abacus-core API Index (v1.0.1)
- Build: unknown
- Java: 17
- Generated: 2026-02-08
Packages
- com.landawn.abacus.annotation
- com.landawn.abacus.eventbus
- com.landawn.abacus.exception
- com.landawn.abacus.guava
- com.landawn.abacus.guava.hash
- com.landawn.abacus.http
- com.landawn.abacus.http.v2
- com.landawn.abacus.logging
- com.landawn.abacus.parser
- com.landawn.abacus.poi
- com.landawn.abacus.pool
- com.landawn.abacus.spring
- com.landawn.abacus.type
- com.landawn.abacus.util
- com.landawn.abacus.util.function
- com.landawn.abacus.util.stream
com.landawn.abacus.annotation
Annotation AccessFieldByMethod (com.landawn.abacus.annotation.AccessFieldByMethod)
Indicates that fields should be accessed via getter/setter methods rather than direct field access.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String
-
Signature:
String value() default "" - Summary: Optional value to specify additional configuration for field access behavior.
-
Parameters:
- (none)
- Returns: the configuration value, empty string by default (which uses standard getter/setter conventions)
Annotation Beta (com.landawn.abacus.annotation.Beta)
Indicates that the annotated API element is in beta stage and subject to change or removal in future versions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Column (com.landawn.abacus.annotation.Column)
Specifies that a field represents a database column in an entity class.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String
-
Signature:
@Deprecated String value() default "" - Summary: Deprecated alias for {@link #name()} .
-
Parameters:
- (none)
- Returns: the column name value
name(...) -> String
-
Signature:
String name() default "" - Summary: The name of the database column this field maps to.
-
Contract:
- If not specified (empty string), the field name is used as the column name.
- <p> Column names should follow the naming conventions of your database system.
-
Parameters:
- (none)
- Returns: the column name, or empty string to use the field name as default
Annotation DiffIgnore (com.landawn.abacus.annotation.DiffIgnore)
Indicates that a field should be excluded from bean difference comparison operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Entity (com.landawn.abacus.annotation.Entity)
Marks a class as a persistent entity that maps to a database table.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String
-
Signature:
@Deprecated String value() default "" - Summary: Deprecated alias for {@link #name()} .
-
Parameters:
- (none)
- Returns: the entity name value
name(...) -> String
-
Signature:
String name() default "" - Summary: The name of the entity, which typically maps to the database table name.
-
Contract:
- If not specified (empty string), the simple class name is used as the entity name.
-
Parameters:
- (none)
- Returns: the entity name, or empty string to use the simple class name as default
Annotation Id (com.landawn.abacus.annotation.Id)
Marks a field or type as representing the primary key (identifier) of an entity.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String\[\]
-
Signature:
String[] value() default {} - Summary: Specifies the column names that form the primary key.
-
Parameters:
- (none)
- Returns: an array of column names forming the primary key; empty array uses the field name for field-level usage
Annotation Immutable (com.landawn.abacus.annotation.Immutable)
Indicates that the annotated type or method is immutable, meaning its state cannot be modified after creation (for types) or that it does not modify any state (for methods).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation IntermediateOp (com.landawn.abacus.annotation.IntermediateOp)
Marks a method as an intermediate operation in stream-like or pipeline processing.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Internal (com.landawn.abacus.annotation.Internal)
Indicates that the annotated element is for internal use only and should not be used by external code or client applications.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation JoinedBy (com.landawn.abacus.annotation.JoinedBy)
Defines join relationships between entities for ORM mapping and data loading.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String\[\]
-
Signature:
String[] value() default {} - Summary: Specifies the join conditions that define how entities are related.
-
Parameters:
- (none)
- Returns: array of join condition strings defining the relationship
Annotation JsonXmlConfig (com.landawn.abacus.annotation.JsonXmlConfig)
Configures JSON and XML serialization/deserialization behavior for the annotated class.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
namingPolicy(...) -> NamingPolicy
-
Signature:
NamingPolicy namingPolicy() default NamingPolicy.CAMEL_CASE - Summary: Specifies the naming policy to use when converting field names during serialization.
-
Contract:
- Specifies the naming policy to use when converting field names during serialization.
-
Parameters:
- (none)
- Returns: the naming policy to apply to field names during serialization
ignoredFields(...) -> String\[\]
-
Signature:
String[] ignoredFields() default {} - Summary: Specifies fields to ignore during serialization/deserialization.
-
Contract:
- <p> This is useful for excluding sensitive data, computed fields, or fields that should not be persisted.
-
Parameters:
- (none)
- Returns: array of field names or regex patterns to exclude from serialization
- See also: String#matches(String)
dateFormat(...) -> String
-
Signature:
String dateFormat() default "" - Summary: Specifies the date format pattern to use for date/time serialization.
-
Contract:
- If empty, the default ISO-8601 format is used.
- <p> The pattern must conform to {@link java.text.SimpleDateFormat} conventions.
-
Parameters:
- (none)
- Returns: the date format pattern, empty string for default ISO-8601 format
- See also: java.text.SimpleDateFormat
timeZone(...) -> String
-
Signature:
String timeZone() default "" - Summary: Specifies the time zone to use for date/time serialization.
-
Contract:
- If empty, the system default time zone is used.
-
Parameters:
- (none)
- Returns: the time zone ID, empty string for system default time zone
- See also: java.util.TimeZone#getTimeZone(String)
numberFormat(...) -> String
-
Signature:
String numberFormat() default "" - Summary: Specifies the number format pattern to use for numeric values during serialization.
-
Contract:
- If empty, numbers are serialized using their default string representation.
-
Parameters:
- (none)
- Returns: the number format pattern, empty string for default representation
- See also: DecimalFormat
enumerated(...) -> EnumType
-
Signature:
EnumType enumerated() default EnumType.NAME - Summary: Specifies how enum values are serialized and deserialized.
-
Parameters:
- (none)
- Returns: the enum serialization strategy
exclusion(...) -> Exclusion
-
Signature:
Exclusion exclusion() default Exclusion.NULL - Summary: Specifies the exclusion policy for field serialization.
-
Contract:
- Determines which fields should be excluded from the serialized output.
-
Parameters:
- (none)
- Returns: the exclusion policy to apply during serialization
- See also: Exclusion
Annotation JsonXmlCreator (com.landawn.abacus.annotation.JsonXmlCreator)
Marks a method or constructor as the preferred creator for JSON/XML deserialization.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation JsonXmlField (com.landawn.abacus.annotation.JsonXmlField)
Configures JSON and XML serialization/deserialization behavior for individual fields.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
name(...) -> String
-
Signature:
String name() default "" - Summary: Specifies the field name to use in JSON/XML serialization.
-
Contract:
- If not specified (empty string), the Java field name is used.
-
Parameters:
- (none)
- Returns: the field name for serialization, empty string for default Java field name
aliases(...) -> String\[\]
-
Signature:
String[] aliases() default {} - Summary: Defines alternative names that can be used during deserialization.
-
Parameters:
- (none)
- Returns: array of alias names for deserialization
type(...) -> String
-
Signature:
String type() default "" - Summary: Specifies the explicit type for field serialization/deserialization.
-
Parameters:
- (none)
- Returns: the explicit type string, empty string for automatic type detection
dateFormat(...) -> String
-
Signature:
String dateFormat() default "" - Summary: Specifies the date format pattern for date/time field serialization.
-
Parameters:
- (none)
- Returns: the date format pattern, empty string for default format
- See also: java.text.SimpleDateFormat, java.time.format.DateTimeFormatter
timeZone(...) -> String
-
Signature:
String timeZone() default "" - Summary: Specifies the time zone for date/time field serialization.
-
Parameters:
- (none)
- Returns: the time zone ID (e.g., "UTC", "America/New_York"), empty string for system default
numberFormat(...) -> String
-
Signature:
String numberFormat() default "" - Summary: Specifies the number format pattern for numeric field serialization.
-
Parameters:
- (none)
- Returns: the number format pattern, empty string for default formatting
- See also: DecimalFormat
enumerated(...) -> EnumType
-
Signature:
EnumType enumerated() default EnumType.NAME - Summary: Specifies how enum values are serialized and deserialized for this field.
-
Parameters:
- (none)
- Returns: the enum serialization strategy
ignore(...) -> boolean
-
Signature:
boolean ignore() default false - Summary: Specifies whether this field should be completely ignored during serialization and deserialization.
-
Contract:
- Specifies whether this field should be completely ignored during serialization and deserialization.
- When set to {@code true} , the field will be excluded from JSON/XML processing.
-
Parameters:
- (none)
- Returns: {@code true} to ignore this field during JSON/XML processing, {@code false} to include it
isJsonRawValue(...) -> boolean
-
Signature:
boolean isJsonRawValue() default false - Summary: Indicates whether the field value should be treated as raw JSON/XML content.
-
Contract:
- Indicates whether the field value should be treated as raw JSON/XML content.
- When {@code true} , the field's string value is inserted directly into the output without additional JSON/XML escaping or formatting.
- <p> This is useful when a field contains pre-serialized JSON/XML that should be embedded as-is in the output.
-
Parameters:
- (none)
- Returns: {@code true} if the field contains raw JSON/XML content, {@code false} for normal processing
direction(...) -> Direction
-
Signature:
Direction direction() default Direction.BOTH - Summary: Controls whether the field is included during serialization, deserialization, or both.
-
Contract:
- <p> <b> Options: </b> </p> <ul> <li> BOTH - Include in both serialization and deserialization (default) </li> <li> SERIALIZE_ONLY - Include only when writing JSON/XML output </li> <li> DESERIALIZE_ONLY - Include only when reading from JSON/XML input </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code public class User { @JsonXmlField(direction = Direction.SERIALIZE_ONLY) private String displayName; // Written to JSON but not read from it @JsonXmlField(direction = Direction.DESERIALIZE_ONLY) private String tempPassword; // Read from JSON but not written to it } } </pre>
-
Parameters:
- (none)
- Returns: the exposure mode for this field
Enum Direction (com.landawn.abacus.annotation.JsonXmlField.Direction)
Defines the exposure levels for field serialization and deserialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation JsonXmlValue (com.landawn.abacus.annotation.JsonXmlValue)
Indicates that the annotated method or field represents the value of an object for JSON/XML serialization and deserialization purposes.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation LazyEvaluation (com.landawn.abacus.annotation.LazyEvaluation)
Indicates that the annotated method or type uses lazy evaluation strategy.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation MayReturnNull (com.landawn.abacus.annotation.MayReturnNull)
Indicates that the annotated method may return {@code null} values under certain conditions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Mutable (com.landawn.abacus.annotation.Mutable)
Indicates that the annotated type or method represents mutable data or operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation NonColumn (com.landawn.abacus.annotation.NonColumn)
Explicitly marks a field as NOT being a database column.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation NonUpdatable (com.landawn.abacus.annotation.NonUpdatable)
Marks a field as non-updatable, excluding it from UPDATE operations while allowing INSERTs.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation NotNull (com.landawn.abacus.annotation.NotNull)
Indicates that the annotated element must not be {@code null} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation NullSafe (com.landawn.abacus.annotation.NullSafe)
Indicates that the annotated element gracefully handles {@code null} values without throwing exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation ParallelSupported (com.landawn.abacus.annotation.ParallelSupported)
Indicates that the annotated method or type supports parallel execution.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation ReadOnly (com.landawn.abacus.annotation.ReadOnly)
Marks a field as read-only for database persistence operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation ReadOnlyId (com.landawn.abacus.annotation.ReadOnlyId)
Marks a field or type as a read-only identifier that should not be modified during persistence operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String\[\]
-
Signature:
String[] value() default {} - Summary: Specifies the column names that form the read-only primary key.
-
Parameters:
- (none)
- Returns: an array of column names forming the read-only identifier; empty array uses the field name for field-level usage
Annotation Record (com.landawn.abacus.annotation.Record)
A test annotation used to mark classes as record-like entities, particularly for testing purposes.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation SequentialOnly (com.landawn.abacus.annotation.SequentialOnly)
Indicates that the annotated method or type must be executed sequentially and does not support parallel execution.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Stateful (com.landawn.abacus.annotation.Stateful)
Marks a class, method, or field as stateful, indicating that it maintains mutable internal state that can change between invocations or over time.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation SuppressFBWarnings (com.landawn.abacus.annotation.SuppressFBWarnings)
Annotation used to suppress FindBugs warnings on annotated program elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String\[\]
-
Signature:
String[] value() default {} - Summary: The set of FindBugs warnings that are to be suppressed in an annotated element.
-
Parameters:
- (none)
- Returns: array of FindBugs warning identifiers to suppress
justification(...) -> String
-
Signature:
String justification() default "" - Summary: Optional documentation of the reason why the warning is suppressed.
-
Contract:
- This field should provide a clear explanation of why suppressing the warning is appropriate.
- <p> <b> Best practices for justifications: </b> </p> <ul> <li> Explain why the warning is a {@code false} positive </li> <li> Describe the intentional design decision </li> <li> Reference external validation or security measures </li> <li> Note if the issue is addressed elsewhere in the codebase </li> </ul> <p> <b> Usage Examples: </b> </p> <ul> <li> "Null check performed by validation framework" </li> <li> "Intentional exposure for API compatibility" </li> <li> "Thread safety guaranteed by external synchronization" </li> <li> "Performance critical code, checked thoroughly in tests" </li> </ul>
-
Parameters:
- (none)
- Returns: the justification for suppressing the warning, empty string if not provided
Annotation Table (com.landawn.abacus.annotation.Table)
Specifies that the annotated class is mapped to a database table.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String
-
Signature:
@Deprecated String value() default "" - Summary: Deprecated alias for {@link #name()} .
-
Parameters:
- (none)
- Returns: the table name value
name(...) -> String
-
Signature:
String name() default "" - Summary: The name of the database table this class maps to.
-
Contract:
- If not specified (empty string), the simple class name is used as the table name.
-
Parameters:
- (none)
- Returns: the table name, or empty string to use the simple class name as default
alias(...) -> String
-
Signature:
String alias() default "" - Summary: An alias for the table that can be used in SQL queries.
-
Contract:
- This provides a shorter reference name for the table, useful in complex queries with joins, subqueries, or when the table name is long.
-
Parameters:
- (none)
- Returns: the table alias, or empty string if no alias is defined
columnFields(...) -> String\[\]
-
Signature:
String[] columnFields() default {} - Summary: Specifies an explicit whitelist of fields that should be mapped to table columns.
-
Contract:
- Specifies an explicit whitelist of fields that should be mapped to table columns.
- When specified, ONLY these fields will be considered for column mapping, regardless of other annotations or conventions.
-
Parameters:
- (none)
- Returns: an array of field names to include as columns, empty array means no whitelist filtering
nonColumnFields(...) -> String\[\]
-
Signature:
String[] nonColumnFields() default {} - Summary: Specifies a blacklist of fields that should NOT be mapped to table columns.
-
Contract:
- Specifies a blacklist of fields that should NOT be mapped to table columns.
- <p> <b> Common exclusions: </b> </p> <ul> <li> Calculated or derived fields </li> <li> Temporary state or cache fields </li> <li> Framework-specific metadata </li> <li> Fields mapped to other tables (relationships) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code @Table(name = "products", nonColumnFields = {"displayPrice", "cache", "dirty"}) public class Product { private Long id; // Mapped private String name; // Mapped private BigDecimal price; // Mapped private String displayPrice; // Not mapped - calculated field private Map<String, Object> cache; // Not mapped - temporary cache private boolean dirty; // Not mapped - state tracking } } </pre> <p> <b> Note: </b> If both columnFields and nonColumnFields are specified, columnFields takes precedence (whitelist wins over blacklist).
-
Parameters:
- (none)
- Returns: an array of field names to exclude from column mapping, empty array means no blacklist filtering
Annotation TerminalOp (com.landawn.abacus.annotation.TerminalOp)
Marks a method as a terminal operation in stream-like or pipeline processing.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation TerminalOpTriggered (com.landawn.abacus.annotation.TerminalOpTriggered)
Marks methods where intermediate operations trigger terminal operations internally, resulting in the closure of the current stream and the creation of a new stream.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Test (com.landawn.abacus.annotation.Test)
Marks elements that are intended for testing purposes only and should not be used in production code.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Transient (com.landawn.abacus.annotation.Transient)
Marks a field as transient, indicating it should be excluded from persistence operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation Type (com.landawn.abacus.annotation.Type)
Specifies custom type handling for fields or methods during serialization and persistence operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> String
-
Signature:
@Deprecated String value() default "" - Summary: Deprecated alias for {@link #name()} .
-
Parameters:
- (none)
- Returns: the type name value, or empty string if not specified
name(...) -> String
-
Signature:
String name() default "" - Summary: Specifies the type name to use for type conversion.
-
Contract:
- This should match a registered type name in the type factory.
-
Parameters:
- (none)
- Returns: the type name, or empty string to use default type handling
clazz(...) -> Class<? extends com.landawn.abacus.type.Type>
-
Signature:
@SuppressWarnings("rawtypes") Class<? extends com.landawn.abacus.type.Type> clazz() default com.landawn.abacus.type.Type.class - Summary: Specifies a custom Type class to handle value conversion.
-
Contract:
- The specified class must extend {@link com.landawn.abacus.type.Type} and implement the necessary conversion methods.
- The custom type class should: </p> <ul> <li> Have a no-argument constructor </li> <li> Override the necessary conversion methods </li> <li> Be thread-safe if used in concurrent contexts </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code public class EncryptedStringType extends Type<String> { @Override public String valueOf(String value) { return decrypt(value); } @Override public String stringOf(String value) { return encrypt(value); } } @Type(clazz = EncryptedStringType.class) private String sensitiveData; } </pre>
-
Parameters:
- (none)
- Returns: the custom Type implementation class, or base Type.class for default handling
enumerated(...) -> EnumType
-
Signature:
EnumType enumerated() default EnumType.NAME - Summary: Specifies how enum values should be represented during conversion.
-
Contract:
- Specifies how enum values should be represented during conversion.
- <p> <b> EnumType.NAME (default): </b> </p> <ul> <li> Uses the enum constant name as a string </li> <li> More readable and maintainable </li> <li> Resilient to enum reordering </li> <li> Larger storage size </li> </ul> <p> <b> EnumType.ORDINAL: </b> </p> <ul> <li> Uses the enum ordinal position as an integer </li> <li> Smaller storage size </li> <li> Fragile - breaks if enum order changes </li> <li> Less readable in raw data </li> </ul> <p> <b> EnumType.CODE: </b> </p> <ul> <li> Uses a predefined integer code from the enum (for example, via {@code public int code()} ) </li> <li> Compact representation with stable code values </li> <li> Requires the enum to expose consistent code values </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code public enum Priority { LOW, MEDIUM, HIGH, URGENT } // Using NAME (default) - stored as "LOW", "MEDIUM", etc.
-
Parameters:
- (none)
- Returns: the enum representation strategy, defaults to EnumType.NAME
scope(...) -> Scope
-
Signature:
Scope scope() default Scope.ALL - Summary: Specifies the scope where this type conversion should apply.
-
Contract:
- Specifies the scope where this type conversion should apply.
-
Parameters:
- (none)
- Returns: the scope of type conversion, defaults to Scope.ALL
Enum Scope (com.landawn.abacus.annotation.Type.Scope)
Defines the operational contexts where custom type conversion should be applied.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Annotation UnsupportedOperation (com.landawn.abacus.annotation.UnsupportedOperation)
Marks methods that represent unsupported operations in an implementation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
com.landawn.abacus.eventbus
Class EventBus (com.landawn.abacus.eventbus.EventBus)
EventBus is a publish-subscribe event bus that simplifies communication between components.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getDefault(...) -> EventBus
-
Signature:
@SuppressFBWarnings("MS_EXPOSE_REP") public static EventBus getDefault() - Summary: Returns the default EventBus instance.
-
Parameters:
- (none)
- Returns: the default EventBus instance
Public Instance Methods
<init>(...) -> void
-
Signature:
@SuppressFBWarnings("SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR") public EventBus() - Summary: Creates a new EventBus instance with a randomly generated identifier.
-
Parameters:
- (none)
-
Signature:
public EventBus(final String identifier) - Summary: Creates a new EventBus instance with the specified identifier.
-
Parameters:
-
identifier(String) — the unique identifier for this EventBus instance
-
-
Signature:
public EventBus(final String identifier, final Executor executor) - Summary: Creates a new EventBus instance with the specified identifier and executor.
-
Contract:
- The executor is used for asynchronous event delivery when ThreadMode.THREAD_POOL_EXECUTOR is specified.
- If the executor is an ExecutorService, a shutdown hook will be registered to properly shutdown the executor.
-
Parameters:
-
identifier(String) — the unique identifier for this EventBus instance -
executor(Executor) — the executor to use for asynchronous event delivery, or {@code null} to use the default executor
-
identifier(...) -> String
-
Signature:
public String identifier() - Summary: Returns the unique identifier of this EventBus instance.
-
Parameters:
- (none)
- Returns: the identifier of this EventBus
getSubscribers(...) -> List<Object>
-
Signature:
public List<Object> getSubscribers(final Class<?> eventType) - Summary: Returns all subscribers that are registered to receive events of the specified type or its subtypes.
-
Parameters:
-
eventType(Class<?>) — the event type to search for
-
- Returns: a list of subscribers registered for the specified event type
-
Signature:
public List<Object> getSubscribers(final String eventId, final Class<?> eventType) - Summary: Returns all subscribers that are registered to receive events of the specified type and event ID.
-
Contract:
- The method checks both the event type hierarchy and the event ID when searching for subscribers.
-
Parameters:
-
eventId(String) — the event ID to match, or {@code null} for subscribers without event ID -
eventType(Class<?>) — the event type to search for
-
- Returns: a list of subscribers registered for the specified event type and ID
getAllSubscribers(...) -> List<Object>
-
Signature:
public List<Object> getAllSubscribers() - Summary: Returns all currently registered subscribers in this EventBus.
-
Parameters:
- (none)
- Returns: a list of all registered subscribers
register(...) -> EventBus
-
Signature:
public EventBus register(final Object subscriber) - Summary: Registers a subscriber to receive events.
-
Contract:
- The subscriber must either implement the {@link Subscriber} interface or have methods annotated with {@link Subscribe} .
-
Parameters:
-
subscriber(Object) — the subscriber to register
-
- Returns: this EventBus instance for method chaining
-
Signature:
public EventBus register(final Object subscriber, final String eventId) - Summary: Registers a subscriber with a specific event ID.
-
Parameters:
-
subscriber(Object) — the subscriber to register -
eventId(String) — the event ID to filter events
-
- Returns: this EventBus instance for method chaining
-
Signature:
public EventBus register(final Object subscriber, final ThreadMode threadMode) - Summary: Registers a subscriber with a specific thread mode.
-
Parameters:
-
subscriber(Object) — the subscriber to register -
threadMode(ThreadMode) — the thread mode for event delivery
-
- Returns: this EventBus instance for method chaining
-
Signature:
public EventBus register(final Object subscriber, final String eventId, final ThreadMode threadMode) - Summary: Registers a subscriber with both event ID and thread mode specifications.
-
Contract:
- If the subscriber has sticky event handling enabled, it will immediately receive any matching sticky events.
-
Parameters:
-
subscriber(Object) — the subscriber to register -
eventId(String) — the event ID to filter events, or {@code null} for no filtering -
threadMode(ThreadMode) — the thread mode for event delivery, or {@code null} for default
-
- Returns: this EventBus instance for method chaining
-
Signature:
public <T> EventBus register(final Subscriber<T> subscriber, final String eventId) - Summary: Registers a Subscriber interface implementation with a specific event ID.
-
Parameters:
-
subscriber(Subscriber<T>) — the Subscriber implementation to register -
eventId(String) — the event ID to filter events (required for lambda subscribers)
-
- Returns: this EventBus instance for method chaining
-
Signature:
public <T> EventBus register(final Subscriber<T> subscriber, final String eventId, final ThreadMode threadMode) - Summary: Registers a Subscriber interface implementation with both event ID and thread mode.
-
Parameters:
-
subscriber(Subscriber<T>) — the Subscriber implementation to register -
eventId(String) — the event ID to filter events (required for lambda subscribers) -
threadMode(ThreadMode) — the thread mode for event delivery
-
- Returns: this EventBus instance for method chaining
unregister(...) -> EventBus
-
Signature:
public EventBus unregister(final Object subscriber) - Summary: Unregisters a previously registered subscriber.
-
Contract:
- This method should be called when a subscriber is no longer needed to prevent memory leaks.
-
Parameters:
-
subscriber(Object) — the subscriber to unregister
-
- Returns: this EventBus instance for method chaining
post(...) -> EventBus
-
Signature:
public EventBus post(final Object event) - Summary: Posts an event to all registered subscribers.
-
Parameters:
-
event(Object) — the event to post
-
- Returns: this EventBus instance for method chaining
-
Signature:
public EventBus post(final String eventId, final Object event) - Summary: Posts an event with a specific event ID.
-
Parameters:
-
eventId(String) — the event ID for filtering subscribers, or {@code null} for no filtering -
event(Object) — the event to post
-
- Returns: this EventBus instance for method chaining
postSticky(...) -> EventBus
-
Signature:
public EventBus postSticky(final Object event) - Summary: Posts a sticky event that will be retained and delivered to future subscribers.
-
Parameters:
-
event(Object) — the sticky event to post
-
- Returns: this EventBus instance for method chaining
-
Signature:
public EventBus postSticky(final String eventId, final Object event) - Summary: Posts a sticky event with a specific event ID.
-
Parameters:
-
eventId(String) — the event ID for filtering subscribers -
event(Object) — the sticky event to post
-
- Returns: this EventBus instance for method chaining
removeStickyEvent(...) -> boolean
-
Signature:
public boolean removeStickyEvent(final Object event) - Summary: Removes a sticky event that was posted without an event ID.
-
Parameters:
-
event(Object) — the sticky event to remove
-
- Returns: {@code true} if the event was removed, {@code false} otherwise
-
Signature:
public boolean removeStickyEvent(final String eventId, final Object event) - Summary: Removes a sticky event that was posted with a specific event ID.
-
Contract:
- The event will only be removed if both the event object and event ID match.
-
Parameters:
-
eventId(String) — the event ID the sticky event was posted with -
event(Object) — the sticky event to remove
-
- Returns: {@code true} if the event was removed, {@code false} otherwise
removeStickyEvents(...) -> boolean
-
Signature:
public boolean removeStickyEvents(final Class<?> eventType) - Summary: Removes all sticky events of a specific type that were posted without an event ID.
-
Parameters:
-
eventType(Class<?>) — the class type of sticky events to remove
-
- Returns: {@code true} if one or more events were removed, {@code false} otherwise
-
Signature:
public boolean removeStickyEvents(final String eventId, final Class<?> eventType) - Summary: Removes all sticky events of a specific type that were posted with the specified event ID.
-
Parameters:
-
eventId(String) — the event ID to match, or {@code null} for events without ID -
eventType(Class<?>) — the class type of sticky events to remove
-
- Returns: {@code true} if one or more events were removed, {@code false} otherwise
removeAllStickyEvents(...) -> void
-
Signature:
public void removeAllStickyEvents() - Summary: Removes all sticky events from this EventBus.
-
Parameters:
- (none)
getStickyEvents(...) -> List<Object>
-
Signature:
public List<Object> getStickyEvents(final Class<?> eventType) - Summary: Returns all sticky events of a specific type that were posted without an event ID.
-
Parameters:
-
eventType(Class<?>) — the class type to search for
-
- Returns: a list of sticky events that can be assigned to the specified type
-
Signature:
public List<Object> getStickyEvents(final String eventId, final Class<?> eventType) - Summary: Returns all sticky events of a specific type that were posted with the specified event ID.
-
Parameters:
-
eventId(String) — the event ID to match, or {@code null} for events without ID -
eventType(Class<?>) — the class type to search for
-
- Returns: a list of sticky events matching both the type and event ID
Annotation Subscribe (com.landawn.abacus.eventbus.Subscribe)
Annotation to mark methods as event subscribers in the EventBus system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
threadMode(...) -> ThreadMode
-
Signature:
ThreadMode threadMode() default ThreadMode.DEFAULT - Summary: Specifies the thread mode for event delivery.
-
Parameters:
- (none)
- Returns: the thread mode for event delivery
strictEventType(...) -> boolean
-
Signature:
boolean strictEventType() default false - Summary: Controls whether the subscriber accepts only exact event type matches or includes subtypes.
-
Contract:
- <p> When set to {@code true} , only events of the exact parameter type will be delivered.
- When {@code false} (default), events of the parameter type and all its subtypes will be delivered.
-
Parameters:
- (none)
- Returns: {@code true} to accept only exact type matches, {@code false} to accept subtypes
sticky(...) -> boolean
-
Signature:
boolean sticky() default false - Summary: Indicates whether this subscriber should receive the most recent sticky event upon registration.
-
Contract:
- Indicates whether this subscriber should receive the most recent sticky event upon registration.
- <p> When {@code true} , if a sticky event matching this subscriber's type and event ID was previously posted, it will be immediately delivered to this subscriber upon registration.
-
Parameters:
- (none)
- Returns: {@code true} to receive sticky events upon registration
eventId(...) -> String
-
Signature:
String eventId() default "" - Summary: Specifies an event ID to filter incoming events.
-
Contract:
- <p> If empty (default), the subscriber will receive events based on type matching alone, unless it was registered with a specific event ID.
-
Parameters:
- (none)
- Returns: the event ID to filter on, or empty string for no filtering
intervalMillis(...) -> long
-
Signature:
long intervalMillis() default 0 - Summary: Specifies the minimum time interval (in milliseconds) between event deliveries.
-
Parameters:
- (none)
- Returns: the minimum interval between events in milliseconds, 0 for no throttling
deduplicate(...) -> boolean
-
Signature:
boolean deduplicate() default false - Summary: Controls whether duplicate consecutive events should be ignored.
-
Contract:
- Controls whether duplicate consecutive events should be ignored.
- <p> When {@code true} , if an event equal to the previous event is posted, it will be ignored.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code @Subscribe(deduplicate = true) public void onTemperature(Temperature temp) { // If temperature hasn't changed, event is ignored updateThermostat(temp.getValue()); } @Subscribe(deduplicate = true) public void onConfigChange(Config config) { // Only processes when configuration actually changes applyNewConfiguration(config); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} to ignore duplicate consecutive events
Interface Subscriber (com.landawn.abacus.eventbus.Subscriber)
A functional interface for implementing event subscribers in the EventBus system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
on(...) -> void
-
Signature:
void on(E event) - Summary: Called when an event of type E is posted to the EventBus.
-
Contract:
- Called when an event of type E is posted to the EventBus.
- This method will be invoked by the EventBus when a matching event is posted.
- <p> The method will be called on the thread specified during registration, or on the posting thread if no thread mode was specified.
- </p> <p> Implementations should handle the event appropriately and should not throw unchecked exceptions.
-
Parameters:
-
event(E) — the event instance posted to the EventBus. Never {@code null} .
-
com.landawn.abacus.exception
Class DuplicatedResultException (com.landawn.abacus.exception.DuplicatedResultException)
Exception thrown when an operation that expects a unique result encounters duplicate results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public DuplicatedResultException() - Summary: Constructs a new {@code DuplicatedResultException} with no detail message.
-
Parameters:
- (none)
-
Signature:
public DuplicatedResultException(final String message) - Summary: Constructs a new {@code DuplicatedResultException} with the specified detail message.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
-
-
Signature:
public DuplicatedResultException(final String message, final Throwable cause) - Summary: Constructs a new {@code DuplicatedResultException} with the specified detail message and cause.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
-
Signature:
public DuplicatedResultException(final Throwable cause) - Summary: Constructs a new {@code DuplicatedResultException} with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of {@code cause} ).
-
Parameters:
-
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
Class ObjectNotFoundException (com.landawn.abacus.exception.ObjectNotFoundException)
Exception thrown when an expected object cannot be found.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ObjectNotFoundException() - Summary: Constructs a new {@code ObjectNotFoundException} with no detail message.
-
Parameters:
- (none)
-
Signature:
public ObjectNotFoundException(final String message) - Summary: Constructs a new {@code ObjectNotFoundException} with the specified detail message.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
-
-
Signature:
public ObjectNotFoundException(final String message, final Throwable cause) - Summary: Constructs a new {@code ObjectNotFoundException} with the specified detail message and cause.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
-
Signature:
public ObjectNotFoundException(final Throwable cause) - Summary: Constructs a new {@code ObjectNotFoundException} with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of {@code cause} ).
-
Parameters:
-
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
Class ParsingException (com.landawn.abacus.exception.ParsingException)
Exception thrown when a parsing operation fails.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ParsingException() - Summary: Constructs a new {@code ParsingException} with no detail message.
-
Parameters:
- (none)
-
Signature:
public ParsingException(final String message) - Summary: Constructs a new {@code ParsingException} with the specified detail message.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
-
-
Signature:
public ParsingException(final int errorToken, final String message) - Summary: Constructs a new {@code ParsingException} with the specified token and detail message.
-
Contract:
- This constructor is useful when you want to indicate the specific token or position where the parsing error occurred.
-
Parameters:
-
errorToken(int) — an integer value representing the token, position, or error code where the parsing failed. This value can be retrieved later using {@link #getErrorToken()} . -
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
-
-
Signature:
public ParsingException(final String message, final Throwable cause) - Summary: Constructs a new {@code ParsingException} with the specified detail message and cause.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
-
Signature:
public ParsingException(final Throwable cause) - Summary: Constructs a new {@code ParsingException} with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of {@code cause} ).
-
Parameters:
-
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
getErrorToken(...) -> int
-
Signature:
public int getErrorToken() - Summary: Returns the token value associated with this parsing exception.
-
Contract:
- The token can represent various things depending on the context: <ul> <li> The position in the input where parsing failed </li> <li> The type of token that caused the error </li> <li> An error code specific to the parser </li> <li> -2 if no token was specified (default value) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code try { parseExpression(input); } catch (ParsingException e) { System.err.println("Parse error at token: " + e.getErrorToken()); } } </pre>
-
Parameters:
- (none)
- Returns: the token value where the parsing error occurred, or -2 if not specified
Class TooManyElementsException (com.landawn.abacus.exception.TooManyElementsException)
Exception thrown when an operation encounters more elements than expected or allowed.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public TooManyElementsException() - Summary: Constructs a new {@code TooManyElementsException} with no detail message.
-
Parameters:
- (none)
-
Signature:
public TooManyElementsException(final String message) - Summary: Constructs a new {@code TooManyElementsException} with the specified detail message.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
-
-
Signature:
public TooManyElementsException(final String message, final Throwable cause) - Summary: Constructs a new {@code TooManyElementsException} with the specified detail message and cause.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
-
Signature:
public TooManyElementsException(final Throwable cause) - Summary: Constructs a new {@code TooManyElementsException} with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of {@code cause} ).
-
Parameters:
-
cause(Throwable) — the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
-
Class UncheckedException (com.landawn.abacus.exception.UncheckedException)
A runtime exception that wraps checked exceptions, allowing them to be thrown without being declared.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedException(final Throwable cause) - Summary: Constructs a new {@code UncheckedException} by wrapping the specified checked exception.
-
Parameters:
-
cause(Throwable) — the checked exception to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedException(final String message, final Throwable cause) - Summary: Constructs a new {@code UncheckedException} with the specified detail message and checked exception.
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(Throwable) — the checked exception to wrap. Must not be {@code null} .
-
Class UncheckedExecutionException (com.landawn.abacus.exception.UncheckedExecutionException)
A runtime exception that wraps {@link ExecutionException} , allowing thread interruption exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedExecutionException(final ExecutionException cause) - Summary: Constructs a new {@code UncheckedExecutionException} by wrapping the specified {@link ExecutionException} .
-
Contract:
- </p> <p> <strong> Note: </strong> Remember to restore the thread's interrupted status before throwing this exception if the interruption hasn't been fully handled: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code catch (ExecutionException e) { Thread.currentThread().interrupt(); // Restore interrupted status throw new UncheckedExecutionException(e); } } </pre>
-
Parameters:
-
cause(ExecutionException) — the {@link ExecutionException} to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedExecutionException(final String message, final ExecutionException cause) - Summary: Constructs a new {@code UncheckedExecutionException} with the specified detail message and {@link ExecutionException} .
-
Contract:
- </p> <p> <strong> Note: </strong> Remember to restore the thread's interrupted status before throwing this exception if the interruption hasn't been fully handled: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code catch (ExecutionException e) { Thread.currentThread().interrupt(); // Restore interrupted status throw new UncheckedExecutionException("Interrupted while waiting for resource", e); } } </pre>
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(ExecutionException) — the {@link ExecutionException} to wrap. Must not be {@code null} .
-
Class UncheckedIOException (com.landawn.abacus.exception.UncheckedIOException)
A runtime exception that wraps {@link IOException} , allowing I/O exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedIOException(final IOException cause) - Summary: Constructs a new {@code UncheckedIOException} by wrapping the specified {@link IOException} .
-
Parameters:
-
cause(IOException) — the {@link IOException} to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedIOException(final String message, final IOException cause) - Summary: Constructs a new {@code UncheckedIOException} with the specified detail message and {@link IOException} .
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(IOException) — the {@link IOException} to wrap. Must not be {@code null} .
-
getCause(...) -> IOException
-
Signature:
@Override public synchronized IOException getCause() -
Parameters:
- (none)
- Returns: unspecified
Class UncheckedInterruptedException (com.landawn.abacus.exception.UncheckedInterruptedException)
A runtime exception that wraps {@link InterruptedException} , allowing thread interruption exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedInterruptedException(final InterruptedException cause) - Summary: Constructs a new {@code UncheckedInterruptedException} by wrapping the specified {@link InterruptedException} .
-
Contract:
- </p> <p> <strong> Note: </strong> Remember to restore the thread's interrupted status before throwing this exception if the interruption hasn't been fully handled: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code catch (InterruptedException e) { Thread.currentThread().interrupt(); // Restore interrupted status throw new UncheckedInterruptedException(e); } } </pre>
-
Parameters:
-
cause(InterruptedException) — the {@link InterruptedException} to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedInterruptedException(final String message, final InterruptedException cause) - Summary: Constructs a new {@code UncheckedInterruptedException} with the specified detail message and {@link InterruptedException} .
-
Contract:
- </p> <p> <strong> Note: </strong> Remember to restore the thread's interrupted status before throwing this exception if the interruption hasn't been fully handled: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code catch (InterruptedException e) { Thread.currentThread().interrupt(); // Restore interrupted status throw new UncheckedInterruptedException("Interrupted while waiting for resource", e); } } </pre>
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(InterruptedException) — the {@link InterruptedException} to wrap. Must not be {@code null} .
-
Class UncheckedParseException (com.landawn.abacus.exception.UncheckedParseException)
A runtime exception that wraps {@link java.text.ParseException} , allowing parsing exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedParseException(final java.text.ParseException cause) - Summary: Constructs a new {@code UncheckedParseException} by wrapping the specified {@link java.text.ParseException} .
-
Parameters:
-
cause(java.text.ParseException) — the {@link java.text.ParseException} to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedParseException(final String message, final java.text.ParseException cause) - Summary: Constructs a new {@code UncheckedParseException} with the specified detail message and {@link java.text.ParseException} .
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(java.text.ParseException) — the {@link java.text.ParseException} to wrap. Must not be {@code null} .
-
Class UncheckedReflectiveOperationException (com.landawn.abacus.exception.UncheckedReflectiveOperationException)
A runtime exception that wraps {@link ReflectiveOperationException} and its subclasses, allowing reflection exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedReflectiveOperationException(final ReflectiveOperationException cause) - Summary: Constructs a new {@code UncheckedReflectiveOperationException} by wrapping the specified {@link ReflectiveOperationException} or any of its subclasses.
-
Parameters:
-
cause(ReflectiveOperationException) — the {@link ReflectiveOperationException} to wrap. Must not be {@code null} . This can be any subclass of ReflectiveOperationException including ClassNotFoundException, NoSuchMethodException, IllegalAccessException, etc.
-
-
Signature:
public UncheckedReflectiveOperationException(final String message, final ReflectiveOperationException cause) - Summary: Constructs a new {@code UncheckedReflectiveOperationException} with the specified detail message and {@link ReflectiveOperationException} .
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(ReflectiveOperationException) — the {@link ReflectiveOperationException} to wrap. Must not be {@code null} . This can be any subclass of ReflectiveOperationException.
-
Class UncheckedSQLException (com.landawn.abacus.exception.UncheckedSQLException)
A runtime exception that wraps {@link SQLException} , allowing SQL exceptions to be thrown without being declared in method signatures.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public UncheckedSQLException(final SQLException cause) - Summary: Constructs a new {@code UncheckedSQLException} by wrapping the specified {@link SQLException} .
-
Parameters:
-
cause(SQLException) — the {@link SQLException} to wrap. Must not be {@code null} .
-
-
Signature:
public UncheckedSQLException(final String message, final SQLException cause) - Summary: Constructs a new {@code UncheckedSQLException} with the specified detail message and {@link SQLException} .
-
Parameters:
-
message(String) — the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. -
cause(SQLException) — the {@link SQLException} to wrap. Must not be {@code null} .
-
getSQLState(...) -> String
-
Signature:
@MayReturnNull public String getSQLState() - Summary: Retrieves the SQL state string from the underlying SQLException.
-
Contract:
- Common SQL states include: </p> <ul> <li> 08xxx - Connection exceptions </li> <li> 22xxx - Data exceptions </li> <li> 23xxx - Constraint violations </li> <li> 40xxx - Transaction rollback </li> <li> 42xxx - Syntax errors or access violations </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code try { // database operation } catch (UncheckedSQLException e) { if ("23505".equals(e.getSQLState())) { // Handle unique constraint violation } } } </pre>
-
Parameters:
- (none)
- Returns: the SQL state string from the wrapped SQLException, or {@code null} if not available
- See also: SQLException#getSQLState()
getErrorCode(...) -> int
-
Signature:
public int getErrorCode() - Summary: Retrieves the vendor-specific error code from the underlying SQLException.
-
Contract:
- </p> <p> Common uses include: </p> <ul> <li> Identifying specific database constraint violations </li> <li> Detecting known database-specific errors for specialized handling </li> <li> Detailed logging of database operations </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code try { // Perform database operation } catch (UncheckedSQLException e) { // Oracle error code 1 is "unique constraint violated" if (e.getErrorCode() == 1) { // Handle duplicate key violation } // Log with both general and specific error information logger.error("Database error: state={}, code={}", e.getSQLState(), e.getErrorCode()); } } </pre>
-
Parameters:
- (none)
- Returns: the vendor-specific error code from the wrapped SQLException
- See also: #getSQLState(), SQLException#getErrorCode()
getCause(...) -> SQLException
-
Signature:
@Override public synchronized SQLException getCause() -
Parameters:
- (none)
- Returns: unspecified
com.landawn.abacus.guava
Class Files (com.landawn.abacus.guava.Files)
A comprehensive file manipulation utility class that provides unified file operations by wrapping and extending Google Guava's file utilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
newReader(...) -> BufferedReader
-
Signature:
public static BufferedReader newReader(final File file, final Charset charset) throws FileNotFoundException - Summary: Returns a buffered reader that reads from a file using the given character set.
-
Contract:
- The reader should be closed after use to release system resources.
-
Parameters:
-
file(File) — the file to read from. -
charset(Charset) — the charset used to decode the input stream (see {@link StandardCharsets} for helpful predefined constants).
-
- Returns: a BufferedReader instance for reading from the file.
-
Throws:
-
java.io.FileNotFoundException— if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
-
newWriter(...) -> BufferedWriter
-
Signature:
public static BufferedWriter newWriter(final File file, final Charset charset) throws FileNotFoundException - Summary: Returns a buffered writer that writes to a file using the given character set.
-
Contract:
- If the file already exists, it will be overwritten.
- If the file does not exist, it will be created.
- The writer should be closed after use to ensure all data is written and to release system resources.
-
Parameters:
-
file(File) — the file to write to -
charset(Charset) — the charset used to encode the output stream (see {@link StandardCharsets} for helpful predefined constants)
-
- Returns: a BufferedWriter instance for writing to the file
-
Throws:
-
java.io.FileNotFoundException— if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
-
asByteSource(...) -> ByteSource
-
Signature:
public static ByteSource asByteSource(final File file) - Summary: Returns a new {@link ByteSource} for reading bytes from the given file.
-
Contract:
- The file is opened when methods on the returned ByteSource are called.
-
Parameters:
-
file(File) — the file to create a ByteSource for
-
- Returns: a ByteSource that reads from the given file
-
Signature:
public static ByteSource asByteSource(final Path path, final OpenOption... options) - Summary: Returns a view of the given {@code path} as a {@link ByteSource} .
-
Contract:
- <p> Any {@linkplain OpenOption open options} provided are used when opening streams to the file and may affect the behavior of the returned source and the streams it provides.
-
Parameters:
-
path(Path) — the path to create a ByteSource for -
options(OpenOption[]) — zero or more open options that control how the file is opened
-
- Returns: a ByteSource that reads from the given path
asByteSink(...) -> ByteSink
-
Signature:
public static ByteSink asByteSink(final File file, final FileWriteMode... modes) - Summary: Returns a new {@link ByteSink} for writing bytes to the given file.
-
Contract:
- When no mode is provided, the file will be truncated before writing.
- When the {@link FileWriteMode#APPEND APPEND} mode is provided, writes will append to the end of the file without truncating it.
- The file is opened when methods on the returned ByteSink are called.
-
Parameters:
-
file(File) — the file to create a ByteSink for -
modes(FileWriteMode[]) — optional file write modes; if empty, the file will be truncated
-
- Returns: a ByteSink that writes to the given file
-
Signature:
public static ByteSink asByteSink(final Path path, final OpenOption... options) - Summary: Returns a view of the given {@code path} as a {@link ByteSink} .
-
Contract:
- <p> Any {@linkplain OpenOption open options} provided are used when opening streams to the file and may affect the behavior of the returned sink and the streams it provides.
-
Parameters:
-
path(Path) — the path to create a ByteSink for. -
options(OpenOption[]) — zero or more open options that control how the file is opened.
-
- Returns: a ByteSink that writes to the given path.
asCharSource(...) -> CharSource
-
Signature:
public static CharSource asCharSource(final File file, final Charset charset) - Summary: Returns a new {@link CharSource} for reading character data from the given file using the given character set.
-
Contract:
- The file is opened when methods on the returned CharSource are called.
-
Parameters:
-
file(File) — the file to create a CharSource for. -
charset(Charset) — the character set to use when reading the file.
-
- Returns: a CharSource that reads from the given file using the specified charset.
-
Signature:
public static CharSource asCharSource(final Path path, final Charset charset, final OpenOption... options) - Summary: Returns a view of the given {@code path} as a {@link CharSource} using the given {@code charset} .
-
Contract:
- <p> Any {@linkplain OpenOption open options} provided are used when opening streams to the file and may affect the behavior of the returned source and the streams it provides.
-
Parameters:
-
path(Path) — the path to create a CharSource for. -
charset(Charset) — the character set to use when reading the file. -
options(OpenOption[]) — zero or more open options that control how the file is opened.
-
- Returns: a CharSource that reads from the given path using the specified charset.
asCharSink(...) -> CharSink
-
Signature:
public static CharSink asCharSink(final File file, final Charset charset, final FileWriteMode... modes) - Summary: Returns a new {@link CharSink} for writing character data to the given file using the given character set.
-
Contract:
- When no mode is provided, the file will be truncated before writing.
- When the {@link FileWriteMode#APPEND APPEND} mode is provided, writes will append to the end of the file without truncating it.
- The file is opened when methods on the returned CharSink are called.
-
Parameters:
-
file(File) — the file to create a CharSink for. -
charset(Charset) — the character set to use when writing to the file. -
modes(FileWriteMode[]) — optional file write modes; if empty, the file will be truncated.
-
- Returns: a CharSink that writes to the given file using the specified charset.
-
Signature:
public static CharSink asCharSink(final Path path, final Charset charset, final OpenOption... options) - Summary: Returns a view of the given {@code path} as a {@link CharSink} using the given {@code charset} .
-
Contract:
- <p> Any {@linkplain OpenOption open options} provided are used when opening streams to the file and may affect the behavior of the returned sink and the streams it provides.
-
Parameters:
-
path(Path) — the path to create a CharSink for. -
charset(Charset) — the character set to use when writing to the file. -
options(OpenOption[]) — zero or more open options that control how the file is opened.
-
- Returns: a CharSink that writes to the given path using the specified charset.
toByteArray(...) -> byte\[\]
-
Signature:
public static byte[] toByteArray(final File file) throws IOException - Summary: Reads all bytes from a file into a byte array.
-
Contract:
- This method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.
-
Parameters:
-
file(File) — the file to read.
-
- Returns: a byte array containing all bytes from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading the file.
-
write(...) -> void
-
Signature:
public static void write(final byte[] from, final File to) throws IOException - Summary: Overwrites a file with the contents of a byte array.
-
Contract:
- If the file already exists, it will be overwritten.
- If the file does not exist, it will be created along with any necessary parent directories.
-
Parameters:
-
from(byte[]) — the byte array containing data to write to the file. -
to(File) — the destination file to write to.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing to the file.
-
equal(...) -> boolean
-
Signature:
public static boolean equal(final File file1, final File file2) throws IOException - Summary: Returns {@code true} if the given files exist, are not directories, and contain the same bytes.
-
Contract:
- Returns {@code true} if the given files exist, are not directories, and contain the same bytes.
- <p> <b> Usage Examples: </b> </p> <pre> {@code boolean identical = Files.equal(new File("file1.txt"), new File("file2.txt")); if (identical) { System.out.println("Files are identical"); } } </pre>
-
Parameters:
-
file1(File) — the first file to compare. -
file2(File) — the second file to compare.
-
- Returns: {@code true} if the files contain the same bytes, {@code false} otherwise.
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading either file.
-
-
Signature:
public static boolean equal(final Path path1, final Path path2) throws IOException - Summary: Returns {@code true} if the files located by the given paths exist, are not directories, and contain the same bytes.
-
Contract:
- Returns {@code true} if the files located by the given paths exist, are not directories, and contain the same bytes.
-
Parameters:
-
path1(Path) — the first path to compare. -
path2(Path) — the second path to compare.
-
- Returns: {@code true} if the files contain the same bytes, {@code false} otherwise.
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading either file.
-
touch(...) -> void
-
Signature:
public static void touch(final File file) throws IOException - Summary: Creates an empty file or updates the last updated timestamp on the same as the unix command of the same name.
-
Contract:
- If the file already exists, its last modified time will be updated to the current time.
- If the file does not exist, an empty file will be created.
- <p> This method creates parent directories if necessary.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("timestamp.txt"); Files.touch(file); // File now exists (if it didn't) and has current timestamp } </pre>
-
Parameters:
-
file(File) — the file to create or update.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while creating or updating the file.
-
-
Signature:
public static void touch(final Path path) throws IOException - Summary: Like the unix command of the same name, creates an empty file or updates the last modified timestamp of the existing file at the given path to the current system time.
-
Contract:
- If the file already exists, its last modified time will be updated.
- If the file does not exist, an empty file will be created.
- <p> This method creates parent directories if necessary.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Path path = Paths.get("timestamp.txt"); Files.touch(path); // File now exists (if it didn't) and has current timestamp } </pre>
-
Parameters:
-
path(Path) — the path of the file to create or update.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while creating or updating the file.
-
createTempDir(...) -> File
-
Signature:
@Deprecated public static File createTempDir() - Summary: Atomically creates a new directory somewhere beneath the system's temporary directory (as defined by the {@code java.io.tmpdir} system property), and returns its name.
-
Contract:
- If that is not possible (as is the case under the very old Android Ice Cream Sandwich release), then this method throws an exception instead of creating a directory that would be more accessible.
- Previous versions would create a directory that is more accessible, as discussed in <a href="https://github.com/google/guava/issues/4011"> CVE-2020-8908 </a> .) <p> Use this method instead of {@link File#createTempFile(String, String)} when you wish to create a directory, not a regular file.
- A common pitfall is to call {@code createTempFile} , delete the file and create a directory in its place, but this leads a race condition which can be exploited to create security vulnerabilities, especially when executable files are to be written into the directory.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File tempDir = Files.createTempDir(); // Use tempDir for temporary operations // Remember to delete when done } </pre>
-
Parameters:
- (none)
- Returns: the newly created directory.
createParentDirs(...) -> void
-
Signature:
public static void createParentDirs(final File file) throws IOException - Summary: Creates any necessary but nonexistent parent directories of the specified file.
-
Contract:
- Note that if this operation fails, it may have succeeded in creating some (but not all) of the necessary parent directories.
- <p> This method does nothing if the parent directory already exists.
- Unlike the similar {@link File#mkdirs()} , this method throws an exception if the parent directory cannot be created.
-
Parameters:
-
file(File) — the file whose parent directories should be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs, or if any necessary but nonexistent parent directories of the specified file could not be created.
-
createParentDirectories(...) -> void
-
Signature:
public static void createParentDirectories(final Path path, final FileAttribute<?>... attrs) throws IOException - Summary: Creates any necessary but nonexistent parent directories of the specified path.
-
Contract:
- Note that if this operation fails, it may have succeeded in creating some (but not all) of the necessary parent directories.
- <p> This method does nothing if the parent directory already exists.
-
Parameters:
-
path(Path) — the path whose parent directories should be created. -
attrs(FileAttribute<?>[]) — an optional list of file attributes to set atomically when creating the directories.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs, or if any necessary but nonexistent parent directories of the specified file could not be created.
-
copy(...) -> void
-
Signature:
public static void copy(final File from, final OutputStream to) throws IOException - Summary: Copies all bytes from a file to an output stream.
-
Parameters:
-
from(File) — the source file. -
to(OutputStream) — the output stream to write to.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading from the file or writing to the stream.
-
-
Signature:
public static void copy(final File from, final File to) throws IOException - Summary: Copies all the bytes from one file to another.
-
Contract:
- If you need to guard against those conditions, you should employ other file-level synchronization.
- <p> <b> Warning: </b> If {@code to} represents an existing file, that file will be overwritten with the contents of {@code from} .
- If {@code to} and {@code from} refer to the <i> same </i> file, the contents of that file will be deleted.
-
Parameters:
-
from(File) — the source file. -
to(File) — the destination file.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the copy operation.
-
move(...) -> void
-
Signature:
public static void move(final File from, final File to) throws IOException - Summary: Moves a file from one path to another.
-
Contract:
- In either case {@code to} must be the target path for the file itself; not just the new name for the file or the path to the new parent directory.
- <p> This method attempts to move the file atomically, but falls back to a copy-and-delete operation if an atomic move is not supported by the file system.
-
Parameters:
-
from(File) — the source file. -
to(File) — the destination file (must be the complete target path, not just a directory).
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the move operation.
-
readLines(...) -> List<String>
-
Signature:
public static List<String> readLines(final File file, final Charset charset) throws IOException - Summary: Reads all the lines from a file.
-
Parameters:
-
file(File) — the file to read from. -
charset(Charset) — the charset used to decode the input stream; see {@link StandardCharsets} for helpful predefined constants.
-
- Returns: a mutable {@link List} containing all the lines.
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading the file.
-
map(...) -> MappedByteBuffer
-
Signature:
public static MappedByteBuffer map(final File file) throws IOException - Summary: Fully maps a file read-only in to memory as per {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)} .
-
Parameters:
-
file(File) — the file to map.
-
- Returns: a read-only buffer reflecting {@code file} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: FileChannel#map(MapMode, long, long)
-
Signature:
public static MappedByteBuffer map(final File file, final MapMode mode) throws IOException - Summary: Fully maps a file in to memory as per {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)} using the requested {@link MapMode} .
-
Parameters:
-
file(File) — the file to map. -
mode(MapMode) — the mode to use when mapping {@code file} (READ_ONLY, READ_WRITE, or PRIVATE).
-
- Returns: a buffer reflecting {@code file} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: FileChannel#map(MapMode, long, long)
-
Signature:
public static MappedByteBuffer map(final File file, final MapMode mode, final long size) throws IOException - Summary: Maps a file in to memory as per {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)} using the requested {@link MapMode} .
-
Contract:
- <p> If the mode is {@link MapMode#READ_WRITE} and the file does not exist, it will be created with the requested {@code size} .
-
Parameters:
-
file(File) — the file to map. -
mode(MapMode) — the mode to use when mapping {@code file} . -
size(long) — the number of bytes to map starting from offset 0.
-
- Returns: a buffer reflecting {@code file} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: FileChannel#map(MapMode, long, long)
simplifyPath(...) -> String
-
Signature:
public static String simplifyPath(final String pathname) - Summary: Returns the lexically cleaned form of the path name, <i> usually </i> (but not always) equivalent to the original.
-
Contract:
- <li> fold out ./ <li> fold out ../ when possible <li> collapse multiple slashes <li> delete trailing slashes (unless the path is just "/") </ul> <p> These heuristics do not always match the behavior of the filesystem.
- If {@code a} is a symlink to {@code x} , {@code a/../b} may refer to a sibling of {@code x} , rather than the sibling of {@code a} referred to by {@code b} .
-
Parameters:
-
pathname(String) — the path to simplify.
-
- Returns: the simplified path.
getNameWithoutExtension(...) -> String
-
Signature:
public static String getNameWithoutExtension(final String file) - Summary: Returns the file name without its <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> or path.
-
Parameters:
-
file(String) — the name of the file to trim the extension from. This can be either a fully qualified file name (including a path) or just a file name.
-
- Returns: the file name without its path or extension.
-
Signature:
public static String getNameWithoutExtension(final Path path) - Summary: Returns the file name without its <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> or path.
-
Parameters:
-
path(Path) — the path whose file name should be extracted without extension.
-
- Returns: the file name without its extension.
getFileExtension(...) -> String
-
Signature:
public static String getFileExtension(final String fullName) - Summary: Returns the <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> for the given file name, or the empty string if the file has no extension.
-
Contract:
- Returns the <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> for the given file name, or the empty string if the file has no extension.
- For example, on NTFS it will report {@code "txt"} as the extension for the filename {@code "foo.exe:.txt"} even though NTFS will drop the {@code ":.txt"} part of the name when the file is actually created on the filesystem due to NTFS's <a href="https://learn.microsoft.com/en-us/archive/blogs/askcore/alternate-data-streams-in-ntfs"> Alternate Data Streams </a> .
-
Parameters:
-
fullName(String) — the file name to extract the extension from.
-
- Returns: the file extension (without the dot), or empty string if none.
-
Signature:
public static String getFileExtension(final Path path) - Summary: Returns the <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> for the file at the given path, or the empty string if the file has no extension.
-
Contract:
- Returns the <a href="http://en.wikipedia.org/wiki/Filename_extension"> file extension </a> for the file at the given path, or the empty string if the file has no extension.
- For example, on NTFS it will report {@code "txt"} as the extension for the filename {@code "foo.exe:.txt"} even though NTFS will drop the {@code ":.txt"} part of the name when the file is actually created on the filesystem due to NTFS's <a href="https://learn.microsoft.com/en-us/archive/blogs/askcore/alternate-data-streams-in-ntfs"> Alternate Data Streams </a> .
-
Parameters:
-
path(Path) — the path whose file extension should be extracted.
-
- Returns: the file extension (without the dot), or empty string if none.
fileTraverser(...) -> Traverser<File>
-
Signature:
public static Traverser<File> fileTraverser() - Summary: Returns a {@link Traverser} instance for the file and directory tree.
-
Contract:
- <p> <b> Warning: </b> {@code File} provides no support for symbolic links, and as such there is no way to ensure that a symbolic link to a directory is not followed when traversing the tree.
- In this case, iterables created by this traverser could contain files that are outside the given directory or even be infinite if there is a symbolic link loop.
- <p> If available, consider using {@link MoreFiles#fileTraverser()} instead.
- <p> If the {@link File} passed to one of the {@link Traverser} methods does not exist or is not a directory, no exception will be thrown and the returned {@link Iterable} will contain a single element: that file.
-
Parameters:
- (none)
- Returns: a traverser for traversing file trees starting from File objects.
pathTraverser(...) -> Traverser<Path>
-
Signature:
public static Traverser<Path> pathTraverser() - Summary: Returns a {@link Traverser} instance for the file and directory tree.
-
Contract:
- However, the traverser cannot guarantee that it will not follow symbolic links to directories as it is possible for a directory to be replaced with a symbolic link between checking if the file is a directory and actually reading the contents of that directory.
- <p> If the {@link Path} passed to one of the traversal methods does not exist or is not a directory, no exception will be thrown and the returned {@link Iterable} will contain a single element: that path.
- <p> {@link DirectoryIteratorException} may be thrown when iterating {@link Iterable} instances created by this traverser if an {@link IOException} is thrown by a call to {@link #listFiles(Path)} .
-
Parameters:
- (none)
- Returns: a traverser for traversing file trees starting from Path objects.
listFiles(...) -> ImmutableList<Path>
-
Signature:
public static ImmutableList<Path> listFiles(final Path dir) throws IOException - Summary: Returns an immutable list of paths to the files contained in the given directory.
-
Parameters:
-
dir(Path) — the directory whose files should be listed.
-
- Returns: an immutable list of paths to files in the directory.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: IOUtil#listFiles(File)
deleteRecursively(...) -> void
-
Signature:
public static void deleteRecursively(final Path path, final RecursiveDeleteOption... options) throws IOException - Summary: Deletes the file or directory at the given {@code path} recursively.
-
Contract:
- <p> If an I/O exception occurs attempting to read, open or delete any file under the given directory, this method skips that file and continues.
- <p> By default, this method throws {@link InsecureRecursiveDeleteException} if it can't guarantee the security of recursive deletes.
- If you wish to allow the recursive deletes anyway, pass {@link RecursiveDeleteOption#ALLOW_INSECURE} to this method to override that behavior.
-
Parameters:
-
path(Path) — the path to delete (file or directory). -
options(RecursiveDeleteOption[]) — optional delete options, such as {@link RecursiveDeleteOption#ALLOW_INSECURE} .
-
-
Throws:
-
java.io.IOException— if {@code path} or any file in the subtree rooted at it can't be deleted for any reason.
-
deleteDirectoryContents(...) -> void
-
Signature:
public static void deleteDirectoryContents(final Path path, final RecursiveDeleteOption... options) throws IOException - Summary: Deletes all files within the directory at the given {@code path} {@linkplain #deleteRecursively recursively} .
-
Contract:
- If {@code path} itself is a symbolic link to a directory, that link is followed and the contents of the directory it targets are deleted.
- <p> If an I/O exception occurs attempting to read, open or delete any file under the given directory, this method skips that file and continues.
- <p> By default, this method throws {@link InsecureRecursiveDeleteException} if it can't guarantee the security of recursive deletes.
- If you wish to allow the recursive deletes anyway, pass {@link RecursiveDeleteOption#ALLOW_INSECURE} to this method to override that behavior.
-
Parameters:
-
path(Path) — the directory whose contents should be deleted. -
options(RecursiveDeleteOption[]) — optional delete options, such as {@link RecursiveDeleteOption#ALLOW_INSECURE} .
-
-
Throws:
-
java.io.IOException— if one or more files can't be deleted for any reason.
-
isDirectory(...) -> Predicate<Path>
-
Signature:
public static Predicate<Path> isDirectory(final LinkOption... options) - Summary: Returns a predicate that returns the result of {@link java.nio.file.Files#isDirectory(Path, LinkOption...)} on input paths with the given link options.
-
Parameters:
-
options(LinkOption[]) — link options to use when checking if a path is a directory.
-
- Returns: a predicate that tests if a path is a directory.
isRegularFile(...) -> Predicate<Path>
-
Signature:
public static Predicate<Path> isRegularFile(final LinkOption... options) - Summary: Returns a predicate that returns the result of {@link java.nio.file.Files#isRegularFile(Path, LinkOption...)} on input paths with the given link options.
-
Parameters:
-
options(LinkOption[]) — link options to use when checking if a path is a regular file.
-
- Returns: a predicate that tests if a path is a regular file.
readAllBytes(...) -> byte\[\]
-
Signature:
public static byte[] readAllBytes(final File file) throws IOException - Summary: Reads all bytes from a file into a byte array.
-
Contract:
- The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.
-
Parameters:
-
file(File) — the file to read from.
-
- Returns: a byte array containing the content read from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs reading from the file.
-
- See also: #readString(File), java.nio.file.Files#readAllBytes(Path), IOUtil#readAllBytes(File)
readString(...) -> String
-
Signature:
public static String readString(final File file) throws IOException - Summary: Reads all content from a file into a string using UTF-8 charset.
-
Contract:
- The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.
-
Parameters:
-
file(File) — the file to read from.
-
- Returns: a string containing the content read from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs reading from the file.
-
- See also: #readString(File, Charset), java.nio.file.Files#readString(Path), IOUtil#readAllToString(File)
-
Signature:
public static String readString(final File file, Charset charset) throws IOException - Summary: Reads all bytes from a file into a string using the given character set.
-
Contract:
- The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.
-
Parameters:
-
file(File) — the file to read from. -
charset(Charset) — the character set used to decode the input stream; see {@link StandardCharsets} for helpful predefined constants.
-
- Returns: a string containing the content read from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs reading from the file.
-
- See also: java.nio.file.Files#readString(Path, Charset), IOUtil#readAllToString(File, Charset)
readAllLines(...) -> List<String>
-
Signature:
public static List<String> readAllLines(final File file) throws IOException - Summary: Reads all lines from a file using UTF-8 charset.
-
Parameters:
-
file(File) — the file to read from.
-
- Returns: a mutable {@link List} containing all the lines.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllLines(File, Charset), java.nio.file.Files#readAllLines(Path, Charset), IOUtil#readAllLines(File)
-
Signature:
public static List<String> readAllLines(final File file, Charset charset) throws IOException - Summary: Reads all lines from a file using the given character set.
-
Parameters:
-
file(File) — the file to read from. -
charset(Charset) — the character set used to decode the input stream (see {@link StandardCharsets} for helpful predefined constants).
-
- Returns: a mutable {@link List} containing all the lines from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs while reading from the file.
-
- See also: java.nio.file.Files#readAllLines(Path, Charset), IOUtil#readAllLines(File, Charset)
Public Instance Methods
- (none)
Class MoreFiles (com.landawn.abacus.guava.Files.MoreFiles)
The Class MoreFiles.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Traverser (com.landawn.abacus.guava.Traverser)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
forTree(...) -> Traverser<T>
-
Signature:
public static <T> Traverser<T> forTree(final Function<? super T, ? extends Iterable<T>> tree) - Summary: Creates a new traverser for a directed acyclic graph that has at most one path from the start node to any node reachable from the start node, such as a tree.
-
Contract:
- <p> This method is optimized for tree-like structures and will perform better than {@link #forGraph(Function)} when the graph is known to be a tree.
- <p> Providing graphs that don't conform to the tree structure may lead to: <ul> <li> Traversal not terminating (if the graph has cycles) </li> <li> Nodes being visited multiple times (if multiple paths exist from the start node to any node reachable from it) </li> </ul> In these cases, use {@link #forGraph(Function)} instead.
-
Parameters:
-
tree(Function<? super T, ? extends Iterable<T>>) — {@link Function} representing a directed acyclic graph that has at most one path between any two nodes. The function takes a node and returns its children.
-
- Returns: a new Traverser for the specified tree structure
- Performance: </li> <li> While traversing, the traverser will use <i> O(H) </i> space (where <i> H </i> is the number of nodes that have been seen but not yet visited, that is, the "horizon").
- See also: #forGraph(Function)
forGraph(...) -> Traverser<T>
-
Signature:
public static <T> Traverser<T> forGraph(final Function<? super T, ? extends Iterable<T>> graph) - Summary: Creates a new traverser for the given general graph that may contain cycles.
-
Contract:
- <p> This method should be used when the graph may have cycles or multiple paths between nodes.
- <p> If {@code graph} is known to be tree-shaped, consider using {@link #forTree(Function)} instead for better performance.
-
Parameters:
-
graph(Function<? super T, ? extends Iterable<T>>) — {@link Function} representing a general graph that may have cycles. The function takes a node and returns its adjacent nodes (successors).
-
- Returns: a new Traverser for the specified graph structure
- Performance: </li> <li> While traversing, the traverser will use <i> O(n) </i> space (where <i> n </i> is the number of nodes that have thus far been visited), plus <i> O(H) </i> space (where <i> H </i> is the number of nodes that have been seen but not yet visited, that is, the "horizon").
- See also: #forTree(Function)
Public Instance Methods
breadthFirst(...) -> Stream<T>
-
Signature:
public Stream<T> breadthFirst(final T startNode) - Summary: Returns a {@link Stream} over the nodes reachable from {@code startNode} , in the order of a breadth-first traversal.
-
Contract:
- <p> Breadth-first traversal is useful when you want to explore nodes level by level, such as finding the shortest path or exploring nodes in increasing distance from the start.
- <pre> {@code b ---- a ---- d | | | | e ---- c ---- f } </pre> <p> The behavior of this method is undefined if the nodes, or the topology of the graph, change while iteration is in progress.
-
Parameters:
-
startNode(T) — the node to start traversal from
-
- Returns: a Stream of nodes in breadth-first order
- See also: #depthFirstPreOrder(Object), #depthFirstPostOrder(Object)
depthFirstPreOrder(...) -> Stream<T>
-
Signature:
public Stream<T> depthFirstPreOrder(final T startNode) - Summary: Returns a {@link Stream} over the nodes reachable from {@code startNode} , in the order of a depth-first pre-order traversal.
-
Contract:
- <pre> {@code b ---- a ---- d | | | | e ---- c ---- f } </pre> <p> The behavior of this method is undefined if the nodes, or the topology of the graph, change while iteration is in progress.
-
Parameters:
-
startNode(T) — the node to start traversal from
-
- Returns: a Stream of nodes in depth-first pre-order
- See also: #breadthFirst(Object), #depthFirstPostOrder(Object)
depthFirstPostOrder(...) -> Stream<T>
-
Signature:
public Stream<T> depthFirstPostOrder(final T startNode) - Summary: Returns a {@link Stream} over the nodes reachable from {@code startNode} , in the order of a depth-first post-order traversal.
-
Contract:
- <pre> {@code b ---- a ---- d | | | | e ---- c ---- f } </pre> <p> The behavior of this method is undefined if the nodes, or the topology of the graph, change while iteration is in progress.
-
Parameters:
-
startNode(T) — the node to start traversal from
-
- Returns: a Stream of nodes in depth-first post-order
- See also: #breadthFirst(Object), #depthFirstPreOrder(Object)
com.landawn.abacus.guava.hash
Interface HashFunction (com.landawn.abacus.guava.hash.HashFunction)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
newHasher(...) -> Hasher
-
Signature:
Hasher newHasher() - Summary: Creates a new {@link Hasher} instance for incremental hashing.
-
Contract:
- <p> Each hasher instance should be used for exactly one hash computation.
- After calling {@link Hasher#hash()} , the hasher should not be used again.
-
Parameters:
- (none)
- Returns: a new, empty hasher instance ready to receive data
-
Signature:
Hasher newHasher(int expectedInputSize) - Summary: Creates a new {@link Hasher} instance with a hint about the expected input size.
-
Contract:
- If unsure, use {@link #newHasher()} instead.
-
Parameters:
-
expectedInputSize(int) — a hint about the expected total size of input in bytes (must be non-negative)
-
- Returns: a new hasher instance optimized for the expected input size
hash(...) -> HashCode
-
Signature:
HashCode hash(int input) - Summary: Computes the hash code for a single integer value.
-
Parameters:
-
input(int) — the integer value to hash
-
- Returns: the hash code for the input value
-
Signature:
HashCode hash(long input) - Summary: Computes the hash code for a single long value.
-
Parameters:
-
input(long) — the long value to hash
-
- Returns: the hash code for the input value
-
Signature:
HashCode hash(byte[] input) - Summary: Computes the hash code for a byte array.
-
Parameters:
-
input(byte[]) — the byte array to hash
-
- Returns: the hash code for the input bytes
-
Signature:
HashCode hash(byte[] input, int off, int len) - Summary: Computes the hash code for a portion of a byte array.
-
Contract:
- This is useful when working with buffers or when only part of an array contains valid data.
-
Parameters:
-
input(byte[]) — the byte array containing data to hash -
off(int) — the starting offset in the array (zero-based, inclusive) -
len(int) — the number of bytes to hash from the array
-
- Returns: the hash code for the specified bytes
-
Signature:
HashCode hash(CharSequence input) - Summary: Computes the hash code for a character sequence without encoding.
-
Contract:
- <p> <b> Warning: </b> This method produces different output than most other languages when hashing strings.
-
Parameters:
-
input(CharSequence) — the character sequence to hash
-
- Returns: the hash code for the input characters
-
Signature:
HashCode hash(CharSequence input, Charset charset) - Summary: Computes the hash code for a character sequence using the specified character encoding.
-
Contract:
- This method is useful for cross-language compatibility as it produces consistent results when the same encoding is used.
-
Parameters:
-
input(CharSequence) — the character sequence to hash -
charset(Charset) — the character encoding to use
-
- Returns: the hash code for the encoded input
-
Signature:
<T> HashCode hash(T instance, Funnel<? super T> funnel) - Summary: Computes the hash code for an arbitrary object using a {@link Funnel} to decompose the object into primitive values.
-
Parameters:
-
instance(T) — the object instance to hash -
funnel(Funnel<? super T>) — the funnel used to decompose the object into primitive values
-
- Returns: the hash code for the object
bits(...) -> int
-
Signature:
int bits() - Summary: Returns the number of bits in each hash code produced by this hash function.
-
Parameters:
- (none)
- Returns: the number of bits in hash codes produced by this function (always positive and typically a multiple of 32)
Interface Hasher (com.landawn.abacus.guava.hash.Hasher)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> Hasher
-
Signature:
Hasher put(byte b) - Summary: Adds a single byte to this hasher's internal state.
-
Parameters:
-
b(byte) — the byte value to add to the hash computation
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(byte[] bytes) - Summary: Adds all bytes in the given array to this hasher's internal state.
-
Parameters:
-
bytes(byte[]) — the byte array containing data to add to the hash computation
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(byte[] bytes, int off, int len) - Summary: Adds a portion of the given byte array to this hasher's internal state.
-
Parameters:
-
bytes(byte[]) — the byte array containing data to add to the hash computation -
off(int) — the starting offset in the array (zero-based, inclusive) -
len(int) — the number of bytes to process from the array
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(ByteBuffer bytes) - Summary: Adds all remaining bytes from the given ByteBuffer to this hasher's internal state.
-
Parameters:
-
bytes(ByteBuffer) — the ByteBuffer containing data to add to the hash computation
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(short s) - Summary: Adds a short value to this hasher's internal state.
-
Parameters:
-
s(short) — the short value to add to the hash computation (interpreted in little-endian byte order)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(int i) - Summary: Adds an integer value to this hasher's internal state.
-
Parameters:
-
i(int) — the integer value to add to the hash computation (interpreted in little-endian byte order)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(long l) - Summary: Adds a long value to this hasher's internal state.
-
Parameters:
-
l(long) — the long value to add to the hash computation (interpreted in little-endian byte order)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(float f) - Summary: Adds a float value to this hasher's internal state.
-
Contract:
- Use {@link Float#floatToRawIntBits(float)} explicitly if you need consistent handling of NaN values.
-
Parameters:
-
f(float) — the float value to add to the hash computation (using its raw binary representation)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(double d) - Summary: Adds a double value to this hasher's internal state.
-
Contract:
- Use {@link Double#doubleToRawLongBits(double)} explicitly if you need consistent handling of NaN values.
-
Parameters:
-
d(double) — the double value to add to the hash computation (using its raw binary representation)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(boolean b) - Summary: Adds a boolean value to this hasher's internal state.
-
Parameters:
-
b(boolean) — the boolean value to add to the hash computation (true=1, false=0)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(char c) - Summary: Adds a character value to this hasher's internal state.
-
Parameters:
-
c(char) — the character value to add to the hash computation (interpreted in little-endian byte order)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(char[] chars) - Summary: Adds all characters from the given array to this hasher's internal state.
-
Parameters:
-
chars(char[]) — the character array containing data to add to the hash computation
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(char[] chars, int off, int len) - Summary: Adds a portion of the given character array to this hasher's internal state.
-
Parameters:
-
chars(char[]) — the character array containing data to add to the hash computation -
off(int) — the starting offset in the array (zero-based, inclusive) -
len(int) — the number of characters to process from the array
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(CharSequence charSequence) - Summary: Adds all characters from the given CharSequence to this hasher's internal state without performing any character encoding.
-
Contract:
- <p> This method is faster than {@link #put(CharSequence, Charset)} and produces consistent results across Java versions, but the output will differ from most other programming languages when hashing the same string.
-
Parameters:
-
charSequence(CharSequence) — the character sequence to add to the hash computation (String, StringBuilder, etc.)
-
- Returns: this hasher instance for method chaining
-
Signature:
Hasher put(CharSequence charSequence, Charset charset) - Summary: Adds the given CharSequence to this hasher's internal state after encoding it using the specified charset.
-
Contract:
- <p> This method is useful for cross-language compatibility as it produces the same hash values as other languages when using the same character encoding.
- Use the unencoded version for better performance when cross-language compatibility is not required.
-
Parameters:
-
charSequence(CharSequence) — the character sequence to encode and add to the hash computation -
charset(Charset) — the character encoding to use for converting the sequence to bytes
-
- Returns: this hasher instance for method chaining
-
Signature:
<T> Hasher put(T instance, Funnel<? super T> funnel) - Summary: Adds an arbitrary object to this hasher's internal state using a {@link Funnel} to decompose the object into primitive values.
-
Parameters:
-
instance(T) — the object instance to add to the hash computation -
funnel(Funnel<? super T>) — the funnel used to decompose the object into primitive values
-
- Returns: this hasher instance for method chaining
hash(...) -> HashCode
-
Signature:
HashCode hash() - Summary: Computes and returns the final hash code based on all data that has been added to this hasher.
-
Contract:
- After calling this method, the hasher instance should not be used again.
-
Parameters:
- (none)
- Returns: the computed hash code
Class Hashing (com.landawn.abacus.guava.hash.Hashing)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
goodFastHash(...) -> HashFunction
-
Signature:
public static HashFunction goodFastHash(final int minimumBits) - Summary: Returns a general-purpose, temporary-use, non-cryptographic hash function that produces hash codes of at least the specified number of bits.
-
Contract:
- The returned function is suitable for in-memory data structures but should not be used for persistent storage or cross-process communication.
- <p> <b> Warning: </b> Do not use this method if hash codes may escape the current process in any way (e.g., being sent over RPC or saved to disk).
- <p> <b> When to Use goodFastHash() vs.
-
Parameters:
-
minimumBits(int) — a positive integer specifying the minimum number of bits the hash code should have (the actual number of bits may be higher, typically rounded up to a multiple of 32 or 64)
-
- Returns: a hash function that produces hash codes of length {@code minimumBits} or greater
- See also: #murmur3_128(), #murmur3_32(), #sha256(), #sipHash24(long, long)
murmur3_32(...) -> HashFunction
-
Signature:
public static HashFunction murmur3_32(final int seed) - Summary: Returns a hash function implementing the 32-bit Murmur3 algorithm (x86 variant) with the specified seed value.
-
Parameters:
-
seed(int) — the seed value to initialize the hash function (different seeds produce different hash values for the same input)
-
- Returns: a Murmur3 32-bit hash function initialized with the given seed
-
Signature:
public static HashFunction murmur3_32() - Summary: Returns a hash function implementing the 32-bit Murmur3 algorithm (x86 variant) with a seed value of zero.
-
Contract:
- <p> This is a convenient method for when you don't need a specific seed value.
-
Parameters:
- (none)
- Returns: a Murmur3 32-bit hash function with seed value 0
- See also: #murmur3_32(int)
murmur3_128(...) -> HashFunction
-
Signature:
public static HashFunction murmur3_128(final int seed) - Summary: Returns a hash function implementing the 128-bit Murmur3 algorithm (x64 variant) with the specified seed value.
-
Parameters:
-
seed(int) — the seed value to initialize the hash function (different seeds produce different hash values for the same input)
-
- Returns: a Murmur3 128-bit hash function initialized with the given seed
-
Signature:
public static HashFunction murmur3_128() - Summary: Returns a hash function implementing the 128-bit Murmur3 algorithm (x64 variant) with a seed value of zero.
-
Parameters:
- (none)
- Returns: a Murmur3 128-bit hash function with seed value 0
- See also: #murmur3_128(int)
sipHash24(...) -> HashFunction
-
Signature:
public static HashFunction sipHash24() - Summary: Returns a hash function implementing the 64-bit SipHash-2-4 algorithm using a default seed value of {@code k = 00 01 02 ...} .
-
Parameters:
- (none)
- Returns: a SipHash-2-4 hash function with default seed
- See also: #sipHash24(long, long)
-
Signature:
public static HashFunction sipHash24(final long k0, final long k1) - Summary: Returns a hash function implementing the 64-bit SipHash-2-4 algorithm using the specified 128-bit key (provided as two 64-bit values).
-
Parameters:
-
k0(long) — the first 64 bits of the 128-bit key (low order bits) -
k1(long) — the second 64 bits of the 128-bit key (high order bits)
-
- Returns: a SipHash-2-4 hash function initialized with the given key
md5(...) -> HashFunction
-
Signature:
@Deprecated public static HashFunction md5() - Summary: Returns a hash function implementing the MD5 hash algorithm (128 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing MD5
sha1(...) -> HashFunction
-
Signature:
@Deprecated public static HashFunction sha1() - Summary: Returns a hash function implementing the SHA-1 algorithm (160 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing SHA-1
sha256(...) -> HashFunction
-
Signature:
public static HashFunction sha256() - Summary: Returns a hash function implementing the SHA-256 algorithm (256 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing SHA-256
sha384(...) -> HashFunction
-
Signature:
public static HashFunction sha384() - Summary: Returns a hash function implementing the SHA-384 algorithm (384 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing SHA-384
sha512(...) -> HashFunction
-
Signature:
public static HashFunction sha512() - Summary: Returns a hash function implementing the SHA-512 algorithm (512 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing SHA-512
hmacMd5(...) -> HashFunction
-
Signature:
public static HashFunction hmacMd5(final Key key) - Summary: Returns a hash function implementing the HMAC (Hash-based Message Authentication Code) algorithm using MD5 as the underlying hash function (128 hash bits).
-
Parameters:
-
key(Key) — the secret key for HMAC computation
-
- Returns: a hash function implementing HMAC-MD5 with the given key
-
Signature:
public static HashFunction hmacMd5(final byte[] key) - Summary: Returns a hash function implementing HMAC-MD5 using a {@link javax.crypto.spec.SecretKeySpec} created from the given byte array.
-
Parameters:
-
key(byte[]) — the key material for the secret key as a byte array
-
- Returns: a hash function implementing HMAC-MD5 with a key created from the given bytes
hmacSha1(...) -> HashFunction
-
Signature:
public static HashFunction hmacSha1(final Key key) - Summary: Returns a hash function implementing the HMAC algorithm using SHA-1 as the underlying hash function (160 hash bits).
-
Parameters:
-
key(Key) — the secret key for HMAC computation
-
- Returns: a hash function implementing HMAC-SHA1 with the given key
-
Signature:
public static HashFunction hmacSha1(final byte[] key) - Summary: Returns a hash function implementing HMAC-SHA1 using a {@link javax.crypto.spec.SecretKeySpec} created from the given byte array.
-
Parameters:
-
key(byte[]) — the key material for the secret key as a byte array
-
- Returns: a hash function implementing HMAC-SHA1 with a key created from the given bytes
hmacSha256(...) -> HashFunction
-
Signature:
public static HashFunction hmacSha256(final Key key) - Summary: Returns a hash function implementing the HMAC algorithm using SHA-256 as the underlying hash function (256 hash bits).
-
Parameters:
-
key(Key) — the secret key for HMAC computation
-
- Returns: a hash function implementing HMAC-SHA256 with the given key
-
Signature:
public static HashFunction hmacSha256(final byte[] key) - Summary: Returns a hash function implementing HMAC-SHA256 using a {@link javax.crypto.spec.SecretKeySpec} created from the given byte array.
-
Parameters:
-
key(byte[]) — the key material for the secret key as a byte array
-
- Returns: a hash function implementing HMAC-SHA256 with a key created from the given bytes
hmacSha512(...) -> HashFunction
-
Signature:
public static HashFunction hmacSha512(final Key key) - Summary: Returns a hash function implementing the HMAC algorithm using SHA-512 as the underlying hash function (512 hash bits).
-
Parameters:
-
key(Key) — the secret key for HMAC computation
-
- Returns: a hash function implementing HMAC-SHA512 with the given key
-
Signature:
public static HashFunction hmacSha512(final byte[] key) - Summary: Returns a hash function implementing HMAC-SHA512 using a {@link javax.crypto.spec.SecretKeySpec} created from the given byte array.
-
Parameters:
-
key(byte[]) — the key material for the secret key as a byte array
-
- Returns: a hash function implementing HMAC-SHA512 with a key created from the given bytes
crc32c(...) -> HashFunction
-
Signature:
public static HashFunction crc32c() - Summary: Returns a hash function implementing the CRC32C checksum algorithm (32 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing CRC32C
crc32(...) -> HashFunction
-
Signature:
public static HashFunction crc32() - Summary: Returns a hash function implementing the standard CRC-32 checksum algorithm (32 hash bits).
-
Contract:
- Note that CRC32 is not cryptographically secure and should not be used for security purposes.
-
Parameters:
- (none)
- Returns: a hash function implementing CRC-32
adler32(...) -> HashFunction
-
Signature:
public static HashFunction adler32() - Summary: Returns a hash function implementing the Adler-32 checksum algorithm (32 hash bits).
-
Parameters:
- (none)
- Returns: a hash function implementing Adler-32
farmHashFingerprint64(...) -> HashFunction
-
Signature:
public static HashFunction farmHashFingerprint64() - Summary: Returns a hash function implementing FarmHash's Fingerprint64, an open-source algorithm designed for generating persistent fingerprints of strings.
-
Contract:
- Note that this implementation uses unsigned integers (see {@link com.google.common.primitives.UnsignedInts} ), which should be considered when comparing with signed integer implementations.
-
Parameters:
- (none)
- Returns: a hash function implementing FarmHash Fingerprint64
concatenating(...) -> HashFunction
-
Signature:
public static HashFunction concatenating(final HashFunction first, final HashFunction second) - Summary: Returns a hash function that computes its hash code by concatenating the hash codes of two underlying hash functions.
-
Contract:
- This is useful when you need a hash code of a specific length that is not directly available.
-
Parameters:
-
first(HashFunction) — the first hash function -
second(HashFunction) — the second hash function
-
- Returns: a hash function that concatenates the results of the two input functions
- See also: #concatenating(Iterable)
-
Signature:
public static HashFunction concatenating(final HashFunction first, final HashFunction second, final HashFunction third) - Summary: Returns a hash function that computes its hash code by concatenating the hash codes of three underlying hash functions.
-
Parameters:
-
first(HashFunction) — the first hash function -
second(HashFunction) — the second hash function -
third(HashFunction) — the third hash function
-
- Returns: a hash function that concatenates the results of the three input functions
- See also: #concatenating(Iterable)
-
Signature:
public static HashFunction concatenating(final Iterable<HashFunction> hashFunctions) - Summary: Returns a hash function that computes its hash code by concatenating the hash codes of the underlying hash functions in the provided iterable.
-
Parameters:
-
hashFunctions(Iterable<HashFunction>) — an iterable of hash functions to concatenate (must not be empty)
-
- Returns: a hash function that concatenates the results of all input functions
combineOrdered(...) -> HashCode
-
Signature:
public static HashCode combineOrdered(final HashCode first, final HashCode second) - Summary: Combines two hash codes in an ordered fashion to produce a new hash code with the same bit length as the input hash codes.
-
Parameters:
-
first(HashCode) — the first hash code to combine -
second(HashCode) — the second hash code to combine
-
- Returns: a hash code combining the input hash codes in order
- See also: #combineOrdered(Iterable)
-
Signature:
public static HashCode combineOrdered(final HashCode first, final HashCode second, final HashCode third) - Summary: Combines three hash codes in an ordered fashion to produce a new hash code with the same bit length as the input hash codes.
-
Parameters:
-
first(HashCode) — the first hash code to combine -
second(HashCode) — the second hash code to combine -
third(HashCode) — the third hash code to combine
-
- Returns: a hash code combining the input hash codes in order
- See also: #combineOrdered(Iterable)
-
Signature:
public static HashCode combineOrdered(final Iterable<HashCode> hashCodes) - Summary: Returns a hash code that combines the information from multiple hash codes in an ordered fashion.
-
Contract:
- <p> This method is designed such that if two equal hash codes are produced by two calls to this method, it is as likely as possible that each was computed from the same input hash codes in the same order.
-
Parameters:
-
hashCodes(Iterable<HashCode>) — an iterable of hash codes to combine
-
- Returns: a hash code combining all input hash codes in order
combineUnordered(...) -> HashCode
-
Signature:
public static HashCode combineUnordered(final HashCode first, final HashCode second) - Summary: Combines two hash codes in an unordered fashion to produce a new hash code with the same bit length as the input hash codes.
-
Parameters:
-
first(HashCode) — the first hash code to combine -
second(HashCode) — the second hash code to combine
-
- Returns: a hash code combining the input hash codes without regard to order
- See also: #combineUnordered(Iterable)
-
Signature:
public static HashCode combineUnordered(final HashCode first, final HashCode second, final HashCode third) - Summary: Combines three hash codes in an unordered fashion to produce a new hash code with the same bit length as the input hash codes.
-
Parameters:
-
first(HashCode) — the first hash code to combine -
second(HashCode) — the second hash code to combine -
third(HashCode) — the third hash code to combine
-
- Returns: a hash code combining the input hash codes without regard to order
- See also: #combineUnordered(Iterable)
-
Signature:
public static HashCode combineUnordered(final Iterable<HashCode> hashCodes) - Summary: Returns a hash code that combines the information from multiple hash codes in an unordered fashion.
-
Contract:
- <p> This method is designed such that if two equal hash codes are produced by two calls to this method, it is as likely as possible that each was computed from the same set of input hash codes, regardless of order.
-
Parameters:
-
hashCodes(Iterable<HashCode>) — an iterable of hash codes to combine
-
- Returns: a hash code combining all input hash codes without regard to order
consistentHash(...) -> int
-
Signature:
public static int consistentHash(final HashCode hashCode, final int buckets) - Summary: Assigns a "bucket" index in the range {@code \[0, buckets)} to the given hash code using consistent hashing.
-
Contract:
- <p> Specifically, {@code consistentHash(h, n)} equals: <ul> <li> {@code n - 1} , with approximate probability {@code 1/n} </li> <li> {@code consistentHash(h, n - 1)} , otherwise (probability {@code 1 - 1/n} ) </li> </ul> <p> This property makes consistent hashing ideal for distributed systems where you want to minimize redistribution when adding or removing nodes.
- When the number of buckets increases from n-1 to n, only approximately 1/n of the items need to be remapped.
-
Parameters:
-
hashCode(HashCode) — the hash code to assign to a bucket -
buckets(int) — the number of buckets available (must be positive)
-
- Returns: a bucket index in the range {@code \[0, buckets)}
- See also: <a href="http://en.wikipedia.org/wiki/Consistent_hashing">,Consistent hashing on Wikipedia,</a>
-
Signature:
public static int consistentHash(final long input, final int buckets) - Summary: Assigns a "bucket" index in the range {@code \[0, buckets)} to the given long value using consistent hashing.
-
Contract:
- <p> This method provides the same consistent hashing properties as {@link #consistentHash(HashCode, int)} , minimizing redistribution when the number of buckets changes.
-
Parameters:
-
input(long) — the input value to assign to a bucket -
buckets(int) — the number of buckets available (must be positive)
-
- Returns: a bucket index in the range {@code \[0, buckets)}
- See also: #consistentHash(HashCode, int)
Public Instance Methods
- (none)
com.landawn.abacus.http
Enum ContentFormat (com.landawn.abacus.http.ContentFormat)
Enum representing various content formats for HTTP requests and responses.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
contentType(...) -> String
-
Signature:
public String contentType() - Summary: Returns the MIME content type associated with this format.
-
Parameters:
- (none)
- Returns: the content type string, or an empty string if not applicable
contentEncoding(...) -> String
-
Signature:
public String contentEncoding() - Summary: Returns the content encoding (compression algorithm) associated with this format.
-
Parameters:
- (none)
- Returns: the content encoding string, or an empty string if no compression is used
Class HARUtil (com.landawn.abacus.http.HARUtil)
Utility class for working with HTTP Archive (HAR) files.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
setHttpHeaderFilterForHARRequest(...) -> void
-
Signature:
public static void setHttpHeaderFilterForHARRequest(final BiPredicate<? super String, String> httpHeaderFilterForHARRequest) throws IllegalArgumentException - Summary: Sets a custom HTTP header filter for HAR request processing.
-
Contract:
- <p> The filter is used to determine which headers from the HAR file should be included when replaying requests.
- </p> <p> The filter receives the header name and value as parameters and should return {@code true} to include the header or {@code false} to exclude it.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Exclude authorization headers when replaying requests HARUtil.setHttpHeaderFilterForHARRequest((name, value) -> !name.equalsIgnoreCase("Authorization")); } </pre>
-
Parameters:
-
httpHeaderFilterForHARRequest(BiPredicate<? super String, String>) — the filter to apply to headers, must not be null
-
-
Throws:
-
java.lang.IllegalArgumentException— if httpHeaderFilterForHARRequest is null
-
resetHttpHeaderFilterForHARRequest(...) -> void
-
Signature:
public static void resetHttpHeaderFilterForHARRequest() - Summary: Resets the HTTP header filter to the default implementation.
-
Parameters:
- (none)
logRequestCurlForHARRequest(...) -> void
-
Signature:
public static void logRequestCurlForHARRequest(final boolean logRequest) - Summary: Enables or disables logging of curl commands for HAR requests.
-
Contract:
- <p> When enabled, a curl command equivalent to each HAR request will be logged using the default logger at INFO level.
-
Parameters:
-
logRequest(boolean) — {@code true} to enable curl logging, {@code false} to disable
-
- See also: #logRequestCurlForHARRequest(boolean, char), #logRequestCurlForHARRequest(boolean, char, Consumer)
-
Signature:
public static void logRequestCurlForHARRequest(final boolean logRequest, final char quoteChar) - Summary: Enables or disables logging of curl commands for HAR requests with a custom quote character.
-
Contract:
- <p> When enabled, a curl command equivalent to each HAR request will be logged using the default logger at INFO level.
-
Parameters:
-
logRequest(boolean) — {@code true} to enable curl logging, {@code false} to disable -
quoteChar(char) — the character to use for quoting in curl commands (typically ' or ")
-
- See also: #logRequestCurlForHARRequest(boolean), #logRequestCurlForHARRequest(boolean, char, Consumer)
-
Signature:
public static void logRequestCurlForHARRequest(final boolean logRequest, final char quoteChar, final Consumer<? super String> logHandler) - Summary: Enables or disables logging of curl commands for HAR requests with custom settings.
-
Parameters:
-
logRequest(boolean) — {@code true} to enable curl logging, {@code false} to disable -
quoteChar(char) — the character to use for quoting in curl commands -
logHandler(Consumer<? super String>) — the consumer that will handle the generated curl command strings
-
- See also: #logRequestCurlForHARRequest(boolean), #logRequestCurlForHARRequest(boolean, char)
sendRequestByHAR(...) -> String
-
Signature:
public static String sendRequestByHAR(final File har, final String targetUrl) - Summary: Sends an HTTP request extracted from a HAR file for the specified target URL.
-
Parameters:
-
har(File) — the HAR file containing captured HTTP requests -
targetUrl(String) — the exact URL to match in the HAR file
-
- Returns: the response body as a string
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
-
Signature:
public static String sendRequestByHAR(final File har, final Predicate<? super String> filterForTargetUrl) - Summary: Sends an HTTP request extracted from a HAR file for URLs matching the given filter.
-
Parameters:
-
har(File) — the HAR file containing captured HTTP requests -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; the first matching URL's request will be sent
-
- Returns: the response body as a string
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
-
Signature:
public static String sendRequestByHAR(final String har, final String targetUrl) - Summary: Sends an HTTP request extracted from a HAR string for the specified target URL.
-
Parameters:
-
har(String) — the HAR content as a JSON string -
targetUrl(String) — the exact URL to match in the HAR content
-
- Returns: the response body as a string
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
-
Signature:
@SuppressWarnings("rawtypes") public static String sendRequestByHAR(final String har, final Predicate<? super String> filterForTargetUrl) - Summary: Sends an HTTP request extracted from a HAR string for URLs matching the given filter.
-
Parameters:
-
har(String) — the HAR content as a JSON string -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; the first matching URL's request will be sent
-
- Returns: the response body as a string
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
sendMultiRequestsByHAR(...) -> List<String>
-
Signature:
public static List<String> sendMultiRequestsByHAR(final File har, final Predicate<? super String> filterForTargetUrl) - Summary: Sends multiple HTTP requests extracted from a HAR file for URLs matching the given filter.
-
Parameters:
-
har(File) — the HAR file containing captured HTTP requests -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; all matching URLs' requests will be sent
-
- Returns: a list of response bodies as strings, in the order they appear in the HAR file
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
-
Signature:
@SuppressWarnings("rawtypes") public static List<String> sendMultiRequestsByHAR(final String har, final Predicate<? super String> filterForTargetUrl) - Summary: Sends multiple HTTP requests extracted from a HAR string for URLs matching the given filter.
-
Parameters:
-
har(String) — the HAR content as a JSON string -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; all matching URLs' requests will be sent
-
- Returns: a list of response bodies as strings, in the order they appear in the HAR content
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
streamMultiRequestsByHAR(...) -> Stream<Tuple2<Map<String, Object>, HttpResponse>>
-
Signature:
public static Stream<Tuple2<Map<String, Object>, HttpResponse>> streamMultiRequestsByHAR(final File har, final Predicate<? super String> filterForTargetUrl) - Summary: Creates a stream of HTTP requests and their responses from a HAR file.
-
Parameters:
-
har(File) — the HAR file containing captured HTTP requests -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; only matching URLs will be included in the stream
-
- Returns: a stream of tuples where the first element is the request entry map and the second is the HttpResponse
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
-
Signature:
@SuppressWarnings("rawtypes") public static Stream<Tuple2<Map<String, Object>, HttpResponse>> streamMultiRequestsByHAR(final String har, final Predicate<? super String> filterForTargetUrl) - Summary: Creates a stream of HTTP requests and their responses from a HAR string.
-
Contract:
- The stream is lazy - requests are only sent when the stream is consumed.
-
Parameters:
-
har(String) — the HAR content as a JSON string -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs; only matching URLs will be included in the stream
-
- Returns: a stream of tuples where the first element is the request entry map and the second is the HttpResponse
- See also: <a href="http://www.softwareishard.com/har/viewer/">,HAR Viewer,</a>, <a href="https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html">,Generating HAR files,</a>
sendRequestByRequestEntry(...) -> T
-
Signature:
public static <T> T sendRequestByRequestEntry(final Map<String, Object> requestEntry, final Class<T> responseClass) - Summary: Sends an HTTP request based on a HAR request entry.
-
Contract:
- </p> <p> The method will: </p> <ul> <li> Extract URL, HTTP method, headers from the request entry </li> <li> Apply the configured header filter to include/exclude headers </li> <li> Extract request body and MIME type if present </li> <li> Log curl command if logging is enabled </li> <li> Send the HTTP request and return the response </li> </ul>
-
Parameters:
-
requestEntry(Map<String, Object>) — the HAR request entry map containing request details -
responseClass(Class<T>) — the class to deserialize the response into
-
- Returns: the response deserialized into the specified type
getRequestEntryByUrlFromHAR(...) -> Optional<Map<String, Object>>
-
Signature:
public static Optional<Map<String, Object>> getRequestEntryByUrlFromHAR(final File har, final Predicate<? super String> filterForTargetUrl) - Summary: Retrieves a request entry from a HAR file based on URL filtering.
-
Parameters:
-
har(File) — the HAR file containing captured HTTP requests -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs
-
- Returns: an Optional containing the first matching request entry map, or empty if no match is found
-
Signature:
@SuppressWarnings("rawtypes") public static Optional<Map<String, Object>> getRequestEntryByUrlFromHAR(final String har, final Predicate<? super String> filterForTargetUrl) - Summary: Retrieves a request entry from a HAR string based on URL filtering.
-
Parameters:
-
har(String) — the HAR content as a JSON string -
filterForTargetUrl(Predicate<? super String>) — predicate to test URLs
-
- Returns: an Optional containing the first matching request entry map, or empty if no match is found
getUrlByRequestEntry(...) -> String
-
Signature:
public static String getUrlByRequestEntry(final Map<String, Object> requestEntry) - Summary: Extracts the URL from a HAR request entry.
-
Parameters:
-
requestEntry(Map<String, Object>) — the HAR request entry map
-
- Returns: the URL string from the request entry
getHttpMethodByRequestEntry(...) -> HttpMethod
-
Signature:
public static HttpMethod getHttpMethodByRequestEntry(final Map<String, Object> requestEntry) - Summary: Extracts the HTTP method from a HAR request entry.
-
Parameters:
-
requestEntry(Map<String, Object>) — the HAR request entry map
-
- Returns: the HTTP method enum value (GET, POST, PUT, DELETE, etc.)
getHeadersByRequestEntry(...) -> HttpHeaders
-
Signature:
public static HttpHeaders getHeadersByRequestEntry(final Map<String, Object> requestEntry) - Summary: Extracts and filters HTTP headers from a HAR request entry.
-
Contract:
- <p> This method retrieves all headers from the request entry and applies the configured header filter to determine which headers should be included.
-
Parameters:
-
requestEntry(Map<String, Object>) — the HAR request entry map containing a "headers" array
-
- Returns: an HttpHeaders object containing the filtered headers
getBodyAndMimeTypeByRequestEntry(...) -> Tuple2<String, String>
-
Signature:
public static Tuple2<String, String> getBodyAndMimeTypeByRequestEntry(final Map<String, Object> requestEntry) - Summary: Extracts the request body and MIME type from a HAR request entry.
-
Parameters:
-
requestEntry(Map<String, Object>) — the HAR request entry map
-
- Returns: a tuple where the first element is the request body text and the second element is the MIME type
Public Instance Methods
- (none)
Class HttpClient (com.landawn.abacus.http.HttpClient)
A comprehensive, thread-safe HTTP client implementation built on Java's {@link HttpURLConnection} foundation, providing high-performance, feature-rich capabilities for modern web service integration and API communication.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> HttpClient
-
Signature:
public static HttpClient create(final String url) - Summary: Creates an HttpClient instance with the specified URL and default settings.
-
Parameters:
-
url(String) — The base URL for the HTTP client
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final int maxConnection) - Summary: Creates an HttpClient instance with the specified URL and maximum connections.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpClient instance with the specified URL and timeout settings.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpClient instance with the specified URL, max connections, and timeout settings.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings) throws UncheckedIOException - Summary: Creates an HttpClient instance with the specified URL, max connections, timeout settings, and HTTP settings.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings (headers, content type, etc.)
-
- Returns: A new HttpClient instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final AtomicInteger sharedActiveConnectionCounter) - Summary: Creates an HttpClient instance with a shared active connection counter.
-
Contract:
- Useful when you need to enforce a global connection limit across multiple HTTP endpoints.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings -
sharedActiveConnectionCounter(AtomicInteger) — Shared counter for active connections across multiple HttpClient instances
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final Executor executor) - Summary: Creates an HttpClient instance with a custom executor for async operations.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
executor(Executor) — Custom executor for asynchronous operations
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final Executor executor) throws UncheckedIOException - Summary: Creates an HttpClient instance with the specified URL, settings, and custom executor.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.) -
executor(Executor) — Custom executor for asynchronous operations
-
- Returns: A new HttpClient instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static HttpClient create(final String url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final AtomicInteger sharedActiveConnectionCounter, final Executor executor) - Summary: Creates an HttpClient instance with all configuration options.
-
Parameters:
-
url(String) — The base URL for the HTTP client -
maxConnection(int) — Maximum number of concurrent connections per client -
connectTimeoutInMillis(long) — Connection timeout in milliseconds (0 uses default) -
readTimeoutInMillis(long) — Read timeout in milliseconds (0 uses default) -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.) -
sharedActiveConnectionCounter(AtomicInteger) — Shared counter for managing active connections across multiple clients -
executor(Executor) — Custom executor for asynchronous operations (null uses default)
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url) - Summary: Creates an HttpClient instance with a URL object and default settings.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object)
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final int maxConnection) - Summary: Creates an HttpClient instance with a URL object and maximum connections.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpClient instance with a URL object and timeout settings.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpClient instance with a URL object, max connections, and timeout settings.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings) throws UncheckedIOException - Summary: Creates an HttpClient instance with a URL object and all basic configuration options.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.)
-
- Returns: A new HttpClient instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final AtomicInteger sharedActiveConnectionCounter) - Summary: Creates an HttpClient instance with a URL object and shared connection counter.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.) -
sharedActiveConnectionCounter(AtomicInteger) — Shared counter for active connections across multiple clients
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final Executor executor) - Summary: Creates an HttpClient instance with a URL object and custom executor.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
executor(Executor) — Custom executor for asynchronous operations
-
- Returns: A new HttpClient instance
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final Executor executor) throws UncheckedIOException - Summary: Creates an HttpClient instance with a URL object, settings, and custom executor.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.) -
executor(Executor) — Custom executor for asynchronous operations
-
- Returns: A new HttpClient instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static HttpClient create(final URL url, final int maxConnection, final long connectTimeoutInMillis, final long readTimeoutInMillis, final HttpSettings settings, final AtomicInteger sharedActiveConnectionCounter, final Executor executor) - Summary: Creates an HttpClient instance with a URL object and all configuration options.
-
Parameters:
-
url(URL) — The base URL for the HTTP client (as a java.net.URL object) -
maxConnection(int) — Maximum number of concurrent connections -
connectTimeoutInMillis(long) — Connection timeout in milliseconds (0 uses default) -
readTimeoutInMillis(long) — Read timeout in milliseconds (0 uses default) -
settings(HttpSettings) — Additional HTTP settings (headers, content type, proxy, SSL, etc.) -
sharedActiveConnectionCounter(AtomicInteger) — Shared counter for managing active connections across multiple clients -
executor(Executor) — Custom executor for asynchronous operations (null uses default)
-
- Returns: A new HttpClient instance
Public Instance Methods
url(...) -> String
-
Signature:
public String url() - Summary: Gets the base URL configured for this HTTP client.
-
Parameters:
- (none)
- Returns: The base URL as a string
get(...) -> String
-
Signature:
public String get() throws UncheckedIOException - Summary: Performs a GET request and returns the response as a String.
-
Parameters:
- (none)
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String get(final HttpSettings settings) throws UncheckedIOException - Summary: Performs a GET request with custom settings and returns the response as a String.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String get(final Object queryParameters) throws UncheckedIOException - Summary: Performs a GET request with query parameters and returns the response as a String.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String get(final Object queryParameters, final HttpSettings settings) throws UncheckedIOException - Summary: Performs a GET request with query parameters and custom settings, returning the response as a String.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T get(final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a GET request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T get(final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a GET request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T get(final Object queryParameters, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a GET request with query parameters and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T get(final Object queryParameters, final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a GET request with all options and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
delete(...) -> String
-
Signature:
public String delete() throws UncheckedIOException - Summary: Performs a DELETE request and returns the response as a String.
-
Parameters:
- (none)
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String delete(final HttpSettings settings) throws UncheckedIOException - Summary: Performs a DELETE request with custom settings and returns the response as a String.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String delete(final Object queryParameters) throws UncheckedIOException - Summary: Performs a DELETE request with query parameters and returns the response as a String.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String delete(final Object queryParameters, final HttpSettings settings) throws UncheckedIOException - Summary: Performs a DELETE request with query parameters and custom settings, returning the response as a String.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T delete(final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a DELETE request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T delete(final Object queryParameters, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a DELETE request with query parameters and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T delete(final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a DELETE request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T delete(final Object queryParameters, final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a DELETE request with all options and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
post(...) -> String
-
Signature:
public String post(final Object request) throws UncheckedIOException - Summary: Performs a POST request with the specified request body and returns the response as a String.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for JSON/XML serialization)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T post(final Object request, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a POST request and deserializes the response.
-
Parameters:
-
request(Object) — The request body -
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String post(final Object request, final HttpSettings settings) throws UncheckedIOException - Summary: Performs a POST request with custom settings and returns the response as a String.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T post(final Object request, final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a POST request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
put(...) -> String
-
Signature:
public String put(final Object request) throws UncheckedIOException - Summary: Performs a PUT request with the specified request body and returns the response as a String.
-
Parameters:
-
request(Object) — The request body
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T put(final Object request, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a PUT request and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String put(final Object request, final HttpSettings settings) throws UncheckedIOException - Summary: Performs a PUT request with custom settings and returns the response as a String.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T put(final Object request, final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Performs a PUT request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
head(...) -> void
-
Signature:
public void head() throws UncheckedIOException - Summary: Performs a HEAD request with default settings.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code client.head(); // Check if resource exists } </pre>
-
Parameters:
- (none)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public void head(final HttpSettings settings) throws UncheckedIOException - Summary: Performs a HEAD request with custom settings.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
execute(...) -> String
-
Signature:
public String execute(final HttpMethod httpMethod, final Object request) throws UncheckedIOException - Summary: Executes an HTTP request with the specified method and request body.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use -
request(Object) — The request body (can be {@code null} for GET/DELETE)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T execute(final HttpMethod httpMethod, final Object request, final Class<T> resultClass) throws UncheckedIOException - Summary: Executes an HTTP request and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public String execute(final HttpMethod httpMethod, final Object request, final HttpSettings settings) throws UncheckedIOException - Summary: Executes an HTTP request with custom settings and returns the response as a String.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: The response body as a String
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T execute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final Class<T> resultClass) throws UncheckedIOException - Summary: Executes an HTTP request with all options and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: The deserialized response object, or {@code null} if resultClass is Void
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public void execute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final File output) throws UncheckedIOException - Summary: Executes an HTTP request and writes the response to a file.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request -
output(File) — The file to write the response to
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public void execute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final OutputStream output) throws UncheckedIOException - Summary: Executes an HTTP request and writes the response to an output stream.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
output(OutputStream) — The output stream to write the response to
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public void execute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final Writer output) throws UncheckedIOException - Summary: Executes an HTTP request and writes the response to a writer.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
output(Writer) — The writer to write the response to
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
openConnection(...) -> HttpURLConnection
-
Signature:
public HttpURLConnection openConnection(final HttpMethod httpMethod, final HttpSettings settings, final boolean doOutput, final Class<?> resultClass) throws UncheckedIOException - Summary: Opens a new HTTP connection with the specified method and settings.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use -
settings(HttpSettings) — Additional HTTP settings for the connection -
doOutput(boolean) — Whether the connection will send a request body -
resultClass(Class<?>) — The expected result class (used for optimization)
-
- Returns: A configured HttpURLConnection ready for use
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
@SuppressWarnings("unused") public HttpURLConnection openConnection(final HttpMethod httpMethod, final Object queryParameters, final HttpSettings settings, final boolean doOutput, final Class<?> resultClass) throws UncheckedIOException - Summary: Opens a new HTTP connection with query parameters and the specified settings.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use -
queryParameters(Object) — Query parameters for GET/DELETE requests (can be String, Map, or Bean) -
settings(HttpSettings) — Additional HTTP settings for the connection -
doOutput(boolean) — Whether the connection will send a request body -
resultClass(Class<?>) — The expected result class (used for optimization)
-
- Returns: A configured HttpURLConnection ready for use
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or connection limit is exceeded
-
asyncGet(...) -> ContinuableFuture<String>
-
Signature:
public ContinuableFuture<String> asyncGet() - Summary: Performs an asynchronous GET request and returns the response as a String.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code client.asyncGet() .thenRunAsync((response, exception) -> { if (exception != null) { exception.printStackTrace(); } else { System.out.println("Response: " + response); } }); } </pre>
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the response body
-
Signature:
public ContinuableFuture<String> asyncGet(final HttpSettings settings) - Summary: Performs an asynchronous GET request with custom settings.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public ContinuableFuture<String> asyncGet(final Object queryParameters) - Summary: Performs an asynchronous GET request with query parameters.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public ContinuableFuture<String> asyncGet(final Object queryParameters, final HttpSettings settings) - Summary: Performs an asynchronous GET request with query parameters and custom settings.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass) - Summary: Performs an asynchronous GET request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Object queryParameters, final Class<T> resultClass) - Summary: Performs an asynchronous GET request with query parameters and deserializes the response.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous GET request with custom settings and deserializes the response.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Object queryParameters, final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous GET request with all options and deserializes the response.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response
asyncDelete(...) -> ContinuableFuture<String>
-
Signature:
public ContinuableFuture<String> asyncDelete() - Summary: Performs an asynchronous DELETE request and returns the response as a String.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public ContinuableFuture<String> asyncDelete(final Object queryParameters) - Summary: Performs an asynchronous DELETE request with query parameters.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public ContinuableFuture<String> asyncDelete(final HttpSettings settings) - Summary: Performs an asynchronous DELETE request with custom settings.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public ContinuableFuture<String> asyncDelete(final Object queryParameters, final HttpSettings settings) - Summary: Performs an asynchronous DELETE request with query parameters and custom settings.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass) - Summary: Performs an asynchronous DELETE request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Object queryParameters, final Class<T> resultClass) - Summary: Performs an asynchronous DELETE request with query parameters and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous DELETE request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Object queryParameters, final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous DELETE request with all options and deserializes the response to the specified type.
-
Parameters:
-
queryParameters(Object) — Query parameters as a String, Map, or Bean object (will be URL-encoded) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
asyncPost(...) -> ContinuableFuture<String>
-
Signature:
public ContinuableFuture<String> asyncPost(final Object request) - Summary: Performs an asynchronous POST request with the specified request body.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Object request, final Class<T> resultClass) - Summary: Performs an asynchronous POST request and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public ContinuableFuture<String> asyncPost(final Object request, final HttpSettings settings) - Summary: Performs an asynchronous POST request with custom settings and returns the response as a String.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Object request, final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous POST request with custom settings and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
asyncPut(...) -> ContinuableFuture<String>
-
Signature:
public ContinuableFuture<String> asyncPut(final Object request) - Summary: Performs an asynchronous PUT request with the specified request body.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Object request, final Class<T> resultClass) - Summary: Performs an asynchronous PUT request and deserializes the response to the specified type.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
-
Signature:
public ContinuableFuture<String> asyncPut(final Object request, final HttpSettings settings) - Summary: Performs an asynchronous PUT request with custom settings and returns the response as a String.
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Object request, final HttpSettings settings, final Class<T> resultClass) - Summary: Performs an asynchronous PUT request with custom settings and deserializes the response to the specified type.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code UpdateUserRequest updateRequest = new UpdateUserRequest("Jane", "Doe"); HttpSettings settings = HttpSettings.create() .header("If-Match", "\\"abc123\\"") .setReadTimeout(30000); client.asyncPut(updateRequest, settings, User.class) .thenRunAsync((user, exception) -> { if (exception != null) { System.err.println("Update failed: " + exception.getMessage()); } else { System.out.println("Updated: " + user.getName()); } }); } </pre>
-
Parameters:
-
request(Object) — The request body (can be String, byte\[\], File, InputStream, Reader, or any object for serialization) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response object
asyncHead(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> asyncHead() - Summary: Performs an asynchronous HEAD request with default settings.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete when the request finishes
-
Signature:
public ContinuableFuture<Void> asyncHead(final HttpSettings settings) - Summary: Performs an asynchronous HEAD request with custom settings.
-
Parameters:
-
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete when the request finishes
asyncExecute(...) -> ContinuableFuture<String>
-
Signature:
public ContinuableFuture<String> asyncExecute(final HttpMethod httpMethod, final Object request) - Summary: Executes an asynchronous HTTP request with the specified method and request body, returning the response as a String.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Object request, final Class<T> resultClass) - Summary: Executes an asynchronous HTTP request and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public ContinuableFuture<String> asyncExecute(final HttpMethod httpMethod, final Object request, final HttpSettings settings) - Summary: Executes an asynchronous HTTP request with custom settings and returns the response as a String.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.)
-
- Returns: A ContinuableFuture that will complete with the response body as a String
-
Signature:
public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final Class<T> resultClass) - Summary: Executes an asynchronous HTTP request with all options and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
resultClass(Class<T>) — The class of the expected response object (for deserialization)
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final File output) - Summary: Executes an asynchronous HTTP request and writes the response to a file.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
output(File) — The file to write the response to
-
- Returns: A ContinuableFuture that will complete when the file is written successfully
-
Signature:
public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final OutputStream output) - Summary: Executes an asynchronous HTTP request and writes the response to an output stream.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
output(OutputStream) — The output stream to write the response to
-
- Returns: A ContinuableFuture that will complete when the stream is written successfully
-
Signature:
public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final Object request, final HttpSettings settings, final Writer output) - Summary: Executes an asynchronous HTTP request and writes the response to a writer.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.) -
request(Object) — The request body (can be {@code null} for GET/DELETE) -
settings(HttpSettings) — Additional HTTP settings for this request (headers, timeouts, etc.) -
output(Writer) — The writer to write the response to
-
- Returns: A ContinuableFuture that will complete when the writer is written successfully
close(...) -> void
-
Signature:
public synchronized void close() - Summary: Closes this HTTP client and releases any resources.
-
Parameters:
- (none)
Class HttpHeaders (com.landawn.abacus.http.HttpHeaders)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> HttpHeaders
-
Signature:
public static HttpHeaders create() - Summary: Creates a new empty HttpHeaders instance.
-
Parameters:
- (none)
- Returns: a new HttpHeaders instance
of(...) -> HttpHeaders
-
Signature:
public static HttpHeaders of(final String name, final Object value) throws IllegalArgumentException - Summary: Creates a new HttpHeaders instance with a single header.
-
Parameters:
-
name(String) — the header name -
value(Object) — the header value (can be String, Collection, Date, Instant, or any object)
-
- Returns: a new HttpHeaders instance containing the specified header
-
Throws:
-
java.lang.IllegalArgumentException— if name is {@code null}
-
-
Signature:
public static HttpHeaders of(final String name1, final Object value1, final String name2, final Object value2) throws IllegalArgumentException - Summary: Creates a new HttpHeaders instance with two headers.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value
-
- Returns: a new HttpHeaders instance containing the specified headers
-
Throws:
-
java.lang.IllegalArgumentException— if any name is {@code null}
-
-
Signature:
public static HttpHeaders of(final String name1, final Object value1, final String name2, final Object value2, final String name3, final Object value3) throws IllegalArgumentException - Summary: Creates a new HttpHeaders instance with three headers.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value -
name3(String) — the third header name -
value3(Object) — the third header value
-
- Returns: a new HttpHeaders instance containing the specified headers
-
Throws:
-
java.lang.IllegalArgumentException— if any name is {@code null}
-
-
Signature:
public static HttpHeaders of(final Map<String, ?> headers) throws IllegalArgumentException - Summary: Creates a new HttpHeaders instance from a Map of headers.
-
Parameters:
-
headers(Map<String, ?>) — the map of header names to values
-
- Returns: a new HttpHeaders instance backed by the provided map
-
Throws:
-
java.lang.IllegalArgumentException— if headers is {@code null}
-
copyOf(...) -> HttpHeaders
-
Signature:
public static HttpHeaders copyOf(final Map<String, ?> headers) throws IllegalArgumentException - Summary: Creates a new HttpHeaders instance with a copy of the provided headers map.
-
Parameters:
-
headers(Map<String, ?>) — the map of header names to values to copy
-
- Returns: a new HttpHeaders instance with a copy of the headers
-
Throws:
-
java.lang.IllegalArgumentException— if headers is {@code null}
-
valueOf(...) -> String
-
Signature:
public static String valueOf(final Object headerValue) - Summary: Converts a header value to its string representation.
-
Parameters:
-
headerValue(Object) — the header value to convert
-
- Returns: the string representation of the header value
Public Instance Methods
setContentType(...) -> HttpHeaders
-
Signature:
public HttpHeaders setContentType(final String contentType) - Summary: Sets the Content-Type header.
-
Parameters:
-
contentType(String) — The content type value (e.g., "application/json")
-
- Returns: This HttpHeaders instance for method chaining
setContentEncoding(...) -> HttpHeaders
-
Signature:
public HttpHeaders setContentEncoding(final String contentEncoding) - Summary: Sets the Content-Encoding header.
-
Parameters:
-
contentEncoding(String) — The content encoding value (e.g., "gzip", "deflate", "br")
-
- Returns: This HttpHeaders instance for method chaining
setContentLanguage(...) -> HttpHeaders
-
Signature:
public HttpHeaders setContentLanguage(final String contentLanguage) - Summary: Sets the Content-Language header.
-
Parameters:
-
contentLanguage(String) — The content language value (e.g., "en-US", "fr-FR")
-
- Returns: This HttpHeaders instance for method chaining
setContentLength(...) -> HttpHeaders
-
Signature:
public HttpHeaders setContentLength(final long contentLength) - Summary: Sets the Content-Length header.
-
Parameters:
-
contentLength(long) — The content length in bytes
-
- Returns: This HttpHeaders instance for method chaining
setUserAgent(...) -> HttpHeaders
-
Signature:
public HttpHeaders setUserAgent(final String userAgent) - Summary: Sets the User-Agent header.
-
Parameters:
-
userAgent(String) — The user agent string
-
- Returns: This HttpHeaders instance for method chaining
setCookie(...) -> HttpHeaders
-
Signature:
public HttpHeaders setCookie(final String cookie) - Summary: Sets the Cookie header.
-
Parameters:
-
cookie(String) — The cookie string in the format "name=value; name2=value2"
-
- Returns: This HttpHeaders instance for method chaining
setAuthorization(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAuthorization(final String value) - Summary: Sets the Authorization header.
-
Parameters:
-
value(String) — The authorization value (e.g., "Bearer token123", "Basic credentials")
-
- Returns: This HttpHeaders instance for method chaining
setBasicAuthentication(...) -> HttpHeaders
-
Signature:
public HttpHeaders setBasicAuthentication(final String username, final String password) - Summary: Sets the Authorization header with Basic authentication.
-
Parameters:
-
username(String) — The username -
password(String) — The password
-
- Returns: This HttpHeaders instance for method chaining
setProxyAuthorization(...) -> HttpHeaders
-
Signature:
public HttpHeaders setProxyAuthorization(final String value) - Summary: Sets the Proxy-Authorization header.
-
Parameters:
-
value(String) — The proxy authorization value (e.g., "Basic base64credentials")
-
- Returns: This HttpHeaders instance for method chaining
setCacheControl(...) -> HttpHeaders
-
Signature:
public HttpHeaders setCacheControl(final String value) - Summary: Sets the Cache-Control header.
-
Contract:
- It controls how, and for how long, the response should be cached by browsers and intermediary caches.
-
Parameters:
-
value(String) — The cache control directives (e.g., "no-cache", "max-age=3600")
-
- Returns: This HttpHeaders instance for method chaining
setConnection(...) -> HttpHeaders
-
Signature:
public HttpHeaders setConnection(final String value) - Summary: Sets the Connection header.
-
Parameters:
-
value(String) — The connection value (e.g., "keep-alive", "close")
-
- Returns: This HttpHeaders instance for method chaining
setHost(...) -> HttpHeaders
-
Signature:
public HttpHeaders setHost(final String value) - Summary: Sets the Host header.
-
Parameters:
-
value(String) — The host value (e.g., "example.com", "example.com:8080")
-
- Returns: This HttpHeaders instance for method chaining
setFrom(...) -> HttpHeaders
-
Signature:
public HttpHeaders setFrom(final String value) - Summary: Sets the From header.
-
Parameters:
-
value(String) — The email address of the user making the request
-
- Returns: This HttpHeaders instance for method chaining
setAccept(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAccept(final String value) - Summary: Sets the Accept header.
-
Parameters:
-
value(String) — The media types the client can accept (e.g., "application/json")
-
- Returns: This HttpHeaders instance for method chaining
setAcceptEncoding(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAcceptEncoding(final String acceptEncoding) - Summary: Sets the Accept-Encoding header.
-
Parameters:
-
acceptEncoding(String) — The acceptable encodings (e.g., "gzip, deflate", "br")
-
- Returns: This HttpHeaders instance for method chaining
setAcceptCharset(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAcceptCharset(final String acceptCharset) - Summary: Sets the Accept-Charset header.
-
Parameters:
-
acceptCharset(String) — The acceptable character sets (e.g., "utf-8, iso-8859-1")
-
- Returns: This HttpHeaders instance for method chaining
setAcceptLanguage(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAcceptLanguage(final String acceptLanguage) - Summary: Sets the Accept-Language header.
-
Parameters:
-
acceptLanguage(String) — The acceptable languages (e.g., "en-US,en;q=0.9", "fr-FR,fr;q=0.8,en;q=0.5")
-
- Returns: This HttpHeaders instance for method chaining
setAcceptRanges(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAcceptRanges(final String acceptRanges) - Summary: Sets the Accept-Ranges header.
-
Parameters:
-
acceptRanges(String) — The acceptable range units (e.g., "bytes", "none")
-
- Returns: This HttpHeaders instance for method chaining
set(...) -> HttpHeaders
-
Signature:
public HttpHeaders set(final String name, final Object value) - Summary: Sets a header with the specified name and value.
-
Contract:
- If a header with this name already exists, it is replaced.
-
Parameters:
-
name(String) — The header name -
value(Object) — The header value (can be String, Collection, Date, Instant, or any object)
-
- Returns: This HttpHeaders instance for method chaining
setAll(...) -> HttpHeaders
-
Signature:
public HttpHeaders setAll(final Map<String, ?> m) - Summary: Sets all headers from the provided map.
-
Parameters:
-
m(Map<String, ?>) — The map of header names to values
-
- Returns: This HttpHeaders instance for method chaining
get(...) -> Object
-
Signature:
public Object get(final String headerName) - Summary: Gets the value of a header.
-
Parameters:
-
headerName(String) — The name of the header to retrieve
-
- Returns: The header value, or {@code null} if not present
remove(...) -> Object
-
Signature:
public Object remove(final String headerName) - Summary: Removes a header.
-
Parameters:
-
headerName(String) — The name of the header to remove
-
- Returns: The previous value associated with the header, or {@code null} if there was no mapping
headerNameSet(...) -> Set<String>
-
Signature:
public Set<String> headerNameSet() - Summary: Returns a set of all header names in this HttpHeaders.
-
Parameters:
- (none)
- Returns: a set view of the header names backed by the underlying map
forEach(...) -> void
-
Signature:
public void forEach(final BiConsumer<? super String, ? super Object> action) - Summary: Performs the given action for each header in this HttpHeaders.
-
Parameters:
-
action(BiConsumer<? super String, ? super Object>) — The action to be performed for each header
-
clear(...) -> void
-
Signature:
public void clear() - Summary: Removes all headers from this HttpHeaders.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Checks if this HttpHeaders is empty.
-
Contract:
- Checks if this HttpHeaders is empty.
- Returns {@code true} if this HttpHeaders contains no header entries.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (headers.isEmpty()) { // No headers present } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if this HttpHeaders contains no headers; {@code false} otherwise
toMap(...) -> Map<String, Object>
-
Signature:
public Map<String, Object> toMap() - Summary: Returns a new map containing all headers.
-
Parameters:
- (none)
- Returns: a new map containing all headers
copy(...) -> HttpHeaders
-
Signature:
public HttpHeaders copy() - Summary: Creates a copy of this HttpHeaders instance.
-
Parameters:
- (none)
- Returns: a new HttpHeaders instance with a copy of all headers
hashCode(...) -> int
-
Signature:
@Override public int hashCode() -
Parameters:
- (none)
- Returns: unspecified
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this HttpHeaders is equal to another object.
-
Contract:
- Checks if this HttpHeaders is equal to another object.
- Two HttpHeaders instances are equal if they contain the same headers.
-
Parameters:
-
obj(Object) — The object to compare with
-
- Returns: {@code true} if the objects are equal
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class Names (com.landawn.abacus.http.HttpHeaders.Names)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Values (com.landawn.abacus.http.HttpHeaders.Values)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class ReferrerPolicyValues (com.landawn.abacus.http.HttpHeaders.ReferrerPolicyValues)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Enum HttpMethod (com.landawn.abacus.http.HttpMethod)
Enum representing standard HTTP request methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class HttpRequest (com.landawn.abacus.http.HttpRequest)
A fluent API for building and executing HTTP requests using HttpClient.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> HttpRequest
-
Signature:
public static HttpRequest create(final HttpClient httpClient) - Summary: Creates an HttpRequest instance with the specified HttpClient.
-
Contract:
- This method is useful when you want to use an existing HttpClient with specific configuration.
-
Parameters:
-
httpClient(HttpClient) — The HttpClient to use for the request. Must not be {@code null} .
-
- Returns: A new HttpRequest instance
url(...) -> HttpRequest
-
Signature:
public static HttpRequest url(final String url) - Summary: Creates an HttpRequest for the specified URL with default connection and read timeouts.
-
Parameters:
-
url(String) — The target URL for the request
-
- Returns: A new HttpRequest instance
-
Signature:
public static HttpRequest url(final String url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpRequest for the specified URL with custom timeouts.
-
Parameters:
-
url(String) — The target URL for the request -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpRequest instance
-
Signature:
public static HttpRequest url(final URL url) - Summary: Creates an HttpRequest for the specified URL with default connection and read timeouts.
-
Parameters:
-
url(URL) — The target URL for the request
-
- Returns: A new HttpRequest instance
-
Signature:
public static HttpRequest url(final URL url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates an HttpRequest for the specified URL with custom timeouts.
-
Parameters:
-
url(URL) — The target URL for the request -
connectTimeoutInMillis(long) — Connection timeout in milliseconds -
readTimeoutInMillis(long) — Read timeout in milliseconds
-
- Returns: A new HttpRequest instance
Public Instance Methods
settings(...) -> HttpRequest
-
Signature:
@Beta public HttpRequest settings(final HttpSettings httpSettings) - Summary: Merges the provided HTTP settings with existing settings on this request.
-
Contract:
- If the same setting is defined in both existing and provided settings, the provided settings take precedence.
-
Parameters:
-
httpSettings(HttpSettings) — The HTTP settings to merge. If {@code null} , this method has no effect.
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpSettings
basicAuth(...) -> HttpRequest
-
Signature:
public HttpRequest basicAuth(final String username, final Object password) - Summary: Sets HTTP Basic Authentication header using the specified username and password.
-
Parameters:
-
username(String) — The username for authentication -
password(Object) — The password for authentication
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
header(...) -> HttpRequest
-
Signature:
public HttpRequest header(final String name, final Object value) - Summary: Sets an HTTP header with the specified name and value.
-
Contract:
- If this request already has any headers with that name, they are all replaced.
-
Parameters:
-
name(String) — The header name -
value(Object) — The header value
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
headers(...) -> HttpRequest
-
Signature:
public HttpRequest headers(final String name1, final Object value1, final String name2, final Object value2) - Summary: Sets two HTTP headers with the specified names and values.
-
Contract:
- If this request already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — The first header name -
value1(Object) — The first header value -
name2(String) — The second header name -
value2(Object) — The second header value
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
-
Signature:
public HttpRequest headers(final String name1, final Object value1, final String name2, final Object value2, final String name3, final Object value3) - Summary: Sets three HTTP headers with the specified names and values.
-
Contract:
- If this request already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — The first header name -
value1(Object) — The first header value -
name2(String) — The second header name -
value2(Object) — The second header value -
name3(String) — The third header name -
value3(Object) — The third header value
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
-
Signature:
public HttpRequest headers(final Map<String, ?> headers) - Summary: Sets HTTP headers from the specified map.
-
Contract:
- If this request already has any headers with the same names, they are all replaced.
-
Parameters:
-
headers(Map<String, ?>) — A map containing header names and values
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
-
Signature:
public HttpRequest headers(final HttpHeaders headers) - Summary: Removes all headers on this request and adds the specified headers.
-
Parameters:
-
headers(HttpHeaders) — The HttpHeaders instance to set
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
connectTimeout(...) -> HttpRequest
-
Signature:
public HttpRequest connectTimeout(final long connectTimeout) - Summary: Sets the connection timeout in milliseconds for this HTTP request.
-
Contract:
- The connection timeout defines how long to wait when establishing a connection to the remote server before timing out.
-
Parameters:
-
connectTimeout(long) — The connection timeout in milliseconds. Must be non-negative.
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest connectTimeout(final Duration connectTimeout) - Summary: Sets the connection timeout using a Duration.
-
Parameters:
-
connectTimeout(Duration) — The connection timeout as a Duration
-
- Returns: This HttpRequest instance for method chaining
readTimeout(...) -> HttpRequest
-
Signature:
public HttpRequest readTimeout(final long readTimeout) - Summary: Sets the read timeout in milliseconds for this HTTP request.
-
Parameters:
-
readTimeout(long) — The read timeout in milliseconds. Must be non-negative.
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest readTimeout(final Duration readTimeout) - Summary: Sets the read timeout using a Duration.
-
Parameters:
-
readTimeout(Duration) — The read timeout as a Duration
-
- Returns: This HttpRequest instance for method chaining
useCaches(...) -> HttpRequest
-
Signature:
public HttpRequest useCaches(final boolean useCaches) - Summary: Sets whether to use caches for this HTTP request.
-
Contract:
- When enabled, the request may use cached responses according to HTTP caching rules.
-
Parameters:
-
useCaches(boolean) — {@code true} to enable caching, {@code false} to disable
-
- Returns: This HttpRequest instance for method chaining
sslSocketFactory(...) -> HttpRequest
-
Signature:
public HttpRequest sslSocketFactory(final SSLSocketFactory sslSocketFactory) - Summary: Sets the SSL socket factory for HTTPS connections.
-
Parameters:
-
sslSocketFactory(SSLSocketFactory) — The SSL socket factory to use. Must not be {@code null} .
-
- Returns: This HttpRequest instance for method chaining
proxy(...) -> HttpRequest
-
Signature:
public HttpRequest proxy(final Proxy proxy) - Summary: Sets the proxy for this HTTP request.
-
Parameters:
-
proxy(Proxy) — The proxy to use. Must not be {@code null} .
-
- Returns: This HttpRequest instance for method chaining
query(...) -> HttpRequest
-
Signature:
public HttpRequest query(final String query) - Summary: Sets query parameters for GET or DELETE requests as a query string.
-
Parameters:
-
query(String) — The query string
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest query(final Map<String, ?> queryParams) - Summary: Sets query parameters for GET or DELETE requests from a map.
-
Parameters:
-
queryParams(Map<String, ?>) — A map containing query parameter names and values
-
- Returns: This HttpRequest instance for method chaining
jsonBody(...) -> HttpRequest
-
Signature:
public HttpRequest jsonBody(final String json) - Summary: Sets the request body as JSON string and sets the Content-Type header to application/json.
-
Parameters:
-
json(String) — The JSON string
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest jsonBody(final Object obj) - Summary: Sets the request body as JSON by serializing the specified object and sets the Content-Type header to application/json.
-
Parameters:
-
obj(Object) — The object to serialize as JSON
-
- Returns: This HttpRequest instance for method chaining
xmlBody(...) -> HttpRequest
-
Signature:
public HttpRequest xmlBody(final String xml) - Summary: Sets the request body as an XML string and sets the Content-Type header to application/xml.
-
Parameters:
-
xml(String) — The XML string to send as the request body
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest xmlBody(final Object obj) - Summary: Sets the request body as XML by serializing the specified object and sets the Content-Type header to application/xml.
-
Parameters:
-
obj(Object) — The object to serialize as XML. Must not be {@code null} .
-
- Returns: This HttpRequest instance for method chaining
formBody(...) -> HttpRequest
-
Signature:
public HttpRequest formBody(final Map<?, ?> formBodyByMap) - Summary: Sets the request body as form URL-encoded data from a map and sets the Content-Type header to application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByMap(Map<?, ?>) — A map containing form field names and values
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest formBody(final Object formBodyByBean) - Summary: Sets the request body as form URL-encoded data from a bean object and sets the Content-Type header to application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByBean(Object) — A bean object whose properties will be used as form fields. Must not be {@code null} .
-
- Returns: This HttpRequest instance for method chaining
body(...) -> HttpRequest
-
Signature:
public HttpRequest body(final Object requestBody) - Summary: Sets the request body to the specified object.
-
Contract:
- The Content-Type header should be set separately when using this method.
-
Parameters:
-
requestBody(Object) — The request body. Accepted types include String, byte\[\], File, InputStream, Reader, or any serializable object.
-
- Returns: This HttpRequest instance for method chaining
get(...) -> HttpResponse
-
Signature:
public HttpResponse get() throws UncheckedIOException - Summary: Executes a GET request and returns the response as an HttpResponse.
-
Parameters:
- (none)
- Returns: The HttpResponse object containing status, headers, and body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public <T> T get(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a GET request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
post(...) -> HttpResponse
-
Signature:
public HttpResponse post() throws UncheckedIOException - Summary: Executes a POST request and returns the response as an HttpResponse.
-
Parameters:
- (none)
- Returns: The HttpResponse object containing status code, headers, and response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
-
Signature:
public <T> T post(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a POST request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
put(...) -> HttpResponse
-
Signature:
public HttpResponse put() throws UncheckedIOException - Summary: Executes a PUT request and returns the response as an HttpResponse.
-
Parameters:
- (none)
- Returns: The HttpResponse object containing status code, headers, and response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
-
Signature:
public <T> T put(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a PUT request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
delete(...) -> HttpResponse
-
Signature:
public HttpResponse delete() throws UncheckedIOException - Summary: Executes a DELETE request and returns the response as an HttpResponse.
-
Parameters:
- (none)
- Returns: The HttpResponse object containing status code, headers, and response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
-
Signature:
public <T> T delete(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a DELETE request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: The deserialized response object
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
head(...) -> HttpResponse
-
Signature:
public HttpResponse head() throws UncheckedIOException - Summary: Executes a HEAD request and returns the response as an HttpResponse.
-
Parameters:
- (none)
- Returns: The HttpResponse object containing status code and headers (body will be empty)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
execute(...) -> HttpResponse
-
Signature:
@Beta public HttpResponse execute(final HttpMethod httpMethod) throws UncheckedIOException - Summary: Executes an HTTP request with the specified method and returns the response as an HttpResponse.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} .
-
- Returns: The HttpResponse object containing status code, headers, and response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request
-
-
Signature:
@Beta public <T> T execute(final HttpMethod httpMethod, final Class<T> resultClass) throws IllegalArgumentException, UncheckedIOException - Summary: Executes an HTTP request with the specified method and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use -
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response object
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
@Beta public void execute(final HttpMethod httpMethod, final File output) throws IllegalArgumentException, UncheckedIOException - Summary: Executes an HTTP request with the specified method and writes the response body to a file.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(File) — The file to write the response body to. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request or file writing
-
-
Signature:
@Beta public void execute(final HttpMethod httpMethod, final OutputStream output) throws IllegalArgumentException, UncheckedIOException - Summary: Executes an HTTP request with the specified method and writes the response body to an output stream.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(OutputStream) — The output stream to write the response body to. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request or stream writing
-
-
Signature:
@Beta public void execute(final HttpMethod httpMethod, final Writer output) throws IllegalArgumentException, UncheckedIOException - Summary: Executes an HTTP request with the specified method and writes the response body to a writer.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(Writer) — The writer to write the response body to. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the request or writing
-
asyncGet(...) -> ContinuableFuture<HttpResponse>
-
Signature:
public ContinuableFuture<HttpResponse> asyncGet() - Summary: Executes an asynchronous GET request and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public ContinuableFuture<HttpResponse> asyncGet(final Executor executor) - Summary: Executes an asynchronous GET request with a custom executor and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass) - Summary: Executes an asynchronous GET request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass, final Executor executor) - Summary: Executes an asynchronous GET request with a custom executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
asyncPost(...) -> ContinuableFuture<HttpResponse>
-
Signature:
public ContinuableFuture<HttpResponse> asyncPost() - Summary: Executes an asynchronous POST request and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public ContinuableFuture<HttpResponse> asyncPost(final Executor executor) - Summary: Executes an asynchronous POST request with a custom executor and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass) - Summary: Executes an asynchronous POST request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass, final Executor executor) - Summary: Executes an asynchronous POST request with a custom executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
asyncPut(...) -> ContinuableFuture<HttpResponse>
-
Signature:
public ContinuableFuture<HttpResponse> asyncPut() - Summary: Executes an asynchronous PUT request and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public ContinuableFuture<HttpResponse> asyncPut(final Executor executor) - Summary: Executes an asynchronous PUT request with a custom executor and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass) - Summary: Executes an asynchronous PUT request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass, final Executor executor) - Summary: Executes an asynchronous PUT request with a custom executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
asyncDelete(...) -> ContinuableFuture<HttpResponse>
-
Signature:
public ContinuableFuture<HttpResponse> asyncDelete() - Summary: Executes an asynchronous DELETE request and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public ContinuableFuture<HttpResponse> asyncDelete(final Executor executor) - Summary: Executes an asynchronous DELETE request with a custom executor and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass) - Summary: Executes an asynchronous DELETE request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass, final Executor executor) - Summary: Executes an asynchronous DELETE request with a custom executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
asyncHead(...) -> ContinuableFuture<HttpResponse>
-
Signature:
public ContinuableFuture<HttpResponse> asyncHead() - Summary: Executes an asynchronous HEAD request and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
- (none)
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public ContinuableFuture<HttpResponse> asyncHead(final Executor executor) - Summary: Executes an asynchronous HEAD request with a custom executor and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
public <T> ContinuableFuture<T> asyncHead(final Class<T> resultClass, final Executor executor) - Summary: Executes an asynchronous HEAD request with a custom executor and the specified result class.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the response
asyncExecute(...) -> ContinuableFuture<HttpResponse>
-
Signature:
@Beta public ContinuableFuture<HttpResponse> asyncExecute(final HttpMethod httpMethod) - Summary: Executes an asynchronous HTTP request with the specified method and returns a ContinuableFuture with the HttpResponse.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
@Beta public ContinuableFuture<HttpResponse> asyncExecute(final HttpMethod httpMethod, final Executor executor) - Summary: Executes an asynchronous HTTP request with the specified method and a custom executor.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the HttpResponse
-
Signature:
@Beta public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Class<T> resultClass) throws IllegalArgumentException - Summary: Executes an asynchronous HTTP request with the specified method and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null
-
-
Signature:
@Beta public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Class<T> resultClass, final Executor executor) throws IllegalArgumentException - Summary: Executes an asynchronous HTTP request with the specified method, custom executor, and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
resultClass(Class<T>) — The class of the expected response object. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete with the deserialized response
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null
-
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final File output) - Summary: Executes an asynchronous HTTP request and writes the response body to a file.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(File) — The file to write the response body to. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the file is written successfully
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final File output, final Executor executor) - Summary: Executes an asynchronous HTTP request with a custom executor and writes the response body to a file.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(File) — The file to write the response body to. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the file is written successfully
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final OutputStream output) - Summary: Executes an asynchronous HTTP request and writes the response body to an output stream.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(OutputStream) — The output stream to write the response body to. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the stream is written successfully
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final OutputStream output, final Executor executor) - Summary: Executes an asynchronous HTTP request with a custom executor and writes the response body to an output stream.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(OutputStream) — The output stream to write the response body to. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the stream is written successfully
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final Writer output) - Summary: Executes an asynchronous HTTP request and writes the response body to a writer.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(Writer) — The writer to write the response body to. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the writer is written successfully
-
Signature:
@Beta public ContinuableFuture<Void> asyncExecute(final HttpMethod httpMethod, final Writer output, final Executor executor) - Summary: Executes an asynchronous HTTP request with a custom executor and writes the response body to a writer.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, DELETE, HEAD, etc.). Must not be {@code null} . -
output(Writer) — The writer to write the response body to. Must not be {@code null} . -
executor(Executor) — The executor to use for the asynchronous operation. Must not be {@code null} .
-
- Returns: A ContinuableFuture that will complete when the writer is written successfully
Class HttpResponse (com.landawn.abacus.http.HttpResponse)
Represents an HTTP response containing status code, headers, and body.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isSuccessful(...) -> boolean
-
Signature:
public boolean isSuccessful() - Summary: Checks if the response status code indicates success.
-
Contract:
- Checks if the response status code indicates success.
- Returns {@code true} if the code is in \[200..300), which means the request was successfully received, understood, and accepted.
- <p> <b> Usage Examples: </b> </p> <pre> {@code HttpResponse response = client.get(HttpResponse.class); if (response.isSuccessful()) { // Process successful response } else { // Handle error } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the response indicates success, {@code false} otherwise
requestUrl(...) -> String
-
Signature:
public String requestUrl() - Summary: Gets the URL of the original request that generated this response.
-
Parameters:
- (none)
- Returns: The request URL as a string
requestSentAtMillis(...) -> long
-
Signature:
public long requestSentAtMillis() - Summary: Gets the timestamp when the request was sent, in milliseconds since epoch.
-
Contract:
- Gets the timestamp when the request was sent, in milliseconds since epoch.
-
Parameters:
- (none)
- Returns: The request sent timestamp in milliseconds
responseReceivedAtMillis(...) -> long
-
Signature:
public long responseReceivedAtMillis() - Summary: Gets the timestamp when the response was received, in milliseconds since epoch.
-
Contract:
- Gets the timestamp when the response was received, in milliseconds since epoch.
-
Parameters:
- (none)
- Returns: The response received timestamp in milliseconds
statusCode(...) -> int
-
Signature:
public int statusCode() - Summary: Gets the HTTP status code of the response.
-
Contract:
- Common status codes include: <ul> <li> 200 - OK </li> <li> 201 - Created </li> <li> 400 - Bad Request </li> <li> 404 - Not Found </li> <li> 500 - Internal Server Error </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code int status = response.statusCode(); if (status == 404) { // Handle not found } } </pre>
-
Parameters:
- (none)
- Returns: The HTTP status code
message(...) -> String
-
Signature:
public String message() - Summary: Gets the status message associated with the status code.
-
Parameters:
- (none)
- Returns: The status message
headers(...) -> Map<String, List<String>>
-
Signature:
public Map<String, List<String>> headers() - Summary: Gets all response headers as a map.
-
Parameters:
- (none)
- Returns: A map of header names to their values
body(...) -> byte\[\]
-
Signature:
public byte[] body() - Summary: Gets the raw response body as a byte array.
-
Parameters:
- (none)
- Returns: The response body as a byte array
-
Signature:
public <T> T body(final Class<T> resultClass) throws IllegalArgumentException - Summary: Deserializes the response body to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.lang.IllegalArgumentException— if resultClass is null
-
-
Signature:
public <T> T body(final Type<T> resultType) throws IllegalArgumentException - Summary: Deserializes the response body to the specified parameterized type.
-
Parameters:
-
resultType(Type<T>) — The type information including generic parameters
-
- Returns: The deserialized response body
-
Throws:
-
java.lang.IllegalArgumentException— if resultType is null
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes the hash code for this HttpResponse.
-
Parameters:
- (none)
- Returns: the hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Determines whether this HttpResponse is equal to another object.
-
Contract:
- Two HttpResponse objects are considered equal if they have the same request URL, status code, message, headers, body format, and body content.
-
Parameters:
-
obj(Object) — The object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this HttpResponse.
-
Parameters:
- (none)
- Returns: a string representation of this object
Class HttpSettings (com.landawn.abacus.http.HttpSettings)
Configuration settings for HTTP requests.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> HttpSettings
-
Signature:
public static HttpSettings create() - Summary: Creates a new HttpSettings instance with default values.
-
Parameters:
- (none)
- Returns: a new HttpSettings instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public HttpSettings() - Summary: Creates a new HttpSettings instance with default values.
-
Parameters:
- (none)
getConnectTimeout(...) -> long
-
Signature:
public long getConnectTimeout() - Summary: Gets the connection timeout in milliseconds.
-
Parameters:
- (none)
- Returns: the connection timeout in milliseconds, or 0 if not set
- See also: #setConnectTimeout(long)
setConnectTimeout(...) -> HttpSettings
-
Signature:
public HttpSettings setConnectTimeout(final long connectTimeout) - Summary: Sets the connection timeout in milliseconds.
-
Contract:
- This timeout begins when the connection attempt starts and expires if the connection cannot be established within the specified time.
- </p> <p> If the timeout expires before a connection is established, a {@link java.net.SocketTimeoutException} will be thrown.
-
Parameters:
-
connectTimeout(long) — the connection timeout in milliseconds (0 = infinite)
-
- Returns: this HttpSettings instance for method chaining
getReadTimeout(...) -> long
-
Signature:
public long getReadTimeout() - Summary: Gets the read timeout in milliseconds.
-
Parameters:
- (none)
- Returns: the read timeout in milliseconds, or 0 if not set
setReadTimeout(...) -> HttpSettings
-
Signature:
public HttpSettings setReadTimeout(final long readTimeout) - Summary: Sets the read timeout in milliseconds.
-
Parameters:
-
readTimeout(long) — the read timeout in milliseconds
-
- Returns: this HttpSettings instance for method chaining
getSSLSocketFactory(...) -> SSLSocketFactory
-
Signature:
public SSLSocketFactory getSSLSocketFactory() - Summary: Gets the SSL socket factory used for HTTPS connections.
-
Parameters:
- (none)
- Returns: the SSL socket factory, or {@code null} if not set
setSSLSocketFactory(...) -> HttpSettings
-
Signature:
public HttpSettings setSSLSocketFactory(final SSLSocketFactory sslSocketFactory) - Summary: Sets the SSL socket factory for HTTPS connections.
-
Parameters:
-
sslSocketFactory(SSLSocketFactory) — the SSL socket factory to use
-
- Returns: this HttpSettings instance for method chaining
getProxy(...) -> Proxy
-
Signature:
public Proxy getProxy() - Summary: Gets the proxy configuration.
-
Parameters:
- (none)
- Returns: the proxy, or {@code null} if not set
setProxy(...) -> HttpSettings
-
Signature:
public HttpSettings setProxy(final Proxy proxy) - Summary: Sets the proxy for HTTP connections.
-
Parameters:
-
proxy(Proxy) — the proxy to use
-
- Returns: this HttpSettings instance for method chaining
getUseCaches(...) -> boolean
-
Signature:
public boolean getUseCaches() - Summary: Gets whether to use caches.
-
Parameters:
- (none)
- Returns: {@code true} if caches should be used, {@code false} otherwise
setUseCaches(...) -> HttpSettings
-
Signature:
public HttpSettings setUseCaches(final boolean useCaches) - Summary: Sets whether to use caches for HTTP connections.
-
Contract:
- When enabled, the HTTP implementation may cache responses.
-
Parameters:
-
useCaches(boolean) — {@code true} to use caches, {@code false} otherwise
-
- Returns: this HttpSettings instance for method chaining
doInput(...) -> boolean
-
Signature:
public boolean doInput() - Summary: Gets whether the connection will be used for input.
-
Parameters:
- (none)
- Returns: {@code true} if the connection will be used for input
- See also: java.net.HttpURLConnection#setDoInput(boolean)
-
Signature:
public HttpSettings doInput(final boolean doInput) - Summary: Sets whether the connection will be used for input.
-
Contract:
- This should almost always be {@code true} (the default).
-
Parameters:
-
doInput(boolean) — {@code true} if the connection will be used for input
-
- Returns: this HttpSettings instance for method chaining
- See also: java.net.HttpURLConnection#setDoInput(boolean)
doOutput(...) -> boolean
-
Signature:
public boolean doOutput() - Summary: Gets whether the connection will be used for output.
-
Parameters:
- (none)
- Returns: {@code true} if the connection will be used for output
- See also: java.net.HttpURLConnection#setDoOutput(boolean)
-
Signature:
public HttpSettings doOutput(final boolean doOutput) - Summary: Sets whether the connection will be used for output.
-
Parameters:
-
doOutput(boolean) — {@code true} if the connection will be used for output
-
- Returns: this HttpSettings instance for method chaining
- See also: java.net.HttpURLConnection#setDoOutput(boolean)
isOneWayRequest(...) -> boolean
-
Signature:
public boolean isOneWayRequest() - Summary: Checks if this is a one-way request (fire-and-forget).
-
Contract:
- Checks if this is a one-way request (fire-and-forget).
-
Parameters:
- (none)
- Returns: {@code true} if this is a one-way request
setOneWayRequest(...) -> HttpSettings
-
Signature:
public HttpSettings setOneWayRequest(final boolean isOneWayRequest) - Summary: Sets whether this is a one-way request (fire-and-forget).
-
Contract:
- When {@code true} , the request will be sent but the response will not be read.
-
Parameters:
-
isOneWayRequest(boolean) — {@code true} for one-way requests
-
- Returns: this HttpSettings instance for method chaining
getContentFormat(...) -> ContentFormat
-
Signature:
public ContentFormat getContentFormat() - Summary: Gets the content format for request/response serialization.
-
Contract:
- If not explicitly set, it will be determined from the Content-Type header.
-
Parameters:
- (none)
- Returns: The content format, or {@code null} if not set
setContentFormat(...) -> HttpSettings
-
Signature:
public HttpSettings setContentFormat(final ContentFormat contentFormat) - Summary: Sets the content format for request/response serialization.
-
Parameters:
-
contentFormat(ContentFormat) — the content format to use
-
- Returns: this HttpSettings instance for method chaining
getContentType(...) -> String
-
Signature:
public String getContentType() - Summary: Gets the Content-Type header value.
-
Contract:
- If not explicitly set but a content format is configured, the content type will be derived from the content format.
-
Parameters:
- (none)
- Returns: The Content-Type header value, or {@code null} if not set
setContentType(...) -> HttpSettings
-
Signature:
public HttpSettings setContentType(final String contentType) - Summary: Sets the Content-Type header.
-
Parameters:
-
contentType(String) — the Content-Type header value
-
- Returns: this HttpSettings instance for method chaining
getContentEncoding(...) -> String
-
Signature:
public String getContentEncoding() - Summary: Gets the Content-Encoding header value.
-
Contract:
- If not explicitly set but a content format is configured, the content encoding will be derived from the content format.
-
Parameters:
- (none)
- Returns: The Content-Encoding header value, or {@code null} if not set
setContentEncoding(...) -> HttpSettings
-
Signature:
public HttpSettings setContentEncoding(final String contentEncoding) - Summary: Sets the Content-Encoding header.
-
Parameters:
-
contentEncoding(String) — the Content-Encoding header value
-
- Returns: this HttpSettings instance for method chaining
basicAuth(...) -> HttpSettings
-
Signature:
@SuppressWarnings("UnusedReturnValue") public HttpSettings basicAuth(final String username, final Object password) - Summary: Sets HTTP Basic Authentication header using the specified username and password.
-
Parameters:
-
username(String) — the username for authentication -
password(Object) — the password for authentication
-
- Returns: this HttpSettings instance for method chaining
header(...) -> HttpSettings
-
Signature:
public HttpSettings header(final String name, final Object value) - Summary: Sets an HTTP header with the specified name and value.
-
Contract:
- If this settings object already has any headers with that name, they are all replaced.
-
Parameters:
-
name(String) — the header name (must not be {@code null} ) -
value(Object) — the header value
-
- Returns: this HttpSettings instance for method chaining
- See also: HttpHeaders
headers(...) -> HttpSettings
-
Signature:
public HttpSettings headers(final String name1, final Object value1, final String name2, final Object value2) - Summary: Sets two HTTP headers with the specified names and values.
-
Contract:
- If this settings object already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value
-
- Returns: this HttpSettings instance for method chaining
- See also: HttpHeaders
-
Signature:
public HttpSettings headers(final String name1, final Object value1, final String name2, final Object value2, final String name3, final Object value3) - Summary: Sets three HTTP headers with the specified names and values.
-
Contract:
- If this settings object already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value -
name3(String) — the third header name -
value3(Object) — the third header value
-
- Returns: this HttpSettings instance for method chaining
- See also: HttpHeaders
-
Signature:
public HttpSettings headers(final Map<String, ?> headers) - Summary: Sets HTTP headers from the specified map.
-
Contract:
- If this settings object already has any headers with the same names, they are all replaced.
-
Parameters:
-
headers(Map<String, ?>) — a map containing header names and values
-
- Returns: this HttpSettings instance for method chaining
- See also: HttpHeaders
-
Signature:
public HttpSettings headers(final HttpHeaders headers) - Summary: Removes all headers on this settings object and adds the specified headers.
-
Parameters:
-
headers(HttpHeaders) — the HttpHeaders to set
-
- Returns: this HttpSettings instance for method chaining
- See also: HttpHeaders
-
Signature:
public HttpHeaders headers() - Summary: Gets the HTTP headers configured in this settings object.
-
Contract:
- If no headers have been set yet, this method creates an empty HttpHeaders object.
-
Parameters:
- (none)
- Returns: the HttpHeaders object (never {@code null} )
- See also: HttpHeaders
copy(...) -> HttpSettings
-
Signature:
public HttpSettings copy() - Summary: Creates a copy of this HttpSettings object.
-
Parameters:
- (none)
- Returns: a new HttpSettings instance with the same configuration
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this HttpSettings object.
-
Parameters:
- (none)
- Returns: a string representation of this object
Class HttpUtil (com.landawn.abacus.http.HttpUtil)
Utility class for HTTP operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
isSuccessfulResponseCode(...) -> boolean
-
Signature:
public static boolean isSuccessfulResponseCode(final int code) - Summary: Checks if the HTTP response code indicates success.
-
Contract:
- Checks if the HTTP response code indicates success.
- A response code is considered successful if it's in the range \[200, 300).
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (HttpUtil.isSuccessfulResponseCode(response.getResponseCode())) { // Process successful response } } </pre>
-
Parameters:
-
code(int) — The HTTP response code to check
-
- Returns: {@code true} if the code indicates success, {@code false} otherwise
isValidHttpHeader(...) -> boolean
-
Signature:
public static boolean isValidHttpHeader(final String key, final String value) - Summary: Validates an HTTP header key-value pair.
-
Parameters:
-
key(String) — The header key to validate -
value(String) — The header value to validate
-
- Returns: {@code true} if the header is valid, {@code false} otherwise
readHttpHeaderValue(...) -> String
-
Signature:
public static String readHttpHeaderValue(final Object value) - Summary: Reads an HTTP header value from various object types.
-
Contract:
- If the value is a Collection, joins multiple values with commas.
-
Parameters:
-
value(Object) — The header value (can be {@code null} , String, Collection, or any object)
-
- Returns: The header value as a string, or {@code null} if value is null
getContentType(...) -> String
-
Signature:
public static String getContentType(final Map<String, ?> httpHeaders) - Summary: Gets the Content-Type header value from HTTP headers.
-
Contract:
- <p> Note: When using a Map parameter, this method checks for both standard and lowercase header names.
-
Parameters:
-
httpHeaders(Map<String, ?>) — The HTTP headers map
-
- Returns: The Content-Type value, or {@code null} if not found
-
Signature:
public static String getContentType(final HttpHeaders httpHeaders) - Summary: Gets the Content-Type header value from HttpHeaders.
-
Parameters:
-
httpHeaders(HttpHeaders) — The HttpHeaders object
-
- Returns: The Content-Type value, or {@code null} if not found
-
Signature:
public static String getContentType(final HttpSettings httpSettings) - Summary: Gets the Content-Type from HttpSettings.
-
Parameters:
-
httpSettings(HttpSettings) — The HttpSettings object
-
- Returns: The Content-Type value, or {@code null} if not found
-
Signature:
public static String getContentType(final HttpURLConnection connection) - Summary: Gets the Content-Type from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The Content-Type value, or {@code null} if not found
-
Signature:
public static String getContentType(final ContentFormat contentFormat) - Summary: Gets the content type string for a ContentFormat.
-
Parameters:
-
contentFormat(ContentFormat) — The content format
-
- Returns: The content type string, or an empty string "" if contentFormat is {@code null} or NONE
getContentEncoding(...) -> String
-
Signature:
public static String getContentEncoding(final Map<String, ?> httpHeaders) - Summary: Gets the Content-Encoding header value from HTTP headers.
-
Contract:
- <p> Note: When using a Map parameter, this method checks for both standard and lowercase header names.
-
Parameters:
-
httpHeaders(Map<String, ?>) — The HTTP headers map
-
- Returns: The Content-Encoding value, or {@code null} if not found
-
Signature:
public static String getContentEncoding(final HttpHeaders httpHeaders) - Summary: Gets the Content-Encoding header value from HttpHeaders.
-
Parameters:
-
httpHeaders(HttpHeaders) — The HttpHeaders object
-
- Returns: The Content-Encoding value, or {@code null} if not found
-
Signature:
public static String getContentEncoding(final HttpSettings httpSettings) - Summary: Gets the Content-Encoding from HttpSettings.
-
Parameters:
-
httpSettings(HttpSettings) — The HttpSettings object
-
- Returns: The Content-Encoding value, or {@code null} if not found
-
Signature:
public static String getContentEncoding(final HttpURLConnection connection) - Summary: Gets the Content-Encoding from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The Content-Encoding value, or {@code null} if not found
-
Signature:
public static String getContentEncoding(final ContentFormat contentFormat) - Summary: Gets the content encoding string for a ContentFormat.
-
Parameters:
-
contentFormat(ContentFormat) — The content format
-
- Returns: The content encoding string, or an empty string "" if contentFormat is {@code null} or has no encoding
getAccept(...) -> String
-
Signature:
public static String getAccept(final Map<String, ?> httpHeaders) - Summary: Gets the Accept header value from HTTP headers.
-
Contract:
- <p> Note: When using a Map parameter, this method checks for both standard and lowercase header names.
-
Parameters:
-
httpHeaders(Map<String, ?>) — The HTTP headers map
-
- Returns: The Accept value, or {@code null} if not found
-
Signature:
public static String getAccept(final HttpHeaders httpHeaders) - Summary: Gets the Accept header value from HttpHeaders.
-
Parameters:
-
httpHeaders(HttpHeaders) — The HttpHeaders object
-
- Returns: The Accept value, or {@code null} if not found
-
Signature:
public static String getAccept(final HttpSettings httpSettings) - Summary: Gets the Accept header from HttpSettings.
-
Parameters:
-
httpSettings(HttpSettings) — The HttpSettings object
-
- Returns: The Accept value, or {@code null} if not found
-
Signature:
public static String getAccept(final HttpURLConnection connection) - Summary: Gets the Accept header from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The Accept value, or {@code null} if not found
getAcceptEncoding(...) -> String
-
Signature:
public static String getAcceptEncoding(final Map<String, ?> httpHeaders) - Summary: Gets the Accept-Encoding header value from HTTP headers.
-
Contract:
- <p> Note: When using a Map parameter, this method checks for both standard and lowercase header names.
-
Parameters:
-
httpHeaders(Map<String, ?>) — The HTTP headers map
-
- Returns: The Accept-Encoding value, or {@code null} if not found
-
Signature:
public static String getAcceptEncoding(final HttpHeaders httpHeaders) - Summary: Gets the Accept-Encoding header value from HttpHeaders.
-
Parameters:
-
httpHeaders(HttpHeaders) — The HttpHeaders object
-
- Returns: The Accept-Encoding value, or {@code null} if not found
-
Signature:
public static String getAcceptEncoding(final HttpSettings httpSettings) - Summary: Gets the Accept-Encoding header from HttpSettings.
-
Parameters:
-
httpSettings(HttpSettings) — The HttpSettings object
-
- Returns: The Accept-Encoding value, or {@code null} if not found
-
Signature:
public static String getAcceptEncoding(final HttpURLConnection connection) - Summary: Gets the Accept-Encoding header from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The Accept-Encoding value, or {@code null} if not found
getAcceptCharset(...) -> String
-
Signature:
public static String getAcceptCharset(final Map<String, ?> httpHeaders) - Summary: Gets the Accept-Charset header value from HTTP headers.
-
Contract:
- <p> Note: When using a Map parameter, this method checks for both standard and lowercase header names.
-
Parameters:
-
httpHeaders(Map<String, ?>) — The HTTP headers map
-
- Returns: The Accept-Charset value, or {@code null} if not found
-
Signature:
public static String getAcceptCharset(final HttpHeaders httpHeaders) - Summary: Gets the Accept-Charset header value from HttpHeaders.
-
Parameters:
-
httpHeaders(HttpHeaders) — The HttpHeaders object
-
- Returns: The Accept-Charset value, or {@code null} if not found
-
Signature:
public static String getAcceptCharset(final HttpSettings httpSettings) - Summary: Gets the Accept-Charset header from HttpSettings.
-
Parameters:
-
httpSettings(HttpSettings) — The HttpSettings object
-
- Returns: The Accept-Charset value, or {@code null} if not found
-
Signature:
public static String getAcceptCharset(final HttpURLConnection connection) - Summary: Gets the Accept-Charset header from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The Accept-Charset value, or {@code null} if not found
getContentFormat(...) -> ContentFormat
-
Signature:
public static ContentFormat getContentFormat(String contentType, String contentEncoding) - Summary: Determines the ContentFormat from content type and encoding strings.
-
Parameters:
-
contentType(String) — The content type (e.g., "application/json") -
contentEncoding(String) — The content encoding (e.g., "gzip")
-
- Returns: The matching ContentFormat, or ContentFormat.NONE if no match is found
-
Signature:
public static ContentFormat getContentFormat(final HttpURLConnection connection) - Summary: Gets the ContentFormat from an HttpURLConnection.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection
-
- Returns: The ContentFormat, or ContentFormat.NONE if not determined
getResponseContentFormat(...) -> ContentFormat
-
Signature:
public static ContentFormat getResponseContentFormat(final Map<String, ?> respHeaders, final ContentFormat requestContentFormat) - Summary: Gets the response ContentFormat based on response headers and request format.
-
Contract:
- If the response doesn't specify a content type, falls back to the request format.
-
Parameters:
-
respHeaders(Map<String, ?>) — The response headers -
requestContentFormat(ContentFormat) — The request content format (used as fallback)
-
- Returns: The response ContentFormat
getParser(...) -> Parser<SC, DC>
-
Signature:
public static <SC extends SerializationConfig<?>, DC extends DeserializationConfig<?>> Parser<SC, DC> getParser(final ContentFormat contentFormat) - Summary: Gets the parser for a specific ContentFormat.
-
Parameters:
-
contentFormat(ContentFormat) — The content format
-
- Returns: The parser for the content format
wrapInputStream(...) -> InputStream
-
Signature:
public static InputStream wrapInputStream(final InputStream is, final ContentFormat contentFormat) - Summary: Wraps an input stream with decompression based on the content format.
-
Parameters:
-
is(InputStream) — The input stream to wrap -
contentFormat(ContentFormat) — The content format indicating compression
-
- Returns: The wrapped input stream, or the original stream if no decompression is needed
wrapOutputStream(...) -> OutputStream
-
Signature:
public static OutputStream wrapOutputStream(final OutputStream os, final ContentFormat contentFormat) - Summary: Wraps an output stream with compression based on the content format.
-
Parameters:
-
os(OutputStream) — The output stream to wrap -
contentFormat(ContentFormat) — The content format indicating compression
-
- Returns: The wrapped output stream, or the original stream if no compression is needed
getOutputStream(...) -> OutputStream
-
Signature:
public static OutputStream getOutputStream(final HttpURLConnection connection, final ContentFormat contentFormat, String contentType, // NOSONAR String contentEncoding) throws IOException - Summary: Gets an output stream from an HttpURLConnection with appropriate headers and wrapping.
-
Contract:
- Sets Content-Type and Content-Encoding headers based on the content format, and wraps the stream with compression if needed.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection -
contentFormat(ContentFormat) — The content format for the request body -
contentType(String) — The Content-Type header value (can be null) -
contentEncoding(String) — The Content-Encoding header value (can be null)
-
- Returns: The output stream, possibly wrapped with compression
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
getInputStream(...) -> InputStream
-
Signature:
public static InputStream getInputStream(final HttpURLConnection connection, final ContentFormat contentFormat) - Summary: Gets an input stream from an HttpURLConnection with appropriate unwrapping.
-
Parameters:
-
connection(HttpURLConnection) — The HTTP connection -
contentFormat(ContentFormat) — The content format for decompression
-
- Returns: The input stream, possibly wrapped with decompression
flush(...) -> void
-
Signature:
public static void flush(final OutputStream os) throws IOException - Summary: Flushes an output stream, handling special cases for compression streams.
-
Parameters:
-
os(OutputStream) — The output stream to flush
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
getRequestCharset(...) -> Charset
-
Signature:
public static Charset getRequestCharset(final HttpHeaders headers) - Summary: Gets the charset to use for HTTP requests based on headers.
-
Contract:
- Extracts the charset from the Content-Type header if present, otherwise returns the default charset (UTF-8).
-
Parameters:
-
headers(HttpHeaders) — The HTTP headers
-
- Returns: The charset to use for the request
getResponseCharset(...) -> Charset
-
Signature:
public static Charset getResponseCharset(final Map<String, ?> headers, final Charset requestCharset) - Summary: Gets the charset to use for HTTP responses based on headers.
-
Contract:
- Extracts the charset from the Content-Type header if present, otherwise returns the request charset as a fallback.
-
Parameters:
-
headers(Map<String, ?>) — The response headers -
requestCharset(Charset) — The charset used in the request (as fallback)
-
- Returns: The charset to use for the response
getCharset(...) -> Charset
-
Signature:
public static Charset getCharset(final String contentType) - Summary: Extracts the charset from a Content-Type header value.
-
Parameters:
-
contentType(String) — The Content-Type header value
-
- Returns: The charset, or the default charset (UTF-8) if not found
-
Signature:
public static Charset getCharset(final String contentType, final Charset defaultIfNull) - Summary: Extracts the charset from a Content-Type header value with a specified default.
-
Parameters:
-
contentType(String) — The Content-Type header value -
defaultIfNull(Charset) — The default charset to return if none is found
-
- Returns: The charset from the content type, or the default if not found
turnOffCertificateValidation(...) -> void
-
Signature:
@Deprecated public static void turnOffCertificateValidation() - Summary: Turns off certificate validation for HTTPS connections.
-
Contract:
- <b> WARNING: This is extremely insecure and should NEVER be used in production code.
-
Parameters:
- (none)
Public Instance Methods
- (none)
Class HttpDate (com.landawn.abacus.http.HttpUtil.HttpDate)
HTTP date parser and formatter.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
parse(...) -> Date
-
Signature:
public static Date parse(final String value) - Summary: Parses an HTTP date string into a Date object.
-
Parameters:
-
value(String) — The date string to parse
-
- Returns: The parsed Date, or {@code null} if the value couldn't be parsed
format(...) -> String
-
Signature:
public static String format(final Date value) - Summary: Formats a Date into an HTTP date string.
-
Parameters:
-
value(Date) — The date to format
-
- Returns: The formatted date string
Public Instance Methods
- (none)
Class OkHttpRequest (com.landawn.abacus.http.OkHttpRequest)
A fluent HTTP request builder and executor based on OkHttp.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> OkHttpRequest
-
Signature:
public static OkHttpRequest create(final String url, final OkHttpClient httpClient) - Summary: Creates a new OkHttpRequest instance with the specified URL and HTTP client.
-
Parameters:
-
url(String) — the URL string for the request -
httpClient(OkHttpClient) — the OkHttpClient to use for executing the request
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest create(final URL url, final OkHttpClient httpClient) - Summary: Creates a new OkHttpRequest instance with the specified URL and HTTP client.
-
Parameters:
-
url(URL) — the URL object for the request -
httpClient(OkHttpClient) — the OkHttpClient to use for executing the request
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest create(final HttpUrl url, final OkHttpClient httpClient) - Summary: Creates a new OkHttpRequest instance with the specified HttpUrl and HTTP client.
-
Parameters:
-
url(HttpUrl) — the HttpUrl object for the request -
httpClient(OkHttpClient) — the OkHttpClient to use for executing the request
-
- Returns: a new OkHttpRequest instance
url(...) -> OkHttpRequest
-
Signature:
public static OkHttpRequest url(final String url) - Summary: Creates a new OkHttpRequest instance with the specified URL using the default HTTP client.
-
Parameters:
-
url(String) — the URL string for the request
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest url(final URL url) - Summary: Creates a new OkHttpRequest instance with the specified URL using the default HTTP client.
-
Parameters:
-
url(URL) — the URL object for the request
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest url(final HttpUrl url) - Summary: Creates a new OkHttpRequest instance with the specified HttpUrl using the default HTTP client.
-
Parameters:
-
url(HttpUrl) — the HttpUrl object for the request
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest url(final String url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new OkHttpRequest instance with the specified URL and timeout settings.
-
Parameters:
-
url(String) — the URL string for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest url(final URL url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new OkHttpRequest instance with the specified URL and timeout settings.
-
Parameters:
-
url(URL) — the URL object for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new OkHttpRequest instance
-
Signature:
public static OkHttpRequest url(final HttpUrl url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new OkHttpRequest instance with the specified HttpUrl and timeout settings.
-
Parameters:
-
url(HttpUrl) — the HttpUrl object for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new OkHttpRequest instance
Public Instance Methods
connectTimeout(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest connectTimeout(final long connectTimeout) - Summary: Sets the connection timeout in milliseconds for this HTTP request.
-
Contract:
- The connection timeout defines how long to wait when establishing a connection to the remote server before timing out.
-
Parameters:
-
connectTimeout(long) — The connection timeout in milliseconds. Must be non-negative.
-
- Returns: This OkHttpRequest instance for method chaining
-
Signature:
public OkHttpRequest connectTimeout(final Duration connectTimeout) - Summary: Sets the connection timeout using a Duration.
-
Parameters:
-
connectTimeout(Duration) — The connection timeout as a Duration
-
- Returns: This OkHttpRequest instance for method chaining
readTimeout(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest readTimeout(final long readTimeout) - Summary: Sets the read timeout in milliseconds for this HTTP request.
-
Parameters:
-
readTimeout(long) — The read timeout in milliseconds. Must be non-negative.
-
- Returns: This OkHttpRequest instance for method chaining
-
Signature:
public OkHttpRequest readTimeout(final Duration readTimeout) - Summary: Sets the read timeout using a Duration.
-
Parameters:
-
readTimeout(Duration) — The read timeout as a Duration
-
- Returns: This OkHttpRequest instance for method chaining
cacheControl(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest cacheControl(final CacheControl cacheControl) - Summary: Sets this request's {@code Cache-Control} header, replacing any cache control headers already present.
-
Contract:
- If {@code cacheControl} doesn't define any directives, this clears this request's cache-control headers.
-
Parameters:
-
cacheControl(CacheControl) — the cache control directives
-
- Returns: this OkHttpRequest instance for method chaining
tag(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest tag(final Object tag) - Summary: Attaches {@code tag} to the request.
-
Contract:
- If the tag is unspecified or {@code null} , the request is canceled by using the request itself as the tag.
-
Parameters:
-
tag(Object) — the tag to attach to the request
-
- Returns: this OkHttpRequest instance for method chaining
-
Signature:
public <T> OkHttpRequest tag(final Class<? super T> type, final T tag) - Summary: Attaches {@code tag} to the request using {@code type} as a key.
-
Parameters:
-
type(Class<? super T>) — the class type used as a key for the tag -
tag(T) — the tag to attach, or {@code null} to remove existing tag
-
- Returns: this OkHttpRequest instance for method chaining
basicAuth(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest basicAuth(final String username, final Object password) - Summary: Sets the Basic Authentication header for this request.
-
Parameters:
-
username(String) — the username for authentication -
password(Object) — the password for authentication
-
- Returns: this OkHttpRequest instance for method chaining
header(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest header(final String name, final Object value) - Summary: Sets the header named {@code name} to {@code value} .
-
Contract:
- If this request already has any headers with that name, they are all replaced.
-
Parameters:
-
name(String) — the header name -
value(Object) — the header value
-
- Returns: this OkHttpRequest instance for method chaining
- See also: Request.Builder#header(String, String), HttpHeaders
headers(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest headers(final String name1, final Object value1, final String name2, final Object value2) - Summary: Sets HTTP headers specified by {@code name1/value1} , {@code name2/value2} .
-
Contract:
- If this request already has any headers with that name, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value
-
- Returns: this OkHttpRequest instance for method chaining
- See also: Request.Builder#header(String, String), HttpHeaders
-
Signature:
public OkHttpRequest headers(final String name1, final Object value1, final String name2, final Object value2, final String name3, final Object value3) - Summary: Sets HTTP headers specified by {@code name1/value1} , {@code name2/value2} , {@code name3/value3} .
-
Contract:
- If this request already has any headers with that name, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value -
name2(String) — the second header name -
value2(Object) — the second header value -
name3(String) — the third header name -
value3(Object) — the third header value
-
- Returns: this OkHttpRequest instance for method chaining
- See also: Request.Builder#header(String, String), HttpHeaders
-
Signature:
public OkHttpRequest headers(final Map<String, ?> headers) - Summary: Sets HTTP headers specified by the key/value entries from the provided Map.
-
Contract:
- If this request already has any headers with that name, they are all replaced.
-
Parameters:
-
headers(Map<String, ?>) — A map containing header names and values
-
- Returns: This OkHttpRequest instance for method chaining
- See also: Request.Builder#header(String, String), HttpHeaders
-
Signature:
public OkHttpRequest headers(final Headers headers) - Summary: Removes all headers on this request and adds the specified headers.
-
Parameters:
-
headers(Headers) — the Headers object containing all headers to set
-
- Returns: this OkHttpRequest instance for method chaining
- See also: Request.Builder#headers(Headers), HttpHeaders
-
Signature:
public OkHttpRequest headers(final HttpHeaders headers) - Summary: Removes all headers on this request and adds the specified headers.
-
Parameters:
-
headers(HttpHeaders) — the HttpHeaders object containing all headers to set
-
- Returns: this OkHttpRequest instance for method chaining
- See also: Request.Builder#headers(Headers), HttpHeaders
addHeader(...) -> OkHttpRequest
-
Signature:
@Deprecated public OkHttpRequest addHeader(final String name, final Object value) - Summary: Adds a header with {@code name} and {@code value} .
-
Parameters:
-
name(String) — the header name -
value(Object) — the header value
-
- Returns: this OkHttpRequest instance for method chaining
removeHeader(...) -> OkHttpRequest
-
Signature:
@Deprecated public OkHttpRequest removeHeader(final String name) - Summary: Removes all headers with the specified name from this request.
-
Parameters:
-
name(String) — the name of the headers to remove
-
- Returns: this OkHttpRequest instance for method chaining
query(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest query(final String query) - Summary: Sets query parameters for {@code GET} or {@code DELETE} request.
-
Parameters:
-
query(String) — the query string
-
- Returns: this OkHttpRequest instance for method chaining
-
Signature:
public OkHttpRequest query(final Map<String, ?> queryParams) - Summary: Sets query parameters for {@code GET} or {@code DELETE} request.
-
Parameters:
-
queryParams(Map<String, ?>) — A map containing query parameter names and values
-
- Returns: This OkHttpRequest instance for method chaining
jsonBody(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest jsonBody(final String json) - Summary: Sets the request body as JSON with Content-Type: application/json.
-
Parameters:
-
json(String) — the JSON string to send as the request body
-
- Returns: this OkHttpRequest instance for method chaining
-
Signature:
public OkHttpRequest jsonBody(final Object obj) - Summary: Sets the request body as JSON with Content-Type: application/json.
-
Parameters:
-
obj(Object) — the object to serialize to JSON and send as the request body
-
- Returns: this OkHttpRequest instance for method chaining
xmlBody(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest xmlBody(final String xml) - Summary: Sets the request body as XML with Content-Type: application/xml.
-
Parameters:
-
xml(String) — the XML string to send as the request body
-
- Returns: this OkHttpRequest instance for method chaining
-
Signature:
public OkHttpRequest xmlBody(final Object obj) - Summary: Sets the request body as XML with Content-Type: application/xml.
-
Parameters:
-
obj(Object) — the object to serialize to XML and send as the request body
-
- Returns: this OkHttpRequest instance for method chaining
formBody(...) -> OkHttpRequest
-
Signature:
public OkHttpRequest formBody(final Map<?, ?> formBodyByMap) - Summary: Sets the request body as form data with Content-Type: application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByMap(Map<?, ?>) — A map containing form field names and values
-
- Returns: This OkHttpRequest instance for method chaining
- See also: FormBody.Builder
-
Signature:
public OkHttpRequest formBody(final Object formBodyByBean) throws IllegalArgumentException - Summary: Sets the request body as form data with Content-Type: application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByBean(Object) — a bean object whose properties will be used as form fields
-
- Returns: this OkHttpRequest instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not a bean class with getter/setter methods
-
- See also: FormBody.Builder
body(...) -> OkHttpRequest
-
Signature:
@Deprecated public OkHttpRequest body(final Map<?, ?> formBodyByMap) - Summary: Sets the request body as form data from a map.
-
Parameters:
-
formBodyByMap(Map<?, ?>) — a map containing form field names and values
-
- Returns: this OkHttpRequest instance for method chaining
- See also: FormBody.Builder
-
Signature:
@Deprecated public OkHttpRequest body(final Object formBodyByBean) - Summary: Sets the request body as form data from a bean object.
-
Parameters:
-
formBodyByBean(Object) — a bean object whose properties will be used as form fields
-
- Returns: this OkHttpRequest instance for method chaining
- See also: FormBody.Builder
-
Signature:
public OkHttpRequest body(final RequestBody body) - Summary: Sets the request body with a custom RequestBody instance.
-
Parameters:
-
body(RequestBody) — the RequestBody to use
-
- Returns: this OkHttpRequest instance for method chaining
- See also: RequestBody
-
Signature:
public OkHttpRequest body(final String content, final MediaType contentType) - Summary: Sets the request body with the specified content and media type.
-
Parameters:
-
content(String) — the string content of the request body -
contentType(MediaType) — the media type of the content, or {@code null} to use default
-
- Returns: this OkHttpRequest instance for method chaining
- See also: RequestBody#create(MediaType, String)
-
Signature:
public OkHttpRequest body(final byte[] content, final MediaType contentType) - Summary: Sets the request body with the specified byte array content and media type.
-
Parameters:
-
content(byte[]) — the byte array content of the request body -
contentType(MediaType) — the media type of the content, or {@code null} to use default
-
- Returns: this OkHttpRequest instance for method chaining
- See also: RequestBody#create(MediaType, byte\[\])
-
Signature:
public OkHttpRequest body(final byte[] content, final int offset, final int byteCount, final MediaType contentType) - Summary: Sets the request body with the specified byte array content, offset, length, and media type.
-
Parameters:
-
content(byte[]) — the byte array content of the request body -
offset(int) — the offset in the byte array to start reading from -
byteCount(int) — the number of bytes to read from the array -
contentType(MediaType) — the media type of the content, or {@code null} to use default
-
- Returns: this OkHttpRequest instance for method chaining
- See also: RequestBody#create(MediaType, byte\[\], int, int)
-
Signature:
public OkHttpRequest body(final File content, final MediaType contentType) - Summary: Sets the request body with the content from the specified file and media type.
-
Parameters:
-
content(File) — the file containing the request body content -
contentType(MediaType) — the media type of the content, or {@code null} to use default
-
- Returns: this OkHttpRequest instance for method chaining
get(...) -> Response
-
Signature:
public Response get() throws IOException - Summary: Executes a GET request and returns the response.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Response response = OkHttpRequest.url("http://localhost:18080/users") .header("Accept", "application/json") .get(); if (response.isSuccessful()) { String body = response.body().string(); } } </pre>
-
Parameters:
- (none)
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
public <T> T get(final Class<T> resultClass) throws IOException - Summary: Executes a GET request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.io.IOException— if the request could not be executed or the response indicates an error
-
post(...) -> Response
-
Signature:
public Response post() throws IOException - Summary: Executes a POST request and returns the response.
-
Parameters:
- (none)
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
public <T> T post(final Class<T> resultClass) throws IOException - Summary: Executes a POST request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.io.IOException— if the request could not be executed or the response indicates an error
-
put(...) -> Response
-
Signature:
public Response put() throws IOException - Summary: Executes a PUT request and returns the response.
-
Parameters:
- (none)
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
public <T> T put(final Class<T> resultClass) throws IOException - Summary: Executes a PUT request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.io.IOException— if the request could not be executed or the response indicates an error
-
patch(...) -> Response
-
Signature:
public Response patch() throws IOException - Summary: Executes a PATCH request and returns the response.
-
Parameters:
- (none)
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
public <T> T patch(final Class<T> resultClass) throws IOException - Summary: Executes a PATCH request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.io.IOException— if the request could not be executed or the response indicates an error
-
delete(...) -> Response
-
Signature:
public Response delete() throws IOException - Summary: Executes a DELETE request and returns the response.
-
Parameters:
- (none)
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
public <T> T delete(final Class<T> resultClass) throws IOException - Summary: Executes a DELETE request and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.io.IOException— if the request could not be executed or the response indicates an error
-
head(...) -> Response
-
Signature:
public Response head() throws IOException - Summary: Executes a HEAD request and returns the response.
-
Contract:
- This is useful for checking if a resource exists or getting metadata without downloading the full content.
-
Parameters:
- (none)
- Returns: The HTTP response (with no body)
-
Throws:
-
java.io.IOException— if the request could not be executed
-
execute(...) -> Response
-
Signature:
@Beta public Response execute(final HttpMethod httpMethod) throws IOException - Summary: Executes an HTTP request with the specified method and returns the response.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD)
-
- Returns: The HTTP response
-
Throws:
-
java.io.IOException— if the request could not be executed
-
-
Signature:
@Beta public <T> T execute(final HttpMethod httpMethod, final Class<T> resultClass) throws IllegalArgumentException, IOException - Summary: Executes an HTTP request with the specified method and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
resultClass(Class<T>) — The class of the expected response object
-
- Returns: The deserialized response body
-
Throws:
-
java.lang.IllegalArgumentException— if resultClass is HttpResponse -
java.io.IOException— if the request could not be executed or the response indicates an error
-
asyncGet(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncGet() - Summary: Executes a GET request asynchronously using the default executor.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Response> future = OkHttpRequest.url("http://localhost:18080/users") .asyncGet(); future.getThenAccept(response -> { if (response.isSuccessful()) { // Process response } }); } </pre>
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncGet(final Executor executor) - Summary: Executes a GET request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — the executor to use for the asynchronous operation
-
- Returns: a ContinuableFuture that will complete with the HTTP response when the request finishes
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass) - Summary: Executes a GET request asynchronously and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
public <T> ContinuableFuture<T> asyncGet(final Class<T> resultClass, final Executor executor) - Summary: Executes a GET request asynchronously using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
asyncPost(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncPost() - Summary: Executes a POST request asynchronously using the default executor.
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncPost(final Executor executor) - Summary: Executes a POST request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass) - Summary: Executes a POST request asynchronously and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
public <T> ContinuableFuture<T> asyncPost(final Class<T> resultClass, final Executor executor) - Summary: Executes a POST request asynchronously using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
asyncPut(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncPut() - Summary: Executes a PUT request asynchronously using the default executor.
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncPut(final Executor executor) - Summary: Executes a PUT request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass) - Summary: Executes a PUT request asynchronously and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
public <T> ContinuableFuture<T> asyncPut(final Class<T> resultClass, final Executor executor) - Summary: Executes a PUT request asynchronously using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
asyncPatch(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncPatch() - Summary: Executes a PATCH request asynchronously using the default executor.
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncPatch(final Executor executor) - Summary: Executes a PATCH request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
public <T> ContinuableFuture<T> asyncPatch(final Class<T> resultClass) - Summary: Executes a PATCH request asynchronously and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
public <T> ContinuableFuture<T> asyncPatch(final Class<T> resultClass, final Executor executor) - Summary: Executes a PATCH request asynchronously using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
asyncDelete(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncDelete() - Summary: Executes a DELETE request asynchronously using the default executor.
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncDelete(final Executor executor) - Summary: Executes a DELETE request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass) - Summary: Executes a DELETE request asynchronously and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
public <T> ContinuableFuture<T> asyncDelete(final Class<T> resultClass, final Executor executor) - Summary: Executes a DELETE request asynchronously using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
asyncHead(...) -> ContinuableFuture<Response>
-
Signature:
public ContinuableFuture<Response> asyncHead() - Summary: Executes a HEAD request asynchronously using the default executor.
-
Parameters:
- (none)
- Returns: a ContinuableFuture that will complete with the HTTP response
-
Signature:
public ContinuableFuture<Response> asyncHead(final Executor executor) - Summary: Executes a HEAD request asynchronously using the specified executor.
-
Parameters:
-
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
asyncExecute(...) -> ContinuableFuture<Response>
-
Signature:
@Beta public ContinuableFuture<Response> asyncExecute(final HttpMethod httpMethod) - Summary: Executes an HTTP request asynchronously with the specified method using the default executor.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD)
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
@Beta public ContinuableFuture<Response> asyncExecute(final HttpMethod httpMethod, final Executor executor) - Summary: Executes an HTTP request asynchronously with the specified method using the specified executor.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the HTTP response
-
Signature:
@Beta public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Class<T> resultClass) - Summary: Executes an HTTP request asynchronously with the specified method and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
resultClass(Class<T>) — The class of the expected response object
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
-
Signature:
@Beta public <T> ContinuableFuture<T> asyncExecute(final HttpMethod httpMethod, final Class<T> resultClass, final Executor executor) - Summary: Executes an HTTP request asynchronously with the specified method using the specified executor and deserializes the response to the specified type.
-
Parameters:
-
httpMethod(HttpMethod) — The HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
resultClass(Class<T>) — The class of the expected response object -
executor(Executor) — The executor to use for the asynchronous operation
-
- Returns: A ContinuableFuture that will complete with the deserialized response body
Class WebUtil (com.landawn.abacus.http.WebUtil)
Utility class providing methods for handling HTTP requests, responses, and cURL command conversions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
convertCurlToHttpRequest(...) -> String
-
Signature:
public static String convertCurlToHttpRequest(final String curl) - Summary: Converts a cURL command string into Java code for creating an HttpRequest.
-
Contract:
- </p> <p> Supported cURL options: </p> <ul> <li> {@code -X, --request} : HTTP method (GET, POST, PUT, DELETE, etc.) </li> <li> {@code -H, --header} : HTTP headers (can be specified multiple times) </li> <li> {@code -d, --data, --data-raw} : Request body data </li> <li> {@code -I} : HEAD request (inferred method) </li> </ul> <p> HTTP Method Detection: </p> <ul> <li> If {@code -X} is specified, uses that method </li> <li> If {@code -d} is present without {@code -X} , defaults to POST </li> <li> If {@code -I} is present without {@code -X} , defaults to HEAD </li> <li> Otherwise defaults to GET </li> </ul> <p> The generated code properly escapes special characters in strings using Java escape sequences.
- If a request body is present, it's declared as a separate {@code requestBody} variable for readability.
-
Parameters:
-
curl(String) — the cURL command string to convert, must not be {@code null} or empty and must start with "curl" (case-insensitive)
-
- Returns: Java code string for creating an equivalent HttpRequest, formatted with proper indentation and line separators
- See also: #convertCurlToOkHttpRequest(String)
convertCurlToOkHttpRequest(...) -> String
-
Signature:
public static String convertCurlToOkHttpRequest(final String curl) - Summary: Converts a cURL command string into Java code for creating an OkHttpRequest.
-
Contract:
- </p> <p> Key differences from {@link #convertCurlToHttpRequest(String)} : </p> <ul> <li> Creates {@code RequestBody} with {@code MediaType} when body is present </li> <li> Automatically extracts {@code MediaType} from Content-Type header </li> <li> Attaches body using {@code .body(requestBody)} instead of passing to method </li> <li> Uses OkHttp-specific method calls ( {@code .post()} , {@code .put()} , etc.) </li> </ul> <p> The generated code includes: </p> <ul> <li> {@code RequestBody} creation with appropriate {@code MediaType} extracted from headers </li> <li> OkHttpRequest builder chain with URL, headers, and body </li> <li> Appropriate HTTP method call ( {@code get()} , {@code post()} , {@code put()} , {@code delete()} , or {@code execute()} ) </li> </ul> <p> HTTP Method Detection follows the same rules as {@link #convertCurlToHttpRequest(String)} : </p> <ul> <li> If {@code -X} is specified, uses that method </li> <li> If {@code -d} is present without {@code -X} , defaults to POST </li> <li> If {@code -I} is present without {@code -X} , defaults to HEAD </li> <li> Otherwise defaults to GET </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code String curl = "curl -X POST http://localhost:18080/users " + "-H \\"Content-Type: application/json\\" " + "-d '{\\"name\\":\\"John\\"}'"; String javaCode = WebUtil.convertCurlToOkHttpRequest(curl); System.out.println(javaCode); } </pre>
-
Parameters:
-
curl(String) — the cURL command string to convert, must not be {@code null} or empty and must start with "curl" (case-insensitive)
-
- Returns: Java code string for creating an equivalent OkHttpRequest, formatted with proper indentation and line separators
- See also: #convertCurlToHttpRequest(String)
createOkHttpRequestForCurl(...) -> OkHttpRequest
-
Signature:
public static OkHttpRequest createOkHttpRequestForCurl(final String url, final Consumer<? super String> logHandler) - Summary: Creates an OkHttpRequest configured to log cURL commands for each HTTP request.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Create request with cURL logging OkHttpRequest request = WebUtil.createOkHttpRequestForCurl( "http://localhost:18080", curl -> logger.debug("cURL command: {}", curl) ); // When you make a request, it will log the cURL equivalent request.header("Authorization", "Bearer token123") .header("Content-Type", "application/json") .jsonBody(requestData) .post(); // The logHandler will receive something like: // curl -X POST 'http://localhost:18080' \\ // -H 'Authorization: Bearer token123' \\ // -H 'Content-Type: application/json' \\ // -d '{"key":"value"}' } </pre>
-
Parameters:
-
url(String) — the base URL for the HTTP request, must not be null -
logHandler(Consumer<? super String>) — consumer that receives the generated cURL command string for each request, must not be null
-
- Returns: an OkHttpRequest configured with cURL logging interceptor
- See also: #createOkHttpRequestForCurl(String, char, Consumer), CurlInterceptor, <a href="https://github.com/mrmike/Ok2Curl">,Ok2Curl - OkHttp to cURL converter,</a>
-
Signature:
public static OkHttpRequest createOkHttpRequestForCurl(final String url, final char quoteChar, final Consumer<? super String> logHandler) - Summary: Creates an OkHttpRequest configured to log cURL commands with a custom quote character.
-
Contract:
- This is useful when you need to generate cURL commands compatible with specific shell environments or documentation standards.
- </p> <p> Common quote character choices: </p> <ul> <li> Single quote ('): Recommended for most Unix/Linux shells, prevents variable expansion </li> <li> Double quote ("): May be needed for Windows CMD or when variable expansion is desired </li> </ul> <p> The generated cURL commands will use the specified quote character for: </p> <ul> <li> URL </li> <li> Header values </li> <li> Request body data </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Use double quotes in generated cURL commands (e.g., for Windows compatibility) OkHttpRequest request = WebUtil.createOkHttpRequestForCurl( "http://localhost:18080", '"', curl -> System.out.println("cURL: " + curl) ); request.header("Content-Type", "application/json") .post(); // Generates: // curl -X POST "http://localhost:18080" \\ // -H "Content-Type: application/json" } </pre>
-
Parameters:
-
url(String) — the base URL for the HTTP request, must not be null -
quoteChar(char) — the character to use for quoting in cURL commands, typically single quote (') or double quote (") -
logHandler(Consumer<? super String>) — consumer that receives the generated cURL command string for each request, must not be null
-
- Returns: an OkHttpRequest configured with cURL logging interceptor using the specified quote character
- See also: #createOkHttpRequestForCurl(String, Consumer), CurlInterceptor
buildCurl(...) -> String
-
Signature:
public static String buildCurl(final String httpMethod, final String url, final Map<String, ?> headers, final String body, final String bodyContentType, final char quoteChar) - Summary: Builds a cURL command string from HTTP request parameters.
-
Contract:
- It handles proper quoting and escaping of all components to ensure the command works correctly when executed.
- </p> <p> The generated cURL command includes: </p> <ul> <li> HTTP method using the {@code -X} flag </li> <li> URL enclosed in the specified quote character </li> <li> All headers using {@code -H} flags with proper quoting and escaping </li> <li> Request body using {@code -d} flag if body is not empty </li> <li> Content-Type header if body is present but Content-Type header is missing </li> </ul> <p> Special handling: </p> <ul> <li> If {@code body} is not empty but Content-Type header is not present in {@code headers} , and {@code bodyContentType} is specified, the Content-Type header is automatically added </li> <li> Header values are read using {@link HttpUtil#readHttpHeaderValue(Object)} to handle various value types (String, List, etc.) </li> <li> Quote characters within strings are properly escaped using {@link Strings#quoteEscaped(String, char)} </li> <li> The command is formatted with line separators at the beginning and end </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, String> headers = new HashMap<>(); headers.put("Content-Type", "application/json"); headers.put("Authorization", "Bearer token123"); String curl = WebUtil.buildCurl( "POST", "http://localhost:18080/users", headers, "{\\"name\\":\\"John\\",\\"email\\":\\"john@example.com\\"}", "application/json", '\\'' ); System.out.println(curl); } </pre>
-
Parameters:
-
httpMethod(String) — the HTTP method (e.g., "GET", "POST", "PUT", "DELETE"), must not be null -
url(String) — the target URL, must not be null -
headers(Map<String, ?>) — map of HTTP headers where values can be String or other types that {@link HttpUtil#readHttpHeaderValue(Object)} can handle (can be {@code null} or empty) -
body(String) — the request body string (can be {@code null} or empty for requests without a body) -
bodyContentType(String) — the MIME type of the body (e.g., "application/json"), used to add Content-Type header if not already present in headers (can be null) -
quoteChar(char) — the character to use for quoting values in the cURL command, typically single quote (') or double quote (")
-
- Returns: a formatted cURL command string with line separators, ready for execution
- See also: HttpUtil#readHttpHeaderValue(Object), Strings#quoteEscaped(String, char)
setContentTypeByRequestBodyType(...) -> void
-
Signature:
public static void setContentTypeByRequestBodyType(final String requestBodyType, final HttpHeaders httpHeaders) - Summary: Sets the Content-Type header based on the request body type if not already present.
-
Contract:
- Sets the Content-Type header based on the request body type if not already present.
- The header is only set if: </p> <ul> <li> The {@code requestBodyType} parameter is not {@code null} or empty </li> <li> The {@code httpHeaders} does not already have a Content-Type header </li> </ul> <p> This method is particularly useful when: </p> <ul> <li> Processing HAR (HTTP Archive) files where body type is specified separately </li> <li> Building HTTP requests programmatically where content type needs to be inferred </li> <li> Importing requests from external sources that specify MIME type separately </li> <li> Ensuring a default Content-Type without overriding existing values </li> </ul> <p> If the Content-Type header is already present in {@code httpHeaders} , this method does nothing, preserving the existing header value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Case 1: Setting Content-Type when not present HttpHeaders headers = HttpHeaders.create(); WebUtil.setContentTypeByRequestBodyType("application/json", headers); // headers now contains: Content-Type: application/json // Case 2: Preserving existing Content-Type HttpHeaders headers2 = HttpHeaders.create(); headers2.setContentType("text/xml"); WebUtil.setContentTypeByRequestBodyType("application/json", headers2); // headers2 still contains: Content-Type: text/xml (not changed) // Case 3: No-op when requestBodyType is empty HttpHeaders headers3 = HttpHeaders.create(); WebUtil.setContentTypeByRequestBodyType("", headers3); // headers3 has no Content-Type header (nothing was set) } </pre>
-
Parameters:
-
requestBodyType(String) — the MIME type of the request body (e.g., "application/json", "text/xml", "application/x-www-form-urlencoded"), can be {@code null} or empty -
httpHeaders(HttpHeaders) — the HttpHeaders object to conditionally update, must not be null
-
- See also: HttpHeaders#setContentType(String), HttpHeaders#get(String)
Public Instance Methods
- (none)
com.landawn.abacus.http.v2
Class HttpRequest (com.landawn.abacus.http.v2.HttpRequest)
A fluent HTTP request builder and executor based on Java 11+ HttpClient.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> HttpRequest
-
Signature:
public static HttpRequest create(final String url, final HttpClient httpClient) - Summary: Creates a new HttpRequest instance with the specified URL and HTTP client.
-
Parameters:
-
url(String) — the URL string for the request -
httpClient(HttpClient) — the HttpClient to use for executing the request
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest create(final URL url, final HttpClient httpClient) - Summary: Creates a new HttpRequest instance with the specified URL and HTTP client.
-
Parameters:
-
url(URL) — the URL object for the request -
httpClient(HttpClient) — the HttpClient to use for executing the request
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest create(final URI uri, final HttpClient httpClient) - Summary: Creates a new HttpRequest instance with the specified URI and HTTP client.
-
Parameters:
-
uri(URI) — the URI object for the request -
httpClient(HttpClient) — the HttpClient to use for executing the request
-
- Returns: a new HttpRequest instance
url(...) -> HttpRequest
-
Signature:
public static HttpRequest url(final String url) - Summary: Creates a new HttpRequest instance with the specified URL using the default HTTP client.
-
Parameters:
-
url(String) — the URL string for the request
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest url(final String url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new HttpRequest instance with the specified URL and timeout settings.
-
Parameters:
-
url(String) — the URL string for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest url(final URL url) - Summary: Creates a new HttpRequest instance with the specified URL using the default HTTP client.
-
Parameters:
-
url(URL) — the URL object for the request
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest url(final URL url, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new HttpRequest instance with the specified URL and timeout settings.
-
Parameters:
-
url(URL) — the URL object for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest url(final URI uri) - Summary: Creates a new HttpRequest instance with the specified URI using the default HTTP client.
-
Parameters:
-
uri(URI) — the URI object for the request
-
- Returns: a new HttpRequest instance
-
Signature:
public static HttpRequest url(final URI uri, final long connectTimeoutInMillis, final long readTimeoutInMillis) - Summary: Creates a new HttpRequest instance with the specified URI and timeout settings.
-
Parameters:
-
uri(URI) — the URI object for the request -
connectTimeoutInMillis(long) — the connection timeout in milliseconds -
readTimeoutInMillis(long) — the read timeout in milliseconds
-
- Returns: a new HttpRequest instance
Public Instance Methods
connectTimeout(...) -> HttpRequest
-
Signature:
public HttpRequest connectTimeout(final Duration connectTimeout) - Summary: Sets the connection timeout for this request.
-
Contract:
- This creates a new HttpClient builder if one doesn't exist, or copies settings from the existing client.
- The connection timeout is the maximum time to wait when establishing a connection to the server.
- If the connection cannot be established within this timeout, the request will fail.
-
Parameters:
-
connectTimeout(Duration) — the connection timeout duration
-
- Returns: this HttpRequest instance for method chaining
readTimeout(...) -> HttpRequest
-
Signature:
public HttpRequest readTimeout(final Duration readTimeout) - Summary: Sets the read timeout for this request.
-
Parameters:
-
readTimeout(Duration) — the read timeout duration
-
- Returns: this HttpRequest instance for method chaining
authenticator(...) -> HttpRequest
-
Signature:
public HttpRequest authenticator(final Authenticator authenticator) - Summary: Sets the authenticator for this request.
-
Contract:
- The authenticator will be used to provide credentials when the server requests authentication (e.g., HTTP Basic or Digest authentication).
-
Parameters:
-
authenticator(Authenticator) — the authenticator to use for providing credentials
-
- Returns: this HttpRequest instance for method chaining
- See also: #basicAuth(String, Object)
basicAuth(...) -> HttpRequest
-
Signature:
public HttpRequest basicAuth(final String username, final Object password) - Summary: Sets the Basic Authentication header for this request.
-
Parameters:
-
username(String) — the username for authentication -
password(Object) — the password for authentication
-
- Returns: this HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
header(...) -> HttpRequest
-
Signature:
public HttpRequest header(final String name, final Object value) - Summary: Sets the HTTP header specified by {@code name/value} .
-
Contract:
- If this HttpRequest already has any headers with that name, they are all replaced.
-
Parameters:
-
name(String) — the header name -
value(Object) — the header value (will be converted to string)
-
- Returns: this HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
headers(...) -> HttpRequest
-
Signature:
public HttpRequest headers(final String name1, final Object value1, final String name2, final Object value2) - Summary: Sets HTTP headers specified by {@code name1/value1} , {@code name2/value2} .
-
Contract:
- If this HttpRequest already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value (will be converted to string) -
name2(String) — the second header name -
value2(Object) — the second header value (will be converted to string)
-
- Returns: this HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
-
Signature:
public HttpRequest headers(final String name1, final Object value1, final String name2, final Object value2, final String name3, final Object value3) - Summary: Sets HTTP headers specified by {@code name1/value1} , {@code name2/value2} , {@code name3/value3} .
-
Contract:
- If this HttpRequest already has any headers with those names, they are all replaced.
-
Parameters:
-
name1(String) — the first header name -
value1(Object) — the first header value (will be converted to string) -
name2(String) — the second header name -
value2(Object) — the second header value (will be converted to string) -
name3(String) — the third header name -
value3(Object) — the third header value (will be converted to string)
-
- Returns: this HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
-
Signature:
public HttpRequest headers(final Map<String, ?> headers) - Summary: Sets HTTP headers specified by the key/value entries from the provided Map.
-
Contract:
- If this HttpRequest already has any headers with those names, they are all replaced.
-
Parameters:
-
headers(Map<String, ?>) — A map containing header names and values
-
- Returns: This HttpRequest instance for method chaining
- See also: HttpHeaders, HttpHeaders.Names, HttpHeaders.Values
query(...) -> HttpRequest
-
Signature:
public HttpRequest query(final String query) - Summary: Sets query parameters for {@code GET} or {@code DELETE} request.
-
Parameters:
-
query(String) — the query string
-
- Returns: this HttpRequest instance for method chaining
-
Signature:
public HttpRequest query(final Map<String, ?> queryParams) - Summary: Sets query parameters for {@code GET} or {@code DELETE} request.
-
Parameters:
-
queryParams(Map<String, ?>) — A map containing query parameter names and values
-
- Returns: This HttpRequest instance for method chaining
jsonBody(...) -> HttpRequest
-
Signature:
public HttpRequest jsonBody(final String json) - Summary: Sets the request body as JSON with Content-Type: application/json.
-
Parameters:
-
json(String) — the JSON string to send as the request body
-
- Returns: this HttpRequest instance for method chaining
-
Signature:
public HttpRequest jsonBody(final Object obj) - Summary: Sets the request body as JSON with Content-Type: application/json.
-
Parameters:
-
obj(Object) — the object to serialize to JSON and send as the request body
-
- Returns: this HttpRequest instance for method chaining
xmlBody(...) -> HttpRequest
-
Signature:
public HttpRequest xmlBody(final String xml) - Summary: Sets the request body as XML with Content-Type: application/xml.
-
Parameters:
-
xml(String) — the XML string to send as the request body
-
- Returns: this HttpRequest instance for method chaining
- See also: #xmlBody(Object)
-
Signature:
public HttpRequest xmlBody(final Object obj) - Summary: Sets the request body as XML with Content-Type: application/xml.
-
Contract:
- This is useful when you have a POJO that you want to send as XML.
-
Parameters:
-
obj(Object) — the object to serialize to XML and send as the request body
-
- Returns: this HttpRequest instance for method chaining
- See also: #xmlBody(String)
formBody(...) -> HttpRequest
-
Signature:
public HttpRequest formBody(final Map<?, ?> formBodyByMap) - Summary: Sets the request body as form data with Content-Type: application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByMap(Map<?, ?>) — A map containing form field names and values
-
- Returns: This HttpRequest instance for method chaining
-
Signature:
public HttpRequest formBody(final Object formBodyByBean) - Summary: Sets the request body as form data with Content-Type: application/x-www-form-urlencoded.
-
Parameters:
-
formBodyByBean(Object) — a bean object whose properties will be used as form fields
-
- Returns: this HttpRequest instance for method chaining
body(...) -> HttpRequest
-
Signature:
public HttpRequest body(final BodyPublisher bodyPublisher) - Summary: Sets the request body with a custom BodyPublisher instance.
-
Parameters:
-
bodyPublisher(BodyPublisher) — the BodyPublisher to use for sending the request body
-
- Returns: this HttpRequest instance for method chaining
- See also: java.net.http.HttpRequest.BodyPublishers
get(...) -> HttpResponse<String>
-
Signature:
public HttpResponse<String> get() throws UncheckedIOException - Summary: Executes a GET request and returns the response with a String body.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code HttpResponse<String> response = HttpRequest.url("http://localhost:18080/users") .header("Accept", "application/json") .get(); if (response.statusCode() == 200) { String body = response.body(); } } </pre>
-
Parameters:
- (none)
- Returns: the HTTP response with String body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
-
Signature:
public <T> HttpResponse<T> get(final HttpResponse.BodyHandler<T> responseBodyHandler) throws UncheckedIOException - Summary: Executes a GET request with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> T get(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a GET request and returns the response body deserialized to the specified type.
-
Parameters:
-
resultClass(Class<T>) — the class of the result type
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
post(...) -> HttpResponse<String>
-
Signature:
public HttpResponse<String> post() - Summary: Executes a POST request and returns the response with a String body.
-
Parameters:
- (none)
- Returns: the HTTP response with String body
-
Signature:
public <T> HttpResponse<T> post(final HttpResponse.BodyHandler<T> responseBodyHandler) throws UncheckedIOException - Summary: Executes a POST request with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> T post(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a POST request and returns the response body deserialized to the specified type.
-
Parameters:
-
resultClass(Class<T>) — the class of the result type
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
put(...) -> HttpResponse<String>
-
Signature:
public HttpResponse<String> put() throws UncheckedIOException - Summary: Executes a PUT request and returns the response with a String body.
-
Parameters:
- (none)
- Returns: the HTTP response with String body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
-
Signature:
public <T> HttpResponse<T> put(final HttpResponse.BodyHandler<T> responseBodyHandler) throws UncheckedIOException - Summary: Executes a PUT request with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> T put(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a PUT request and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
patch(...) -> HttpResponse<String>
-
Signature:
public HttpResponse<String> patch() throws UncheckedIOException - Summary: Executes a PATCH request and returns the response with a String body.
-
Parameters:
- (none)
- Returns: the HTTP response with String body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
-
Signature:
public <T> HttpResponse<T> patch(final HttpResponse.BodyHandler<T> responseBodyHandler) throws UncheckedIOException - Summary: Executes a PATCH request with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> T patch(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a PATCH request and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
delete(...) -> HttpResponse<String>
-
Signature:
public HttpResponse<String> delete() throws UncheckedIOException - Summary: Executes a DELETE request and returns the response with a String body.
-
Parameters:
- (none)
- Returns: the HTTP response with String body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
-
Signature:
public <T> HttpResponse<T> delete(final HttpResponse.BodyHandler<T> responseBodyHandler) throws UncheckedIOException - Summary: Executes a DELETE request with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> T delete(final Class<T> resultClass) throws UncheckedIOException - Summary: Executes a DELETE request and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
head(...) -> HttpResponse<Void>
-
Signature:
public HttpResponse<Void> head() throws UncheckedIOException - Summary: Executes a HEAD request and returns the response.
-
Contract:
- HEAD requests are used to retrieve headers without the response body, which is useful for checking if a resource exists, getting metadata, or checking content length.
-
Parameters:
- (none)
- Returns: the HTTP response (with no body, only headers)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
execute(...) -> HttpResponse<String>
-
Signature:
@Beta public HttpResponse<String> execute(final HttpMethod httpMethod) throws UncheckedIOException - Summary: Executes an HTTP request with the specified method and returns the response with a String body.
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD)
-
- Returns: the HTTP response with String body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
-
Signature:
@Beta public <T> HttpResponse<T> execute(final HttpMethod httpMethod, final HttpResponse.BodyHandler<T> responseBodyHandler) throws IllegalArgumentException, UncheckedIOException - Summary: Executes an HTTP request with the specified method and custom response body handler.
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: the HTTP response with the processed body
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null -
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
@Beta public <T> T execute(final HttpMethod httpMethod, final Class<T> resultClass) throws UncheckedIOException - Summary: Executes an HTTP request with the specified method and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: the deserialized response body
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if the request could not be executed or the response indicates an error
-
asyncGet(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
public CompletableFuture<HttpResponse<String>> asyncGet() - Summary: Executes a GET request asynchronously and returns a CompletableFuture with a String body response.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code CompletableFuture<HttpResponse<String>> future = HttpRequest.url("http://localhost:18080/users") .asyncGet(); future.thenAccept(response -> { if (response.statusCode() == 200) { System.out.println(response.body()); } }); } </pre>
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncGet(final HttpResponse.BodyHandler<T> responseBodyHandler) - Summary: Executes a GET request asynchronously with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> CompletableFuture<T> asyncGet(final Class<T> resultClass) - Summary: Executes a GET request asynchronously and returns the response body deserialized to the specified type.
-
Parameters:
-
resultClass(Class<T>) — the class of the result type
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncGet(final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) - Summary: Executes a GET request asynchronously with a custom response body handler and push promise handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.PushPromiseHandler
asyncPost(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
public CompletableFuture<HttpResponse<String>> asyncPost() - Summary: Executes a POST request asynchronously and returns a CompletableFuture with a String body response.
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPost(final HttpResponse.BodyHandler<T> responseBodyHandler) - Summary: Executes a POST request asynchronously with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> CompletableFuture<T> asyncPost(final Class<T> resultClass) - Summary: Executes a POST request asynchronously and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPost(final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) - Summary: Executes a POST request asynchronously with a custom response body handler and push promise handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.PushPromiseHandler
asyncPut(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
public CompletableFuture<HttpResponse<String>> asyncPut() - Summary: Executes a PUT request asynchronously and returns a CompletableFuture with a String body response.
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPut(final HttpResponse.BodyHandler<T> responseBodyHandler) - Summary: Executes a PUT request asynchronously with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> CompletableFuture<T> asyncPut(final Class<T> resultClass) - Summary: Executes a PUT request asynchronously and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPut(final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) - Summary: Executes a PUT request asynchronously with a custom response body handler and push promise handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.PushPromiseHandler
asyncPatch(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
public CompletableFuture<HttpResponse<String>> asyncPatch() - Summary: Executes a PATCH request asynchronously and returns a CompletableFuture with a String body response.
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPatch(final HttpResponse.BodyHandler<T> responseBodyHandler) - Summary: Executes a PATCH request asynchronously with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> CompletableFuture<T> asyncPatch(final Class<T> resultClass) - Summary: Executes a PATCH request asynchronously and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncPatch(final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) - Summary: Executes a PATCH request asynchronously with a custom response body handler and push promise handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.PushPromiseHandler
asyncDelete(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
public CompletableFuture<HttpResponse<String>> asyncDelete() - Summary: Executes a DELETE request asynchronously and returns a CompletableFuture with a String body response.
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncDelete(final HttpResponse.BodyHandler<T> responseBodyHandler) - Summary: Executes a DELETE request asynchronously with a custom response body handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
public <T> CompletableFuture<T> asyncDelete(final Class<T> resultClass) - Summary: Executes a DELETE request asynchronously and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Signature:
public <T> CompletableFuture<HttpResponse<T>> asyncDelete(final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) - Summary: Executes a DELETE request asynchronously with a custom response body handler and push promise handler.
-
Parameters:
-
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
- See also: java.net.http.HttpResponse.PushPromiseHandler
asyncHead(...) -> CompletableFuture<HttpResponse<Void>>
-
Signature:
public CompletableFuture<HttpResponse<Void>> asyncHead() - Summary: Executes a HEAD request asynchronously and returns a CompletableFuture with no response body.
-
Contract:
- HEAD requests are useful for checking if a resource exists or getting metadata without downloading the full response body.
-
Parameters:
- (none)
- Returns: a CompletableFuture that will complete with the HTTP response
asyncExecute(...) -> CompletableFuture<HttpResponse<String>>
-
Signature:
@Beta public CompletableFuture<HttpResponse<String>> asyncExecute(final HttpMethod httpMethod) - Summary: Executes an HTTP request asynchronously with the specified method and returns a CompletableFuture with a String body response.
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD)
-
- Returns: a CompletableFuture that will complete with the HTTP response
-
Signature:
@Beta public <T> CompletableFuture<HttpResponse<T>> asyncExecute(final HttpMethod httpMethod, final HttpResponse.BodyHandler<T> responseBodyHandler) throws IllegalArgumentException - Summary: Executes an HTTP request asynchronously with the specified method and custom response body handler.
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body
-
- Returns: a CompletableFuture that will complete with the HTTP response
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null
-
- See also: java.net.http.HttpResponse.BodyHandlers
-
Signature:
@Beta public <T> CompletableFuture<T> asyncExecute(final HttpMethod httpMethod, final Class<T> resultClass) throws IllegalArgumentException - Summary: Executes an HTTP request asynchronously with the specified method and returns the response body deserialized to the specified type.
-
Contract:
- An exception is thrown if the response status code indicates an error (not 2xx).
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
resultClass(Class<T>) — the class of the result type to deserialize the response body into
-
- Returns: a CompletableFuture that will complete with the deserialized response body
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null
-
-
Signature:
@Beta public <T> CompletableFuture<HttpResponse<T>> asyncExecute(final HttpMethod httpMethod, final HttpResponse.BodyHandler<T> responseBodyHandler, final PushPromiseHandler<T> pushPromiseHandler) throws IllegalArgumentException - Summary: Executes an HTTP request asynchronously with the specified method, custom response body handler, and push promise handler.
-
Parameters:
-
httpMethod(HttpMethod) — the HTTP method to use (GET, POST, PUT, PATCH, DELETE, HEAD) -
responseBodyHandler(HttpResponse.BodyHandler<T>) — the handler for processing the response body -
pushPromiseHandler(PushPromiseHandler<T>) — the handler for processing HTTP/2 server push promises
-
- Returns: a CompletableFuture that will complete with the HTTP response
-
Throws:
-
java.lang.IllegalArgumentException— if httpMethod is null
-
- See also: java.net.http.HttpResponse.PushPromiseHandler
com.landawn.abacus.logging
Class AbstractLogger (com.landawn.abacus.logging.AbstractLogger)
Abstract base implementation of the Logger interface providing template-based logging methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getName(...) -> String
-
Signature:
@Override public String getName() -
Parameters:
- (none)
- Returns: unspecified
trace(...) -> void
-
Signature:
@Override public void trace(final String template, final Object arg) - Summary: Logs a message at TRACE level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2) - Summary: Logs a message at TRACE level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a message at TRACE level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4) - Summary: Logs a message at TRACE level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5) - Summary: Logs a message at TRACE level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6) - Summary: Logs a message at TRACE level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
@Override public void trace(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6, final Object arg7) - Summary: Logs a message at TRACE level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated @Override public void trace(final String template, final Object... args) - Summary: Logs a message at TRACE level with variable number of parameters.
-
Parameters:
-
template(String) — the message template -
args(Object[]) — the arguments to be substituted in the template
-
-
Signature:
@Override public void trace(final Throwable t, final String msg) - Summary: Logs an exception at the TRACE level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message to log
-
-
Signature:
@Override public void trace(final Throwable t, final String template, final Object arg) - Summary: Logs a formatted message at TRACE level with an exception and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void trace(final Throwable t, final String template, final Object arg1, final Object arg2) - Summary: Logs a formatted message at TRACE level with an exception and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void trace(final Throwable t, final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a formatted message at TRACE level with an exception and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void trace(final Supplier<String> supplier) - Summary: Logs a message at TRACE level using a supplier for lazy evaluation.
-
Contract:
- <p> The supplier is only called if TRACE level is enabled.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated @Override public void trace(final Supplier<String> supplier, final Throwable t) - Summary: Logs a message at TRACE level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
@Override public void trace(final Throwable t, final Supplier<String> supplier) - Summary: Logs a message at TRACE level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
debug(...) -> void
-
Signature:
@Override public void debug(final String template, final Object arg) - Summary: Logs a message at DEBUG level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2) - Summary: Logs a message at DEBUG level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a message at DEBUG level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4) - Summary: Logs a message at DEBUG level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5) - Summary: Logs a message at DEBUG level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6) - Summary: Logs a message at DEBUG level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
@Override public void debug(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6, final Object arg7) - Summary: Logs a message at DEBUG level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated @Override public void debug(final String template, final Object... args) - Summary: Logs a message at DEBUG level with variable number of parameters.
-
Parameters:
-
template(String) — the message template -
args(Object[]) — the arguments to be substituted in the template
-
-
Signature:
@Override public void debug(final Throwable t, final String msg) - Summary: Logs an exception at the DEBUG level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
@Override public void debug(final Throwable t, final String template, final Object arg) - Summary: Logs a formatted message at DEBUG level with an exception and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void debug(final Throwable t, final String template, final Object arg1, final Object arg2) - Summary: Logs a formatted message at DEBUG level with an exception and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void debug(final Throwable t, final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a formatted message at DEBUG level with an exception and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void debug(final Supplier<String> supplier) - Summary: Logs a message at DEBUG level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated @Override public void debug(final Supplier<String> supplier, final Throwable t) - Summary: Logs a message at DEBUG level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
@Override public void debug(final Throwable t, final Supplier<String> supplier) - Summary: Logs a message at DEBUG level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
info(...) -> void
-
Signature:
@Override public void info(final String template, final Object arg) - Summary: Logs a message at INFO level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2) - Summary: Logs a message at INFO level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a message at INFO level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4) - Summary: Logs a message at INFO level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5) - Summary: Logs a message at INFO level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6) - Summary: Logs a message at INFO level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
@Override public void info(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6, final Object arg7) - Summary: Logs a message at INFO level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated @Override public void info(final String template, final Object... args) - Summary: Logs a message at INFO level with variable number of parameters.
-
Parameters:
-
template(String) — the message template -
args(Object[]) — the arguments to be substituted in the template
-
-
Signature:
@Override public void info(final Throwable t, final String msg) - Summary: Logs an exception at the INFO level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
@Override public void info(final Throwable t, final String template, final Object arg) - Summary: Logs a formatted message at INFO level with an exception and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void info(final Throwable t, final String template, final Object arg1, final Object arg2) - Summary: Logs a formatted message at INFO level with an exception and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void info(final Throwable t, final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a formatted message at INFO level with an exception and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void info(final Supplier<String> supplier) - Summary: Logs a message at INFO level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated @Override public void info(final Supplier<String> supplier, final Throwable t) - Summary: Logs a message at INFO level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
@Override public void info(final Throwable t, final Supplier<String> supplier) - Summary: Logs a message at INFO level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
warn(...) -> void
-
Signature:
@Override public void warn(final String template, final Object arg) - Summary: Logs a message at WARN level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2) - Summary: Logs a message at WARN level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a message at WARN level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4) - Summary: Logs a message at WARN level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5) - Summary: Logs a message at WARN level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6) - Summary: Logs a message at WARN level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
@Override public void warn(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6, final Object arg7) - Summary: Logs a message at WARN level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated @Override public void warn(final String template, final Object... args) - Summary: Logs a message at WARN level with variable number of parameters.
-
Parameters:
-
template(String) — the message template -
args(Object[]) — the arguments to be substituted in the template
-
-
Signature:
@Override public void warn(final Throwable t, final String msg) - Summary: Logs an exception at the WARN level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
@Override public void warn(final Throwable t, final String template, final Object arg) - Summary: Logs a formatted message at WARN level with an exception and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void warn(final Throwable t, final String template, final Object arg1, final Object arg2) - Summary: Logs a formatted message at WARN level with an exception and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void warn(final Throwable t, final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a formatted message at WARN level with an exception and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void warn(final Supplier<String> supplier) - Summary: Logs a message at WARN level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated @Override public void warn(final Supplier<String> supplier, final Throwable t) - Summary: Logs a message at WARN level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
@Override public void warn(final Throwable t, final Supplier<String> supplier) - Summary: Logs a message at WARN level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
error(...) -> void
-
Signature:
@Override public void error(final String template, final Object arg) - Summary: Logs a message at ERROR level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2) - Summary: Logs a message at ERROR level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a message at ERROR level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4) - Summary: Logs a message at ERROR level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5) - Summary: Logs a message at ERROR level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6) - Summary: Logs a message at ERROR level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
@Override public void error(final String template, final Object arg1, final Object arg2, final Object arg3, final Object arg4, final Object arg5, final Object arg6, final Object arg7) - Summary: Logs a message at ERROR level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated @Override public void error(final String template, final Object... args) - Summary: Logs a message at ERROR level with variable number of parameters.
-
Parameters:
-
template(String) — the message template -
args(Object[]) — the arguments to be substituted in the template
-
-
Signature:
@Override public void error(final Throwable t, final String msg) - Summary: Logs an exception at the ERROR level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
@Override public void error(final Throwable t, final String template, final Object arg) - Summary: Logs a formatted message at ERROR level with an exception and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
@Override public void error(final Throwable t, final String template, final Object arg1, final Object arg2) - Summary: Logs a formatted message at ERROR level with an exception and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
@Override public void error(final Throwable t, final String template, final Object arg1, final Object arg2, final Object arg3) - Summary: Logs a formatted message at ERROR level with an exception and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
@Override public void error(final Supplier<String> supplier) - Summary: Logs a message at ERROR level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated @Override public void error(final Supplier<String> supplier, final Throwable t) - Summary: Logs a message at ERROR level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
@Override public void error(final Throwable t, final Supplier<String> supplier) - Summary: Logs a message at ERROR level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
Interface Logger (com.landawn.abacus.logging.Logger)
The main Logger interface providing a unified API for logging across different implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getName(...) -> String
-
Signature:
String getName() - Summary: Gets the name of this logger instance.
-
Parameters:
- (none)
- Returns: the name of this logger
isTraceEnabled(...) -> boolean
-
Signature:
boolean isTraceEnabled() - Summary: Checks if the logger instance is enabled for the TRACE level.
-
Contract:
- Checks if the logger instance is enabled for the TRACE level.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (logger.isTraceEnabled()) { logger.trace("Entry count: " + expensiveCalculation()); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if this Logger is enabled for the TRACE level, {@code false} otherwise
trace(...) -> void
-
Signature:
void trace(String msg) - Summary: Logs a message at the TRACE level.
-
Parameters:
-
msg(String) — the message string to be logged
-
-
Signature:
void trace(String template, Object arg) - Summary: Logs a message at the TRACE level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void trace(String template, Object arg1, Object arg2) - Summary: Logs a message at the TRACE level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void trace(String template, Object arg1, Object arg2, Object arg3) - Summary: Logs a message at the TRACE level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void trace(String template, Object arg1, Object arg2, Object arg3, Object arg4) - Summary: Logs a message at the TRACE level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
void trace(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) - Summary: Logs a message at the TRACE level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
void trace(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) - Summary: Logs a message at the TRACE level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
void trace(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) - Summary: Logs a message at the TRACE level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated void trace(String template, Object... args) - Summary: Logs a message at the TRACE level with variable number of arguments.
-
Contract:
- <p> This form avoids superfluous object creation when the logger is disabled for the TRACE level.
-
Parameters:
-
template(String) — the template string -
args(Object[]) — an array of arguments
-
-
Signature:
void trace(String msg, Throwable t) - Summary: Logs an exception at the TRACE level with an accompanying message.
-
Parameters:
-
msg(String) — the message accompanying the exception -
t(Throwable) — the exception or error to log
-
-
Signature:
void trace(Throwable t, String msg) - Summary: Logs an exception at the TRACE level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
void trace(Throwable t, String template, Object arg) - Summary: Logs an exception at the TRACE level with a formatted message and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void trace(Throwable t, String template, Object arg1, Object arg2) - Summary: Logs an exception at the TRACE level with a formatted message and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void trace(Throwable t, String template, Object arg1, Object arg2, Object arg3) - Summary: Logs an exception at the TRACE level with a formatted message and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void trace(Supplier<String> supplier) - Summary: Logs a message at the TRACE level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated void trace(Supplier<String> supplier, Throwable t) - Summary: Logs a message at the TRACE level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
void trace(Throwable t, Supplier<String> supplier) - Summary: Logs a message at the TRACE level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
isDebugEnabled(...) -> boolean
-
Signature:
boolean isDebugEnabled() - Summary: Checks if the logger instance is enabled for the DEBUG level.
-
Contract:
- Checks if the logger instance is enabled for the DEBUG level.
- <p> This method should be used to guard expensive debug message construction.
-
Parameters:
- (none)
- Returns: {@code true} if this Logger is enabled for the DEBUG level, {@code false} otherwise
debug(...) -> void
-
Signature:
void debug(String msg) - Summary: Logs a message at the DEBUG level.
-
Parameters:
-
msg(String) — the message string to be logged
-
-
Signature:
void debug(String template, Object arg) - Summary: Logs a message at the DEBUG level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void debug(String template, Object arg1, Object arg2) - Summary: Logs a message at the DEBUG level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void debug(String template, Object arg1, Object arg2, Object arg3) - Summary: Logs a message at the DEBUG level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void debug(String template, Object arg1, Object arg2, Object arg3, Object arg4) - Summary: Logs a message at the DEBUG level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
void debug(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) - Summary: Logs a message at the DEBUG level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
void debug(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) - Summary: Logs a message at the DEBUG level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
void debug(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) - Summary: Logs a message at the DEBUG level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated void debug(String template, Object... args) - Summary: Logs a message at the DEBUG level with variable number of arguments.
-
Contract:
- <p> This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
-
Parameters:
-
template(String) — the template string -
args(Object[]) — an array of arguments
-
-
Signature:
void debug(String msg, Throwable t) - Summary: Logs an exception at the DEBUG level with an accompanying message.
-
Parameters:
-
msg(String) — the message accompanying the exception -
t(Throwable) — the exception or error to log
-
-
Signature:
void debug(Throwable t, String msg) - Summary: Logs an exception at the DEBUG level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
void debug(Throwable t, String template, Object arg) - Summary: Logs an exception at the DEBUG level with a formatted message and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void debug(Throwable t, String template, Object arg1, Object arg2) - Summary: Logs an exception at the DEBUG level with a formatted message and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void debug(Throwable t, String template, Object arg1, Object arg2, Object arg3) - Summary: Logs an exception at the DEBUG level with a formatted message and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void debug(Supplier<String> supplier) - Summary: Logs a message at the DEBUG level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated void debug(Supplier<String> supplier, Throwable t) - Summary: Logs a message at the DEBUG level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
void debug(Throwable t, Supplier<String> supplier) - Summary: Logs a message at the DEBUG level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
isInfoEnabled(...) -> boolean
-
Signature:
boolean isInfoEnabled() - Summary: Checks if the logger instance is enabled for the INFO level.
-
Contract:
- Checks if the logger instance is enabled for the INFO level.
- <p> This method should be used to guard expensive info message construction.
-
Parameters:
- (none)
- Returns: {@code true} if this Logger is enabled for the INFO level, {@code false} otherwise
info(...) -> void
-
Signature:
void info(String msg) - Summary: Logs a message at the INFO level.
-
Parameters:
-
msg(String) — the message string to be logged
-
-
Signature:
void info(String template, Object arg) - Summary: Logs a message at the INFO level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void info(String template, Object arg1, Object arg2) - Summary: Logs a message at the INFO level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void info(String template, Object arg1, Object arg2, Object arg3) - Summary: Logs a message at the INFO level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void info(String template, Object arg1, Object arg2, Object arg3, Object arg4) - Summary: Logs a message at the INFO level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
void info(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) - Summary: Logs a message at the INFO level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
void info(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) - Summary: Logs a message at the INFO level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
void info(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) - Summary: Logs a message at the INFO level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated void info(String template, Object... args) - Summary: Logs a message at the INFO level with variable number of arguments.
-
Contract:
- <p> This form avoids superfluous object creation when the logger is disabled for the INFO level.
-
Parameters:
-
template(String) — the template string -
args(Object[]) — an array of arguments
-
-
Signature:
void info(String msg, Throwable t) - Summary: Logs an exception at the INFO level with an accompanying message.
-
Parameters:
-
msg(String) — the message accompanying the exception -
t(Throwable) — the exception or error to log
-
-
Signature:
void info(Throwable t, String msg) - Summary: Logs an exception at the INFO level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
void info(Throwable t, String template, Object arg) - Summary: Logs an exception at the INFO level with a formatted message and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void info(Throwable t, String template, Object arg1, Object arg2) - Summary: Logs an exception at the INFO level with a formatted message and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void info(Throwable t, String template, Object arg1, Object arg2, Object arg3) - Summary: Logs an exception at the INFO level with a formatted message and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void info(Supplier<String> supplier) - Summary: Logs a message at the INFO level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated void info(Supplier<String> supplier, Throwable t) - Summary: Logs a message at the INFO level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
void info(Throwable t, Supplier<String> supplier) - Summary: Logs a message at the INFO level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
isWarnEnabled(...) -> boolean
-
Signature:
boolean isWarnEnabled() - Summary: Checks if the logger instance is enabled for the WARN level.
-
Contract:
- Checks if the logger instance is enabled for the WARN level.
- <p> This method should be used to guard expensive warn message construction.
-
Parameters:
- (none)
- Returns: {@code true} if this Logger is enabled for the WARN level, {@code false} otherwise
warn(...) -> void
-
Signature:
void warn(String msg) - Summary: Logs a message at the WARN level.
-
Parameters:
-
msg(String) — the message string to be logged
-
-
Signature:
void warn(String template, Object arg) - Summary: Logs a message at the WARN level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void warn(String template, Object arg1, Object arg2) - Summary: Logs a message at the WARN level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void warn(String template, Object arg1, Object arg2, Object arg3) - Summary: Logs a message at the WARN level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void warn(String template, Object arg1, Object arg2, Object arg3, Object arg4) - Summary: Logs a message at the WARN level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
void warn(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) - Summary: Logs a message at the WARN level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
void warn(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) - Summary: Logs a message at the WARN level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
void warn(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) - Summary: Logs a message at the WARN level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated void warn(String template, Object... args) - Summary: Logs a message at the WARN level with variable number of arguments.
-
Contract:
- <p> This form avoids superfluous object creation when the logger is disabled for the WARN level.
-
Parameters:
-
template(String) — the template string -
args(Object[]) — an array of arguments
-
-
Signature:
void warn(String msg, Throwable t) - Summary: Logs an exception at the WARN level with an accompanying message.
-
Parameters:
-
msg(String) — the message accompanying the exception -
t(Throwable) — the exception or error to log
-
-
Signature:
void warn(Throwable t, String msg) - Summary: Logs an exception at the WARN level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
void warn(Throwable t, String template, Object arg) - Summary: Logs an exception at the WARN level with a formatted message and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void warn(Throwable t, String template, Object arg1, Object arg2) - Summary: Logs an exception at the WARN level with a formatted message and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void warn(Throwable t, String template, Object arg1, Object arg2, Object arg3) - Summary: Logs an exception at the WARN level with a formatted message and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void warn(Supplier<String> supplier) - Summary: Logs a message at the WARN level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated void warn(Supplier<String> supplier, Throwable t) - Summary: Logs a message at the WARN level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
void warn(Throwable t, Supplier<String> supplier) - Summary: Logs a message at the WARN level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
isErrorEnabled(...) -> boolean
-
Signature:
boolean isErrorEnabled() - Summary: Checks if the logger instance is enabled for the ERROR level.
-
Contract:
- Checks if the logger instance is enabled for the ERROR level.
- <p> This method should be used to guard expensive error message construction.
-
Parameters:
- (none)
- Returns: {@code true} if this Logger is enabled for the ERROR level, {@code false} otherwise
error(...) -> void
-
Signature:
void error(String msg) - Summary: Logs a message at the ERROR level.
-
Parameters:
-
msg(String) — the message string to be logged
-
-
Signature:
void error(String template, Object arg) - Summary: Logs a message at the ERROR level with one parameter.
-
Parameters:
-
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void error(String template, Object arg1, Object arg2) - Summary: Logs a message at the ERROR level with two parameters.
-
Parameters:
-
template(String) — the message template containing two placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void error(String template, Object arg1, Object arg2, Object arg3) - Summary: Logs a message at the ERROR level with three parameters.
-
Parameters:
-
template(String) — the message template containing three placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void error(String template, Object arg1, Object arg2, Object arg3, Object arg4) - Summary: Logs a message at the ERROR level with four parameters.
-
Parameters:
-
template(String) — the message template containing four placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument
-
-
Signature:
void error(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) - Summary: Logs a message at the ERROR level with five parameters.
-
Parameters:
-
template(String) — the message template containing five placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument
-
-
Signature:
void error(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) - Summary: Logs a message at the ERROR level with six parameters.
-
Parameters:
-
template(String) — the message template containing six placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument
-
-
Signature:
void error(String template, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) - Summary: Logs a message at the ERROR level with seven parameters.
-
Parameters:
-
template(String) — the message template containing seven placeholders -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument -
arg4(Object) — the fourth argument -
arg5(Object) — the fifth argument -
arg6(Object) — the sixth argument -
arg7(Object) — the seventh argument
-
-
Signature:
@Deprecated void error(String template, Object... args) - Summary: Logs a message at the ERROR level with variable number of arguments.
-
Contract:
- <p> This form avoids superfluous object creation when the logger is disabled for the ERROR level.
-
Parameters:
-
template(String) — the template string -
args(Object[]) — an array of arguments
-
-
Signature:
void error(String msg, Throwable t) - Summary: Logs an exception at the ERROR level with an accompanying message.
-
Parameters:
-
msg(String) — the message accompanying the exception -
t(Throwable) — the exception or error to log
-
-
Signature:
void error(Throwable t, String msg) - Summary: Logs an exception at the ERROR level with an accompanying message.
-
Parameters:
-
t(Throwable) — the exception or error to log -
msg(String) — the message accompanying the exception
-
-
Signature:
void error(Throwable t, String template, Object arg) - Summary: Logs an exception at the ERROR level with a formatted message and one parameter.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg(Object) — the argument to be substituted in the template
-
-
Signature:
void error(Throwable t, String template, Object arg1, Object arg2) - Summary: Logs an exception at the ERROR level with a formatted message and two parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument
-
-
Signature:
void error(Throwable t, String template, Object arg1, Object arg2, Object arg3) - Summary: Logs an exception at the ERROR level with a formatted message and three parameters.
-
Parameters:
-
t(Throwable) — the exception or error to log -
template(String) — the message template -
arg1(Object) — the first argument -
arg2(Object) — the second argument -
arg3(Object) — the third argument
-
-
Signature:
void error(Supplier<String> supplier) - Summary: Logs a message at the ERROR level using a supplier for lazy evaluation.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message
-
-
Signature:
@Deprecated void error(Supplier<String> supplier, Throwable t) - Summary: Logs a message at the ERROR level with an exception using a supplier.
-
Parameters:
-
supplier(Supplier<String>) — the supplier that provides the message -
t(Throwable) — the exception or error to log
-
-
Signature:
void error(Throwable t, Supplier<String> supplier) - Summary: Logs a message at the ERROR level with an exception using a supplier for lazy evaluation.
-
Parameters:
-
t(Throwable) — the exception or error to log -
supplier(Supplier<String>) — the supplier that provides the message
-
Class LoggerFactory (com.landawn.abacus.logging.LoggerFactory)
A factory for creating Logger objects with automatic detection of the logging framework.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getLogger(...) -> Logger
-
Signature:
public static synchronized Logger getLogger(final Class<?> clazz) - Summary: Gets a logger instance for the specified class.
-
Contract:
- If a logger with the same name already exists, the cached instance is returned.
-
Parameters:
-
clazz(Class<?>) — the class for which to get the logger
-
- Returns: a Logger instance for the specified class
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") @SuppressWarnings("fallthrough") public static synchronized Logger getLogger(final String name) - Summary: Gets a logger instance for the specified name.
-
Contract:
- <p> This method returns a cached logger if one exists for the given name, otherwise it creates a new logger using the detected logging framework.
-
Parameters:
-
name(String) — the name of the logger
-
- Returns: a Logger instance for the specified name
Public Instance Methods
- (none)
com.landawn.abacus.parser
Class AvroDeserializationConfig (com.landawn.abacus.parser.AvroDeserializationConfig)
Configuration class for Apache Avro deserialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getSchema(...) -> Schema
-
Signature:
public Schema getSchema() - Summary: Gets the Avro schema used for deserialization.
-
Parameters:
- (none)
- Returns: the Avro schema, or {@code null} if not set
setSchema(...) -> AvroDeserializationConfig
-
Signature:
public AvroDeserializationConfig setSchema(final Schema schema) - Summary: Sets the Avro schema for deserialization.
-
Parameters:
-
schema(Schema) — the Avro schema to use for deserialization
-
- Returns: this instance for method chaining
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes a hash code for this configuration based on its settings.
-
Parameters:
- (none)
- Returns: a hash code value for this configuration
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this configuration with another object for equality.
-
Contract:
- Two configurations are considered equal if they have the same ignored properties, unmatched property handling, and schema.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class ADC (com.landawn.abacus.parser.AvroDeserializationConfig.ADC)
Factory class for creating AvroDeserializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> AvroDeserializationConfig
-
Signature:
public static AvroDeserializationConfig create() - Summary: Creates a new instance of AvroDeserializationConfig with default settings.
-
Parameters:
- (none)
- Returns: a new AvroDeserializationConfig instance
Public Instance Methods
- (none)
Class AvroParser (com.landawn.abacus.parser.AvroParser)
Parser implementation for Apache Avro format serialization and deserialization.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public AvroParser() - Summary: Constructs a new AvroParser instance.
-
Parameters:
- (none)
serialize(...) -> String
-
Signature:
@Override public String serialize(final Object obj, final AvroSerializationConfig config) - Summary: Serializes an object to a Base64 encoded string representation.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(AvroSerializationConfig) — the serialization configuration to use (must contain schema if obj is not SpecificRecord)
-
- Returns: the Base64 encoded string representation of the serialized object
-
Signature:
@Override public void serialize(final Object obj, final AvroSerializationConfig config, final File output) - Summary: Serializes an object to a file with raw binary content (NOT Base64 encoded).
-
Contract:
- <p> The file will be created if it doesn't exist, or overwritten if it does.
- Parent directories must exist or an exception will be thrown.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(AvroSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior) -
output(File) — the output file to write to (must not be {@code null} )
-
-
Signature:
@SuppressFBWarnings @Override public void serialize(final Object obj, final AvroSerializationConfig config, final OutputStream output) - Summary: Serializes an object to an output stream with raw binary content (NOT Base64 encoded).
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(AvroSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior) -
output(OutputStream) — the output stream to write to (must not be {@code null} )
-
-
Signature:
@Deprecated @Override public void serialize(final Object obj, final AvroSerializationConfig config, final Writer output) throws UnsupportedOperationException - Summary: Serialization to Writer is not supported for Avro format.
-
Parameters:
-
obj(Object) — the object to serialize -
config(AvroSerializationConfig) — the serialization configuration -
output(Writer) — the writer (not supported)
-
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as this operation is not supported
-
deserialize(...) -> T
-
Signature:
@Override public <T> T deserialize(String source, AvroDeserializationConfig config, Type<? extends T> targetType) - Summary: Deserializes an object from a Base64 encoded string representation.
-
Contract:
- The input string must be Base64 encoded Avro binary data.
-
Parameters:
-
source(String) — the Base64 encoded string to deserialize from (must not be {@code null} ) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(final String source, final AvroDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from a Base64 encoded string representation.
-
Contract:
- The input string must be Base64 encoded Avro binary data.
-
Parameters:
-
source(String) — the Base64 encoded string to deserialize from (must not be {@code null} ) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(File source, AvroDeserializationConfig config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file containing raw binary data (NOT Base64 encoded).
-
Contract:
- The file should contain raw binary Avro data (not Base64 encoded).
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
@Override public <T> T deserialize(final File source, final AvroDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from a file containing raw binary data (NOT Base64 encoded).
-
Contract:
- The file should contain raw binary Avro data (not Base64 encoded).
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(InputStream source, AvroDeserializationConfig config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream containing raw binary data (NOT Base64 encoded).
-
Contract:
- The stream should contain raw binary Avro data (not Base64 encoded).
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
@Override public <T> T deserialize(final InputStream source, final AvroDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from an input stream containing raw binary data (NOT Base64 encoded).
-
Contract:
- The stream should contain raw binary Avro data (not Base64 encoded).
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(AvroDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Deprecated @Override public <T> T deserialize(Reader source, AvroDeserializationConfig config, Type<? extends T> targetType) throws UnsupportedOperationException - Summary: Deserialization from Reader is not supported for Avro format.
-
Parameters:
-
source(Reader) — the reader (not supported) -
config(AvroDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target type
-
- Returns: never returns
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as this operation is not supported
-
-
Signature:
@Deprecated @Override public <T> T deserialize(final Reader source, final AvroDeserializationConfig config, final Class<? extends T> targetClass) throws UnsupportedOperationException - Summary: Deserialization from Reader is not supported for Avro format.
-
Parameters:
-
source(Reader) — the reader (not supported) -
config(AvroDeserializationConfig) — the deserialization configuration -
targetClass(Class<? extends T>) — the target class
-
- Returns: never returns
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as this operation is not supported
-
Class AvroSerializationConfig (com.landawn.abacus.parser.AvroSerializationConfig)
Configuration class for Apache Avro serialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public AvroSerializationConfig() - Summary: Creates a new instance of AvroSerializationConfig with default settings.
-
Parameters:
- (none)
getSchema(...) -> Schema
-
Signature:
public Schema getSchema() - Summary: Gets the Avro schema used for serialization.
-
Parameters:
- (none)
- Returns: the Avro schema, or {@code null} if not set
setSchema(...) -> AvroSerializationConfig
-
Signature:
public AvroSerializationConfig setSchema(final Schema schema) - Summary: Sets the Avro schema for serialization.
-
Parameters:
-
schema(Schema) — the Avro schema to use for serialization
-
- Returns: this instance for method chaining
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes a hash code for this configuration based on its settings.
-
Parameters:
- (none)
- Returns: a hash code value for this configuration
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this configuration with another object for equality.
-
Contract:
- Two configurations are considered equal if they have the same ignored properties, exclusion settings, transient field handling, and schema.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class ASC (com.landawn.abacus.parser.AvroSerializationConfig.ASC)
Factory class for creating AvroSerializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> AvroSerializationConfig
-
Signature:
public static AvroSerializationConfig create() - Summary: Creates a new instance of AvroSerializationConfig with default settings.
-
Parameters:
- (none)
- Returns: a new AvroSerializationConfig instance
of(...) -> AvroSerializationConfig
-
Signature:
@Deprecated public static AvroSerializationConfig of(final Schema schema) - Summary: Creates a new AvroSerializationConfig with the specified schema.
-
Parameters:
-
schema(Schema) — the Avro schema to use
-
- Returns: a new configured AvroSerializationConfig instance
-
Signature:
@Deprecated public static AvroSerializationConfig of(final Schema schema, final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new AvroSerializationConfig with schema, exclusion policy, and ignored properties.
-
Parameters:
-
schema(Schema) — the Avro schema to use -
exclusion(Exclusion) — the exclusion policy for properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured AvroSerializationConfig instance
Public Instance Methods
- (none)
Class DeserializationConfig (com.landawn.abacus.parser.DeserializationConfig)
Abstract base configuration class for deserialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
ignoreUnmatchedProperty(...) -> boolean
-
Signature:
public boolean ignoreUnmatchedProperty() - Summary: Checks if unmatched properties should be ignored during deserialization.
-
Contract:
- Checks if unmatched properties should be ignored during deserialization.
- When set to {@code true} (default), properties in the source data that don't match any property in the target class will be silently ignored.
- When {@code false} , unmatched properties will cause an exception to be thrown.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (config.ignoreUnmatchedProperty()) { // Extra properties in JSON will be ignored } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if unknown properties can be ignored, {@code false} otherwise
-
Signature:
public C ignoreUnmatchedProperty(final boolean ignoreUnmatchedProperty) - Summary: Sets whether unmatched properties should be ignored during deserialization.
-
Contract:
- Sets whether unmatched properties should be ignored during deserialization.
- This is useful when deserializing data that may contain extra fields not present in the target class.
- <p> When set to {@code false} , the parser will throw an exception (typically {@code IllegalArgumentException} or a parser-specific exception) when encountering properties in the source data that don't have corresponding fields in the target class.
-
Parameters:
-
ignoreUnmatchedProperty(boolean) — {@code true} to ignore unmatched properties, {@code false} to throw an exception
-
- Returns: this configuration instance for method chaining
getElementType(...) -> Type<T>
-
Signature:
public <T> Type<T> getElementType() - Summary: Gets the element type for collection and array deserialization.
-
Contract:
- This type is used when deserializing JSON arrays or XML sequences to determine the type of elements in the collection.
-
Parameters:
- (none)
- Returns: the configured element type, or {@code null} if not set
setElementType(...) -> C
-
Signature:
public C setElementType(final Class<?> elementClass) - Summary: Sets the element type for collection and array deserialization using a Class.
-
Contract:
- This is used when deserializing to collections or arrays to specify the type of elements they contain.
-
Parameters:
-
elementClass(Class<?>) — the class of collection/array elements
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setElementType(final Type<?> type) - Summary: Sets the element type for collection and array deserialization using a Type.
-
Parameters:
-
type(Type<?>) — the type of collection/array elements
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setElementType(final String type) - Summary: Sets the element type for collection and array deserialization using a type name string.
-
Parameters:
-
type(String) — the type name string
-
- Returns: this configuration instance for method chaining
getMapKeyType(...) -> Type<T>
-
Signature:
public <T> Type<T> getMapKeyType() - Summary: Gets the key type for map deserialization.
-
Contract:
- This type is used when deserializing to Map instances to determine the type of keys in the map.
-
Parameters:
- (none)
- Returns: the configured map key type, or {@code null} if not set
setMapKeyType(...) -> C
-
Signature:
public C setMapKeyType(final Class<?> cls) - Summary: Sets the key type for map deserialization using a Class.
-
Contract:
- This is used when deserializing to Map instances to specify the type of keys they contain.
-
Parameters:
-
cls(Class<?>) — the class of map keys
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setMapKeyType(final Type<?> keyType) - Summary: Sets the key type for map deserialization using a Type.
-
Parameters:
-
keyType(Type<?>) — the type of map keys
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setMapKeyType(final String keyType) - Summary: Sets the key type for map deserialization using a type name string.
-
Parameters:
-
keyType(String) — the key type name string
-
- Returns: this configuration instance for method chaining
getMapValueType(...) -> Type<T>
-
Signature:
public <T> Type<T> getMapValueType() - Summary: Gets the value type for map deserialization.
-
Contract:
- This type is used when deserializing to Map instances to determine the type of values in the map.
-
Parameters:
- (none)
- Returns: the configured map value type, or {@code null} if not set
setMapValueType(...) -> C
-
Signature:
public C setMapValueType(final Class<?> cls) - Summary: Sets the value type for map deserialization using a Class.
-
Contract:
- This is used when deserializing to Map instances to specify the type of values they contain.
-
Parameters:
-
cls(Class<?>) — the class of map values
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setMapValueType(final Type<?> valueType) - Summary: Sets the value type for map deserialization using a Type.
-
Parameters:
-
valueType(Type<?>) — the type of map values
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setMapValueType(final String valueType) - Summary: Sets the value type for map deserialization using a type name string.
-
Parameters:
-
valueType(String) — the value type name string
-
- Returns: this configuration instance for method chaining
hasValueTypes(...) -> boolean
-
Signature:
public boolean hasValueTypes() - Summary: Checks if any value types have been configured.
-
Contract:
- Checks if any value types have been configured.
- Returns {@code true} if either individual value types have been set for specific properties or a bean class has been set for value type information.
-
Parameters:
- (none)
- Returns: {@code true} if value types are configured, {@code false} otherwise
getValueType(...) -> Type<T>
-
Signature:
public <T> Type<T> getValueType(final String keyName) - Summary: Gets the value type for a specific property by its key name.
-
Parameters:
-
keyName(String) — the property name, supporting nested properties (e.g., "account.devices.model") - see class documentation
-
- Returns: the type for the specified property, or {@code null} if not configured
-
Signature:
public <T> Type<T> getValueType(final String keyName, final Type<T> defaultType) - Summary: Gets the value type for a specific property by its key name with a default type.
-
Contract:
- If no type is configured for the specified property, returns the default type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<String> stringType = Type.of(String.class); Type<?> type = config.getValueType("unknownProp", stringType); // Returns stringType if "unknownProp" is not configured } </pre>
-
Parameters:
-
keyName(String) — the property name, supporting nested properties (e.g., "account.devices.model") - see class documentation -
defaultType(Type<T>) — the type to return if no type is configured for the property
-
- Returns: the type for the specified property, or defaultType if not configured
setValueType(...) -> C
-
Signature:
public C setValueType(final String keyName, final Class<?> typeClass) - Summary: Sets the value type for a specific property using a Class.
-
Parameters:
-
keyName(String) — the property name, supporting nested properties (e.g., "account.devices.model") - see class documentation -
typeClass(Class<?>) — the class to use for deserializing this property
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setValueType(final String keyName, final Type<?> type) - Summary: Sets the value type for a specific property using a Type.
-
Parameters:
-
keyName(String) — the property name, supporting nested properties (e.g., "account.devices.model") - see class documentation -
type(Type<?>) — the type to use for deserializing this property
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setValueType(final String keyName, final String typeName) - Summary: Sets the value type for a specific property using a type name string.
-
Parameters:
-
keyName(String) — the property name, supporting nested properties (e.g., "account.devices.model") - see class documentation -
typeName(String) — the type name string
-
- Returns: this configuration instance for method chaining
setValueTypes(...) -> C
-
Signature:
public C setValueTypes(final Map<String, Type<?>> valueTypes) - Summary: Sets multiple value types at once using a map.
-
Contract:
- This is useful when configuring types for many properties at once.
-
Parameters:
-
valueTypes(Map<String, Type<?>>) — map of property names to their types
-
- Returns: this configuration instance for method chaining
setValueTypesByBeanClass(...) -> C
-
Signature:
public C setValueTypesByBeanClass(final java.lang.reflect.Type beanType) throws IllegalArgumentException - Summary: Sets value types by analyzing a bean class.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // If Person class has properties: name (String), age (int), address (Address) config.setValueTypesByBeanClass(Person.class); // Now "name", "age", and "address" properties will use their declared types } </pre>
-
Parameters:
-
beanType(java.lang.reflect.Type) — the bean class to extract type information from (may be {@code null} to clear)
-
- Returns: this configuration instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if the specified class is not a valid bean class
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Calculates the hash code for this configuration object.
-
Parameters:
- (none)
- Returns: the hash code value for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this configuration with another object for equality.
-
Contract:
- Two configurations are considered equal if all their settings match.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration object.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Enum Exclusion (com.landawn.abacus.parser.Exclusion)
Enumeration defining property exclusion policies for serialization.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class JsonDeserializationConfig (com.landawn.abacus.parser.JsonDeserializationConfig)
Configuration class for JSON deserialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public JsonDeserializationConfig() - Summary: Constructs a new JsonDeserializationConfig with default settings.
-
Parameters:
- (none)
ignoreNullOrEmpty(...) -> boolean
-
Signature:
public boolean ignoreNullOrEmpty() - Summary: Checks if {@code null} or empty values should be ignored during deserialization.
-
Contract:
- Checks if {@code null} or empty values should be ignored during deserialization.
- <p> When this setting is enabled, {@code null} or empty values in the JSON will not be set on the target object.
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} or empty values are ignored, {@code false} otherwise
- See also: #ignoreNullOrEmpty(boolean)
-
Signature:
public JsonDeserializationConfig ignoreNullOrEmpty(final boolean ignoreNullOrEmpty) - Summary: Sets whether to ignore {@code null} or empty values during deserialization.
-
Contract:
- <p> When enabled, {@code null} or empty CharSequence/Array/Collection/Map values won't be set/added/put to the target bean/array/list/map.
- This is useful when you want to preserve existing values in the target object rather than overwriting them with {@code null} or empty values from the JSON.
-
Parameters:
-
ignoreNullOrEmpty(boolean) — {@code true} to ignore {@code null} or empty values, {@code false} otherwise
-
- Returns: this instance for method chaining
readNullToEmpty(...) -> boolean
-
Signature:
public boolean readNullToEmpty() - Summary: Checks if {@code null} values should be read as empty values.
-
Contract:
- Checks if {@code null} values should be read as empty values.
- <p> This setting determines whether {@code null} values in JSON should be converted to empty instances of the corresponding type during deserialization.
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} values are read as empty, {@code false} otherwise
- See also: #readNullToEmpty(boolean)
-
Signature:
public JsonDeserializationConfig readNullToEmpty(final boolean readNullToEmpty) - Summary: Sets whether to deserialize {@code null} values to empty CharSequence/Array/Collection/Map.
-
Contract:
- <p> When enabled, {@code null} values in JSON will be converted to empty instances instead of {@code null} .
- This is particularly useful when you want to avoid {@code null} checks in your code and prefer working with empty collections or strings.
-
Parameters:
-
readNullToEmpty(boolean) — {@code true} to read {@code null} as empty, {@code false} otherwise
-
- Returns: this instance for method chaining
getMapInstanceType(...) -> Class<? extends Map>
-
Signature:
@SuppressWarnings("rawtypes") public Class<? extends Map> getMapInstanceType() - Summary: Gets the Map implementation class to use when deserializing to Map instances.
-
Contract:
- Gets the Map implementation class to use when deserializing to Map instances.
- <p> This returns the concrete Map class that will be instantiated when the deserializer needs to create a Map instance.
-
Parameters:
- (none)
- Returns: the Map implementation class
- See also: #setMapInstanceType(Class)
setMapInstanceType(...) -> JsonDeserializationConfig
-
Signature:
@SuppressWarnings("rawtypes") public JsonDeserializationConfig setMapInstanceType(final Class<? extends Map> mapInstanceType) throws IllegalArgumentException - Summary: Sets the Map implementation class to use when deserializing to Map instances.
-
Contract:
- Sets the Map implementation class to use when deserializing to Map instances.
- The specified class must be a concrete implementation of Map with a no-argument constructor.
-
Parameters:
-
mapInstanceType(Class<? extends Map>) — the Map implementation class to use (must not be {@code null} )
-
- Returns: this instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if mapInstanceType is {@code null}
-
setPropHandler(...) -> JsonDeserializationConfig
-
Signature:
public JsonDeserializationConfig setPropHandler(final String propName, final BiConsumer<? super Collection<Object>, ?> handler) throws IllegalArgumentException - Summary: Sets a custom handler for processing collection property values during deserialization.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code config.setPropHandler("items", (collection, element) -> { // Custom processing for each element if (element != null && isValid(element)) { collection.add(processElement(element)); } }); // For nested properties config.setPropHandler("account.devices.model", (collection, model) -> { collection.add(model.toString().toUpperCase()); }); } </pre>
-
Parameters:
-
propName(String) — the property name (supports nested properties like "account.devices.model") -
handler(BiConsumer<? super Collection<Object>, ?>) — the handler to process collection values (first parameter is Collection or Map, second is current element/entry)
-
- Returns: this instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if propName is empty or handler is {@code null}
-
getPropHandler(...) -> BiConsumer<? super Collection<Object>, ?>
-
Signature:
public BiConsumer<? super Collection<Object>, ?> getPropHandler(final String propName) - Summary: Gets the property handler for the specified property name.
-
Contract:
- If no handler has been registered for the property, this method returns {@code null} .
-
Parameters:
-
propName(String) — the property name (must not be empty)
-
- Returns: the handler for the property, or {@code null} if not set
- See also: #setPropHandler(String, BiConsumer)
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Calculates the hash code for this configuration object.
-
Parameters:
- (none)
- Returns: the hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this configuration with another object for equality.
-
Contract:
- <p> Two JsonDeserializationConfig objects are considered equal if all their settings match, including: </p> <ul> <li> All inherited settings from {@link DeserializationConfig} </li> <li> ignoreNullOrEmpty setting </li> <li> readNullToEmpty setting </li> <li> mapInstanceType </li> <li> All registered property handlers </li> </ul>
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration object.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class JDC (com.landawn.abacus.parser.JsonDeserializationConfig.JDC)
Factory class for creating JsonDeserializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> JsonDeserializationConfig
-
Signature:
public static JsonDeserializationConfig create() - Summary: Creates a new instance of JsonDeserializationConfig with default settings.
-
Parameters:
- (none)
- Returns: a new JsonDeserializationConfig instance
of(...) -> JsonDeserializationConfig
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final Class<?> elementClass) - Summary: Creates a new JsonDeserializationConfig with the specified element type.
-
Parameters:
-
elementClass(Class<?>) — the class of collection/array elements
-
- Returns: a new configured JsonDeserializationConfig instance
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final Class<?> keyClass, final Class<?> valueClass) - Summary: Creates a new JsonDeserializationConfig with specified map key and value types.
-
Parameters:
-
keyClass(Class<?>) — the class of map keys -
valueClass(Class<?>) — the class of map values
-
- Returns: a new configured JsonDeserializationConfig instance
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonDeserializationConfig with property matching and ignored properties settings.
-
Parameters:
-
ignoreUnmatchedProperty(boolean) — whether to ignore properties that don't match the target class -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonDeserializationConfig instance
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final Class<?> elementClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonDeserializationConfig with element type and property settings.
-
Parameters:
-
elementClass(Class<?>) — the class of collection/array elements -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonDeserializationConfig instance
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final Class<?> keyClass, final Class<?> valueClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonDeserializationConfig with map types and property settings.
-
Parameters:
-
keyClass(Class<?>) — the class of map keys -
valueClass(Class<?>) — the class of map values -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonDeserializationConfig instance
-
Signature:
@Deprecated public static JsonDeserializationConfig of(final Class<?> elementClass, final Class<?> keyClass, final Class<?> valueClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonDeserializationConfig with all type and property settings.
-
Parameters:
-
elementClass(Class<?>) — the class of collection/array elements -
keyClass(Class<?>) — the class of map keys -
valueClass(Class<?>) — the class of map values -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonDeserializationConfig instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public JDC() - Summary: Constructs a new JDC instance.
-
Parameters:
- (none)
Interface JsonParser (com.landawn.abacus.parser.JsonParser)
Interface for JSON parsing and serialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
readString(...) -> T
-
Signature:
<T> T readString(String source, Type<? extends T> targetType) - Summary: Parses a JSON string into an object of the specified type.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ) -
targetType(Type<? extends T>) — the type of the target object to deserialize into (must not be {@code null} )
-
- Returns: the parsed object of type T, never {@code null}
-
Signature:
<T> T readString(String source, Class<? extends T> targetType) - Summary: Parses a JSON string into an object of the specified type.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ) -
targetType(Class<? extends T>) — the class of the target object to deserialize into (must not be {@code null} )
-
- Returns: the parsed object of type T, never {@code null}
-
Signature:
<T> T readString(String source, JsonDeserializationConfig config, Type<? extends T> targetType) - Summary: Parses a JSON string into an object of the specified type with custom configuration.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ) -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the target object to deserialize into (must not be {@code null} )
-
- Returns: the parsed object of type T, never {@code null}
-
Signature:
<T> T readString(String source, JsonDeserializationConfig config, Class<? extends T> targetType) - Summary: Parses a JSON string into an object of the specified type with custom configuration.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ) -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the target object to deserialize into (must not be {@code null} )
-
- Returns: the parsed object of type T, never {@code null}
-
Signature:
void readString(String source, Object[] output) - Summary: Parses a JSON string into an existing array.
-
Contract:
- The array must be pre-allocated with the correct size to match the JSON array length.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ); must contain a JSON array -
output(Object[]) — the pre-allocated array to populate with parsed values (must not be {@code null} )
-
-
Signature:
void readString(String source, JsonDeserializationConfig config, Object[] output) - Summary: Parses a JSON string into an existing array with custom configuration.
-
Contract:
- The array must be pre-allocated with the correct size to match the JSON array length.
-
Parameters:
-
source(String) — the JSON string to parse (must not be {@code null} ); must contain a JSON array -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
output(Object[]) — the pre-allocated array to populate with parsed values (must not be {@code null} )
-
-
Signature:
void readString(String source, Collection<?> output) - Summary: Parses a JSON string into an existing Collection.
-
Parameters:
-
source(String) — the JSON string to parse, must contain a JSON array -
output(Collection<?>) — the Collection to populate with parsed values, must not be {@code null} ; existing elements are preserved
-
-
Signature:
void readString(String source, JsonDeserializationConfig config, Collection<?> output) - Summary: Parses a JSON string into an existing Collection with custom configuration.
-
Parameters:
-
source(String) — the JSON string to parse, must contain a JSON array -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
output(Collection<?>) — the Collection to populate with parsed values, must not be {@code null} ; existing elements are preserved
-
-
Signature:
void readString(String source, Map<?, ?> output) - Summary: Parses a JSON string into an existing Map.
-
Parameters:
-
source(String) — the JSON string to parse, must contain a JSON object -
output(Map<?, ?>) — the Map to populate with parsed key-value pairs, must not be {@code null} ; existing entries are preserved
-
-
Signature:
void readString(String source, JsonDeserializationConfig config, Map<?, ?> output) - Summary: Parses a JSON string into an existing Map with custom configuration.
-
Parameters:
-
source(String) — the JSON string to parse, must contain a JSON object -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
output(Map<?, ?>) — the Map to populate with parsed key-value pairs, must not be {@code null} ; existing entries are preserved
-
deserialize(...) -> T
-
Signature:
<T> T deserialize(String source, int fromIndex, int toIndex, Type<? extends T> targetType) - Summary: Parses a substring of a JSON string into an object of the specified type.
-
Contract:
- This method allows parsing a portion of a larger string without creating a substring, which can improve performance when working with large strings.
-
Parameters:
-
source(String) — the JSON string containing the data to parse -
fromIndex(int) — the starting index (inclusive) of the JSON content -
toIndex(int) — the ending index (exclusive) of the JSON content -
targetType(Type<? extends T>) — the type of the target object
-
- Returns: the parsed object of type T
-
Signature:
<T> T deserialize(String source, int fromIndex, int toIndex, Class<? extends T> targetType) - Summary: Parses a substring of a JSON string into an object of the specified type.
-
Contract:
- This method allows parsing a portion of a larger string without creating a substring, which can improve performance when working with large strings.
-
Parameters:
-
source(String) — the JSON string containing the data to parse -
fromIndex(int) — the starting index (inclusive) of the JSON content -
toIndex(int) — the ending index (exclusive) of the JSON content -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the parsed object of type T
-
Signature:
<T> T deserialize(String source, int fromIndex, int toIndex, JsonDeserializationConfig config, Type<? extends T> targetType) - Summary: Parses a substring of a JSON string into an object with custom configuration.
-
Contract:
- This method allows parsing a portion of a larger string without creating a substring, which can improve performance when working with large strings.
-
Parameters:
-
source(String) — the JSON string containing the data to parse -
fromIndex(int) — the starting index (inclusive) of the JSON content -
toIndex(int) — the ending index (exclusive) of the JSON content -
config(JsonDeserializationConfig) — the deserialization configuration to control parsing behavior -
targetType(Type<? extends T>) — the type of the target object
-
- Returns: the parsed object of type T
-
Signature:
<T> T deserialize(String source, int fromIndex, int toIndex, JsonDeserializationConfig config, Class<? extends T> targetType) - Summary: Parses a substring of a JSON string into an object with custom configuration.
-
Contract:
- This method allows parsing a portion of a larger string without creating a substring, which can improve performance when working with large strings.
-
Parameters:
-
source(String) — the JSON string containing the data to parse -
fromIndex(int) — the starting index (inclusive) of the JSON content -
toIndex(int) — the ending index (exclusive) of the JSON content -
config(JsonDeserializationConfig) — the deserialization configuration to control parsing behavior -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the parsed object of type T
stream(...) -> Stream<T>
-
Signature:
<T> Stream<T> stream(String source, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements lazily from a JSON string.
-
Contract:
- The stream should be closed after use to free resources.
-
Parameters:
-
source(String) — the JSON string containing a JSON array -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(String source, JsonDeserializationConfig config, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements lazily with custom configuration from a JSON string.
-
Contract:
- The stream should be closed after use to free resources.
-
Parameters:
-
source(String) — the JSON string containing a JSON array -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(File source, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from a file.
-
Contract:
- The stream should be closed after use to free resources and close the underlying file handle.
-
Parameters:
-
source(File) — the JSON file containing a JSON array, must exist and be readable -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(File source, JsonDeserializationConfig config, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from a file with custom configuration.
-
Contract:
- The stream should be closed after use to free resources and close the underlying file handle.
-
Parameters:
-
source(File) — the JSON file containing a JSON array, must exist and be readable -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(InputStream source, boolean closeInputStreamWhenStreamIsClosed, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from an InputStream.
-
Contract:
- The closeInputStreamWhenStreamIsClosed parameter controls whether the input stream is closed when the returned stream is closed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.json"); Stream<Item> stream = parser.stream(is, true, Type.of(Item.class))) { stream.limit(100) .forEach(item -> process(item)); } // InputStream is automatically closed when stream is closed } </pre>
-
Parameters:
-
source(InputStream) — the input stream containing a JSON array, must not be null -
closeInputStreamWhenStreamIsClosed(boolean) — if {@code true} , the input stream will be closed when the returned stream is closed -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(InputStream source, boolean closeInputStreamWhenStreamIsClosed, JsonDeserializationConfig config, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from an InputStream with custom configuration.
-
Contract:
- The closeInputStreamWhenStreamIsClosed parameter controls whether the input stream is closed when the returned stream is closed.
-
Parameters:
-
source(InputStream) — the input stream containing a JSON array, must not be null -
closeInputStreamWhenStreamIsClosed(boolean) — if {@code true} , the input stream will be closed when the returned stream is closed -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(Reader source, boolean closeReaderWhenStreamIsClosed, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from a Reader.
-
Contract:
- The closeReaderWhenStreamIsClosed parameter controls whether the reader is closed when the returned stream is closed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("data.json"); Stream<Product> stream = parser.stream(reader, true, Type.of(Product.class))) { Map<String, List<Product>> grouped = stream .collect(Collectors.groupingBy(Product::getCategory)); } // Reader is automatically closed when stream is closed } </pre>
-
Parameters:
-
source(Reader) — the reader containing a JSON array, must not be null -
closeReaderWhenStreamIsClosed(boolean) — if {@code true} , the reader will be closed when the returned stream is closed -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
-
Signature:
<T> Stream<T> stream(Reader source, boolean closeReaderWhenStreamIsClosed, JsonDeserializationConfig config, Type<? extends T> elementType) - Summary: Creates a stream for parsing JSON array elements from a Reader with custom configuration.
-
Contract:
- The closeReaderWhenStreamIsClosed parameter controls whether the reader is closed when the returned stream is closed.
-
Parameters:
-
source(Reader) — the reader containing a JSON array, must not be null -
closeReaderWhenStreamIsClosed(boolean) — if {@code true} , the reader will be closed when the returned stream is closed -
config(JsonDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
elementType(Type<? extends T>) — the type of array elements. Only Bean/Map/Collection/Array/Dataset element types are supported.
-
- Returns: a Stream of parsed elements that must be closed after use
Class JsonSerializationConfig (com.landawn.abacus.parser.JsonSerializationConfig)
Configuration class for JSON serialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public JsonSerializationConfig() - Summary: Creates a new instance of JsonSerializationConfig with default settings.
-
Parameters:
- (none)
writeNullToEmpty(...) -> boolean
-
Signature:
public boolean writeNullToEmpty() - Summary: Checks if {@code null} values should be written as empty values.
-
Contract:
- Checks if {@code null} values should be written as empty values.
- When enabled, {@code null} values will be serialized as empty strings, empty arrays, or empty objects depending on the expected type.
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} values should be written as empty strings/arrays/objects, {@code false} otherwise
-
Signature:
public JsonSerializationConfig writeNullToEmpty(final boolean writeNullToEmpty) - Summary: Sets whether {@code null} values should be written as empty values during serialization.
-
Contract:
- Sets whether {@code null} values should be written as empty values during serialization.
- When enabled, {@code null} values will be serialized as empty strings, empty arrays, or empty objects depending on the expected type.
- This is useful when the consuming system cannot handle {@code null} values.
-
Parameters:
-
writeNullToEmpty(boolean) — {@code true} to write {@code null} as empty, {@code false} to write as null
-
- Returns: this instance for method chaining
writeDatasetByRow(...) -> boolean
-
Signature:
public boolean writeDatasetByRow() - Summary: Checks if Dataset should be written row by row.
-
Contract:
- Checks if Dataset should be written row by row.
- When enabled, Dataset will be serialized as an array of row objects.
- When disabled (default), Dataset will be serialized with column-based structure.
-
Parameters:
- (none)
- Returns: {@code true} if Dataset is written by rows, {@code false} if by columns
-
Signature:
public JsonSerializationConfig writeDatasetByRow(final boolean writeDatasetByRow) - Summary: Sets whether Dataset should be serialized row by row.
-
Contract:
- Sets whether Dataset should be serialized row by row.
- When enabled, Dataset will be serialized as an array of row objects where each object represents a row with column names as keys.
- When disabled (default), Dataset will be serialized with a column-based structure.
-
Parameters:
-
writeDatasetByRow(boolean) — {@code true} to write by rows, {@code false} to write by columns
-
- Returns: this instance for method chaining
writeRowColumnKeyType(...) -> boolean
-
Signature:
public boolean writeRowColumnKeyType() - Summary: Checks if row and column key types should be written for Sheet objects.
-
Contract:
- Checks if row and column key types should be written for Sheet objects.
-
Parameters:
- (none)
- Returns: {@code true} if key types should be written, {@code false} otherwise
-
Signature:
public JsonSerializationConfig writeRowColumnKeyType(final boolean writeRowColumnKeyType) - Summary: Sets whether to include row and column key type information when serializing Sheet objects.
-
Contract:
- Sets whether to include row and column key type information when serializing Sheet objects.
- <p> <b> Usage Examples: </b> </p> <pre> {@code JsonSerializationConfig config = new JsonSerializationConfig() .writeRowColumnKeyType(true); // Output will include type information for row/column keys // Useful when keys are not simple strings } </pre>
-
Parameters:
-
writeRowColumnKeyType(boolean) — {@code true} to include key type information, {@code false} otherwise
-
- Returns: this instance for method chaining
writeColumnType(...) -> boolean
-
Signature:
public boolean writeColumnType() - Summary: Checks if column type information should be written for Dataset and Sheet objects.
-
Contract:
- Checks if column type information should be written for Dataset and Sheet objects.
- When enabled, the type of each column will be included in the serialized output.
-
Parameters:
- (none)
- Returns: {@code true} if column types should be written, {@code false} otherwise
-
Signature:
public JsonSerializationConfig writeColumnType(final boolean writeColumnType) - Summary: Sets whether to include column type information when serializing Dataset and Sheet objects.
-
Contract:
- Sets whether to include column type information when serializing Dataset and Sheet objects.
- When enabled, the type of each column will be included in the serialized output, which helps preserve type information for proper deserialization.
-
Parameters:
-
writeColumnType(boolean) — {@code true} to include column type information, {@code false} otherwise
-
- Returns: this instance for method chaining
setCharQuotation(...) -> JsonSerializationConfig
-
Signature:
@Deprecated @Override public JsonSerializationConfig setCharQuotation(final char charQuotation) - Summary: Sets the character quotation for char values.
-
Parameters:
-
charQuotation(char) — the character to use for quoting char values
-
- Returns: this instance for method chaining
setStringQuotation(...) -> JsonSerializationConfig
-
Signature:
@Deprecated @Override public JsonSerializationConfig setStringQuotation(final char stringQuotation) - Summary: Sets the string quotation character.
-
Parameters:
-
stringQuotation(char) — the character to use for quoting strings
-
- Returns: this instance for method chaining
noCharQuotation(...) -> JsonSerializationConfig
-
Signature:
@Deprecated @Override public JsonSerializationConfig noCharQuotation() - Summary: Disables character quotation.
-
Contract:
- Characters in JSON must be represented as quoted strings.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noStringQuotation(...) -> JsonSerializationConfig
-
Signature:
@Deprecated @Override public JsonSerializationConfig noStringQuotation() - Summary: Disables string quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noQuotation(...) -> JsonSerializationConfig
-
Signature:
@Deprecated @Override public JsonSerializationConfig noQuotation() - Summary: Disables all quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
quotePropName(...) -> boolean
-
Signature:
public boolean quotePropName() - Summary: Checks if property names should be quoted in the JSON output.
-
Contract:
- Checks if property names should be quoted in the JSON output.
- The default value is {@code true} if not set, which conforms to the JSON specification.
-
Parameters:
- (none)
- Returns: {@code true} if property names should be quoted, {@code false} otherwise
-
Signature:
public JsonSerializationConfig quotePropName(final boolean quotePropName) - Summary: Sets whether property names should be quoted in the JSON output.
-
Contract:
- Sets whether property names should be quoted in the JSON output.
- According to strict JSON specification, property names should always be quoted.
-
Parameters:
-
quotePropName(boolean) — {@code true} to quote property names (standard), {@code false} otherwise
-
- Returns: this instance for method chaining
quoteMapKey(...) -> boolean
-
Signature:
public boolean quoteMapKey() - Summary: Checks if map keys should be quoted in the JSON output.
-
Contract:
- Checks if map keys should be quoted in the JSON output.
- The default value is {@code true} if not set.
-
Parameters:
- (none)
- Returns: {@code true} if map keys should be quoted, {@code false} otherwise
-
Signature:
public JsonSerializationConfig quoteMapKey(final boolean quoteMapKey) - Summary: Sets whether map keys should be quoted in the JSON output.
-
Contract:
- Sets whether map keys should be quoted in the JSON output.
- When serializing Map objects, this determines if the keys should be surrounded by quotes.
-
Parameters:
-
quoteMapKey(boolean) — {@code true} to quote map keys, {@code false} otherwise
-
- Returns: this instance for method chaining
bracketRootValue(...) -> boolean
-
Signature:
public boolean bracketRootValue() - Summary: Checks if the root value should be enclosed with brackets.
-
Contract:
- Checks if the root value should be enclosed with brackets.
- The default value is {@code true} if not set.
-
Parameters:
- (none)
- Returns: {@code true} if root value should be bracketed, {@code false} otherwise
-
Signature:
public JsonSerializationConfig bracketRootValue(final boolean bracketRootValue) - Summary: Sets whether to enclose the JSON string/text with '{' and '}' or '\[' and '\]'.
-
Contract:
- This determines if the root element should be wrapped with brackets when it's a single value that would not normally be bracketed.
-
Parameters:
-
bracketRootValue(boolean) — {@code true} to bracket root value, {@code false} otherwise
-
- Returns: this instance for method chaining
wrapRootValue(...) -> boolean
-
Signature:
public boolean wrapRootValue() - Summary: Checks if the root value should be wrapped with its type name.
-
Contract:
- Checks if the root value should be wrapped with its type name.
-
Parameters:
- (none)
- Returns: {@code true} if root value should be wrapped, {@code false} otherwise
-
Signature:
public JsonSerializationConfig wrapRootValue(final boolean wrapRootValue) - Summary: Sets whether to wrap the root value with its type name as a property.
-
Contract:
- When enabled, the output will include the class name as a wrapper property.
-
Parameters:
-
wrapRootValue(boolean) — {@code true} to wrap root value with type name, {@code false} otherwise
-
- Returns: this instance for method chaining
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Calculates the hash code for this configuration object.
-
Parameters:
- (none)
- Returns: the hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this configuration with another object for equality.
-
Contract:
- Two configurations are considered equal if all their settings match.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration object.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class JSC (com.landawn.abacus.parser.JsonSerializationConfig.JSC)
Factory class for creating JsonSerializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> JsonSerializationConfig
-
Signature:
public static JsonSerializationConfig create() - Summary: Creates a new instance of JsonSerializationConfig with default settings.
-
Parameters:
- (none)
- Returns: a new JsonSerializationConfig instance
of(...) -> JsonSerializationConfig
-
Signature:
@Deprecated public static JsonSerializationConfig of(final boolean quotePropName, final boolean quoteMapKey) - Summary: Creates a new JsonSerializationConfig with specified quote settings.
-
Parameters:
-
quotePropName(boolean) — whether to quote property names -
quoteMapKey(boolean) — whether to quote map keys
-
- Returns: a new configured JsonSerializationConfig instance
-
Signature:
@Deprecated public static JsonSerializationConfig of(final DateTimeFormat dateTimeFormat) - Summary: Creates a new JsonSerializationConfig with specified date time format.
-
Parameters:
-
dateTimeFormat(DateTimeFormat) — the date time format to use
-
- Returns: a new configured JsonSerializationConfig instance
-
Signature:
@Deprecated public static JsonSerializationConfig of(final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonSerializationConfig with exclusion settings and ignored properties.
-
Parameters:
-
exclusion(Exclusion) — the exclusion policy for properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonSerializationConfig instance
-
Signature:
@Deprecated public static JsonSerializationConfig of(final boolean quotePropName, final boolean quoteMapKey, final DateTimeFormat dateTimeFormat, final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new JsonSerializationConfig with all specified settings.
-
Parameters:
-
quotePropName(boolean) — whether to quote property names -
quoteMapKey(boolean) — whether to quote map keys -
dateTimeFormat(DateTimeFormat) — the date time format to use -
exclusion(Exclusion) — the exclusion policy for properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of class to set of property names to ignore
-
- Returns: a new configured JsonSerializationConfig instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public JSC() - Summary: Constructs a new JSC instance.
-
Parameters:
- (none)
Class JsonXmlSerializationConfig (com.landawn.abacus.parser.JsonXmlSerializationConfig)
Base configuration class for JSON and XML serialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getCharQuotation(...) -> char
-
Signature:
public char getCharQuotation() - Summary: Gets the character used for quoting char values.
-
Parameters:
- (none)
- Returns: the char quotation character
setCharQuotation(...) -> C
-
Signature:
public C setCharQuotation(final char charQuotation) - Summary: Sets the character to use for quoting char values.
-
Parameters:
-
charQuotation(char) — the character to use (', ", or 0)
-
- Returns: this instance for method chaining
getStringQuotation(...) -> char
-
Signature:
public char getStringQuotation() - Summary: Gets the character used for quoting string values.
-
Parameters:
- (none)
- Returns: the string quotation character
setStringQuotation(...) -> C
-
Signature:
public C setStringQuotation(final char stringQuotation) - Summary: Sets the character to use for quoting string values.
-
Parameters:
-
stringQuotation(char) — the character to use (', ", or 0)
-
- Returns: this instance for method chaining
noCharQuotation(...) -> C
-
Signature:
@SuppressWarnings("UnusedReturnValue") public C noCharQuotation() - Summary: Disables character quotation by setting the quotation character to 0.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noStringQuotation(...) -> C
-
Signature:
@SuppressWarnings("UnusedReturnValue") public C noStringQuotation() - Summary: Disables string quotation by setting the quotation character to 0.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noQuotation(...) -> C
-
Signature:
@SuppressWarnings("UnusedReturnValue") public C noQuotation() - Summary: Disables both character and string quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
getDateTimeFormat(...) -> DateTimeFormat
-
Signature:
public DateTimeFormat getDateTimeFormat() - Summary: Gets the date time format used for serializing date/time values.
-
Parameters:
- (none)
- Returns: the current date time format
setDateTimeFormat(...) -> C
-
Signature:
public C setDateTimeFormat(final DateTimeFormat dateTimeFormat) - Summary: Sets the date time format for serializing date/time values.
-
Parameters:
-
dateTimeFormat(DateTimeFormat) — the date time format to use
-
- Returns: this instance for method chaining
prettyFormat(...) -> boolean
-
Signature:
public boolean prettyFormat() - Summary: Checks if pretty formatting is enabled.
-
Contract:
- Checks if pretty formatting is enabled.
- When enabled, the output will include line breaks and indentation for better readability.
-
Parameters:
- (none)
- Returns: {@code true} if pretty format is enabled, {@code false} otherwise
-
Signature:
public C prettyFormat(final boolean prettyFormat) - Summary: Sets whether to enable pretty formatting.
-
Contract:
- When enabled, the output will be formatted with line breaks and indentation, making it more human-readable but larger in size.
-
Parameters:
-
prettyFormat(boolean) — {@code true} to enable pretty formatting, {@code false} otherwise
-
- Returns: this instance for method chaining
getIndentation(...) -> String
-
Signature:
public String getIndentation() - Summary: Gets the indentation string used for pretty formatting.
-
Parameters:
- (none)
- Returns: the indentation string
setIndentation(...) -> C
-
Signature:
public C setIndentation(final String indentation) - Summary: Sets the indentation string used for pretty formatting.
-
Contract:
- This is only used when pretty formatting is enabled.
-
Parameters:
-
indentation(String) — the indentation string to use
-
- Returns: this instance for method chaining
getPropNamingPolicy(...) -> NamingPolicy
-
Signature:
public NamingPolicy getPropNamingPolicy() - Summary: Gets the property naming policy used during serialization.
-
Parameters:
- (none)
- Returns: the property naming policy, or {@code null} if using default naming
setPropNamingPolicy(...) -> C
-
Signature:
public C setPropNamingPolicy(final NamingPolicy propNamingPolicy) - Summary: Sets the property naming policy for serialization.
-
Parameters:
-
propNamingPolicy(NamingPolicy) — the naming policy to use
-
- Returns: this instance for method chaining
writeLongAsString(...) -> boolean
-
Signature:
public boolean writeLongAsString() - Summary: Checks if long values should be written as strings.
-
Contract:
- Checks if long values should be written as strings.
-
Parameters:
- (none)
- Returns: {@code true} if longs are written as strings, {@code false} otherwise
-
Signature:
public C writeLongAsString(final boolean writeLongAsString) - Summary: Sets whether to write long values as strings.
-
Parameters:
-
writeLongAsString(boolean) — {@code true} to write longs as strings, {@code false} otherwise
-
- Returns: this instance for method chaining
writeNullStringAsEmpty(...) -> boolean
-
Signature:
public boolean writeNullStringAsEmpty() - Summary: Checks if {@code null} strings should be written as empty strings.
-
Contract:
- Checks if {@code null} strings should be written as empty strings.
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} strings are written as empty, {@code false} otherwise
-
Signature:
public C writeNullStringAsEmpty(final boolean writeNullStringAsEmpty) - Summary: Sets whether to write {@code null} string values as empty strings.
-
Contract:
- When enabled, {@code null} string properties will be serialized as "" instead of {@code null} .
-
Parameters:
-
writeNullStringAsEmpty(boolean) — {@code true} to write {@code null} as empty string, {@code false} otherwise
-
- Returns: this instance for method chaining
writeNullNumberAsZero(...) -> boolean
-
Signature:
public boolean writeNullNumberAsZero() - Summary: Checks if {@code null} numbers should be written as zero.
-
Contract:
- Checks if {@code null} numbers should be written as zero.
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} numbers are written as zero, {@code false} otherwise
-
Signature:
public C writeNullNumberAsZero(final boolean writeNullNumberAsZero) - Summary: Sets whether to write {@code null} number values as zero.
-
Contract:
- When enabled, {@code null} numeric properties will be serialized as 0 (or 0.0 for decimals).
-
Parameters:
-
writeNullNumberAsZero(boolean) — {@code true} to write {@code null} as zero, {@code false} otherwise
-
- Returns: this instance for method chaining
writeNullBooleanAsFalse(...) -> boolean
-
Signature:
public boolean writeNullBooleanAsFalse() - Summary: Checks if {@code null} booleans should be written as {@code false} .
-
Contract:
- Checks if {@code null} booleans should be written as {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if {@code null} booleans are written as {@code false} , {@code false} otherwise
-
Signature:
public C writeNullBooleanAsFalse(final boolean writeNullBooleanAsFalse) - Summary: Sets whether to write {@code null} boolean values as {@code false} .
-
Contract:
- When enabled, {@code null} Boolean properties will be serialized as {@code false} instead of {@code null} .
-
Parameters:
-
writeNullBooleanAsFalse(boolean) — {@code true} to write {@code null} as {@code false} , {@code false} otherwise
-
- Returns: this instance for method chaining
writeBigDecimalAsPlain(...) -> boolean
-
Signature:
public boolean writeBigDecimalAsPlain() - Summary: Checks if BigDecimal values should be written in plain format.
-
Contract:
- Checks if BigDecimal values should be written in plain format.
-
Parameters:
- (none)
- Returns: {@code true} if BigDecimals are written as plain strings, {@code false} otherwise
-
Signature:
public C writeBigDecimalAsPlain(final boolean writeBigDecimalAsPlain) - Summary: Sets whether to write BigDecimal values in plain format (without scientific notation).
-
Contract:
- When enabled, BigDecimal values will always be written in plain decimal notation.
-
Parameters:
-
writeBigDecimalAsPlain(boolean) — {@code true} to write in plain format, {@code false} otherwise
-
- Returns: this instance for method chaining
failOnEmptyBean(...) -> boolean
-
Signature:
public boolean failOnEmptyBean() - Summary: Checks if serialization should fail when encountering empty beans.
-
Contract:
- Checks if serialization should fail when encountering empty beans.
-
Parameters:
- (none)
- Returns: {@code true} if should fail on empty beans, {@code false} otherwise
-
Signature:
public C failOnEmptyBean(final boolean failOnEmptyBean) - Summary: Sets whether serialization should fail when encountering empty beans.
-
Contract:
- Sets whether serialization should fail when encountering empty beans.
- When disabled, empty beans will be serialized as empty objects ({}).
-
Parameters:
-
failOnEmptyBean(boolean) — {@code true} to fail on empty beans, {@code false} to allow
-
- Returns: this instance for method chaining
supportCircularReference(...) -> boolean
-
Signature:
public boolean supportCircularReference() - Summary: Checks if circular references are supported during serialization.
-
Contract:
- Checks if circular references are supported during serialization.
-
Parameters:
- (none)
- Returns: {@code true} if circular references are supported, {@code false} otherwise
-
Signature:
public C supportCircularReference(final boolean supportCircularReference) - Summary: Sets whether to support circular references during serialization.
-
Contract:
- When enabled, circular references will be handled gracefully instead of causing stack overflow.
-
Parameters:
-
supportCircularReference(boolean) — {@code true} to support circular references, {@code false} otherwise
-
- Returns: this instance for method chaining
Class KryoDeserializationConfig (com.landawn.abacus.parser.KryoDeserializationConfig)
Configuration class for Kryo deserialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public KryoDeserializationConfig() - Summary: Constructs a new KryoDeserializationConfig with default settings.
-
Parameters:
- (none)
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes a hash code for this configuration based on its settings.
-
Parameters:
- (none)
- Returns: a hash code value for this configuration
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class KDC (com.landawn.abacus.parser.KryoDeserializationConfig.KDC)
Factory class for creating {@link KryoDeserializationConfig} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> KryoDeserializationConfig
-
Signature:
public static KryoDeserializationConfig create() - Summary: Creates a new instance of {@link KryoDeserializationConfig} with default settings.
-
Parameters:
- (none)
- Returns: a new {@link KryoDeserializationConfig} instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public KDC() - Summary: Constructs a new KDC instance.
-
Parameters:
- (none)
Class KryoParser (com.landawn.abacus.parser.KryoParser)
High-performance binary serialization parser using the Kryo framework.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
serialize(...) -> String
-
Signature:
@Override public String serialize(final Object obj, final KryoSerializationConfig config) - Summary: Serializes an object to a Base64 encoded string representation.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(KryoSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior)
-
- Returns: the Base64 encoded string representation of the serialized object
-
Signature:
@Override public void serialize(final Object obj, final KryoSerializationConfig config, final File output) - Summary: Serializes an object to a file with raw binary content (NOT Base64 encoded).
-
Contract:
- <p> The file will be created if it doesn't exist, or overwritten if it does.
- Parent directories must exist or an exception will be thrown.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(KryoSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior) -
output(File) — the output file to write to (must not be {@code null} )
-
-
Signature:
@Override public void serialize(final Object obj, final KryoSerializationConfig config, final OutputStream output) - Summary: Serializes an object to an output stream with raw binary content (NOT Base64 encoded).
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(KryoSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior) -
output(OutputStream) — the output stream to write to (must not be {@code null} )
-
-
Signature:
@Override public void serialize(final Object obj, final KryoSerializationConfig config, final Writer output) - Summary: Serializes an object to a writer with Base64 encoded content.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(KryoSerializationConfig) — the serialization configuration to use (may be {@code null} for default behavior) -
output(Writer) — the writer to write to (must not be {@code null} )
-
deserialize(...) -> T
-
Signature:
@Override public <T> T deserialize(String source, KryoDeserializationConfig config, Type<? extends T> targetType) - Summary: Deserializes an object from a Base64 encoded string representation.
-
Contract:
- The input string must be Base64 encoded Kryo binary data.
-
Parameters:
-
source(String) — the Base64 encoded string to deserialize from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(final String source, final KryoDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from a Base64 encoded string representation.
-
Contract:
- The input string must be Base64 encoded Kryo binary data.
-
Parameters:
-
source(String) — the Base64 encoded string to deserialize from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(File source, KryoDeserializationConfig config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file containing raw binary data (NOT Base64 encoded).
-
Contract:
- The file should contain raw binary Kryo data (not Base64 encoded).
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
@Override public <T> T deserialize(final File source, final KryoDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from a file containing raw binary data (NOT Base64 encoded).
-
Contract:
- The file should contain raw binary Kryo data (not Base64 encoded).
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(InputStream source, KryoDeserializationConfig config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream containing raw binary data (NOT Base64 encoded).
-
Contract:
- The stream should contain raw binary Kryo data (not Base64 encoded).
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
@Override public <T> T deserialize(final InputStream source, final KryoDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from an input stream containing raw binary data (NOT Base64 encoded).
-
Contract:
- The stream should contain raw binary Kryo data (not Base64 encoded).
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Signature:
@Override public <T> T deserialize(Reader source, KryoDeserializationConfig config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a reader containing Base64 encoded content.
-
Contract:
- The reader should contain Base64 encoded Kryo binary data.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading
-
-
Signature:
@Override public <T> T deserialize(final Reader source, final KryoDeserializationConfig config, final Class<? extends T> targetClass) - Summary: Deserializes an object from a reader containing Base64 encoded content.
-
Contract:
- The reader should contain Base64 encoded Kryo binary data.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
config(KryoDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetClass(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance
copy(...) -> T
-
Signature:
public <T> T copy(final T source) - Summary: Creates a shallow copy of the source object.
-
Parameters:
-
source(T) — the object to copy
-
- Returns: a shallow copy of the source object
clone(...) -> T
-
Signature:
public <T> T clone(final T source) - Summary: Creates a deep copy of the source object.
-
Parameters:
-
source(T) — the object to clone
-
- Returns: a deep copy of the source object
encode(...) -> byte\[\]
-
Signature:
public byte[] encode(final Object source) - Summary: Encodes an object to a byte array.
-
Parameters:
-
source(Object) — the object to encode
-
- Returns: the encoded byte array
decode(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public <T> T decode(final byte[] source) - Summary: Decodes an object from a byte array.
-
Contract:
- The byte array must have been created with {@link #encode(Object)} .
-
Parameters:
-
source(byte[]) — the byte array to decode
-
- Returns: the decoded object
register(...) -> void
-
Signature:
public void register(final Class<?> type) throws IllegalArgumentException - Summary: Registers a class with this parser instance for improved performance.
-
Parameters:
-
type(Class<?>) — the class to register
-
-
Throws:
-
java.lang.IllegalArgumentException— if type is null
-
-
Signature:
public void register(final Class<?> type, final int id) throws IllegalArgumentException - Summary: Registers a class with a specific ID for this parser instance.
-
Parameters:
-
type(Class<?>) — the class to register -
id(int) — the unique ID for this class
-
-
Throws:
-
java.lang.IllegalArgumentException— if type is null
-
-
Signature:
public void register(final Class<?> type, final Serializer<?> serializer) throws IllegalArgumentException - Summary: Registers a class with a custom serializer for this parser instance.
-
Parameters:
-
type(Class<?>) — the class to register -
serializer(Serializer<?>) — the custom serializer for this class
-
-
Throws:
-
java.lang.IllegalArgumentException— if type or serializer is null
-
-
Signature:
public void register(final Class<?> type, final Serializer<?> serializer, final int id) throws IllegalArgumentException - Summary: Registers a class with a custom serializer and specific ID for this parser instance.
-
Parameters:
-
type(Class<?>) — the class to register -
serializer(Serializer<?>) — the custom serializer for this class -
id(int) — the unique ID for this class
-
-
Throws:
-
java.lang.IllegalArgumentException— if type or serializer is null
-
Class KryoSerializationConfig (com.landawn.abacus.parser.KryoSerializationConfig)
Configuration class for Kryo serialization settings.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public KryoSerializationConfig() - Summary: Creates a new KryoSerializationConfig with default settings.
-
Parameters:
- (none)
writeClass(...) -> boolean
-
Signature:
public boolean writeClass() - Summary: Checks if class information should be written during serialization.
-
Contract:
- Checks if class information should be written during serialization.
- <p> When {@code true} , Kryo will write the full class name with the serialized data, allowing deserialization without specifying the target class.
-
Parameters:
- (none)
- Returns: {@code true} if class information should be written, {@code false} otherwise
-
Signature:
public KryoSerializationConfig writeClass(final boolean writeClass) - Summary: Sets whether class information should be written during serialization.
-
Contract:
- Sets whether class information should be written during serialization.
- <p> When set to {@code true} , Kryo will include the full class name in the serialized data.
-
Parameters:
-
writeClass(boolean) — {@code true} to write class information, {@code false} to omit it
-
- Returns: this configuration instance for method chaining
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes a hash code for this configuration based on its settings.
-
Parameters:
- (none)
- Returns: a hash code value for this configuration
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Determines whether this configuration is equal to another object.
-
Contract:
- <p> Two KryoSerializationConfig instances are considered equal if they have the same writeClass setting and all inherited settings are equal.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the configurations are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class KSC (com.landawn.abacus.parser.KryoSerializationConfig.KSC)
Factory class for creating KryoSerializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> KryoSerializationConfig
-
Signature:
public static KryoSerializationConfig create() - Summary: Creates a new KryoSerializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new KryoSerializationConfig instance
of(...) -> KryoSerializationConfig
-
Signature:
@Deprecated public static KryoSerializationConfig of(final boolean writeClass) - Summary: Creates a new KryoSerializationConfig with the specified writeClass setting.
-
Parameters:
-
writeClass(boolean) — whether to write class information
-
- Returns: a new configured KryoSerializationConfig instance
-
Signature:
@Deprecated public static KryoSerializationConfig of(final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new KryoSerializationConfig with the specified exclusion and ignored properties.
-
Parameters:
-
exclusion(Exclusion) — the exclusion strategy -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of ignored property names by class
-
- Returns: a new configured KryoSerializationConfig instance
-
Signature:
@Deprecated public static KryoSerializationConfig of(final boolean writeClass, final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new KryoSerializationConfig with all specified settings.
-
Parameters:
-
writeClass(boolean) — whether to write class information -
exclusion(Exclusion) — the exclusion strategy -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of ignored property names by class
-
- Returns: a new configured KryoSerializationConfig instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public KSC() - Summary: Constructs a new KSC instance.
-
Parameters:
- (none)
Interface Parser (com.landawn.abacus.parser.Parser)
Generic interface for object serialization and deserialization parsers.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
serialize(...) -> String
-
Signature:
String serialize(Object obj) - Summary: Serializes an object to a string representation.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation)
-
- Returns: the serialized string representation, never {@code null}
-
Signature:
String serialize(Object obj, SC config) - Summary: Serializes an object to a string representation using custom configuration.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(SC) — the serialization configuration to use (may be {@code null} for default behavior)
-
- Returns: the serialized string representation, never {@code null}
-
Signature:
void serialize(Object obj, File output) throws UncheckedIOException - Summary: Serializes an object to a file.
-
Contract:
- The file will be created if it doesn't exist, or overwritten if it does.
- Parent directories must exist or an exception will be thrown.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
output(File) — the output file to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file writing
-
-
Signature:
void serialize(Object obj, SC config, File output) throws UncheckedIOException - Summary: Serializes an object to a file using custom configuration.
-
Contract:
- <p> The file will be created if it doesn't exist, or overwritten if it does.
- Parent directories must exist or an exception will be thrown.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(SC) — the serialization configuration to use (may be {@code null} for default behavior) -
output(File) — the output file to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file writing
-
-
Signature:
void serialize(Object obj, OutputStream output) throws UncheckedIOException - Summary: Serializes an object to an output stream.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
output(OutputStream) — the output stream to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream writing
-
-
Signature:
void serialize(Object obj, SC config, OutputStream output) throws UncheckedIOException - Summary: Serializes an object to an output stream using custom configuration.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(SC) — the serialization configuration to use (may be {@code null} for default behavior) -
output(OutputStream) — the output stream to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream writing
-
-
Signature:
void serialize(Object obj, Writer output) throws UncheckedIOException - Summary: Serializes an object to a writer.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
output(Writer) — the writer to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during writing
-
-
Signature:
void serialize(Object obj, SC config, Writer output) throws UncheckedIOException - Summary: Serializes an object to a writer using custom configuration.
-
Parameters:
-
obj(Object) — the object to serialize (may be {@code null} depending on implementation) -
config(SC) — the serialization configuration to use (may be {@code null} for default behavior) -
output(Writer) — the writer to write to (must not be {@code null} )
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during writing
-
deserialize(...) -> T
-
Signature:
<T> T deserialize(String source, Type<? extends T> targetType) - Summary: Deserializes an object from a string representation.
-
Parameters:
-
source(String) — the source string to deserialize from (must not be {@code null} ) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Signature:
<T> T deserialize(String source, Class<? extends T> targetType) - Summary: Deserializes an object from a string representation.
-
Parameters:
-
source(String) — the source string to deserialize from (must not be {@code null} ) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Signature:
<T> T deserialize(String source, DC config, Type<? extends T> targetType) - Summary: Deserializes an object from a string representation using custom configuration.
-
Parameters:
-
source(String) — the source string to deserialize from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Signature:
<T> T deserialize(String source, DC config, Class<? extends T> targetType) - Summary: Deserializes an object from a string representation using custom configuration.
-
Parameters:
-
source(String) — the source string to deserialize from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Signature:
<T> T deserialize(File source, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file.
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
<T> T deserialize(File source, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file.
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
<T> T deserialize(File source, DC config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file using custom configuration.
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
<T> T deserialize(File source, DC config, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a file using custom configuration.
-
Parameters:
-
source(File) — the source file to read from (must not be {@code null} and must exist) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the file doesn't exist
-
-
Signature:
<T> T deserialize(InputStream source, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream.
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
<T> T deserialize(InputStream source, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream.
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
<T> T deserialize(InputStream source, DC config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream using custom configuration.
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
<T> T deserialize(InputStream source, DC config, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from an input stream using custom configuration.
-
Parameters:
-
source(InputStream) — the input stream to read from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during stream reading
-
-
Signature:
<T> T deserialize(Reader source, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a reader.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading
-
-
Signature:
<T> T deserialize(Reader source, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a reader.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading
-
-
Signature:
<T> T deserialize(Reader source, DC config, Type<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a reader using custom configuration.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the type of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading
-
-
Signature:
<T> T deserialize(Reader source, DC config, Class<? extends T> targetType) throws UncheckedIOException - Summary: Deserializes an object from a reader using custom configuration.
-
Parameters:
-
source(Reader) — the reader to read from (must not be {@code null} ) -
config(DC) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object instance, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading
-
Class ParserConfig (com.landawn.abacus.parser.ParserConfig)
Abstract base class for parser configuration that provides common settings shared by both serialization and deserialization configurations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getIgnoredPropNames(...) -> Map<Class<?>, Set<String>>
-
Signature:
public Map<Class<?>, Set<String>> getIgnoredPropNames() - Summary: Gets the complete map of ignored property names organized by class.
-
Parameters:
- (none)
- Returns: the map of ignored properties by class, or {@code null} if none are configured
-
Signature:
public Collection<String> getIgnoredPropNames(final Class<?> cls) - Summary: Gets the ignored property names for a specific class.
-
Contract:
- If none are found, it returns the globally ignored properties (those registered for {@code Object.class} ).
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Collection<String> ignoredProps = config.getIgnoredPropNames(User.class); if (ignoredProps != null) { // Process ignored properties } } </pre>
-
Parameters:
-
cls(Class<?>) — the class to get ignored properties for
-
- Returns: collection of ignored property names, or {@code null} if none are configured
setIgnoredPropNames(...) -> C
-
Signature:
public C setIgnoredPropNames(final Set<String> ignoredPropNames) - Summary: Sets globally ignored property names that apply to all classes.
-
Parameters:
-
ignoredPropNames(Set<String>) — set of property names to ignore globally
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setIgnoredPropNames(final Class<?> cls, final Set<String> ignoredPropNames) - Summary: Sets ignored property names for a specific class.
-
Parameters:
-
cls(Class<?>) — the class to set ignored properties for -
ignoredPropNames(Set<String>) — set of property names to ignore for this class
-
- Returns: this configuration instance for method chaining
-
Signature:
public C setIgnoredPropNames(final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Sets the complete map of ignored property names by class.
-
Parameters:
-
ignoredPropNames(Map<Class<?>, Set<String>>) — complete map of ignored properties by class
-
- Returns: this configuration instance for method chaining
copy(...) -> C
-
Signature:
public C copy() - Summary: Creates a copy of this configuration.
-
Parameters:
- (none)
- Returns: a copy of this configuration
Class ParserFactory (com.landawn.abacus.parser.ParserFactory)
Factory class for creating various parser instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
isAbacusXmlParserAvailable(...) -> boolean
-
Signature:
public static boolean isAbacusXmlParserAvailable() - Summary: Checks if abacus-common XML parser is available.
-
Contract:
- Checks if abacus-common XML parser is available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isAbacusXmlParserAvailable()) { XmlParser parser = ParserFactory.createAbacusXmlParser(); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if abacus-common XML parser is available, {@code false} otherwise
isXmlParserAvailable(...) -> boolean
-
Signature:
public static boolean isXmlParserAvailable() - Summary: Checks if standard XML parser is available.
-
Contract:
- Checks if standard XML parser is available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isXmlParserAvailable()) { XmlParser parser = ParserFactory.createXmlParser(); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if XML parser is available, {@code false} otherwise
isAvroParserAvailable(...) -> boolean
-
Signature:
public static boolean isAvroParserAvailable() - Summary: Checks if Apache Avro parser is available.
-
Contract:
- Checks if Apache Avro parser is available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isAvroParserAvailable()) { AvroParser parser = ParserFactory.createAvroParser(); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if Avro parser is available, {@code false} otherwise
isKryoParserAvailable(...) -> boolean
-
Signature:
public static boolean isKryoParserAvailable() - Summary: Checks if Kryo parser is available.
-
Contract:
- Checks if Kryo parser is available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isKryoParserAvailable()) { KryoParser parser = ParserFactory.createKryoParser(); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if Kryo parser is available, {@code false} otherwise
createAvroParser(...) -> AvroParser
-
Signature:
public static AvroParser createAvroParser() - Summary: Creates a new Avro parser instance.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isAvroParserAvailable()) { AvroParser parser = ParserFactory.createAvroParser(); // Use Avro parser } } </pre>
-
Parameters:
- (none)
- Returns: a new {@link AvroParser} instance
createKryoParser(...) -> KryoParser
-
Signature:
public static KryoParser createKryoParser() - Summary: Creates a new Kryo parser instance.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isKryoParserAvailable()) { KryoParser parser = ParserFactory.createKryoParser(); byte\[\] data = parser.serialize(myObject); } } </pre>
-
Parameters:
- (none)
- Returns: a new {@link KryoParser} instance
createJsonParser(...) -> JsonParser
-
Signature:
public static JsonParser createJsonParser() - Summary: Creates a new JSON parser instance with default configuration.
-
Parameters:
- (none)
- Returns: a new {@link JsonParser} instance
-
Signature:
public static JsonParser createJsonParser(final JsonSerializationConfig jsc, final JsonDeserializationConfig jdc) - Summary: Creates a new JSON parser instance with specified configurations.
-
Parameters:
-
jsc(JsonSerializationConfig) — the JSON serialization configuration (may be {@code null} for default behavior) -
jdc(JsonDeserializationConfig) — the JSON deserialization configuration (may be {@code null} for default behavior)
-
- Returns: a new {@link JsonParser} instance with the specified configurations
createAbacusXmlParser(...) -> XmlParser
-
Signature:
public static XmlParser createAbacusXmlParser() - Summary: Creates a new abacus-common XML parser instance with default configuration.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isAbacusXmlParserAvailable()) { XmlParser parser = ParserFactory.createAbacusXmlParser(); String xml = parser.serialize(myObject); } } </pre>
-
Parameters:
- (none)
- Returns: a new abacus-common {@link XmlParser} instance
-
Signature:
public static XmlParser createAbacusXmlParser(final XmlSerializationConfig xsc, final XmlDeserializationConfig xdc) - Summary: Creates a new abacus-common XML parser instance with specified configurations.
-
Parameters:
-
xsc(XmlSerializationConfig) — the XML serialization configuration (may be {@code null} for default behavior) -
xdc(XmlDeserializationConfig) — the XML deserialization configuration (may be {@code null} for default behavior)
-
- Returns: a new abacus-common {@link XmlParser} instance with the specified configurations
createXmlParser(...) -> XmlParser
-
Signature:
public static XmlParser createXmlParser() - Summary: Creates a new standard XML parser instance with default configuration.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (ParserFactory.isXmlParserAvailable()) { XmlParser parser = ParserFactory.createXmlParser(); String xml = parser.serialize(myObject); } } </pre>
-
Parameters:
- (none)
- Returns: a new standard {@link XmlParser} instance
-
Signature:
public static XmlParser createXmlParser(final XmlSerializationConfig xsc, final XmlDeserializationConfig xdc) - Summary: Creates a new standard XML parser instance with specified configurations.
-
Parameters:
-
xsc(XmlSerializationConfig) — the XML serialization configuration (may be {@code null} for default behavior) -
xdc(XmlDeserializationConfig) — the XML deserialization configuration (may be {@code null} for default behavior)
-
- Returns: a new standard {@link XmlParser} instance with the specified configurations
createJAXBParser(...) -> XmlParser
-
Signature:
public static XmlParser createJAXBParser() - Summary: Creates a new JAXB parser instance with default configuration.
-
Parameters:
- (none)
- Returns: a new JAXB {@link XmlParser} instance
-
Signature:
public static XmlParser createJAXBParser(final XmlSerializationConfig xsc, final XmlDeserializationConfig xdc) - Summary: Creates a new JAXB parser instance with specified configurations.
-
Parameters:
-
xsc(XmlSerializationConfig) — the XML serialization configuration (may be {@code null} for default behavior) -
xdc(XmlDeserializationConfig) — the XML deserialization configuration (may be {@code null} for default behavior)
-
- Returns: a new JAXB {@link XmlParser} instance with the specified configurations
registerKryo(...) -> void
-
Signature:
public static void registerKryo(final Class<?> type) throws IllegalArgumentException - Summary: Registers a class with Kryo for serialization.
-
Parameters:
-
type(Class<?>) — the class to register (must not be {@code null} )
-
-
Throws:
-
java.lang.IllegalArgumentException— if type is {@code null}
-
-
Signature:
public static void registerKryo(final Class<?> type, final int id) throws IllegalArgumentException - Summary: Registers a class with Kryo using a specific ID.
-
Parameters:
-
type(Class<?>) — the class to register (must not be {@code null} ) -
id(int) — the unique ID for this class
-
-
Throws:
-
java.lang.IllegalArgumentException— if type is {@code null}
-
-
Signature:
public static void registerKryo(final Class<?> type, final Serializer<?> serializer) throws IllegalArgumentException - Summary: Registers a class with Kryo using a custom serializer.
-
Parameters:
-
type(Class<?>) — the class to register (must not be {@code null} ) -
serializer(Serializer<?>) — the custom serializer for this class (must not be {@code null} )
-
-
Throws:
-
java.lang.IllegalArgumentException— if type or serializer is {@code null}
-
-
Signature:
public static void registerKryo(final Class<?> type, final Serializer<?> serializer, final int id) throws IllegalArgumentException - Summary: Registers a class with Kryo using a custom serializer and specific ID.
-
Parameters:
-
type(Class<?>) — the class to register (must not be {@code null} ) -
serializer(Serializer<?>) — the custom serializer for this class (must not be {@code null} ) -
id(int) — the unique ID for this class
-
-
Throws:
-
java.lang.IllegalArgumentException— if type or serializer is {@code null}
-
Public Instance Methods
- (none)
Class ParserUtil (com.landawn.abacus.parser.ParserUtil)
Utility class for parser-related operations, providing methods for handling bean metadata, property information, and serialization/deserialization configurations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getBeanInfo(...) -> BeanInfo
-
Signature:
public static BeanInfo getBeanInfo(final java.lang.reflect.Type beanType) - Summary: Retrieves or creates a {@link BeanInfo} instance for the specified java type.
-
Parameters:
-
beanType(java.lang.reflect.Type) — the java type of the bean class to get information for
-
- Returns: a BeanInfo instance containing metadata about the class
- See also: BeanInfo
-
Signature:
public static BeanInfo getBeanInfo(final Class<?> beanClass) - Summary: Retrieves or creates a {@link BeanInfo} instance for the specified class.
-
Parameters:
-
beanClass(Class<?>) — the class to get bean information for
-
- Returns: a BeanInfo instance containing metadata about the class
- See also: BeanInfo
refreshBeanPropInfo(...) -> void
-
Signature:
@Deprecated @Internal public static void refreshBeanPropInfo(final java.lang.reflect.Type beanType) - Summary: Refreshes the cached bean property information for the specified class.
-
Parameters:
-
beanType(java.lang.reflect.Type) — the java type of the bean class to refresh
-
Public Instance Methods
- (none)
Class BeanInfo (com.landawn.abacus.parser.ParserUtil.BeanInfo)
Container class holding comprehensive metadata about a bean class.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getPropInfo(...) -> PropInfo
-
Signature:
@Override public PropInfo getPropInfo(final String propName) - Summary: Gets property information by property name.
-
Parameters:
-
propName(String) — the property name to look up
-
- Returns: the PropInfo for the property, or {@code null} if not found
- See also: PropInfo
-
Signature:
public PropInfo getPropInfo(final PropInfo propInfoFromOtherBean) - Summary: Gets property information using property information from another bean.
-
Contract:
- <p> This method attempts to find a matching property by first checking the property name, then checking any aliases if the direct name match fails.
-
Parameters:
-
propInfoFromOtherBean(PropInfo) — property information from another bean
-
- Returns: matching PropInfo in this bean, or {@code null} if no match found
getPropValue(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public <T> T getPropValue(final Object obj, final String propName) - Summary: Gets the value of a property from the specified object.
-
Contract:
- If any intermediate property in a nested path is {@code null} , returns the default value for the final property type.
-
Parameters:
-
obj(Object) — the object to get the property value from -
propName(String) — the property name (supports nested paths)
-
- Returns: the property value, or default value if property is null
setPropValue(...) -> void
-
Signature:
public void setPropValue(final Object obj, final String propName, final Object propValue) - Summary: Sets the value of a property on the specified object.
-
Parameters:
-
obj(Object) — the object to set the property value on -
propName(String) — the property name -
propValue(Object) — the value to set
-
-
Signature:
@SuppressWarnings("rawtypes") public boolean setPropValue(final Object obj, final String propName, final Object propValue, final boolean ignoreUnmatchedProperty) - Summary: Sets the value of a property on the specified object with optional unmatched property handling.
-
Contract:
- For nested properties, intermediate objects are created as needed if they are {@code null} .
-
Parameters:
-
obj(Object) — the object to set the property value on -
propName(String) — the property name (supports nested paths) -
propValue(Object) — the value to set -
ignoreUnmatchedProperty(boolean) — if {@code true} , silently ignore properties that don't exist
-
- Returns: {@code true} if the property was set, {@code false} if it was ignored
-
Signature:
public void setPropValue(final Object obj, final PropInfo propInfoFromOtherBean, final Object propValue) - Summary: Sets a property value using property information from another bean.
-
Parameters:
-
obj(Object) — the object to set the property value on -
propInfoFromOtherBean(PropInfo) — property information from another bean -
propValue(Object) — the value to set
-
-
Signature:
public boolean setPropValue(final Object obj, final PropInfo propInfoFromOtherBean, final Object propValue, final boolean ignoreUnmatchedProperty) - Summary: Sets a property value using property information from another bean with optional unmatched property handling.
-
Parameters:
-
obj(Object) — the object to set the property value on -
propInfoFromOtherBean(PropInfo) — property information from another bean -
propValue(Object) — the value to set -
ignoreUnmatchedProperty(boolean) — if {@code true} , silently ignore properties that don't exist
-
- Returns: {@code true} if the property was set, {@code false} if it was ignored
getPropInfoQueue(...) -> List<PropInfo>
-
Signature:
public List<PropInfo> getPropInfoQueue(final String propName) - Summary: Gets a queue of property information for nested property paths.
-
Parameters:
-
propName(String) — the property path (e.g., "address.street")
-
- Returns: a list of PropInfo objects for each level, or empty list if invalid
readPropInfo(...) -> PropInfo
-
Signature:
@Override public PropInfo readPropInfo(final char[] cbuf, final int fromIndex, final int toIndex) - Summary: Reads property information from a character buffer for efficient parsing.
-
Parameters:
-
cbuf(char[]) — the character buffer containing the property name -
fromIndex(int) — the starting index in the buffer -
toIndex(int) — the ending index in the buffer
-
- Returns: the PropInfo if found, {@code null} otherwise
isAnnotationPresent(...) -> boolean
-
Signature:
public boolean isAnnotationPresent(final Class<? extends Annotation> annotationClass) - Summary: Checks if this class has the specified annotation.
-
Contract:
- Checks if this class has the specified annotation.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code if (beanInfo.isAnnotationPresent(Entity.class)) { // Process as entity } } </pre>
-
Parameters:
-
annotationClass(Class<? extends Annotation>) — the annotation class to check for
-
- Returns: {@code true} if the annotation is present, {@code false} otherwise
getAnnotation(...) -> T
-
Signature:
public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) - Summary: Gets the specified annotation from this class.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Table tableAnnotation = beanInfo.getAnnotation(Table.class); if (tableAnnotation != null) { String tableName = tableAnnotation.value(); } } </pre>
-
Parameters:
-
annotationClass(Class<T>) — the annotation class to retrieve
-
- Returns: the annotation instance, or {@code null} if not present
createBeanResult(...) -> Object
-
Signature:
@Beta public Object createBeanResult() - Summary: Creates an intermediate result object for bean construction.
-
Parameters:
- (none)
- Returns: an intermediate object for bean construction
finishBeanResult(...) -> T
-
Signature:
@Beta public <T> T finishBeanResult(final Object result) - Summary: Finalizes bean construction from an intermediate result object.
-
Parameters:
-
result(Object) — the intermediate result from createBeanResult
-
- Returns: the finished bean instance
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes the hash code for this BeanInfo based on the class.
-
Parameters:
- (none)
- Returns: the hash code value
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this BeanInfo equals another object.
-
Contract:
- Checks if this BeanInfo equals another object.
- <p> Two BeanInfo instances are considered equal if they represent the same class.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class PropInfo (com.landawn.abacus.parser.ParserUtil.PropInfo)
Represents metadata and runtime information about a property (field or getter/setter pair) in a Java class.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getPropValue(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public <T> T getPropValue(final Object obj) - Summary: Gets the value of this property from the specified object.
-
Contract:
- <p> This method handles different access strategies: </p> <ul> <li> For immutable beans stored as arrays, directly accesses the array element </li> <li> For regular objects, uses field access if available, otherwise uses the getter method </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Person person = new Person("John", 30); PropInfo nameProp = ...
-
Parameters:
-
obj(Object) — the object to get the property value from
-
- Returns: the property value, cast to type T
setPropValue(...) -> void
-
Signature:
@SuppressFBWarnings public void setPropValue(final Object obj, Object propValue) - Summary: Sets the value of this property on the specified object.
-
Contract:
- <p> This method provides intelligent property setting with the following features: </p> <ul> <li> Automatic type conversion when necessary </li> <li> Support for immutable beans and builder patterns </li> <li> Handling of JSON raw values </li> <li> Performance optimization for repeated operations </li> <li> Fallback strategies for different access methods </li> </ul> <p> The method attempts to set the value in the following order: </p> <ol> <li> Direct field access (if accessible and settable) </li> <li> Setter method invocation </li> <li> Setting via getter for collections/maps (XML binding) </li> <li> Forced field access as last resort </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Person person = new Person(); PropInfo ageProp = ...
-
Parameters:
-
obj(Object) — the object to set the property value on -
propValue(Object) — the value to set (will be converted if necessary)
-
readPropValue(...) -> Object
-
Signature:
public Object readPropValue(final String strValue) - Summary: Reads and converts a string value to the appropriate property type.
-
Parameters:
-
strValue(String) — the string value to parse
-
- Returns: the parsed value in the appropriate type
writePropValue(...) -> void
-
Signature:
public void writePropValue(final CharacterWriter writer, final Object x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a property value to a character writer with appropriate formatting.
-
Parameters:
-
writer(CharacterWriter) — the character writer to write to -
x(Object) — the value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
isAnnotationPresent(...) -> boolean
-
Signature:
public boolean isAnnotationPresent(final Class<? extends Annotation> annotationClass) - Summary: Checks if this property has the specified annotation.
-
Contract:
- Checks if this property has the specified annotation.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code if (propInfo.isAnnotationPresent(NotNull.class)) { // Validate that the property is not null } } </pre>
-
Parameters:
-
annotationClass(Class<? extends Annotation>) — the annotation class to check for
-
- Returns: {@code true} if the annotation is present, {@code false} otherwise
getAnnotation(...) -> T
-
Signature:
public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) - Summary: Gets the specified annotation from this property.
-
Contract:
- If the same annotation is present in multiple places, the precedence order is: field annotations, getter annotations, then setter annotations.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code JsonXmlField jsonField = propInfo.getAnnotation(JsonXmlField.class); if (jsonField != null) { String customName = jsonField.name(); } } </pre>
-
Parameters:
-
annotationClass(Class<T>) — the annotation class to retrieve
-
- Returns: the annotation instance, or {@code null} if not present
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this PropInfo.
-
Parameters:
- (none)
- Returns: the hash code value
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this PropInfo with another object for equality.
-
Contract:
- <p> Two PropInfo objects are considered equal if they have the same name and the same field.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this PropInfo.
-
Parameters:
- (none)
- Returns: the property name
Class SerializationConfig (com.landawn.abacus.parser.SerializationConfig)
Abstract base class for serialization configuration that provides common settings for controlling how objects are serialized.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getExclusion(...) -> Exclusion
-
Signature:
public Exclusion getExclusion() - Summary: Gets the current exclusion strategy for field serialization.
-
Contract:
- <p> The exclusion strategy determines which fields should be excluded from serialization based on their values or other criteria.
-
Parameters:
- (none)
- Returns: the current {@link Exclusion} strategy, or {@code null} if no exclusion is set
- See also: Exclusion
setExclusion(...) -> C
-
Signature:
public C setExclusion(final Exclusion exclusion) - Summary: Sets the exclusion strategy for field serialization in beans.
-
Parameters:
-
exclusion(Exclusion) — the exclusion strategy to use, or {@code null} for no exclusion
-
- Returns: this configuration instance for method chaining
- See also: Exclusion
skipTransientField(...) -> boolean
-
Signature:
public boolean skipTransientField() - Summary: Checks whether transient fields should be skipped during serialization.
-
Contract:
- Checks whether transient fields should be skipped during serialization.
- <p> When {@code true} , fields marked with the {@code transient} keyword or {@code @Transient} annotation will be excluded from serialization.
-
Parameters:
- (none)
- Returns: {@code true} if transient fields should be skipped, {@code false} otherwise
-
Signature:
public C skipTransientField(final boolean skipTransientField) - Summary: Sets whether transient fields should be skipped during serialization.
-
Contract:
- Sets whether transient fields should be skipped during serialization.
- <p> When set to {@code true} , fields marked with the {@code transient} keyword or {@code @Transient} annotation will be excluded from serialization.
- This is useful for excluding fields that should not be persisted or transmitted.
-
Parameters:
-
skipTransientField(boolean) — {@code true} to skip transient fields, {@code false} to include them
-
- Returns: this configuration instance for method chaining
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Computes a hash code for this configuration based on its settings.
-
Parameters:
- (none)
- Returns: a hash code value for this configuration
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Determines whether this configuration is equal to another object.
-
Contract:
- <p> Two SerializationConfig instances are considered equal if they have the same ignored property names, exclusion strategy, and skipTransientField setting.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the configurations are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class XmlConstants (com.landawn.abacus.parser.XmlConstants)
Constants used for XML parsing and serialization operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class XmlDeserializationConfig (com.landawn.abacus.parser.XmlDeserializationConfig)
Configuration class for XML deserialization settings.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public XmlDeserializationConfig() - Summary: Creates a new XmlDeserializationConfig with default settings.
-
Parameters:
- (none)
Class XDC (com.landawn.abacus.parser.XmlDeserializationConfig.XDC)
Factory class for creating XmlDeserializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> XmlDeserializationConfig
-
Signature:
public static XmlDeserializationConfig create() - Summary: Creates a new XmlDeserializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new XmlDeserializationConfig instance
of(...) -> XmlDeserializationConfig
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final Class<?> elementClass) - Summary: Creates a new XmlDeserializationConfig with the specified element type.
-
Contract:
- <p> This is useful when deserializing collections where the element type cannot be inferred from the target class alone.
-
Parameters:
-
elementClass(Class<?>) — the class type of collection elements
-
- Returns: a new configured XmlDeserializationConfig instance
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final Class<?> keyClass, final Class<?> valueClass) - Summary: Creates a new XmlDeserializationConfig with specified map key and value types.
-
Contract:
- <p> This is useful when deserializing maps where the key and value types cannot be inferred from the target class alone.
-
Parameters:
-
keyClass(Class<?>) — the class type of map keys -
valueClass(Class<?>) — the class type of map values
-
- Returns: a new configured XmlDeserializationConfig instance
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlDeserializationConfig with unmatched property handling and ignored properties.
-
Parameters:
-
ignoreUnmatchedProperty(boolean) — whether to ignore properties not found in the target class -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of property names to ignore by class
-
- Returns: a new configured XmlDeserializationConfig instance
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final Class<?> elementClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlDeserializationConfig with element type and property handling settings.
-
Parameters:
-
elementClass(Class<?>) — the class type of collection elements -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of property names to ignore by class
-
- Returns: a new configured XmlDeserializationConfig instance
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final Class<?> keyClass, final Class<?> valueClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlDeserializationConfig with map types and property handling settings.
-
Parameters:
-
keyClass(Class<?>) — the class type of map keys -
valueClass(Class<?>) — the class type of map values -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of property names to ignore by class
-
- Returns: a new configured XmlDeserializationConfig instance
-
Signature:
@Deprecated public static XmlDeserializationConfig of(final Class<?> elementClass, final Class<?> keyClass, final Class<?> valueClass, final boolean ignoreUnmatchedProperty, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlDeserializationConfig with all type information and property handling settings.
-
Parameters:
-
elementClass(Class<?>) — the class type of collection elements -
keyClass(Class<?>) — the class type of map keys -
valueClass(Class<?>) — the class type of map values -
ignoreUnmatchedProperty(boolean) — whether to ignore unmatched properties -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of property names to ignore by class
-
- Returns: a new configured XmlDeserializationConfig instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public XDC() - Summary: Constructs a new XDC factory instance.
-
Parameters:
- (none)
Interface XmlParser (com.landawn.abacus.parser.XmlParser)
Interface for XML parsing operations, extending the base {@link Parser} interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
deserialize(...) -> T
-
Signature:
<T> T deserialize(Node source, Type<? extends T> targetType) - Summary: Deserializes an XML DOM node to an object of the specified type using a Type descriptor.
-
Parameters:
-
source(Node) — the DOM node containing the XML data to deserialize (must not be {@code null} ) -
targetType(Type<? extends T>) — the Type descriptor of the object to create (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , never {@code null}
-
Signature:
<T> T deserialize(Node source, Class<? extends T> targetType) - Summary: Deserializes an XML DOM node to an object of the specified type using default deserialization configuration.
-
Parameters:
-
source(Node) — the DOM node containing the XML data to deserialize (must not be {@code null} ) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , never {@code null}
-
Signature:
<T> T deserialize(Node source, XmlDeserializationConfig config, Type<? extends T> targetType) - Summary: Deserializes an XML DOM node to an object of the specified type with custom deserialization configuration.
-
Parameters:
-
source(Node) — the DOM node containing the XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Type<? extends T>) — the Type descriptor of the object to create (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , never {@code null}
-
Signature:
<T> T deserialize(Node source, XmlDeserializationConfig config, Class<? extends T> targetType) - Summary: Deserializes an XML DOM node to an object of the specified type with custom deserialization configuration.
-
Parameters:
-
source(Node) — the DOM node containing the XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
targetType(Class<? extends T>) — the class of the object to create (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , never {@code null}
-
Signature:
<T> T deserialize(File source, XmlDeserializationConfig config, Map<String, Type<?>> nodeTypes) - Summary: Deserializes XML from a file using node class mappings for dynamic type resolution.
-
Contract:
- When the parser encounters an XML element, it looks up the element name in the nodeTypes map to determine which class to instantiate.
- This is particularly useful for deserializing heterogeneous collections or when the target type cannot be determined statically.
-
Parameters:
-
source(File) — the file containing XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
nodeTypes(Map<String, Type<?>>) — mapping of XML element names to their corresponding types (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , or {@code null} if the file is empty
-
Signature:
<T> T deserialize(InputStream source, XmlDeserializationConfig config, Map<String, Type<?>> nodeTypes) - Summary: Deserializes XML from an input stream using node class mappings for dynamic type resolution.
-
Contract:
- When the parser encounters an XML element, it looks up the element name in the nodeTypes map to determine which class to instantiate.
- This is particularly useful for deserializing heterogeneous collections or when the target type cannot be determined statically.
-
Parameters:
-
source(InputStream) — the input stream containing XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
nodeTypes(Map<String, Type<?>>) — mapping of XML element names to their corresponding types (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , or {@code null} if the input stream is empty
-
Signature:
<T> T deserialize(Reader source, XmlDeserializationConfig config, Map<String, Type<?>> nodeTypes) - Summary: Deserializes XML from a reader using node class mappings for dynamic type resolution.
-
Contract:
- When the parser encounters an XML element, it looks up the element name in the nodeTypes map to determine which class to instantiate.
- This is particularly useful for deserializing heterogeneous collections or when the target type cannot be determined statically.
-
Parameters:
-
source(Reader) — the reader containing XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
nodeTypes(Map<String, Type<?>>) — mapping of XML element names to their corresponding types (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , or {@code null} if the reader is empty
-
Signature:
<T> T deserialize(Node source, XmlDeserializationConfig config, Map<String, Type<?>> nodeTypes) - Summary: Deserializes an XML DOM node using node class mappings for dynamic type resolution.
-
Contract:
- This is particularly useful when working with pre-parsed DOM trees containing heterogeneous elements.
- If no match is found and the node has a <i> name </i> attribute, it will attempt to match using that attribute value.
-
Parameters:
-
source(Node) — the DOM node containing XML data to deserialize (must not be {@code null} ) -
config(XmlDeserializationConfig) — the deserialization configuration to use (may be {@code null} for default behavior) -
nodeTypes(Map<String, Type<?>>) — mapping of XML element names to their corresponding types (must not be {@code null} )
-
- Returns: the deserialized object of type {@code T} , or {@code null} if the node is empty
Class XmlSerializationConfig (com.landawn.abacus.parser.XmlSerializationConfig)
Configuration class for XML serialization settings.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public XmlSerializationConfig() - Summary: Creates a new XmlSerializationConfig with default settings.
-
Parameters:
- (none)
setStringQuotation(...) -> XmlSerializationConfig
-
Signature:
@Deprecated @Override public XmlSerializationConfig setStringQuotation(final char stringQuotation) - Summary: Sets the string quotation character.
-
Parameters:
-
stringQuotation(char) — the character to use for quoting strings
-
- Returns: this instance for method chaining
setCharQuotation(...) -> XmlSerializationConfig
-
Signature:
@Deprecated @Override public XmlSerializationConfig setCharQuotation(final char charQuotation) - Summary: Sets the character quotation for char values.
-
Parameters:
-
charQuotation(char) — the character to use for quoting char values
-
- Returns: this instance for method chaining
noCharQuotation(...) -> XmlSerializationConfig
-
Signature:
@Deprecated @Override public XmlSerializationConfig noCharQuotation() - Summary: Disables character quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noStringQuotation(...) -> XmlSerializationConfig
-
Signature:
@Deprecated @Override public XmlSerializationConfig noStringQuotation() - Summary: Disables string quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
noQuotation(...) -> XmlSerializationConfig
-
Signature:
@Deprecated @Override public XmlSerializationConfig noQuotation() - Summary: Disables all quotation.
-
Parameters:
- (none)
- Returns: this instance for method chaining
tagByPropertyName(...) -> boolean
-
Signature:
public boolean tagByPropertyName() - Summary: Checks if XML tags should be named after property names.
-
Contract:
- Checks if XML tags should be named after property names.
- <p> When {@code true} , XML elements will use the property name as the tag name.
- When {@code false} , a generic tag structure is used with name attributes.
-
Parameters:
- (none)
- Returns: {@code true} if tags are named after properties, {@code false} otherwise
-
Signature:
public XmlSerializationConfig tagByPropertyName(final boolean tagByPropertyName) - Summary: Sets whether XML tags should be named after property names.
-
Contract:
- Sets whether XML tags should be named after property names.
-
Parameters:
-
tagByPropertyName(boolean) — {@code true} to use property names as tags
-
- Returns: this configuration instance for method chaining
writeTypeInfo(...) -> boolean
-
Signature:
public boolean writeTypeInfo() - Summary: Checks whether type information should be included during XML serialization.
-
Contract:
- Checks whether type information should be included during XML serialization.
- When enabled, the XML output will contain type attributes that specify the Java class types of objects.
-
Parameters:
- (none)
- Returns: {@code true} if type information should be written, {@code false} otherwise
- See also: #writeTypeInfo(boolean)
-
Signature:
public XmlSerializationConfig writeTypeInfo(final boolean writeTypeInfo) - Summary: Sets whether to include type information during XML serialization.
-
Contract:
- When enabled, the XML output will contain type attributes that specify the Java class types of objects.
-
Parameters:
-
writeTypeInfo(boolean) — {@code true} to include type information, {@code false} to omit it
-
- Returns: this configuration instance for method chaining
- See also: #writeTypeInfo()
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Calculates the hash code for this configuration object.
-
Parameters:
- (none)
- Returns: the hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Determines whether this configuration is equal to another object.
-
Contract:
- <p> Two XmlSerializationConfig instances are considered equal if they have the same values for all configuration settings.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the configurations are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this configuration object.
-
Parameters:
- (none)
- Returns: a string representation of this configuration
Class XSC (com.landawn.abacus.parser.XmlSerializationConfig.XSC)
Factory class for creating XmlSerializationConfig instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> XmlSerializationConfig
-
Signature:
public static XmlSerializationConfig create() - Summary: Creates a new XmlSerializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new XmlSerializationConfig instance
of(...) -> XmlSerializationConfig
-
Signature:
@Deprecated public static XmlSerializationConfig of(final boolean tagByPropertyName, final boolean writeTypeInfo) - Summary: Creates a new XmlSerializationConfig with specified tag naming and type info settings.
-
Parameters:
-
tagByPropertyName(boolean) — whether to use property names as XML tags -
writeTypeInfo(boolean) — whether to write type information
-
- Returns: a new configured XmlSerializationConfig instance
-
Signature:
@Deprecated public static XmlSerializationConfig of(final DateTimeFormat dateTimeFormat) - Summary: Creates a new XmlSerializationConfig with the specified date/time format.
-
Parameters:
-
dateTimeFormat(DateTimeFormat) — the date/time format to use
-
- Returns: a new configured XmlSerializationConfig instance
-
Signature:
@Deprecated public static XmlSerializationConfig of(final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlSerializationConfig with exclusion and ignored properties.
-
Parameters:
-
exclusion(Exclusion) — the exclusion strategy -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of ignored property names by class
-
- Returns: a new configured XmlSerializationConfig instance
-
Signature:
@Deprecated public static XmlSerializationConfig of(final boolean tagByPropertyName, final boolean writeTypeInfo, final DateTimeFormat dateTimeFormat, final Exclusion exclusion, final Map<Class<?>, Set<String>> ignoredPropNames) - Summary: Creates a new XmlSerializationConfig with all specified settings.
-
Parameters:
-
tagByPropertyName(boolean) — whether to use property names as XML tags -
writeTypeInfo(boolean) — whether to write type information -
dateTimeFormat(DateTimeFormat) — the date/time format to use -
exclusion(Exclusion) — the exclusion strategy -
ignoredPropNames(Map<Class<?>, Set<String>>) — map of ignored property names by class
-
- Returns: a new configured XmlSerializationConfig instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public XSC() - Summary: Constructs a new XSC factory instance.
-
Parameters:
- (none)
com.landawn.abacus.poi
Class ExcelUtil (com.landawn.abacus.poi.ExcelUtil)
A comprehensive, enterprise-grade utility class providing advanced Excel file processing capabilities including high-performance reading, writing, and conversion operations using Apache POI.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
loadSheet(...) -> Dataset
-
Signature:
public static Dataset loadSheet(final File excelFile) - Summary: Loads the first sheet from the specified Excel file into a Dataset.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file.
-
- Returns: a Dataset containing the sheet data with the first row as column names, empty Dataset if sheet is empty.
-
Signature:
public static Dataset loadSheet(final File excelFile, final int sheetIndex, final TriConsumer<? super String[], ? super Row, ? super Object[]> rowExtractor) - Summary: Loads the specified sheet from the Excel file into a Dataset using a custom row extractor.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file. -
sheetIndex(int) — the zero-based index of the sheet to read (0 for first sheet). -
rowExtractor(TriConsumer<? super String[], ? super Row, ? super Object[]>) — custom function to extract row data. Receives three parameters: column headers array, current row, and output array to populate with extracted values.
-
- Returns: a Dataset containing the extracted sheet data with the first row as column names.
-
Signature:
public static Dataset loadSheet(final File excelFile, final String sheetName, final TriConsumer<? super String[], ? super Row, ? super Object[]> rowExtractor) - Summary: Loads the sheet with the specified name from the Excel file into a Dataset.
-
Contract:
- This method allows loading a specific sheet by name rather than index, which is useful when working with workbooks that have meaningful sheet names.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file. -
sheetName(String) — the name of the sheet to read, case-sensitive. -
rowExtractor(TriConsumer<? super String[], ? super Row, ? super Object[]>) — custom function to extract row data. Receives three parameters: column headers array, current row, and output array to populate with extracted values.
-
- Returns: a Dataset containing the extracted sheet data with the first row as column names.
readSheet(...) -> List<List<Object>>
-
Signature:
public static List<List<Object>> readSheet(final File excelFile) - Summary: Reads the first sheet of the Excel file and returns rows as a list of lists.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file.
-
- Returns: a list of rows, where each row is a list of cell values with preserved types.
-
Signature:
public static <T> List<T> readSheet(final File excelFile, final int sheetIndex, final boolean skipFirstRow, final Function<? super Row, ? extends T> rowMapper) - Summary: Reads the specified sheet and maps each row to a custom object type using the provided mapper.
-
Contract:
- Optionally skips the first row if it contains headers.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file. -
sheetIndex(int) — the zero-based index of the sheet to read (0 for first sheet). -
skipFirstRow(boolean) — {@code true} to skip the first row (typically headers), {@code false} to process all rows. -
rowMapper(Function<? super Row, ? extends T>) — function to convert each Row to an object of type T.
-
- Returns: a list of mapped objects, one per row (excluding skipped rows).
-
Signature:
public static <T> List<T> readSheet(final File excelFile, final String sheetName, final boolean skipFirstRow, final Function<? super Row, ? extends T> rowMapper) - Summary: Reads the sheet with the specified name and maps each row to a custom object type.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file. -
sheetName(String) — the name of the sheet to read, case-sensitive. -
skipFirstRow(boolean) — {@code true} to skip the first row (typically headers), {@code false} to process all rows. -
rowMapper(Function<? super Row, ? extends T>) — function to convert each Row to an object of type T.
-
- Returns: a list of mapped objects, one per row (excluding skipped rows).
streamSheet(...) -> Stream<Row>
-
Signature:
public static Stream<Row> streamSheet(final File excelFile, final int sheetIndex, final boolean skipFirstRow) - Summary: Creates a stream of Row objects from the specified sheet in the Excel file.
-
Contract:
- Ideal for processing files that are too large to fit comfortably in memory or when early termination is possible.
- </p> <p> <strong> Important: </strong> The Stream must be closed after use to release file handles and workbook resources.
- Always use try-with-resources or explicitly call {@code close()} on the stream when done.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetIndex(int) — the zero-based index of the sheet to stream (0 for first sheet) -
skipFirstRow(boolean) — {@code true} to skip the first row (typically headers), {@code false} to process all rows
-
- Returns: a Stream of Row objects from the specified sheet that must be closed after use
-
Signature:
public static Stream<Row> streamSheet(final File excelFile, final String sheetName, final boolean skipFirstRow) - Summary: Creates a stream of Row objects from the sheet with the specified name.
-
Contract:
- This is essential for handling large datasets or when processing can be short-circuited based on conditions.
- </p> <p> <strong> Important: </strong> The Stream must be closed after use to release file handles and workbook resources.
- Always use try-with-resources or explicitly call {@code close()} on the stream when done.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetName(String) — the name of the sheet to stream, case-sensitive -
skipFirstRow(boolean) — {@code true} to skip the first row (typically headers), {@code false} to process all rows
-
- Returns: a Stream of Row objects from the specified sheet that must be closed after use
writeSheet(...) -> void
-
Signature:
public static void writeSheet(final String sheetName, final List<?> headers, final List<? extends Collection<?>> rows, final File outputExcelFile) - Summary: Writes data to a new Excel file with the specified sheet name and headers.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook -
headers(List<?>) — the column headers as a list of objects (will be converted to strings) -
rows(List<? extends Collection<?>>) — the data rows, where each row is a collection of cell values -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten)
-
-
Signature:
public static void writeSheet(final String sheetName, final List<?> headers, final List<? extends Collection<?>> rows, final SheetCreateOptions sheetCreateOptions, final File outputExcelFile) - Summary: Writes data to a new Excel file with additional formatting options.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook -
headers(List<?>) — the column headers as a list of objects (will be converted to strings) -
rows(List<? extends Collection<?>>) — the data rows, where each row is a collection of cell values -
sheetCreateOptions(SheetCreateOptions) — configuration options for sheet formatting (null to apply no formatting) -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten)
-
-
Signature:
public static void writeSheet(final String sheetName, final List<?> headers, final List<? extends Collection<?>> rows, final Consumer<? super Sheet> sheetSetter, final File outputExcelFile) - Summary: Writes data to a new Excel file with a custom sheet configuration function.
-
Contract:
- Use this when you need formatting options beyond what SheetCreateOptions provides, such as custom column widths, conditional formatting, cell styles, or data validation rules.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook. -
headers(List<?>) — the column headers as a list of objects (will be converted to strings). -
rows(List<? extends Collection<?>>) — the data rows, where each row is a collection of cell values. -
sheetSetter(Consumer<? super Sheet>) — a consumer to apply custom formatting to the sheet after data is written (null to skip). -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten).
-
-
Signature:
public static void writeSheet(final String sheetName, final Dataset dataset, final File outputExcelFile) - Summary: Writes a Dataset to a new Excel file with the specified sheet name.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook. -
dataset(Dataset) — the Dataset containing the data to write, must not be null. -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten).
-
-
Signature:
public static void writeSheet(final String sheetName, final Dataset dataset, final SheetCreateOptions sheetCreateOptions, final File outputExcelFile) - Summary: Writes a Dataset to a new Excel file with additional formatting options.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook. -
dataset(Dataset) — the Dataset containing the data to write, must not be null. -
sheetCreateOptions(SheetCreateOptions) — configuration options for sheet formatting (null to apply no formatting). -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten).
-
-
Signature:
public static void writeSheet(final String sheetName, final Dataset dataset, final Consumer<? super Sheet> sheetSetter, final File outputExcelFile) - Summary: Writes a Dataset to a new Excel file with custom sheet formatting.
-
Parameters:
-
sheetName(String) — the name of the sheet to create in the workbook. -
dataset(Dataset) — the Dataset containing the data to write, must not be null. -
sheetSetter(Consumer<? super Sheet>) — a consumer to apply custom formatting to the sheet after data is written (null to skip). -
outputExcelFile(File) — the file to write the Excel data to (will be created or overwritten).
-
saveSheetAsCsv(...) -> void
-
Signature:
public static void saveSheetAsCsv(final File excelFile, final int sheetIndex, final File outputCsvFile) - Summary: Converts the specified sheet from an Excel file to a CSV file using default charset.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetIndex(int) — the zero-based index of the sheet to convert (0 for first sheet) -
outputCsvFile(File) — the CSV file to write to (will be created or overwritten)
-
-
Signature:
public static void saveSheetAsCsv(final File excelFile, final String sheetName, final File outputCsvFile) - Summary: Converts the sheet with the specified name from an Excel file to a CSV file.
-
Contract:
- This method allows exporting a specific worksheet by name rather than index, which is more robust when working with workbooks where sheet positions might change.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetName(String) — the name of the sheet to convert, case-sensitive -
outputCsvFile(File) — the CSV file to write to (will be created or overwritten)
-
-
Signature:
public static void saveSheetAsCsv(final File excelFile, final int sheetIndex, final List<String> csvHeaders, final Writer outputWriter) - Summary: Converts the specified sheet from an Excel file to a CSV file with custom options.
-
Contract:
- When custom headers are provided, the first row of the Excel sheet is skipped and replaced with the custom headers.
- <p> The charset parameter is particularly important for international data or when the CSV will be consumed by systems with specific encoding requirements.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetIndex(int) — the zero-based index of the sheet to convert (0 for first sheet) -
csvHeaders(List<String>) — custom headers for the CSV file (null to use original Excel headers from first row) -
outputWriter(Writer) — the CSV file to write to (will be created or overwritten)
-
-
Signature:
public static void saveSheetAsCsv(final File excelFile, final String sheetName, List<String> csvHeaders, final Writer outputWriter) - Summary: Converts the sheet with the specified name to a CSV file with full control over headers and encoding.
-
Contract:
- <p> When custom headers are provided, they replace the first row of the Excel sheet in the CSV output.
-
Parameters:
-
excelFile(File) — the Excel file to read, must exist and be a valid Excel file -
sheetName(String) — the name of the sheet to convert, case-sensitive -
csvHeaders(List<String>) — custom headers for the CSV file (null to use original Excel headers from first row) -
outputWriter(Writer) — the CSV writer to write to (will be created or overwritten)
-
Public Instance Methods
- (none)
Class RowMappers (com.landawn.abacus.poi.ExcelUtil.RowMappers)
Collection of predefined row mapping functions for common Excel data transformation use cases.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toDelimitedString(...) -> Function<Row, String>
-
Signature:
public static Function<Row, String> toDelimitedString(final String cellSeparator) - Summary: Creates a row mapper that converts rows to delimited strings with a custom separator.
-
Parameters:
-
cellSeparator(String) — the string to use as separator between cell values
-
- Returns: a Function that converts Row to delimited String
-
Signature:
public static Function<Row, String> toDelimitedString(final String cellSeparator, final Function<Cell, String> cellMapper) - Summary: Creates a row mapper that converts rows to delimited strings with custom cell processing.
-
Contract:
- Use this when you need special formatting, value transformations, or custom handling of specific cell types.
-
Parameters:
-
cellSeparator(String) — the string to use as separator between cell values -
cellMapper(Function<Cell, String>) — custom function to convert each cell to a string
-
- Returns: a Function that converts Row to delimited String
toList(...) -> Function<Row, List<T>>
-
Signature:
public static <T> Function<Row, List<T>> toList(final Function<Cell, T> cellMapper) - Summary: Creates a row mapper that converts rows to Lists with custom cell processing.
-
Contract:
- Particularly useful when you need to extract specific data types, perform validation, or apply transformations during the read process.
-
Parameters:
-
cellMapper(Function<Cell, T>) — function to convert each cell to type T
-
- Returns: a Function that converts Row to List < T >
Public Instance Methods
- (none)
Class RowExtractors (com.landawn.abacus.poi.ExcelUtil.RowExtractors)
Collection of row extraction functions specifically designed for use with {@code loadSheet} methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> TriConsumer<String\[\], Row, Object\[\]>
-
Signature:
public static TriConsumer<String[], Row, Object[]> create(final Function<Cell, ?> cellMapper) - Summary: Creates a custom row extractor with the specified cell mapping function.
-
Parameters:
-
cellMapper(Function<Cell, ?>) — function to convert each cell to the desired output type
-
- Returns: a TriConsumer that extracts row data using the cell mapper
Public Instance Methods
- (none)
Class SheetCreateOptions (com.landawn.abacus.poi.ExcelUtil.SheetCreateOptions)
Configuration options for controlling Excel sheet creation with professional formatting and features.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public SheetCreateOptions() - Summary: Creates a new instance of SheetCreateOptions with default values.
-
Parameters:
- (none)
Record FreezePane (com.landawn.abacus.poi.ExcelUtil.FreezePane)
Represents a freeze pane configuration for Excel sheets, specifying which columns and rows should remain visible when scrolling through the worksheet.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
record FreezePane(int colSplit, int rowSplit) { } } -
Parameters:
-
colSplit(int) -
rowSplit(int)
-
com.landawn.abacus.pool
Class AbstractPool (com.landawn.abacus.pool.AbstractPool)
Abstract base class for implementing object pools with eviction, balancing, and memory management capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
lock(...) -> void
-
Signature:
@Override public void lock() - Summary: Acquires the lock for this pool.
-
Parameters:
- (none)
unlock(...) -> void
-
Signature:
@Override public void unlock() - Summary: Releases the lock for this pool.
-
Contract:
- This method should always be called in a finally block after {@link #lock()} .
-
Parameters:
- (none)
capacity(...) -> int
-
Signature:
@Override public int capacity() - Summary: Returns the maximum capacity of this pool.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (pool.size() >= pool.capacity() * 0.9) { // Pool is 90% full, consider scaling } } </pre>
-
Parameters:
- (none)
- Returns: the maximum number of objects this pool can hold
stats(...) -> PoolStats
-
Signature:
@Override public PoolStats stats() - Summary: Returns a snapshot of the current pool statistics.
-
Parameters:
- (none)
- Returns: a PoolStats object containing current pool statistics
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Checks whether this pool is currently empty.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (pool.isEmpty()) { System.out.println("Pool has no available objects"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the pool contains no objects, {@code false} otherwise
isClosed(...) -> boolean
-
Signature:
@Override public boolean isClosed() - Summary: Checks whether this pool has been closed.
-
Parameters:
- (none)
- Returns: {@code true} if the pool has been closed, {@code false} otherwise
Class AbstractPoolable (com.landawn.abacus.pool.AbstractPoolable)
Abstract base class for implementing poolable objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
activityPrint(...) -> ActivityPrint
-
Signature:
@Override public ActivityPrint activityPrint() - Summary: Returns the activity print for this poolable object.
-
Parameters:
- (none)
- Returns: the ActivityPrint associated with this object, never {@code null}
Class ActivityPrint (com.landawn.abacus.pool.ActivityPrint)
Tracks the activity and lifecycle information for poolable objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ActivityPrint
-
Signature:
public static ActivityPrint of(final long liveTime, final long maxIdleTime) - Summary: Factory method to create a new ActivityPrint with the specified lifetime and idle time limits.
-
Parameters:
-
liveTime(long) — maximum lifetime in milliseconds (must be positive) -
maxIdleTime(long) — maximum idle time in milliseconds (must be positive)
-
- Returns: a new ActivityPrint instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public ActivityPrint(final long liveTime, final long maxIdleTime) throws IllegalArgumentException - Summary: Creates a new ActivityPrint with the specified lifetime and idle time limits.
-
Parameters:
-
liveTime(long) — maximum lifetime in milliseconds (must be positive) -
maxIdleTime(long) — maximum idle time in milliseconds (must be positive)
-
-
Throws:
-
java.lang.IllegalArgumentException— if liveTime or maxIdleTime is not positive
-
getLiveTime(...) -> long
-
Signature:
public long getLiveTime() - Summary: Returns the maximum lifetime for this activity print.
-
Parameters:
- (none)
- Returns: the maximum lifetime in milliseconds
setLiveTime(...) -> ActivityPrint
-
Signature:
public ActivityPrint setLiveTime(final long liveTime) throws IllegalArgumentException - Summary: Sets the maximum lifetime for this activity print.
-
Parameters:
-
liveTime(long) — the new maximum lifetime in milliseconds
-
- Returns: this ActivityPrint instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if liveTime is negative
-
getMaxIdleTime(...) -> long
-
Signature:
public long getMaxIdleTime() - Summary: Returns the maximum idle time for this activity print.
-
Parameters:
- (none)
- Returns: the maximum idle time in milliseconds
setMaxIdleTime(...) -> ActivityPrint
-
Signature:
public ActivityPrint setMaxIdleTime(final long maxIdleTime) throws IllegalArgumentException - Summary: Sets the maximum idle time for this activity print.
-
Parameters:
-
maxIdleTime(long) — the new maximum idle time in milliseconds
-
- Returns: this ActivityPrint instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if maxIdleTime is negative
-
getCreatedTime(...) -> long
-
Signature:
public long getCreatedTime() - Summary: Returns the creation time of the object associated with this activity print.
-
Parameters:
- (none)
- Returns: the creation time in milliseconds since epoch
getLastAccessTime(...) -> long
-
Signature:
public long getLastAccessTime() - Summary: Returns the last access time for the object associated with this activity print.
-
Parameters:
- (none)
- Returns: the last access time in milliseconds since epoch
updateLastAccessTime(...) -> void
-
Signature:
public void updateLastAccessTime() - Summary: Updates the last access time to the current system time.
-
Contract:
- This method should be called whenever the associated object is accessed from the pool.
- <p> <b> Usage Examples: </b> </p> <pre> {@code E pooledObject = pool.get(); if (pooledObject != null) { pooledObject.activityPrint().updateLastAccessTime(); } } </pre>
-
Parameters:
- (none)
getAccessCount(...) -> int
-
Signature:
public int getAccessCount() - Summary: Returns the number of times the associated object has been accessed.
-
Parameters:
- (none)
- Returns: the access count
updateAccessCount(...) -> void
-
Signature:
public void updateAccessCount() - Summary: Increments the access count by one.
-
Contract:
- This method should be called whenever the associated object is accessed from the pool.
-
Parameters:
- (none)
getExpirationTime(...) -> long
-
Signature:
public long getExpirationTime() - Summary: Calculates and returns the expiration time for the associated object.
-
Parameters:
- (none)
- Returns: the expiration time in milliseconds since epoch, or Long.MAX_VALUE if it would overflow
isExpired(...) -> boolean
-
Signature:
public boolean isExpired() - Summary: Checks whether the associated object has expired based on its lifetime or idle time.
-
Contract:
- <p> An object is considered expired if either: <ul> <li> It has exceeded its maximum lifetime (current time - creation time > live time) </li> <li> It has been idle too long (current time - last access time > max idle time) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code if (pooledObject.activityPrint().isExpired()) { pooledObject.destroy(Caller.EVICT); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the object has expired, {@code false} otherwise
clone(...) -> Object
-
Signature:
@Override public Object clone() - Summary: Creates and returns a copy of this ActivityPrint.
-
Parameters:
- (none)
- Returns: a clone of this ActivityPrint
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this ActivityPrint.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is equal to this ActivityPrint.
-
Contract:
- Two ActivityPrint objects are equal if all their fields have the same values.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this ActivityPrint.
-
Parameters:
- (none)
- Returns: a string representation of this object
Enum EvictionPolicy (com.landawn.abacus.pool.EvictionPolicy)
Enumeration of eviction policies that determine which objects to remove from a pool when it reaches capacity or during periodic eviction runs.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class GenericKeyedObjectPool (com.landawn.abacus.pool.GenericKeyedObjectPool)
A generic implementation of KeyedObjectPool that manages poolable objects by keys.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> boolean
-
Signature:
@Override public boolean put(final K key, final E value) throws IllegalStateException - Summary: Associates the specified element with the specified key in this pool.
-
Contract:
- If the pool previously contained a mapping for the key, the old element is replaced and destroyed.
- <p> The put operation will fail if: </p> <ul> <li> Either key or element is null </li> <li> The element has already expired </li> <li> The pool is at capacity and auto-balancing is disabled </li> <li> The element would exceed memory constraints (when memory measure is configured) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code DBConnection conn = new DBConnection("server1"); if (pool.put("database1", conn)) { System.out.println("Connection added successfully"); } else { System.out.println("Failed to add - pool full or connection expired"); conn.destroy(Caller.PUT_ADD_FAILURE); } } </pre>
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
value(E) — the value to be associated with the specified key
-
- Returns: {@code true} if the mapping was successfully added, {@code false} otherwise
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
-
Signature:
@Override public boolean put(final K key, final E value, final boolean autoDestroyOnFailedToPut) - Summary: Associates the specified element with the specified key in this pool, with optional automatic destruction on failure.
-
Contract:
- <p> This is a convenience method that wraps {@link #put(Object, Poolable)} and optionally destroys the element if the put operation fails.
- The destruction occurs in a finally block to ensure cleanup even if an exception is thrown.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
value(E) — the value to be associated with the specified key -
autoDestroyOnFailedToPut(boolean) — if {@code true} , calls {@code value.destroy(PUT_ADD_FAILURE)} when put fails
-
- Returns: {@code true} if the mapping was successfully added, {@code false} otherwise
get(...) -> E
-
Signature:
@MayReturnNull @Override public E get(final K key) throws IllegalStateException - Summary: Returns the element associated with the specified key, or {@code null} if no mapping exists.
-
Contract:
- Returns the element associated with the specified key, or {@code null} if no mapping exists.
- If the element has expired, it is removed and destroyed, and {@code null} is returned.
- <p> This method performs the following operations: </p> <ol> <li> Retrieves the element associated with the key </li> <li> Checks if the element has expired </li> <li> If expired: removes and destroys the element, returns {@code null} </li> <li> If valid: updates last access time and access count, returns the element </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code E cached = pool.get("myKey"); if (cached != null) { // Use cached element } else { // Create new element and add to pool E newElement = createElement(); pool.put("myKey", newElement); } } </pre>
-
Parameters:
-
key(K) — the key whose associated element is to be returned
-
- Returns: the element associated with the key, or {@code null} if no mapping exists or element expired
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
remove(...) -> E
-
Signature:
@MayReturnNull @Override public E remove(final K key) throws IllegalStateException - Summary: Removes and returns the element associated with the specified key.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code E element = pool.remove("myKey"); if (element != null) { try { // use the element exclusively } finally { element.destroy(Caller.REMOVE_REPLACE_CLEAR); } } } </pre>
-
Parameters:
-
key(K) — the key whose mapping is to be removed
-
- Returns: the element previously associated with the key, or {@code null} if no mapping exists
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
peek(...) -> E
-
Signature:
@MayReturnNull @Override public E peek(final K key) throws IllegalStateException - Summary: Returns the element associated with the specified key without updating access statistics.
-
Contract:
- If the element has expired, it is removed and destroyed, and {@code null} is returned.
- <p> <b> Important Side Effects: </b> </p> <ul> <li> <b> Does NOT update </b> last access time - element's access time remains unchanged </li> <li> <b> Does NOT update </b> access count - element's access counter remains unchanged </li> <li> <b> DOES remove and destroy </b> expired elements - if the element has expired, it will be destroyed and removed from the pool, and {@code null} will be returned </li> <li> <b> Does NOT remove </b> the element from the pool (if valid) - the element remains available for future requests </li> </ul> <p> Use this method when you need to inspect pool contents for monitoring, debugging, or administrative purposes without affecting the element's eviction priority.
- If you need to use the element for regular operations, use {@link #get(Object)} instead.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if an element exists without affecting its access statistics DBConnection conn = pool.peek("database1"); if (conn != null) { System.out.println("Connection available: " + conn.isActive()); // Connection remains in pool with unchanged access statistics } } </pre>
-
Parameters:
-
key(K) — the key whose associated element is to be returned
-
- Returns: the element associated with the key, or {@code null} if no mapping exists or element expired
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
containsKey(...) -> boolean
-
Signature:
@Override public boolean containsKey(final K key) throws IllegalStateException - Summary: Returns {@code true} if this pool contains a mapping for the specified key.
-
Contract:
- Returns {@code true} if this pool contains a mapping for the specified key.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (pool.containsKey("database1")) { DBConnection conn = pool.get("database1"); // use connection } else { // create and add new connection } } </pre>
-
Parameters:
-
key(K) — the key whose presence in this pool is to be tested
-
- Returns: {@code true} if this pool contains a mapping for the specified key
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
keySet(...) -> Set<K>
-
Signature:
@Override public Set<K> keySet() throws IllegalStateException - Summary: Returns a snapshot of the keys contained in this pool.
-
Parameters:
- (none)
- Returns: a set containing all keys currently in the pool
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
values(...) -> Collection<E>
-
Signature:
@Override public Collection<E> values() throws IllegalStateException - Summary: Returns a snapshot of the elements contained in this pool.
-
Parameters:
- (none)
- Returns: a collection containing all elements currently in the pool
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
clear(...) -> void
-
Signature:
@Override public void clear() throws IllegalStateException - Summary: Removes all mappings from this pool.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
close(...) -> void
-
Signature:
@Override public void close() - Summary: Closes this pool and releases all resources.
-
Contract:
- Cancels the eviction task if scheduled and destroys all pooled entries.
-
Parameters:
- (none)
vacate(...) -> void
-
Signature:
@Override public void vacate() throws IllegalStateException - Summary: Removes a portion of mappings from the pool based on the configured balance factor.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
size(...) -> int
-
Signature:
@Override public int size() throws IllegalStateException - Summary: Returns the current number of key-value mappings in the pool.
-
Parameters:
- (none)
- Returns: the number of mappings currently in the pool
-
Throws:
-
java.lang.IllegalStateException
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this pool.
-
Parameters:
- (none)
- Returns: a hash code value for this pool
equals(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @Override public boolean equals(final Object obj) - Summary: Compares this pool to the specified object for equality.
-
Contract:
- Two pools are equal if they contain the same key-value mappings.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the pools are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this pool.
-
Parameters:
- (none)
- Returns: a string representation of this pool
Class GenericObjectPool (com.landawn.abacus.pool.GenericObjectPool)
A generic implementation of ObjectPool that stores poolable objects in a LIFO (Last-In-First-Out) structure.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> boolean
-
Signature:
@Override public boolean add(final E element) throws IllegalStateException - Summary: Adds an object to the pool.
-
Contract:
- <p> The add operation will fail if: </p> <ul> <li> The object is null </li> <li> The object has already expired </li> <li> The pool is at capacity and auto-balancing is disabled </li> <li> The object would exceed memory constraints (when memory measure is configured) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code MyPoolable obj = new MyPoolable(); if (pool.add(obj)) { System.out.println("Object added successfully"); } else { System.out.println("Failed to add - pool full or object expired"); obj.destroy(Caller.PUT_ADD_FAILURE); } } </pre>
-
Parameters:
-
element(E) — the object to add, must not be {@code null}
-
- Returns: {@code true} if the object was successfully added, {@code false} otherwise
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
-
Signature:
@Override public boolean add(final E element, final boolean autoDestroyOnFailedToAdd) - Summary: Adds an object to the pool with optional automatic destruction on failure.
-
Contract:
- This method ensures proper cleanup of resources if the object cannot be added.
-
Parameters:
-
element(E) — the object to add, must not be {@code null} -
autoDestroyOnFailedToAdd(boolean) — if {@code true} , calls e.destroy(PUT_ADD_FAILURE) if add fails
-
- Returns: {@code true} if the object was successfully added, {@code false} otherwise
-
Signature:
@Override public boolean add(final E element, final long timeout, final TimeUnit unit) throws IllegalStateException, InterruptedException - Summary: Attempts to add an object to the pool within the specified timeout period.
-
Contract:
- After 10,000 iterations of checking for available space, the method will return {@code false} even if the timeout has not expired.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code MyPoolable obj = new MyPoolable(); // Wait up to 5 seconds to add the object if (pool.add(obj, 5, TimeUnit.SECONDS)) { System.out.println("Object added successfully"); } else { System.out.println("Failed to add - pool full or timeout"); obj.destroy(Caller.PUT_ADD_FAILURE); } } </pre>
-
Parameters:
-
element(E) — the object to add, must not be {@code null} -
timeout(long) — the maximum time to wait -
unit(TimeUnit) — the time unit of the timeout argument
-
- Returns: {@code true} if successful, {@code false} if the timeout elapsed before space was available or if the maxSpins safety limit (10,000 iterations) is reached
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed -
java.lang.InterruptedException— if interrupted while waiting
-
-
Signature:
@Override public boolean add(final E element, final long timeout, final TimeUnit unit, final boolean autoDestroyOnFailedToAdd) throws InterruptedException - Summary: Attempts to add an object to the pool with timeout and automatic destruction on failure.
-
Parameters:
-
element(E) — the object to add, must not be {@code null} -
timeout(long) — the maximum time to wait -
unit(TimeUnit) — the time unit of the timeout argument -
autoDestroyOnFailedToAdd(boolean) — if {@code true} , calls e.destroy(PUT_ADD_FAILURE) if add fails
-
- Returns: {@code true} if successful, {@code false} if the timeout elapsed or add failed
-
Throws:
-
java.lang.InterruptedException— if interrupted while waiting
-
take(...) -> E
-
Signature:
@MayReturnNull @Override public E take() throws IllegalStateException - Summary: Retrieves and removes an object from the pool.
-
Contract:
- <p> If the retrieved object has expired, it will be destroyed and the method will return {@code null} .
- <p> This method performs the following operations: </p> <ol> <li> Removes an object from the head of the pool (LIFO) </li> <li> Checks if the object has expired </li> <li> If expired: destroys the object, returns {@code null} </li> <li> If valid: updates last access time and access count, returns the object </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code E obj = pool.take(); if (obj != null) { try { // use the object } finally { pool.add(obj); // return to pool } } else { // pool is empty, create new object if needed } } </pre>
-
Parameters:
- (none)
- Returns: an object from the pool, or {@code null} if the pool is empty
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
-
Signature:
@MayReturnNull @Override public E take(final long timeout, final TimeUnit unit) throws IllegalStateException, InterruptedException - Summary: Retrieves and removes an object from the pool within the specified timeout period.
-
Parameters:
-
timeout(long) — the maximum time to wait -
unit(TimeUnit) — the time unit of the timeout argument
-
- Returns: an object from the pool, or {@code null} if the timeout elapsed before an object was available
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed -
java.lang.InterruptedException— if interrupted while waiting
-
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final E element) throws IllegalStateException - Summary: Checks if the pool contains the specified object.
-
Contract:
- Checks if the pool contains the specified object.
- <p> <b> Usage Examples: </b> </p> <pre> {@code MyPoolable obj = new MyPoolable(); pool.add(obj); if (pool.contains(obj)) { System.out.println("Object is in the pool"); } } </pre>
-
Parameters:
-
element(E) — the object to search for
-
- Returns: {@code true} if the pool contains the object, {@code false} otherwise
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
vacate(...) -> void
-
Signature:
@Override public void vacate() throws IllegalStateException - Summary: Removes a portion of objects from the pool based on the configured balance factor.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
clear(...) -> void
-
Signature:
@Override public void clear() throws IllegalStateException - Summary: Removes all objects from the pool.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the pool has been closed
-
close(...) -> void
-
Signature:
@Override public void close() - Summary: Closes this pool and releases all resources.
-
Contract:
- Cancels the eviction task if scheduled and destroys all pooled objects.
-
Parameters:
- (none)
size(...) -> int
-
Signature:
@Override public int size() throws IllegalStateException - Summary: Returns the current number of objects in the pool.
-
Parameters:
- (none)
- Returns: the number of objects currently in the pool
-
Throws:
-
java.lang.IllegalStateException
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this pool.
-
Parameters:
- (none)
- Returns: a hash code value for this pool
equals(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @Override public boolean equals(final Object obj) - Summary: Compares this pool to the specified object for equality.
-
Contract:
- Two pools are equal if they contain the same objects in the same order.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the pools are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this pool.
-
Parameters:
- (none)
- Returns: a string representation of this pool
Interface KeyedObjectPool (com.landawn.abacus.pool.KeyedObjectPool)
A pool that manages objects associated with keys, similar to a Map but with pooling capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> boolean
-
Signature:
boolean put(K key, E value) - Summary: Associates the specified poolable element with the specified key in this pool.
-
Contract:
- If the pool previously contained an element for the key, the old element is destroyed.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated, must not be {@code null} -
value(E) — the value to be associated with the specified key, must not be {@code null}
-
- Returns: {@code true} if the value was successfully added, {@code false} otherwise
-
Signature:
boolean put(K key, E value, boolean autoDestroyOnFailedToPut) - Summary: Associates the specified element with the specified key in this pool, with optional automatic destruction on failure.
-
Contract:
- <p> This is a convenience method that ensures proper cleanup if the object cannot be pooled.
- <p> <b> Execution Order: </b> </p> <ol> <li> Attempts to add the object to the pool using {@link #put(Object, Poolable)} </li> <li> If put fails and {@code autoDestroyOnFailedToPut} is {@code true} , calls {@code value.destroy(PUT_ADD_FAILURE)} </li> <li> Returns the success status of the put operation </li> </ol> <p> The destroy operation is guaranteed to execute in a finally block if the put fails, even if an exception occurs during the put attempt.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Assume DBConnection extends AbstractPoolable and implements close logic in destroy() DBConnection conn = new DBConnection("server1"); // Connection will be destroyed if it can't be added to pool pool.put("db1", conn, true); } </pre>
-
Parameters:
-
key(K) — the key with which the specified value is to be associated, must not be {@code null} -
value(E) — the value to be associated with the specified key, must not be {@code null} -
autoDestroyOnFailedToPut(boolean) — if {@code true} , calls value.destroy(PUT_ADD_FAILURE) if put fails
-
- Returns: {@code true} if the value was successfully added, {@code false} otherwise
get(...) -> E
-
Signature:
@MayReturnNull E get(K key) - Summary: Returns the element associated with the specified key, or {@code null} if no mapping exists.
-
Contract:
- Returns the element associated with the specified key, or {@code null} if no mapping exists.
- <p> If the retrieved element has expired, it will be destroyed and {@code null} will be returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code E cached = pool.get("myKey"); if (cached != null) { // Use cached object } else { // Create new object and add to pool E newObj = createObject(); pool.put("myKey", newObj); } } </pre>
-
Parameters:
-
key(K) — the key whose associated element is to be returned
-
- Returns: the element associated with the key, or {@code null} if no mapping exists or the element has expired
remove(...) -> E
-
Signature:
@MayReturnNull E remove(K key) - Summary: Removes and returns the element associated with the specified key.
-
Parameters:
-
key(K) — the key whose mapping is to be removed from the pool
-
- Returns: the element previously associated with the key, or {@code null} if no mapping exists
peek(...) -> E
-
Signature:
@MayReturnNull E peek(K key) - Summary: Returns the element associated with the specified key without updating access statistics.
-
Contract:
- <p> <b> Important Side Effects: </b> </p> <ul> <li> <b> Does NOT update </b> last access time - element's access time remains unchanged </li> <li> <b> Does NOT update </b> access count - element's access counter remains unchanged </li> <li> <b> DOES remove and destroy </b> expired elements - if the element has expired, it will be destroyed and removed from the pool, and {@code null} will be returned </li> <li> <b> Does NOT remove </b> the element from the pool (if valid) - the element remains available for future requests </li> </ul> <p> Use this method when you need to inspect pool contents for monitoring, debugging, or administrative purposes without affecting the element's eviction priority.
- If you need to use the element for regular operations, use {@link #get(Object)} instead.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if an element exists without affecting its access statistics DBConnection conn = pool.peek("database1"); if (conn != null) { System.out.println("Connection available: " + conn.isActive()); // Connection remains in pool with unchanged access statistics } } </pre>
-
Parameters:
-
key(K) — the key whose associated element is to be returned
-
- Returns: the element associated with the key, or {@code null} if no mapping exists or element expired
keySet(...) -> Set<K>
-
Signature:
Set<K> keySet() - Summary: Returns a Set view of the keys contained in this pool.
-
Parameters:
- (none)
- Returns: a set containing all keys currently in the pool
values(...) -> Collection<E>
-
Signature:
Collection<E> values() - Summary: Returns a Collection view of the values contained in this pool.
-
Parameters:
- (none)
- Returns: a collection containing all values currently in the pool
containsKey(...) -> boolean
-
Signature:
boolean containsKey(K key) - Summary: Checks if this pool contains a mapping for the specified key.
-
Contract:
- Checks if this pool contains a mapping for the specified key.
-
Parameters:
-
key(K) — the key whose presence in this pool is to be tested
-
- Returns: {@code true} if this pool contains a mapping for the specified key, {@code false} otherwise
Interface MemoryMeasure (com.landawn.abacus.pool.KeyedObjectPool.MemoryMeasure)
Interface for measuring the memory size of key-value pairs in the pool.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
sizeOf(...) -> long
-
Signature:
long sizeOf(K key, E value) - Summary: Calculates the memory size of the given key-value pair in bytes.
-
Parameters:
-
key(K) — the key part of the pair, never {@code null} when called by the pool -
value(E) — the value part of the pair, never {@code null} when called by the pool
-
- Returns: the combined size of the key-value pair in bytes, should be non-negative
Interface ObjectPool (com.landawn.abacus.pool.ObjectPool)
A pool of reusable objects that extends the base Pool interface with object-specific operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> boolean
-
Signature:
boolean add(E element) - Summary: Adds a new object to the pool.
-
Contract:
- The object will only be added if the pool has capacity and the object has not expired.
-
Parameters:
-
element(E) — the object to be added to the pool, must not be {@code null}
-
- Returns: {@code true} if the object was successfully added, {@code false} otherwise
-
Signature:
boolean add(E element, boolean autoDestroyOnFailedToAdd) - Summary: Adds a new object to the pool with optional automatic destruction on failure.
-
Contract:
- This is a convenience method that ensures proper cleanup if the object cannot be pooled.
- <p> <b> Execution Order: </b> </p> <ol> <li> Attempts to add the object to the pool using {@link #add(Poolable)} </li> <li> If add fails and {@code autoDestroyOnFailedToAdd} is {@code true} , calls {@code element.destroy(PUT_ADD_FAILURE)} </li> <li> Returns the success status of the add operation </li> </ol> <p> The destroy operation is guaranteed to execute in a finally block if the add fails, even if an exception occurs during the add attempt.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code MyPoolable obj = createExpensiveObject(); // Object will be automatically destroyed if it can't be added pool.add(obj, true); } </pre>
-
Parameters:
-
element(E) — the object to be added to the pool, must not be {@code null} -
autoDestroyOnFailedToAdd(boolean) — if {@code true} , calls element.destroy(PUT_ADD_FAILURE) if add fails
-
- Returns: {@code true} if the object was successfully added, {@code false} otherwise
-
Signature:
boolean add(E element, long timeout, TimeUnit unit) throws InterruptedException - Summary: Attempts to add an object to the pool, waiting if necessary for space to become available.
-
Contract:
- Attempts to add an object to the pool, waiting if necessary for space to become available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code MyPoolable obj = new MyPoolable(); if (pool.add(obj, 5, TimeUnit.SECONDS)) { // Successfully added } else { // Timeout - handle the object obj.destroy(Caller.PUT_ADD_FAILURE); } } </pre>
-
Parameters:
-
element(E) — the object to be added to the pool, must not be {@code null} -
timeout(long) — the maximum time to wait for space to become available -
unit(TimeUnit) — the time unit of the timeout argument
-
- Returns: {@code true} if successful, {@code false} if timeout elapsed before space was available
-
Throws:
-
java.lang.InterruptedException— if interrupted while waiting
-
-
Signature:
boolean add(E element, long timeout, TimeUnit unit, boolean autoDestroyOnFailedToAdd) throws InterruptedException - Summary: Attempts to add an object to the pool with timeout and automatic destruction on failure.
-
Contract:
- <p> <b> Execution Order: </b> </p> <ol> <li> Attempts to add the object to the pool using {@link #add(Poolable, long, TimeUnit)} , waiting up to the specified timeout </li> <li> If add fails (timeout or capacity) and {@code autoDestroyOnFailedToAdd} is {@code true} , calls {@code element.destroy(PUT_ADD_FAILURE)} </li> <li> Returns the success status of the add operation </li> </ol> <p> The destroy operation is guaranteed to execute in a finally block if the add fails, even if an exception occurs during the add attempt.
-
Parameters:
-
element(E) — the object to be added to the pool, must not be {@code null} -
timeout(long) — the maximum time to wait for space to become available -
unit(TimeUnit) — the time unit of the timeout argument -
autoDestroyOnFailedToAdd(boolean) — if {@code true} , calls element.destroy(PUT_ADD_FAILURE) if add fails
-
- Returns: {@code true} if successful, {@code false} if timeout elapsed or add failed
-
Throws:
-
java.lang.InterruptedException— if interrupted while waiting
-
take(...) -> E
-
Signature:
@MayReturnNull E take() - Summary: Retrieves and removes an object from the pool, or returns {@code null} if the pool is empty.
-
Contract:
- Retrieves and removes an object from the pool, or returns {@code null} if the pool is empty.
- <p> If the retrieved object has expired, it will be destroyed and {@code null} will be returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code E obj = pool.take(); if (obj != null) { try { // use the object } finally { pool.add(obj); // return to pool } } } </pre>
-
Parameters:
- (none)
- Returns: an object from the pool, or {@code null} if the pool is empty
-
Signature:
@MayReturnNull E take(long timeout, TimeUnit unit) throws InterruptedException - Summary: Retrieves and removes an object from the pool, waiting if necessary for an object to become available.
-
Contract:
- Retrieves and removes an object from the pool, waiting if necessary for an object to become available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code E obj = pool.take(10, TimeUnit.SECONDS); if (obj != null) { try { // use the object } finally { pool.add(obj); // return to pool } } else { // timeout - pool was empty } } </pre>
-
Parameters:
-
timeout(long) — the maximum time to wait for an object to become available -
unit(TimeUnit) — the time unit of the timeout argument
-
- Returns: an object from the pool, or {@code null} if the timeout elapsed before an object was available
-
Throws:
-
java.lang.InterruptedException— if interrupted while waiting
-
contains(...) -> boolean
-
Signature:
boolean contains(E element) - Summary: Checks if the specified object is currently in the pool.
-
Contract:
- Checks if the specified object is currently in the pool.
-
Parameters:
-
element(E) — the object to search for in the pool
-
- Returns: {@code true} if the pool contains the specified object, {@code false} otherwise
Interface MemoryMeasure (com.landawn.abacus.pool.ObjectPool.MemoryMeasure)
Interface for measuring the memory size of objects in the pool.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
sizeOf(...) -> long
-
Signature:
long sizeOf(E element) - Summary: Calculates the memory size of the given object in bytes.
-
Parameters:
-
element(E) — the object to measure, never {@code null} when called by the pool
-
- Returns: the size of the object in bytes, should be non-negative
Interface Pool (com.landawn.abacus.pool.Pool)
Base interface for all pool implementations, providing fundamental pool operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
lock(...) -> void
-
Signature:
void lock() - Summary: Acquires an exclusive lock on this pool.
-
Contract:
- <p> The lock must be released by calling {@link #unlock()} in a finally block to ensure proper cleanup even if an exception occurs.
-
Parameters:
- (none)
unlock(...) -> void
-
Signature:
void unlock() - Summary: Releases the exclusive lock on this pool.
-
Contract:
- <p> This method must be called by the same thread that acquired the lock via {@link #lock()} , typically in a finally block.
-
Parameters:
- (none)
capacity(...) -> int
-
Signature:
int capacity() - Summary: Returns the maximum capacity of this pool.
-
Parameters:
- (none)
- Returns: the maximum number of objects this pool can hold
size(...) -> int
-
Signature:
int size() - Summary: Returns the current number of objects in this pool.
-
Contract:
- <p> The size may change between the time this method returns and when the returned value is used, as other threads may be concurrently adding or removing objects.
-
Parameters:
- (none)
- Returns: the current number of objects in the pool
isEmpty(...) -> boolean
-
Signature:
boolean isEmpty() - Summary: Checks whether this pool is empty.
-
Parameters:
- (none)
- Returns: {@code true} if the pool contains no objects, {@code false} otherwise
vacate(...) -> void
-
Signature:
void vacate() - Summary: Removes a portion of objects from the pool to free up space.
-
Contract:
- <p> This method is typically called when the pool is full and auto-balancing is enabled.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (pool.size() >= pool.capacity() * 0.9) { pool.vacate(); // free up some space } } </pre>
-
Parameters:
- (none)
clear(...) -> void
-
Signature:
void clear() - Summary: Removes all objects from this pool.
-
Parameters:
- (none)
stats(...) -> PoolStats
-
Signature:
PoolStats stats() - Summary: Returns a snapshot of statistics for this pool.
-
Contract:
- <p> The statistics include information such as: </p> <ul> <li> Pool capacity and current size </li> <li> Number of put and get operations </li> <li> Hit and miss counts </li> <li> Number of evictions </li> <li> Memory usage (if applicable) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code PoolStats stats = pool.stats(); System.out.println("Pool capacity: " + stats.capacity()); System.out.println("Pool size: " + stats.size()); System.out.println("Eviction count: " + stats.evictionCount()); } </pre>
-
Parameters:
- (none)
- Returns: a PoolStats object containing current pool statistics
close(...) -> void
-
Signature:
void close() - Summary: Closes this pool and releases all resources.
-
Parameters:
- (none)
isClosed(...) -> boolean
-
Signature:
boolean isClosed() - Summary: Checks whether this pool has been closed.
-
Parameters:
- (none)
- Returns: {@code true} if the pool has been closed, {@code false} otherwise
Class PoolFactory (com.landawn.abacus.pool.PoolFactory)
Factory class for creating various types of object pools.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
createObjectPool(...) -> ObjectPool<E>
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity) - Summary: Creates a new ObjectPool with the specified capacity.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold
-
- Returns: a new ObjectPool instance with the specified capacity
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity, final long evictDelayInMillis) - Summary: Creates a new ObjectPool with the specified capacity and eviction delay.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction
-
- Returns: a new ObjectPool instance with the specified capacity and eviction delay
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy) - Summary: Creates a new ObjectPool with the specified capacity, eviction delay, and eviction policy.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting objects to evict
-
- Returns: a new ObjectPool instance with the specified configuration
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final long maxMemorySize, final ObjectPool.MemoryMeasure<E> memoryMeasure) - Summary: Creates a new ObjectPool with memory-based capacity constraints.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting objects to evict -
maxMemorySize(long) — the maximum total memory in bytes the pool can use -
memoryMeasure(ObjectPool.MemoryMeasure<E>) — the function to calculate memory size of pool elements
-
- Returns: a new ObjectPool instance with memory constraints
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final boolean autoBalance, final float balanceFactor) - Summary: Creates a new ObjectPool with custom auto-balancing configuration.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting objects to evict -
autoBalance(boolean) — whether to automatically remove objects when the pool is full -
balanceFactor(float) — the proportion of objects to remove during balancing (typically 0.1 to 0.5)
-
- Returns: a new ObjectPool instance with custom balancing configuration
-
Signature:
public static <E extends Poolable> ObjectPool<E> createObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final boolean autoBalance, final float balanceFactor, final long maxMemorySize, final ObjectPool.MemoryMeasure<E> memoryMeasure) - Summary: Creates a new ObjectPool with full configuration options including memory constraints and auto-balancing.
-
Parameters:
-
capacity(int) — the maximum number of objects the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting objects to evict -
autoBalance(boolean) — whether to automatically remove objects when the pool is full -
balanceFactor(float) — the proportion of objects to remove during balancing, typically 0.1 to 0.5 -
maxMemorySize(long) — the maximum total memory in bytes, or 0 for no memory limit -
memoryMeasure(ObjectPool.MemoryMeasure<E>) — the function to calculate memory size of pool elements, or {@code null} if not using memory limits
-
- Returns: a new ObjectPool instance with full configuration
createKeyedObjectPool(...) -> KeyedObjectPool<K, E>
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity) - Summary: Creates a new KeyedObjectPool with the specified capacity.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold
-
- Returns: a new KeyedObjectPool instance with the specified capacity
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity, final long evictDelayInMillis) - Summary: Creates a new KeyedObjectPool with the specified capacity and eviction delay.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction
-
- Returns: a new KeyedObjectPool instance with the specified capacity and eviction delay
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy) - Summary: Creates a new KeyedObjectPool with the specified capacity, eviction delay, and eviction policy.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting entries to evict
-
- Returns: a new KeyedObjectPool instance with the specified configuration
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final long maxMemorySize, final KeyedObjectPool.MemoryMeasure<K, E> memoryMeasure) - Summary: Creates a new KeyedObjectPool with memory-based capacity constraints.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting entries to evict -
maxMemorySize(long) — the maximum total memory in bytes the pool can use -
memoryMeasure(KeyedObjectPool.MemoryMeasure<K, E>) — the function to calculate memory size of key-value pairs
-
- Returns: a new KeyedObjectPool instance with memory constraints
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final boolean autoBalance, final float balanceFactor) - Summary: Creates a new KeyedObjectPool with custom auto-balancing configuration.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting entries to evict -
autoBalance(boolean) — whether to automatically remove entries when the pool is full -
balanceFactor(float) — the proportion of entries to remove during balancing (typically 0.1 to 0.5)
-
- Returns: a new KeyedObjectPool instance with custom balancing configuration
-
Signature:
public static <K, E extends Poolable> KeyedObjectPool<K, E> createKeyedObjectPool(final int capacity, final long evictDelayInMillis, final EvictionPolicy evictionPolicy, final boolean autoBalance, final float balanceFactor, final long maxMemorySize, final KeyedObjectPool.MemoryMeasure<K, E> memoryMeasure) - Summary: Creates a new KeyedObjectPool with full configuration options including memory constraints and auto-balancing.
-
Parameters:
-
capacity(int) — the maximum number of key-value pairs the pool can hold -
evictDelayInMillis(long) — the delay in milliseconds between eviction runs, or 0 to disable eviction -
evictionPolicy(EvictionPolicy) — the policy to use for selecting entries to evict (default: LAST_ACCESS_TIME) -
autoBalance(boolean) — whether to automatically remove entries when the pool is full (default: true) -
balanceFactor(float) — the proportion of entries to remove during balancing, typically 0.1 to 0.5 (default: 0.2) -
maxMemorySize(long) — the maximum total memory in bytes, or 0 for no memory limit -
memoryMeasure(KeyedObjectPool.MemoryMeasure<K, E>) — the function to calculate memory size of key-value pairs, or {@code null} if not using memory limits
-
- Returns: a new KeyedObjectPool instance with full configuration
Public Instance Methods
- (none)
Record PoolStats (com.landawn.abacus.pool.PoolStats)
An immutable record containing statistics about a pool's current state and historical performance.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
record PoolStats(int capacity, int size, long putCount, long getCount, long hitCount, long missCount, long evictionCount, long maxMemory, long dataSize) { } -
Parameters:
-
capacity(int) -
size(int) -
putCount(long) -
getCount(long) -
hitCount(long) -
missCount(long) -
evictionCount(long) -
maxMemory(long) -
dataSize(long)
-
Interface Poolable (com.landawn.abacus.pool.Poolable)
Interface for objects that can be managed by a pool.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> PoolableWrapper<T>
-
Signature:
static <T> PoolableWrapper<T> wrap(final T value) - Summary: Wraps the provided object in a PoolableWrapper with maximum lifetime and idle time.
-
Parameters:
-
value(T) — the object to wrap, can be {@code null}
-
- Returns: a PoolableWrapper containing the source object
-
Signature:
static <T> PoolableWrapper<T> wrap(final T value, final long liveTime, final long maxIdleTime) - Summary: Wraps the provided object in a PoolableWrapper with specified lifetime and idle time limits.
-
Contract:
- This allows fine-grained control over when wrapped objects expire.
-
Parameters:
-
value(T) — the object to wrap, can be {@code null} -
liveTime(long) — maximum lifetime in milliseconds before the object expires -
maxIdleTime(long) — maximum idle time in milliseconds before the object expires
-
- Returns: a PoolableWrapper containing the source object with the specified expiration settings
Public Instance Methods
activityPrint(...) -> ActivityPrint
-
Signature:
ActivityPrint activityPrint() - Summary: Returns the activity print associated with this poolable object.
-
Contract:
- <p> The returned ActivityPrint should be the same instance throughout the object's lifetime to ensure consistent tracking of access patterns and expiration.
-
Parameters:
- (none)
- Returns: the ActivityPrint for this object, never {@code null}
destroy(...) -> void
-
Signature:
void destroy(Caller caller) - Summary: Destroys this poolable object and releases any resources it holds.
-
Contract:
- This method is called when the object is being removed from the pool.
- <p> Implementations should: <ul> <li> Close any open resources (connections, files, etc.) </li> <li> Cancel any pending operations </li> <li> Clear references to help garbage collection </li> <li> Handle exceptions gracefully without throwing </li> </ul> <p> The caller parameter indicates why the object is being destroyed, which can be useful for logging or different cleanup strategies.
-
Parameters:
-
caller(Caller) — the reason for destruction, providing context about why the object is being removed
-
- See also: Caller
Enum Caller (com.landawn.abacus.pool.Poolable.Caller)
Enumeration of reasons why a poolable object might be destroyed.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
value(...) -> int
-
Signature:
public int value() - Summary: Returns the numeric value associated with this caller reason.
-
Parameters:
- (none)
- Returns: the numeric identifier for this caller type
Class PoolableWrapper (com.landawn.abacus.pool.PoolableWrapper)
A wrapper class that makes any object poolable by implementing the Poolable interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public PoolableWrapper(final T value) - Summary: Constructs a new PoolableWrapper with infinite lifetime and idle time.
-
Parameters:
-
value(T) — the object to wrap, can be {@code null}
-
-
Signature:
public PoolableWrapper(final T value, final long liveTime, final long maxIdleTime) - Summary: Constructs a new PoolableWrapper with specified lifetime and idle time limits.
-
Parameters:
-
value(T) — the object to wrap, can be {@code null} -
liveTime(long) — the maximum lifetime in milliseconds before expiration -
maxIdleTime(long) — the maximum idle time in milliseconds before expiration
-
value(...) -> T
-
Signature:
public T value() - Summary: Returns the wrapped object.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code PoolableWrapper<String> wrapped = pool.take(); if (wrapped != null) { String data = wrapped.value(); // use data } } </pre>
-
Parameters:
- (none)
- Returns: the object wrapped by this PoolableWrapper, may be {@code null}
destroy(...) -> void
-
Signature:
@Override public void destroy(final Caller caller) - Summary: No-op implementation of destroy.
-
Parameters:
-
caller(Caller) — the reason for destruction (ignored)
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this wrapper.
-
Parameters:
- (none)
- Returns: the hash code of the wrapped object, or 0 if the wrapped object is null
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this wrapper to another object for equality.
-
Contract:
- Two wrappers are equal if they wrap equal objects (according to the wrapped object's equals method).
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the wrapped objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this wrapper.
-
Parameters:
- (none)
- Returns: a string representation of this wrapper
com.landawn.abacus.spring
Class JsonHttpMessageConverter (com.landawn.abacus.spring.JsonHttpMessageConverter)
Spring HTTP message converter for JSON serialization and deserialization using abacus-common JSON utilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public JsonHttpMessageConverter() - Summary: Constructs a new JsonHttpMessageConverter with default configuration.
-
Parameters:
- (none)
-
Signature:
public JsonHttpMessageConverter(final JsonSerializationConfig jsc, final JsonDeserializationConfig jdc) - Summary: Constructs a new JsonHttpMessageConverter with custom serialization and deserialization configurations.
-
Contract:
- <p> Use this constructor when you need to customize the JSON processing behavior beyond the defaults.
-
Parameters:
-
jsc(JsonSerializationConfig) — the serialization configuration controlling how Java objects are converted to JSON. Must not be {@code null} . Use {@link JsonSerializationConfig} to customize serialization behavior. -
jdc(JsonDeserializationConfig) — the deserialization configuration controlling how JSON is converted to Java objects. Must not be {@code null} . Use {@link JsonDeserializationConfig} to customize deserialization behavior.
-
- See also: JsonSerializationConfig, JsonDeserializationConfig, com.landawn.abacus.parser.Exclusion
com.landawn.abacus.type
Class AbstractArrayType (com.landawn.abacus.type.AbstractArrayType)
Abstract base class for array types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isArray(...) -> boolean
-
Signature:
@Override public boolean isArray() - Summary: Checks if this type represents an array type.
-
Contract:
- Checks if this type represents an array type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is an array type
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type for this array type.
-
Contract:
- Returns {@link SerializationType#SERIALIZABLE} if the array type is serializable, otherwise returns {@link SerializationType#ARRAY} .
-
Parameters:
- (none)
- Returns: the appropriate {@link SerializationType} for this array type
arrayToCollection(...) -> Collection<E>
-
Signature:
@Override public <E> Collection<E> arrayToCollection(final T array, final Class<?> collClass) - Summary: Converts an array to a collection of the specified type.
-
Parameters:
-
array(T) — the array to convert, may be {@code null} -
collClass(Class<?>) — the class of the collection to create (must have a no-arg constructor)
-
- Returns: a new collection containing all elements from the array, or {@code null} if the input array is {@code null}
Class AbstractAtomicType (com.landawn.abacus.type.AbstractAtomicType)
Abstract base class for atomic types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Checks if this type represents values that should not be quoted in CSV format.
-
Contract:
- Checks if this type represents values that should not be quoted in CSV format.
- For atomic types, this method always returns {@code true} , indicating that atomic values should be written without quotes in CSV files.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that atomic type values should not be quoted in CSV format
Class AbstractBooleanType (com.landawn.abacus.type.AbstractBooleanType)
Abstract base class for boolean types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Boolean b) - Summary: Converts a Boolean value to its string representation.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation of the boolean value ("true" or "false").
-
Parameters:
-
b(Boolean) — the Boolean value to convert
-
- Returns: the string representation of the boolean value, or {@code null} if input is {@code null}
valueOf(...) -> Boolean
-
Signature:
@Override public Boolean valueOf(final Object obj) - Summary: Converts an object to a Boolean value.
-
Contract:
- This method handles various input types: <ul> <li> {@code null} returns the default value </li> <li> Boolean instances are returned as-is </li> <li> Numbers are converted to {@code true} if greater than 0, {@code false} otherwise </li> <li> Single character strings: 'Y', 'y', or '1' return {@code true} </li> <li> Other strings are parsed using {@link Boolean#valueOf(String)} </li> </ul>
-
Parameters:
-
obj(Object) — the source object to convert
-
- Returns: the Boolean value, or default value if input is {@code null}
-
Signature:
@Override public Boolean valueOf(final String str) - Summary: Converts a string to a Boolean value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Boolean value, or default value if input is empty or {@code null}
-
Signature:
@Override public Boolean valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a Boolean value.
-
Contract:
- This method checks if the character array contains "true" (case-insensitive).
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: {@code true} if the array contains "true" (case-insensitive), {@code false} otherwise
isBoolean(...) -> boolean
-
Signature:
@Override public boolean isBoolean() - Summary: Checks if this type represents a boolean type.
-
Contract:
- Checks if this type represents a boolean type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a boolean type
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Checks if this type represents values that should not be quoted in CSV format.
-
Contract:
- Checks if this type represents values that should not be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that boolean values should not be quoted in CSV format
get(...) -> Boolean
-
Signature:
@Override public Boolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a boolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the boolean value at the specified column, or Boolean.valueOf(false) if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Boolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a boolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the boolean value at the specified column, or Boolean.valueOf(false) if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Boolean x) throws SQLException - Summary: Sets a boolean parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Boolean) — the boolean value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Boolean x) throws SQLException - Summary: Sets a boolean parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Boolean) — the boolean value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Boolean x) throws IOException - Summary: Appends the string representation of a boolean value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , "true" if {@code true} , or "false" if {@code false} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Boolean) — the boolean value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Boolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a boolean value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullBooleanAsFalse} and the value is {@code null} , writes {@code false} instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Boolean) — the boolean value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractByteType (com.landawn.abacus.type.AbstractByteType)
Abstract base class for byte types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as a byte.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation of the byte value.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the byte value, or {@code null} if input is {@code null}
valueOf(...) -> Byte
-
Signature:
@Override public Byte valueOf(final String str) - Summary: Converts a string to a Byte value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Byte value
-
Signature:
@Override public Byte valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a Byte value.
-
Contract:
- Parses the character array as an integer and checks if it's within byte range (Byte.MIN_VALUE to Byte.MAX_VALUE).
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: the Byte value, or default value if input is {@code null} or empty
isByte(...) -> boolean
-
Signature:
@Override public boolean isByte() - Summary: Checks if this type represents a byte type.
-
Contract:
- Checks if this type represents a byte type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Byte> type = TypeFactory.getType(Byte.class); if (type.isByte()) { // Handle byte type specific logic System.out.println("This is a byte type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a byte type
get(...) -> Byte
-
Signature:
@Override public Byte get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a byte value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the byte value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Byte get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a byte value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the byte value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets a byte parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as byte, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets a byte parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as byte, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of a byte value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as byte
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a byte value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0 instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as byte -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractCalendarType (com.landawn.abacus.type.AbstractCalendarType)
Abstract base class for Calendar types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isCalendar(...) -> boolean
-
Signature:
@Override public boolean isCalendar() - Summary: Checks if this type represents a Calendar type.
-
Contract:
- Checks if this type represents a Calendar type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a Calendar type
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Checks if this type is comparable.
-
Contract:
- Checks if this type is comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Calendar types support comparison
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Checks if this type represents values that should not be quoted in CSV format.
-
Contract:
- Checks if this type represents values that should not be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Calendar values should not be quoted in CSV format
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Calendar calendar) - Summary: Converts a Calendar value to its string representation.
-
Parameters:
-
calendar(Calendar) — the Calendar value to convert
-
- Returns: the formatted string representation of the calendar, or {@code null} if input is {@code null}
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Calendar x) throws SQLException - Summary: Sets a Calendar parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Calendar) — the Calendar value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Calendar x) throws SQLException - Summary: Sets a Calendar parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Calendar) — the Calendar value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a Calendar value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the formatted date string.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T) — the Calendar value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Calendar value to a CharacterWriter with optional configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the Calendar value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractCharSequenceType (com.landawn.abacus.type.AbstractCharSequenceType)
Abstract base class for CharSequence types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isCharSequence(...) -> boolean
-
Signature:
@Override public boolean isCharSequence() - Summary: Checks if this type represents a CharSequence type.
-
Contract:
- Checks if this type represents a CharSequence type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a CharSequence type
Class AbstractCharacterType (com.landawn.abacus.type.AbstractCharacterType)
Abstract base class for Character types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(Character x) - Summary: Converts a Character value to its string representation.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns a single-character string.
-
Parameters:
-
x(Character) — the Character value to convert
-
- Returns: the string representation of the character, or {@code null} if input is {@code null}
valueOf(...) -> Character
-
Signature:
@Override public Character valueOf(String str) - Summary: Converts a string to a Character value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Character value, or default value if input is empty or {@code null}
-
Signature:
@Override public Character valueOf(char[] cbuf, int offset, int len) - Summary: Converts a character array to a Character value.
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: the Character value, or default value if input is {@code null} or empty
isCharacter(...) -> boolean
-
Signature:
@Override public boolean isCharacter() - Summary: Checks if this type represents a Character type.
-
Contract:
- Checks if this type represents a Character type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a Character type
get(...) -> Character
-
Signature:
@Override public Character get(ResultSet rs, int columnIndex) throws SQLException - Summary: Retrieves a character value from a ResultSet at the specified column index.
-
Contract:
- Returns the {@code null} character (0) if the database value is NULL.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the first character of the string value, or 0 if NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Character get(ResultSet rs, String columnName) throws SQLException - Summary: Retrieves a character value from a ResultSet using the specified column label.
-
Contract:
- Returns the {@code null} character (0) if the database value is NULL.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the first character of the string value, or 0 if NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(PreparedStatement stmt, int columnIndex, Character x) throws SQLException - Summary: Sets a character parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Character) — the Character value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(CallableStatement stmt, String parameterName, Character x) throws SQLException - Summary: Sets a character parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Character) — the Character value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(Appendable appendable, Character x) throws IOException - Summary: Appends a character value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise appends the character directly.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Character) — the Character value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(CharacterWriter writer, Character x, JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a character value to a CharacterWriter with optional configuration.
-
Contract:
- If quotation is specified in the configuration, the character is wrapped in quotes.
- Special handling is provided for single quotes when they are used as the quotation character.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Character) — the Character value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractDateType (com.landawn.abacus.type.AbstractDateType)
Abstract base class for Date types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isDate(...) -> boolean
-
Signature:
@Override public boolean isDate() - Summary: Checks if this type represents a Date type.
-
Contract:
- Checks if this type represents a Date type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a Date type
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Checks if this type is comparable.
-
Contract:
- Checks if this type is comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Date types support comparison
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Checks if this type represents values that should not be quoted in CSV format.
-
Contract:
- Checks if this type represents values that should not be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Date values should not be quoted in CSV format
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a Date value to its string representation.
-
Parameters:
-
x(T) — the Date value to convert
-
- Returns: the formatted string representation of the date, or {@code null} if input is {@code null}
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a Date value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the formatted date string.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T) — the Date value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Date value to a CharacterWriter with optional configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the Date value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractDoubleType (com.landawn.abacus.type.AbstractDoubleType)
Abstract base class for double types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as a double.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation obtained from the Number's toString() method.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the double value, or {@code null} if input is {@code null}
valueOf(...) -> Double
-
Signature:
@Override public Double valueOf(final String str) - Summary: Converts a string to a Double value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Double value
isDouble(...) -> boolean
-
Signature:
@Override public boolean isDouble() - Summary: Checks if this type represents a double type.
-
Contract:
- Checks if this type represents a double type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Double> type = TypeFactory.getType(Double.class); if (type.isDouble()) { // Handle double type specific logic System.out.println("This is a double type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a double type
get(...) -> Double
-
Signature:
@Override public Double get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a double value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the double value at the specified column; returns 0.0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Double get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a double value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the double value at the specified column; returns 0.0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets a double parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as double, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets a double parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as double, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of a double value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value using its toString() representation.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as double
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a double value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0.0 instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as double -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractFloatType (com.landawn.abacus.type.AbstractFloatType)
Abstract base class for float types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as a float.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation obtained from the Number's toString() method.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the float value, or {@code null} if input is {@code null}
valueOf(...) -> Float
-
Signature:
@Override public Float valueOf(final String str) - Summary: Converts a string to a Float value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Float value
isFloat(...) -> boolean
-
Signature:
@Override public boolean isFloat() - Summary: Checks if this type represents a float type.
-
Contract:
- Checks if this type represents a float type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Float> type = TypeFactory.getType(Float.class); if (type.isFloat()) { // Handle float type specific logic System.out.println("This is a float type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a float type
get(...) -> Float
-
Signature:
@Override public Float get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a float value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the float value at the specified column; returns 0.0f if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Float get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a float value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the float value at the specified column; returns 0.0f if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets a float parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as float, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets a float parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as float, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of a float value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value using its toString() representation.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as float
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a float value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0.0f instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as float -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractIntegerType (com.landawn.abacus.type.AbstractIntegerType)
Abstract base class for integer types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as an integer.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation of the integer value.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the integer value, or {@code null} if input is {@code null}
valueOf(...) -> Integer
-
Signature:
@Override public Integer valueOf(final String str) - Summary: Converts a string to an Integer value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Integer value
-
Signature:
@Override public Integer valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to an Integer value.
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: the Integer value, or default value if input is {@code null} or empty
isInteger(...) -> boolean
-
Signature:
@Override public boolean isInteger() - Summary: Checks if this type represents an integer type.
-
Contract:
- Checks if this type represents an integer type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Integer> type = TypeFactory.getType(Integer.class); if (type.isInteger()) { // Handle integer type specific logic System.out.println("This is an integer type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is an integer type
get(...) -> Integer
-
Signature:
@Override public Integer get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an integer value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the integer value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Integer get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an integer value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the integer value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets an integer parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as integer, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets an integer parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as integer, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of an integer value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as integer
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes an integer value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0 instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as integer -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractJodaDateTimeType (com.landawn.abacus.type.AbstractJodaDateTimeType)
Abstract base class for Joda-Time DateTime types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isJodaDateTime(...) -> boolean
-
Signature:
@Override public boolean isJodaDateTime() - Summary: Checks if this type represents a Joda DateTime type.
-
Contract:
- Checks if this type represents a Joda DateTime type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a Joda DateTime type
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Checks if this type is comparable.
-
Contract:
- Checks if this type is comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Joda DateTime types support comparison
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Checks if this type represents values that should not be quoted in CSV format.
-
Contract:
- Checks if this type represents values that should not be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Joda DateTime values should not be quoted in CSV format
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a Joda DateTime value to its string representation.
-
Parameters:
-
x(T) — the Joda DateTime instant value to convert
-
- Returns: the ISO 8601 timestamp string representation, or {@code null} if input is {@code null}
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a Joda DateTime value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the ISO 8601 timestamp format.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T) — the Joda DateTime instant value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Joda DateTime value to a CharacterWriter with optional configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the Joda DateTime instant value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractLongType (com.landawn.abacus.type.AbstractLongType)
Abstract base class for long types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as a long.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation of the long value.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the long value, or {@code null} if input is {@code null}
valueOf(...) -> Long
-
Signature:
@Override public Long valueOf(final Object obj) - Summary: Converts an object to a Long value.
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: the Long value representing milliseconds for date/time types, or parsed value for others
-
Signature:
@Override public Long valueOf(final String str) - Summary: Converts a string to a Long value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Long value
-
Signature:
@Override public Long valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a Long value.
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: the Long value, or default value if input is {@code null} or empty
isLong(...) -> boolean
-
Signature:
@Override public boolean isLong() - Summary: Checks if this type represents a long type.
-
Contract:
- Checks if this type represents a long type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Long> type = TypeFactory.getType(Long.class); if (type.isLong()) { // Handle long type specific logic System.out.println("This is a long type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a long type
get(...) -> Long
-
Signature:
@Override public Long get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a long value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the long value at the specified column; returns 0L if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Long get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a long value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the long value at the specified column; returns 0L if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets a long parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as long, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets a long parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as long, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of a long value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as long
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a long value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0L instead of {@code null} .
- If the configuration specifies {@code writeLongAsString} , the long value is wrapped in quotation marks.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as long -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractOptionalType (com.landawn.abacus.type.AbstractOptionalType)
Abstract base class for Optional types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isOptionalOrNullable(...) -> boolean
-
Signature:
@Override public boolean isOptionalOrNullable() - Summary: Checks if this type represents an Optional or {@code nullable} type.
-
Contract:
- Checks if this type represents an Optional or {@code nullable} type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is an Optional or {@code nullable} type
Class AbstractPrimaryType (com.landawn.abacus.type.AbstractPrimaryType)
Abstract base class for primary types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Checks if this type is immutable.
-
Contract:
- Checks if this type is immutable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that primary types are immutable
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Checks if this type is comparable.
-
Contract:
- Checks if this type is comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that primary types support comparison
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final Object obj) - Summary: Converts an object to this primary type.
-
Contract:
- Returns the default value if the input object is {@code null} .
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: the converted primary type value, or default value if input is {@code null}
Class AbstractPrimitiveArrayType (com.landawn.abacus.type.AbstractPrimitiveArrayType)
Abstract base class for primitive array types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isPrimitiveArray(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveArray() - Summary: Checks if this type represents a primitive array.
-
Contract:
- Checks if this type represents a primitive array.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a primitive array type
deepHashCode(...) -> int
-
Signature:
@Override public int deepHashCode(final T x) - Summary: Calculates the deep hash code for a primitive array.
-
Parameters:
-
x(T) — the primitive array
-
- Returns: the hash code of the array
deepEquals(...) -> boolean
-
Signature:
@Override public boolean deepEquals(final T x, final T y) - Summary: Performs deep equality comparison between two primitive arrays.
-
Parameters:
-
x(T) — the first primitive array -
y(T) — the second primitive array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString(final T x) - Summary: Converts a primitive array to its string representation.
-
Contract:
- Returns "null" if the array is {@code null} , otherwise delegates to the {@link #stringOf(Object)} method for the actual conversion.
-
Parameters:
-
x(T) — the primitive array
-
- Returns: the string representation of the array
deepToString(...) -> String
-
Signature:
@Override public String deepToString(final T x) - Summary: Converts a primitive array to its deep string representation.
-
Parameters:
-
x(T) — the primitive array
-
- Returns: the string representation of the array
Class AbstractPrimitiveListType (com.landawn.abacus.type.AbstractPrimitiveListType)
Abstract base class for primitive list types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isPrimitiveList(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveList() - Summary: Checks if this type represents a primitive list.
-
Contract:
- Checks if this type represents a primitive list.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a primitive list type
Class AbstractShortType (com.landawn.abacus.type.AbstractShortType)
Abstract base class for short types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Number x) - Summary: Converts a Number value to its string representation as a short.
-
Contract:
- Returns {@code null} if the input is {@code null} , otherwise returns the string representation of the short value.
-
Parameters:
-
x(Number) — the Number value to convert
-
- Returns: the string representation of the short value, or {@code null} if input is {@code null}
valueOf(...) -> Short
-
Signature:
@Override public Short valueOf(final String str) - Summary: Converts a string to a Short value.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: the Short value
-
Signature:
@Override public Short valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a Short value.
-
Contract:
- Parses the character array as an integer and checks if it's within short range (Short.MIN_VALUE to Short.MAX_VALUE).
-
Parameters:
-
cbuf(char[]) — the character array to convert -
offset(int) — the starting position in the array -
len(int) — the number of characters to read
-
- Returns: the Short value, or default value if input is {@code null} or empty
isShort(...) -> boolean
-
Signature:
@Override public boolean isShort() - Summary: Checks if this type represents a short type.
-
Contract:
- Checks if this type represents a short type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Short> type = TypeFactory.getType(Short.class); if (type.isShort()) { // Handle short type specific logic System.out.println("This is a short type"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a short type
get(...) -> Short
-
Signature:
@Override public Short get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a short value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the short value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Short get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a short value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label
-
- Returns: the short value at the specified column; returns 0 if SQL NULL (may be overridden by subclasses to return null)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Number x) throws SQLException - Summary: Sets a short parameter in a PreparedStatement at the specified position.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Number) — the Number value to set as short, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Number x) throws SQLException - Summary: Sets a short parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the value is {@code null} , sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the parameter name -
x(Number) — the Number value to set as short, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Number x) throws IOException - Summary: Appends the string representation of a short value to an Appendable.
-
Contract:
- Writes "null" if the value is {@code null} , otherwise writes the numeric value.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Number) — the Number value to append as short
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, Number x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a short value to a CharacterWriter with optional configuration.
-
Contract:
- If the configuration specifies {@code writeNullNumberAsZero} and the value is {@code null} , writes 0 instead of {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Number) — the Number value to write as short -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class AbstractStringType (com.landawn.abacus.type.AbstractStringType)
Abstract base class for String type handling in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<String>
-
Signature:
@Override public Class<String> clazz() - Summary: Returns the Class object representing the String class.
-
Parameters:
- (none)
- Returns: the Class object for String.class
isString(...) -> boolean
-
Signature:
@Override public boolean isString() - Summary: Determines whether this type represents a String type.
-
Parameters:
- (none)
- Returns: {@code true} indicating this is a string type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final String str) - Summary: Converts a String value to its string representation.
-
Parameters:
-
str(String) — the String value to convert, may be {@code null}
-
- Returns: the same String value passed as input, or {@code null} if input is {@code null}
valueOf(...) -> String
-
Signature:
@Override public String valueOf(final String str) - Summary: Converts a string representation to a String value.
-
Parameters:
-
str(String) — the string representation to convert, may be {@code null}
-
- Returns: the same String value passed as input, or {@code null} if input is {@code null}
-
Signature:
@Override public String valueOf(final char[] cbuf, final int offset, final int len) - Summary: Creates a String from a character array subset.
-
Parameters:
-
cbuf(char[]) — the character array containing the characters to convert, may be {@code null} -
offset(int) — the starting position in the character array (0-based) -
len(int) — the number of characters to include
-
- Returns: a new String created from the specified characters, or {@code null} if cbuf is {@code null} , or an empty string if cbuf is empty or len is 0
-
Signature:
@SuppressFBWarnings @Override public String valueOf(final Object obj) - Summary: Converts an Object to a String value.
-
Parameters:
-
obj(Object) — the object to convert to String, may be {@code null}
-
- Returns: the String representation of the object, or {@code null} if obj is {@code null} . For Clob objects, extracts and returns the character data. For Reader objects, reads all content and returns as String. For other objects, uses their type-specific string conversion.
get(...) -> String
-
Signature:
@Override public String get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a String value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from, must not be {@code null} -
columnIndex(int) — the column index (1-based) of the value to retrieve
-
- Returns: the String value at the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public String get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a String value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from, must not be {@code null} -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified, must not be {@code null}
-
- Returns: the String value in the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final String x) throws SQLException - Summary: Sets a String parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on, must not be {@code null} -
columnIndex(int) — the parameter index (1-based) to set -
x(String) — the String value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final String x) throws SQLException - Summary: Sets a named String parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on, must not be {@code null} -
parameterName(String) — the name of the parameter to set, must not be {@code null} -
x(String) — the String value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final String x) throws IOException - Summary: Appends a String value to an Appendable object.
-
Contract:
- If the String is {@code null} , appends the string "null" instead.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to, must not be {@code null} -
x(String) — the String value to append, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, String x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a String value to a CharacterWriter with optional quotation based on configuration.
-
Contract:
- This method handles {@code null} values and applies string quotation marks if specified in the configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to, must not be {@code null} -
x(String) — the String value to write, may be {@code null} -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify string quotation preferences and {@code null} string handling options, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class AbstractTemporalType (com.landawn.abacus.type.AbstractTemporalType)
Abstract base class for temporal type handling in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Determines whether this temporal type should be quoted in CSV format.
-
Contract:
- Determines whether this temporal type should be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} indicating that temporal values should not be quoted in CSV format
Class AbstractType (com.landawn.abacus.type.AbstractType)
Abstract base class for all types in the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
name(...) -> String
-
Signature:
@Override public String name() - Summary: Returns the name of this type.
-
Parameters:
- (none)
- Returns: the type name
javaType(...) -> java.lang.reflect.Type
-
Signature:
@Override public java.lang.reflect.Type javaType() - Summary: Returns the Java class that this type represents.
-
Parameters:
- (none)
- Returns: the Java class
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type.
-
Parameters:
- (none)
- Returns: the declaring name
xmlName(...) -> String
-
Signature:
@Override public String xmlName() - Summary: Returns the XML-safe name of this type.
-
Parameters:
- (none)
- Returns: the XML-safe type name with escaped angle brackets
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Checks if this is a primitive type.
-
Contract:
- Checks if this is a primitive type.
- Subclasses for primitive types should override this method.
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive type, {@code false} otherwise
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Checks if this is a primitive wrapper type.
-
Contract:
- Checks if this is a primitive wrapper type.
- Subclasses for primitive wrapper types should override this method.
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive wrapper type, {@code false} otherwise
isPrimitiveList(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveList() - Summary: Checks if this is a primitive list type.
-
Contract:
- Checks if this is a primitive list type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive list type, {@code false} otherwise
isBoolean(...) -> boolean
-
Signature:
@Override public boolean isBoolean() - Summary: Checks if this is a boolean type.
-
Contract:
- Checks if this is a boolean type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a boolean type, {@code false} otherwise
isNumber(...) -> boolean
-
Signature:
@Override public boolean isNumber() - Summary: Checks if this is a number type.
-
Contract:
- Checks if this is a number type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a number type, {@code false} otherwise
isString(...) -> boolean
-
Signature:
@Override public boolean isString() - Summary: Checks if this is a string type.
-
Contract:
- Checks if this is a string type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a string type, {@code false} otherwise
isCharSequence(...) -> boolean
-
Signature:
@Override public boolean isCharSequence() - Summary: Checks if this is a CharSequence type.
-
Contract:
- Checks if this is a CharSequence type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a CharSequence type, {@code false} otherwise
isDate(...) -> boolean
-
Signature:
@Override public boolean isDate() - Summary: Checks if this type represents a Date.
-
Contract:
- Checks if this type represents a Date.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Date type, {@code false} otherwise
isCalendar(...) -> boolean
-
Signature:
@Override public boolean isCalendar() - Summary: Checks if this type represents a Calendar.
-
Contract:
- Checks if this type represents a Calendar.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Calendar type, {@code false} otherwise
isJodaDateTime(...) -> boolean
-
Signature:
@Override public boolean isJodaDateTime() - Summary: Checks if this type represents a Joda DateTime.
-
Contract:
- Checks if this type represents a Joda DateTime.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Joda DateTime type, {@code false} otherwise
isPrimitiveArray(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveArray() - Summary: Checks if this type represents a primitive array.
-
Contract:
- Checks if this type represents a primitive array.
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive array type, {@code false} otherwise
isPrimitiveByteArray(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveByteArray() - Summary: Checks if this type represents a byte array.
-
Contract:
- Checks if this type represents a byte array.
-
Parameters:
- (none)
- Returns: {@code true} if this is a byte array type, {@code false} otherwise
isObjectArray(...) -> boolean
-
Signature:
@Override public boolean isObjectArray() - Summary: Checks if this type represents an object array.
-
Contract:
- Checks if this type represents an object array.
-
Parameters:
- (none)
- Returns: {@code true} if this is an object array type, {@code false} otherwise
isArray(...) -> boolean
-
Signature:
@Override public boolean isArray() - Summary: Checks if this type represents any kind of array.
-
Contract:
- Checks if this type represents any kind of array.
-
Parameters:
- (none)
- Returns: {@code true} if this is an array type, {@code false} otherwise
isList(...) -> boolean
-
Signature:
@Override public boolean isList() - Summary: Checks if this type represents a List.
-
Contract:
- Checks if this type represents a List.
-
Parameters:
- (none)
- Returns: {@code true} if this is a List type, {@code false} otherwise
isSet(...) -> boolean
-
Signature:
@Override public boolean isSet() - Summary: Checks if this type represents a Set.
-
Contract:
- Checks if this type represents a Set.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Set type, {@code false} otherwise
isCollection(...) -> boolean
-
Signature:
@Override public boolean isCollection() - Summary: Checks if this type represents a Collection.
-
Contract:
- Checks if this type represents a Collection.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Collection type, {@code false} otherwise
isMap(...) -> boolean
-
Signature:
@Override public boolean isMap() - Summary: Checks if this type represents a Map.
-
Contract:
- Checks if this type represents a Map.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Map type, {@code false} otherwise
isBean(...) -> boolean
-
Signature:
@Override public boolean isBean() - Summary: Checks if this type represents a Bean.
-
Contract:
- Checks if this type represents a Bean.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Bean type, {@code false} otherwise
isMapEntity(...) -> boolean
-
Signature:
@Override public boolean isMapEntity() - Summary: Checks if this type represents a MapEntity.
-
Contract:
- Checks if this type represents a MapEntity.
-
Parameters:
- (none)
- Returns: {@code true} if this is a MapEntity type, {@code false} otherwise
isEntityId(...) -> boolean
-
Signature:
@Override public boolean isEntityId() - Summary: Checks if this type represents an EntityId.
-
Contract:
- Checks if this type represents an EntityId.
-
Parameters:
- (none)
- Returns: {@code true} if this is an EntityId type, {@code false} otherwise
isDataset(...) -> boolean
-
Signature:
@Override public boolean isDataset() - Summary: Checks if this type represents a Dataset.
-
Contract:
- Checks if this type represents a Dataset.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Dataset type, {@code false} otherwise
isInputStream(...) -> boolean
-
Signature:
@Override public boolean isInputStream() - Summary: Checks if this type represents an InputStream.
-
Contract:
- Checks if this type represents an InputStream.
-
Parameters:
- (none)
- Returns: {@code true} if this is an InputStream type, {@code false} otherwise
isReader(...) -> boolean
-
Signature:
@Override public boolean isReader() - Summary: Checks if this type represents a Reader.
-
Contract:
- Checks if this type represents a Reader.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Reader type, {@code false} otherwise
isByteBuffer(...) -> boolean
-
Signature:
@Override public boolean isByteBuffer() - Summary: Checks if this type represents a ByteBuffer.
-
Contract:
- Checks if this type represents a ByteBuffer.
-
Parameters:
- (none)
- Returns: {@code true} if this is a ByteBuffer type, {@code false} otherwise
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Checks if this is a generic type.
-
Contract:
- Checks if this is a generic type.
- A type is considered generic if it has type parameters.
-
Parameters:
- (none)
- Returns: {@code true} if this type has type parameters, {@code false} otherwise
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Checks if this type is immutable.
-
Contract:
- Checks if this type is immutable.
-
Parameters:
- (none)
- Returns: {@code true} if values of this type are immutable, {@code false} otherwise
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Checks if this type is comparable.
-
Contract:
- Checks if this type is comparable.
-
Parameters:
- (none)
- Returns: {@code true} if values of this type can be compared, {@code false} otherwise
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Checks if this type is serializable.
-
Contract:
- Checks if this type is serializable.
-
Parameters:
- (none)
- Returns: {@code true} if values of this type can be serialized, {@code false} otherwise
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type for this type.
-
Contract:
- Returns SERIALIZABLE if the type is serializable, otherwise UNKNOWN.
-
Parameters:
- (none)
- Returns: the serialization type
isOptionalOrNullable(...) -> boolean
-
Signature:
@Override public boolean isOptionalOrNullable() - Summary: Checks if this type is optional or {@code nullable} .
-
Contract:
- Checks if this type is optional or {@code nullable} .
-
Parameters:
- (none)
- Returns: {@code true} if this type represents optional or {@code nullable} values, {@code false} otherwise
isObjectType(...) -> boolean
-
Signature:
@Override public boolean isObjectType() - Summary: Checks if this is the Object type.
-
Contract:
- Checks if this is the Object type.
-
Parameters:
- (none)
- Returns: {@code true} if this is the Object type, {@code false} otherwise
getElementType(...) -> Type<?>
-
Signature:
@Override public Type<?> getElementType() - Summary: Gets the element type for collection/array types.
-
Parameters:
- (none)
- Returns: the element type, or {@code null} if not applicable
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Gets the parameter types for generic types.
-
Parameters:
- (none)
- Returns: array of parameter types
defaultValue(...) -> T
-
Signature:
@Override public T defaultValue() - Summary: Returns the default value for this type.
-
Parameters:
- (none)
- Returns: the default value, typically {@code null}
isDefaultValue(...) -> boolean
-
Signature:
@Override public boolean isDefaultValue(final T value) - Summary: Checks if the given value is the default value for this type.
-
Contract:
- Checks if the given value is the default value for this type.
-
Parameters:
-
value(T) — the value to check
-
- Returns: {@code true} if the value equals the default value
compare(...) -> int
-
Signature:
@SuppressWarnings("unchecked") @Override public int compare(final T x, final T y) - Summary: Compares two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: negative if x < y, zero if x equals y, positive if x > y
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final Object obj) - Summary: Converts an object to this type.
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: the converted value
-
Signature:
@Override public T valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to this type.
-
Parameters:
-
cbuf(char[]) — the character array -
offset(int) — the starting position -
len(int) — the number of characters
-
- Returns: the converted value
get(...) -> T
-
Signature:
@Override public T get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a value of this type from a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet -
columnIndex(int) — the column index (1-based)
-
- Returns: the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public T get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a value of this type from a ResultSet by column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet -
columnName(String) — the column label
-
- Returns: the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final T x) throws SQLException - Summary: Sets a parameter value in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement -
columnIndex(int) — the parameter index (1-based) -
x(T) — the value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final T x) throws SQLException - Summary: Sets a parameter value in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement -
parameterName(String) — the parameter name -
x(T) — the value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final T x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter value in a PreparedStatement with SQL type.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement -
columnIndex(int) — the parameter index (1-based) -
x(T) — the value to set -
sqlTypeOrLength(int) — the SQL type or length (ignored in default implementation)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final T x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter value in a CallableStatement with SQL type.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement -
parameterName(String) — the parameter name -
x(T) — the value to set -
sqlTypeOrLength(int) — the SQL type or length (ignored in default implementation)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a value to an Appendable.
-
Parameters:
-
appendable(Appendable) — the target to append to -
x(T) — the value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a value to a CharacterWriter with optional configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> T
-
Signature:
@Override public T collectionToArray(final Collection<?> c) - Summary: Converts a collection to an array of this type.
-
Parameters:
-
c(Collection<?>) — the collection to convert
-
- Returns: the array representation
arrayToCollection(...) -> Collection<E>
-
Signature:
@Override public <E> Collection<E> arrayToCollection(final T array, final Class<?> collClass) - Summary: Converts an array to a collection.
-
Parameters:
-
array(T) — the array to convert -
collClass(Class<?>) — the collection class to create
-
- Returns: the collection
-
Signature:
@Override public <E> void arrayToCollection(final T array, final Collection<E> output) - Summary: Converts an array to a collection by adding elements to the output collection.
-
Parameters:
-
array(T) — the array to convert -
output(Collection<E>) — the collection to add elements to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final T x) - Summary: Calculates the hash code for a value of this type.
-
Parameters:
-
x(T) — the value
-
- Returns: the hash code
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this type based on its name.
-
Parameters:
- (none)
- Returns: the hash code
deepHashCode(...) -> int
-
Signature:
@Override public int deepHashCode(final T x) - Summary: Calculates the deep hash code for a value of this type.
-
Parameters:
-
x(T) — the value
-
- Returns: the deep hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final T x, final T y) - Summary: Checks equality between two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: {@code true} if the values are equal
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this type equals another object.
-
Contract:
- Checks if this type equals another object.
- Two types are equal if they have the same name, declaring name, and class.
-
Parameters:
-
obj(Object) — the object to compare
-
- Returns: {@code true} if the objects are equal types
deepEquals(...) -> boolean
-
Signature:
@Override public boolean deepEquals(final T x, final T y) - Summary: Checks deep equality between two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: {@code true} if the values are deeply equal
toString(...) -> String
-
Signature:
@Override public String toString(final T x) - Summary: Converts a value to its string representation.
-
Parameters:
-
x(T) — the value
-
- Returns: the string representation
-
Signature:
@Override public String toString() - Summary: Returns the string representation of this type (its name).
-
Parameters:
- (none)
- Returns: the type name
deepToString(...) -> String
-
Signature:
@Override public String deepToString(final T x) - Summary: Converts a value to its deep string representation.
-
Parameters:
-
x(T) — the value
-
- Returns: the deep string representation
Class AsciiStreamType (com.landawn.abacus.type.AsciiStreamType)
Type handler for ASCII InputStream operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> InputStream
-
Signature:
@Override public InputStream get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an ASCII InputStream from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the ASCII stream from -
columnIndex(int) — the column index (1-based) of the ASCII stream
-
- Returns: an InputStream containing the ASCII data, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public InputStream get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an ASCII InputStream from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the ASCII stream from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: an InputStream containing the ASCII data, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x) throws SQLException - Summary: Sets an ASCII InputStream parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the InputStream containing ASCII data, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x) throws SQLException - Summary: Sets a named ASCII InputStream parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream containing ASCII data, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an ASCII InputStream parameter in a PreparedStatement with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the InputStream containing ASCII data, may be null -
sqlTypeOrLength(int) — the number of bytes in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a named ASCII InputStream parameter in a CallableStatement with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream containing ASCII data, may be null -
sqlTypeOrLength(int) — the number of bytes in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final InputStream x) throws IOException - Summary: Appends the content of an ASCII InputStream to an Appendable object.
-
Contract:
- If the InputStream is {@code null} , appends the string "null".
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(InputStream) — the InputStream containing ASCII data to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the read or append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final InputStream x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the content of an ASCII InputStream to a CharacterWriter with optional quotation.
-
Contract:
- This method handles {@code null} values and applies string quotation marks if specified in the configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(InputStream) — the InputStream containing ASCII data to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify string quotation preferences
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the read or write operation
-
Class AtomicBooleanType (com.landawn.abacus.type.AtomicBooleanType)
Type handler for AtomicBoolean operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<AtomicBoolean>
-
Signature:
@Override public Class<AtomicBoolean> clazz() - Summary: Returns the Class object representing the AtomicBoolean class.
-
Parameters:
- (none)
- Returns: the Class object for {@code AtomicBoolean}
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final AtomicBoolean x) - Summary: Converts an AtomicBoolean value to its string representation.
-
Parameters:
-
x(AtomicBoolean) — the AtomicBoolean value to convert
-
- Returns: "true" if the AtomicBoolean contains {@code true} , "false" if it contains {@code false} , or {@code null} if the input is null
valueOf(...) -> AtomicBoolean
-
Signature:
@Override public AtomicBoolean valueOf(final String str) - Summary: Converts a string representation to an AtomicBoolean value.
-
Parameters:
-
str(String) — the string to parse (case-insensitive "true" results in {@code true} , all else false)
-
- Returns: a new AtomicBoolean containing the parsed value, or {@code null} if str is {@code null} or empty
get(...) -> AtomicBoolean
-
Signature:
@Override public AtomicBoolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an AtomicBoolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnIndex(int) — the column index (1-based) of the boolean value
-
- Returns: a new AtomicBoolean containing the retrieved value (false if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public AtomicBoolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an AtomicBoolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: a new AtomicBoolean containing the retrieved value (false if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final AtomicBoolean x) throws SQLException - Summary: Sets an AtomicBoolean parameter in a PreparedStatement at the specified position.
-
Contract:
- If the AtomicBoolean is {@code null} , sets {@code false} as the parameter value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(AtomicBoolean) — the AtomicBoolean value to set, may be {@code null} (treated as false)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final AtomicBoolean x) throws SQLException - Summary: Sets a named AtomicBoolean parameter in a CallableStatement.
-
Contract:
- If the AtomicBoolean is {@code null} , sets {@code false} as the parameter value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(AtomicBoolean) — the AtomicBoolean value to set, may be {@code null} (treated as false)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final AtomicBoolean x) throws IOException - Summary: Appends an AtomicBoolean value to an Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(AtomicBoolean) — the AtomicBoolean value to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final AtomicBoolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes an AtomicBoolean value to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(AtomicBoolean) — the AtomicBoolean value to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for boolean values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class AtomicIntegerType (com.landawn.abacus.type.AtomicIntegerType)
Type handler for AtomicInteger operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<AtomicInteger>
-
Signature:
@Override public Class<AtomicInteger> clazz() - Summary: Returns the Class object representing the AtomicInteger class.
-
Parameters:
- (none)
- Returns: the Class object for {@code AtomicInteger}
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final AtomicInteger x) - Summary: Converts an AtomicInteger value to its string representation.
-
Parameters:
-
x(AtomicInteger) — the AtomicInteger value to convert
-
- Returns: the string representation of the integer value, or {@code null} if input is null
valueOf(...) -> AtomicInteger
-
Signature:
@Override public AtomicInteger valueOf(final String str) - Summary: Converts a string representation to an AtomicInteger value.
-
Parameters:
-
str(String) — the string to parse as an integer
-
- Returns: a new AtomicInteger containing the parsed value, or {@code null} if str is {@code null} or empty
get(...) -> AtomicInteger
-
Signature:
@Override public AtomicInteger get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an AtomicInteger value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnIndex(int) — the column index (1-based) of the integer value
-
- Returns: a new AtomicInteger containing the retrieved value (0 if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public AtomicInteger get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an AtomicInteger value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: a new AtomicInteger containing the retrieved value (0 if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final AtomicInteger x) throws SQLException - Summary: Sets an AtomicInteger parameter in a PreparedStatement at the specified position.
-
Contract:
- If the AtomicInteger is {@code null} , sets 0 as the parameter value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(AtomicInteger) — the AtomicInteger value to set, may be {@code null} (treated as 0)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final AtomicInteger x) throws SQLException - Summary: Sets a named AtomicInteger parameter in a CallableStatement.
-
Contract:
- If the AtomicInteger is {@code null} , sets 0 as the parameter value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(AtomicInteger) — the AtomicInteger value to set, may be {@code null} (treated as 0)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final AtomicInteger x) throws IOException - Summary: Appends an AtomicInteger value to an Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(AtomicInteger) — the AtomicInteger value to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final AtomicInteger x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes an AtomicInteger value to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(AtomicInteger) — the AtomicInteger value to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for integer values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class AtomicLongType (com.landawn.abacus.type.AtomicLongType)
Type handler for AtomicLong operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<AtomicLong>
-
Signature:
@Override public Class<AtomicLong> clazz() - Summary: Returns the Class object representing the AtomicLong class.
-
Parameters:
- (none)
- Returns: the Class object for {@code AtomicLong}
get(...) -> AtomicLong
-
Signature:
@Override public AtomicLong get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an AtomicLong value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnIndex(int) — the column index (1-based) of the long value
-
- Returns: a new AtomicLong containing the retrieved value (0L if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public AtomicLong get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an AtomicLong value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: a new AtomicLong containing the retrieved value (0L if SQL NULL)
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final AtomicLong x) throws SQLException - Summary: Sets an AtomicLong parameter in a PreparedStatement at the specified position.
-
Contract:
- If the AtomicLong is {@code null} , sets 0L as the parameter value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(AtomicLong) — the AtomicLong value to set, may be {@code null} (treated as 0L)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final AtomicLong x) throws SQLException - Summary: Sets a named AtomicLong parameter in a CallableStatement.
-
Contract:
- If the AtomicLong is {@code null} , sets 0L as the parameter value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(AtomicLong) — the AtomicLong value to set, may be {@code null} (treated as 0L)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final AtomicLong x) - Summary: Converts an AtomicLong value to its string representation.
-
Parameters:
-
x(AtomicLong) — the AtomicLong value to convert
-
- Returns: the string representation of the long value, or {@code null} if input is null
valueOf(...) -> AtomicLong
-
Signature:
@Override public AtomicLong valueOf(final String str) - Summary: Converts a string representation to an AtomicLong value.
-
Parameters:
-
str(String) — the string to parse as a long
-
- Returns: a new AtomicLong containing the parsed value, or {@code null} if str is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final AtomicLong x) throws IOException - Summary: Appends an AtomicLong value to an Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(AtomicLong) — the AtomicLong value to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final AtomicLong x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes an AtomicLong value to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(AtomicLong) — the AtomicLong value to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for long values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class BSONObjectIdType (com.landawn.abacus.type.BSONObjectIdType)
Type handler for BSON ObjectId operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<ObjectId>
-
Signature:
@Override public Class<ObjectId> clazz() - Summary: Returns the Class object representing the ObjectId class.
-
Parameters:
- (none)
- Returns: the Class object for org.bson.types.ObjectId
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ObjectId x) - Summary: Converts an ObjectId to its hexadecimal string representation.
-
Parameters:
-
x(ObjectId) — the ObjectId to convert
-
- Returns: the 24-character hexadecimal string representation of the ObjectId, or {@code null} if the input is null
valueOf(...) -> ObjectId
-
Signature:
@Override public ObjectId valueOf(final String str) - Summary: Converts a hexadecimal string representation to an ObjectId.
-
Parameters:
-
str(String) — the hexadecimal string to parse (must be 24 characters)
-
- Returns: a new ObjectId created from the hexadecimal string, or {@code null} if str is {@code null} or empty
Class Base64EncodedType (com.landawn.abacus.type.Base64EncodedType)
Type handler for Base64-encoded byte arrays.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<byte\[\]>
-
Signature:
@Override public Class<byte[]> clazz() - Summary: Returns the Class object representing the byte array class.
-
Parameters:
- (none)
- Returns: the Class object for byte\[\].class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final byte[] x) - Summary: Converts a byte array to its Base64-encoded string representation.
-
Parameters:
-
x(byte[]) — the byte array to encode
-
- Returns: the Base64-encoded string representation of the byte array, or an empty string if the input is null
valueOf(...) -> byte\[\]
-
Signature:
@Override public byte[] valueOf(final String base64String) - Summary: Converts a Base64-encoded string back to its original byte array.
-
Parameters:
-
base64String(String) — the Base64-encoded string to decode
-
- Returns: the decoded byte array, or an empty byte array if the input is null
Class BeanType (com.landawn.abacus.type.BeanType)
Type handler for JavaBean objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the bean type.
-
Parameters:
- (none)
- Returns: the Class object for the specific bean type T
javaType(...) -> java.lang.reflect.Type
-
Signature:
@Override public java.lang.reflect.Type javaType() - Summary: Returns the Java Type representation of the bean type.
-
Parameters:
- (none)
- Returns: the Java Type for the specific bean type T
isBean(...) -> boolean
-
Signature:
@Override public boolean isBean() - Summary: Determines whether this type represents a JavaBean.
-
Parameters:
- (none)
- Returns: {@code true} indicating this is a bean type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Determines whether this bean type is directly serializable.
-
Parameters:
- (none)
- Returns: {@code false} indicating beans are not directly serializable
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type classification for this bean type.
-
Parameters:
- (none)
- Returns: SerializationType.ENTITY indicating this is an entity type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a bean instance to its JSON string representation.
-
Parameters:
-
x(T) — the bean instance to serialize
-
- Returns: the JSON string representation of the bean, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a JSON string representation back to a bean instance.
-
Parameters:
-
str(String) — the JSON string to deserialize
-
- Returns: a new instance of the bean type populated from the JSON data, or {@code null} if the input string is {@code null} or empty
Class BigDecimalType (com.landawn.abacus.type.BigDecimalType)
Type handler for BigDecimal operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<BigDecimal>
-
Signature:
@Override public Class<BigDecimal> clazz() - Summary: Returns the Class object representing the BigDecimal class.
-
Parameters:
- (none)
- Returns: the Class object for BigDecimal.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final BigDecimal x) - Summary: Converts a BigDecimal value to its string representation.
-
Parameters:
-
x(BigDecimal) — the BigDecimal value to convert, may be {@code null}
-
- Returns: the string representation of the BigDecimal, or {@code null} if input is {@code null}
valueOf(...) -> BigDecimal
-
Signature:
@Override public BigDecimal valueOf(final String str) - Summary: Converts a string representation to a BigDecimal value.
-
Parameters:
-
str(String) — the string to parse as a BigDecimal, may be {@code null}
-
- Returns: a new BigDecimal parsed from the string with unlimited precision, or {@code null} if str is {@code null} or empty
-
Signature:
@Override public BigDecimal valueOf(final char[] cbuf, final int offset, final int len) - Summary: Creates a BigDecimal from a character array subset.
-
Parameters:
-
cbuf(char[]) — the character array containing the digits, must not be {@code null} -
offset(int) — the starting position in the character array (0-based) -
len(int) — the number of characters to use
-
- Returns: a new BigDecimal created from the specified characters with unlimited precision, or {@code null} if len is 0
get(...) -> BigDecimal
-
Signature:
@Override public BigDecimal get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a BigDecimal value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from, must not be {@code null} -
columnIndex(int) — the column index (1-based) of the BigDecimal value
-
- Returns: the BigDecimal value at the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public BigDecimal get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a BigDecimal value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from, must not be {@code null} -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified, must not be {@code null}
-
- Returns: the BigDecimal value in the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final BigDecimal x) throws SQLException - Summary: Sets a BigDecimal parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on, must not be {@code null} -
columnIndex(int) — the parameter index (1-based) to set -
x(BigDecimal) — the BigDecimal value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final BigDecimal x) throws SQLException - Summary: Sets a named BigDecimal parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on, must not be {@code null} -
parameterName(String) — the name of the parameter to set, must not be {@code null} -
x(BigDecimal) — the BigDecimal value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final BigDecimal x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a BigDecimal value to a CharacterWriter with optional plain string formatting.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to, must not be {@code null} -
x(BigDecimal) — the BigDecimal value to write, may be {@code null} -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify to write BigDecimal values in plain format (without scientific notation), may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class BigIntegerType (com.landawn.abacus.type.BigIntegerType)
Type handler for BigInteger operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<BigInteger>
-
Signature:
@Override public Class<BigInteger> clazz() - Summary: Returns the Class object representing the BigInteger class.
-
Parameters:
- (none)
- Returns: the Class object for BigInteger.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final BigInteger x) - Summary: Converts a BigInteger value to its string representation in base 10.
-
Parameters:
-
x(BigInteger) — the BigInteger value to convert
-
- Returns: the string representation of the BigInteger in decimal format, or {@code null} if input is null
valueOf(...) -> BigInteger
-
Signature:
@Override public BigInteger valueOf(final String str) - Summary: Converts a string representation to a BigInteger value.
-
Parameters:
-
str(String) — the string to parse as a BigInteger in decimal format
-
- Returns: a new BigInteger parsed from the string, or {@code null} if str is {@code null} or empty
get(...) -> BigInteger
-
Signature:
@Override public BigInteger get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a BigInteger value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the BigInteger value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public BigInteger get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a BigInteger value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the BigInteger value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final BigInteger x) throws SQLException - Summary: Sets a BigInteger parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on, must not be {@code null} -
columnIndex(int) — the parameter index (1-based) to set -
x(BigInteger) — the BigInteger value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final BigInteger x) throws SQLException - Summary: Sets a named BigInteger parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on, must not be {@code null} -
parameterName(String) — the name of the parameter to set, must not be {@code null} -
x(BigInteger) — the BigInteger value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class BinaryStreamType (com.landawn.abacus.type.BinaryStreamType)
Type handler for binary InputStream operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class BlobInputStreamType (com.landawn.abacus.type.BlobInputStreamType)
Type handler for BLOB (Binary Large Object) InputStream operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> InputStream
-
Signature:
@Override public InputStream get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a BLOB as an InputStream from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the BLOB from -
columnIndex(int) — the column index (1-based) of the BLOB value
-
- Returns: an InputStream for reading the BLOB data, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public InputStream get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a BLOB as an InputStream from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the BLOB from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: an InputStream for reading the BLOB data, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x) throws SQLException - Summary: Sets an InputStream as a BLOB parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the InputStream containing the binary data for the BLOB, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x) throws SQLException - Summary: Sets a named InputStream as a BLOB parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream containing the binary data for the BLOB, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an InputStream as a BLOB parameter in a PreparedStatement with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the InputStream containing the binary data for the BLOB, may be null -
sqlTypeOrLength(int) — the number of bytes in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a named InputStream as a BLOB parameter in a CallableStatement with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream containing the binary data for the BLOB, may be null -
sqlTypeOrLength(int) — the number of bytes in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class BlobType (com.landawn.abacus.type.BlobType)
Type handler for SQL Blob (Binary Large Object) operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Blob>
-
Signature:
@Override public Class<Blob> clazz() - Summary: Returns the Class object representing the Blob interface.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.Blob
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Blob x) throws UnsupportedOperationException - Summary: String conversion is not supported for Blob types.
-
Parameters:
-
x(Blob) — the Blob value (ignored)
-
- Returns: never returns, always throws exception
-
Throws:
-
java.lang.UnsupportedOperationException— always, as Blobs cannot be converted to strings
-
valueOf(...) -> Blob
-
Signature:
@Override public Blob valueOf(final String str) throws UnsupportedOperationException - Summary: String parsing is not supported for Blob types.
-
Parameters:
-
str(String) — the string value (ignored)
-
- Returns: never returns, always throws exception
-
Throws:
-
java.lang.UnsupportedOperationException— always, as Blobs cannot be created from strings
-
get(...) -> Blob
-
Signature:
@Override public Blob get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Blob value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the Blob from -
columnIndex(int) — the column index (1-based) of the Blob value
-
- Returns: the Blob object at the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Blob get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Blob value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the Blob from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: the Blob object in the specified column, or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Blob x) throws SQLException - Summary: Sets a Blob parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Blob) — the Blob value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Blob x) throws SQLException - Summary: Sets a named Blob parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Blob) — the Blob value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class BooleanArrayType (com.landawn.abacus.type.BooleanArrayType)
Type handler for Boolean array operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Boolean[] x) - Summary: Converts a Boolean array to its string representation.
-
Parameters:
-
x(Boolean[]) — the Boolean array to convert
-
- Returns: a string representation like "\[true, false, null\]", or {@code null} if input is {@code null} , or "\[\]" if the array is empty
valueOf(...) -> Boolean\[\]
-
Signature:
@Override public Boolean[] valueOf(final String str) - Summary: Converts a string representation back to a Boolean array.
-
Parameters:
-
str(String) — the string to parse, expecting format like "\[true, false, null\]"
-
- Returns: a Boolean array parsed from the string, or {@code null} if str is {@code null} , or an empty array if str is empty or equals "\[\]"
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Boolean[] x) throws IOException - Summary: Appends a Boolean array to an Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(Boolean[]) — the Boolean array to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Boolean[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Boolean array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Boolean[]) — the Boolean array to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for boolean arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class BooleanCharType (com.landawn.abacus.type.BooleanCharType)
Type handler for Boolean values represented as single characters.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Boolean>
-
Signature:
@Override public Class<Boolean> clazz() - Summary: Returns the Class object representing the Boolean class.
-
Parameters:
- (none)
- Returns: the Class object for Boolean.class
defaultValue(...) -> Boolean
-
Signature:
@Override public Boolean defaultValue() - Summary: Returns the default value for this type.
-
Parameters:
- (none)
- Returns: {@code Boolean.FALSE}
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Determines whether this type should be quoted in CSV format.
-
Contract:
- Determines whether this type should be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} indicating that <i> Y'/'N </i> values should not be quoted in CSV format
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Boolean b) - Summary: Converts a Boolean value to its character string representation.
-
Parameters:
-
b(Boolean) — the Boolean value to convert
-
- Returns: "Y" if b is {@code true} , "N" if b is {@code false} or null
valueOf(...) -> Boolean
-
Signature:
@Override public Boolean valueOf(final String str) - Summary: Converts a string representation to a Boolean value.
-
Parameters:
-
str(String) — the string to parse (typically "Y" or "N")
-
- Returns: Boolean.TRUE if str equals "Y" (case-insensitive), Boolean.FALSE otherwise
-
Signature:
@Override public Boolean valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array subset to a Boolean value.
-
Contract:
- Checks if the single character is 'Y' or 'y' for {@code true} .
-
Parameters:
-
cbuf(char[]) — the character array containing the character -
offset(int) — the starting position in the character array -
len(int) — the number of characters to examine (should be 1)
-
- Returns: Boolean.TRUE if the single character is 'Y' or 'y', Boolean.FALSE otherwise
get(...) -> Boolean
-
Signature:
@Override public Boolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Boolean value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Boolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Boolean value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Boolean x) throws SQLException - Summary: Sets a Boolean parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on, must not be {@code null} -
columnIndex(int) — the parameter index (1-based) to set -
x(Boolean) — the Boolean value to set, may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Boolean x) throws SQLException - Summary: Sets a named Boolean parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Boolean) — the Boolean value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Boolean x) throws IOException - Summary: Appends a Boolean value to an Appendable object as a Y/N character.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(Boolean) — the Boolean value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Boolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Boolean value to a CharacterWriter as a Y/N character.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Boolean) — the Boolean value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify character quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class BooleanIntType (com.landawn.abacus.type.BooleanIntType)
Type handler for Boolean values represented as integers.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Boolean>
-
Signature:
@Override public Class<Boolean> clazz() - Summary: Returns the Class object representing the Boolean class.
-
Parameters:
- (none)
- Returns: the Class object for Boolean.class
defaultValue(...) -> Boolean
-
Signature:
@Override public Boolean defaultValue() - Summary: Returns the default value for the BooleanInt type.
-
Parameters:
- (none)
- Returns: Boolean.FALSE as the default value
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Determines whether this type should be quoted in CSV format.
-
Contract:
- Determines whether this type should be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} indicating that 0/1 values should not be quoted in CSV format
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Boolean b) - Summary: Converts a Boolean value to its integer string representation.
-
Parameters:
-
b(Boolean) — the Boolean value to convert
-
- Returns: "1" if b is {@code true} , "0" if b is {@code false} or null
valueOf(...) -> Boolean
-
Signature:
@Override public Boolean valueOf(final String str) - Summary: Converts a string representation to a Boolean value.
-
Parameters:
-
str(String) — the string to parse (typically "0" or "1")
-
- Returns: Boolean.TRUE if str equals "1", Boolean.FALSE otherwise
-
Signature:
@Override public Boolean valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array subset to a Boolean value.
-
Contract:
- Checks if the single character is '1' for {@code true} .
-
Parameters:
-
cbuf(char[]) — the character array containing the character -
offset(int) — the starting position in the character array -
len(int) — the number of characters to examine (should be 1)
-
- Returns: Boolean.TRUE if the single character is '1', Boolean.FALSE otherwise
get(...) -> Boolean
-
Signature:
@Override public Boolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnIndex(int) — the column index (1-based) of the integer value
-
- Returns: Boolean.TRUE if the integer value is greater than 0, Boolean.FALSE otherwise
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Boolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: Boolean.TRUE if the integer value is greater than 0, Boolean.FALSE otherwise
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Boolean x) throws SQLException - Summary: Sets a Boolean parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Boolean) — the Boolean value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Boolean x) throws SQLException - Summary: Sets a named Boolean parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Boolean) — the Boolean value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Boolean x) throws IOException - Summary: Appends a Boolean value to an Appendable object as a 0/1 character.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(Boolean) — the Boolean value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Boolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Boolean value to a CharacterWriter as a 0/1 character.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Boolean) — the Boolean value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify character quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class BooleanType (com.landawn.abacus.type.BooleanType)
Type handler for Boolean (wrapper class) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Boolean>
-
Signature:
@Override public Class<Boolean> clazz() - Summary: Returns the Class object representing the Boolean class.
-
Parameters:
- (none)
- Returns: the Class object for Boolean.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Boolean is a primitive wrapper
get(...) -> Boolean
-
Signature:
@Override public Boolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Boolean value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Boolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Boolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Boolean value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class ByteArrayType (com.landawn.abacus.type.ByteArrayType)
Type handler for Byte array operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Byte[] x) - Summary: Converts a Byte array to its string representation.
-
Parameters:
-
x(Byte[]) — the Byte array to convert
-
- Returns: a string representation like "\[1, 2, null\]", or {@code null} if input is {@code null} , or "\[\]" if the array is empty
valueOf(...) -> Byte\[\]
-
Signature:
@Override public Byte[] valueOf(final String str) - Summary: Converts a string representation back to a Byte array.
-
Parameters:
-
str(String) — the string to parse, expecting format like "\[1, 2, null\]"
-
- Returns: a Byte array parsed from the string, or {@code null} if str is {@code null} , or an empty array if str is empty or equals "\[\]"
get(...) -> Byte\[\]
-
Signature:
@Override public Byte[] get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Byte array from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnIndex(int) — the column index (1-based) of the byte array
-
- Returns: a Byte array boxed from the database byte\[\], or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Byte[] get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Byte array from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to retrieve the value from -
columnName(String) — the label for the column specified with the SQL AS clause, or the column name if no AS clause was specified
-
- Returns: a Byte array boxed from the database byte\[\], or {@code null} if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Byte[] x) throws SQLException - Summary: Sets a Byte array parameter in a PreparedStatement at the specified position.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Byte[]) — the Byte array to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Byte[] x) throws SQLException - Summary: Sets a named Byte array parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Byte[]) — the Byte array to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Byte[] x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a Byte array parameter in a PreparedStatement with additional SQL type information.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Byte[]) — the Byte array to set, may be null -
sqlTypeOrLength(int) — the SQL type code (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Byte[] x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a named Byte array parameter in a CallableStatement with additional SQL type information.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Byte[]) — the Byte array to set, may be null -
sqlTypeOrLength(int) — the SQL type code (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Byte[] x) throws IOException - Summary: Appends a Byte array to an Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to append to -
x(Byte[]) — the Byte array to append, may be null
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Byte[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Byte array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Byte[]) — the Byte array to write, may be null -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for byte arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class ByteBufferType (com.landawn.abacus.type.ByteBufferType)
Type handler for ByteBuffer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
byteArrayOf(...) -> byte\[\]
-
Signature:
public static byte[] byteArrayOf(final ByteBuffer x) - Summary: Extracts the content of a ByteBuffer as a byte array.
-
Parameters:
-
x(ByteBuffer) — the ByteBuffer to extract bytes from
-
- Returns: a byte array containing the buffer's content from 0 to current position
valueOf(...) -> ByteBuffer
-
Signature:
public static ByteBuffer valueOf(final byte[] bytes) - Summary: Creates a ByteBuffer from a byte array.
-
Parameters:
-
bytes(byte[]) — the byte array to wrap in a ByteBuffer
-
- Returns: a ByteBuffer wrapping the input array with position at the end
Public Instance Methods
clazz(...) -> Class<ByteBuffer>
-
Signature:
@Override public Class<ByteBuffer> clazz() - Summary: Returns the Class object representing the ByteBuffer class.
-
Parameters:
- (none)
- Returns: the Class object for java.nio.ByteBuffer
isByteBuffer(...) -> boolean
-
Signature:
@Override public boolean isByteBuffer() - Summary: Determines whether this type represents a ByteBuffer.
-
Parameters:
- (none)
- Returns: {@code true} indicating this is a byte buffer type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ByteBuffer x) - Summary: Converts a ByteBuffer to its Base64-encoded string representation.
-
Parameters:
-
x(ByteBuffer) — the ByteBuffer to encode
-
- Returns: the Base64-encoded string representation of the buffer's content, or {@code null} if the input is null
valueOf(...) -> ByteBuffer
-
Signature:
@Override public ByteBuffer valueOf(final String str) - Summary: Converts a Base64-encoded string back to a ByteBuffer.
-
Parameters:
-
str(String) — the Base64-encoded string to decode
-
- Returns: a ByteBuffer containing the decoded data, or {@code null} if str is {@code null} , or an empty buffer if str is empty
Class ByteType (com.landawn.abacus.type.ByteType)
Type handler for Byte (wrapper class) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Byte class.
-
Parameters:
- (none)
- Returns: the Class object for Byte.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Byte is a primitive wrapper
get(...) -> Byte
-
Signature:
@Override public Byte get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Byte value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Byte value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Byte get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Byte value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Byte value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class BytesType (com.landawn.abacus.type.BytesType)
Type handler for byte array (byte\[\]) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<byte\[\]>
-
Signature:
@Override public Class<byte[]> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing byte\[\].class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final byte[] x) - Summary: Converts a byte array to its string representation using Base64 encoding.
-
Parameters:
-
x(byte[]) — the byte array to convert. Can be {@code null} .
-
- Returns: A Base64 encoded string representation of the byte array, or {@code null} if the input is null
valueOf(...) -> byte\[\]
-
Signature:
@Override public byte[] valueOf(final String str) - Summary: Converts a Base64 encoded string back to a byte array.
-
Parameters:
-
str(String) — the Base64 encoded string to convert. Can be {@code null} .
-
- Returns: The decoded byte array, or {@code null} if the input string is null
get(...) -> byte\[\]
-
Signature:
@Override public byte[] get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a byte array value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the byte array value
-
- Returns: The byte array value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public byte[] get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a byte array value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the byte array value
-
- Returns: The byte array value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final byte[] x) throws SQLException - Summary: Sets a byte array value as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(byte[]) — the byte array value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final byte[] x) throws SQLException - Summary: Sets a byte array value as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(byte[]) — the byte array value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class CalendarType (com.landawn.abacus.type.CalendarType)
Type handler for Calendar values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Calendar>
-
Signature:
@Override public Class<Calendar> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing Calendar.class
valueOf(...) -> Calendar
-
Signature:
@Override public Calendar valueOf(final Object obj) - Summary: Converts various object types to a Calendar instance.
-
Parameters:
-
obj(Object) — the object to convert to Calendar. Can be {@code null} .
-
- Returns: A Calendar instance representing the input value, or {@code null} if input is null
-
Signature:
@Override public Calendar valueOf(final String str) - Summary: Converts a string representation to a Calendar instance.
-
Parameters:
-
str(String) — the string to parse. Can be {@code null} or empty.
-
- Returns: A Calendar instance parsed from the string, or {@code null} if input is null/empty
-
Signature:
@Override public Calendar valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a Calendar instance.
-
Contract:
- If the character array appears to represent a numeric value (timestamp), it attempts to parse it as milliseconds since epoch.
-
Parameters:
-
cbuf(char[]) — the character array containing the value to parse -
offset(int) — the starting position in the character array -
len(int) — the number of characters to use
-
- Returns: A Calendar instance parsed from the character array, or {@code null} if input is {@code null} or empty
get(...) -> Calendar
-
Signature:
@Override public Calendar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Calendar value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the timestamp value
-
- Returns: A Calendar instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Calendar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Calendar value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the timestamp value
-
- Returns: A Calendar instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
Class CharacterArrayType (com.landawn.abacus.type.CharacterArrayType)
Type handler for Character array (Character\[\]) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Character[] x) - Summary: Converts a Character array to its string representation.
-
Parameters:
-
x(Character[]) — the Character array to convert. Can be {@code null} .
-
- Returns: A string representation of the array with quoted characters, or {@code null} if input is null
valueOf(...) -> Character\[\]
-
Signature:
@Override public Character[] valueOf(final String str) - Summary: Converts a string representation back to a Character array.
-
Parameters:
-
str(String) — the string to parse. Can be {@code null} .
-
- Returns: A Character array parsed from the string, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Character[] x) throws IOException - Summary: Appends a Character array to an Appendable output.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Character[]) — the Character array to append. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Character[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Character array to a CharacterWriter with optional quotation based on configuration.
-
Contract:
- The output format is: \[element1, element2, ...\] - If quotation is configured, characters are wrapped in the specified quote character - Single quotes within characters are escaped when using single quote quotation - Null elements are always represented as "null" without quotes
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Character[]) — the Character array to write. Can be {@code null} . -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that specifies quotation settings. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
toString(...) -> String
-
Signature:
@Override public String toString(final Character[] x) - Summary: Converts a Character array to a string representation using standard array formatting.
-
Parameters:
-
x(Character[]) — the Character array to convert. Can be {@code null} .
-
- Returns: A string representation of the array, or {@code null} if input is null
Class CharacterStreamType (com.landawn.abacus.type.CharacterStreamType)
Type handler for character stream values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class CharacterType (com.landawn.abacus.type.CharacterType)
Type handler for Character (wrapper class) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Character>
-
Signature:
@Override public Class<Character> clazz() - Summary: Returns the Class object representing the Character class.
-
Parameters:
- (none)
- Returns: the Class object for Character.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Character is a primitive wrapper
get(...) -> Character
-
Signature:
@Override public Character get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Character value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the first character of the string value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Character get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Character value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the first character of the string value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class ClazzType (com.landawn.abacus.type.ClazzType)
Type handler for Class objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Class>
-
Signature:
@Override public Class<Class> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object loaded from the type name provided in constructor
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this type are immutable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Class objects are immutable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Class x) - Summary: Converts a Class object to its string representation.
-
Parameters:
-
x(Class) — the Class object to convert. Can be {@code null} .
-
- Returns: The canonical name of the class, or {@code null} if input is null
valueOf(...) -> Class
-
Signature:
@Override public Class valueOf(final String str) - Summary: Converts a string representation back to a Class object.
-
Contract:
- The string should be a fully qualified class name.
-
Parameters:
-
str(String) — the fully qualified class name. Can be {@code null} or empty.
-
- Returns: The Class object for the specified name, or {@code null} if input is null/empty
Class ClobAsciiStreamType (com.landawn.abacus.type.ClobAsciiStreamType)
Type handler for CLOB ASCII stream values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> InputStream
-
Signature:
@Override public InputStream get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a CLOB value as an ASCII InputStream from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the CLOB value
-
- Returns: An InputStream containing the ASCII representation of the CLOB, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public InputStream get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a CLOB value as an ASCII InputStream from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the CLOB value
-
- Returns: An InputStream containing the ASCII representation of the CLOB, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x) throws SQLException - Summary: Sets an ASCII InputStream as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the ASCII InputStream to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x) throws SQLException - Summary: Sets an ASCII InputStream as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the ASCII InputStream to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an ASCII InputStream as a parameter in a PreparedStatement with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(InputStream) — the ASCII InputStream to set. Can be {@code null} . -
sqlTypeOrLength(int) — the length of the stream in bytes
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an ASCII InputStream as a named parameter in a CallableStatement with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the ASCII InputStream to set. Can be {@code null} . -
sqlTypeOrLength(int) — the length of the stream in bytes
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final InputStream x) throws IOException - Summary: Appends the contents of an ASCII InputStream to an Appendable output.
-
Contract:
- If the Appendable is a Writer, data is streamed directly for efficiency.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(InputStream) — the ASCII InputStream to append. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final InputStream x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the contents of an ASCII InputStream to a CharacterWriter.
-
Contract:
- If serialization config specifies string quotation, the content is wrapped in quotes.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(InputStream) — the ASCII InputStream to write. Can be {@code null} . -
config(JsonXmlSerializationConfig<?>) — the serialization configuration for quotation settings. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or writing
-
Class ClobReaderType (com.landawn.abacus.type.ClobReaderType)
Type handler for CLOB character stream values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Reader
-
Signature:
@Override public Reader get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a CLOB value as a character Reader from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the CLOB value
-
- Returns: A Reader containing the character stream of the CLOB, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Reader get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a CLOB value as a character Reader from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the CLOB value
-
- Returns: A Reader containing the character stream of the CLOB, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x) throws SQLException - Summary: Sets a Reader as a CLOB parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the character data. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x) throws SQLException - Summary: Sets a Reader as a named CLOB parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the character data. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a Reader as a CLOB parameter in a PreparedStatement with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the character data. Can be {@code null} . -
sqlTypeOrLength(int) — the number of characters to read from the Reader
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a Reader as a named CLOB parameter in a CallableStatement with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the character data. Can be {@code null} . -
sqlTypeOrLength(int) — the number of characters to read from the Reader
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class ClobType (com.landawn.abacus.type.ClobType)
Type handler for CLOB (Character Large Object) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Clob>
-
Signature:
@Override public Class<Clob> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing Clob.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Clob x) - Summary: Converts a CLOB object to its string representation by extracting the complete character content.
-
Parameters:
-
x(Clob) — the CLOB object to convert. Can be {@code null} .
-
- Returns: The complete character content of the CLOB as a String, or {@code null} if input is null
valueOf(...) -> Clob
-
Signature:
@Override public Clob valueOf(final String str) throws UnsupportedOperationException - Summary: String deserialization is not supported for CLOB objects.
-
Contract:
- CLOBs are database-specific objects that must be created through JDBC.
-
Parameters:
-
str(String) — the string value (parameter is ignored)
-
- Returns: Never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as this operation is not supported
-
get(...) -> Clob
-
Signature:
@Override public Clob get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a CLOB value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the CLOB value
-
- Returns: The CLOB object at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Clob get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a CLOB value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the CLOB value
-
- Returns: The CLOB object in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Clob x) throws SQLException - Summary: Sets a CLOB value as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(Clob) — the CLOB object to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Clob x) throws SQLException - Summary: Sets a CLOB value as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(Clob) — the CLOB object to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class CollectionType (com.landawn.abacus.type.CollectionType)
Type handler for Collection implementations including List, Set, Queue and their concrete implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this collection type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "List < String > " instead of "java.util.List < java.lang.String > ")
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the collection type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for the collection type
getElementType(...) -> Type<E>
-
Signature:
@Override public Type<E> getElementType() - Summary: Returns the type handler for the elements contained in this collection.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this collection
getParameterTypes(...) -> Type<E>\[\]
-
Signature:
@Override public Type<E>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic collection type.
-
Parameters:
- (none)
- Returns: an array containing the element type as the only parameter type
isList(...) -> boolean
-
Signature:
@Override public boolean isList() - Summary: Checks whether this collection type represents a List or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} if this type represents a List, {@code false} otherwise
isSet(...) -> boolean
-
Signature:
@Override public boolean isSet() - Summary: Checks whether this collection type represents a Set or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} if this type represents a Set, {@code false} otherwise
isCollection(...) -> boolean
-
Signature:
@Override public boolean isCollection() - Summary: Always returns {@code true} as this type handler specifically handles Collection types.
-
Parameters:
- (none)
- Returns: true
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Always returns {@code true} as collection types are parameterized with an element type.
-
Parameters:
- (none)
- Returns: true
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Checks whether the elements of this collection type are serializable.
-
Contract:
- The collection itself is considered serializable if its element type is serializable.
-
Parameters:
- (none)
- Returns: {@code true} if the element type is serializable, {@code false} otherwise
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type category for this collection.
-
Contract:
- If the element type is serializable, returns SERIALIZABLE; otherwise returns COLLECTION.
-
Parameters:
- (none)
- Returns: SerializationType.SERIALIZABLE if elements are serializable, SerializationType.COLLECTION otherwise
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a collection to its string representation.
-
Contract:
- If the collection is {@code null} , returns {@code null} .
- If the collection is empty, returns "\[\]".
-
Parameters:
-
x(T) — the collection to convert to string
-
- Returns: the string representation of the collection, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a string representation back to a collection instance.
-
Contract:
- The string should be in JSON array format.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a new collection instance containing the parsed elements, or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a collection to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T) — the collection to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a collection to a CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the collection to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class CurrencyType (com.landawn.abacus.type.CurrencyType)
Type handler for Currency values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Currency>
-
Signature:
@Override public Class<Currency> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing Currency.class
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this type are immutable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Currency objects are immutable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Currency x) - Summary: Converts a Currency object to its string representation.
-
Parameters:
-
x(Currency) — the Currency object to convert. Can be {@code null} .
-
- Returns: The ISO 4217 currency code (e.g., "USD"), or {@code null} if input is null
valueOf(...) -> Currency
-
Signature:
@Override public Currency valueOf(final String str) - Summary: Parses a string representation to create a Currency instance.
-
Contract:
- The string should be a valid ISO 4217 currency code.
-
Parameters:
-
str(String) — the ISO 4217 currency code. Can be {@code null} or empty.
-
- Returns: The Currency instance for the specified code, or {@code null} if input is null/empty
Class DatasetType (com.landawn.abacus.type.DatasetType)
Type handler for Dataset values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Dataset>
-
Signature:
@Override public Class<Dataset> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing Dataset.class
isDataset(...) -> boolean
-
Signature:
@Override public boolean isDataset() - Summary: Indicates whether this type represents a Dataset.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler specifically handles Dataset objects
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this Dataset type is serializable in the type system.
-
Parameters:
- (none)
- Returns: {@code false} , indicating Datasets are not simply serializable
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type category for Dataset objects.
-
Parameters:
- (none)
- Returns: SerializationType.DATA_SET, indicating special Dataset serialization handling
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Dataset x) - Summary: Converts a Dataset to its JSON string representation.
-
Parameters:
-
x(Dataset) — the Dataset to convert. Can be {@code null} .
-
- Returns: A JSON string representation of the Dataset, or {@code null} if input is null
valueOf(...) -> Dataset
-
Signature:
@Override public Dataset valueOf(final String str) - Summary: Converts a JSON string representation back to a Dataset object.
-
Contract:
- The string should contain a valid JSON representation of a Dataset with its structure and data.
-
Parameters:
-
str(String) — the JSON string to parse. Can be {@code null} or empty.
-
- Returns: A Dataset parsed from the JSON string, or {@code null} if input is null/empty
Class DateType (com.landawn.abacus.type.DateType)
Type handler for java.sql.Date values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Date>
-
Signature:
@Override public Class<Date> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing java.sql.Date.class
valueOf(...) -> Date
-
Signature:
@Override public Date valueOf(final Object obj) - Summary: Converts various object types to a SQL Date instance.
-
Parameters:
-
obj(Object) — the object to convert to SQL Date. Can be {@code null} .
-
- Returns: A SQL Date instance representing the input value, or {@code null} if input is null
-
Signature:
@Override public Date valueOf(final String str) - Summary: Converts a string representation to a SQL Date instance.
-
Parameters:
-
str(String) — the string to parse. Can be {@code null} or empty.
-
- Returns: A SQL Date instance parsed from the string, or {@code null} if input is null/empty
-
Signature:
@Override public Date valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a SQL Date instance.
-
Contract:
- If the character array appears to represent a numeric value (timestamp), it attempts to parse it as milliseconds since epoch.
-
Parameters:
-
cbuf(char[]) — the character array containing the value to parse -
offset(int) — the starting position in the character array -
len(int) — the number of characters to use
-
- Returns: A SQL Date instance parsed from the character array, or {@code null} if input is {@code null} or empty
get(...) -> Date
-
Signature:
@Override public Date get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a SQL Date value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Date> dateType = TypeFactory.getType(Date.class); try (ResultSet rs = stmt.executeQuery("SELECT created_date FROM users")) { if (rs.next()) { Date createdDate = dateType.get(rs, 1); // retrieves date from column 1 } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the date value
-
- Returns: A SQL Date instance from the result set, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Date get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a SQL Date value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Date> dateType = TypeFactory.getType(Date.class); try (ResultSet rs = stmt.executeQuery("SELECT created_date FROM users")) { if (rs.next()) { Date createdDate = dateType.get(rs, "created_date"); // retrieves by column name } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the date value
-
- Returns: A SQL Date instance from the result set, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Date x) throws SQLException - Summary: Sets a SQL Date value as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(Date) — the SQL Date value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Date x) throws SQLException - Summary: Sets a SQL Date value as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(Date) — the SQL Date value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class DoubleArrayType (com.landawn.abacus.type.DoubleArrayType)
Type handler for Double array (Double\[\]) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Double[] x) - Summary: Converts a Double array to its string representation.
-
Parameters:
-
x(Double[]) — the Double array to convert. Can be {@code null} .
-
- Returns: A string representation of the array, or {@code null} if input is null
valueOf(...) -> Double\[\]
-
Signature:
@Override public Double[] valueOf(final String str) - Summary: Converts a string representation back to a Double array.
-
Parameters:
-
str(String) — the string to parse. Can be {@code null} .
-
- Returns: A Double array parsed from the string, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Double[] x) throws IOException - Summary: Appends a Double array to an Appendable output.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Double[]) — the Double array to append. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Double[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Double array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Double[]) — the Double array to write. Can be {@code null} . -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for Double arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class DoubleType (com.landawn.abacus.type.DoubleType)
Type handler for Double (wrapper class) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Double class.
-
Parameters:
- (none)
- Returns: the Class object for Double.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Double is a primitive wrapper
get(...) -> Double
-
Signature:
@Override public Double get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Double value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Double value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Double get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Double value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Double value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class DurationType (com.landawn.abacus.type.DurationType)
Type handler for Duration values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether Duration values are comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Duration values are comparable
clazz(...) -> Class<Duration>
-
Signature:
@Override public Class<Duration> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing Duration.class
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be quoted in CSV format.
-
Contract:
- Indicates whether this type should be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Duration values should not be quoted in CSV
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Duration x) - Summary: Converts a Duration to its string representation.
-
Parameters:
-
x(Duration) — the Duration to convert. Can be {@code null} .
-
- Returns: A string containing the milliseconds value, or {@code null} if input is null
valueOf(...) -> Duration
-
Signature:
@Override public Duration valueOf(final String str) - Summary: Converts a string representation back to a Duration.
-
Contract:
- The string should contain a numeric value representing milliseconds.
-
Parameters:
-
str(String) — the string containing milliseconds value. Can be {@code null} or empty.
-
- Returns: A Duration created from the milliseconds value, or {@code null} if input is null/empty
get(...) -> Duration
-
Signature:
@Override public Duration get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Duration value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the duration value
-
- Returns: A Duration created from the milliseconds value in the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Duration get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Duration value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the duration value
-
- Returns: A Duration created from the milliseconds value in the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Duration x) throws SQLException - Summary: Sets a Duration value as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(Duration) — the Duration value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Duration x) throws SQLException - Summary: Sets a Duration value as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(Duration) — the Duration value to set. Can be {@code null} .
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Duration x) throws IOException - Summary: Appends a Duration value to an Appendable output.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Duration) — the Duration to append. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Duration x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Duration value to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Duration) — the Duration to write. Can be {@code null} . -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for Duration)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class EntityIdType (com.landawn.abacus.type.EntityIdType)
Type handler for EntityId values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<EntityId>
-
Signature:
@Override public Class<EntityId> clazz() - Summary: Returns the Java class type handled by this type handler.
-
Parameters:
- (none)
- Returns: The Class object representing EntityId.class
isEntityId(...) -> boolean
-
Signature:
@Override public boolean isEntityId() - Summary: Indicates whether this type represents an EntityId.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler specifically handles EntityId objects
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this EntityId type is serializable in the type system.
-
Parameters:
- (none)
- Returns: {@code false} , indicating EntityIds are not simply serializable
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type category for EntityId objects.
-
Parameters:
- (none)
- Returns: SerializationType.ENTITY_ID, indicating special EntityId serialization handling
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final EntityId x) - Summary: Converts an EntityId to its JSON string representation.
-
Parameters:
-
x(EntityId) — the EntityId to convert. Can be {@code null} .
-
- Returns: A JSON string representation of the EntityId, or {@code null} if input is null
valueOf(...) -> EntityId
-
Signature:
@Override public EntityId valueOf(final String str) - Summary: Converts a JSON string representation back to an EntityId object.
-
Contract:
- The string should contain a valid JSON representation of an EntityId with all required fields.
-
Parameters:
-
str(String) — the JSON string to parse. Can be {@code null} or empty.
-
- Returns: An EntityId parsed from the JSON string, or {@code null} if input is null/empty
Class EnumType (com.landawn.abacus.type.EnumType)
Type handler for Enum types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
enumerated(...) -> com.landawn.abacus.util.EnumType
-
Signature:
public com.landawn.abacus.util.EnumType enumerated() - Summary: Returns the enumeration strategy used by this type handler.
-
Parameters:
- (none)
- Returns: the configured enum representation
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this enum type is serializable.
-
Parameters:
- (none)
- Returns: {@code true} , as enums are always serializable
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this enum type are immutable.
-
Parameters:
- (none)
- Returns: {@code true} , as enums are immutable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts an enum value to its string representation.
-
Contract:
- If a custom JSON value type is defined, uses the parent class implementation.
-
Parameters:
-
x(T) — the enum value to convert; may be {@code null}
-
- Returns: the enum constant name, or {@code null} if input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a string representation back to an enum value.
-
Contract:
- Numeric strings are interpreted as ordinals (or codes when CODE is configured) unless the same string is defined as a JSON/XML name.
- The literal string {@code "null"} returns {@code null} when the enum does not define a constant named {@code "null"} .
-
Parameters:
-
str(String) — the string to convert; may be {@code null} or empty
-
- Returns: the enum value corresponding to the string, or {@code null} if input is null/empty
-
Signature:
public T valueOf(final int value) - Summary: Converts an integer ordinal or code value to its corresponding enum constant.
-
Contract:
- A value of 0 returns {@code null} when no constant is mapped to 0.
-
Parameters:
-
value(int) — the ordinal or code value
-
- Returns: the enum constant for the specified value, or {@code null} if value is 0 and no constant maps to 0
get(...) -> T
-
Signature:
@Override public T get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an enum value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnIndex(int) — the column index (1-based) of the enum value
-
- Returns: the enum value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public T get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an enum value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data -
columnName(String) — the label of the column containing the enum value
-
- Returns: the enum value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final T x) throws SQLException - Summary: Sets an enum value as a parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement in which to set the parameter -
columnIndex(int) — the parameter index (1-based) to set -
x(T) — the enum value to set; may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final T x) throws SQLException - Summary: Sets an enum value as a named parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement in which to set the parameter -
parameterName(String) — the name of the parameter to set -
x(T) — the enum value to set; may be {@code null}
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes an enum value to a CharacterWriter with the specified serialization configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the enum value to write; may be {@code null} -
config(JsonXmlSerializationConfig<?>) — the serialization configuration for quotation settings
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class FloatArrayType (com.landawn.abacus.type.FloatArrayType)
Type handler for Float array (Float\[\]) values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Float[] x) - Summary: Converts a Float array to its string representation.
-
Parameters:
-
x(Float[]) — the Float array to convert. Can be {@code null} .
-
- Returns: A string representation of the array, or {@code null} if input is null
valueOf(...) -> Float\[\]
-
Signature:
@Override public Float[] valueOf(final String str) - Summary: Converts a string representation back to a Float array.
-
Parameters:
-
str(String) — the string to parse. Can be {@code null} .
-
- Returns: A Float array parsed from the string, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Float[] x) throws IOException - Summary: Appends a Float array to an Appendable output.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Float[]) — the Float array to append. Can be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Float[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a Float array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Float[]) — the Float array to write. Can be {@code null} . -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for Float arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class FloatType (com.landawn.abacus.type.FloatType)
Type handler for Float wrapper type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Float class.
-
Parameters:
- (none)
- Returns: the Class object for Float.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Float is a primitive wrapper
get(...) -> Float
-
Signature:
@Override public Float get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Float value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Float value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Float get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Float value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Float value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class FractionType (com.landawn.abacus.type.FractionType)
Type handler for Fraction objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Fraction>
-
Signature:
@Override public Class<Fraction> clazz() - Summary: Returns the Class object representing the Fraction type.
-
Parameters:
- (none)
- Returns: Fraction.class
isNumber(...) -> boolean
-
Signature:
@Override public boolean isNumber() - Summary: Indicates whether this type represents a numeric value.
-
Parameters:
- (none)
- Returns: {@code true} , as Fraction represents numeric values
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this type are immutable.
-
Parameters:
- (none)
- Returns: {@code true} , as Fraction instances are immutable
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether instances of this type implement the Comparable interface.
-
Parameters:
- (none)
- Returns: {@code true} , as Fraction implements Comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be written without quotes in CSV format.
-
Contract:
- Indicates whether this type should be written without quotes in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Fraction values should not be quoted in CSV output
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Fraction x) - Summary: Converts a Fraction object to its string representation.
-
Parameters:
-
x(Fraction) — the Fraction to convert to string
-
- Returns: the string representation of the fraction, or {@code null} if the input is null
valueOf(...) -> Fraction
-
Signature:
@Override public Fraction valueOf(final String str) - Summary: Parses a string representation into a Fraction object.
-
Contract:
- The string should be in a format that can be parsed by Fraction.of(), typically "numerator/denominator" or a decimal number.
-
Parameters:
-
str(String) — the string to parse into a Fraction
-
- Returns: the parsed Fraction object, or {@code null} if the input string is {@code null} or empty
Class GregorianCalendarType (com.landawn.abacus.type.GregorianCalendarType)
Type handler for GregorianCalendar objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<GregorianCalendar>
-
Signature:
@Override public Class<GregorianCalendar> clazz() - Summary: Returns the Class object representing the GregorianCalendar type.
-
Parameters:
- (none)
- Returns: GregorianCalendar.class
valueOf(...) -> GregorianCalendar
-
Signature:
@Override public GregorianCalendar valueOf(final Object obj) - Summary: Converts various object types to a GregorianCalendar instance.
-
Parameters:
-
obj(Object) — the object to convert to GregorianCalendar
-
- Returns: a GregorianCalendar instance, or {@code null} if the input is null
-
Signature:
@Override public GregorianCalendar valueOf(final String str) - Summary: Parses a string representation into a GregorianCalendar instance.
-
Parameters:
-
str(String) — the string to parse into a GregorianCalendar
-
- Returns: the parsed GregorianCalendar instance, or {@code null} if the input is {@code null} or empty
-
Signature:
@Override public GregorianCalendar valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a GregorianCalendar instance.
-
Contract:
- This method is optimized for performance when parsing from character buffers.
- If the character sequence appears to be a long number, it's interpreted as milliseconds since epoch.
-
Parameters:
-
cbuf(char[]) — the character array containing the date/time representation -
offset(int) — the start offset in the character array -
len(int) — the number of characters to parse
-
- Returns: the parsed GregorianCalendar instance, or {@code null} if the input is {@code null} or empty
get(...) -> GregorianCalendar
-
Signature:
@Override public GregorianCalendar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a GregorianCalendar value from the specified column in a ResultSet.
-
Contract:
- If the column value is {@code null} , returns {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<GregorianCalendar> type = TypeFactory.getType(GregorianCalendar.class); try (ResultSet rs = stmt.executeQuery("SELECT created_at FROM events")) { if (rs.next()) { GregorianCalendar createdAt = type.get(rs, 1); // Retrieves GregorianCalendar from the first column } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: the GregorianCalendar value from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public GregorianCalendar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a GregorianCalendar value from the specified column in a ResultSet using the column label.
-
Contract:
- If the column value is {@code null} , returns {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<GregorianCalendar> type = TypeFactory.getType(GregorianCalendar.class); try (ResultSet rs = stmt.executeQuery("SELECT created_at FROM events")) { if (rs.next()) { GregorianCalendar createdAt = type.get(rs, "created_at"); // Retrieves GregorianCalendar from the "created_at" column } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: the GregorianCalendar value from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
Class GuavaMultimapType (com.landawn.abacus.type.GuavaMultimapType)
Type handler for Google Guava Multimap implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this multimap type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "com.google.common.collect.Multimap < String, Integer > ")
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the multimap type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for the multimap type
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic multimap type.
-
Parameters:
- (none)
- Returns: an array containing the key type and collection value type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type with type parameters.
-
Parameters:
- (none)
- Returns: {@code true} , as Multimap is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code true} , as multimaps can be serialized
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a multimap to its string representation.
-
Parameters:
-
x(T) — the multimap to convert to string
-
- Returns: the JSON string representation of the multimap, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a string representation back to a multimap instance.
-
Contract:
- The string should be in JSON format representing a Map < K, Collection < V > > .
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a new multimap instance containing the parsed data, or {@code null} if the input is {@code null} or empty
Class GuavaMultisetType (com.landawn.abacus.type.GuavaMultisetType)
Type handler for Google Guava Multiset implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this multiset type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "com.google.common.collect.Multiset < String > ")
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the multiset type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for the multiset type
getElementType(...) -> Type<E>
-
Signature:
@Override public Type<E> getElementType() - Summary: Returns the type handler for the elements contained in this multiset.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this multiset
getParameterTypes(...) -> Type<E>\[\]
-
Signature:
@Override public Type<E>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic multiset type.
-
Parameters:
- (none)
- Returns: an array containing the element type as the only parameter type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type with type parameters.
-
Parameters:
- (none)
- Returns: {@code true} , as Multiset is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code true} , as multisets can be serialized
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a multiset to its string representation.
-
Parameters:
-
x(T) — the multiset to convert to string
-
- Returns: the JSON string representation of the multiset as a map of elements to counts, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a string representation back to a multiset instance.
-
Contract:
- The string should be in JSON format representing a Map < E, Integer > where values are element counts.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a new multiset instance containing the parsed elements with their counts, or {@code null} if the input is {@code null} or empty
Class HBaseColumnType (com.landawn.abacus.type.HBaseColumnType)
Type handler for HBaseColumn objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this HBaseColumn type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "HBaseColumn < String > ")
clazz(...) -> Class<HBaseColumn<T>>
-
Signature:
@Override public Class<HBaseColumn<T>> clazz() - Summary: Returns the Class object representing the HBaseColumn type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for HBaseColumn
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Returns the type handler for the value element stored in the HBaseColumn.
-
Parameters:
- (none)
- Returns: the Type instance representing the value type of this HBaseColumn
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic HBaseColumn type.
-
Parameters:
- (none)
- Returns: an array containing the value type as the only parameter type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type with type parameters.
-
Parameters:
- (none)
- Returns: {@code true} , as HBaseColumn is a generic type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final HBaseColumn<T> x) - Summary: Converts an HBaseColumn to its string representation.
-
Parameters:
-
x(HBaseColumn<T>) — the HBaseColumn to convert to string
-
- Returns: the string representation in format "version:value", or {@code null} if the input is null
valueOf(...) -> HBaseColumn<T>
-
Signature:
@Override public HBaseColumn<T> valueOf(final String str) - Summary: Parses a string representation into an HBaseColumn instance.
-
Contract:
- The string should be in the format "version:value" where version is a long number representing the timestamp/version, and value is parsed according to the element type.
-
Parameters:
-
str(String) — the string to parse in format "version:value"
-
- Returns: a new HBaseColumn instance with the parsed version and value, or {@code null} if the input is {@code null} or empty
Class ImmutableListType (com.landawn.abacus.type.ImmutableListType)
Type handler for ImmutableList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this immutable list type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "ImmutableList < String > ")
clazz(...) -> Class<ImmutableList<E>>
-
Signature:
@Override public Class<ImmutableList<E>> clazz() - Summary: Returns the Class object representing the ImmutableList type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for ImmutableList
getElementType(...) -> Type<E>
-
Signature:
@Override public Type<E> getElementType() - Summary: Returns the type handler for the elements contained in this immutable list.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this immutable list
getParameterTypes(...) -> Type<E>\[\]
-
Signature:
@Override public Type<E>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic immutable list type.
-
Parameters:
- (none)
- Returns: an array containing the element type as the only parameter type
isList(...) -> boolean
-
Signature:
@Override public boolean isList() - Summary: Indicates whether this type represents a List or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} , as ImmutableList is a list type
isCollection(...) -> boolean
-
Signature:
@Override public boolean isCollection() - Summary: Indicates whether this type represents a Collection or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} , as ImmutableList is a collection type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Checks whether the elements of this immutable list type are serializable.
-
Contract:
- The immutable list is considered serializable if its element type is serializable.
-
Parameters:
- (none)
- Returns: {@code true} if the underlying list type is serializable, {@code false} otherwise
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type category for this immutable list.
-
Parameters:
- (none)
- Returns: SerializationType.SERIALIZABLE if elements are serializable, SerializationType.COLLECTION otherwise
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ImmutableList<E> x) - Summary: Converts an immutable list to its string representation.
-
Parameters:
-
x(ImmutableList<E>) — the immutable list to convert to string
-
- Returns: the string representation of the immutable list, or {@code null} if the input is null
valueOf(...) -> ImmutableList<E>
-
Signature:
@Override public ImmutableList<E> valueOf(final String str) - Summary: Converts a string representation back to an immutable list instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a new immutable list instance containing the parsed elements
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable writer, final ImmutableList<E> x) throws IOException - Summary: Appends the string representation of an immutable list to an Appendable.
-
Parameters:
-
writer(Appendable) — the Appendable to write to -
x(ImmutableList<E>) — the immutable list to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final ImmutableList<E> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an immutable list to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(ImmutableList<E>) — the immutable list to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class ImmutableMapEntryType (com.landawn.abacus.type.ImmutableMapEntryType)
Type handler for immutable Map.Entry objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this immutable map entry type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "Map.ImmutableEntry < String, Integer > ")
clazz(...) -> Class<AbstractMap.SimpleImmutableEntry<K, V>>
-
Signature:
@Override public Class<AbstractMap.SimpleImmutableEntry<K, V>> clazz() - Summary: Returns the Class object representing the SimpleImmutableEntry type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for AbstractMap.SimpleImmutableEntry
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic map entry type.
-
Parameters:
- (none)
- Returns: an array containing the key type and value type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final AbstractMap.SimpleImmutableEntry<K, V> x) - Summary: Converts an immutable map entry to its string representation.
-
Parameters:
-
x(AbstractMap.SimpleImmutableEntry<K, V>) — the immutable map entry to convert to string
-
- Returns: the JSON string representation of the entry (e.g., "{\\"key\\":\\"value\\"}"), or {@code null} if the input is null
valueOf(...) -> AbstractMap.SimpleImmutableEntry<K, V>
-
Signature:
@Override public AbstractMap.SimpleImmutableEntry<K, V> valueOf(final String str) - Summary: Parses a string representation into an immutable map entry instance.
-
Contract:
- The string should be in JSON object format with a single key-value pair.
-
Parameters:
-
str(String) — the JSON string to parse (e.g., "{\\"key\\":\\"value\\"}")
-
- Returns: a new immutable map entry instance, or {@code null} if the input is {@code null} , empty, or "{}"
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final AbstractMap.SimpleImmutableEntry<K, V> x) throws IOException - Summary: Appends the string representation of an immutable map entry to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(AbstractMap.SimpleImmutableEntry<K, V>) — the immutable map entry to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final AbstractMap.SimpleImmutableEntry<K, V> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an immutable map entry to a CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(AbstractMap.SimpleImmutableEntry<K, V>) — the immutable map entry to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class ImmutableMapType (com.landawn.abacus.type.ImmutableMapType)
Type handler for ImmutableMap objects with generic key and value types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this ImmutableMap type.
-
Parameters:
- (none)
- Returns: The declaring name in format "MapClass < KeyDeclaringName, ValueDeclaringName > "
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the specific ImmutableMap implementation type.
-
Parameters:
- (none)
- Returns: The Class object for the ImmutableMap implementation
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Gets the parameter types for this generic ImmutableMap type.
-
Parameters:
- (none)
- Returns: An array containing the key type and value type
isMap(...) -> boolean
-
Signature:
@Override public boolean isMap() - Summary: Indicates whether this type represents a ImmutableMap.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that this type represents a ImmutableMap
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that ImmutableMap is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code false} , indicating that ImmutableMap is not serializable through this type
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type category for ImmutableMap.
-
Contract:
- This indicates how the ImmutableMap should be treated during serialization processes.
-
Parameters:
- (none)
- Returns: SerializationType.MAP
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a ImmutableMap object to its JSON string representation.
-
Parameters:
-
x(T) — The ImmutableMap object to convert
-
- Returns: The JSON string representation of the ImmutableMap, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Parses a JSON string to create a ImmutableMap object.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed ImmutableMap object, or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a ImmutableMap to an Appendable.
-
Contract:
- If the Appendable is a Writer, the serialization is performed directly to the Writer for better performance.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(T) — The ImmutableMap to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
Class ImmutableSetType (com.landawn.abacus.type.ImmutableSetType)
Type handler for ImmutableSet objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this immutable set type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "ImmutableSet < String > ")
clazz(...) -> Class<ImmutableSet<E>>
-
Signature:
@Override public Class<ImmutableSet<E>> clazz() - Summary: Returns the Class object representing the ImmutableSet type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for ImmutableSet
getElementType(...) -> Type<E>
-
Signature:
@Override public Type<E> getElementType() - Summary: Returns the type handler for the elements contained in this immutable set.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this immutable set
getParameterTypes(...) -> Type<E>\[\]
-
Signature:
@Override public Type<E>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic immutable set type.
-
Parameters:
- (none)
- Returns: an array containing the element type as the only parameter type
isSet(...) -> boolean
-
Signature:
@Override public boolean isSet() - Summary: Indicates whether this type represents a Set or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} , as ImmutableSet is a set type
isCollection(...) -> boolean
-
Signature:
@Override public boolean isCollection() - Summary: Indicates whether this type represents a Collection or its subtype.
-
Parameters:
- (none)
- Returns: {@code true} , as ImmutableSet is a collection type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Checks whether the elements of this immutable set type are serializable.
-
Contract:
- The immutable set is considered serializable if its element type is serializable.
-
Parameters:
- (none)
- Returns: {@code true} if the underlying set type is serializable, {@code false} otherwise
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type category for this immutable set.
-
Parameters:
- (none)
- Returns: SerializationType.SERIALIZABLE if elements are serializable, SerializationType.COLLECTION otherwise
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ImmutableSet<E> x) - Summary: Converts an immutable set to its string representation.
-
Parameters:
-
x(ImmutableSet<E>) — the immutable set to convert to string
-
- Returns: the string representation of the immutable set, or {@code null} if the input is null
valueOf(...) -> ImmutableSet<E>
-
Signature:
@Override public ImmutableSet<E> valueOf(final String str) - Summary: Converts a string representation back to an immutable set instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a new immutable set instance containing the parsed elements
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable writer, final ImmutableSet<E> x) throws IOException - Summary: Appends the string representation of an immutable set to an Appendable.
-
Parameters:
-
writer(Appendable) — the Appendable to write to -
x(ImmutableSet<E>) — the immutable set to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final ImmutableSet<E> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an immutable set to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(ImmutableSet<E>) — the immutable set to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class IndexedType (com.landawn.abacus.type.IndexedType)
Type handler for Indexed objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this indexed type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "Indexed < String > ")
clazz(...) -> Class<Indexed<T>>
-
Signature:
@Override public Class<Indexed<T>> clazz() - Summary: Returns the Class object representing the Indexed type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for Indexed
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic indexed type.
-
Parameters:
- (none)
- Returns: an array containing the value type as the only parameter type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Indexed<T> x) - Summary: Converts an Indexed object to its string representation.
-
Parameters:
-
x(Indexed<T>) — the Indexed object to convert to string
-
- Returns: the JSON array representation "\[index,value\]", or {@code null} if the input is null
valueOf(...) -> Indexed<T>
-
Signature:
@SuppressWarnings("unchecked") @Override public Indexed<T> valueOf(final String str) - Summary: Parses a string representation into an Indexed instance.
-
Contract:
- The string should be in JSON array format with exactly two elements: \[index, value\].
-
Parameters:
-
str(String) — the JSON array string to parse (e.g., "\[0,\\"hello\\"\]")
-
- Returns: a new Indexed instance with the parsed index and value, or {@code null} if the input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Indexed<T> x) throws IOException - Summary: Appends the string representation of an Indexed object to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Indexed<T>) — the Indexed object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Indexed<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an Indexed object to a CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Indexed<T>) — the Indexed object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class InputStreamType (com.landawn.abacus.type.InputStreamType)
Type handler for InputStream and its subclasses.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<InputStream>
-
Signature:
@Override public Class<InputStream> clazz() - Summary: Returns the Class object representing the InputStream type handled by this type handler.
-
Parameters:
- (none)
- Returns: the Class object for InputStream or its subclass
isInputStream(...) -> boolean
-
Signature:
@Override public boolean isInputStream() - Summary: Indicates whether this type represents an InputStream.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is an InputStream type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final InputStream x) - Summary: Converts an InputStream to its string representation.
-
Parameters:
-
x(InputStream) — the InputStream to convert to string
-
- Returns: the string representation of the stream contents, or {@code null} if the input is null
valueOf(...) -> InputStream
-
Signature:
@Override public InputStream valueOf(final String str) - Summary: Converts a string back to an InputStream instance.
-
Contract:
- If no specific constructors are available, returns a ByteArrayInputStream.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: a new InputStream containing the string bytes, or {@code null} if the input is null
-
Signature:
@SuppressFBWarnings @Override public InputStream valueOf(final Object obj) - Summary: Converts various object types to an InputStream.
-
Parameters:
-
obj(Object) — the object to convert to InputStream
-
- Returns: an InputStream representation of the object, or {@code null} if the input is null
get(...) -> InputStream
-
Signature:
@Override public InputStream get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an InputStream from the specified column in a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: the InputStream from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public InputStream get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an InputStream from the specified column in a ResultSet using the column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: the InputStream from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x) throws SQLException - Summary: Sets an InputStream parameter in a PreparedStatement.
-
Contract:
- The stream will be read when the statement is executed.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(InputStream) — the InputStream to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x) throws SQLException - Summary: Sets an InputStream parameter in a CallableStatement using a parameter name.
-
Contract:
- The stream will be read when the statement is executed.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an InputStream parameter in a PreparedStatement with a specified length.
-
Contract:
- The stream will be read when the statement is executed, up to the specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(InputStream) — the InputStream to set, or null -
sqlTypeOrLength(int) — the length of the stream in bytes
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final InputStream x, final int sqlTypeOrLength) throws SQLException - Summary: Sets an InputStream parameter in a CallableStatement with a specified length.
-
Contract:
- The stream will be read when the statement is executed, up to the specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(InputStream) — the InputStream to set, or null -
sqlTypeOrLength(int) — the length of the stream in bytes
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final InputStream x) throws IOException - Summary: Appends the content of an InputStream to an Appendable.
-
Contract:
- If the Appendable is a Writer, the stream is efficiently copied using character encoding.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(InputStream) — the InputStream to read from
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final InputStream x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an InputStream to a CharacterWriter.
-
Contract:
- Handles quotation marks if specified in the configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(InputStream) — the InputStream to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or writing
-
Class InstantType (com.landawn.abacus.type.InstantType)
Type handler for java.time.Instant.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Instant>
-
Signature:
@Override public Class<Instant> clazz() - Summary: Returns the Class object representing the Instant type.
-
Parameters:
- (none)
- Returns: Instant.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Instant x) - Summary: Converts an Instant to its string representation.
-
Parameters:
-
x(Instant) — the Instant to convert to string
-
- Returns: the ISO-8601 timestamp string representation, or {@code null} if the input is null
valueOf(...) -> Instant
-
Signature:
@Override public Instant valueOf(final Object obj) - Summary: Converts various object types to an Instant.
-
Parameters:
-
obj(Object) — the object to convert to Instant
-
- Returns: an Instant instance, or {@code null} if the input is null
-
Signature:
@Override public Instant valueOf(final String str) - Summary: Parses a string representation into an Instant.
-
Parameters:
-
str(String) — the string to parse into an Instant
-
- Returns: the parsed Instant instance, or {@code null} if the input is {@code null} or represents a {@code null} datetime
-
Signature:
@Override public Instant valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into an Instant.
-
Contract:
- This method is optimized for performance when parsing from character buffers.
- If the character sequence appears to be a long number, it's interpreted as milliseconds since epoch.
-
Parameters:
-
cbuf(char[]) — the character array containing the instant representation -
offset(int) — the start offset in the character array -
len(int) — the number of characters to parse
-
- Returns: the parsed Instant instance, or {@code null} if the input is {@code null} or empty
get(...) -> Instant
-
Signature:
@Override public Instant get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an Instant value from the specified column in a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: the Instant value from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Instant get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an Instant value from the specified column in a ResultSet using the column name.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label (or name if no label was specified) to read
-
- Returns: the Instant value from the column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Instant x) throws SQLException - Summary: Sets an Instant parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(Instant) — the Instant to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Instant x) throws SQLException - Summary: Sets an Instant parameter in a CallableStatement using a parameter name.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Instant) — the Instant to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Instant x) throws IOException - Summary: Appends the string representation of an Instant to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Instant) — the Instant to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final Instant x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an Instant to a CharacterWriter.
-
Contract:
- The format depends on the serialization configuration: - LONG format: writes milliseconds since epoch as a number - ISO_8601_DATE_TIME: writes in "yyyy-MM-dd'T'HH:mm:ssZ" format - ISO_8601_TIMESTAMP: writes in "yyyy-MM-dd'T'HH:mm:ss.SSSZ" format - Default: uses the standard stringOf() format String formats are quoted if specified in the configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Instant) — the Instant to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class IntegerArrayType (com.landawn.abacus.type.IntegerArrayType)
Type handler for Integer array (Integer\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Integer[] x) - Summary: Converts an Integer array to its string representation.
-
Parameters:
-
x(Integer[]) — the Integer array to convert to string
-
- Returns: the JSON array string representation (e.g., "\[1,null,3\]"), or {@code null} if the input array is null
valueOf(...) -> Integer\[\]
-
Signature:
@Override public Integer[] valueOf(final String str) - Summary: Parses a string representation into an Integer array.
-
Contract:
- The string should be in JSON array format.
-
Parameters:
-
str(String) — the JSON array string to parse (e.g., "\[1,null,3\]")
-
- Returns: the parsed Integer array, or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Integer[] x) throws IOException - Summary: Appends the string representation of an Integer array to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Integer[]) — the Integer array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Integer[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an Integer array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Integer[]) — the Integer array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for integer arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class IntegerType (com.landawn.abacus.type.IntegerType)
Type handler for Integer wrapper type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Integer class.
-
Parameters:
- (none)
- Returns: the Class object for Integer.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Integer is a primitive wrapper
get(...) -> Integer
-
Signature:
@Override public Integer get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an Integer value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Integer value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Integer get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an Integer value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Integer value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class JSONType (com.landawn.abacus.type.JSONType)
Type handler for JSON serialization and deserialization of generic types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Gets the declaring name of this JSONType.
-
Parameters:
- (none)
- Returns: the declaring name of this type
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Gets the class object for the type handled by this JSONType.
-
Parameters:
- (none)
- Returns: the Class object representing the type T
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts the specified object to its JSON string representation.
-
Parameters:
-
x(T) — the object to convert to JSON string
-
- Returns: the JSON string representation of the object, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Parses a JSON string into an object of type T.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: the deserialized object of type T, or {@code null} if the string is empty or null
Class JUDateType (com.landawn.abacus.type.JUDateType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Gets the declaring name of this type.
-
Parameters:
- (none)
- Returns: the canonical name of java.util.Date class
clazz(...) -> Class<Date>
-
Signature:
@Override public Class<Date> clazz() - Summary: Gets the class type for java.util.Date.
-
Parameters:
- (none)
- Returns: the Class object representing java.util.Date
valueOf(...) -> Date
-
Signature:
@Override public Date valueOf(final Object obj) - Summary: Converts the specified object to a java.util.Date instance.
-
Parameters:
-
obj(Object) — the object to convert to Date
-
- Returns: a Date instance, or {@code null} if the input is null
-
Signature:
@Override public Date valueOf(final String str) - Summary: Parses a string representation into a java.util.Date instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Date instance, or {@code null} if the string is empty or null
-
Signature:
@Override public Date valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a java.util.Date instance.
-
Contract:
- If that fails, it converts the character array to a string and delegates to valueOf(String).
-
Parameters:
-
cbuf(char[]) — the character buffer containing the value to parse -
offset(int) — the start offset in the character buffer -
len(int) — the number of characters to parse
-
- Returns: a Date instance, or {@code null} if the character buffer is {@code null} or length is 0
get(...) -> Date
-
Signature:
@Override public Date get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Date value from the specified column in a ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<java.util.Date> type = TypeFactory.getType(java.util.Date.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Date date = type.get(rs, 1); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a Date instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Date get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Date value from the specified column in a ResultSet using column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<java.util.Date> type = TypeFactory.getType(java.util.Date.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Date date = type.get(rs, "created_at"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label to retrieve the value from
-
- Returns: a Date instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Date x) throws SQLException - Summary: Sets a Date parameter in a PreparedStatement.
-
Contract:
- If the Date is already a Timestamp instance, it is used directly.
- If the Date is {@code null} , a SQL NULL is set for the parameter.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Date) — the Date value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Date x) throws SQLException - Summary: Sets a named Date parameter in a CallableStatement.
-
Contract:
- If the Date is already a Timestamp instance, it is used directly.
- If the Date is {@code null} , a SQL NULL is set for the parameter.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Date) — the Date value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class JdkDurationType (com.landawn.abacus.type.JdkDurationType)
Type handler for java.time.Duration.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Duration>
-
Signature:
@Override public Class<Duration> clazz() - Summary: Returns the Class object representing the Duration type.
-
Parameters:
- (none)
- Returns: Duration.class
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be written without quotes in CSV format.
-
Contract:
- Indicates whether this type should be written without quotes in CSV format.
- Duration values are numeric (milliseconds) and should not be quoted.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Duration values should not be quoted in CSV output
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Duration x) - Summary: Converts a Duration to its string representation.
-
Parameters:
-
x(Duration) — the Duration to convert to string
-
- Returns: the string representation of milliseconds, or {@code null} if the input is null
valueOf(...) -> Duration
-
Signature:
@Override public Duration valueOf(final String str) - Summary: Parses a string representation into a Duration.
-
Contract:
- The string should contain a number representing milliseconds.
-
Parameters:
-
str(String) — the string containing milliseconds to parse
-
- Returns: the parsed Duration instance, or {@code null} if the input is {@code null} or empty
get(...) -> Duration
-
Signature:
@Override public Duration get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Duration value from the specified column in a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: the Duration value created from the milliseconds in the column
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Duration get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Duration value from the specified column in a ResultSet using the column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: the Duration value created from the milliseconds in the column
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Duration x) throws SQLException - Summary: Sets a Duration parameter in a PreparedStatement.
-
Contract:
- If the Duration is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(Duration) — the Duration to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Duration x) throws SQLException - Summary: Sets a Duration parameter in a CallableStatement using a parameter name.
-
Contract:
- If the Duration is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Duration) — the Duration to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Duration x) throws IOException - Summary: Appends the string representation of a Duration to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Duration) — the Duration to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Duration x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Duration to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Duration) — the Duration to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for Duration)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class JdkOptionalDoubleType (com.landawn.abacus.type.JdkOptionalDoubleType)
Type handler for java.util.OptionalDouble.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalDouble>
-
Signature:
@Override public Class<OptionalDouble> clazz() - Summary: Returns the Class object representing the OptionalDouble type.
-
Parameters:
- (none)
- Returns: OptionalDouble.class
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether instances of this type implement the Comparable interface.
-
Contract:
- OptionalDouble values can be compared when both are present.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalDouble values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be written without quotes in CSV format.
-
Contract:
- Indicates whether this type should be written without quotes in CSV format.
- Double values are numeric and should not be quoted.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that OptionalDouble values should not be quoted in CSV output
defaultValue(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble defaultValue() - Summary: Returns the default value for OptionalDouble type, which is an empty OptionalDouble.
-
Parameters:
- (none)
- Returns: OptionalDouble.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalDouble x) - Summary: Converts an OptionalDouble to its string representation.
-
Contract:
- If the optional is empty or {@code null} , returns {@code null} .
-
Parameters:
-
x(OptionalDouble) — the OptionalDouble to convert to string
-
- Returns: the string representation of the double value, or {@code null} if empty or null
valueOf(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble valueOf(final String str) - Summary: Parses a string representation into an OptionalDouble.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: OptionalDouble.empty() if the string is {@code null} or empty, otherwise OptionalDouble containing the parsed value
get(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an OptionalDouble value from the specified column in a ResultSet.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalDouble.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: OptionalDouble.empty() if the column is {@code null} , otherwise OptionalDouble containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalDouble get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an OptionalDouble value from the specified column in a ResultSet using the column label.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalDouble.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: OptionalDouble.empty() if the column is {@code null} , otherwise OptionalDouble containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalDouble x) throws SQLException - Summary: Sets an OptionalDouble parameter in a PreparedStatement.
-
Contract:
- If the OptionalDouble is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(OptionalDouble) — the OptionalDouble to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalDouble x) throws SQLException - Summary: Sets an OptionalDouble parameter in a CallableStatement using a parameter name.
-
Contract:
- If the OptionalDouble is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalDouble) — the OptionalDouble to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalDouble x) throws IOException - Summary: Appends the string representation of an OptionalDouble to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalDouble) — the OptionalDouble to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalDouble x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an OptionalDouble to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalDouble) — the OptionalDouble to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for numeric values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class JdkOptionalIntType (com.landawn.abacus.type.JdkOptionalIntType)
Type handler for java.util.OptionalInt.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalInt>
-
Signature:
@Override public Class<OptionalInt> clazz() - Summary: Returns the Class object representing the OptionalInt type.
-
Parameters:
- (none)
- Returns: OptionalInt.class
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether instances of this type implement the Comparable interface.
-
Contract:
- OptionalInt values can be compared when both are present.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalInt values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be written without quotes in CSV format.
-
Contract:
- Indicates whether this type should be written without quotes in CSV format.
- Integer values are numeric and should not be quoted.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that OptionalInt values should not be quoted in CSV output
defaultValue(...) -> OptionalInt
-
Signature:
@Override public OptionalInt defaultValue() - Summary: Returns the default value for OptionalInt type, which is an empty OptionalInt.
-
Parameters:
- (none)
- Returns: OptionalInt.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalInt x) - Summary: Converts an OptionalInt to its string representation.
-
Contract:
- If the optional is empty or {@code null} , returns {@code null} .
-
Parameters:
-
x(OptionalInt) — the OptionalInt to convert to string
-
- Returns: the string representation of the int value, or {@code null} if empty or null
valueOf(...) -> OptionalInt
-
Signature:
@Override public OptionalInt valueOf(final String str) - Summary: Parses a string representation into an OptionalInt.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: OptionalInt.empty() if the string is {@code null} or empty, otherwise OptionalInt containing the parsed value
get(...) -> OptionalInt
-
Signature:
@Override public OptionalInt get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an OptionalInt value from the specified column in a ResultSet.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalInt.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: OptionalInt.empty() if the column is {@code null} , otherwise OptionalInt containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalInt get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an OptionalInt value from the specified column in a ResultSet using the column label.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalInt.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: OptionalInt.empty() if the column is {@code null} , otherwise OptionalInt containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalInt x) throws SQLException - Summary: Sets an OptionalInt parameter in a PreparedStatement.
-
Contract:
- If the OptionalInt is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(OptionalInt) — the OptionalInt to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalInt x) throws SQLException - Summary: Sets an OptionalInt parameter in a CallableStatement using a parameter name.
-
Contract:
- If the OptionalInt is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalInt) — the OptionalInt to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalInt x) throws IOException - Summary: Appends the string representation of an OptionalInt to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalInt) — the OptionalInt to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalInt x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an OptionalInt to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalInt) — the OptionalInt to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for numeric values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class JdkOptionalLongType (com.landawn.abacus.type.JdkOptionalLongType)
Type handler for java.util.OptionalLong.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalLong>
-
Signature:
@Override public Class<OptionalLong> clazz() - Summary: Returns the Class object representing the OptionalLong type.
-
Parameters:
- (none)
- Returns: OptionalLong.class
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether instances of this type implement the Comparable interface.
-
Contract:
- OptionalLong values can be compared when both are present.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalLong values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether this type should be written without quotes in CSV format.
-
Contract:
- Indicates whether this type should be written without quotes in CSV format.
- Long values are numeric and should not be quoted.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that OptionalLong values should not be quoted in CSV output
defaultValue(...) -> OptionalLong
-
Signature:
@Override public OptionalLong defaultValue() - Summary: Returns the default value for OptionalLong type, which is an empty OptionalLong.
-
Parameters:
- (none)
- Returns: OptionalLong.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalLong x) - Summary: Converts an OptionalLong to its string representation.
-
Contract:
- If the optional is empty or {@code null} , returns {@code null} .
-
Parameters:
-
x(OptionalLong) — the OptionalLong to convert to string
-
- Returns: the string representation of the long value, or {@code null} if empty or null
valueOf(...) -> OptionalLong
-
Signature:
@Override public OptionalLong valueOf(final String str) - Summary: Parses a string representation into an OptionalLong.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: OptionalLong.empty() if the string is {@code null} or empty, otherwise OptionalLong containing the parsed value
get(...) -> OptionalLong
-
Signature:
@Override public OptionalLong get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an OptionalLong value from the specified column in a ResultSet.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalLong.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: OptionalLong.empty() if the column is {@code null} , otherwise OptionalLong containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalLong get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an OptionalLong value from the specified column in a ResultSet using the column label.
-
Contract:
- If the column value is {@code null} , returns an empty OptionalLong.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: OptionalLong.empty() if the column is {@code null} , otherwise OptionalLong containing the value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalLong x) throws SQLException - Summary: Sets an OptionalLong parameter in a PreparedStatement.
-
Contract:
- If the OptionalLong is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(OptionalLong) — the OptionalLong to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalLong x) throws SQLException - Summary: Sets an OptionalLong parameter in a CallableStatement using a parameter name.
-
Contract:
- If the OptionalLong is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalLong) — the OptionalLong to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalLong x) throws IOException - Summary: Appends the string representation of an OptionalLong to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalLong) — the OptionalLong to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalLong x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an OptionalLong to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalLong) — the OptionalLong to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (not used for numeric values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class JdkOptionalType (com.landawn.abacus.type.JdkOptionalType)
Type handler for java.util.Optional with generic type parameter.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this optional type.
-
Parameters:
- (none)
- Returns: the declaring name of this type (e.g., "JdkOptional < String > ")
clazz(...) -> Class<Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") @Override public Class<Optional<T>> clazz() - Summary: Returns the Class object representing the Optional type.
-
Parameters:
- (none)
- Returns: Optional.class with appropriate generic type casting
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Returns the type handler for the element that may be contained in the Optional.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this Optional
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() - Summary: Returns an array containing the parameter types of this generic optional type.
-
Parameters:
- (none)
- Returns: an array containing the value type as the only parameter type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a generic type
defaultValue(...) -> Optional<T>
-
Signature:
@Override public Optional<T> defaultValue() - Summary: Returns the default value for Optional type, which is an empty Optional.
-
Parameters:
- (none)
- Returns: Optional.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Optional<T> x) - Summary: Converts an Optional to its string representation.
-
Contract:
- If the optional is empty or {@code null} , returns {@code null} .
-
Parameters:
-
x(Optional<T>) — the Optional to convert to string
-
- Returns: the string representation of the contained value, or {@code null} if empty or null
valueOf(...) -> Optional<T>
-
Signature:
@Override public Optional<T> valueOf(final String str) - Summary: Parses a string representation into an Optional.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: Optional.empty() if the string is {@code null} , otherwise Optional.ofNullable() of the parsed value
get(...) -> Optional<T>
-
Signature:
@Override public Optional<T> get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an Optional value from the specified column in a ResultSet.
-
Contract:
- If the column value is {@code null} , returns an empty Optional.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the index of the column to read (1-based)
-
- Returns: Optional.empty() if the column is {@code null} , otherwise Optional containing the converted value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Optional<T> get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an Optional value from the specified column in a ResultSet using the column label.
-
Contract:
- If the column value is {@code null} , returns an empty Optional.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to read
-
- Returns: Optional.empty() if the column is {@code null} , otherwise Optional containing the converted value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Optional<T> x) throws SQLException - Summary: Sets an Optional parameter in a PreparedStatement.
-
Contract:
- If the Optional is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(Optional<T>) — the Optional to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Optional<T> x) throws SQLException - Summary: Sets an Optional parameter in a CallableStatement using a parameter name.
-
Contract:
- If the Optional is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Optional<T>) — the Optional to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Optional<T> x) throws IOException - Summary: Appends the string representation of an Optional to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Optional<T>) — the Optional to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Optional<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an Optional to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Optional<T>) — the Optional to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class JodaDateTimeType (com.landawn.abacus.type.JodaDateTimeType)
Type handler for Joda-Time DateTime objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<DateTime>
-
Signature:
@Override public Class<DateTime> clazz() - Summary: Gets the class type for Joda DateTime.
-
Parameters:
- (none)
- Returns: the Class object representing org.joda.time.DateTime
valueOf(...) -> DateTime
-
Signature:
@Override public DateTime valueOf(final Object obj) - Summary: Converts the specified object to a Joda DateTime instance.
-
Parameters:
-
obj(Object) — the object to convert to DateTime
-
- Returns: a DateTime instance, or {@code null} if the input is null
-
Signature:
@Override public DateTime valueOf(final String str) - Summary: Parses a string representation into a Joda DateTime instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a DateTime instance, or {@code null} if the string is empty or null
-
Signature:
@Override public DateTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a Joda DateTime instance.
-
Contract:
- If that fails, it converts the character array to a string and delegates to valueOf(String).
-
Parameters:
-
cbuf(char[]) — the character buffer containing the value to parse -
offset(int) — the start offset in the character buffer -
len(int) — the number of characters to parse
-
- Returns: a DateTime instance, or {@code null} if the character buffer is {@code null} or length is 0
get(...) -> DateTime
-
Signature:
@Override public DateTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a DateTime value from the specified column in a ResultSet.
-
Contract:
- If the timestamp is {@code null} , this method returns {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<DateTime> type = TypeFactory.getType(DateTime.class); try (Connection conn = dataSource.getConnection(); PreparedStatement stmt = conn.prepareStatement("SELECT created_at FROM events WHERE id = ?")) { stmt.setInt(1, eventId); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { DateTime createdAt = type.get(rs, 1); System.out.println("Event created at: " + createdAt); } } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a DateTime instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public DateTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a DateTime value from the specified column in a ResultSet using column label.
-
Contract:
- If the timestamp is {@code null} , this method returns {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<DateTime> type = TypeFactory.getType(DateTime.class); try (Connection conn = dataSource.getConnection(); PreparedStatement stmt = conn.prepareStatement("SELECT created_at, updated_at FROM events WHERE id = ?")) { stmt.setInt(1, eventId); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { DateTime createdAt = type.get(rs, "created_at"); DateTime updatedAt = type.get(rs, "updated_at"); System.out.println("Created: " + createdAt + ", Updated: " + updatedAt); } } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label to retrieve the value from
-
- Returns: a DateTime instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final DateTime x) throws SQLException - Summary: Sets a DateTime parameter in a PreparedStatement.
-
Contract:
- If the DateTime is {@code null} , a SQL NULL is set for the parameter.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(DateTime) — the DateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final DateTime x) throws SQLException - Summary: Sets a named DateTime parameter in a CallableStatement.
-
Contract:
- If the DateTime is {@code null} , a SQL NULL is set for the parameter.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(DateTime) — the DateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class JodaInstantType (com.landawn.abacus.type.JodaInstantType)
Type handler for Joda-Time Instant objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Instant>
-
Signature:
@Override public Class<Instant> clazz() - Summary: Gets the class type for Joda Instant.
-
Parameters:
- (none)
- Returns: the Class object representing org.joda.time.Instant
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Instant x) - Summary: Converts a Joda Instant to its string representation.
-
Parameters:
-
x(Instant) — the Instant to convert
-
- Returns: the string representation of the Instant, or {@code null} if the input is null
valueOf(...) -> Instant
-
Signature:
@Override public Instant valueOf(final String str) - Summary: Parses a string representation into a Joda Instant instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: an Instant instance, or {@code null} if the string is empty or null
-
Signature:
@Override public Instant valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a Joda Instant instance.
-
Contract:
- If that fails, it converts the character array to a string and delegates to valueOf(String).
-
Parameters:
-
cbuf(char[]) — the character buffer containing the value to parse -
offset(int) — the start offset in the character buffer -
len(int) — the number of characters to parse
-
- Returns: an Instant instance, or {@code null} if the character buffer is {@code null} or length is 0
get(...) -> Instant
-
Signature:
@Override public Instant get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an Instant value from the specified column in a ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Instant> type = TypeFactory.getType(Instant.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Instant timestamp = type.get(rs, 1); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an Instant instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Instant get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an Instant value from the specified column in a ResultSet using column name.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Instant> type = TypeFactory.getType(Instant.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Instant timestamp = type.get(rs, "created_at"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label (or name if no label was specified) to retrieve the value from
-
- Returns: an Instant instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column name is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Instant x) throws SQLException - Summary: Sets an Instant parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Instant) — the Instant value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Instant x) throws SQLException - Summary: Sets a named Instant parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Instant) — the Instant value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Instant x) throws IOException - Summary: Appends the string representation of an Instant to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Instant) — the Instant to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final Instant x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an Instant to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Instant) — the Instant to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration specifying format and quoting options
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class JodaMutableDateTimeType (com.landawn.abacus.type.JodaMutableDateTimeType)
Type handler for Joda-Time MutableDateTime objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableDateTime>
-
Signature:
@Override public Class<MutableDateTime> clazz() - Summary: Gets the class type for Joda MutableDateTime.
-
Parameters:
- (none)
- Returns: the Class object representing org.joda.time.MutableDateTime
valueOf(...) -> MutableDateTime
-
Signature:
@Override public MutableDateTime valueOf(final Object obj) - Summary: Converts the specified object to a Joda MutableDateTime instance.
-
Parameters:
-
obj(Object) — the object to convert to MutableDateTime
-
- Returns: a MutableDateTime instance, or {@code null} if the input is null
-
Signature:
@Override public MutableDateTime valueOf(final String str) - Summary: Parses a string representation into a Joda MutableDateTime instance.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a MutableDateTime instance, or {@code null} if the string is empty or null
-
Signature:
@Override public MutableDateTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a Joda MutableDateTime instance.
-
Contract:
- If that fails, it converts the character array to a string and delegates to valueOf(String).
-
Parameters:
-
cbuf(char[]) — the character buffer containing the value to parse -
offset(int) — the start offset in the character buffer -
len(int) — the number of characters to parse
-
- Returns: a MutableDateTime instance, or {@code null} if the character buffer is {@code null} or length is 0
get(...) -> MutableDateTime
-
Signature:
@Override public MutableDateTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableDateTime value from the specified column in a ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableDateTime> type = TypeFactory.getType(MutableDateTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { MutableDateTime dt = type.get(rs, 1); dt.addDays(1); // Can modify after retrieval } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a MutableDateTime instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableDateTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableDateTime value from the specified column in a ResultSet using column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableDateTime> type = TypeFactory.getType(MutableDateTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { MutableDateTime dt = type.get(rs, "created_at"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label to retrieve the value from
-
- Returns: a MutableDateTime instance created from the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableDateTime x) throws SQLException - Summary: Sets a MutableDateTime parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(MutableDateTime) — the MutableDateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableDateTime x) throws SQLException - Summary: Sets a named MutableDateTime parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(MutableDateTime) — the MutableDateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class ListMultimapType (com.landawn.abacus.type.ListMultimapType)
Type handler for ListMultimap serialization and deserialization.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ListMultimap<K, E> x) - Summary: Converts a ListMultimap to its JSON string representation.
-
Parameters:
-
x(ListMultimap<K, E>) — the ListMultimap to convert to JSON string
-
- Returns: the JSON string representation of the multimap, or {@code null} if the input is null
valueOf(...) -> ListMultimap<K, E>
-
Signature:
@SuppressWarnings("unchecked") @Override public ListMultimap<K, E> valueOf(final String str) - Summary: Parses a JSON string into a ListMultimap instance.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a ListMultimap instance populated with the parsed data, or {@code null} if the string is empty or null
Class LocalDateTimeType (com.landawn.abacus.type.LocalDateTimeType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<LocalDateTime>
-
Signature:
@Override public Class<LocalDateTime> clazz() - Summary: Returns the Class object representing the LocalDateTime type.
-
Parameters:
- (none)
- Returns: The Class object for LocalDateTime
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final LocalDateTime x) - Summary: Converts a LocalDateTime object to its string representation.
-
Parameters:
-
x(LocalDateTime) — The LocalDateTime object to convert
-
- Returns: The string representation of the LocalDateTime, or {@code null} if the input is null
valueOf(...) -> LocalDateTime
-
Signature:
@Override public LocalDateTime valueOf(final Object obj) - Summary: Converts an Object to a LocalDateTime.
-
Contract:
- If the object is a Number, it is treated as milliseconds since epoch and converted to LocalDateTime using the default zone ID.
-
Parameters:
-
obj(Object) — The object to convert to LocalDateTime
-
- Returns: The LocalDateTime representation of the object, or {@code null} if the input is null
-
Signature:
@Override public LocalDateTime valueOf(final String str) - Summary: Parses a string to create a LocalDateTime object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: The parsed LocalDateTime object, or {@code null} if the input is {@code null} or empty
-
Signature:
@Override public LocalDateTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a LocalDateTime object.
-
Parameters:
-
cbuf(char[]) — The character array containing the LocalDateTime representation -
offset(int) — The starting position in the character array -
len(int) — The number of characters to use
-
- Returns: The parsed LocalDateTime object, or {@code null} if the input is {@code null} or empty
get(...) -> LocalDateTime
-
Signature:
@Override public LocalDateTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a LocalDateTime value from a ResultSet at the specified column index.
-
Contract:
- If that fails, falls back to retrieving it as a Timestamp and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalDateTime> type = TypeFactory.getType(LocalDateTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalDateTime dt = type.get(rs, 1); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: The LocalDateTime value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public LocalDateTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a LocalDateTime value from a ResultSet using the specified column name.
-
Contract:
- If that fails, falls back to retrieving it as a Timestamp and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalDateTime> type = TypeFactory.getType(LocalDateTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalDateTime dt = type.get(rs, "created_at"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — the column label (or name if no label was specified) to retrieve the value from
-
- Returns: The LocalDateTime value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column name is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final LocalDateTime x) throws SQLException - Summary: Sets a LocalDateTime parameter in a PreparedStatement at the specified position.
-
Contract:
- If that fails, falls back to setting it as a Timestamp.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(LocalDateTime) — The LocalDateTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final LocalDateTime x) throws SQLException - Summary: Sets a LocalDateTime parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If that fails, falls back to setting it as a Timestamp.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(LocalDateTime) — The LocalDateTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class LocalDateType (com.landawn.abacus.type.LocalDateType)
Type handler for {@link java.time.LocalDate} values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<LocalDate>
-
Signature:
@Override public Class<LocalDate> clazz() - Summary: Returns the Class object representing the LocalDate type.
-
Parameters:
- (none)
- Returns: The Class object for LocalDate
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final LocalDate x) - Summary: Converts a LocalDate object to its string representation.
-
Parameters:
-
x(LocalDate) — The LocalDate object to convert
-
- Returns: The string representation of the LocalDate, or {@code null} if the input is null
valueOf(...) -> LocalDate
-
Signature:
@Override public LocalDate valueOf(final Object obj) - Summary: Converts an Object to a LocalDate.
-
Contract:
- If the object is a Number, it is treated as milliseconds since epoch and converted to LocalDate using the default zone ID.
-
Parameters:
-
obj(Object) — The object to convert to LocalDate
-
- Returns: The LocalDate representation of the object, or {@code null} if the input is null
-
Signature:
@Override public LocalDate valueOf(final String str) - Summary: Parses a string to create a LocalDate object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: The parsed LocalDate object, or {@code null} if the input is {@code null} or empty
-
Signature:
@Override public LocalDate valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a LocalDate object.
-
Parameters:
-
cbuf(char[]) — The character array containing the LocalDate representation -
offset(int) — The starting position in the character array -
len(int) — The number of characters to use
-
- Returns: The parsed LocalDate object, or {@code null} if the input is {@code null} or empty
get(...) -> LocalDate
-
Signature:
@Override public LocalDate get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a LocalDate value from a ResultSet at the specified column index.
-
Contract:
- If that fails, falls back to retrieving it as a java.sql.Date and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalDate> type = TypeFactory.getType(LocalDate.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalDate date = type.get(rs, 1); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: The LocalDate value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public LocalDate get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a LocalDate value from a ResultSet using the specified column name.
-
Contract:
- If that fails, falls back to retrieving it as a java.sql.Date and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalDate> type = TypeFactory.getType(LocalDate.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalDate date = type.get(rs, "birth_date"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — the column label (or name if no label was specified) to retrieve the value from
-
- Returns: The LocalDate value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column name is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final LocalDate x) throws SQLException - Summary: Sets a LocalDate parameter in a PreparedStatement at the specified position.
-
Contract:
- If that fails, falls back to setting it as a java.sql.Date.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(LocalDate) — The LocalDate value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final LocalDate x) throws SQLException - Summary: Sets a LocalDate parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If that fails, falls back to setting it as a java.sql.Date.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(LocalDate) — The LocalDate value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class LocalTimeType (com.landawn.abacus.type.LocalTimeType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<LocalTime>
-
Signature:
@Override public Class<LocalTime> clazz() - Summary: Returns the Class object representing the LocalTime type.
-
Parameters:
- (none)
- Returns: The Class object for LocalTime
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final LocalTime x) - Summary: Converts a LocalTime object to its string representation.
-
Parameters:
-
x(LocalTime) — The LocalTime object to convert
-
- Returns: The string representation of the LocalTime, or {@code null} if the input is null
valueOf(...) -> LocalTime
-
Signature:
@Override public LocalTime valueOf(final Object obj) - Summary: Converts an Object to a LocalTime.
-
Contract:
- If the object is a Number, it is treated as milliseconds since epoch and converted to LocalTime using the default zone ID.
-
Parameters:
-
obj(Object) — The object to convert to LocalTime
-
- Returns: The LocalTime representation of the object, or {@code null} if the input is null
-
Signature:
@Override public LocalTime valueOf(final String str) - Summary: Parses a string to create a LocalTime object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: The parsed LocalTime object, or {@code null} if the input is {@code null} or empty
-
Signature:
@Override public LocalTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a LocalTime object.
-
Parameters:
-
cbuf(char[]) — The character array containing the LocalTime representation -
offset(int) — The starting position in the character array -
len(int) — The number of characters to use
-
- Returns: The parsed LocalTime object, or {@code null} if the input is {@code null} or empty
get(...) -> LocalTime
-
Signature:
@Override public LocalTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a LocalTime value from a ResultSet at the specified column index.
-
Contract:
- If that fails, falls back to retrieving it as a java.sql.Time and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalTime> type = TypeFactory.getType(LocalTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalTime time = type.get(rs, 1); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: The LocalTime value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public LocalTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a LocalTime value from a ResultSet using the specified column name.
-
Contract:
- If that fails, falls back to retrieving it as a java.sql.Time and converting it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<LocalTime> type = TypeFactory.getType(LocalTime.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { LocalTime time = type.get(rs, "start_time"); } } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — the column label (or name if no label was specified) to retrieve the value from
-
- Returns: The LocalTime value from the ResultSet, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column name is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final LocalTime x) throws SQLException - Summary: Sets a LocalTime parameter in a PreparedStatement at the specified position.
-
Contract:
- If that fails, falls back to setting it as a java.sql.Time.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(LocalTime) — The LocalTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final LocalTime x) throws SQLException - Summary: Sets a LocalTime parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If that fails, falls back to setting it as a java.sql.Time.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(LocalTime) — The LocalTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class LongArrayType (com.landawn.abacus.type.LongArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Long[] x) - Summary: Converts a Long array to its string representation.
-
Parameters:
-
x(Long[]) — The Long array to convert
-
- Returns: The string representation of the array in format "\[value1, value2, ...\]", or {@code null} if the input array is {@code null} , or "\[\]" if the array is empty
valueOf(...) -> Long\[\]
-
Signature:
@Override public Long[] valueOf(final String str) - Summary: Parses a string to create a Long array.
-
Contract:
- The string should be in the format "\[value1, value2, ...\]" where each value is either a long number or "null".
-
Parameters:
-
str(String) — The string to parse
-
- Returns: The parsed Long array, or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Long[] x) throws IOException - Summary: Appends the string representation of a Long array to an Appendable.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(Long[]) — The Long array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Long[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Long array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(Long[]) — The Long array to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration (currently unused for Long arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class LongType (com.landawn.abacus.type.LongType)
Type handler for Long wrapper type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Long class.
-
Parameters:
- (none)
- Returns: the Class object for Long.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Long is a primitive wrapper
get(...) -> Long
-
Signature:
@Override public Long get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Long value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Long value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Long get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Long value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Long value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class MapEntityType (com.landawn.abacus.type.MapEntityType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MapEntity>
-
Signature:
@Override public Class<MapEntity> clazz() - Summary: Returns the Class object representing the MapEntity type.
-
Parameters:
- (none)
- Returns: The Class object for MapEntity
isMapEntity(...) -> boolean
-
Signature:
@Override public boolean isMapEntity() - Summary: Indicates whether this type represents a MapEntity.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that this type represents a MapEntity
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code false} , indicating that MapEntity is not serializable through this type
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type category for MapEntity.
-
Contract:
- This indicates how the MapEntity should be treated during serialization processes.
-
Parameters:
- (none)
- Returns: SerializationType.MAP_ENTITY
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MapEntity x) - Summary: Converts a MapEntity object to its JSON string representation.
-
Parameters:
-
x(MapEntity) — The MapEntity object to convert
-
- Returns: The JSON string representation of the MapEntity, or {@code null} if the input is null
valueOf(...) -> MapEntity
-
Signature:
@Override public MapEntity valueOf(final String str) - Summary: Parses a JSON string to create a MapEntity object.
-
Contract:
- The string should be a valid JSON object representation that can be deserialized into a MapEntity.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed MapEntity object, or {@code null} if the input is {@code null} or empty
Class MapEntryType (com.landawn.abacus.type.MapEntryType)
Type handler for Map.Entry objects with generic key and value types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this MapEntry type.
-
Parameters:
- (none)
- Returns: The declaring name in format "Map.Entry < KeyDeclaringName, ValueDeclaringName > "
clazz(...) -> Class<Map.Entry<K, V>>
-
Signature:
@Override public Class<Map.Entry<K, V>> clazz() - Summary: Returns the Class object representing the Map.Entry type.
-
Parameters:
- (none)
- Returns: The Class object for Map.Entry
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Gets the parameter types for this generic Map.Entry type.
-
Parameters:
- (none)
- Returns: An array containing the key type and value type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Map.Entry is a generic type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Map.Entry<K, V> x) - Summary: Converts a Map.Entry object to its JSON string representation.
-
Parameters:
-
x(Map.Entry<K, V>) — The Map.Entry object to convert
-
- Returns: The JSON string representation in format "{key:value}", or {@code null} if the input is null
valueOf(...) -> Map.Entry<K, V>
-
Signature:
@Override public Map.Entry<K, V> valueOf(final String str) - Summary: Parses a JSON string to create a Map.Entry object.
-
Contract:
- The string should represent a JSON object with exactly one key-value pair.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed Map.Entry object, or {@code null} if the input is {@code null} , empty, or represents an empty object "{}"
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Map.Entry<K, V> x) throws IOException - Summary: Appends the string representation of a Map.Entry to an Appendable.
-
Contract:
- If the Appendable is a Writer, buffering is used for better performance.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(Map.Entry<K, V>) — The Map.Entry to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Map.Entry<K, V> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Map.Entry to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(Map.Entry<K, V>) — The Map.Entry to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration to use for formatting
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MapType (com.landawn.abacus.type.MapType)
Type handler for Map objects with generic key and value types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this Map type.
-
Parameters:
- (none)
- Returns: The declaring name in format "MapClass < KeyDeclaringName, ValueDeclaringName > "
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the specific Map implementation type.
-
Parameters:
- (none)
- Returns: The Class object for the Map implementation
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Gets the parameter types for this generic Map type.
-
Parameters:
- (none)
- Returns: An array containing the key type and value type
isMap(...) -> boolean
-
Signature:
@Override public boolean isMap() - Summary: Indicates whether this type represents a Map.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that this type represents a Map
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Map is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code false} , indicating that Map is not serializable through this type
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Gets the serialization type category for Map.
-
Contract:
- This indicates how the Map should be treated during serialization processes.
-
Parameters:
- (none)
- Returns: SerializationType.MAP
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a Map object to its JSON string representation.
-
Parameters:
-
x(T) — The Map object to convert
-
- Returns: The JSON string representation of the Map, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Parses a JSON string to create a Map object.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed Map object, or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a Map to an Appendable.
-
Contract:
- If the Appendable is a Writer, the serialization is performed directly to the Writer for better performance.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(T) — The Map to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
Class MillisCalendarType (com.landawn.abacus.type.MillisCalendarType)
Type handler for {@link Calendar} objects that stores and retrieves them as milliseconds in the database.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Calendar
-
Signature:
@Override public Calendar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Calendar value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnIndex(int) — the index of the column to retrieve (1-based)
-
- Returns: a Calendar object created from the milliseconds value, or {@code null} if the database value was 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Calendar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Calendar value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnName(String) — the label of the column to retrieve
-
- Returns: a Calendar object created from the milliseconds value, or {@code null} if the database value was 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Calendar x) throws SQLException - Summary: Sets a Calendar value at the specified parameter index in the PreparedStatement.
-
Contract:
- If the Calendar is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(Calendar) — the Calendar value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Calendar x) throws SQLException - Summary: Sets a Calendar value for the specified parameter name in the CallableStatement.
-
Contract:
- If the Calendar is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Calendar) — the Calendar value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is not found
-
Class MillisDateType (com.landawn.abacus.type.MillisDateType)
Type handler for {@link Date} objects that stores and retrieves them as milliseconds in the database.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Date
-
Signature:
@Override public Date get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Date value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A Date object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Date get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Date value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A Date object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Date x) throws SQLException - Summary: Sets a Date parameter in a PreparedStatement at the specified position.
-
Contract:
- If the Date is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(Date) — The Date value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Date x) throws SQLException - Summary: Sets a Date parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the Date is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(Date) — The Date value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class MillisTimeType (com.landawn.abacus.type.MillisTimeType)
Type handler for {@link Time} objects that stores and retrieves them as milliseconds in the database.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Time
-
Signature:
@Override public Time get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Time value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A Time object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Time get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Time value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A Time object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Time x) throws SQLException - Summary: Sets a Time parameter in a PreparedStatement at the specified position.
-
Contract:
- If the Time is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(Time) — The Time value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Time x) throws SQLException - Summary: Sets a Time parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the Time is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(Time) — The Time value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class MillisTimestampType (com.landawn.abacus.type.MillisTimestampType)
Type handler for {@link Timestamp} objects that stores and retrieves them as milliseconds in the database.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Timestamp
-
Signature:
@Override public Timestamp get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Timestamp value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A Timestamp object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Timestamp get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Timestamp value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A Timestamp object created from the milliseconds value, or {@code null} if the value is 0
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Timestamp x) throws SQLException - Summary: Sets a Timestamp parameter in a PreparedStatement at the specified position.
-
Contract:
- If the Timestamp is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(Timestamp) — The Timestamp value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Timestamp x) throws SQLException - Summary: Sets a Timestamp parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the Timestamp is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(Timestamp) — The Timestamp value to set, or {@code null} to store 0
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class MultimapType (com.landawn.abacus.type.MultimapType)
Type handler for Multimap objects with generic key, element, and collection value types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this Multimap type.
-
Parameters:
- (none)
- Returns: The declaring name in format "MultimapClass < KeyDeclaringName\[, ElementDeclaringName\]\[, ValueDeclaringName\] > "
clazz(...) -> Class<T>
-
Signature:
@SuppressWarnings({ "rawtypes" }) @Override public Class<T> clazz() - Summary: Returns the Class object representing the specific Multimap implementation type.
-
Parameters:
- (none)
- Returns: The Class object for the Multimap implementation
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Gets the parameter types for this generic Multimap type.
-
Contract:
- The array contains: - Two elements if either valueElementTypeName or valueTypeName was empty: \[keyType, valueType/elementType\] - Three elements if both were provided: \[keyType, elementType, valueType\] <p> <b> Usage Examples: </b> </p> <pre> {@code Type<ListMultimap<String, Integer>> type = TypeFactory.getType("ListMultimap<String, Integer>"); Type<?>\[\] paramTypes = type.getParameterTypes(); // Returns: \[StringType, IntegerType\] // paramTypes\[0\] is the key type (String) // paramTypes\[1\] is the element type (Integer) } </pre>
-
Parameters:
- (none)
- Returns: An array containing the parameter types
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Multimap is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Multimap is serializable through this type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a Multimap object to its JSON string representation.
-
Parameters:
-
x(T) — The Multimap object to convert
-
- Returns: The JSON string representation of the Multimap, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Parses a JSON string to create a Multimap object.
-
Contract:
- The string should represent a JSON object where each key maps to an array of values.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed Multimap object, or {@code null} if the input is {@code null} or empty
Class MultisetType (com.landawn.abacus.type.MultisetType)
Type handler for Multiset objects with a generic element type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this Multiset type.
-
Parameters:
- (none)
- Returns: The declaring name in format "Multiset < ElementDeclaringName > "
clazz(...) -> Class<Multiset<E>>
-
Signature:
@Override public Class<Multiset<E>> clazz() - Summary: Returns the Class object representing the Multiset type.
-
Parameters:
- (none)
- Returns: The Class object for Multiset
getElementType(...) -> Type<E>
-
Signature:
@Override public Type<E> getElementType() - Summary: Returns the type handler for the elements contained in this multiset.
-
Parameters:
- (none)
- Returns: the Type instance representing the element type of this multiset
getParameterTypes(...) -> Type<E>\[\]
-
Signature:
@Override public Type<E>[] getParameterTypes() - Summary: Gets the parameter types for this generic Multiset type.
-
Parameters:
- (none)
- Returns: An array containing the element type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Multiset is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether instances of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Multiset is serializable through this type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Multiset<E> x) - Summary: Converts a Multiset object to its JSON string representation.
-
Parameters:
-
x(Multiset<E>) — The Multiset object to convert
-
- Returns: The JSON string representation of the Multiset as a map of element to count, or {@code null} if the input is null
valueOf(...) -> Multiset<E>
-
Signature:
@Override public Multiset<E> valueOf(final String str) - Summary: Parses a JSON string to create a Multiset object.
-
Contract:
- The string should represent a JSON object where each key is an element and the value is its count.
-
Parameters:
-
str(String) — The JSON string to parse
-
- Returns: The parsed Multiset object, or {@code null} if the input is {@code null} or empty
Class MutableBooleanType (com.landawn.abacus.type.MutableBooleanType)
Type handler for {@link com.landawn.abacus.util.MutableBoolean} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableBoolean>
-
Signature:
@Override public Class<MutableBoolean> clazz() - Summary: Returns the Class object representing the MutableBoolean type.
-
Parameters:
- (none)
- Returns: The Class object for MutableBoolean
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type are comparable.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that MutableBoolean values can be compared
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableBoolean x) - Summary: Converts a MutableBoolean object to its string representation.
-
Parameters:
-
x(MutableBoolean) — The MutableBoolean object to convert
-
- Returns: The string representation ("true" or "false"), or {@code null} if the input is null
valueOf(...) -> MutableBoolean
-
Signature:
@Override public MutableBoolean valueOf(final String str) - Summary: Parses a string to create a MutableBoolean object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: A MutableBoolean containing the parsed value, or {@code null} if the input is {@code null} or empty
get(...) -> MutableBoolean
-
Signature:
@Override public MutableBoolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableBoolean value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A MutableBoolean containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableBoolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableBoolean value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A MutableBoolean containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableBoolean x) throws SQLException - Summary: Sets a MutableBoolean parameter in a PreparedStatement at the specified position.
-
Contract:
- If the MutableBoolean is {@code null} , {@code false} is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(MutableBoolean) — The MutableBoolean value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableBoolean x) throws SQLException - Summary: Sets a MutableBoolean parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the MutableBoolean is {@code null} , {@code false} is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(MutableBoolean) — The MutableBoolean value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableBoolean x) throws IOException - Summary: Appends the string representation of a MutableBoolean to an Appendable.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(MutableBoolean) — The MutableBoolean to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableBoolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableBoolean to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(MutableBoolean) — The MutableBoolean to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration (currently unused for boolean values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MutableByteType (com.landawn.abacus.type.MutableByteType)
Type handler for {@link com.landawn.abacus.util.MutableByte} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableByte>
-
Signature:
@Override public Class<MutableByte> clazz() - Summary: Returns the Class object representing the MutableByte type.
-
Parameters:
- (none)
- Returns: The Class object for MutableByte
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableByte x) - Summary: Converts a MutableByte object to its string representation.
-
Parameters:
-
x(MutableByte) — The MutableByte object to convert
-
- Returns: The string representation of the byte value, or {@code null} if the input is null
valueOf(...) -> MutableByte
-
Signature:
@Override public MutableByte valueOf(final String str) - Summary: Parses a string to create a MutableByte object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: A MutableByte containing the parsed value, or {@code null} if the input is {@code null} or empty
get(...) -> MutableByte
-
Signature:
@Override public MutableByte get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableByte value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A MutableByte containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableByte get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableByte value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A MutableByte containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableByte x) throws SQLException - Summary: Sets a MutableByte parameter in a PreparedStatement at the specified position.
-
Contract:
- If the MutableByte is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(MutableByte) — The MutableByte value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableByte x) throws SQLException - Summary: Sets a MutableByte parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the MutableByte is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(MutableByte) — The MutableByte value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableByte x) throws IOException - Summary: Appends the string representation of a MutableByte to an Appendable.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(MutableByte) — The MutableByte to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableByte x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableByte to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(MutableByte) — The MutableByte to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration (currently unused for byte values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MutableCharType (com.landawn.abacus.type.MutableCharType)
Type handler for {@link com.landawn.abacus.util.MutableChar} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableChar>
-
Signature:
@Override public Class<MutableChar> clazz() - Summary: Returns the Class object representing the MutableChar type.
-
Parameters:
- (none)
- Returns: The Class object for MutableChar
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableChar x) - Summary: Converts a MutableChar object to its string representation.
-
Parameters:
-
x(MutableChar) — The MutableChar object to convert
-
- Returns: The string representation of the character, or {@code null} if the input is null
valueOf(...) -> MutableChar
-
Signature:
@Override public MutableChar valueOf(final String str) - Summary: Parses a string to create a MutableChar object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: A MutableChar containing the parsed character, or {@code null} if the input is {@code null} or empty
get(...) -> MutableChar
-
Signature:
@Override public MutableChar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableChar value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableChar> type = TypeFactory.getType(MutableChar.class); ResultSet rs = statement.executeQuery("SELECT char_column FROM table"); if (rs.next()) { MutableChar mc = type.get(rs, 1); // mc contains the character value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A MutableChar containing the retrieved character value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableChar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableChar value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableChar> type = TypeFactory.getType(MutableChar.class); ResultSet rs = statement.executeQuery("SELECT char_col FROM table"); if (rs.next()) { MutableChar mc = type.get(rs, "char_col"); // mc contains the character value from the named column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A MutableChar containing the retrieved character value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableChar x) throws SQLException - Summary: Sets a MutableChar parameter in a PreparedStatement at the specified position.
-
Contract:
- If the MutableChar is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(MutableChar) — The MutableChar value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableChar x) throws SQLException - Summary: Sets a MutableChar parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the MutableChar is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(MutableChar) — The MutableChar value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableChar x) throws IOException - Summary: Appends the string representation of a MutableChar to an Appendable.
-
Contract:
- The character is written directly or "null" if the value is {@code null} .
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(MutableChar) — The MutableChar to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableChar x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableChar to a CharacterWriter.
-
Contract:
- If {@code null} , writes the {@code null} character array.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(MutableChar) — The MutableChar to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration that may specify character quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MutableDoubleType (com.landawn.abacus.type.MutableDoubleType)
Type handler for {@link com.landawn.abacus.util.MutableDouble} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableDouble>
-
Signature:
@Override public Class<MutableDouble> clazz() - Summary: Returns the Class object representing the MutableDouble type.
-
Parameters:
- (none)
- Returns: The Class object for MutableDouble
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableDouble x) - Summary: Converts a MutableDouble object to its string representation.
-
Parameters:
-
x(MutableDouble) — The MutableDouble object to convert
-
- Returns: The string representation of the double value, or {@code null} if the input is null
valueOf(...) -> MutableDouble
-
Signature:
@Override public MutableDouble valueOf(final String str) - Summary: Parses a string to create a MutableDouble object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: A MutableDouble containing the parsed value, or {@code null} if the input is {@code null} or empty
get(...) -> MutableDouble
-
Signature:
@Override public MutableDouble get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableDouble value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableDouble> type = TypeFactory.getType(MutableDouble.class); ResultSet rs = statement.executeQuery("SELECT price FROM products"); if (rs.next()) { MutableDouble price = type.get(rs, 1); // price contains the double value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A MutableDouble containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableDouble get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableDouble value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableDouble> type = TypeFactory.getType(MutableDouble.class); ResultSet rs = statement.executeQuery("SELECT price FROM products"); if (rs.next()) { MutableDouble price = type.get(rs, "price"); // price contains the double value from the named column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A MutableDouble containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableDouble x) throws SQLException - Summary: Sets a MutableDouble parameter in a PreparedStatement at the specified position.
-
Contract:
- If the MutableDouble is {@code null} , 0.0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(MutableDouble) — The MutableDouble value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableDouble x) throws SQLException - Summary: Sets a MutableDouble parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the MutableDouble is {@code null} , 0.0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(MutableDouble) — The MutableDouble value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableDouble x) throws IOException - Summary: Appends the string representation of a MutableDouble to an Appendable.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(MutableDouble) — The MutableDouble to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableDouble x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableDouble to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(MutableDouble) — The MutableDouble to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration (currently unused for double values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MutableFloatType (com.landawn.abacus.type.MutableFloatType)
Type handler for {@link MutableFloat} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableFloat>
-
Signature:
@Override public Class<MutableFloat> clazz() - Summary: Returns the Class object representing the MutableFloat type.
-
Parameters:
- (none)
- Returns: the Class object for MutableFloat
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableFloat x) - Summary: Converts a MutableFloat object to its string representation.
-
Parameters:
-
x(MutableFloat) — the MutableFloat object to convert
-
- Returns: the string representation of the float value, or {@code null} if x is null
valueOf(...) -> MutableFloat
-
Signature:
@Override public MutableFloat valueOf(final String str) - Summary: Creates a MutableFloat object from its string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a MutableFloat containing the parsed value, or {@code null} if str is empty
get(...) -> MutableFloat
-
Signature:
@Override public MutableFloat get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableFloat value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableFloat> type = TypeFactory.getType(MutableFloat.class); ResultSet rs = statement.executeQuery("SELECT price FROM products"); if (rs.next()) { MutableFloat price = type.get(rs, 1); // price contains the float value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnIndex(int) — the index of the column to retrieve (1-based)
-
- Returns: a MutableFloat containing the retrieved float value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public MutableFloat get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableFloat value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableFloat> type = TypeFactory.getType(MutableFloat.class); ResultSet rs = statement.executeQuery("SELECT price FROM products"); if (rs.next()) { MutableFloat price = type.get(rs, "price"); // price contains the float value from the "price" column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnName(String) — the label of the column to retrieve
-
- Returns: a MutableFloat containing the retrieved float value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableFloat x) throws SQLException - Summary: Sets a MutableFloat value at the specified parameter index in the PreparedStatement.
-
Contract:
- If the MutableFloat is {@code null} , sets 0.0f as the value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(MutableFloat) — the MutableFloat value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableFloat x) throws SQLException - Summary: Sets a MutableFloat value for the specified parameter name in the CallableStatement.
-
Contract:
- If the MutableFloat is {@code null} , sets 0.0f as the value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(MutableFloat) — the MutableFloat value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableFloat x) throws IOException - Summary: Appends the string representation of a MutableFloat to the given Appendable.
-
Contract:
- Writes "null" if the MutableFloat is {@code null} , otherwise writes the string representation of the float value.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(MutableFloat) — the MutableFloat value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableFloat x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableFloat to the given CharacterWriter.
-
Contract:
- Writes {@code null} characters if the MutableFloat is {@code null} , otherwise writes the float value directly.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(MutableFloat) — the MutableFloat value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (may be used for formatting)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class MutableIntType (com.landawn.abacus.type.MutableIntType)
Type handler for {@link com.landawn.abacus.util.MutableInt} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableInt>
-
Signature:
@Override public Class<MutableInt> clazz() - Summary: Returns the Class object representing the MutableInt type.
-
Parameters:
- (none)
- Returns: The Class object for MutableInt
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableInt x) - Summary: Converts a MutableInt object to its string representation.
-
Parameters:
-
x(MutableInt) — The MutableInt object to convert
-
- Returns: The string representation of the integer value, or {@code null} if the input is null
valueOf(...) -> MutableInt
-
Signature:
@Override public MutableInt valueOf(final String str) - Summary: Parses a string to create a MutableInt object.
-
Parameters:
-
str(String) — The string to parse
-
- Returns: A MutableInt containing the parsed value, or {@code null} if the input is {@code null} or empty
get(...) -> MutableInt
-
Signature:
@Override public MutableInt get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a MutableInt value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableInt> type = TypeFactory.getType(MutableInt.class); ResultSet rs = statement.executeQuery("SELECT age FROM users"); if (rs.next()) { MutableInt age = type.get(rs, 1); // age contains the integer value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnIndex(int) — The column index (1-based) to retrieve the value from
-
- Returns: A MutableInt containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public MutableInt get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a MutableInt value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableInt> type = TypeFactory.getType(MutableInt.class); ResultSet rs = statement.executeQuery("SELECT age FROM users"); if (rs.next()) { MutableInt age = type.get(rs, "age"); // age contains the integer value from the named column } } </pre>
-
Parameters:
-
rs(ResultSet) — The ResultSet containing the data -
columnName(String) — The label of the column to retrieve the value from
-
- Returns: A MutableInt containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableInt x) throws SQLException - Summary: Sets a MutableInt parameter in a PreparedStatement at the specified position.
-
Contract:
- If the MutableInt is {@code null} , 0 is stored.
-
Parameters:
-
stmt(PreparedStatement) — The PreparedStatement to set the parameter on -
columnIndex(int) — The parameter index (1-based) to set -
x(MutableInt) — The MutableInt value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableInt x) throws SQLException - Summary: Sets a MutableInt parameter in a CallableStatement using the specified parameter name.
-
Contract:
- If the MutableInt is {@code null} , 0 is stored.
-
Parameters:
-
stmt(CallableStatement) — The CallableStatement to set the parameter on -
parameterName(String) — The name of the parameter to set -
x(MutableInt) — The MutableInt value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableInt x) throws IOException - Summary: Appends the string representation of a MutableInt to an Appendable.
-
Parameters:
-
appendable(Appendable) — The Appendable to write to -
x(MutableInt) — The MutableInt to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while appending
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableInt x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a MutableInt to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — The CharacterWriter to write to -
x(MutableInt) — The MutableInt to write -
config(JsonXmlSerializationConfig<?>) — The serialization configuration (currently unused for integer values)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while writing
-
Class MutableLongType (com.landawn.abacus.type.MutableLongType)
Type handler for {@link MutableLong} objects, providing serialization, deserialization, and database interaction capabilities for mutable long wrapper objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableLong>
-
Signature:
@Override public Class<MutableLong> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link MutableLong} class object
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableLong x) - Summary: Converts a {@link MutableLong} object to its string representation.
-
Parameters:
-
x(MutableLong) — the MutableLong object to convert
-
- Returns: the string representation of the long value, or {@code null} if the input is null
valueOf(...) -> MutableLong
-
Signature:
@Override public MutableLong valueOf(final String str) - Summary: Converts a string representation to a {@link MutableLong} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: a MutableLong containing the parsed long value, or {@code null} if the input string is empty or null
get(...) -> MutableLong
-
Signature:
@Override public MutableLong get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a {@link MutableLong} value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableLong> type = TypeFactory.getType(MutableLong.class); ResultSet rs = statement.executeQuery("SELECT user_id FROM users"); if (rs.next()) { MutableLong userId = type.get(rs, 1); // userId contains the long value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a MutableLong containing the long value from the ResultSet
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public MutableLong get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a {@link MutableLong} value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableLong> type = TypeFactory.getType(MutableLong.class); ResultSet rs = statement.executeQuery("SELECT user_id FROM users"); if (rs.next()) { MutableLong userId = type.get(rs, "user_id"); // userId contains the long value from the "user_id" column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: a MutableLong containing the long value from the ResultSet
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableLong x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value of a {@link MutableLong} .
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(MutableLong) — the MutableLong value to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableLong x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value of a {@link MutableLong} .
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(MutableLong) — the MutableLong value to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableLong x) throws IOException - Summary: Appends the string representation of a {@link MutableLong} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(MutableLong) — the MutableLong value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableLong x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a {@link MutableLong} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(MutableLong) — the MutableLong value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class MutableShortType (com.landawn.abacus.type.MutableShortType)
Type handler for {@link MutableShort} objects, providing serialization, deserialization, and database interaction capabilities for mutable short wrapper objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<MutableShort>
-
Signature:
@Override public Class<MutableShort> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link MutableShort} class object
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final MutableShort x) - Summary: Converts a {@link MutableShort} object to its string representation.
-
Parameters:
-
x(MutableShort) — the MutableShort object to convert
-
- Returns: the string representation of the short value, or {@code null} if the input is null
valueOf(...) -> MutableShort
-
Signature:
@Override public MutableShort valueOf(final String str) - Summary: Converts a string representation to a {@link MutableShort} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: a MutableShort containing the parsed short value, or {@code null} if the input string is empty or null
get(...) -> MutableShort
-
Signature:
@Override public MutableShort get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a {@link MutableShort} value from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableShort> type = TypeFactory.getType(MutableShort.class); ResultSet rs = statement.executeQuery("SELECT age FROM users"); if (rs.next()) { MutableShort age = type.get(rs, 1); // age contains the short value from the first column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a MutableShort containing the short value from the ResultSet
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public MutableShort get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a {@link MutableShort} value from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<MutableShort> type = TypeFactory.getType(MutableShort.class); ResultSet rs = statement.executeQuery("SELECT age FROM users"); if (rs.next()) { MutableShort age = type.get(rs, "age"); // age contains the short value from the "age" column } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: a MutableShort containing the short value from the ResultSet
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final MutableShort x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value of a {@link MutableShort} .
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(MutableShort) — the MutableShort value to set, or {@code null} (will be stored as 0)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final MutableShort x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value of a {@link MutableShort} .
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(MutableShort) — the MutableShort value to set, or {@code null} (will be stored as 0)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final MutableShort x) throws IOException - Summary: Appends the string representation of a {@link MutableShort} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(MutableShort) — the MutableShort value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final MutableShort x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a {@link MutableShort} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(MutableShort) — the MutableShort value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class MutableType (com.landawn.abacus.type.MutableType)
An abstract base class for type handlers that work with mutable objects implementing {@link Mutable} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class NCharacterStreamType (com.landawn.abacus.type.NCharacterStreamType)
Type handler for NCharacterStream (National Character Stream) objects, providing database interaction capabilities for handling Unicode character streams in SQL operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Reader
-
Signature:
@Override public Reader get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a national character stream (Reader) from a ResultSet at the specified column index.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Reader> type = TypeFactory.getType(Reader.class); ResultSet rs = org.mockito.Mockito.mock(ResultSet.class); // Reading Unicode text from NCLOB column Reader reader = type.get(rs, 1); if (reader != null) { String content = IOUtils.readAllChars(reader); reader.close(); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the character stream from
-
- Returns: a Reader for the national character stream, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Reader get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a national character stream (Reader) from a ResultSet using the specified column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Reader> type = TypeFactory.getType(Reader.class); ResultSet rs = org.mockito.Mockito.mock(ResultSet.class); // Reading Unicode text from NCLOB column by name Reader reader = type.get(rs, "description"); if (reader != null) { BufferedReader br = new BufferedReader(reader); String line; while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: a Reader for the national character stream, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to a national character stream value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the Unicode character stream to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to a national character stream value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the Unicode character stream to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter in a PreparedStatement to a national character stream value with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the Unicode character stream to set -
sqlTypeOrLength(int) — the number of characters in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a named parameter in a CallableStatement to a national character stream value with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the Unicode character stream to set -
sqlTypeOrLength(int) — the number of characters in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
Class NClobReaderType (com.landawn.abacus.type.NClobReaderType)
Type handler for NClobReader objects, providing database interaction capabilities for handling National Character Large Objects (NCLOB) as Reader streams.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> Reader
-
Signature:
@Override public Reader get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an NCLOB value from a ResultSet at the specified column index and converts it to a Reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Reader> type = TypeFactory.getType("NClobReader"); ResultSet rs = org.mockito.Mockito.mock(ResultSet.class); // Reading NCLOB content from database Reader reader = type.get(rs, 1); if (reader != null) { String content = IOUtils.readAllChars(reader); reader.close(); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the NCLOB from
-
- Returns: a Reader for the NCLOB character stream, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Reader get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an NCLOB value from a ResultSet using the specified column label and converts it to a Reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Reader> type = TypeFactory.getType("NClobReader"); ResultSet rs = org.mockito.Mockito.mock(ResultSet.class); // Reading NCLOB by column name Reader reader = type.get(rs, "document_content"); if (reader != null) { BufferedReader br = new BufferedReader(reader); String line; while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: a Reader for the NCLOB character stream, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to an NCLOB value using a Reader.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the character data to be stored as NCLOB
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to an NCLOB value using a Reader.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the character data to be stored as NCLOB
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter in a PreparedStatement to an NCLOB value using a Reader with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Reader) — the Reader containing the character data to be stored as NCLOB -
sqlTypeOrLength(int) — the number of characters in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a named parameter in a CallableStatement to an NCLOB value using a Reader with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader containing the character data to be stored as NCLOB -
sqlTypeOrLength(int) — the number of characters in the stream
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
Class NClobType (com.landawn.abacus.type.NClobType)
Type handler for {@link NClob} (National Character Large Object) objects, providing database interaction capabilities for handling large Unicode text data.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<NClob>
-
Signature:
@Override public Class<NClob> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link NClob} class object
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final NClob x) throws UnsupportedOperationException - Summary: Converts an {@link NClob} object to its string representation.
-
Parameters:
-
x(NClob) — the NClob object to convert
-
- Returns: the string content of the NClob, or {@code null} if the input is null
-
Throws:
-
java.lang.UnsupportedOperationException— if the NCLOB length exceeds {@link Integer#MAX_VALUE}
-
valueOf(...) -> NClob
-
Signature:
@Override public NClob valueOf(final String str) throws UnsupportedOperationException - Summary: Converts a string representation to an {@link NClob} object.
-
Contract:
- This operation is not supported as NCLOBs cannot be created from strings directly and must be obtained from database operations.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as this operation is not supported
-
get(...) -> NClob
-
Signature:
@Override public NClob get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an {@link NClob} value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the NCLOB from
-
- Returns: the NClob object from the ResultSet, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public NClob get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an {@link NClob} value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: the NClob object from the ResultSet, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final NClob x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to an {@link NClob} value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(NClob) — the NClob value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final NClob x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to an {@link NClob} value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(NClob) — the NClob value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
Class NStringType (com.landawn.abacus.type.NStringType)
Type handler for National String (NString) values, providing database interaction capabilities for handling Unicode string data using national character sets.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> String
-
Signature:
@Override public String get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a national character string value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the string from
-
- Returns: the national string value from the ResultSet, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public String get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a national character string value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: the national string value from the ResultSet, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final String x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to a national character string value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(String) — the national string value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final String x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to a national character string value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(String) — the national string value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
Class NullableType (com.landawn.abacus.type.NullableType)
Generic type handler for {@link Nullable} wrapper objects, providing serialization, deserialization, and database interaction capabilities for {@code nullable} values of any type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes the full generic type declaration.
-
Parameters:
- (none)
- Returns: the declaring name with generic type information
clazz(...) -> Class<Nullable<T>>
-
Signature:
@SuppressWarnings("rawtypes") @Override public Class<Nullable<T>> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link Nullable} class object
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Gets the type handler for the element type contained within the {@code Nullable} .
-
Parameters:
- (none)
- Returns: the Type handler for the wrapped element type
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() - Summary: Gets the array of parameter types for this generic type.
-
Parameters:
- (none)
- Returns: an array containing the element type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
defaultValue(...) -> Nullable<T>
-
Signature:
@Override public Nullable<T> defaultValue() - Summary: Returns the default value for {@code Nullable} type, which is an empty {@code Nullable} .
-
Parameters:
- (none)
- Returns: {@code Nullable} .empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Nullable<T> x) - Summary: Converts a {@link Nullable} object to its string representation.
-
Contract:
- If the {@code Nullable} is {@code null} or contains {@code null} , returns {@code null} .
-
Parameters:
-
x(Nullable<T>) — the {@code Nullable} object to convert
-
- Returns: the string representation of the contained value, or {@code null} if empty
valueOf(...) -> Nullable<T>
-
Signature:
@Override public Nullable<T> valueOf(final String str) - Summary: Converts a string representation to a {@link Nullable} object.
-
Contract:
- If the string is {@code null} , returns an empty {@code Nullable} .
-
Parameters:
-
str(String) — the string to convert
-
- Returns: a {@code Nullable} containing the parsed value, or empty {@code Nullable} if input is null
get(...) -> Nullable<T>
-
Signature:
@Override public Nullable<T> get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a value from a ResultSet at the specified column index and wraps it in a {@link Nullable} .
-
Contract:
- The method attempts to convert the retrieved value to the element type if necessary.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: a non-empty {@code Nullable} containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Nullable<T> get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a value from a ResultSet using the specified column label and wraps it in a {@link Nullable} .
-
Contract:
- The method attempts to convert the retrieved value to the element type if necessary.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: a non-empty {@code Nullable} containing the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Nullable<T> x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in a {@link Nullable} .
-
Contract:
- If the {@code Nullable} is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Nullable<T>) — the {@code Nullable} value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Nullable<T> x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in a {@link Nullable} .
-
Contract:
- If the {@code Nullable} is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Nullable<T>) — the {@code Nullable} value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Nullable<T> x) throws IOException - Summary: Appends the string representation of a {@link Nullable} to an Appendable.
-
Contract:
- If the {@code Nullable} is {@code null} or empty, appends the NULL_STRING constant.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Nullable<T>) — the {@code Nullable} value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Nullable<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a {@link Nullable} to a CharacterWriter.
-
Contract:
- If the {@code Nullable} is {@code null} or empty, writes the NULL_CHAR_ARRAY.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Nullable<T>) — the {@code Nullable} value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class NumberType (com.landawn.abacus.type.NumberType)
Abstract base type handler for {@link Number} subclasses, providing common functionality for numeric type handling including serialization, deserialization, and type conversions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
isNumber(...) -> boolean
-
Signature:
@Override public boolean isNumber() - Summary: Indicates whether this type represents a numeric value.
-
Parameters:
- (none)
- Returns: {@code true} , as this is a number type
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating numeric values don't need quotes in CSV
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the class object for the specific Number subclass
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts a string representation to an instance of the number type.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an instance of the number type, or {@code null} if the input string is empty or null
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts a number object to its string representation.
-
Parameters:
-
x(T) — the number object to convert
-
- Returns: the string representation using toString(), or {@code null} if the input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T x) throws IOException - Summary: Appends the string representation of a number to an Appendable.
-
Contract:
- <p> If the number is {@code null} , appends the string "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T) — the number value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final T x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a number to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the number value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class ObjectArrayType (com.landawn.abacus.type.ObjectArrayType)
Type handler for object arrays, providing serialization, deserialization, and collection conversion capabilities for arrays of any object type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<T\[\]>
-
Signature:
@Override public Class<T[]> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the array class object
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Gets the type handler for the array's element type.
-
Parameters:
- (none)
- Returns: the Type handler for array elements
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() -
Parameters:
- (none)
- Returns: unspecified
isObjectArray(...) -> boolean
-
Signature:
@Override public boolean isObjectArray() - Summary: Indicates whether this type represents an object array.
-
Parameters:
- (none)
- Returns: {@code true} , as this is an object array type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether arrays of this type can be serialized.
-
Parameters:
- (none)
- Returns: {@code true} if the element type is serializable, {@code false} otherwise
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T[] x) - Summary: Converts an object array to its JSON string representation.
-
Contract:
- If the element type is serializable, performs custom JSON serialization.
-
Parameters:
-
x(T[]) — the array to convert
-
- Returns: JSON string representation, {@code null} if input is {@code null} , or "\[\]" for empty arrays
valueOf(...) -> T\[\]
-
Signature:
@Override public T[] valueOf(final String str) - Summary: Converts a JSON string representation to an object array.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: the parsed array, {@code null} if input is {@code null} , or empty array for empty representations
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final T[] x) throws IOException - Summary: Appends the JSON representation of an object array to an Appendable.
-
Contract:
- Optimizes performance by using buffered writers when appropriate.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(T[]) — the array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final T[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the JSON character representation of an object array to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T[]) — the array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
collectionToArray(...) -> T\[\]
-
Signature:
@Override public T[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection to an array of the appropriate type.
-
Parameters:
-
c(Collection<?>) — the collection to convert
-
- Returns: an array containing all elements from the collection, or {@code null} if the collection is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final T[] x, final Collection<E> output) - Summary: Converts an array to a Collection by adding all array elements to the provided collection.
-
Parameters:
-
x(T[]) — the array to convert -
output(Collection<E>) — the collection to add elements to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final Object[] x) - Summary: Computes a hash code for the given array.
-
Parameters:
-
x(Object[]) — the array to hash
-
- Returns: the computed hash code
deepHashCode(...) -> int
-
Signature:
@Override public int deepHashCode(final Object[] x) - Summary: Computes a deep hash code for the given array.
-
Parameters:
-
x(Object[]) — the array to hash
-
- Returns: the computed deep hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object[] x, final Object[] y) - Summary: Compares two arrays for equality.
-
Parameters:
-
x(Object[]) — the first array -
y(Object[]) — the second array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
deepEquals(...) -> boolean
-
Signature:
@Override public boolean deepEquals(final Object[] x, final Object[] y) - Summary: Performs a deep comparison of two arrays for equality.
-
Parameters:
-
x(Object[]) — the first array -
y(Object[]) — the second array
-
- Returns: {@code true} if the arrays are deeply equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString(final Object[] x) - Summary: Creates a string representation of the array.
-
Parameters:
-
x(Object[]) — the array to convert to string
-
- Returns: string representation of the array, {@code null} if input is {@code null} , or "\[\]" for empty arrays
deepToString(...) -> String
-
Signature:
@Override public String deepToString(final Object[] x) - Summary: Creates a deep string representation of the array.
-
Parameters:
-
x(Object[]) — the array to convert to string
-
- Returns: deep string representation of the array, {@code null} if input is {@code null} , or "\[\]" for empty arrays
Class ObjectType (com.landawn.abacus.type.ObjectType)
Type handler for generic {@link Object} types, providing basic serialization, deserialization, and type conversion capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class OffsetDateTimeType (com.landawn.abacus.type.OffsetDateTimeType)
Type handler for {@link OffsetDateTime} objects, providing serialization, deserialization, and database interaction capabilities for date-time values with timezone offset information.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OffsetDateTime>
-
Signature:
@Override public Class<OffsetDateTime> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OffsetDateTime} class object
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OffsetDateTime x) - Summary: Converts an {@link OffsetDateTime} object to its ISO-8601 string representation.
-
Parameters:
-
x(OffsetDateTime) — the OffsetDateTime object to convert
-
- Returns: the ISO-8601 formatted string, or {@code null} if the input is null
valueOf(...) -> OffsetDateTime
-
Signature:
@Override public OffsetDateTime valueOf(final Object obj) - Summary: Converts an object to an {@link OffsetDateTime} .
-
Contract:
- If the object is a Number, it's treated as epoch milliseconds.
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: the OffsetDateTime value, or {@code null} if the input is null
-
Signature:
@Override public OffsetDateTime valueOf(final String str) - Summary: Converts a string representation to an {@link OffsetDateTime} object.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed OffsetDateTime, or {@code null} if the input is {@code null} or represents a {@code null} date-time
-
Signature:
@Override public OffsetDateTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to an {@link OffsetDateTime} object.
-
Parameters:
-
cbuf(char[]) — the character array containing the date-time string -
offset(int) — the offset in the array where the date-time string starts -
len(int) — the length of the date-time string
-
- Returns: the parsed OffsetDateTime, or {@code null} if the input is {@code null} or empty
get(...) -> OffsetDateTime
-
Signature:
@Override public OffsetDateTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an {@link OffsetDateTime} value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OffsetDateTime representing the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OffsetDateTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an {@link OffsetDateTime} value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OffsetDateTime representing the timestamp, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OffsetDateTime x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to an {@link OffsetDateTime} value.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OffsetDateTime) — the OffsetDateTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OffsetDateTime x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to an {@link OffsetDateTime} value.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OffsetDateTime) — the OffsetDateTime value to set, or {@code null} to set SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OffsetDateTime x) throws IOException - Summary: Appends the string representation of an {@link OffsetDateTime} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OffsetDateTime) — the OffsetDateTime value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final OffsetDateTime x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OffsetDateTime} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OffsetDateTime) — the OffsetDateTime value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration specifying format and quoting
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalBooleanType (com.landawn.abacus.type.OptionalBooleanType)
Type handler for {@link OptionalBoolean} objects, providing serialization, deserialization, and database interaction capabilities for optional boolean values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalBoolean>
-
Signature:
@Override public Class<OptionalBoolean> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalBoolean} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalBoolean values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating boolean values don't need quotes in CSV
defaultValue(...) -> OptionalBoolean
-
Signature:
@Override public OptionalBoolean defaultValue() - Summary: Returns the default value for OptionalBoolean type, which is an empty OptionalBoolean.
-
Parameters:
- (none)
- Returns: OptionalBoolean.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalBoolean x) - Summary: Converts an {@link OptionalBoolean} object to its string representation.
-
Parameters:
-
x(OptionalBoolean) — the OptionalBoolean object to convert
-
- Returns: "true" or "false" if the Optional contains a value, or {@code null} if empty or null
valueOf(...) -> OptionalBoolean
-
Signature:
@Override public OptionalBoolean valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalBoolean} object.
-
Parameters:
-
str(String) — the string to convert ("true", "false", or parseable boolean strings)
-
- Returns: an OptionalBoolean containing the parsed boolean value, or empty if the input is empty or null
get(...) -> OptionalBoolean
-
Signature:
@Override public OptionalBoolean get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a boolean value from a ResultSet at the specified column index and wraps it in an {@link OptionalBoolean} .
-
Contract:
- Handles type conversion if the database column is not a boolean type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalBoolean containing the boolean value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalBoolean get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a boolean value from a ResultSet using the specified column label and wraps it in an {@link OptionalBoolean} .
-
Contract:
- Handles type conversion if the database column is not a boolean type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalBoolean containing the boolean value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalBoolean x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalBoolean} .
-
Contract:
- If the OptionalBoolean is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalBoolean) — the OptionalBoolean value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalBoolean x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalBoolean} .
-
Contract:
- If the OptionalBoolean is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalBoolean) — the OptionalBoolean value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalBoolean x) throws IOException - Summary: Appends the string representation of an {@link OptionalBoolean} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalBoolean) — the OptionalBoolean value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalBoolean x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalBoolean} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalBoolean) — the OptionalBoolean value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalByteType (com.landawn.abacus.type.OptionalByteType)
Type handler for {@link OptionalByte} objects, providing serialization, deserialization, and database interaction capabilities for optional byte values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalByte>
-
Signature:
@Override public Class<OptionalByte> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalByte} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalByte values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating byte values don't need quotes in CSV
defaultValue(...) -> OptionalByte
-
Signature:
@Override public OptionalByte defaultValue() - Summary: Returns the default value for OptionalByte type, which is an empty OptionalByte.
-
Parameters:
- (none)
- Returns: OptionalByte.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalByte x) - Summary: Converts an {@link OptionalByte} object to its string representation.
-
Parameters:
-
x(OptionalByte) — the OptionalByte object to convert
-
- Returns: the string representation of the byte value, or {@code null} if empty or null
valueOf(...) -> OptionalByte
-
Signature:
@Override public OptionalByte valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalByte} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalByte containing the parsed byte value, or empty if the input is empty or null
get(...) -> OptionalByte
-
Signature:
@Override public OptionalByte get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a byte value from a ResultSet at the specified column index and wraps it in an {@link OptionalByte} .
-
Contract:
- Handles type conversion if the database column is not a byte type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<OptionalByte> type = TypeFactory.getType(OptionalByte.class); ResultSet rs = statement.executeQuery("SELECT status_code FROM records"); if (rs.next()) { OptionalByte statusCode = type.get(rs, 1); if (statusCode.isPresent()) { byte code = statusCode.get(); // Process the status code } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalByte containing the byte value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalByte get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a byte value from a ResultSet using the specified column label and wraps it in an {@link OptionalByte} .
-
Contract:
- Handles type conversion if the database column is not a byte type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalByte containing the byte value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalByte x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalByte} .
-
Contract:
- If the OptionalByte is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalByte) — the OptionalByte value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalByte x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalByte} .
-
Contract:
- If the OptionalByte is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalByte) — the OptionalByte value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalByte x) throws IOException - Summary: Appends the string representation of an {@link OptionalByte} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalByte) — the OptionalByte value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalByte x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalByte} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalByte) — the OptionalByte value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalCharType (com.landawn.abacus.type.OptionalCharType)
Type handler for {@link OptionalChar} objects, providing serialization, deserialization, and database interaction capabilities for optional character values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalChar>
-
Signature:
@Override public Class<OptionalChar> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalChar} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalChar values are comparable
defaultValue(...) -> OptionalChar
-
Signature:
@Override public OptionalChar defaultValue() - Summary: Returns the default value for OptionalChar type, which is an empty OptionalChar.
-
Parameters:
- (none)
- Returns: OptionalChar.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalChar x) - Summary: Converts an {@link OptionalChar} object to its string representation.
-
Parameters:
-
x(OptionalChar) — the OptionalChar object to convert
-
- Returns: a single-character string, or {@code null} if empty or null
valueOf(...) -> OptionalChar
-
Signature:
@Override public OptionalChar valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalChar} object.
-
Contract:
- The string should contain exactly one character or be convertible to a character.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalChar containing the parsed character value, or empty if the input is empty or null
get(...) -> OptionalChar
-
Signature:
@Override public OptionalChar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a character value from a ResultSet at the specified column index and wraps it in an {@link OptionalChar} .
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalChar containing the character value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalChar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a character value from a ResultSet using the specified column label and wraps it in an {@link OptionalChar} .
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalChar containing the character value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalChar x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalChar} .
-
Contract:
- If the OptionalChar is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalChar) — the OptionalChar value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalChar x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalChar} .
-
Contract:
- If the OptionalChar is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalChar) — the OptionalChar value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalChar x) throws IOException - Summary: Appends the string representation of an {@link OptionalChar} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalChar) — the OptionalChar value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalChar x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalChar} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalChar) — the OptionalChar value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration specifying character quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalDoubleType (com.landawn.abacus.type.OptionalDoubleType)
Type handler for {@link OptionalDouble} objects, providing serialization, deserialization, and database interaction capabilities for optional double-precision floating-point values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalDouble>
-
Signature:
@Override public Class<OptionalDouble> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalDouble} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalDouble values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating double values don't need quotes in CSV
defaultValue(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble defaultValue() - Summary: Returns the default value for OptionalDouble type, which is an empty OptionalDouble.
-
Parameters:
- (none)
- Returns: OptionalDouble.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalDouble x) - Summary: Converts an {@link OptionalDouble} object to its string representation.
-
Parameters:
-
x(OptionalDouble) — the OptionalDouble object to convert
-
- Returns: the string representation of the double value, or {@code null} if empty or null
valueOf(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalDouble} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalDouble containing the parsed double value, or empty if the input is empty or null
get(...) -> OptionalDouble
-
Signature:
@Override public OptionalDouble get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a double value from a ResultSet at the specified column index and wraps it in an {@link OptionalDouble} .
-
Contract:
- Handles type conversion if the database column is not a double type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalDouble containing the double value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalDouble get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a double value from a ResultSet using the specified column label and wraps it in an {@link OptionalDouble} .
-
Contract:
- Handles type conversion if the database column is not a double type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalDouble containing the double value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalDouble x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalDouble} .
-
Contract:
- If the OptionalDouble is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalDouble) — the OptionalDouble value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalDouble x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalDouble} .
-
Contract:
- If the OptionalDouble is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalDouble) — the OptionalDouble value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalDouble x) throws IOException - Summary: Appends the string representation of an {@link OptionalDouble} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalDouble) — the OptionalDouble value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalDouble x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalDouble} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalDouble) — the OptionalDouble value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalFloatType (com.landawn.abacus.type.OptionalFloatType)
Type handler for {@link OptionalFloat} objects, providing serialization, deserialization, and database interaction capabilities for optional single-precision floating-point values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalFloat>
-
Signature:
@Override public Class<OptionalFloat> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalFloat} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalFloat values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating float values don't need quotes in CSV
defaultValue(...) -> OptionalFloat
-
Signature:
@Override public OptionalFloat defaultValue() - Summary: Returns the default value for OptionalFloat type, which is an empty OptionalFloat.
-
Parameters:
- (none)
- Returns: OptionalFloat.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalFloat x) - Summary: Converts an {@link OptionalFloat} object to its string representation.
-
Parameters:
-
x(OptionalFloat) — the OptionalFloat object to convert
-
- Returns: the string representation of the float value, or {@code null} if empty or null
valueOf(...) -> OptionalFloat
-
Signature:
@Override public OptionalFloat valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalFloat} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalFloat containing the parsed float value, or empty if the input is empty or null
get(...) -> OptionalFloat
-
Signature:
@Override public OptionalFloat get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a float value from a ResultSet at the specified column index and wraps it in an {@link OptionalFloat} .
-
Contract:
- Handles type conversion if the database column is not a float type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalFloat containing the float value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalFloat get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a float value from a ResultSet using the specified column label and wraps it in an {@link OptionalFloat} .
-
Contract:
- Handles type conversion if the database column is not a float type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalFloat containing the float value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalFloat x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalFloat} .
-
Contract:
- If the OptionalFloat is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalFloat) — the OptionalFloat value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalFloat x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalFloat} .
-
Contract:
- If the OptionalFloat is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalFloat) — the OptionalFloat value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalFloat x) throws IOException - Summary: Appends the string representation of an {@link OptionalFloat} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalFloat) — the OptionalFloat value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalFloat x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalFloat} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalFloat) — the OptionalFloat value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalIntType (com.landawn.abacus.type.OptionalIntType)
Type handler for {@link OptionalInt} objects, providing serialization, deserialization, and database interaction capabilities for optional integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalInt>
-
Signature:
@Override public Class<OptionalInt> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalInt} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalInt values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating integer values don't need quotes in CSV
defaultValue(...) -> OptionalInt
-
Signature:
@Override public OptionalInt defaultValue() - Summary: Returns the default value for OptionalInt type, which is an empty OptionalInt.
-
Parameters:
- (none)
- Returns: OptionalInt.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalInt x) - Summary: Converts an {@link OptionalInt} object to its string representation.
-
Parameters:
-
x(OptionalInt) — the OptionalInt object to convert
-
- Returns: the string representation of the integer value, or {@code null} if empty or null
valueOf(...) -> OptionalInt
-
Signature:
@Override public OptionalInt valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalInt} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalInt containing the parsed integer value, or empty if the input is empty or null
get(...) -> OptionalInt
-
Signature:
@Override public OptionalInt get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an integer value from a ResultSet at the specified column index and wraps it in an {@link OptionalInt} .
-
Contract:
- Handles type conversion if the database column is not an integer type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalInt containing the integer value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalInt get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an integer value from a ResultSet using the specified column label and wraps it in an {@link OptionalInt} .
-
Contract:
- Handles type conversion if the database column is not an integer type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalInt containing the integer value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalInt x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalInt} .
-
Contract:
- If the OptionalInt is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalInt) — the OptionalInt value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalInt x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalInt} .
-
Contract:
- If the OptionalInt is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalInt) — the OptionalInt value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalInt x) throws IOException - Summary: Appends the string representation of an {@link OptionalInt} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalInt) — the OptionalInt value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalInt x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalInt} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalInt) — the OptionalInt value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalLongType (com.landawn.abacus.type.OptionalLongType)
Type handler for {@link OptionalLong} objects, providing serialization, deserialization, and database interaction capabilities for optional long integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalLong>
-
Signature:
@Override public Class<OptionalLong> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalLong} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalLong values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating long values don't need quotes in CSV
defaultValue(...) -> OptionalLong
-
Signature:
@Override public OptionalLong defaultValue() - Summary: Returns the default value for OptionalLong type, which is an empty OptionalLong.
-
Parameters:
- (none)
- Returns: OptionalLong.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalLong x) - Summary: Converts an {@link OptionalLong} object to its string representation.
-
Parameters:
-
x(OptionalLong) — the OptionalLong object to convert
-
- Returns: the string representation of the long value, or {@code null} if empty or null
valueOf(...) -> OptionalLong
-
Signature:
@Override public OptionalLong valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalLong} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalLong containing the parsed long value, or empty if the input is empty or null
get(...) -> OptionalLong
-
Signature:
@Override public OptionalLong get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a long value from a ResultSet at the specified column index and wraps it in an {@link OptionalLong} .
-
Contract:
- Handles type conversion if the database column is not a long type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalLong containing the long value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalLong get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a long value from a ResultSet using the specified column label and wraps it in an {@link OptionalLong} .
-
Contract:
- Handles type conversion if the database column is not a long type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalLong containing the long value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalLong x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalLong} .
-
Contract:
- If the OptionalLong is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalLong) — the OptionalLong value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalLong x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalLong} .
-
Contract:
- If the OptionalLong is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalLong) — the OptionalLong value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalLong x) throws IOException - Summary: Appends the string representation of an {@link OptionalLong} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalLong) — the OptionalLong value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalLong x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalLong} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalLong) — the OptionalLong value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalShortType (com.landawn.abacus.type.OptionalShortType)
Type handler for {@link OptionalShort} objects, providing serialization, deserialization, and database interaction capabilities for optional short integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<OptionalShort>
-
Signature:
@Override public Class<OptionalShort> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link OptionalShort} class object
isComparable(...) -> boolean
-
Signature:
@Override public boolean isComparable() - Summary: Indicates whether values of this type can be compared.
-
Parameters:
- (none)
- Returns: {@code true} , as OptionalShort values are comparable
isNonQuotableCsvType(...) -> boolean
-
Signature:
@Override public boolean isNonQuotableCsvType() - Summary: Indicates whether values of this type should be quoted when written to CSV format.
-
Contract:
- Indicates whether values of this type should be quoted when written to CSV format.
-
Parameters:
- (none)
- Returns: {@code true} , indicating short values don't need quotes in CSV
defaultValue(...) -> OptionalShort
-
Signature:
@Override public OptionalShort defaultValue() - Summary: Returns the default value for OptionalShort type, which is an empty OptionalShort.
-
Parameters:
- (none)
- Returns: OptionalShort.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final OptionalShort x) - Summary: Converts an {@link OptionalShort} object to its string representation.
-
Parameters:
-
x(OptionalShort) — the OptionalShort object to convert
-
- Returns: the string representation of the short value, or {@code null} if empty or null
valueOf(...) -> OptionalShort
-
Signature:
@Override public OptionalShort valueOf(final String str) - Summary: Converts a string representation to an {@link OptionalShort} object.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an OptionalShort containing the parsed short value, or empty if the input is empty or null
get(...) -> OptionalShort
-
Signature:
@Override public OptionalShort get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a short value from a ResultSet at the specified column index and wraps it in an {@link OptionalShort} .
-
Contract:
- Handles type conversion if the database column is not a short type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an OptionalShort containing the short value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public OptionalShort get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a short value from a ResultSet using the specified column label and wraps it in an {@link OptionalShort} .
-
Contract:
- Handles type conversion if the database column is not a short type.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an OptionalShort containing the short value, or empty if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final OptionalShort x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link OptionalShort} .
-
Contract:
- If the OptionalShort is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(OptionalShort) — the OptionalShort value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final OptionalShort x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link OptionalShort} .
-
Contract:
- If the OptionalShort is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(OptionalShort) — the OptionalShort value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final OptionalShort x) throws IOException - Summary: Appends the string representation of an {@link OptionalShort} to an Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(OptionalShort) — the OptionalShort value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final OptionalShort x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link OptionalShort} to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(OptionalShort) — the OptionalShort value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class OptionalType (com.landawn.abacus.type.OptionalType)
Generic type handler for {@link Optional} wrapper objects, providing serialization, deserialization, and database interaction capabilities for optional values of any type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes the full generic type declaration.
-
Parameters:
- (none)
- Returns: the declaring name with generic type information
clazz(...) -> Class<Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") @Override public Class<Optional<T>> clazz() - Summary: Returns the Java class type that this type handler manages.
-
Parameters:
- (none)
- Returns: the {@link Optional} class object
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Gets the type handler for the element type contained within the Optional.
-
Parameters:
- (none)
- Returns: the Type handler for the wrapped element type
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() - Summary: Gets the array of parameter types for this generic type.
-
Parameters:
- (none)
- Returns: an array containing the element type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a generic type
defaultValue(...) -> Optional<T>
-
Signature:
@Override public Optional<T> defaultValue() - Summary: Returns the default value for Optional type, which is an empty Optional.
-
Parameters:
- (none)
- Returns: Optional.empty()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Optional<T> x) - Summary: Converts an {@link Optional} object to its string representation.
-
Contract:
- If the Optional is {@code null} or empty, returns {@code null} .
-
Parameters:
-
x(Optional<T>) — the Optional object to convert
-
- Returns: the string representation of the contained value, or {@code null} if empty
valueOf(...) -> Optional<T>
-
Signature:
@Override public Optional<T> valueOf(final String str) - Summary: Converts a string representation to an {@link Optional} object.
-
Contract:
- If the string is {@code null} , returns an empty Optional.
- The result may be an Optional containing {@code null} if the element type's valueOf returns {@code null} .
-
Parameters:
-
str(String) — the string to convert
-
- Returns: an Optional containing the parsed value, or empty Optional if input is null
get(...) -> Optional<T>
-
Signature:
@Override public Optional<T> get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a value from a ResultSet at the specified column index and wraps it in an {@link Optional} .
-
Contract:
- The method attempts to convert the retrieved value to the element type if necessary.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Optional<String>> type = TypeFactory.getType("Optional<String>"); PreparedStatement stmt = org.mockito.Mockito.mock(PreparedStatement.class); stmt.setInt(1, 123); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Optional<String> name = type.get(rs, 1); if (name.isPresent()) { System.out.println("Name: " + name.get()); } } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: an Optional containing the retrieved value, or empty Optional if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Optional<T> get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a value from a ResultSet using the specified column label and wraps it in an {@link Optional} .
-
Contract:
- The method attempts to convert the retrieved value to the element type if necessary.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: an Optional containing the retrieved value, or empty Optional if the value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Optional<T> x) throws SQLException - Summary: Sets a parameter in a PreparedStatement to the value contained in an {@link Optional} .
-
Contract:
- If the Optional is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) to set -
x(Optional<T>) — the Optional value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Optional<T> x) throws SQLException - Summary: Sets a named parameter in a CallableStatement to the value contained in an {@link Optional} .
-
Contract:
- If the Optional is {@code null} or empty, sets the parameter to SQL NULL.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Optional<T>) — the Optional value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Optional<T> x) throws IOException - Summary: Appends the string representation of an {@link Optional} to an Appendable.
-
Contract:
- If the Optional is {@code null} or empty, appends the NULL_STRING constant.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Optional<T>) — the Optional value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Optional<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an {@link Optional} to a CharacterWriter.
-
Contract:
- If the Optional is {@code null} or empty, writes the NULL_CHAR_ARRAY.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Optional<T>) — the Optional value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class PairType (com.landawn.abacus.type.PairType)
Type handler for {@link Pair} objects, providing serialization and deserialization capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes the simple class name and parameter types.
-
Parameters:
- (none)
- Returns: the declaring name of this type
clazz(...) -> Class<Pair<L, R>>
-
Signature:
@Override public Class<Pair<L, R>> clazz() - Summary: Returns the Class object representing the Pair type.
-
Parameters:
- (none)
- Returns: the Class object for Pair
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns an array containing the Type objects for the left and right elements of the Pair.
-
Parameters:
- (none)
- Returns: an array of Type objects representing the parameter types
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , as PairType is always a generic type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Pair<L, R> x) - Summary: Converts a Pair object to its string representation using JSON format.
-
Contract:
- Returns {@code null} if the input pair is {@code null} .
-
Parameters:
-
x(Pair<L, R>) — the Pair object to convert to string
-
- Returns: a JSON string representation of the pair, or {@code null} if the input is null
valueOf(...) -> Pair<L, R>
-
Signature:
@SuppressWarnings("unchecked") @Override public Pair<L, R> valueOf(final String str) - Summary: Parses a string representation and creates a Pair object.
-
Contract:
- The string should be in JSON array format: \[leftValue, rightValue\].
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse, expected to be a JSON array with two elements
-
- Returns: a Pair object created from the parsed values, or {@code null} if the input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Pair<L, R> x) throws IOException - Summary: Appends the string representation of a Pair object to an Appendable.
-
Contract:
- If the pair is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Pair<L, R>) — the Pair object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Pair<L, R> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Pair object to a CharacterWriter.
-
Contract:
- If the pair is {@code null} , writes "null".
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Pair<L, R>) — the Pair object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration to use
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing
-
Class PasswordType (com.landawn.abacus.type.PasswordType)
Type handler for password fields that automatically encrypts passwords before storing them in a database.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> String
-
Signature:
@Override public String get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a password value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the password string from the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public String get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a password value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label/name
-
- Returns: the password string from the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final String x) throws SQLException - Summary: Sets a password value in a PreparedStatement at the specified parameter index.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(String) — the plain text password to encrypt and set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final String x) throws SQLException - Summary: Sets a password value in a CallableStatement using the specified parameter name.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(String) — the plain text password to encrypt and set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class PatternType (com.landawn.abacus.type.PatternType)
Type handler for java.util.regex.Pattern objects, providing conversion between Pattern instances and their string representations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Pattern>
-
Signature:
@Override public Class<Pattern> clazz() - Summary: Returns the Class object representing the Pattern type.
-
Parameters:
- (none)
- Returns: the Class object for java.util.regex.Pattern
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Pattern t) - Summary: Converts a Pattern object to its string representation.
-
Contract:
- Returns {@code null} if the input Pattern is {@code null} .
-
Parameters:
-
t(Pattern) — the Pattern object to convert
-
- Returns: the pattern string, or {@code null} if the input is null
valueOf(...) -> Pattern
-
Signature:
@Override public Pattern valueOf(final String str) - Summary: Parses a string representation to create a Pattern instance.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the regular expression string to compile
-
- Returns: a compiled Pattern object, or {@code null} if the input is {@code null} or empty
Class PrimitiveBooleanArrayType (com.landawn.abacus.type.PrimitiveBooleanArrayType)
Type handler for primitive boolean arrays (boolean\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<boolean\[\]>
-
Signature:
@Override public Class<boolean[]> clazz() - Summary: Returns the Class object representing the boolean array type.
-
Parameters:
- (none)
- Returns: the Class object for boolean\[\]
getElementType(...) -> Type<Boolean>
-
Signature:
@Override public Type<Boolean> getElementType() - Summary: Returns the Type object for the boolean element type.
-
Parameters:
- (none)
- Returns: the Type object representing Boolean/boolean elements
getParameterTypes(...) -> Type<Boolean>\[\]
-
Signature:
@Override public Type<Boolean>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Boolean Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final boolean[] x) - Summary: Converts a boolean array to its string representation.
-
Contract:
- Returns {@code null} if the input array is {@code null} , or "\[\]" if the array is empty.
-
Parameters:
-
x(boolean[]) — the boolean array to convert
-
- Returns: the string representation of the array, or {@code null} if input is null
valueOf(...) -> boolean\[\]
-
Signature:
@Override public boolean[] valueOf(final String str) - Summary: Parses a string representation and creates a boolean array.
-
Contract:
- Returns {@code null} if input is {@code null} , empty array if input is empty or "\[\]".
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed boolean array, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final boolean[] x) throws IOException - Summary: Appends the string representation of a boolean array to an Appendable.
-
Contract:
- Appends "null" if the array is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(boolean[]) — the boolean array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final boolean[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a boolean array to a CharacterWriter.
-
Contract:
- Writes "null" if the array is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(boolean[]) — the boolean array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for boolean arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> boolean\[\]
-
Signature:
@Override public boolean[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Boolean objects to a primitive boolean array.
-
Contract:
- Returns {@code null} if the input collection is {@code null} .
-
Parameters:
-
c(Collection<?>) — the Collection of Boolean objects to convert
-
- Returns: a boolean array containing the unboxed values, or {@code null} if input is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final boolean[] x, final Collection<E> output) - Summary: Converts a boolean array to a Collection.
-
Contract:
- Does nothing if the input array is {@code null} or empty.
-
Parameters:
-
x(boolean[]) — the boolean array to convert -
output(Collection<E>) — the Collection to add the boxed Boolean values to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final boolean[] x) - Summary: Calculates the hash code for a boolean array.
-
Parameters:
-
x(boolean[]) — the boolean array to hash
-
- Returns: the hash code of the array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final boolean[] x, final boolean[] y) - Summary: Compares two boolean arrays for equality.
-
Contract:
- Arrays are considered equal if they have the same length and all corresponding elements are equal.
-
Parameters:
-
x(boolean[]) — the first boolean array -
y(boolean[]) — the second boolean array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveBooleanListType (com.landawn.abacus.type.PrimitiveBooleanListType)
Type handler for BooleanList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<BooleanList>
-
Signature:
@Override public Class<BooleanList> clazz() - Summary: Returns the Class object representing the BooleanList type.
-
Parameters:
- (none)
- Returns: the Class object for BooleanList
getElementType(...) -> Type<?>
-
Signature:
@Override public Type<?> getElementType() - Summary: Returns the Type object for the boolean element type.
-
Parameters:
- (none)
- Returns: the Type object representing boolean elements
getParameterTypes(...) -> Type<Boolean>\[\]
-
Signature:
@Override public Type<Boolean>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Boolean Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final BooleanList x) - Summary: Converts a BooleanList to its string representation.
-
Contract:
- Returns {@code null} if the input list is {@code null} .
-
Parameters:
-
x(BooleanList) — the BooleanList to convert
-
- Returns: the string representation of the list, or {@code null} if input is null
valueOf(...) -> BooleanList
-
Signature:
@Override public BooleanList valueOf(final String str) - Summary: Parses a string representation and creates a BooleanList.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a BooleanList created from the parsed values, or {@code null} if input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final BooleanList x) throws IOException - Summary: Appends the string representation of a BooleanList to an Appendable.
-
Contract:
- Appends "null" if the list is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(BooleanList) — the BooleanList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final BooleanList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a BooleanList to a CharacterWriter.
-
Contract:
- Writes "null" if the list is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(BooleanList) — the BooleanList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class PrimitiveBooleanType (com.landawn.abacus.type.PrimitiveBooleanType)
Type handler for primitive boolean values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Boolean>
-
Signature:
@Override public Class<Boolean> clazz() - Summary: Returns the Class object representing the primitive boolean type.
-
Parameters:
- (none)
- Returns: the Class object for the primitive boolean type
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is for primitive boolean
defaultValue(...) -> Boolean
-
Signature:
@Override public Boolean defaultValue() - Summary: Returns the default value for the primitive boolean type.
-
Parameters:
- (none)
- Returns: Boolean.FALSE as the default value for primitive boolean
Class PrimitiveByteArrayType (com.landawn.abacus.type.PrimitiveByteArrayType)
Type handler for primitive byte arrays (byte\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<byte\[\]>
-
Signature:
@Override public Class<byte[]> clazz() - Summary: Returns the Class object representing the byte array type.
-
Parameters:
- (none)
- Returns: the Class object for byte\[\]
getElementType(...) -> Type<Byte>
-
Signature:
@Override public Type<Byte> getElementType() - Summary: Returns the Type object for the byte element type.
-
Parameters:
- (none)
- Returns: the Type object representing Byte/byte elements
getParameterTypes(...) -> Type<Byte>\[\]
-
Signature:
@Override public Type<Byte>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Byte Type that describes the elements of this array type
- See also: #getElementType()
isPrimitiveByteArray(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveByteArray() - Summary: Indicates whether this type represents a primitive byte array.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is specifically for byte arrays
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final byte[] x) - Summary: Converts a byte array to its string representation.
-
Contract:
- Returns {@code null} if the input array is {@code null} , or "\[\]" if the array is empty.
-
Parameters:
-
x(byte[]) — the byte array to convert
-
- Returns: the string representation of the array, or {@code null} if input is null
valueOf(...) -> byte\[\]
-
Signature:
@Override public byte[] valueOf(final String str) - Summary: Parses a string representation and creates a byte array.
-
Contract:
- Returns {@code null} if input is {@code null} , empty array if input is empty or "\[\]".
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed byte array, or {@code null} if input is null
-
Signature:
@SuppressFBWarnings @Override public byte[] valueOf(final Object obj) - Summary: Converts an object to a byte array.
-
Contract:
- Returns {@code null} if input is {@code null} .
-
Parameters:
-
obj(Object) — the object to convert (can be a Blob or other type)
-
- Returns: the byte array representation of the object, or {@code null} if input is null
get(...) -> byte\[\]
-
Signature:
@Override public byte[] get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a byte array from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the byte array from the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public byte[] get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a byte array from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label/name
-
- Returns: the byte array from the database
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final byte[] x) throws SQLException - Summary: Sets a byte array value in a PreparedStatement at the specified parameter index.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(byte[]) — the byte array to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final byte[] x) throws SQLException - Summary: Sets a byte array value in a CallableStatement using the specified parameter name.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(byte[]) — the byte array to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final byte[] x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a byte array value in a PreparedStatement with SQL type information.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(byte[]) — the byte array to set -
sqlTypeOrLength(int) — the SQL type or length (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final byte[] x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a byte array value in a CallableStatement with SQL type information.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(byte[]) — the byte array to set -
sqlTypeOrLength(int) — the SQL type or length (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final byte[] x) throws IOException - Summary: Appends the string representation of a byte array to an Appendable.
-
Contract:
- Appends "null" if the array is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(byte[]) — the byte array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final byte[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a byte array to a CharacterWriter.
-
Contract:
- Writes "null" if the array is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(byte[]) — the byte array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for byte arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> byte\[\]
-
Signature:
@Override public byte[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Byte objects to a primitive byte array.
-
Contract:
- Returns {@code null} if the input collection is {@code null} .
-
Parameters:
-
c(Collection<?>) — the Collection of Byte objects to convert
-
- Returns: a byte array containing the unboxed values, or {@code null} if input is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final byte[] x, final Collection<E> output) - Summary: Converts a byte array to a Collection.
-
Contract:
- Does nothing if the input array is {@code null} or empty.
-
Parameters:
-
x(byte[]) — the byte array to convert -
output(Collection<E>) — the Collection to add the boxed Byte values to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final byte[] x) - Summary: Calculates the hash code for a byte array.
-
Parameters:
-
x(byte[]) — the byte array to hash
-
- Returns: the hash code of the array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final byte[] x, final byte[] y) - Summary: Compares two byte arrays for equality.
-
Contract:
- Arrays are considered equal if they have the same length and all corresponding elements are equal.
-
Parameters:
-
x(byte[]) — the first byte array -
y(byte[]) — the second byte array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveByteListType (com.landawn.abacus.type.PrimitiveByteListType)
Type handler for ByteList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<ByteList>
-
Signature:
@Override public Class<ByteList> clazz() - Summary: Returns the Class object representing the ByteList type.
-
Parameters:
- (none)
- Returns: the Class object for ByteList
getElementType(...) -> Type<Byte>
-
Signature:
@Override public Type<Byte> getElementType() - Summary: Returns the Type object for the byte element type.
-
Parameters:
- (none)
- Returns: the Type object representing byte elements
getParameterTypes(...) -> Type<Byte>\[\]
-
Signature:
@Override public Type<Byte>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Byte Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ByteList x) - Summary: Converts a ByteList to its string representation.
-
Contract:
- Returns {@code null} if the input list is {@code null} .
-
Parameters:
-
x(ByteList) — the ByteList to convert
-
- Returns: the string representation of the list, or {@code null} if input is null
valueOf(...) -> ByteList
-
Signature:
@Override public ByteList valueOf(final String str) - Summary: Parses a string representation and creates a ByteList.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a ByteList created from the parsed values, or {@code null} if input is {@code null} or empty
get(...) -> ByteList
-
Signature:
@Override public ByteList get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a ByteList from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: a ByteList containing the bytes from the database, or {@code null} if the column value is null
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public ByteList get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a ByteList from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label/name
-
- Returns: a ByteList containing the bytes from the database, or {@code null} if the column value is null
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final ByteList x) throws SQLException - Summary: Sets a ByteList value in a PreparedStatement at the specified parameter index.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(ByteList) — the ByteList to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final ByteList x) throws SQLException - Summary: Sets a ByteList value in a CallableStatement using the specified parameter name.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(ByteList) — the ByteList to set, or null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final ByteList x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a ByteList value in a PreparedStatement with SQL type information.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(ByteList) — the ByteList to set, or null -
sqlTypeOrLength(int) — the SQL type or length (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final ByteList x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a ByteList value in a CallableStatement with SQL type information.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(ByteList) — the ByteList to set, or null -
sqlTypeOrLength(int) — the SQL type or length (ignored for byte arrays)
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final ByteList x) throws IOException - Summary: Appends the string representation of a ByteList to an Appendable.
-
Contract:
- Appends "null" if the list is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(ByteList) — the ByteList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final ByteList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a ByteList to a CharacterWriter.
-
Contract:
- Writes "null" if the list is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(ByteList) — the ByteList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class PrimitiveByteType (com.landawn.abacus.type.PrimitiveByteType)
Type handler for primitive byte values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive byte type.
-
Parameters:
- (none)
- Returns: the Class object for the primitive byte type
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is for primitive byte
defaultValue(...) -> Byte
-
Signature:
@Override public Byte defaultValue() - Summary: Returns the default value for the primitive byte type.
-
Parameters:
- (none)
- Returns: Byte value of 0 as the default value for primitive byte
Class PrimitiveCharArrayType (com.landawn.abacus.type.PrimitiveCharArrayType)
Type handler for primitive char arrays (char\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<char\[\]>
-
Signature:
@Override public Class<char[]> clazz() - Summary: Returns the Class object representing the char array type.
-
Parameters:
- (none)
- Returns: the Class object for char\[\]
getElementType(...) -> Type<Character>
-
Signature:
@Override public Type<Character> getElementType() - Summary: Returns the Type object for the char element type.
-
Parameters:
- (none)
- Returns: the Type object representing Character/char elements
getParameterTypes(...) -> Type<Character>\[\]
-
Signature:
@Override public Type<Character>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Character Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final char[] x) - Summary: Converts a char array to its string representation.
-
Contract:
- Returns {@code null} if the input array is {@code null} , or "\[\]" if the array is empty.
-
Parameters:
-
x(char[]) — the char array to convert
-
- Returns: the string representation of the array, or {@code null} if input is null
valueOf(...) -> char\[\]
-
Signature:
@Override public char[] valueOf(final String str) - Summary: Parses a string representation and creates a char array.
-
Contract:
- Returns {@code null} if input is {@code null} , empty array if input is empty or "\[\]".
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed char array, or {@code null} if input is null
-
Signature:
@SuppressFBWarnings @Override public char[] valueOf(final Object obj) - Summary: Converts an object to a char array.
-
Contract:
- Returns {@code null} if input is {@code null} .
-
Parameters:
-
obj(Object) — the object to convert (can be a Clob or other type)
-
- Returns: the char array representation of the object, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final char[] x) throws IOException - Summary: Appends the string representation of a char array to an Appendable.
-
Contract:
- Appends "null" if the array is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(char[]) — the char array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final char[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a char array to a CharacterWriter.
-
Contract:
- If a character quotation is specified in the config, characters are quoted.
- Single quotes within characters are escaped when using single quote quotation.
- Writes "null" if the array is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(char[]) — the char array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that may specify character quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> char\[\]
-
Signature:
@Override public char[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Character objects to a primitive char array.
-
Contract:
- Returns {@code null} if the input collection is {@code null} .
-
Parameters:
-
c(Collection<?>) — the Collection of Character objects to convert
-
- Returns: a char array containing the unboxed values, or {@code null} if input is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final char[] x, final Collection<E> output) - Summary: Converts a char array to a Collection.
-
Contract:
- Does nothing if the input array is {@code null} or empty.
-
Parameters:
-
x(char[]) — the char array to convert -
output(Collection<E>) — the Collection to add the boxed Character values to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final char[] x) - Summary: Calculates the hash code for a char array.
-
Parameters:
-
x(char[]) — the char array to hash
-
- Returns: the hash code of the array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final char[] x, final char[] y) - Summary: Compares two char arrays for equality.
-
Contract:
- Arrays are considered equal if they have the same length and all corresponding elements are equal.
-
Parameters:
-
x(char[]) — the first char array -
y(char[]) — the second char array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString(final char[] x) - Summary: Converts a char array to a readable string representation.
-
Contract:
- Returns "null" if the array is {@code null} .
-
Parameters:
-
x(char[]) — the char array to convert
-
- Returns: a string representation suitable for display
Class PrimitiveCharListType (com.landawn.abacus.type.PrimitiveCharListType)
Type handler for CharList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<CharList>
-
Signature:
@Override public Class<CharList> clazz() - Summary: Returns the Class object representing the CharList type.
-
Parameters:
- (none)
- Returns: the Class object for CharList
getElementType(...) -> Type<Character>
-
Signature:
@Override public Type<Character> getElementType() - Summary: Returns the Type object for the char element type.
-
Parameters:
- (none)
- Returns: the Type object representing char elements
getParameterTypes(...) -> Type<Character>\[\]
-
Signature:
@Override public Type<Character>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Character Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final CharList x) - Summary: Converts a CharList to its string representation.
-
Contract:
- Returns {@code null} if the input list is {@code null} .
-
Parameters:
-
x(CharList) — the CharList to convert
-
- Returns: the string representation of the list, or {@code null} if input is null
valueOf(...) -> CharList
-
Signature:
@Override public CharList valueOf(final String str) - Summary: Parses a string representation and creates a CharList.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a CharList created from the parsed values, or {@code null} if input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final CharList x) throws IOException - Summary: Appends the string representation of a CharList to an Appendable.
-
Contract:
- Appends "null" if the list is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(CharList) — the CharList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final CharList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a CharList to a CharacterWriter.
-
Contract:
- Writes "null" if the list is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(CharList) — the CharList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class PrimitiveCharType (com.landawn.abacus.type.PrimitiveCharType)
Type handler for primitive char values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive char type.
-
Parameters:
- (none)
- Returns: the Class object for the primitive char type
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is for primitive char
defaultValue(...) -> Character
-
Signature:
@Override public Character defaultValue() - Summary: Returns the default value for the primitive char type.
-
Parameters:
- (none)
- Returns: Character value of 0 ('\\0') as the default value for primitive char
Class PrimitiveDoubleArrayType (com.landawn.abacus.type.PrimitiveDoubleArrayType)
Type handler for primitive double arrays (double\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<double\[\]>
-
Signature:
@Override public Class<double[]> clazz() - Summary: Returns the Class object representing the double array type.
-
Parameters:
- (none)
- Returns: the Class object for double\[\]
getElementType(...) -> Type<Double>
-
Signature:
@Override public Type<Double> getElementType() - Summary: Returns the Type object for the double element type.
-
Parameters:
- (none)
- Returns: the Type object representing Double/double elements
getParameterTypes(...) -> Type<Double>\[\]
-
Signature:
@Override public Type<Double>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Double Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final double[] x) - Summary: Converts a double array to its string representation.
-
Contract:
- Returns {@code null} if the input array is {@code null} , or "\[\]" if the array is empty.
-
Parameters:
-
x(double[]) — the double array to convert
-
- Returns: the string representation of the array, or {@code null} if input is null
valueOf(...) -> double\[\]
-
Signature:
@Override public double[] valueOf(final String str) - Summary: Parses a string representation and creates a double array.
-
Contract:
- Returns {@code null} if input is {@code null} , empty array if input is empty or "\[\]".
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed double array, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final double[] x) throws IOException - Summary: Appends the string representation of a double array to an Appendable.
-
Contract:
- Appends "null" if the array is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(double[]) — the double array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final double[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a double array to a CharacterWriter.
-
Contract:
- Writes "null" if the array is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(double[]) — the double array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for double arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> double\[\]
-
Signature:
@Override public double[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Double objects to a primitive double array.
-
Contract:
- Returns {@code null} if the input collection is {@code null} .
-
Parameters:
-
c(Collection<?>) — the Collection of Double objects to convert
-
- Returns: a double array containing the unboxed values, or {@code null} if input is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final double[] x, final Collection<E> output) - Summary: Converts a double array to a Collection.
-
Contract:
- Does nothing if the input array is {@code null} or empty.
-
Parameters:
-
x(double[]) — the double array to convert -
output(Collection<E>) — the Collection to add the boxed Double values to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final double[] x) - Summary: Calculates the hash code for a double array.
-
Parameters:
-
x(double[]) — the double array to hash
-
- Returns: the hash code of the array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final double[] x, final double[] y) - Summary: Compares two double arrays for equality.
-
Contract:
- Arrays are considered equal if they have the same length and all corresponding elements are equal.
-
Parameters:
-
x(double[]) — the first double array -
y(double[]) — the second double array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveDoubleListType (com.landawn.abacus.type.PrimitiveDoubleListType)
Type handler for DoubleList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<DoubleList>
-
Signature:
@Override public Class<DoubleList> clazz() - Summary: Returns the Class object representing the DoubleList type.
-
Parameters:
- (none)
- Returns: the Class object for DoubleList
getElementType(...) -> Type<Double>
-
Signature:
@Override public Type<Double> getElementType() - Summary: Returns the Type object for the double element type.
-
Parameters:
- (none)
- Returns: the Type object representing double elements
getParameterTypes(...) -> Type<Double>\[\]
-
Signature:
@Override public Type<Double>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Double Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final DoubleList x) - Summary: Converts a DoubleList to its string representation.
-
Contract:
- Returns {@code null} if the input list is {@code null} .
-
Parameters:
-
x(DoubleList) — the DoubleList to convert
-
- Returns: the string representation of the list, or {@code null} if input is null
valueOf(...) -> DoubleList
-
Signature:
@Override public DoubleList valueOf(final String str) - Summary: Parses a string representation and creates a DoubleList.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a DoubleList created from the parsed values, or {@code null} if input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final DoubleList x) throws IOException - Summary: Appends the string representation of a DoubleList to an Appendable.
-
Contract:
- Appends "null" if the list is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(DoubleList) — the DoubleList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final DoubleList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a DoubleList to a CharacterWriter.
-
Contract:
- Writes "null" if the list is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(DoubleList) — the DoubleList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class PrimitiveDoubleType (com.landawn.abacus.type.PrimitiveDoubleType)
Type handler for primitive double values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive double type.
-
Parameters:
- (none)
- Returns: the Class object for the primitive double type
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is for primitive double
defaultValue(...) -> Double
-
Signature:
@Override public Double defaultValue() - Summary: Returns the default value for the primitive double type.
-
Parameters:
- (none)
- Returns: Double value of 0.0 as the default value for primitive double
Class PrimitiveFloatArrayType (com.landawn.abacus.type.PrimitiveFloatArrayType)
Type handler for primitive float arrays (float\[\]).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<float\[\]>
-
Signature:
@Override public Class<float[]> clazz() - Summary: Returns the Class object representing the float array type.
-
Parameters:
- (none)
- Returns: the Class object for float\[\]
getElementType(...) -> Type<Float>
-
Signature:
@Override public Type<Float> getElementType() - Summary: Returns the Type object for the float element type.
-
Parameters:
- (none)
- Returns: the Type object representing Float/float elements
getParameterTypes(...) -> Type<Float>\[\]
-
Signature:
@Override public Type<Float>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Float Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final float[] x) - Summary: Converts a float array to its string representation.
-
Contract:
- Returns {@code null} if the input array is {@code null} , or "\[\]" if the array is empty.
-
Parameters:
-
x(float[]) — the float array to convert
-
- Returns: the string representation of the array, or {@code null} if input is null
valueOf(...) -> float\[\]
-
Signature:
@Override public float[] valueOf(final String str) - Summary: Parses a string representation and creates a float array.
-
Contract:
- Returns {@code null} if input is {@code null} , empty array if input is empty or "\[\]".
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed float array, or {@code null} if input is null
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final float[] x) throws IOException - Summary: Appends the string representation of a float array to an Appendable.
-
Contract:
- Appends "null" if the array is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(float[]) — the float array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final float[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a float array to a CharacterWriter.
-
Contract:
- Writes "null" if the array is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(float[]) — the float array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for float arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> float\[\]
-
Signature:
@Override public float[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Float objects to a primitive float array.
-
Contract:
- Returns {@code null} if the input collection is {@code null} .
-
Parameters:
-
c(Collection<?>) — the Collection of Float objects to convert
-
- Returns: a float array containing the unboxed values, or {@code null} if input is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final float[] x, final Collection<E> output) - Summary: Converts a float array to a Collection.
-
Contract:
- Does nothing if the input array is {@code null} or empty.
-
Parameters:
-
x(float[]) — the float array to convert -
output(Collection<E>) — the Collection to add the boxed Float values to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final float[] x) - Summary: Calculates the hash code for a float array.
-
Parameters:
-
x(float[]) — the float array to hash
-
- Returns: the hash code of the array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final float[] x, final float[] y) - Summary: Compares two float arrays for equality.
-
Contract:
- Arrays are considered equal if they have the same length and all corresponding elements are equal.
-
Parameters:
-
x(float[]) — the first float array -
y(float[]) — the second float array
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveFloatListType (com.landawn.abacus.type.PrimitiveFloatListType)
Type handler for FloatList objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<FloatList>
-
Signature:
@Override public Class<FloatList> clazz() - Summary: Returns the Class object representing the FloatList type.
-
Parameters:
- (none)
- Returns: the Class object for FloatList
getElementType(...) -> Type<Float>
-
Signature:
@Override public Type<Float> getElementType() - Summary: Returns the Type object for the float element type.
-
Parameters:
- (none)
- Returns: the Type object representing float elements
getParameterTypes(...) -> Type<Float>\[\]
-
Signature:
@Override public Type<Float>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Float Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final FloatList x) - Summary: Converts a FloatList to its string representation.
-
Contract:
- Returns {@code null} if the input list is {@code null} .
-
Parameters:
-
x(FloatList) — the FloatList to convert
-
- Returns: the string representation of the list, or {@code null} if input is null
valueOf(...) -> FloatList
-
Signature:
@Override public FloatList valueOf(final String str) - Summary: Parses a string representation and creates a FloatList.
-
Contract:
- Returns {@code null} if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a FloatList created from the parsed values, or {@code null} if input is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final FloatList x) throws IOException - Summary: Appends the string representation of a FloatList to an Appendable.
-
Contract:
- Appends "null" if the list is {@code null} .
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(FloatList) — the FloatList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final FloatList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a FloatList to a CharacterWriter.
-
Contract:
- Writes "null" if the list is {@code null} .
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(FloatList) — the FloatList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class PrimitiveFloatType (com.landawn.abacus.type.PrimitiveFloatType)
Type handler for primitive float values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive float type.
-
Parameters:
- (none)
- Returns: the Class object for the primitive float type
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , as this type handler is for primitive float
defaultValue(...) -> Float
-
Signature:
@Override public Float defaultValue() - Summary: Returns the default value for the primitive float type.
-
Parameters:
- (none)
- Returns: Float value of 0.0f as the default value for primitive float
Class PrimitiveIntArrayType (com.landawn.abacus.type.PrimitiveIntArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<int\[\]>
-
Signature:
@Override public Class<int[]> clazz() - Summary: Returns the Class object representing the primitive int array type (int\[\].class).
-
Parameters:
- (none)
- Returns: the Class object for int\[\] type
getElementType(...) -> Type<Integer>
-
Signature:
@Override public Type<Integer> getElementType() - Summary: Returns the Type instance for the element type of this array, which is Integer.
-
Parameters:
- (none)
- Returns: the Type instance representing Integer type for array elements
getParameterTypes(...) -> Type<Integer>\[\]
-
Signature:
@Override public Type<Integer>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Integer Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final int[] x) - Summary: Converts a primitive int array to its string representation.
-
Parameters:
-
x(int[]) — the int array to convert to string
-
- Returns: the string representation of the array, or {@code null} if the input array is {@code null} . Returns "\[\]" for empty arrays.
valueOf(...) -> int\[\]
-
Signature:
@Override public int[] valueOf(final String str) - Summary: Parses a string representation of an int array and returns the corresponding int array.
-
Contract:
- The string should contain comma-separated integer values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed int array, or {@code null} if the input string is {@code null} , empty, or blank. Returns an empty array for "\[\]".
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final int[] x) throws IOException - Summary: Appends the string representation of an int array to the given Appendable.
-
Contract:
- If the array is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(int[]) — the int array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final int[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an int array to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(int[]) — the int array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for primitive arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
collectionToArray(...) -> int\[\]
-
Signature:
@Override public int[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Integer objects to a primitive int array.
-
Parameters:
-
c(Collection<?>) — the Collection of Integer objects to convert
-
- Returns: a primitive int array containing all elements from the collection, or {@code null} if the input collection is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final int[] x, final Collection<E> output) - Summary: Converts a primitive int array to a Collection by adding all array elements to the provided collection.
-
Parameters:
-
x(int[]) — the int array to convert -
output(Collection<E>) — the Collection to add the array elements to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final int[] x) - Summary: Computes and returns the hash code for the given int array.
-
Parameters:
-
x(int[]) — the int array to compute hash code for
-
- Returns: the hash code of the array, or 0 if the array is null
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final int[] x, final int[] y) - Summary: Compares two int arrays for equality.
-
Contract:
- Two arrays are considered equal if they have the same length and contain the same elements in the same order.
-
Parameters:
-
x(int[]) — the first int array to compare -
y(int[]) — the second int array to compare
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveIntListType (com.landawn.abacus.type.PrimitiveIntListType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<IntList>
-
Signature:
@Override public Class<IntList> clazz() - Summary: Returns the Class object representing the IntList type.
-
Parameters:
- (none)
- Returns: the Class object for IntList.class
getElementType(...) -> Type<Integer>
-
Signature:
@Override public Type<Integer> getElementType() - Summary: Returns the Type instance for the element type of this list, which is primitive int.
-
Parameters:
- (none)
- Returns: the Type instance representing int type for list elements
getParameterTypes(...) -> Type<Integer>\[\]
-
Signature:
@Override public Type<Integer>[] getParameterTypes() - Summary: Returns the parameter types associated with this list type.
-
Parameters:
- (none)
- Returns: an array containing the Integer Type that describes the elements of this list type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final IntList x) - Summary: Converts an IntList to its string representation.
-
Parameters:
-
x(IntList) — the IntList to convert to string
-
- Returns: the string representation of the list, or {@code null} if the input list is null
valueOf(...) -> IntList
-
Signature:
@Override public IntList valueOf(final String str) - Summary: Parses a string representation of an int list and returns the corresponding IntList.
-
Contract:
- The string should contain comma-separated integer values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed IntList, or {@code null} if the input string is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final IntList x) throws IOException - Summary: Appends the string representation of an IntList to the given Appendable.
-
Contract:
- If the list is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(IntList) — the IntList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final IntList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an IntList to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(IntList) — the IntList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (passed through to the array type writer)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class PrimitiveIntType (com.landawn.abacus.type.PrimitiveIntType)
Type handler for primitive int values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive int type.
-
Parameters:
- (none)
- Returns: the Class object for int.class
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a primitive type
defaultValue(...) -> Integer
-
Signature:
@Override public Integer defaultValue() - Summary: Returns the default value for the primitive int type.
-
Parameters:
- (none)
- Returns: Integer object containing the value 0
Class PrimitiveLongArrayType (com.landawn.abacus.type.PrimitiveLongArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive long array type (long\[\].class).
-
Parameters:
- (none)
- Returns: the Class object for long\[\] type
getElementType(...) -> Type<Long>
-
Signature:
@Override public Type<Long> getElementType() - Summary: Returns the Type instance for the element type of this array, which is Long.
-
Parameters:
- (none)
- Returns: the Type instance representing Long type for array elements
getParameterTypes(...) -> Type<Long>\[\]
-
Signature:
@Override public Type<Long>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Long Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final long[] x) - Summary: Converts a primitive long array to its string representation.
-
Parameters:
-
x(long[]) — the long array to convert to string
-
- Returns: the string representation of the array, or {@code null} if the input array is {@code null} . Returns "\[\]" for empty arrays.
valueOf(...) -> long\[\]
-
Signature:
@Override public long[] valueOf(final String str) - Summary: Parses a string representation of a long array and returns the corresponding long array.
-
Contract:
- The string should contain comma-separated long values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed long array, or {@code null} if the input string is {@code null} . Returns an empty array for empty string or "\[\]".
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final long[] x) throws IOException - Summary: Appends the string representation of a long array to the given Appendable.
-
Contract:
- If the array is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(long[]) — the long array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final long[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a long array to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(long[]) — the long array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for primitive arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
collectionToArray(...) -> long\[\]
-
Signature:
@Override public long[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Long objects to a primitive long array.
-
Parameters:
-
c(Collection<?>) — the Collection of Long objects to convert
-
- Returns: a primitive long array containing all elements from the collection, or {@code null} if the input collection is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final long[] x, final Collection<E> output) - Summary: Converts a primitive long array to a Collection by adding all array elements to the provided collection.
-
Parameters:
-
x(long[]) — the long array to convert -
output(Collection<E>) — the Collection to add the array elements to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final long[] x) - Summary: Computes and returns the hash code for the given long array.
-
Parameters:
-
x(long[]) — the long array to compute hash code for
-
- Returns: the hash code of the array, or 0 if the array is null
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final long[] x, final long[] y) - Summary: Compares two long arrays for equality.
-
Contract:
- Two arrays are considered equal if they have the same length and contain the same elements in the same order.
-
Parameters:
-
x(long[]) — the first long array to compare -
y(long[]) — the second long array to compare
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveLongListType (com.landawn.abacus.type.PrimitiveLongListType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<LongList>
-
Signature:
@Override public Class<LongList> clazz() - Summary: Returns the Class object representing the LongList type.
-
Parameters:
- (none)
- Returns: the Class object for LongList.class
getElementType(...) -> Type<?>
-
Signature:
@Override public Type<?> getElementType() - Summary: Returns the Type instance for the element type of this list, which is primitive long.
-
Parameters:
- (none)
- Returns: the Type instance representing long type for list elements
getParameterTypes(...) -> Type<Long>\[\]
-
Signature:
@Override public Type<Long>[] getParameterTypes() - Summary: Returns the parameter types associated with this list type.
-
Parameters:
- (none)
- Returns: an array containing the Long Type that describes the elements of this list type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final LongList x) - Summary: Converts a LongList to its string representation.
-
Parameters:
-
x(LongList) — the LongList to convert to string
-
- Returns: the string representation of the list, or {@code null} if the input list is null
valueOf(...) -> LongList
-
Signature:
@Override public LongList valueOf(final String str) - Summary: Parses a string representation of a long list and returns the corresponding LongList.
-
Contract:
- The string should contain comma-separated long values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed LongList, or {@code null} if the input string is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final LongList x) throws IOException - Summary: Appends the string representation of a LongList to the given Appendable.
-
Contract:
- If the list is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(LongList) — the LongList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final LongList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a LongList to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(LongList) — the LongList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (passed through to the array type writer)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class PrimitiveLongType (com.landawn.abacus.type.PrimitiveLongType)
Type handler for primitive long values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive long type.
-
Parameters:
- (none)
- Returns: the Class object for long.class
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a primitive type
defaultValue(...) -> Long
-
Signature:
@Override public Long defaultValue() - Summary: Returns the default value for the primitive long type.
-
Parameters:
- (none)
- Returns: Long object containing the value 0L
Class PrimitiveShortArrayType (com.landawn.abacus.type.PrimitiveShortArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive short array type (short\[\].class).
-
Parameters:
- (none)
- Returns: the Class object for short\[\] type
getElementType(...) -> Type<Short>
-
Signature:
@Override public Type<Short> getElementType() - Summary: Returns the Type instance for the element type of this array, which is Short.
-
Parameters:
- (none)
- Returns: the Type instance representing Short type for array elements
getParameterTypes(...) -> Type<Short>\[\]
-
Signature:
@Override public Type<Short>[] getParameterTypes() - Summary: Returns the parameter types associated with this array type.
-
Parameters:
- (none)
- Returns: an array containing the Short Type that describes the elements of this array type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final short[] x) - Summary: Converts a primitive short array to its string representation.
-
Parameters:
-
x(short[]) — the short array to convert to string
-
- Returns: the string representation of the array, or {@code null} if the input array is {@code null} . Returns "\[\]" for empty arrays.
valueOf(...) -> short\[\]
-
Signature:
@Override public short[] valueOf(final String str) - Summary: Parses a string representation of a short array and returns the corresponding short array.
-
Contract:
- The string should contain comma-separated short values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed short array, or {@code null} if the input string is {@code null} . Returns an empty array for empty string or "\[\]".
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final short[] x) throws IOException - Summary: Appends the string representation of a short array to the given Appendable.
-
Contract:
- If the array is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(short[]) — the short array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final short[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a short array to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(short[]) — the short array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for primitive arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
collectionToArray(...) -> short\[\]
-
Signature:
@Override public short[] collectionToArray(final Collection<?> c) - Summary: Converts a Collection of Short objects to a primitive short array.
-
Parameters:
-
c(Collection<?>) — the Collection of Short objects to convert
-
- Returns: a primitive short array containing all elements from the collection, or {@code null} if the input collection is null
arrayToCollection(...) -> void
-
Signature:
@Override public <E> void arrayToCollection(final short[] x, final Collection<E> output) - Summary: Converts a primitive short array to a Collection by adding all array elements to the provided collection.
-
Parameters:
-
x(short[]) — the short array to convert -
output(Collection<E>) — the Collection to add the array elements to
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode(final short[] x) - Summary: Computes and returns the hash code for the given short array.
-
Parameters:
-
x(short[]) — the short array to compute hash code for
-
- Returns: the hash code of the array, or 0 if the array is null
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final short[] x, final short[] y) - Summary: Compares two short arrays for equality.
-
Contract:
- Two arrays are considered equal if they have the same length and contain the same elements in the same order.
-
Parameters:
-
x(short[]) — the first short array to compare -
y(short[]) — the second short array to compare
-
- Returns: {@code true} if the arrays are equal, {@code false} otherwise
Class PrimitiveShortListType (com.landawn.abacus.type.PrimitiveShortListType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<ShortList>
-
Signature:
@Override public Class<ShortList> clazz() - Summary: Returns the Class object representing the ShortList type.
-
Parameters:
- (none)
- Returns: the Class object for ShortList.class
getElementType(...) -> Type<Short>
-
Signature:
@Override public Type<Short> getElementType() - Summary: Returns the Type instance for the element type of this list, which is primitive short.
-
Parameters:
- (none)
- Returns: the Type instance representing short type for list elements
getParameterTypes(...) -> Type<Short>\[\]
-
Signature:
@Override public Type<Short>[] getParameterTypes() - Summary: Returns the parameter types associated with this list type.
-
Parameters:
- (none)
- Returns: an array containing the Short Type that describes the elements of this list type
- See also: #getElementType()
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ShortList x) - Summary: Converts a ShortList to its string representation.
-
Parameters:
-
x(ShortList) — the ShortList to convert to string
-
- Returns: the string representation of the list, or {@code null} if the input list is null
valueOf(...) -> ShortList
-
Signature:
@Override public ShortList valueOf(final String str) - Summary: Parses a string representation of a short list and returns the corresponding ShortList.
-
Contract:
- The string should contain comma-separated short values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed ShortList, or {@code null} if the input string is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final ShortList x) throws IOException - Summary: Appends the string representation of a ShortList to the given Appendable.
-
Contract:
- If the list is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(ShortList) — the ShortList to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final ShortList x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a ShortList to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(ShortList) — the ShortList to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (passed through to the array type writer)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class PrimitiveShortType (com.landawn.abacus.type.PrimitiveShortType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the primitive short type.
-
Parameters:
- (none)
- Returns: the Class object for short.class
isPrimitiveType(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveType() - Summary: Indicates whether this type represents a primitive type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a primitive type
defaultValue(...) -> Short
-
Signature:
@Override public Short defaultValue() - Summary: Returns the default value for the primitive short type.
-
Parameters:
- (none)
- Returns: Short object containing the value 0
get(...) -> Short
-
Signature:
@Override public Short get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a short value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Short> type = TypeFactory.getType(short.class); // Assuming rs is a ResultSet with a short value in column 1 Short value = type.get(rs, 1); System.out.println(value); // Output: the short value from the database // If the column contains NULL Short nullValue = type.get(rs, 2); System.out.println(nullValue); // Output: null } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the short value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Short get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a short value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Short> type = TypeFactory.getType(short.class); // Assuming rs is a ResultSet with a short value in column "age" Short age = type.get(rs, "age"); System.out.println(age); // Output: the short value from the database // If the column contains NULL Short nullValue = type.get(rs, "missing_column"); System.out.println(nullValue); // Output: null } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the short value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
Class RangeType (com.landawn.abacus.type.RangeType)
Type handler for Range objects containing comparable values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes the Range class name and its parameterized type in angle brackets.
-
Parameters:
- (none)
- Returns: the declaring name in the format "Range < ElementType > "
clazz(...) -> Class<Range<T>>
-
Signature:
@Override public Class<Range<T>> clazz() - Summary: Returns the Class object representing the Range type.
-
Parameters:
- (none)
- Returns: the Class object for Range.class
getElementType(...) -> Type<T>
-
Signature:
@Override public Type<T> getElementType() - Summary: Returns the Type instance for the element type of this Range.
-
Parameters:
- (none)
- Returns: the Type instance for the element type
getParameterTypes(...) -> Type<T>\[\]
-
Signature:
@Override public Type<T>[] getParameterTypes() - Summary: Returns an array containing the Type instances for the parameter types of this Range.
-
Parameters:
- (none)
- Returns: an array with one Type instance representing the element type of the Range
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a generic type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Range<T> x) - Summary: Converts a Range object to its string representation.
-
Parameters:
-
x(Range<T>) — the Range to convert to string
-
- Returns: the string representation of the Range, or {@code null} if the input is null
valueOf(...) -> Range<T>
-
Signature:
@Override public Range<T> valueOf(String str) - Summary: Parses a string representation of a Range and returns the corresponding Range object.
-
Contract:
- The string should be in one of the following formats: - "(lower, upper)" for open-open range - "(lower, upper\]" for open-closed range - "\[lower, upper)" for closed-open range - "\[lower, upper\]" for closed-closed range
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed Range object, or {@code null} if the input string is {@code null} or empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Range<T> x) throws IOException - Summary: Appends the string representation of a Range to the given Appendable.
-
Contract:
- If the Range is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(Range<T>) — the Range to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Range<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Range to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Range<T>) — the Range to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that determines string quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class ReaderType (com.landawn.abacus.type.ReaderType)
Type handler for java.io.Reader and its subclasses.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Reader>
-
Signature:
@Override public Class<Reader> clazz() - Summary: Returns the Class object representing the Reader type or its subclass.
-
Parameters:
- (none)
- Returns: the Class object for Reader.class or the specific Reader subclass
isReader(...) -> boolean
-
Signature:
@Override public boolean isReader() - Summary: Indicates whether this type represents a Reader.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a Reader type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Reader x) - Summary: Converts a Reader to its string representation by reading all content from the Reader.
-
Parameters:
-
x(Reader) — the Reader to convert to string
-
- Returns: the string containing all content read from the Reader, or {@code null} if the input is null
valueOf(...) -> Reader
-
Signature:
@Override public Reader valueOf(final String str) - Summary: Creates a Reader instance from a string value.
-
Contract:
- If the concrete Reader class has a constructor accepting String or Reader, it will be used.
-
Parameters:
-
str(String) — the string to create a Reader from
-
- Returns: a Reader containing the string content, or {@code null} if the input string is null
-
Signature:
@SuppressFBWarnings @Override public Reader valueOf(final Object obj) - Summary: Creates a Reader from various object types.
-
Contract:
- If the object is a Clob, its character stream is returned.
-
Parameters:
-
obj(Object) — the object to convert to a Reader
-
- Returns: a Reader representation of the object, or {@code null} if the input is null
get(...) -> Reader
-
Signature:
@Override public Reader get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a character stream (Reader) from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the Reader for the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Reader get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a character stream (Reader) from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the Reader for the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x) throws SQLException - Summary: Sets a Reader parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(Reader) — the Reader to set as the parameter value
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x) throws SQLException - Summary: Sets a Reader parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader to set as the parameter value
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a Reader parameter in a PreparedStatement with a specified length.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(Reader) — the Reader to set as the parameter value -
sqlTypeOrLength(int) — the length of the stream in characters
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Reader x, final int sqlTypeOrLength) throws SQLException - Summary: Sets a Reader parameter in a CallableStatement with a specified length.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Reader) — the Reader to set as the parameter value -
sqlTypeOrLength(int) — the length of the stream in characters
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Reader x) throws IOException - Summary: Appends the content of a Reader to the given Appendable.
-
Contract:
- If the Appendable is a Writer, the content is copied directly.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(Reader) — the Reader whose content should be appended
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Reader x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the content of a Reader to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Reader) — the Reader whose content should be written -
config(JsonXmlSerializationConfig<?>) — the serialization configuration that determines string quotation
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class RefType (com.landawn.abacus.type.RefType)
Type handler for java.sql.Ref objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Ref>
-
Signature:
@Override public Class<Ref> clazz() - Summary: Returns the Class object representing the SQL Ref type.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.Ref.class
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this type is serializable.
-
Parameters:
- (none)
- Returns: {@code false} , indicating this type is not serializable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Ref x) throws UnsupportedOperationException - Summary: Converts a Ref object to its string representation.
-
Parameters:
-
x(Ref) — the Ref object to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as Ref cannot be converted to string
-
valueOf(...) -> Ref
-
Signature:
@Override public Ref valueOf(final String str) throws UnsupportedOperationException - Summary: Creates a Ref object from a string representation.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as Ref cannot be created from string
-
get(...) -> Ref
-
Signature:
@Override public Ref get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a SQL REF value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Ref> type = TypeFactory.getType(Ref.class); // Assuming rs is a ResultSet with a REF value in column 1 Ref ref = type.get(rs, 1); if (ref != null) { String baseTypeName = ref.getBaseTypeName(); System.out.println("Referenced type: " + baseTypeName); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the Ref value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Ref get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a SQL REF value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Ref> type = TypeFactory.getType(Ref.class); // Assuming rs is a ResultSet with a REF value in column "object_ref" Ref ref = type.get(rs, "object_ref"); if (ref != null) { Object referencedObject = ref.getObject(); System.out.println("Referenced object: " + referencedObject); } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the Ref value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Ref x) throws SQLException - Summary: Sets a Ref parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(Ref) — the Ref value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Ref x) throws SQLException - Summary: Sets a Ref parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Ref) — the Ref value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class RowIdType (com.landawn.abacus.type.RowIdType)
Type handler for java.sql.RowId objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<RowId>
-
Signature:
@Override public Class<RowId> clazz() - Summary: Returns the Class object representing the SQL RowId type.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.RowId.class
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this type is serializable.
-
Parameters:
- (none)
- Returns: {@code false} , indicating this type is not serializable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final RowId x) - Summary: Converts a RowId object to its string representation.
-
Parameters:
-
x(RowId) — the RowId object to convert
-
- Returns: the string representation of the RowId, or {@code null} if the input is null
valueOf(...) -> RowId
-
Signature:
@Override public RowId valueOf(final String str) throws UnsupportedOperationException - Summary: Creates a RowId object from a string representation.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as RowId cannot be created from string
-
get(...) -> RowId
-
Signature:
@Override public RowId get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a SQL ROWID value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the RowId value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public RowId get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a SQL ROWID value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the RowId value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final RowId x) throws SQLException - Summary: Sets a RowId parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(RowId) — the RowId value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final RowId x) throws SQLException - Summary: Sets a RowId parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(RowId) — the RowId value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final RowId x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a RowId to the given CharacterWriter.
-
Contract:
- If the RowId is {@code null} , writes "null".
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(RowId) — the RowId to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for RowId)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class SQLArrayType (com.landawn.abacus.type.SQLArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Array>
-
Signature:
@Override public Class<Array> clazz() - Summary: Returns the Class object representing the SQL Array type.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.Array.class
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this type is serializable.
-
Parameters:
- (none)
- Returns: {@code false} , indicating this type is not serializable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Array x) throws UnsupportedOperationException - Summary: Converts an Array object to its string representation.
-
Parameters:
-
x(Array) — the Array object to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as Array cannot be converted to string
-
valueOf(...) -> Array
-
Signature:
@Override public Array valueOf(final String str) throws UnsupportedOperationException - Summary: Creates an Array object from a string representation.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as Array cannot be created from string
-
get(...) -> Array
-
Signature:
@Override public Array get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a SQL ARRAY value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the Array value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Array get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a SQL ARRAY value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the Array value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Array x) throws SQLException - Summary: Sets an Array parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(Array) — the Array value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Array x) throws SQLException - Summary: Sets an Array parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Array) — the Array value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class SQLXMLType (com.landawn.abacus.type.SQLXMLType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<SQLXML>
-
Signature:
@Override public Class<SQLXML> clazz() - Summary: Returns the Class object representing the SQL XML type.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.SQLXML.class
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this type is serializable.
-
Parameters:
- (none)
- Returns: {@code false} , indicating this type is not serializable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final SQLXML x) throws UnsupportedOperationException - Summary: Converts a SQLXML object to its string representation.
-
Parameters:
-
x(SQLXML) — the SQLXML object to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as SQLXML cannot be directly converted to string
-
valueOf(...) -> SQLXML
-
Signature:
@Override public SQLXML valueOf(final String str) throws UnsupportedOperationException - Summary: Creates a SQLXML object from a string representation.
-
Contract:
- This operation is not supported for SQL XML types as they must be created by the database connection and cannot be instantiated from a string.
-
Parameters:
-
str(String) — the string to convert
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown as SQLXML cannot be created from string
-
get(...) -> SQLXML
-
Signature:
@Override public SQLXML get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a SQL XML value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the 1-based index of the column to retrieve
-
- Returns: the SQLXML value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public SQLXML get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a SQL XML value from the specified column in the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column to retrieve (column name or alias)
-
- Returns: the SQLXML value from the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final SQLXML x) throws SQLException - Summary: Sets a SQLXML parameter in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the 1-based index of the parameter to set -
x(SQLXML) — the SQLXML value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final SQLXML x) throws SQLException - Summary: Sets a SQLXML parameter in a CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(SQLXML) — the SQLXML value to set as the parameter
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is not found
-
Class SetMultimapType (com.landawn.abacus.type.SetMultimapType)
Type handler for SetMultimap, which maps keys to sets of values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final SetMultimap<K, E> x) - Summary: Converts a SetMultimap to its JSON string representation.
-
Parameters:
-
x(SetMultimap<K, E>) — the SetMultimap to convert to string
-
- Returns: the JSON string representation of the multimap, or {@code null} if the input is null
valueOf(...) -> SetMultimap<K, E>
-
Signature:
@SuppressWarnings("unchecked") @Override public SetMultimap<K, E> valueOf(final String str) - Summary: Parses a JSON string representation and returns the corresponding SetMultimap.
-
Contract:
- The string should represent a map where each key maps to a collection of values.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: the parsed SetMultimap, or {@code null} if the input string is {@code null} or empty
Class SheetType (com.landawn.abacus.type.SheetType)
Type handler for Sheet, which represents a two-dimensional table structure with row keys, column keys, and values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public SheetType(final String rowKeyTypeName, final String columnKeyTypeName, final String elementTypeName) - Summary: Constructs a SheetType with the specified type names for row keys, column keys, and values.
-
Parameters:
-
rowKeyTypeName(String) — the type name for row keys -
columnKeyTypeName(String) — the type name for column keys -
elementTypeName(String) — the type name for values/elements
-
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes the Sheet class name and its parameterized types in angle brackets using declaring names.
-
Parameters:
- (none)
- Returns: the declaring name in the format "Sheet < RowType, ColumnType, ElementType > "
clazz(...) -> Class<Sheet<R, C, E>>
-
Signature:
@Override public Class<Sheet<R, C, E>> clazz() - Summary: Returns the Class object representing the Sheet type.
-
Parameters:
- (none)
- Returns: the Class object for Sheet.class
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns an array containing the Type instances for the parameter types of this Sheet.
-
Parameters:
- (none)
- Returns: an array with Type instances for row key, column key, and element types
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} , indicating this is a generic type
isSerializable(...) -> boolean
-
Signature:
@Override public boolean isSerializable() - Summary: Indicates whether this type is serializable.
-
Parameters:
- (none)
- Returns: {@code false} , indicating this type is not serializable
getSerializationType(...) -> SerializationType
-
Signature:
@Override public SerializationType getSerializationType() - Summary: Returns the serialization type classification for Sheet objects.
-
Parameters:
- (none)
- Returns: {@link SerializationType#SHEET} , indicating this type uses sheet-based serialization
stringOf(...) -> String
-
Signature:
@SuppressWarnings("rawtypes") @Override public String stringOf(final Sheet x) - Summary: Converts a Sheet to its JSON string representation.
-
Parameters:
-
x(Sheet) — the Sheet to convert to string
-
- Returns: the JSON string representation of the sheet, or {@code null} if the input is null
valueOf(...) -> Sheet
-
Signature:
@SuppressWarnings("rawtypes") @Override public Sheet valueOf(final String str) - Summary: Parses a JSON string representation and returns the corresponding Sheet object.
-
Contract:
- The string should represent a valid sheet structure with row keys, column keys, and values.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: the parsed Sheet object, or {@code null} if the input string is {@code null} or empty
Class ShortArrayType (com.landawn.abacus.type.ShortArrayType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Short[] x) - Summary: Converts a Short object array to its string representation.
-
Parameters:
-
x(Short[]) — the Short array to convert to string
-
- Returns: the string representation of the array, or {@code null} if the input array is {@code null} . Returns "\[\]" for empty arrays.
valueOf(...) -> Short\[\]
-
Signature:
@Override public Short[] valueOf(final String str) - Summary: Parses a string representation of a Short array and returns the corresponding Short array.
-
Contract:
- The string should contain comma-separated values enclosed in square brackets.
-
Parameters:
-
str(String) — the string to parse, expected format is "\[value1, value2, ...\]"
-
- Returns: the parsed Short array, or {@code null} if the input string is {@code null} . Returns an empty array for empty string or "\[\]".
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Short[] x) throws IOException - Summary: Appends the string representation of a Short array to the given Appendable.
-
Contract:
- If the array itself is {@code null} , appends "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to (e.g., StringBuilder, Writer) -
x(Short[]) — the Short array to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Short[] x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Short array to the given CharacterWriter.
-
Contract:
- This method is optimized for performance when writing to character-based outputs.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Short[]) — the Short array to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration (currently unused for Short arrays)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class ShortType (com.landawn.abacus.type.ShortType)
Type handler for Short wrapper type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class clazz() - Summary: Returns the Class object representing the Short class.
-
Parameters:
- (none)
- Returns: the Class object for Short.class
isPrimitiveWrapper(...) -> boolean
-
Signature:
@Override public boolean isPrimitiveWrapper() - Summary: Indicates whether this type represents a primitive wrapper class.
-
Parameters:
- (none)
- Returns: {@code true} , indicating Short is a primitive wrapper
get(...) -> Short
-
Signature:
@Override public Short get(ResultSet rs, int columnIndex) throws SQLException - Summary: Retrieves a Short value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnIndex(int) — the column index (1-based) to retrieve the value from
-
- Returns: the Short value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
@Override public Short get(ResultSet rs, String columnName) throws SQLException - Summary: Retrieves a Short value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the data, must not be {@code null} -
columnName(String) — the label of the column to retrieve the value from, must not be {@code null}
-
- Returns: the Short value in the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
Class StringBufferType (com.landawn.abacus.type.StringBufferType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<StringBuffer>
-
Signature:
@Override public Class<StringBuffer> clazz() - Summary: Returns the Class object representing the StringBuffer type.
-
Parameters:
- (none)
- Returns: the Class object for StringBuffer.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final StringBuffer x) - Summary: Converts a StringBuffer object to its string representation.
-
Parameters:
-
x(StringBuffer) — the StringBuffer object to convert
-
- Returns: the string representation of the StringBuffer's content, or {@code null} if x is null
valueOf(...) -> StringBuffer
-
Signature:
@Override public StringBuffer valueOf(final String str) - Summary: Creates a StringBuffer object from its string representation.
-
Parameters:
-
str(String) — the string to convert to a StringBuffer
-
- Returns: a new StringBuffer containing the string content, or {@code null} if str is null
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this type are immutable.
-
Parameters:
- (none)
- Returns: {@code false} , as StringBuffer objects are mutable
Class StringBuilderType (com.landawn.abacus.type.StringBuilderType)
unspecified
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<StringBuilder>
-
Signature:
@Override public Class<StringBuilder> clazz() - Summary: Returns the Class object representing the StringBuilder type.
-
Parameters:
- (none)
- Returns: the Class object for StringBuilder.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final StringBuilder x) - Summary: Converts a StringBuilder object to its string representation.
-
Parameters:
-
x(StringBuilder) — the StringBuilder object to convert
-
- Returns: the string representation of the StringBuilder's content, or {@code null} if x is null
valueOf(...) -> StringBuilder
-
Signature:
@Override public StringBuilder valueOf(final String str) - Summary: Creates a StringBuilder object from its string representation.
-
Parameters:
-
str(String) — the string to convert to a StringBuilder
-
- Returns: a new StringBuilder containing the string content, or {@code null} if str is null
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Indicates whether instances of this type are immutable.
-
Parameters:
- (none)
- Returns: {@code false} , as StringBuilder objects are mutable
Class StringType (com.landawn.abacus.type.StringType)
Type handler for {@link String} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class TimeType (com.landawn.abacus.type.TimeType)
Type handler for {@link java.sql.Time} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Time>
-
Signature:
@Override public Class<Time> clazz() - Summary: Returns the Class object representing the Time type.
-
Parameters:
- (none)
- Returns: the Class object for java.sql.Time
valueOf(...) -> Time
-
Signature:
@Override public Time valueOf(final Object obj) - Summary: Converts an object to a Time.
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: a Time object, or {@code null} if obj is null
-
Signature:
@Override public Time valueOf(final String str) - Summary: Creates a Time from its string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Time object, or {@code null} if str is empty
-
Signature:
@Override public Time valueOf(final char[] cbuf, final int offset, final int len) - Summary: Creates a Time from a character array.
-
Contract:
- First attempts to parse as milliseconds if the format suggests a long value, otherwise delegates to string parsing.
-
Parameters:
-
cbuf(char[]) — the character buffer containing the value -
offset(int) — the start offset in the character buffer -
len(int) — the number of characters to use
-
- Returns: a Time object, or {@code null} if the input is {@code null} or empty
get(...) -> Time
-
Signature:
@Override public Time get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Time value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Time> type = TypeFactory.getType(Time.class); try (ResultSet rs = stmt.executeQuery("SELECT start_time FROM events")) { if (rs.next()) { Time startTime = type.get(rs, 1); System.out.println("Start time: " + startTime); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnIndex(int) — the index of the column to retrieve (1-based)
-
- Returns: a Time object, or {@code null} if the database value is null
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public Time get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Time value from the specified column in the ResultSet using the column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Time> type = TypeFactory.getType(Time.class); try (ResultSet rs = stmt.executeQuery("SELECT start_time FROM events")) { if (rs.next()) { Time startTime = type.get(rs, "start_time"); System.out.println("Start time: " + startTime); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet containing the query results -
columnName(String) — the label of the column to retrieve
-
- Returns: a Time object, or {@code null} if the database value is null
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnName is not found
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Time x) throws SQLException - Summary: Sets a Time value at the specified parameter index in the PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the index of the parameter to set (1-based) -
x(Time) — the Time value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the columnIndex is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Time x) throws SQLException - Summary: Sets a Time value for the specified parameter name in the CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter to set -
x(Time) — the Time value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameterName is not found
-
Class TimedType (com.landawn.abacus.type.TimedType)
Type handler for {@link Timed} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which uses simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Timed type
clazz(...) -> Class<Timed<T>>
-
Signature:
@Override public Class<Timed<T>> clazz() - Summary: Returns the Class object representing the Timed type.
-
Parameters:
- (none)
- Returns: the Class object for Timed
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this generic type.
-
Parameters:
- (none)
- Returns: an array containing the value type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Timed<T> x) - Summary: Converts a Timed object to its string representation.
-
Parameters:
-
x(Timed<T>) — the Timed object to convert
-
- Returns: the JSON string representation, or {@code null} if x is null
valueOf(...) -> Timed<T>
-
Signature:
@SuppressWarnings("unchecked") @Override public Timed<T> valueOf(final String str) - Summary: Creates a Timed object from its string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Timed object containing the parsed timestamp and value, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Timed<T> x) throws IOException - Summary: Appends the string representation of a Timed object to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Timed<T>) — the Timed object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Timed<T> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Timed object to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Timed<T>) — the Timed object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration for formatting options
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class TimestampType (com.landawn.abacus.type.TimestampType)
Type handler for {@link java.sql.Timestamp} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Timestamp>
-
Signature:
@Override public Class<Timestamp> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Timestamp.class}
valueOf(...) -> Timestamp
-
Signature:
@Override public Timestamp valueOf(final Object obj) - Summary: Converts the given object to a Timestamp.
-
Contract:
- <p> Conversion rules: <ul> <li> If obj is a Number, creates a Timestamp using the long value as milliseconds since epoch </li> <li> If obj is a java.util.Date, creates a Timestamp from the date's time value </li> <li> If obj is {@code null} , returns null </li> <li> Otherwise, converts obj to string and parses it as a Timestamp </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Timestamp> type = TypeFactory.getType(Timestamp.class); Timestamp ts1 = type.valueOf(1609459200000L); // From milliseconds Timestamp ts2 = type.valueOf(new Date()); // From Date Timestamp ts3 = type.valueOf("2021-01-01 00:00:00"); // From String } </pre>
-
Parameters:
-
obj(Object) — the object to convert to Timestamp
-
- Returns: a Timestamp representation of the object, or {@code null} if obj is null
-
Signature:
@Override public Timestamp valueOf(final String str) - Summary: Parses the given string into a Timestamp.
-
Contract:
- <p> Special handling: <ul> <li> If str is {@code null} or empty, returns null </li> <li> If str equals "SYS_TIME", returns the current timestamp </li> <li> Otherwise, parses the string using the configured date format </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Timestamp> type = TypeFactory.getType(Timestamp.class); Timestamp ts1 = type.valueOf("2021-01-01 12:30:45"); Timestamp ts2 = type.valueOf("SYS_TIME"); // Returns current timestamp Timestamp ts3 = type.valueOf(null); // Returns null } </pre>
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Timestamp parsed from the string, or {@code null} if str is empty
-
Signature:
@Override public Timestamp valueOf(final char[] cbuf, final int offset, final int len) - Summary: Parses a character array into a Timestamp.
-
Contract:
- If that fails, it converts the character array to a string and parses it using the string parsing logic.
-
Parameters:
-
cbuf(char[]) — the character array containing the timestamp representation -
offset(int) — the starting position in the character array -
len(int) — the number of characters to parse
-
- Returns: a Timestamp parsed from the character array, or {@code null} if the array is {@code null} or length is 0
get(...) -> Timestamp
-
Signature:
@Override public Timestamp get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a Timestamp value from the specified column in the ResultSet.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Timestamp> type = TypeFactory.getType(Timestamp.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Timestamp createdAt = type.get(rs, 1); System.out.println("Created at: " + createdAt); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based)
-
- Returns: the Timestamp value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public Timestamp get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a Timestamp value from the specified column in the ResultSet using the column label.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Type<Timestamp> type = TypeFactory.getType(Timestamp.class); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { Timestamp updatedAt = type.get(rs, "updated_at"); System.out.println("Updated at: " + updatedAt); } } } </pre>
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the column label/name
-
- Returns: the Timestamp value at the specified column, or {@code null} if the column value is SQL NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final Timestamp x) throws SQLException - Summary: Sets a Timestamp parameter in the PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the parameter on -
columnIndex(int) — the parameter index (1-based) -
x(Timestamp) — the Timestamp value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final Timestamp x) throws SQLException - Summary: Sets a named Timestamp parameter in the CallableStatement.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the parameter on -
parameterName(String) — the name of the parameter -
x(Timestamp) — the Timestamp value to set, may be null
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class TripleType (com.landawn.abacus.type.TripleType)
Type handler for {@link Triple} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which uses simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Triple type
clazz(...) -> Class<Triple<L, M, R>>
-
Signature:
@Override public Class<Triple<L, M, R>> clazz() - Summary: Returns the Class object representing the Triple type.
-
Parameters:
- (none)
- Returns: the Class object for Triple
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this generic type.
-
Parameters:
- (none)
- Returns: an array containing the left, middle, and right types
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Triple<L, M, R> x) - Summary: Converts a Triple object to its string representation.
-
Parameters:
-
x(Triple<L, M, R>) — the Triple object to convert
-
- Returns: the JSON string representation, or {@code null} if x is null
valueOf(...) -> Triple<L, M, R>
-
Signature:
@SuppressWarnings("unchecked") @Override public Triple<L, M, R> valueOf(final String str) - Summary: Creates a Triple object from its string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Triple object containing the parsed values, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Triple<L, M, R> x) throws IOException - Summary: Appends the string representation of a Triple object to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Triple<L, M, R>) — the Triple object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Triple<L, M, R> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Triple object to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Triple<L, M, R>) — the Triple object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration for formatting options
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple1Type (com.landawn.abacus.type.Tuple1Type)
Type handler for {@link Tuple1} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which uses simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple1 type
clazz(...) -> Class<Tuple1<T1>>
-
Signature:
@Override public Class<Tuple1<T1>> clazz() - Summary: Returns the Class object representing the Tuple1 type.
-
Parameters:
- (none)
- Returns: the Class object for Tuple1
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this generic type.
-
Parameters:
- (none)
- Returns: an array containing the element type
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() -
Parameters:
- (none)
- Returns: unspecified
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple1<T1> x) - Summary: Converts a Tuple1 object to its string representation.
-
Parameters:
-
x(Tuple1<T1>) — the Tuple1 object to convert
-
- Returns: the JSON string representation, or {@code null} if x is null
valueOf(...) -> Tuple1<T1>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple1<T1> valueOf(final String str) - Summary: Creates a Tuple1 object from its string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a Tuple1 object containing the parsed value, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple1<T1> x) throws IOException - Summary: Appends the string representation of a Tuple1 object to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple1<T1>) — the Tuple1 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple1<T1> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a Tuple1 object to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple1<T1>) — the Tuple1 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration for formatting options
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple2Type (com.landawn.abacus.type.Tuple2Type)
Type handler for {@link Tuple2} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple2 type
clazz(...) -> Class<Tuple2<T1, T2>>
-
Signature:
@Override public Class<Tuple2<T1, T2>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple2.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple2 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple2<T1, T2> x) - Summary: Converts the given Tuple2 object to its string representation.
-
Parameters:
-
x(Tuple2<T1, T2>) — the Tuple2 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple2<T1, T2>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple2<T1, T2> valueOf(final String str) - Summary: Parses the given string into a Tuple2 object.
-
Contract:
- The string should be a JSON array representation with exactly two elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple2 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple2<T1, T2> x) throws IOException - Summary: Appends the string representation of the Tuple2 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple2<T1, T2>) — the Tuple2 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple2<T1, T2> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple2 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple2<T1, T2>) — the Tuple2 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple3Type (com.landawn.abacus.type.Tuple3Type)
Type handler for {@link Tuple3} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple3 type
clazz(...) -> Class<Tuple3<T1, T2, T3>>
-
Signature:
@Override public Class<Tuple3<T1, T2, T3>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple3.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple3 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple3<T1, T2, T3> x) - Summary: Converts the given Tuple3 object to its string representation.
-
Parameters:
-
x(Tuple3<T1, T2, T3>) — the Tuple3 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple3<T1, T2, T3>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple3<T1, T2, T3> valueOf(final String str) - Summary: Parses the given string into a Tuple3 object.
-
Contract:
- The string should be a JSON array representation with exactly three elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple3 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple3<T1, T2, T3> x) throws IOException - Summary: Appends the string representation of the Tuple3 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple3<T1, T2, T3>) — the Tuple3 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple3<T1, T2, T3> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple3 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple3<T1, T2, T3>) — the Tuple3 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple4Type (com.landawn.abacus.type.Tuple4Type)
Type handler for {@link Tuple4} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple4 type
clazz(...) -> Class<Tuple4<T1, T2, T3, T4>>
-
Signature:
@Override public Class<Tuple4<T1, T2, T3, T4>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple4.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple4 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple4<T1, T2, T3, T4> x) - Summary: Converts the given Tuple4 object to its string representation.
-
Parameters:
-
x(Tuple4<T1, T2, T3, T4>) — the Tuple4 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple4<T1, T2, T3, T4>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple4<T1, T2, T3, T4> valueOf(final String str) - Summary: Parses the given string into a Tuple4 object.
-
Contract:
- The string should be a JSON array representation with exactly four elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple4 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple4<T1, T2, T3, T4> x) throws IOException - Summary: Appends the string representation of the Tuple4 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple4<T1, T2, T3, T4>) — the Tuple4 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple4<T1, T2, T3, T4> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple4 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple4<T1, T2, T3, T4>) — the Tuple4 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple5Type (com.landawn.abacus.type.Tuple5Type)
Type handler for {@link Tuple5} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple5 type
clazz(...) -> Class<Tuple5<T1, T2, T3, T4, T5>>
-
Signature:
@Override public Class<Tuple5<T1, T2, T3, T4, T5>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple5.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple5 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple5<T1, T2, T3, T4, T5> x) - Summary: Converts the given Tuple5 object to its string representation.
-
Parameters:
-
x(Tuple5<T1, T2, T3, T4, T5>) — the Tuple5 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple5<T1, T2, T3, T4, T5>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple5<T1, T2, T3, T4, T5> valueOf(final String str) - Summary: Parses the given string into a Tuple5 object.
-
Contract:
- The string should be a JSON array representation with exactly five elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple5 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple5<T1, T2, T3, T4, T5> x) throws IOException - Summary: Appends the string representation of the Tuple5 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple5<T1, T2, T3, T4, T5>) — the Tuple5 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple5<T1, T2, T3, T4, T5> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple5 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple5<T1, T2, T3, T4, T5>) — the Tuple5 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple6Type (com.landawn.abacus.type.Tuple6Type)
Type handler for {@link Tuple6} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple6 type
clazz(...) -> Class<Tuple6<T1, T2, T3, T4, T5, T6>>
-
Signature:
@Override public Class<Tuple6<T1, T2, T3, T4, T5, T6>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple6.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple6 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple6<T1, T2, T3, T4, T5, T6> x) - Summary: Converts the given Tuple6 object to its string representation.
-
Parameters:
-
x(Tuple6<T1, T2, T3, T4, T5, T6>) — the Tuple6 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple6<T1, T2, T3, T4, T5, T6>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple6<T1, T2, T3, T4, T5, T6> valueOf(final String str) - Summary: Parses the given string into a Tuple6 object.
-
Contract:
- The string should be a JSON array representation with exactly six elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple6 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple6<T1, T2, T3, T4, T5, T6> x) throws IOException - Summary: Appends the string representation of the Tuple6 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple6<T1, T2, T3, T4, T5, T6>) — the Tuple6 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple6<T1, T2, T3, T4, T5, T6> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple6 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple6<T1, T2, T3, T4, T5, T6>) — the Tuple6 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple7Type (com.landawn.abacus.type.Tuple7Type)
Type handler for {@link Tuple7} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple7 type
clazz(...) -> Class<Tuple7<T1, T2, T3, T4, T5, T6, T7>>
-
Signature:
@Override public Class<Tuple7<T1, T2, T3, T4, T5, T6, T7>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple7.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this type is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple7 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple7<T1, T2, T3, T4, T5, T6, T7> x) - Summary: Converts the given Tuple7 object to its string representation.
-
Parameters:
-
x(Tuple7<T1, T2, T3, T4, T5, T6, T7>) — the Tuple7 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple7<T1, T2, T3, T4, T5, T6, T7>
-
Signature:
@SuppressWarnings("unchecked") @Override public Tuple7<T1, T2, T3, T4, T5, T6, T7> valueOf(final String str) - Summary: Parses the given string into a Tuple7 object.
-
Contract:
- The string should be a JSON array representation with exactly seven elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple7 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple7<T1, T2, T3, T4, T5, T6, T7> x) throws IOException - Summary: Appends the string representation of the Tuple7 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple7<T1, T2, T3, T4, T5, T6, T7>) — the Tuple7 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple7<T1, T2, T3, T4, T5, T6, T7> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple7 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple7<T1, T2, T3, T4, T5, T6, T7>) — the Tuple7 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple8Type (com.landawn.abacus.type.Tuple8Type)
Type handler for {@link Tuple8} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple8 type
clazz(...) -> Class<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>>
-
Signature:
@Override public Class<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple8.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
isParameterizedType(...) -> boolean
-
Signature:
@Override public boolean isParameterizedType() - Summary: Indicates whether this is a generic type.
-
Parameters:
- (none)
- Returns: {@code true} always, as Tuple8 is a parameterized type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> x) - Summary: Converts the given Tuple8 object to its string representation.
-
Parameters:
-
x(Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>) — the Tuple8 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>
-
Signature:
@SuppressWarnings({ "unchecked", "deprecation" }) @Override public Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> valueOf(final String str) - Summary: Parses the given string into a Tuple8 object.
-
Contract:
- The string should be a JSON array representation with exactly eight elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple8 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> x) throws IOException - Summary: Appends the string representation of the Tuple8 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>) — the Tuple8 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple8 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>) — the Tuple8 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class Tuple9Type (com.landawn.abacus.type.Tuple9Type)
Type handler for {@link Tuple9} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this type, which includes simple class names.
-
Parameters:
- (none)
- Returns: the declaring name of this Tuple9 type
clazz(...) -> Class<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>>
-
Signature:
@Override public Class<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> clazz() - Summary: Returns the Java class that this type handler manages.
-
Parameters:
- (none)
- Returns: {@code Tuple9.class}
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
@Override public Type<?>[] getParameterTypes() - Summary: Returns the parameter types of this tuple type.
-
Parameters:
- (none)
- Returns: an array containing the types of the tuple elements
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> x) - Summary: Converts the given Tuple9 object to its string representation.
-
Parameters:
-
x(Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>) — the Tuple9 object to convert
-
- Returns: a JSON string representation of the tuple, or {@code null} if x is null
valueOf(...) -> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>
-
Signature:
@SuppressWarnings({ "unchecked", "deprecation" }) @Override public Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> valueOf(final String str) - Summary: Parses the given string into a Tuple9 object.
-
Contract:
- The string should be a JSON array representation with exactly nine elements.
-
Parameters:
-
str(String) — the JSON string to parse
-
- Returns: a Tuple9 object parsed from the string, or {@code null} if str is empty
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> x) throws IOException - Summary: Appends the string representation of the Tuple9 to the given Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>) — the Tuple9 object to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@Override public void writeCharacter(final CharacterWriter writer, final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of the Tuple9 to the given CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>) — the Tuple9 object to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Interface Type (com.landawn.abacus.type.Type)
The core type abstraction interface representing types in the abacus-common type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Type<T>
-
Signature:
static <T> Type<T> of(final java.lang.reflect.Type javaType) - Summary: Returns the Type instance for the given Java reflection Type.
-
Parameters:
-
javaType(java.lang.reflect.Type) — the Java reflection type
-
- Returns: the corresponding Type instance
-
Signature:
static <T> Type<T> of(final TypeReference<T> typeRef) - Summary: Returns the Type instance for the given TypeReference.
-
Parameters:
-
typeRef(TypeReference<T>) — the type reference
-
- Returns: the corresponding Type instance
-
Signature:
static <T> Type<T> of(final Class<? extends T> cls) - Summary: Returns the Type instance for the given Class.
-
Parameters:
-
cls(Class<? extends T>) — the class
-
- Returns: the corresponding Type instance
-
Signature:
static <T> Type<T> of(final String typeName) - Summary: Returns the Type instance by parsing the given type name string.
-
Parameters:
-
typeName(String) — the type name string
-
- Returns: the corresponding Type instance
ofAll(...) -> List<Type<T>>
-
Signature:
@SafeVarargs static <T> List<Type<T>> ofAll(final Class<? extends T>... classes) - Summary: Returns a list of Type instances for the given array of classes.
-
Parameters:
-
classes(Class<? extends T>[]) — the array of classes
-
- Returns: list of corresponding Type instances
-
Signature:
static <T> List<Type<T>> ofAll(final Collection<Class<? extends T>> classes) - Summary: Returns a list of Type instances for the given collection of classes.
-
Parameters:
-
classes(Collection<Class<? extends T>>) — the collection of classes
-
- Returns: list of corresponding Type instances
ofList(...) -> Type<List<T>>
-
Signature:
static <T> Type<List<T>> ofList(final Class<? extends T> eleClass) - Summary: Returns a List type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for List of the specified element type
ofLinkedList(...) -> Type<LinkedList<T>>
-
Signature:
static <T> Type<LinkedList<T>> ofLinkedList(final Class<? extends T> eleClass) - Summary: Returns a LinkedList type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for LinkedList of the specified element type
ofListOfMap(...) -> Type<List<Map<K, V>>>
-
Signature:
static <K, V> Type<List<Map<K, V>>> ofListOfMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a List of Map type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for List of Map with specified key/value types
ofListOfLinkedHashMap(...) -> Type<List<Map<K, V>>>
-
Signature:
static <K, V> Type<List<Map<K, V>>> ofListOfLinkedHashMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a List of LinkedHashMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for List of LinkedHashMap with specified key/value types
ofSet(...) -> Type<Set<T>>
-
Signature:
static <T> Type<Set<T>> ofSet(final Class<? extends T> eleClass) - Summary: Returns a Set type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for Set of the specified element type
ofSetOfMap(...) -> Type<Set<Map<K, V>>>
-
Signature:
static <K, V> Type<Set<Map<K, V>>> ofSetOfMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a Set of Map type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for Set of Map with specified key/value types
ofSetOfLinkedHashMap(...) -> Type<Set<Map<K, V>>>
-
Signature:
static <K, V> Type<Set<Map<K, V>>> ofSetOfLinkedHashMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a Set of LinkedHashMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for Set of LinkedHashMap with specified key/value types
ofLinkedHashSet(...) -> Type<LinkedHashSet<T>>
-
Signature:
static <T> Type<LinkedHashSet<T>> ofLinkedHashSet(final Class<? extends T> eleClass) - Summary: Returns a LinkedHashSet type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for LinkedHashSet of the specified element type
ofSortedSet(...) -> Type<SortedSet<T>>
-
Signature:
static <T> Type<SortedSet<T>> ofSortedSet(final Class<? extends T> eleClass) - Summary: Returns a SortedSet type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for SortedSet of the specified element type
ofNavigableSet(...) -> Type<NavigableSet<T>>
-
Signature:
static <T> Type<NavigableSet<T>> ofNavigableSet(final Class<? extends T> eleClass) - Summary: Returns a NavigableSet type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for NavigableSet of the specified element type
ofTreeSet(...) -> Type<TreeSet<T>>
-
Signature:
static <T> Type<TreeSet<T>> ofTreeSet(final Class<? extends T> eleClass) - Summary: Returns a TreeSet type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for TreeSet of the specified element type
ofQueue(...) -> Type<Queue<T>>
-
Signature:
static <T> Type<Queue<T>> ofQueue(final Class<? extends T> eleClass) - Summary: Returns a Queue type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for Queue of the specified element type
ofDeque(...) -> Type<Deque<T>>
-
Signature:
static <T> Type<Deque<T>> ofDeque(final Class<? extends T> eleClass) - Summary: Returns a Deque type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for Deque of the specified element type
ofArrayDeque(...) -> Type<ArrayDeque<T>>
-
Signature:
static <T> Type<ArrayDeque<T>> ofArrayDeque(final Class<? extends T> eleClass) - Summary: Returns an ArrayDeque type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for ArrayDeque of the specified element type
ofLinkedBlockingQueue(...) -> Type<LinkedBlockingQueue<T>>
-
Signature:
static <T> Type<LinkedBlockingQueue<T>> ofLinkedBlockingQueue(final Class<? extends T> eleClass) - Summary: Returns a LinkedBlockingQueue type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for LinkedBlockingQueue of the specified element type
ofConcurrentLinkedQueue(...) -> Type<ConcurrentLinkedQueue<T>>
-
Signature:
static <T> Type<ConcurrentLinkedQueue<T>> ofConcurrentLinkedQueue(final Class<? extends T> eleClass) - Summary: Returns a ConcurrentLinkedQueue type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for ConcurrentLinkedQueue of the specified element type
ofPriorityQueue(...) -> Type<PriorityQueue<T>>
-
Signature:
static <T> Type<PriorityQueue<T>> ofPriorityQueue(final Class<? extends T> eleClass) - Summary: Returns a PriorityQueue type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for PriorityQueue of the specified element type
ofPropsMap(...) -> Type<Map<String, Object>>
-
Signature:
static Type<Map<String, Object>> ofPropsMap() - Summary: Returns a Map type for properties (LinkedHashMap < String, Object > ).
-
Parameters:
- (none)
- Returns: Type instance for LinkedHashMap < String, Object >
ofMap(...) -> Type<Map<K, V>>
-
Signature:
static <K, V> Type<Map<K, V>> ofMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a Map type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for Map with specified key/value types
ofLinkedHashMap(...) -> Type<LinkedHashMap<K, V>>
-
Signature:
static <K, V> Type<LinkedHashMap<K, V>> ofLinkedHashMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a LinkedHashMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for LinkedHashMap with specified key/value types
ofSortedMap(...) -> Type<SortedMap<K, V>>
-
Signature:
static <K, V> Type<SortedMap<K, V>> ofSortedMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a SortedMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for SortedMap with specified key/value types
ofNavigableMap(...) -> Type<NavigableMap<K, V>>
-
Signature:
static <K, V> Type<NavigableMap<K, V>> ofNavigableMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a NavigableMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for NavigableMap with specified key/value types
ofTreeMap(...) -> Type<TreeMap<K, V>>
-
Signature:
static <K, V> Type<TreeMap<K, V>> ofTreeMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a TreeMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for TreeMap with specified key/value types
ofConcurrentMap(...) -> Type<ConcurrentMap<K, V>>
-
Signature:
static <K, V> Type<ConcurrentMap<K, V>> ofConcurrentMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a ConcurrentMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for ConcurrentMap with specified key/value types
ofConcurrentHashMap(...) -> Type<ConcurrentHashMap<K, V>>
-
Signature:
static <K, V> Type<ConcurrentHashMap<K, V>> ofConcurrentHashMap(final Class<? extends K> keyClass, final Class<? extends V> valClass) - Summary: Returns a ConcurrentHashMap type with the specified key and value types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
valClass(Class<? extends V>) — the value class
-
- Returns: Type instance for ConcurrentHashMap with specified key/value types
ofMultiset(...) -> Type<Multiset<T>>
-
Signature:
static <T> Type<Multiset<T>> ofMultiset(final Class<? extends T> eleClass) - Summary: Returns a Multiset type with the specified element type.
-
Parameters:
-
eleClass(Class<? extends T>) — the element class
-
- Returns: Type instance for Multiset of the specified element type
ofListMultimap(...) -> Type<ListMultimap<K, E>>
-
Signature:
static <K, E> Type<ListMultimap<K, E>> ofListMultimap(final Class<? extends K> keyClass, final Class<? extends E> eleClass) - Summary: Returns a ListMultimap type with the specified key and element types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
eleClass(Class<? extends E>) — the element class
-
- Returns: Type instance for ListMultimap with specified key/element types
ofSetMultimap(...) -> Type<SetMultimap<K, E>>
-
Signature:
static <K, E> Type<SetMultimap<K, E>> ofSetMultimap(final Class<? extends K> keyClass, final Class<? extends E> eleClass) - Summary: Returns a SetMultimap type with the specified key and element types.
-
Parameters:
-
keyClass(Class<? extends K>) — the key class -
eleClass(Class<? extends E>) — the element class
-
- Returns: Type instance for SetMultimap with specified key/element types
Public Instance Methods
name(...) -> String
-
Signature:
String name() - Summary: Returns the name of this type.
-
Parameters:
- (none)
- Returns: the type name
declaringName(...) -> String
-
Signature:
String declaringName() - Summary: Returns the declaring name of this type.
-
Parameters:
- (none)
- Returns: the declaring name
xmlName(...) -> String
-
Signature:
String xmlName() - Summary: Returns the XML-safe name of this type.
-
Parameters:
- (none)
- Returns: the XML-safe type name
clazz(...) -> Class<T>
-
Signature:
Class<T> clazz() - Summary: Returns the Class object representing this type.
-
Parameters:
- (none)
- Returns: the class for this type
javaType(...) -> java.lang.reflect.Type
-
Signature:
java.lang.reflect.Type javaType() - Summary: Returns the Java reflection Type representing this type.
-
Parameters:
- (none)
- Returns: the Java reflection type
isPrimitiveType(...) -> boolean
-
Signature:
default boolean isPrimitiveType() - Summary: Checks if this is a primitive type (int, long, double, etc.).
-
Contract:
- Checks if this is a primitive type (int, long, double, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive type
isPrimitiveWrapper(...) -> boolean
-
Signature:
default boolean isPrimitiveWrapper() - Summary: Checks if this is a primitive wrapper type (Integer, Long, Double, etc.).
-
Contract:
- Checks if this is a primitive wrapper type (Integer, Long, Double, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive wrapper type
isPrimitiveList(...) -> boolean
-
Signature:
default boolean isPrimitiveList() - Summary: Checks if this is a primitive list type (IntList, LongList, etc.).
-
Contract:
- Checks if this is a primitive list type (IntList, LongList, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive list type
isBoolean(...) -> boolean
-
Signature:
default boolean isBoolean() - Summary: Checks if this type represents a boolean or Boolean type.
-
Contract:
- Checks if this type represents a boolean or Boolean type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a boolean type, {@code false} otherwise
isCharacter(...) -> boolean
-
Signature:
default boolean isCharacter() - Summary: Checks if this type represents a char or Character type.
-
Contract:
- Checks if this type represents a char or Character type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a character type, {@code false} otherwise
isNumber(...) -> boolean
-
Signature:
default boolean isNumber() - Summary: Checks if this is a number type (numeric primitive or wrapper).
-
Contract:
- Checks if this is a number type (numeric primitive or wrapper).
-
Parameters:
- (none)
- Returns: {@code true} if this is a number type
isByte(...) -> boolean
-
Signature:
default boolean isByte() - Summary: Checks if this type represents a byte or Byte type.
-
Contract:
- Checks if this type represents a byte or Byte type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a byte type, {@code false} otherwise
isShort(...) -> boolean
-
Signature:
default boolean isShort() - Summary: Checks if this type represents a short or Short type.
-
Contract:
- Checks if this type represents a short or Short type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a short type, {@code false} otherwise
isInteger(...) -> boolean
-
Signature:
default boolean isInteger() - Summary: Checks if this type represents an int or Integer type.
-
Contract:
- Checks if this type represents an int or Integer type.
-
Parameters:
- (none)
- Returns: {@code true} if this is an integer type, {@code false} otherwise
isLong(...) -> boolean
-
Signature:
default boolean isLong() - Summary: Checks if this type represents a long or Long type.
-
Contract:
- Checks if this type represents a long or Long type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a long type, {@code false} otherwise
isFloat(...) -> boolean
-
Signature:
default boolean isFloat() - Summary: Checks if this type represents a float or Float type.
-
Contract:
- Checks if this type represents a float or Float type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a float type, {@code false} otherwise
isDouble(...) -> boolean
-
Signature:
default boolean isDouble() - Summary: Checks if this type represents a double or Double type.
-
Contract:
- Checks if this type represents a double or Double type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a double type, {@code false} otherwise
isString(...) -> boolean
-
Signature:
default boolean isString() - Summary: Checks if this type represents a String type.
-
Contract:
- Checks if this type represents a String type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a String type, {@code false} otherwise
isCharSequence(...) -> boolean
-
Signature:
default boolean isCharSequence() - Summary: Checks if this type represents a CharSequence type (String, StringBuilder, etc.).
-
Contract:
- Checks if this type represents a CharSequence type (String, StringBuilder, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a CharSequence type, {@code false} otherwise
isDate(...) -> boolean
-
Signature:
default boolean isDate() - Summary: Checks if this type represents a date-related type (java.util.Date, java.sql.Date, etc.).
-
Contract:
- Checks if this type represents a date-related type (java.util.Date, java.sql.Date, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a date type, {@code false} otherwise
isCalendar(...) -> boolean
-
Signature:
default boolean isCalendar() - Summary: Checks if this type represents a Calendar type.
-
Contract:
- Checks if this type represents a Calendar type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Calendar type, {@code false} otherwise
isJodaDateTime(...) -> boolean
-
Signature:
default boolean isJodaDateTime() - Summary: Checks if this type represents a Joda-Time DateTime type.
-
Contract:
- Checks if this type represents a Joda-Time DateTime type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Joda DateTime type, {@code false} otherwise
isPrimitiveArray(...) -> boolean
-
Signature:
default boolean isPrimitiveArray() - Summary: Checks if this type represents a primitive array (int\[\], byte\[\], etc.).
-
Contract:
- Checks if this type represents a primitive array (int\[\], byte\[\], etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a primitive array type, {@code false} otherwise
isPrimitiveByteArray(...) -> boolean
-
Signature:
default boolean isPrimitiveByteArray() - Summary: Checks if this type represents a byte array (byte\[\]).
-
Contract:
- Checks if this type represents a byte array (byte\[\]).
-
Parameters:
- (none)
- Returns: {@code true} if this is a byte array type
isObjectArray(...) -> boolean
-
Signature:
default boolean isObjectArray() - Summary: Checks if this type represents an object array (String\[\], Object\[\], etc.).
-
Contract:
- Checks if this type represents an object array (String\[\], Object\[\], etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is an object array type, {@code false} otherwise
isArray(...) -> boolean
-
Signature:
default boolean isArray() - Summary: Checks if this type represents any array type (primitive or object).
-
Contract:
- Checks if this type represents any array type (primitive or object).
-
Parameters:
- (none)
- Returns: {@code true} if this is an array type, {@code false} otherwise
isList(...) -> boolean
-
Signature:
default boolean isList() - Summary: Checks if this type represents a List type.
-
Contract:
- Checks if this type represents a List type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a List type, {@code false} otherwise
isSet(...) -> boolean
-
Signature:
default boolean isSet() - Summary: Checks if this type represents a Set type.
-
Contract:
- Checks if this type represents a Set type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Set type, {@code false} otherwise
isCollection(...) -> boolean
-
Signature:
default boolean isCollection() - Summary: Checks if this type represents a Collection type (List, Set, Queue, etc.).
-
Contract:
- Checks if this type represents a Collection type (List, Set, Queue, etc.).
-
Parameters:
- (none)
- Returns: {@code true} if this is a Collection type, {@code false} otherwise
isMap(...) -> boolean
-
Signature:
default boolean isMap() - Summary: Checks if this type represents a Map type.
-
Contract:
- Checks if this type represents a Map type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Map type, {@code false} otherwise
isBean(...) -> boolean
-
Signature:
default boolean isBean() - Summary: Checks if this type represents a Bean (POJO with properties).
-
Contract:
- Checks if this type represents a Bean (POJO with properties).
-
Parameters:
- (none)
- Returns: {@code true} if this is a Bean type
isMapEntity(...) -> boolean
-
Signature:
default boolean isMapEntity() - Summary: Checks if this type represents a MapEntity type.
-
Contract:
- Checks if this type represents a MapEntity type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a MapEntity type, {@code false} otherwise
isEntityId(...) -> boolean
-
Signature:
default boolean isEntityId() - Summary: Checks if this type represents an EntityId type.
-
Contract:
- Checks if this type represents an EntityId type.
-
Parameters:
- (none)
- Returns: {@code true} if this is an EntityId type, {@code false} otherwise
isDataset(...) -> boolean
-
Signature:
default boolean isDataset() - Summary: Checks if this type represents a DataSet type.
-
Contract:
- Checks if this type represents a DataSet type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a DataSet type, {@code false} otherwise
isInputStream(...) -> boolean
-
Signature:
default boolean isInputStream() - Summary: Checks if this type represents an InputStream type.
-
Contract:
- Checks if this type represents an InputStream type.
-
Parameters:
- (none)
- Returns: {@code true} if this is an InputStream type, {@code false} otherwise
isReader(...) -> boolean
-
Signature:
default boolean isReader() - Summary: Checks if this type represents a Reader type.
-
Contract:
- Checks if this type represents a Reader type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a Reader type, {@code false} otherwise
isByteBuffer(...) -> boolean
-
Signature:
default boolean isByteBuffer() - Summary: Checks if this type represents a ByteBuffer type.
-
Contract:
- Checks if this type represents a ByteBuffer type.
-
Parameters:
- (none)
- Returns: {@code true} if this is a ByteBuffer type, {@code false} otherwise
isParameterizedType(...) -> boolean
-
Signature:
default boolean isParameterizedType() - Summary: Checks if this type is a generic type with type parameters.
-
Contract:
- Checks if this type is a generic type with type parameters.
-
Parameters:
- (none)
- Returns: {@code true} if this is a generic type, {@code false} otherwise
isImmutable(...) -> boolean
-
Signature:
default boolean isImmutable() - Summary: Checks if this type represents an immutable type.
-
Contract:
- Checks if this type represents an immutable type.
-
Parameters:
- (none)
- Returns: {@code true} if this is an immutable type, {@code false} otherwise
isComparable(...) -> boolean
-
Signature:
default boolean isComparable() - Summary: Checks if this type implements Comparable.
-
Contract:
- Checks if this type implements Comparable.
-
Parameters:
- (none)
- Returns: {@code true} if this type is comparable, {@code false} otherwise
isSerializable(...) -> boolean
-
Signature:
default boolean isSerializable() - Summary: Checks if values of this type can be serialized directly to JSON/XML string.
-
Contract:
- Checks if values of this type can be serialized directly to JSON/XML string.
-
Parameters:
- (none)
- Returns: {@code true} if this type is serializable
isOptionalOrNullable(...) -> boolean
-
Signature:
default boolean isOptionalOrNullable() - Summary: Checks if this type represents optional or {@code nullable} values.
-
Contract:
- Checks if this type represents optional or {@code nullable} values.
-
Parameters:
- (none)
- Returns: {@code true} if this is an optional or {@code nullable} type
isNonQuotableCsvType(...) -> boolean
-
Signature:
default boolean isNonQuotableCsvType() - Summary: Checks if values of this type should not be quoted in CSV format.
-
Contract:
- Checks if values of this type should not be quoted in CSV format.
-
Parameters:
- (none)
- Returns: {@code true} if values should not be quoted in CSV
isObjectType(...) -> boolean
-
Signature:
default boolean isObjectType() - Summary: Checks if this type represents the generic Object type.
-
Contract:
- Checks if this type represents the generic Object type.
-
Parameters:
- (none)
- Returns: {@code true} if this is the Object type, {@code false} otherwise
getSerializationType(...) -> SerializationType
-
Signature:
SerializationType getSerializationType() - Summary: Gets the serialization type classification for this type.
-
Parameters:
- (none)
- Returns: the serialization type
getElementType(...) -> Type<?>
-
Signature:
Type<?> getElementType() - Summary: Gets the element type for collection/array types.
-
Parameters:
- (none)
- Returns: the element type, or {@code null} if not applicable
getParameterTypes(...) -> Type<?>\[\]
-
Signature:
Type<?>[] getParameterTypes() - Summary: Gets the parameter types for generic types.
-
Parameters:
- (none)
- Returns: array of parameter types, empty if none
defaultValue(...) -> T
-
Signature:
T defaultValue() - Summary: Returns the default value for this type.
-
Parameters:
- (none)
- Returns: the default value
isDefaultValue(...) -> boolean
-
Signature:
boolean isDefaultValue(T value) - Summary: Checks if the given value is the default value for this type.
-
Contract:
- Checks if the given value is the default value for this type.
-
Parameters:
-
value(T) — the value to check
-
- Returns: {@code true} if value equals the default value
compare(...) -> int
-
Signature:
int compare(T x, T y) - Summary: Compares two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: negative if x < y, zero if x equals y, positive if x > y
stringOf(...) -> String
-
Signature:
String stringOf(T x) - Summary: Converts a value of this type to its string representation.
-
Parameters:
-
x(T) — the value to convert
-
- Returns: the string representation
valueOf(...) -> T
-
Signature:
T valueOf(String str) - Summary: Parses a string to create a value of this type.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: the parsed value
-
Signature:
T valueOf(Object obj) - Summary: Converts an object to a value of this type.
-
Parameters:
-
obj(Object) — the object to convert
-
- Returns: the converted value
-
Signature:
T valueOf(char[] cbuf, int offset, int len) - Summary: Parses a character array to create a value of this type.
-
Parameters:
-
cbuf(char[]) — the character array -
offset(int) — the starting position -
len(int) — the number of characters to parse
-
- Returns: the parsed value
get(...) -> T
-
Signature:
T get(ResultSet rs, int columnIndex) throws SQLException - Summary: Retrieves a value of this type from a ResultSet at the specified column.
-
Parameters:
-
rs(ResultSet) — the ResultSet -
columnIndex(int) — the column index (1-based)
-
- Returns: the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
T get(ResultSet rs, String columnName) throws SQLException - Summary: Retrieves a value of this type from a ResultSet by column name.
-
Parameters:
-
rs(ResultSet) — the ResultSet -
columnName(String) — the column label
-
- Returns: the retrieved value
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
set(...) -> void
-
Signature:
void set(PreparedStatement stmt, int columnIndex, T x) throws SQLException - Summary: Sets a parameter value in a PreparedStatement.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement -
columnIndex(int) — the parameter index (1-based) -
x(T) — the value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
void set(CallableStatement stmt, String parameterName, T x) throws SQLException - Summary: Sets a parameter value in a CallableStatement by name.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement -
parameterName(String) — the parameter name -
x(T) — the value to set
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
void set(PreparedStatement stmt, int columnIndex, T x, int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter value in a PreparedStatement with SQL type or length hint.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement -
columnIndex(int) — the parameter index (1-based) -
x(T) — the value to set -
sqlTypeOrLength(int) — the SQL type constant or length hint
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
-
Signature:
void set(CallableStatement stmt, String parameterName, T x, int sqlTypeOrLength) throws SQLException - Summary: Sets a parameter value in a CallableStatement with SQL type or length hint.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement -
parameterName(String) — the parameter name -
x(T) — the value to set -
sqlTypeOrLength(int) — the SQL type constant or length hint
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs
-
appendTo(...) -> void
-
Signature:
void appendTo(Appendable appendable, T x) throws IOException - Summary: Appends the string representation of a value to an Appendable.
-
Parameters:
-
appendable(Appendable) — the target to append to -
x(T) — the value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
writeCharacter(...) -> void
-
Signature:
void writeCharacter(CharacterWriter writer, T x, JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes a value to a CharacterWriter with serialization configuration.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(T) — the value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration, may be {@code null}
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
collectionToArray(...) -> T
-
Signature:
T collectionToArray(Collection<?> c) - Summary: Converts a collection to an array of this type.
-
Parameters:
-
c(Collection<?>) — the collection to convert
-
- Returns: the array representation
arrayToCollection(...) -> Collection<E>
-
Signature:
<E> Collection<E> arrayToCollection(T x, Class<?> collClass) - Summary: Converts an array to a collection of the specified type.
-
Parameters:
-
x(T) — the array to convert -
collClass(Class<?>) — the collection class to create
-
- Returns: the created collection containing array elements
-
Signature:
<E> void arrayToCollection(T x, Collection<E> output) - Summary: Converts an array to a collection by adding elements to the output collection.
-
Parameters:
-
x(T) — the array to convert -
output(Collection<E>) — the collection to add elements to
-
hashCode(...) -> int
-
Signature:
int hashCode(T x) - Summary: Calculates the hash code for a value of this type.
-
Parameters:
-
x(T) — the value
-
- Returns: the hash code
deepHashCode(...) -> int
-
Signature:
int deepHashCode(T x) - Summary: Calculates the deep hash code for a value of this type.
-
Parameters:
-
x(T) — the value
-
- Returns: the deep hash code
equals(...) -> boolean
-
Signature:
boolean equals(T x, T y) - Summary: Checks equality between two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: {@code true} if the values are equal
deepEquals(...) -> boolean
-
Signature:
boolean deepEquals(T x, T y) - Summary: Checks deep equality between two values of this type.
-
Parameters:
-
x(T) — the first value -
y(T) — the second value
-
- Returns: {@code true} if the values are deeply equal
toString(...) -> String
-
Signature:
String toString(T x) - Summary: Converts a value to its string representation.
-
Parameters:
-
x(T) — the value
-
- Returns: the string representation
deepToString(...) -> String
-
Signature:
String deepToString(T x) - Summary: Converts a value to its deep string representation.
-
Parameters:
-
x(T) — the value
-
- Returns: the deep string representation
Enum SerializationType (com.landawn.abacus.type.Type.SerializationType)
Enumeration of serialization type categories.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class TypeFactory (com.landawn.abacus.type.TypeFactory)
A factory class for creating, registering, and retrieving Type objects in the abacus-common type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getType(...) -> Type<T>
-
Signature:
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> Type<T> getType(final Class<?> cls) throws IllegalArgumentException - Summary: Retrieves the Type object corresponding to the specified Class object.
-
Contract:
- If the type is not found in the cache, it creates a new Type instance for the class and caches it for future use.
-
Parameters:
-
cls(Class<?>) — the Class object for which to retrieve the Type
-
- Returns: the Type object corresponding to the specified class
-
Throws:
-
java.lang.IllegalArgumentException— if cls is null
-
- See also: #getType(String), #getType(java.lang.reflect.Type)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Type<T> getType(final java.lang.reflect.Type javaType) - Summary: Retrieves the Type object corresponding to the specified java.lang.reflect.Type.
-
Parameters:
-
javaType(java.lang.reflect.Type) — the java.lang.reflect.Type to convert, can be a Class or ParameterizedType
-
- Returns: the corresponding Type object
- See also: #getType(Class), #getType(String)
-
Signature:
public static <T> Type<T> getType(final String typeName) throws IllegalArgumentException - Summary: Retrieves the Type object corresponding to the specified type name string.
-
Contract:
- If the type pool size reaches multiples of 100, a warning is logged about the pool size.
-
Parameters:
-
typeName(String) — the name of the type to retrieve, with optional type parameters
-
- Returns: the Type object corresponding to the type name
-
Throws:
-
java.lang.IllegalArgumentException— if typeName is {@code null} or if the type name format is invalid
-
- See also: #getType(Class), #registerType(String, Type)
registerType(...) -> void
-
Signature:
public static <T> void registerType(final Class<T> targetClass, final BiFunction<? super T, JsonParser, String> toStringFunc, final BiFunction<? super String, JsonParser, T> fromStringFunc) throws IllegalArgumentException - Summary: Registers a custom Type for the specified target class with custom serialization/deserialization functions.
-
Contract:
- <p> This method allows you to define how objects of a specific class should be converted to and from strings.
-
Parameters:
-
targetClass(Class<T>) — the class for which to register the custom type -
toStringFunc(BiFunction<? super T, JsonParser, String>) — the function to convert an object of type T to a String, receives the object and a JsonParser -
fromStringFunc(BiFunction<? super String, JsonParser, T>) — the function to convert a String to an object of type T, receives the string and a JsonParser
-
-
Throws:
-
java.lang.IllegalArgumentException— if targetClass, toStringFunc, or fromStringFunc is null
-
- See also: #registerType(Class, Function, Function), #registerType(Class, Type)
-
Signature:
public static <T> void registerType(final Class<T> cls, final Function<? super T, String> toStringFunc, final Function<? super String, T> fromStringFunc) throws IllegalArgumentException - Summary: Registers a custom Type for the specified class with simple serialization/deserialization functions.
-
Contract:
- <p> This method provides a simpler alternative to {@link #registerType(Class, BiFunction, BiFunction)} when you don't need access to a JsonParser instance for serialization/deserialization.
-
Parameters:
-
cls(Class<T>) — the class for which to register the custom type -
toStringFunc(Function<? super T, String>) — the function to convert an object of type T to a String -
fromStringFunc(Function<? super String, T>) — the function to convert a String to an object of type T
-
-
Throws:
-
java.lang.IllegalArgumentException— if cls, toStringFunc, or fromStringFunc is null
-
- See also: #registerType(Class, BiFunction, BiFunction), #registerType(Class, Type)
-
Signature:
public static <T> void registerType(final Class<T> cls, final Type<T> type) throws IllegalArgumentException - Summary: Registers a custom Type implementation for the specified class.
-
Parameters:
-
cls(Class<T>) — the class for which to register the type -
type(Type<T>) — the Type implementation to register for the class
-
-
Throws:
-
java.lang.IllegalArgumentException— if cls or type is {@code null} , or if a type is already registered for the class
-
- See also: #registerType(String, Type), #getType(Class)
-
Signature:
public static <T> void registerType(final String typeName, final Class<T> targetClass, final BiFunction<? super T, JsonParser, String> toStringFunc, final BiFunction<? super String, JsonParser, T> fromStringFunc) throws IllegalArgumentException - Summary: Registers a custom Type with a specific type name and target class, using custom serialization functions with JsonParser.
-
Contract:
- The type will be accessible by both the custom type name and potentially by the target class (if no other type is already registered for that class).
-
Parameters:
-
typeName(String) — the custom name for this type registration -
targetClass(Class<T>) — the class that this type handles -
toStringFunc(BiFunction<? super T, JsonParser, String>) — the function to convert an object of type T to a String, receives the object and a JsonParser -
fromStringFunc(BiFunction<? super String, JsonParser, T>) — the function to convert a String to an object of type T, receives the string and a JsonParser
-
-
Throws:
-
java.lang.IllegalArgumentException— if typeName, targetClass, toStringFunc, or fromStringFunc is {@code null} , or if a type with the given name already exists
-
- See also: #registerType(String, Class, Function, Function), #registerType(String, Type)
-
Signature:
public static <T> void registerType(final String typeName, final Class<T> targetClass, final Function<? super T, String> toStringFunc, final Function<? super String, T> fromStringFunc) throws IllegalArgumentException - Summary: Registers a custom Type with a specific type name and target class, using simple serialization functions.
-
Contract:
- <p> This method provides a simpler alternative to {@link #registerType(String, Class, BiFunction, BiFunction)} when you don't need access to a JsonParser instance.
- The type will be accessible by the custom type name and potentially by the target class if no other type is registered for it.
-
Parameters:
-
typeName(String) — the custom name for this type registration -
targetClass(Class<T>) — the class that this type handles -
toStringFunc(Function<? super T, String>) — the function to convert an object of type T to a String -
fromStringFunc(Function<? super String, T>) — the function to convert a String to an object of type T
-
-
Throws:
-
java.lang.IllegalArgumentException— if typeName, targetClass, toStringFunc, or fromStringFunc is {@code null} , or if a type with the given name already exists
-
- See also: #registerType(String, Class, BiFunction, BiFunction), #registerType(String, Type)
-
Signature:
public static void registerType(final String typeName, final Type<?> type) throws IllegalArgumentException - Summary: Registers a Type implementation with a specific type name.
-
Contract:
- </p> <p> Note: A type name must be unique.
-
Parameters:
-
typeName(String) — the name to register the type under -
type(Type<?>) — the Type implementation to register
-
-
Throws:
-
java.lang.IllegalArgumentException— if typeName or type is {@code null} , or if a type with the given name already exists
-
- See also: #registerType(Type), #getType(String)
-
Signature:
public static void registerType(final Type<?> type) throws IllegalArgumentException - Summary: Registers a Type implementation using its built-in name.
-
Contract:
- This is typically used internally when registering built-in types or when the type already has an appropriate name defined.
- </p> <p> Note: The type's name must be unique.
-
Parameters:
-
type(Type<?>) — the Type implementation to register
-
-
Throws:
-
java.lang.IllegalArgumentException— if type is {@code null} or if a type with the same name already exists
-
- See also: #registerType(String, Type), Type#name()
Public Instance Methods
- (none)
Class TypeType (com.landawn.abacus.type.TypeType)
Type handler for {@link Type} objects themselves, allowing Type instances to be serialized, deserialized, and converted within the abacus-common type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<Type>
-
Signature:
@Override public Class<Type> clazz() - Summary: Returns the Class object representing the Type interface.
-
Parameters:
- (none)
- Returns: the Class object for Type.class
isImmutable(...) -> boolean
-
Signature:
@Override public boolean isImmutable() - Summary: Checks if Type instances are immutable.
-
Contract:
- Checks if Type instances are immutable.
- <p> Type instances are considered immutable as they represent type metadata that should not change once created.
-
Parameters:
- (none)
- Returns: {@code true} , indicating that Type instances are immutable
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final Type x) - Summary: Converts a Type instance to its string representation.
-
Contract:
- If the input Type is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(Type) — the Type instance to convert to string
-
- Returns: the name of the Type, or {@code null} if the input is null
valueOf(...) -> Type
-
Signature:
@Override public Type valueOf(final String str) - Summary: Converts a string to a Type instance.
-
Contract:
- If the string is {@code null} or empty, this method returns {@code null} .
- </p> <p> The string should be a valid type name that has been registered with the TypeFactory, such as "String", "Integer", "List < String > ", etc.
-
Parameters:
-
str(String) — the type name string to convert to a Type instance
-
- Returns: the Type instance corresponding to the type name, or {@code null} if the string is empty
Class URIType (com.landawn.abacus.type.URIType)
Type handler for {@link java.net.URI} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<URI>
-
Signature:
@Override public Class<URI> clazz() - Summary: Returns the Class object representing the URI class.
-
Parameters:
- (none)
- Returns: the Class object for URI.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final URI x) - Summary: Converts a URI instance to its string representation.
-
Contract:
- If the input URI is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(URI) — the URI instance to convert to string
-
- Returns: the string representation of the URI, or {@code null} if the input is null
valueOf(...) -> URI
-
Signature:
@Override public URI valueOf(final String str) - Summary: Parses a string representation to create a URI instance.
-
Contract:
- If the string is {@code null} or empty, this method returns {@code null} .
-
Parameters:
-
str(String) — the string to convert to a URI
-
- Returns: a URI instance created from the string, or {@code null} if the string is empty
get(...) -> URI
-
Signature:
@Override public URI get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a URI value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) of the URI value
-
- Returns: the URI value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public URI get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a URI value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column containing the URI value
-
- Returns: the URI value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final URI x) throws SQLException - Summary: Sets a URI value in a PreparedStatement at the specified parameter index.
-
Contract:
- If the URI is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the value in -
columnIndex(int) — the parameter index (1-based) where to set the URI value -
x(URI) — the URI value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final URI x) throws SQLException - Summary: Sets a URI value in a CallableStatement using the specified parameter name.
-
Contract:
- If the URI is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the value in -
parameterName(String) — the name of the parameter where to set the URI value -
x(URI) — the URI value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class URLType (com.landawn.abacus.type.URLType)
Type handler for {@link java.net.URL} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<URL>
-
Signature:
@Override public Class<URL> clazz() - Summary: Returns the Class object representing the URL class.
-
Parameters:
- (none)
- Returns: the Class object for URL.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final URL x) - Summary: Converts a URL instance to its external string representation.
-
Contract:
- If the input URL is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(URL) — the URL instance to convert to string
-
- Returns: the external string representation of the URL, or {@code null} if the input is null
valueOf(...) -> URL
-
Signature:
@Override public URL valueOf(final String str) - Summary: Parses a string representation to create a URL instance.
-
Contract:
- If the string is {@code null} or empty, this method returns {@code null} .
-
Parameters:
-
str(String) — the string to convert to a URL
-
- Returns: a URL instance created from the string, or {@code null} if the string is empty
get(...) -> URL
-
Signature:
@Override public URL get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a URL value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) of the URL value
-
- Returns: the URL value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public URL get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a URL value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column containing the URL value
-
- Returns: the URL value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final URL x) throws SQLException - Summary: Sets a URL value in a PreparedStatement at the specified parameter index.
-
Contract:
- If the URL is {@code null} , a NULL value is set in the database.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the value in -
columnIndex(int) — the parameter index (1-based) where to set the URL value -
x(URL) — the URL value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final URL x) throws SQLException - Summary: Sets a URL value in a CallableStatement using the specified parameter name.
-
Contract:
- If the URL is {@code null} , a NULL value is set in the database.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the value in -
parameterName(String) — the name of the parameter where to set the URL value -
x(URL) — the URL value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
Class UUIDType (com.landawn.abacus.type.UUIDType)
Type handler for {@link java.util.UUID} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<UUID>
-
Signature:
@Override public Class<UUID> clazz() - Summary: Returns the Class object representing the UUID class.
-
Parameters:
- (none)
- Returns: the Class object for UUID.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final UUID x) - Summary: Converts a UUID instance to its string representation.
-
Contract:
- If the input UUID is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(UUID) — the UUID instance to convert to string
-
- Returns: the string representation of the UUID, or {@code null} if the input is null
valueOf(...) -> UUID
-
Signature:
@Override public UUID valueOf(final String str) - Summary: Parses a string representation to create a UUID instance.
-
Contract:
- The string must be in the standard UUID format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" where 'x' is a hexadecimal digit.
- If the string is {@code null} or empty, this method returns {@code null} .
-
Parameters:
-
str(String) — the string to convert to a UUID
-
- Returns: a UUID instance created from the string, or {@code null} if the string is empty
Class Utils (com.landawn.abacus.type.Utils)
Internal utility class providing shared parser instances and configurations for the type system.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class XMLGregorianCalendarType (com.landawn.abacus.type.XMLGregorianCalendarType)
Type handler for {@link javax.xml.datatype.XMLGregorianCalendar} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<XMLGregorianCalendar>
-
Signature:
@Override public Class<XMLGregorianCalendar> clazz() - Summary: Returns the Class object representing the XMLGregorianCalendar class.
-
Parameters:
- (none)
- Returns: the Class object for XMLGregorianCalendar.class
valueOf(...) -> XMLGregorianCalendar
-
Signature:
@Override public XMLGregorianCalendar valueOf(final String str) - Summary: Converts a string to an XMLGregorianCalendar instance.
-
Parameters:
-
str(String) — the string to convert to XMLGregorianCalendar
-
- Returns: an XMLGregorianCalendar instance, or {@code null} if the string is empty
-
Signature:
@Override public XMLGregorianCalendar valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to an XMLGregorianCalendar instance.
-
Contract:
- <p> This method first checks if the character array represents a long value (epoch milliseconds).
- If so, it creates an XMLGregorianCalendar from that timestamp.
-
Parameters:
-
cbuf(char[]) — the character array containing the date/time representation -
offset(int) — the starting position in the character array -
len(int) — the number of characters to process
-
- Returns: an XMLGregorianCalendar instance, or {@code null} if the input is {@code null} or empty
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final XMLGregorianCalendar x) - Summary: Converts an XMLGregorianCalendar instance to its string representation.
-
Contract:
- If the input is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(XMLGregorianCalendar) — the XMLGregorianCalendar instance to convert to string
-
- Returns: the string representation of the XMLGregorianCalendar, or {@code null} if the input is null
get(...) -> XMLGregorianCalendar
-
Signature:
@Override public XMLGregorianCalendar get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves an XMLGregorianCalendar value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) of the timestamp value
-
- Returns: the XMLGregorianCalendar value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public XMLGregorianCalendar get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves an XMLGregorianCalendar value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label of the column containing the timestamp value
-
- Returns: the XMLGregorianCalendar value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final XMLGregorianCalendar x) throws SQLException - Summary: Sets an XMLGregorianCalendar value in a PreparedStatement at the specified parameter index.
-
Contract:
- If the XMLGregorianCalendar is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the value in -
columnIndex(int) — the parameter index (1-based) where to set the value -
x(XMLGregorianCalendar) — the XMLGregorianCalendar value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final XMLGregorianCalendar x) throws SQLException - Summary: Sets an XMLGregorianCalendar value in a CallableStatement using the specified parameter name.
-
Contract:
- If the XMLGregorianCalendar is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the value in -
parameterName(String) — the name of the parameter where to set the value -
x(XMLGregorianCalendar) — the XMLGregorianCalendar value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final XMLGregorianCalendar x) throws IOException - Summary: Appends the string representation of an XMLGregorianCalendar to an Appendable.
-
Contract:
- If the XMLGregorianCalendar is {@code null} , it appends the string "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(XMLGregorianCalendar) — the XMLGregorianCalendar value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final XMLGregorianCalendar x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of an XMLGregorianCalendar to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(XMLGregorianCalendar) — the XMLGregorianCalendar value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration controlling format and quoting
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
Class XMLType (com.landawn.abacus.type.XMLType)
Type implementation for XML serialization and deserialization of objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
declaringName(...) -> String
-
Signature:
@Override public String declaringName() - Summary: Returns the declaring name of this XML type.
-
Parameters:
- (none)
- Returns: the declaring name of this XML type
clazz(...) -> Class<T>
-
Signature:
@Override public Class<T> clazz() - Summary: Returns the Class object representing the target class for XML conversion.
-
Parameters:
- (none)
- Returns: the Class object for the target type
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final T x) - Summary: Converts an object to its XML string representation.
-
Contract:
- If the input object is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(T) — the object to convert to XML
-
- Returns: the XML string representation of the object, or {@code null} if the input is null
valueOf(...) -> T
-
Signature:
@Override public T valueOf(final String str) - Summary: Converts an XML string to an object of the target type.
-
Contract:
- If the string is {@code null} or empty, this method returns {@code null} .
-
Parameters:
-
str(String) — the XML string to deserialize
-
- Returns: an object of type T deserialized from the XML string, or {@code null} if the string is empty
Class ZonedDateTimeType (com.landawn.abacus.type.ZonedDateTimeType)
Type handler for {@link java.time.ZonedDateTime} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
clazz(...) -> Class<ZonedDateTime>
-
Signature:
@Override public Class<ZonedDateTime> clazz() - Summary: Returns the Class object representing the ZonedDateTime class.
-
Parameters:
- (none)
- Returns: the Class object for ZonedDateTime.class
stringOf(...) -> String
-
Signature:
@Override public String stringOf(final ZonedDateTime x) - Summary: Converts a ZonedDateTime instance to its string representation.
-
Contract:
- If the input is {@code null} , this method returns {@code null} .
-
Parameters:
-
x(ZonedDateTime) — the ZonedDateTime instance to convert to string
-
- Returns: the ISO 8601 timestamp string representation, or {@code null} if the input is null
valueOf(...) -> ZonedDateTime
-
Signature:
@Override public ZonedDateTime valueOf(final Object obj) - Summary: Converts an object to a ZonedDateTime instance.
-
Parameters:
-
obj(Object) — the object to convert to ZonedDateTime
-
- Returns: a ZonedDateTime instance, or {@code null} if the input is null
-
Signature:
@Override public ZonedDateTime valueOf(final String str) - Summary: Converts a string to a ZonedDateTime instance.
-
Parameters:
-
str(String) — the string to convert to ZonedDateTime
-
- Returns: a ZonedDateTime instance, or {@code null} if the string is empty
-
Signature:
@Override public ZonedDateTime valueOf(final char[] cbuf, final int offset, final int len) - Summary: Converts a character array to a ZonedDateTime instance.
-
Contract:
- <p> This method first checks if the character array represents a long value (epoch milliseconds).
- If so, it creates a ZonedDateTime from that timestamp.
-
Parameters:
-
cbuf(char[]) — the character array containing the date/time representation -
offset(int) — the starting position in the character array -
len(int) — the number of characters to process
-
- Returns: a ZonedDateTime instance, or {@code null} if the input is {@code null} or empty
get(...) -> ZonedDateTime
-
Signature:
@Override public ZonedDateTime get(final ResultSet rs, final int columnIndex) throws SQLException - Summary: Retrieves a ZonedDateTime value from a ResultSet at the specified column index.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnIndex(int) — the column index (1-based) of the timestamp value
-
- Returns: the ZonedDateTime value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column index is invalid
-
-
Signature:
@Override public ZonedDateTime get(final ResultSet rs, final String columnName) throws SQLException - Summary: Retrieves a ZonedDateTime value from a ResultSet using the specified column label.
-
Parameters:
-
rs(ResultSet) — the ResultSet to read from -
columnName(String) — the label for the column specified with the SQL AS clause
-
- Returns: the ZonedDateTime value, or {@code null} if the database value is NULL
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the column label is invalid
-
set(...) -> void
-
Signature:
@Override public void set(final PreparedStatement stmt, final int columnIndex, final ZonedDateTime x) throws SQLException - Summary: Sets a ZonedDateTime value in a PreparedStatement at the specified parameter index.
-
Contract:
- If the ZonedDateTime is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(PreparedStatement) — the PreparedStatement to set the value in -
columnIndex(int) — the parameter index (1-based) where to set the value -
x(ZonedDateTime) — the ZonedDateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter index is invalid
-
-
Signature:
@Override public void set(final CallableStatement stmt, final String parameterName, final ZonedDateTime x) throws SQLException - Summary: Sets a ZonedDateTime value in a CallableStatement using the specified parameter name.
-
Contract:
- If the ZonedDateTime is {@code null} , a NULL value is set.
-
Parameters:
-
stmt(CallableStatement) — the CallableStatement to set the value in -
parameterName(String) — the name of the parameter where to set the value -
x(ZonedDateTime) — the ZonedDateTime value to set, or {@code null} for SQL NULL
-
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the parameter name is invalid
-
appendTo(...) -> void
-
Signature:
@Override public void appendTo(final Appendable appendable, final ZonedDateTime x) throws IOException - Summary: Appends the string representation of a ZonedDateTime to an Appendable.
-
Contract:
- If the ZonedDateTime is {@code null} , it appends the string "null".
-
Parameters:
-
appendable(Appendable) — the Appendable to write to -
x(ZonedDateTime) — the ZonedDateTime value to append
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the append operation
-
writeCharacter(...) -> void
-
Signature:
@SuppressWarnings("null") @Override public void writeCharacter(final CharacterWriter writer, final ZonedDateTime x, final JsonXmlSerializationConfig<?> config) throws IOException - Summary: Writes the character representation of a ZonedDateTime to a CharacterWriter.
-
Parameters:
-
writer(CharacterWriter) — the CharacterWriter to write to -
x(ZonedDateTime) — the ZonedDateTime value to write -
config(JsonXmlSerializationConfig<?>) — the serialization configuration controlling format and quoting
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the write operation
-
com.landawn.abacus.util
Enum AccountStatus (com.landawn.abacus.util.AccountStatus)
Enumeration representing various states of an account lifecycle.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
fromCode(...) -> AccountStatus
-
Signature:
public static AccountStatus fromCode(final int code) - Summary: Returns the AccountStatus corresponding to the specified integer value.
-
Parameters:
-
code(int) — the integer value to convert
-
- Returns: the corresponding AccountStatus
Public Instance Methods
code(...) -> int
-
Signature:
public int code() - Summary: Returns the integer value associated with this account status.
-
Parameters:
- (none)
- Returns: the integer value of this status
Class AddrUtil (com.landawn.abacus.util.AddrUtil)
Utility class for handling and parsing network addresses.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getServerList(...) -> List<String>
-
Signature:
public static List<String> getServerList(final String servers) - Summary: Splits a string containing whitespace or comma separated host or IP addresses and port numbers into a List of server strings without parsing or validating them.
-
Parameters:
-
servers(String) — the string containing server addresses separated by whitespace or commas; must not be {@code null}
-
- Returns: a non-empty list of trimmed server address strings
getAddressList(...) -> List<InetSocketAddress>
-
Signature:
public static List<InetSocketAddress> getAddressList(final String servers) - Summary: Parses a string containing whitespace or comma separated host or IP addresses and port numbers into a List of {@link InetSocketAddress} instances.
-
Contract:
- </p> <p> This method supports various address formats including: </p> <ul> <li> Standard format: {@code "host:port host2:port"} or {@code "host:port, host2:port"} </li> <li> IPv4 addresses: {@code "192.168.1.1:8080"} </li> <li> IPv6 addresses: {@code "::1:11211"} or {@code "fe80::1:8080"} (colon-delimited IPv6 is supported) </li> <li> Hostnames: {@code "localhost:8080"} or {@code "example.com:443"} </li> </ul> <p> The port number must be a valid integer in the range 0-65535.
- Each address must contain at least one colon separating the host and port.
- Both the host part and port part must be non-empty.
-
Parameters:
-
servers(String) — the string containing server addresses to parse; must not be {@code null} or empty
-
- Returns: a non-empty list of {@link InetSocketAddress} instances corresponding to the parsed addresses
- See also: #getAddressList(Collection), #getServerList(String)
-
Signature:
public static List<InetSocketAddress> getAddressList(final Collection<String> servers) - Summary: Converts a collection of server address strings into a list of {@link InetSocketAddress} instances.
-
Contract:
- <p> Each string in the collection should be in the format {@code "host:port"} .
- </p> <p> Supported address formats: </p> <ul> <li> Hostnames: {@code "localhost:8080"} , {@code "example.com:443"} </li> <li> IPv4 addresses: {@code "192.168.1.1:8080"} </li> <li> IPv6 addresses: {@code "::1:11211"} , {@code "fe80::1:8080"} </li> </ul> <p> Each address must contain at least one colon separating the host and port.
- The port must be a valid integer in the range 0-65535.
- Both host and port parts must be non-empty.
-
Parameters:
-
servers(Collection<String>) — a collection of server addresses where each string is in the format {@code "host:port"} ; must not be {@code null}
-
- Returns: a non-empty list of {@link InetSocketAddress} instances corresponding to the server addresses
- See also: #getAddressList(String), #getServerList(String)
getAddressFromUrl(...) -> InetSocketAddress
-
Signature:
public static InetSocketAddress getAddressFromUrl(final URL url) - Summary: Creates an {@link InetSocketAddress} from a {@link URL} object by extracting its host and port information.
-
Contract:
- The host is extracted from the URL's authority component, and the port is taken from the URL's explicit port (if specified) or the default port for the protocol.
- </p> <p> If the URL does not specify a port explicitly and {@link URL#getPort()} returns -1, the method will attempt to use {@link URL#getDefaultPort()} to get the protocol's default port.
- If no default port is available, the resulting {@link InetSocketAddress} will be created with port -1, which typically needs to be handled by the calling code.
-
Parameters:
-
url(URL) — a {@link URL} from which the host and port are to be extracted; must not be {@code null}
-
- Returns: an {@link InetSocketAddress} instance corresponding to the host and port of the URL
- See also: #getAddressList(Collection)
getAddressListFromUrl(...) -> List<InetSocketAddress>
-
Signature:
public static List<InetSocketAddress> getAddressListFromUrl(final Collection<URL> urls) - Summary: Converts a collection of {@link URL} objects into a list of {@link InetSocketAddress} instances.
-
Contract:
- If a URL does not specify a port explicitly and {@link URL#getPort()} returns -1, the method will attempt to use {@link URL#getDefaultPort()} to get the protocol's default port.
- If no default port is available, the resulting {@link InetSocketAddress} will be created with port -1.
-
Parameters:
-
urls(Collection<URL>) — a collection of {@link URL} objects to be converted; may be {@code null} or empty
-
- Returns: a list of {@link InetSocketAddress} instances corresponding to the URLs, or an empty list if the input collection is {@code null} or empty
- See also: #getAddressFromUrl(URL)
Public Instance Methods
- (none)
Class AndroidUtil (com.landawn.abacus.util.AndroidUtil)
Utility class providing access to Android-specific executors or fallback executors for non-Android environments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getSerialExecutor(...) -> Executor
-
Signature:
@Internal public static Executor getSerialExecutor() - Summary: Returns a serial executor that executes tasks one at a time in serial order.
-
Contract:
- </p> <p> This executor is useful when tasks must be executed sequentially and thread safety is a concern.
-
Parameters:
- (none)
- Returns: a serial executor instance
getThreadPoolExecutor(...) -> Executor
-
Signature:
@Internal public static Executor getThreadPoolExecutor() - Summary: Returns a thread pool executor suitable for parallel task execution.
-
Parameters:
- (none)
- Returns: a thread pool executor instance
Public Instance Methods
- (none)
Class AppendableWriter (com.landawn.abacus.util.AppendableWriter)
A Writer implementation that wraps an Appendable object.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public AppendableWriter(final Appendable appendable) throws IllegalArgumentException - Summary: Constructs an AppendableWriter that wraps the specified Appendable.
-
Parameters:
-
appendable(Appendable) — the Appendable to wrap, must not be {@code null}
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code appendable} is {@code null}
-
append(...) -> Writer
-
Signature:
@Override public Writer append(final char c) throws IOException - Summary: Appends the specified character to this writer.
-
Parameters:
-
c(char) — the character to append
-
- Returns: this writer
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public Writer append(final CharSequence csq) throws IOException - Summary: Appends the specified character sequence to this writer.
-
Contract:
- <p> If csq is {@code null} , then the four characters "null" are appended to this writer.
-
Parameters:
-
csq(CharSequence) — the character sequence to append. If csq is {@code null} , then the four characters "null" are appended
-
- Returns: this writer
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public Writer append(final CharSequence csq, final int start, final int end) throws IOException - Summary: Appends a subsequence of the specified character sequence to this writer.
-
Parameters:
-
csq(CharSequence) — the character sequence from which a subsequence will be appended. If csq is {@code null} , then characters will be appended as if csq contained the four characters "null" -
start(int) — the index of the first character in the subsequence -
end(int) — the index of the character following the last character in the subsequence
-
- Returns: this writer
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
write(...) -> void
-
Signature:
@Override public void write(final int c) throws IOException - Summary: Writes a single character.
-
Parameters:
-
c(int) — the int specifying a character to be written
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public void write(final char[] cbuf) throws IOException - Summary: Writes an array of characters.
-
Parameters:
-
cbuf(char[]) — the array of characters to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public void write(final char[] cbuf, final int off, final int len) throws IOException - Summary: Writes a portion of an array of characters.
-
Parameters:
-
cbuf(char[]) — the array of characters -
off(int) — the offset from which to start writing characters -
len(int) — the number of characters to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public void write(final String str) throws IOException - Summary: Writes a string.
-
Parameters:
-
str(String) — the string to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
-
Signature:
@Override public void write(final String str, final int off, final int len) throws IOException - Summary: Writes a portion of a string.
-
Parameters:
-
str(String) — a string -
off(int) — the offset from which to start writing characters -
len(int) — the number of characters to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
flush(...) -> void
-
Signature:
@Override public void flush() throws IOException - Summary: Flushes the stream.
-
Contract:
- <p> If the underlying Appendable implements Flushable, its flush method will be called.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code writer.write("Important data"); writer.flush(); // Ensures data is flushed if supported } </pre>
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the writer has been closed
-
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes the stream, flushing it first.
-
Contract:
- </p> <p> If the underlying Appendable implements AutoCloseable, its close method will be called.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the current content of the underlying Appendable as a string.
-
Parameters:
- (none)
- Returns: the string representation of the underlying Appendable
Class Array (com.landawn.abacus.util.Array)
A comprehensive utility class providing an extensive collection of static methods for array manipulation, creation, transformation, and processing operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
newInstance(...) -> T
-
Signature:
public static <T> T newInstance(final Class<?> componentType, final int length) throws NegativeArraySizeException - Summary: Creates a new instance of an array with the specified component type and length.
-
Parameters:
-
componentType(Class<?>) — the Class object representing the component type of the new array. -
length(int) — the length of the new array.
-
- Returns: the new array.
-
Throws:
-
java.lang.NegativeArraySizeException— if the specified length is negative.
-
-
Signature:
public static <T> T newInstance(final Class<?> componentType, final int... dimensions) throws IllegalArgumentException, NegativeArraySizeException - Summary: Creates a new instance of an array with the specified component type and dimensions.
-
Contract:
- The dimensions should be a valid int array representing the dimensions of the new array.
-
Parameters:
-
componentType(Class<?>) — the Class object representing the component type of the new array. -
dimensions(int[]) — the dimensions of the new array.
-
- Returns: the new array.
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.NegativeArraySizeException— if any of the specified dimensions is negative.
-
- See also: java.lang.reflect.Array#newInstance(Class, int...)
getLength(...) -> int
-
Signature:
public static int getLength(final Object array) throws IllegalArgumentException - Summary: Retrieves the length of the provided array.
-
Contract:
- If the array is {@code null} , this method returns 0.
-
Parameters:
-
array(Object) — the array whose length is to be determined.
-
- Returns: the length of the array, or 0 if the array is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array.
-
- See also: java.lang.reflect.Array#getLength(Object)
get(...) -> T
-
Signature:
public static <T> T get(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the element at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the element. -
index(int) — the index of the element to be retrieved.
-
- Returns: the element at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#get(Object, int)
getBoolean(...) -> boolean
-
Signature:
public static boolean getBoolean(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the boolean value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the boolean value. -
index(int) — the index of the boolean value to be retrieved.
-
- Returns: the boolean value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getBoolean(Object, int)
getByte(...) -> byte
-
Signature:
public static byte getByte(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the byte value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the byte value. -
index(int) — the index of the byte value to be retrieved.
-
- Returns: the byte value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getByte(Object, int)
getChar(...) -> char
-
Signature:
public static char getChar(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the char value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the char value. -
index(int) — the index of the char value to be retrieved.
-
- Returns: the char value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getChar(Object, int)
getShort(...) -> short
-
Signature:
public static short getShort(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the short value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the short value. -
index(int) — the index of the short value to be retrieved.
-
- Returns: the short value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getShort(Object, int)
getInt(...) -> int
-
Signature:
public static int getInt(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the integer value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the integer value. -
index(int) — the index of the integer value to be retrieved.
-
- Returns: the integer value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getInt(Object, int)
getLong(...) -> long
-
Signature:
public static long getLong(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the long value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the long value. -
index(int) — the index of the long value to be retrieved.
-
- Returns: the long value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getLong(Object, int)
getFloat(...) -> float
-
Signature:
public static float getFloat(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the float value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the float value. -
index(int) — the index of the float value to be retrieved.
-
- Returns: the float value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getFloat(Object, int)
getDouble(...) -> double
-
Signature:
public static double getDouble(final Object array, final int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Retrieves the double value at the specified index from the provided array.
-
Parameters:
-
array(Object) — the array from which to retrieve the double value. -
index(int) — the index of the double value to be retrieved.
-
- Returns: the double value at the specified index.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#getDouble(Object, int)
set(...) -> void
-
Signature:
public static void set(final Object array, final int index, final Object value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the value. -
index(int) — the index at which the value is to be set. -
value(Object) — the value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#set(Object, int, Object)
setBoolean(...) -> void
-
Signature:
public static void setBoolean(final Object array, final int index, final boolean z) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the boolean value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the boolean value. -
index(int) — the index at which the boolean value is to be set. -
z(boolean) — the boolean value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setBoolean(Object, int, boolean)
setByte(...) -> void
-
Signature:
public static void setByte(final Object array, final int index, final byte b) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the byte value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the byte value. -
index(int) — the index at which the byte value is to be set. -
b(byte) — the byte value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setByte(Object, int, byte)
setChar(...) -> void
-
Signature:
public static void setChar(final Object array, final int index, final char c) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the char value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the char value. -
index(int) — the index at which the char value is to be set. -
c(char) — the char value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setChar(Object, int, char)
setShort(...) -> void
-
Signature:
public static void setShort(final Object array, final int index, final short s) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the short value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the short value. -
index(int) — the index at which the short value is to be set. -
s(short) — the short value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setShort(Object, int, short)
setInt(...) -> void
-
Signature:
public static void setInt(final Object array, final int index, final int i) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the integer value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the integer value. -
index(int) — the index at which the integer value is to be set. -
i(int) — the integer value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setInt(Object, int, int)
setLong(...) -> void
-
Signature:
public static void setLong(final Object array, final int index, final long l) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the long value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the long value. -
index(int) — the index at which the long value is to be set. -
l(long) — the long value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setLong(Object, int, long)
setFloat(...) -> void
-
Signature:
public static void setFloat(final Object array, final int index, final float f) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the float value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the float value. -
index(int) — the index at which the float value is to be set. -
f(float) — the float value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setFloat(Object, int, float)
setDouble(...) -> void
-
Signature:
public static void setDouble(final Object array, final int index, final double d) throws IllegalArgumentException, ArrayIndexOutOfBoundsException - Summary: Sets the double value at the specified index in the provided array.
-
Parameters:
-
array(Object) — the array in which to set the double value. -
index(int) — the index at which the double value is to be set. -
d(double) — the double value to be set.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided object is not an array. -
java.lang.ArrayIndexOutOfBoundsException— if the index is out of the array's bounds.
-
- See also: java.lang.reflect.Array#setDouble(Object, int, double)
asList(...) -> List<T>
-
Signature:
@SafeVarargs @NullSafe public static <T> List<T> asList(@NullSafe final T... a) - Summary: Returns a fixed-size list backed by the specified array if it's not {@code null} or empty, otherwise an immutable/unmodifiable empty list is returned.
-
Contract:
- Returns a fixed-size list backed by the specified array if it's not {@code null} or empty, otherwise an immutable/unmodifiable empty list is returned.
- </p> <p> The returned list is: </p> <ul> <li> Fixed-size - cannot be resized (no add/remove operations) </li> <li> Backed by the original array - changes to the list affect the array and vice versa </li> <li> Immutable empty list if the input array is {@code null} or empty </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] array = {"a", "b", "c"}; List<String> list = Array.asList(array); list.set(0, "x"); // Modifies both list and original array String\[\] emptyArray = {}; List<String> emptyList = Array.asList(emptyArray); // Returns empty list String\[\] nullArray = null; List<String> nullList = Array.asList(nullArray); // Returns empty list } </pre>
-
Parameters:
-
a(@NullSafe T[]) — the array to be converted to a list. Can be {@code null} or empty.
-
- Returns: a fixed-size list backed by the specified array, or an empty list if the array is {@code null} or empty.
- See also: Arrays#asList(Object...), N#asList(Object...), List#of(Object...), N#emptyList()
of(...) -> boolean\[\]
-
Signature:
public static boolean[] of(final boolean... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(boolean[]) — the input array of booleans.
-
- Returns: the same input array.
-
Signature:
public static char[] of(final char... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(char[]) — the input array of characters.
-
- Returns: the same input array.
-
Signature:
public static byte[] of(final byte... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(byte[]) — the input array of bytes.
-
- Returns: the same input array.
-
Signature:
public static short[] of(final short... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(short[]) — the input array of shorts.
-
- Returns: the same input array.
-
Signature:
public static int[] of(final int... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(int[]) — the input array of integers.
-
- Returns: the same input array.
-
Signature:
public static long[] of(final long... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(long[]) — the input array of longs.
-
- Returns: the same input array.
-
Signature:
public static float[] of(final float... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(float[]) — the input array of floats.
-
- Returns: the same input array.
-
Signature:
public static double[] of(final double... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(double[]) — the input array of doubles.
-
- Returns: the same input array.
-
Signature:
public static <T extends CharSequence> T[] of(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array of CharSequence.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
-
Signature:
@SafeVarargs public static <T extends java.util.Date> T[] of(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
-
Signature:
@SafeVarargs public static <T extends java.util.Calendar> T[] of(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
-
Signature:
@SafeVarargs public static <T extends java.time.temporal.Temporal> T[] of(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
-
Signature:
@SafeVarargs public static <T extends Enum<?>> T[] of(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
oF(...) -> T\[\]
-
Signature:
@Deprecated @SafeVarargs public static <T> T[] oF(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: N#asArray(Object...)
with(...) -> T\[\]
-
Signature:
@Beta public static <T> T[] with(final T... a) - Summary: Returns the input array as-is without any modification or copying.
-
Parameters:
-
a(T[]) — the input array.
-
- Returns: the same input array.
- See also: #oF(Object...)
range(...) -> char\[\]
-
Signature:
public static char[] range(char startInclusive, final char endExclusive) - Summary: Generates a range of characters from the start (inclusive) to the end (exclusive).
-
Contract:
- If the start is greater than or equal to the end, an empty array is returned.
-
Parameters:
-
startInclusive(char) — the first character (inclusive) in the char array. -
endExclusive(char) — the upper bound (exclusive) of the char array.
-
- Returns: a char array containing characters from <i> startInclusive </i> to <i> endExclusive </i> , or an empty array if startInclusive > = endExclusive.
-
Signature:
public static byte[] range(byte startInclusive, final byte endExclusive) - Summary: Generates a range of bytes from the start (inclusive) to the end (exclusive).
-
Contract:
- If the start is greater than or equal to the end, an empty array is returned.
-
Parameters:
-
startInclusive(byte) — the first byte (inclusive) in the byte array. -
endExclusive(byte) — the upper bound (exclusive) of the byte array.
-
- Returns: a byte array containing bytes from <i> startInclusive </i> to <i> endExclusive </i> , or an empty array if startInclusive > = endExclusive.
-
Signature:
public static short[] range(short startInclusive, final short endExclusive) - Summary: Generates a range of short integers from the start (inclusive) to the end (exclusive).
-
Contract:
- If the start is greater than or equal to the end, an empty array is returned.
-
Parameters:
-
startInclusive(short) — the first short integer (inclusive) in the short array. -
endExclusive(short) — the upper bound (exclusive) of the short array.
-
- Returns: a short array containing short integers from <i> startInclusive </i> to <i> endExclusive </i> , or an empty array if startInclusive > = endExclusive.
-
Signature:
public static int[] range(int startInclusive, final int endExclusive) - Summary: Generates a range of integers from the start (inclusive) to the end (exclusive).
-
Contract:
- If the start is greater than or equal to the end, an empty array is returned.
-
Parameters:
-
startInclusive(int) — the first integer (inclusive) in the integer array. -
endExclusive(int) — the upper bound (exclusive) of the integer array.
-
- Returns: an integer array containing integers from <i> startInclusive </i> to <i> endExclusive </i> , or an empty array if startInclusive > = endExclusive.
-
Signature:
public static long[] range(long startInclusive, final long endExclusive) - Summary: Generates a range of long integers from the start (inclusive) to the end (exclusive).
-
Contract:
- If the start is greater than or equal to the end, an empty array is returned.
-
Parameters:
-
startInclusive(long) — the first long integer (inclusive) in the long array. -
endExclusive(long) — the upper bound (exclusive) of the long array.
-
- Returns: a long array containing long integers from <i> startInclusive </i> to <i> endExclusive </i> , or an empty array if startInclusive > = endExclusive.
-
Signature:
public static char[] range(char startInclusive, final char endExclusive, final int by) - Summary: Generates a range of characters from the start (inclusive) to the end (exclusive) with a specific step.
-
Contract:
- The characters are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
-
Parameters:
-
startInclusive(char) — the first character (inclusive) in the char array. -
endExclusive(char) — the upper bound (exclusive) of the char array. -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent character.
-
- Returns: a char array containing characters from <i> startInclusive </i> to <i> endExclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static byte[] range(byte startInclusive, final byte endExclusive, final byte by) - Summary: Generates a range of bytes from the start (inclusive) to the end (exclusive) with a specific step.
-
Contract:
- The bytes are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
-
Parameters:
-
startInclusive(byte) — the first byte (inclusive) in the byte array. -
endExclusive(byte) — the upper bound (exclusive) of the byte array. -
by(byte) — the step to increment (if positive) or decrement (if negative) for each subsequent byte.
-
- Returns: a byte array containing bytes from <i> startInclusive </i> to <i> endExclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static short[] range(short startInclusive, final short endExclusive, final short by) - Summary: Generates a range of short integers from the start (inclusive) to the end (exclusive) with a specific step.
-
Contract:
- The short integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
-
Parameters:
-
startInclusive(short) — the first short integer (inclusive) in the short array. -
endExclusive(short) — the upper bound (exclusive) of the short array. -
by(short) — the step to increment (if positive) or decrement (if negative) for each subsequent short integer.
-
- Returns: a short array containing short integers from <i> startInclusive </i> to <i> endExclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static int[] range(int startInclusive, final int endExclusive, final int by) - Summary: Generates a range of integers from the start (inclusive) to the end (exclusive) with a specific step.
-
Contract:
- The integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
-
Parameters:
-
startInclusive(int) — the first integer (inclusive) in the integer array. -
endExclusive(int) — the upper bound (exclusive) of the integer array. -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent integer.
-
- Returns: an integer array containing integers from <i> startInclusive </i> to <i> endExclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static long[] range(long startInclusive, final long endExclusive, final long by) - Summary: Generates a range of long integers from the start (inclusive) to the end (exclusive) with a specific step.
-
Contract:
- The long integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
-
Parameters:
-
startInclusive(long) — the first long integer (inclusive) in the long array. -
endExclusive(long) — the upper bound (exclusive) of the long array. -
by(long) — the step to increment (if positive) or decrement (if negative) for each subsequent long integer.
-
- Returns: a long array containing long integers from <i> startInclusive </i> to <i> endExclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
rangeClosed(...) -> char\[\]
-
Signature:
public static char[] rangeClosed(char startInclusive, final char endInclusive) - Summary: Generates a range of characters from the start (inclusive) to the end (inclusive).
-
Contract:
- If start is greater than end, an empty array is returned.
- If start equals end, a single-element array containing that value is returned.
-
Parameters:
-
startInclusive(char) — the first character (inclusive) in the char array. -
endInclusive(char) — the upper bound (inclusive) of the char array.
-
- Returns: a char array containing characters from <i> startInclusive </i> to <i> endInclusive </i> , or an empty array if startInclusive > endInclusive.
-
Signature:
public static byte[] rangeClosed(byte startInclusive, final byte endInclusive) - Summary: Generates a range of bytes from the start (inclusive) to the end (inclusive).
-
Contract:
- If start is greater than end, an empty array is returned.
- If start equals end, a single-element array containing that value is returned.
-
Parameters:
-
startInclusive(byte) — the first byte (inclusive) in the byte array. -
endInclusive(byte) — the upper bound (inclusive) of the byte array.
-
- Returns: a byte array containing bytes from <i> startInclusive </i> to <i> endInclusive </i> , or an empty array if startInclusive > endInclusive.
-
Signature:
public static short[] rangeClosed(short startInclusive, final short endInclusive) - Summary: Generates a range of short integers from the start (inclusive) to the end (inclusive).
-
Contract:
- If start is greater than end, an empty array is returned.
- If start equals end, a single-element array containing that value is returned.
-
Parameters:
-
startInclusive(short) — the first short integer (inclusive) in the short array. -
endInclusive(short) — the upper bound (inclusive) of the short array.
-
- Returns: a short array containing short integers from <i> startInclusive </i> to <i> endInclusive </i> , or an empty array if startInclusive > endInclusive.
-
Signature:
public static int[] rangeClosed(int startInclusive, final int endInclusive) - Summary: Generates a range of integers from the start (inclusive) to the end (inclusive).
-
Contract:
- If start is greater than end, an empty array is returned.
- If start equals end, a single-element array containing that value is returned.
-
Parameters:
-
startInclusive(int) — the first integer (inclusive) in the integer array. -
endInclusive(int) — the upper bound (inclusive) of the integer array.
-
- Returns: an integer array containing integers from <i> startInclusive </i> to <i> endInclusive </i> , or an empty array if startInclusive > endInclusive.
-
Signature:
public static long[] rangeClosed(long startInclusive, final long endInclusive) - Summary: Generates a range of long integers from the start (inclusive) to the end (inclusive).
-
Contract:
- If start is greater than end, an empty array is returned.
- If start equals end, a single-element array containing that value is returned.
-
Parameters:
-
startInclusive(long) — the first long integer (inclusive) in the long array. -
endInclusive(long) — the upper bound (inclusive) of the long array.
-
- Returns: a long array containing long integers from <i> startInclusive </i> to <i> endInclusive </i> , or an empty array if startInclusive > endInclusive.
-
Signature:
public static char[] rangeClosed(char startInclusive, final char endInclusive, final int by) - Summary: Generates a range of characters from the start (inclusive) to the end (inclusive) with a specific step.
-
Contract:
- The characters are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
- If start equals end, a single-element array containing that value is returned regardless of the step value.
-
Parameters:
-
startInclusive(char) — the first character (inclusive) in the char array. -
endInclusive(char) — the upper bound (inclusive) of the char array. -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent character.
-
- Returns: a char array containing characters from <i> startInclusive </i> to <i> endInclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static byte[] rangeClosed(byte startInclusive, final byte endInclusive, final byte by) - Summary: Generates a range of bytes from the start (inclusive) to the end (inclusive) with a specific step.
-
Contract:
- The bytes are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
- If start equals end, a single-element array containing that value is returned regardless of the step value.
-
Parameters:
-
startInclusive(byte) — the first byte (inclusive) in the byte array. -
endInclusive(byte) — the upper bound (inclusive) of the byte array. -
by(byte) — the step to increment (if positive) or decrement (if negative) for each subsequent byte.
-
- Returns: a byte array containing bytes from <i> startInclusive </i> to <i> endInclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static short[] rangeClosed(short startInclusive, final short endInclusive, final short by) - Summary: Generates a range of short integers from the start (inclusive) to the end (inclusive) with a specific step.
-
Contract:
- The short integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
- If start equals end, a single-element array containing that value is returned regardless of the step value.
-
Parameters:
-
startInclusive(short) — the first short integer (inclusive) in the short array. -
endInclusive(short) — the upper bound (inclusive) of the short array. -
by(short) — the step to increment (if positive) or decrement (if negative) for each subsequent short integer.
-
- Returns: a short array containing short integers from <i> startInclusive </i> to <i> endInclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static int[] rangeClosed(int startInclusive, final int endInclusive, final int by) - Summary: Generates a range of integers from the start (inclusive) to the end (inclusive) with a specific step.
-
Contract:
- The integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
- If start equals end, a single-element array containing that value is returned regardless of the step value.
-
Parameters:
-
startInclusive(int) — the first integer (inclusive) in the integer array. -
endInclusive(int) — the upper bound (inclusive) of the integer array. -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent integer.
-
- Returns: an integer array containing integers from <i> startInclusive </i> to <i> endInclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
-
Signature:
public static long[] rangeClosed(long startInclusive, final long endInclusive, final long by) - Summary: Generates a range of long integers from the start (inclusive) to the end (inclusive) with a specific step.
-
Contract:
- The long integers are generated in ascending order if <i> by </i> is positive, and in descending order if <i> by </i> is negative.
- If the step direction is inconsistent with the range (e.g., positive step but end < start), an empty array is returned.
- If start equals end, a single-element array containing that value is returned regardless of the step value.
-
Parameters:
-
startInclusive(long) — the first long integer (inclusive) in the long array. -
endInclusive(long) — the upper bound (inclusive) of the long array. -
by(long) — the step to increment (if positive) or decrement (if negative) for each subsequent long integer.
-
- Returns: a long array containing long integers from <i> startInclusive </i> to <i> endInclusive </i> incremented or decremented by <i> by </i> , or an empty array if the range is empty or direction is inconsistent.
repeat(...) -> boolean\[\]
-
Signature:
public static boolean[] repeat(final boolean element, final int n) - Summary: Generates a new boolean array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(boolean) — the boolean value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a boolean array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static boolean[] repeat(final boolean[] a, final int n) - Summary: Generates a new boolean array by repeating the input array a specified number of times.
-
Parameters:
-
a(boolean[]) — the input boolean array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new boolean array containing the input array repeated n times.
- See also: #repeat(boolean, int)
-
Signature:
public static char[] repeat(final char element, final int n) - Summary: Generates a new char array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(char) — the char value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a char array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static char[] repeat(final char[] a, final int n) - Summary: Generates a new char array by repeating the input array a specified number of times.
-
Parameters:
-
a(char[]) — the input char array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new char array containing the input array repeated n times.
-
Signature:
public static byte[] repeat(final byte element, final int n) - Summary: Generates a new byte array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(byte) — the byte value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a byte array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static byte[] repeat(final byte[] a, final int n) - Summary: Generates a new byte array by repeating the input array a specified number of times.
-
Parameters:
-
a(byte[]) — the input byte array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new byte array containing the input array repeated n times.
-
Signature:
public static short[] repeat(final short element, final int n) - Summary: Generates a new short array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(short) — the short value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a short array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static short[] repeat(final short[] a, final int n) - Summary: Generates a new short array by repeating the input array a specified number of times.
-
Parameters:
-
a(short[]) — the input short array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new short array containing the input array repeated n times.
-
Signature:
public static int[] repeat(final int element, final int n) - Summary: Generates a new integer array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(int) — the integer value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: an integer array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static int[] repeat(final int[] a, final int n) - Summary: Generates a new integer array by repeating the input array a specified number of times.
-
Parameters:
-
a(int[]) — the input integer array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new integer array containing the input array repeated n times.
-
Signature:
public static long[] repeat(final long element, final int n) - Summary: Generates a new long array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(long) — the long value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a long array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static long[] repeat(final long[] a, final int n) - Summary: Generates a new long array by repeating the input array a specified number of times.
-
Parameters:
-
a(long[]) — the input long array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new long array containing the input array repeated n times.
-
Signature:
public static float[] repeat(final float element, final int n) - Summary: Generates a new float array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(float) — the float value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a float array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static float[] repeat(final float[] a, final int n) - Summary: Generates a new float array by repeating the input array a specified number of times.
-
Parameters:
-
a(float[]) — the input float array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new float array containing the input array repeated n times.
-
Signature:
public static double[] repeat(final double element, final int n) - Summary: Generates a new double array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(double) — the double value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a double array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static double[] repeat(final double[] a, final int n) - Summary: Generates a new double array by repeating the input array a specified number of times.
-
Parameters:
-
a(double[]) — the input double array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new double array containing the input array repeated n times.
-
Signature:
public static String[] repeat(final String element, final int n) - Summary: Generates a new String array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(String) — the String value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: a String array of length <i> n </i> with all elements set to <i> element </i> .
-
Signature:
public static String[] repeat(final String[] a, final int n) - Summary: Generates a new String array by repeating the input array a specified number of times.
-
Parameters:
-
a(String[]) — the input String array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative).
-
- Returns: a new String array containing the input array repeated n times.
-
Signature:
@Deprecated public static <T> T[] repeat(final T element, final int n) throws IllegalArgumentException - Summary: Generates a new array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(T) — the value to be repeated in the array. -
n(int) — the length of the array to be generated.
-
- Returns: an array of type 'T' and length <i> n </i> with all elements set to <i> element </i> .
-
Throws:
-
java.lang.IllegalArgumentException— <i> element </i> is {@code null} or {@code n} is negative.
-
- See also: #repeat(Object, int, Class), #repeatNonNull(Object, int), N#repeat(Object, int)
-
Signature:
public static <T> T[] repeat(final T element, final int n, final Class<? extends T> elementClass) - Summary: Generates a new array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(T) — the value to be repeated in the array. -
n(int) — the length of the array to be generated. -
elementClass(Class<? extends T>) — the class of the elements in the array.
-
- Returns: an array of type 'T' and length <i> n </i> with all elements set to <i> element </i> .
- See also: N#repeat(Object, int)
-
Signature:
public static <T> T[] repeat(final T[] a, final int n, final Class<? extends T> elementClass) - Summary: Generates a new array by repeating the input array a specified number of times.
-
Parameters:
-
a(T[]) — the input array to be repeated. -
n(int) — the number of times to repeat the array (must be non-negative). -
elementClass(Class<? extends T>) — the class of the elements in the array.
-
- Returns: a new array containing the input array repeated n times.
repeatNonNull(...) -> T\[\]
-
Signature:
public static <T> T[] repeatNonNull(final T element, final int n) throws IllegalArgumentException - Summary: Generates a new array of a specified length, with all elements set to the <i> element </i> value.
-
Parameters:
-
element(T) — the value to be repeated in the array; must not be {@code null} -
n(int) — the length of the array to be generated. Must be non-negative.
-
- Returns: an array of type 'T' and length <i> n </i> with all elements set to <i> element </i> .
-
Throws:
-
java.lang.IllegalArgumentException— if <i> element </i> is {@code null} or if <i> n </i> is negative.
-
- See also: #repeat(Object, int, Class), N#repeat(Object, int)
random(...) -> int\[\]
-
Signature:
@Beta public static int[] random(final int len) - Summary: Generates an array of random integers of the specified length.
-
Parameters:
-
len(int) — the length of the array to be generated. Must be non-negative.
-
- Returns: an array of random integers of the specified length.
- See also: Random#nextInt(), IntList#random(int), #random(int, int, int)
-
Signature:
@Beta public static int[] random(final int startInclusive, final int endExclusive, final int len) - Summary: Generates an array of random integers within the specified range.
-
Parameters:
-
startInclusive(int) — the lower bound (inclusive) of the random integers. -
endExclusive(int) — the upper bound (exclusive) of the random integers. -
len(int) — the length of the array to be generated. Must be non-negative.
-
- Returns: an array of random integers within the specified range.
- See also: Random#nextInt(int), IntList#random(int, int, int), #random(int)
concat(...) -> boolean\[\]\[\]
-
Signature:
public static boolean[][] concat(final boolean[][] a, final boolean[][] b) - Summary: Concatenates two two-dimensional boolean arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(boolean[][]) — the first two-dimensional boolean array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(boolean[][]) — the second two-dimensional boolean array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional boolean array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static boolean[][][] concat(final boolean[][][] a, final boolean[][][] b) - Summary: Concatenates two three-dimensional boolean arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(boolean[][][]) — the first three-dimensional boolean array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(boolean[][][]) — the second three-dimensional boolean array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional boolean array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static char[][] concat(final char[][] a, final char[][] b) - Summary: Concatenates two two-dimensional char arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(char[][]) — the first two-dimensional char array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(char[][]) — the second two-dimensional char array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional char array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static char[][][] concat(final char[][][] a, final char[][][] b) - Summary: Concatenates two three-dimensional char arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(char[][][]) — the first three-dimensional char array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(char[][][]) — the second three-dimensional char array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional char array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static byte[][] concat(final byte[][] a, final byte[][] b) - Summary: Concatenates two two-dimensional byte arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(byte[][]) — the first two-dimensional byte array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(byte[][]) — the second two-dimensional byte array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional byte array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static byte[][][] concat(final byte[][][] a, final byte[][][] b) - Summary: Concatenates two three-dimensional byte arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(byte[][][]) — the first three-dimensional byte array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(byte[][][]) — the second three-dimensional byte array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional byte array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static short[][] concat(final short[][] a, final short[][] b) - Summary: Concatenates two two-dimensional short arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(short[][]) — the first two-dimensional short array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(short[][]) — the second two-dimensional short array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional short array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static short[][][] concat(final short[][][] a, final short[][][] b) - Summary: Concatenates two three-dimensional short arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(short[][][]) — the first three-dimensional short array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(short[][][]) — the second three-dimensional short array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional short array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static int[][] concat(final int[][] a, final int[][] b) - Summary: Concatenates two two-dimensional integer arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(int[][]) — the first two-dimensional int array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(int[][]) — the second two-dimensional int array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional int array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static int[][][] concat(final int[][][] a, final int[][][] b) - Summary: Concatenates two three-dimensional integer arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(int[][][]) — the first three-dimensional int array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(int[][][]) — the second three-dimensional int array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional int array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static long[][] concat(final long[][] a, final long[][] b) - Summary: Concatenates two two-dimensional long arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(long[][]) — the first two-dimensional long array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(long[][]) — the second two-dimensional long array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional long array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static long[][][] concat(final long[][][] a, final long[][][] b) - Summary: Concatenates two three-dimensional long arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(long[][][]) — the first three-dimensional long array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(long[][][]) — the second three-dimensional long array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional long array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static float[][] concat(final float[][] a, final float[][] b) - Summary: Concatenates two two-dimensional float arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(float[][]) — the first two-dimensional float array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(float[][]) — the second two-dimensional float array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional float array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static float[][][] concat(final float[][][] a, final float[][][] b) - Summary: Concatenates two three-dimensional float arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(float[][][]) — the first three-dimensional float array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(float[][][]) — the second three-dimensional float array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional float array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
-
Signature:
public static double[][] concat(final double[][] a, final double[][] b) - Summary: Concatenates two two-dimensional double arrays element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(double[][]) — the first two-dimensional double array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(double[][]) — the second two-dimensional double array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new two-dimensional double array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} .
-
Signature:
public static double[][][] concat(final double[][][] a, final double[][][] b) - Summary: Concatenates two three-dimensional double arrays element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(double[][][]) — the first three-dimensional double array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned (or an empty array if both are null/empty). -
b(double[][][]) — the second three-dimensional double array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned (or an empty array if both are null/empty).
-
- Returns: a new three-dimensional double array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} .
concat2D(...) -> T\[\]\[\]
-
Signature:
public static <T> T[][] concat2D(final T[][] a, final T[][] b) - Summary: Concatenates two two-dimensional arrays of generic type T element-wise by combining their corresponding row elements.
-
Contract:
- For each row index: <ul> <li> If both arrays have a row at that index, the rows are concatenated together </li> <li> If only one array has a row at that index, that row is used in the result </li> <li> If neither array has a row at that index (both are null), the result row is an empty array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(T[][]) — the first two-dimensional array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned. -
b(T[][]) — the second two-dimensional array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned.
-
- Returns: a new two-dimensional array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each row in the result is the concatenation of the corresponding rows from {@code a} and {@code b} . Returns {@code null} if both input arrays are {@code null} .
concat3D(...) -> T\[\]\[\]\[\]
-
Signature:
public static <T> T[][][] concat3D(final T[][][] a, final T[][][] b) - Summary: Concatenates two three-dimensional arrays of generic type T element-wise by combining their corresponding two-dimensional layer elements.
-
Contract:
- For each layer index: <ul> <li> If both arrays have a layer at that index, the layers are concatenated using the two-dimensional concat2D method </li> <li> If only one array has a layer at that index, that layer is used in the result </li> <li> If neither array has a layer at that index (both are null), the result layer is an empty two-dimensional array </li> </ul> <p> The operation creates a new array and does not modify the input arrays.
-
Parameters:
-
a(T[][][]) — the first three-dimensional array to concatenate. Can be {@code null} or empty, in which case a clone of {@code b} is returned. -
b(T[][][]) — the second three-dimensional array to concatenate. Can be {@code null} or empty, in which case a clone of {@code a} is returned.
-
- Returns: a new three-dimensional array containing the element-wise concatenation of the input arrays. The length equals max(a.length, b.length). Each two-dimensional layer in the result is the concatenation of the corresponding layers from {@code a} and {@code b} . Returns {@code null} if both input arrays are {@code null} .
box(...) -> Boolean\[\]
-
Signature:
@MayReturnNull public static Boolean[] box(final boolean... a) - Summary: Converts an array of primitive booleans to an array of Boolean objects.
-
Parameters:
-
a(boolean[]) — the array of primitive booleans to be converted. May be {@code null} .
-
- Returns: an array of Boolean objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Boolean[] box(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive booleans to an array of Boolean objects.
-
Parameters:
-
a(boolean[]) — the array of primitive booleans to be converted. -
fromIndex(int) — the start index of the portion to be converted. -
toIndex(int) — the end index of the portion to be converted.
-
- Returns: an array of Boolean objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Character[] box(final char... a) - Summary: Converts an array of primitive chars to an array of Character objects.
-
Parameters:
-
a(char[]) — the array of primitive chars to be converted. May be {@code null} .
-
- Returns: an array of Character objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Character[] box(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive chars to an array of Character objects.
-
Parameters:
-
a(char[]) — the array of primitive chars to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Character objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Byte[] box(final byte... a) - Summary: Converts an array of primitive bytes to an array of Byte objects.
-
Parameters:
-
a(byte[]) — the array of primitive bytes to be converted. May be {@code null} .
-
- Returns: an array of Byte objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Byte[] box(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive bytes to an array of Byte objects.
-
Parameters:
-
a(byte[]) — the array of primitive bytes to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Byte objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Short[] box(final short... a) - Summary: Converts an array of primitive shorts to an array of Short objects.
-
Parameters:
-
a(short[]) — the array of primitive shorts to be converted. May be {@code null} .
-
- Returns: an array of Short objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Short[] box(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive shorts to an array of Short objects.
-
Parameters:
-
a(short[]) — the array of primitive shorts to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Short objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Integer[] box(final int... a) - Summary: Converts an array of primitive integers to an array of Integer objects.
-
Parameters:
-
a(int[]) — the array of primitive integers to be converted. May be {@code null} .
-
- Returns: an array of Integer objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Integer[] box(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive integers to an array of Integer objects.
-
Parameters:
-
a(int[]) — the array of primitive integers to be converted. -
fromIndex(int) — the start index of the portion to be converted. -
toIndex(int) — the end index of the portion to be converted.
-
- Returns: an array of Integer objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Long[] box(final long... a) - Summary: Converts an array of primitive longs to an array of Long objects.
-
Parameters:
-
a(long[]) — the array of primitive longs to be converted. May be {@code null} .
-
- Returns: an array of Long objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Long[] box(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive longs to an array of Long objects.
-
Parameters:
-
a(long[]) — the array of primitive longs to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Long objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Float[] box(final float... a) - Summary: Converts an array of primitive floats to an array of Float objects.
-
Parameters:
-
a(float[]) — the array of primitive floats to be converted. May be {@code null} .
-
- Returns: an array of Float objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Float[] box(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive floats to an array of Float objects.
-
Parameters:
-
a(float[]) — the array of primitive floats to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Float objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Double[] box(final double... a) - Summary: Converts an array of primitive doubles to an array of Double objects.
-
Parameters:
-
a(double[]) — the array of primitive doubles to be converted. May be {@code null} .
-
- Returns: an array of Double objects, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull public static Double[] box(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of primitive doubles to an array of Double objects.
-
Parameters:
-
a(double[]) — the array of primitive doubles to be converted. -
fromIndex(int) — the start index of the portion to be converted (inclusive). -
toIndex(int) — the end index of the portion to be converted (exclusive).
-
- Returns: an array of Double objects representing the specified portion of the input array, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds.
-
-
Signature:
@MayReturnNull public static Boolean[][] box(final boolean[][] a) - Summary: Converts a two-dimensional array of primitive booleans to a two-dimensional array of Boolean objects.
-
Parameters:
-
a(boolean[][]) — the two-dimensional array of primitive booleans to be converted.
-
- Returns: a two-dimensional array of Boolean objects, {@code null} if the input array is {@code null} .
- See also: #box(boolean\[\])
-
Signature:
@MayReturnNull public static Character[][] box(final char[][] a) - Summary: Converts a two-dimensional array of primitive chars to a two-dimensional array of Character objects.
-
Parameters:
-
a(char[][]) — the two-dimensional array of primitive chars to be converted.
-
- Returns: a two-dimensional array of Character objects, {@code null} if the input array is {@code null} .
- See also: #box(char\[\])
-
Signature:
@MayReturnNull public static Byte[][] box(final byte[][] a) - Summary: Converts a two-dimensional array of primitive bytes to a two-dimensional array of Byte objects.
-
Parameters:
-
a(byte[][]) — the two-dimensional array of primitive bytes to be converted.
-
- Returns: a two-dimensional array of Byte objects, {@code null} if the input array is {@code null} .
- See also: #box(byte\[\])
-
Signature:
@MayReturnNull public static Short[][] box(final short[][] a) - Summary: Converts a two-dimensional array of primitive shorts to a two-dimensional array of Short objects.
-
Parameters:
-
a(short[][]) — the two-dimensional array of primitive shorts to be converted.
-
- Returns: a two-dimensional array of Short objects, {@code null} if the input array is {@code null} .
- See also: #box(short\[\])
-
Signature:
@MayReturnNull public static Integer[][] box(final int[][] a) - Summary: Converts a two-dimensional array of primitive integers to a two-dimensional array of Integer objects.
-
Parameters:
-
a(int[][]) — the two-dimensional array of primitive integers to be converted.
-
- Returns: a two-dimensional array of Integer objects, {@code null} if the input array is {@code null} .
- See also: #box(int\[\])
-
Signature:
@MayReturnNull public static Long[][] box(final long[][] a) - Summary: Converts a two-dimensional array of primitive longs to a two-dimensional array of Long objects.
-
Parameters:
-
a(long[][]) — the two-dimensional array of primitive longs to be converted.
-
- Returns: a two-dimensional array of Long objects, {@code null} if the input array is {@code null} .
- See also: #box(long\[\])
-
Signature:
@MayReturnNull public static Float[][] box(final float[][] a) - Summary: Converts a two-dimensional array of primitive floats to a two-dimensional array of Float objects.
-
Parameters:
-
a(float[][]) — the two-dimensional array of primitive floats to be converted.
-
- Returns: a two-dimensional array of Float objects, {@code null} if the input array is {@code null} .
- See also: #box(float\[\])
-
Signature:
@MayReturnNull public static Double[][] box(final double[][] a) - Summary: Converts a two-dimensional array of primitive doubles to a two-dimensional array of Double objects.
-
Parameters:
-
a(double[][]) — the two-dimensional array of primitive doubles to be converted.
-
- Returns: a two-dimensional array of Double objects, {@code null} if the input array is {@code null} .
- See also: #box(double\[\])
-
Signature:
@MayReturnNull public static Boolean[][][] box(final boolean[][][] a) - Summary: Converts a three-dimensional array of primitive booleans to a three-dimensional array of Boolean objects.
-
Parameters:
-
a(boolean[][][]) — the three-dimensional array of primitive booleans to be converted.
-
- Returns: a three-dimensional array of Boolean objects, {@code null} if the input array is {@code null} .
- See also: #box(boolean\[\]), #box(boolean\[\]\[\])
-
Signature:
@MayReturnNull public static Character[][][] box(final char[][][] a) - Summary: Converts a three-dimensional array of primitive chars to a three-dimensional array of Character objects.
-
Parameters:
-
a(char[][][]) — the three-dimensional array of primitive chars to be converted.
-
- Returns: a three-dimensional array of Character objects, {@code null} if the input array is {@code null} .
- See also: #box(char\[\]), #box(char\[\]\[\])
-
Signature:
@MayReturnNull public static Byte[][][] box(final byte[][][] a) - Summary: Converts a three-dimensional array of primitive bytes to a three-dimensional array of Byte objects.
-
Parameters:
-
a(byte[][][]) — the three-dimensional array of primitive bytes to be converted.
-
- Returns: a three-dimensional array of Byte objects, {@code null} if the input array is {@code null} .
- See also: #box(byte\[\]), #box(byte\[\]\[\])
-
Signature:
@MayReturnNull public static Short[][][] box(final short[][][] a) - Summary: Converts a three-dimensional array of primitive shorts to a three-dimensional array of Short objects.
-
Parameters:
-
a(short[][][]) — the three-dimensional array of primitive shorts to be converted.
-
- Returns: a three-dimensional array of Short objects, {@code null} if the input array is {@code null} .
- See also: #box(short\[\]), #box(short\[\]\[\])
-
Signature:
@MayReturnNull public static Integer[][][] box(final int[][][] a) - Summary: Converts a three-dimensional array of primitive integers to a three-dimensional array of Integer objects.
-
Parameters:
-
a(int[][][]) — the three-dimensional array of primitive integers to be converted.
-
- Returns: a three-dimensional array of Integer objects, {@code null} if the input array is {@code null} .
- See also: #box(int\[\]), #box(int\[\]\[\])
-
Signature:
@MayReturnNull public static Long[][][] box(final long[][][] a) - Summary: Converts a three-dimensional array of primitive longs to a three-dimensional array of Long objects.
-
Parameters:
-
a(long[][][]) — the three-dimensional array of primitive longs to be converted.
-
- Returns: a three-dimensional array of Long objects, {@code null} if the input array is {@code null} .
- See also: #box(long\[\]), #box(long\[\]\[\])
-
Signature:
@MayReturnNull public static Float[][][] box(final float[][][] a) - Summary: Converts a three-dimensional array of primitive floats to a three-dimensional array of Float objects.
-
Parameters:
-
a(float[][][]) — the three-dimensional array of primitive floats to be converted.
-
- Returns: a three-dimensional array of Float objects, {@code null} if the input array is {@code null} .
- See also: #box(float\[\]), #box(float\[\]\[\])
-
Signature:
@MayReturnNull public static Double[][][] box(final double[][][] a) - Summary: Converts a three-dimensional array of primitive doubles to a three-dimensional array of Double objects.
-
Parameters:
-
a(double[][][]) — the three-dimensional array of primitive doubles to be converted.
-
- Returns: a three-dimensional array of Double objects, {@code null} if the input array is {@code null} .
- See also: #box(double\[\]), #box(double\[\]\[\])
unbox(...) -> boolean\[\]
-
Signature:
public static boolean[] unbox(final Boolean... a) - Summary: Converts an array of Boolean objects into an array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value {@code false} .
-
Parameters:
-
a(Boolean[]) — the array of Boolean objects to be converted. May be {@code null} .
-
- Returns: an array of primitive booleans, or {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\], boolean), #unbox(Boolean\[\], int, int, boolean)
-
Signature:
@MayReturnNull public static boolean[] unbox(final Boolean[] a, final boolean valueForNull) - Summary: Converts an array of Boolean objects into an array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Boolean[]) — the array of Boolean objects to be converted. -
valueForNull(boolean) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive booleans, {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\], int, int, boolean)
-
Signature:
@MayReturnNull public static boolean[] unbox(final Boolean[] a, final int fromIndex, final int toIndex, final boolean valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Boolean objects into an array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Boolean[]) — the array of Boolean objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(boolean) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive booleans, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Boolean\[\], boolean)
-
Signature:
public static char[] unbox(final Character... a) - Summary: Converts an array of Character objects into an array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (char) 0.
-
Parameters:
-
a(Character[]) — the array of Character objects to be converted.
-
- Returns: an array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\], char), #unbox(Character\[\], int, int, char)
-
Signature:
@MayReturnNull public static char[] unbox(final Character[] a, final char valueForNull) - Summary: Converts an array of Character objects into an array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Character[]) — the array of Character objects to be converted. -
valueForNull(char) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\], int, int, char)
-
Signature:
@MayReturnNull public static char[] unbox(final Character[] a, final int fromIndex, final int toIndex, final char valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Character objects into an array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Character[]) — the array of Character objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(char) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive chars, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Character\[\], char), #unbox(Character\[\])
-
Signature:
public static byte[] unbox(final Byte... a) - Summary: Converts an array of Byte objects into an array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (byte) 0.
-
Parameters:
-
a(Byte[]) — the array of Byte objects to be converted.
-
- Returns: an array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\], byte), #unbox(Byte\[\], int, int, byte)
-
Signature:
@MayReturnNull public static byte[] unbox(final Byte[] a, final byte valueForNull) - Summary: Converts an array of Byte objects into an array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Byte[]) — the array of Byte objects to be converted. -
valueForNull(byte) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\], int, int, byte)
-
Signature:
@MayReturnNull public static byte[] unbox(final Byte[] a, final int fromIndex, final int toIndex, final byte valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Byte objects into an array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Byte[]) — the array of Byte objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(byte) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive bytes, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Byte\[\], byte), #unbox(Byte\[\])
-
Signature:
public static short[] unbox(final Short... a) - Summary: Converts an array of Short objects into an array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (short) 0.
-
Parameters:
-
a(Short[]) — the array of Short objects to be converted.
-
- Returns: an array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\], short), #unbox(Short\[\], int, int, short)
-
Signature:
@MayReturnNull public static short[] unbox(final Short[] a, final short valueForNull) - Summary: Converts an array of Short objects into an array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Short[]) — the array of Short objects to be converted. -
valueForNull(short) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\], int, int, short)
-
Signature:
@MayReturnNull public static short[] unbox(final Short[] a, final int fromIndex, final int toIndex, final short valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Short objects into an array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Short[]) — the array of Short objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(short) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive shorts, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Short\[\], short), #unbox(Short\[\])
-
Signature:
public static int[] unbox(final Integer... a) - Summary: Converts an array of Integer objects into an array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (int) 0.
-
Parameters:
-
a(Integer[]) — the array of Integer objects to be converted. May be {@code null} .
-
- Returns: an array of primitive integers, or {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\], int), #unbox(Integer\[\], int, int, int)
-
Signature:
@MayReturnNull public static int[] unbox(final Integer[] a, final int valueForNull) - Summary: Converts an array of Integer objects into an array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Integer[]) — the array of Integer objects to be converted. -
valueForNull(int) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive integers, {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\], int, int, int), #unbox(Integer...)
-
Signature:
@MayReturnNull public static int[] unbox(final Integer[] a, final int fromIndex, final int toIndex, final int valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Integer objects into an array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Integer[]) — the array of Integer objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(int) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive integers, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Integer\[\], int), #unbox(Integer...)
-
Signature:
public static long[] unbox(final Long... a) - Summary: Converts an array of Long objects into an array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (long) 0.
-
Parameters:
-
a(Long[]) — the array of Long objects to be converted. May be {@code null} .
-
- Returns: an array of primitive longs, or {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\], long), #unbox(Long\[\], int, int, long)
-
Signature:
@MayReturnNull public static long[] unbox(final Long[] a, final long valueForNull) - Summary: Converts an array of Long objects into an array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Long[]) — the array of Long objects to be converted. -
valueForNull(long) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive longs, {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\], int, int, long), #unbox(Long...)
-
Signature:
@MayReturnNull public static long[] unbox(final Long[] a, final int fromIndex, final int toIndex, final long valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Long objects into an array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Long[]) — the array of Long objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(long) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive longs, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Long\[\], long), #unbox(Long...)
-
Signature:
public static float[] unbox(final Float... a) - Summary: Converts an array of Float objects into an array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (float) 0.
-
Parameters:
-
a(Float[]) — the array of Float objects to be converted.
-
- Returns: an array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\], float), #unbox(Float\[\], int, int, float)
-
Signature:
@MayReturnNull public static float[] unbox(final Float[] a, final float valueForNull) - Summary: Converts an array of Float objects into an array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Float[]) — the array of Float objects to be converted. -
valueForNull(float) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\], int, int, float), #unbox(Float...)
-
Signature:
@MayReturnNull public static float[] unbox(final Float[] a, final int fromIndex, final int toIndex, final float valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Float objects into an array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Float[]) — the array of Float objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(float) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive floats, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Float\[\], float), #unbox(Float...)
-
Signature:
public static double[] unbox(final Double... a) - Summary: Converts an array of Double objects into an array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (double) 0.
-
Parameters:
-
a(Double[]) — the array of Double objects to be converted. May be {@code null} .
-
- Returns: an array of primitive doubles, or {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\], double), #unbox(Double\[\], int, int, double)
-
Signature:
@MayReturnNull public static double[] unbox(final Double[] a, final double valueForNull) - Summary: Converts an array of Double objects into an array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Double[]) — the array of Double objects to be converted. -
valueForNull(double) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive doubles, {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\], int, int, double), #unbox(Double...)
-
Signature:
@MayReturnNull public static double[] unbox(final Double[] a, final int fromIndex, final int toIndex, final double valueForNull) throws IndexOutOfBoundsException - Summary: Converts a portion of an array of Double objects into an array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Double[]) — the array of Double objects to be converted. -
fromIndex(int) — the starting index (inclusive) in the array to be converted. -
toIndex(int) — the ending index (exclusive) in the array to be converted. -
valueForNull(double) — the value to be used for {@code null} values in the input array.
-
- Returns: an array of primitive doubles, {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > a.length or fromIndex > toIndex.
-
- See also: #unbox(Double\[\], double), #unbox(Double...)
-
Signature:
public static boolean[][] unbox(final Boolean[][] a) - Summary: Converts a two-dimensional array of Boolean objects into a two-dimensional array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (boolean) {@code false} .
-
Parameters:
-
a(Boolean[][]) — the two-dimensional array of Boolean objects to be converted.
-
- Returns: a two-dimensional array of primitive booleans, {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\]\[\], boolean), #unbox(Boolean\[\])
-
Signature:
@MayReturnNull public static boolean[][] unbox(final Boolean[][] a, final boolean valueForNull) - Summary: Converts a two-dimensional array of Boolean objects into a two-dimensional array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Boolean[][]) — the two-dimensional array of Boolean objects to be converted. -
valueForNull(boolean) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive booleans, {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\], boolean)
-
Signature:
public static char[][] unbox(final Character[][] a) - Summary: Converts a two-dimensional array of Character objects into a two-dimensional array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (char) 0.
-
Parameters:
-
a(Character[][]) — the two-dimensional array of Character objects to be converted.
-
- Returns: a two-dimensional array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\]\[\], char), #unbox(Character\[\])
-
Signature:
@MayReturnNull public static char[][] unbox(final Character[][] a, final char valueForNull) - Summary: Converts a two-dimensional array of Character objects into a two-dimensional array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Character[][]) — the two-dimensional array of Character objects to be converted. -
valueForNull(char) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\], char)
-
Signature:
public static byte[][] unbox(final Byte[][] a) - Summary: Converts a two-dimensional array of Byte objects into a two-dimensional array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (byte) 0.
-
Parameters:
-
a(Byte[][]) — the two-dimensional array of Byte objects to be converted.
-
- Returns: a two-dimensional array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\]\[\], byte), #unbox(Byte\[\])
-
Signature:
@MayReturnNull public static byte[][] unbox(final Byte[][] a, final byte valueForNull) - Summary: Converts a two-dimensional array of Byte objects into a two-dimensional array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Byte[][]) — the two-dimensional array of Byte objects to be converted. -
valueForNull(byte) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\], byte)
-
Signature:
public static short[][] unbox(final Short[][] a) - Summary: Converts a two-dimensional array of Short objects into a two-dimensional array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (short) 0.
-
Parameters:
-
a(Short[][]) — the two-dimensional array of Short objects to be converted.
-
- Returns: a two-dimensional array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\]\[\], short), #unbox(Short\[\])
-
Signature:
@MayReturnNull public static short[][] unbox(final Short[][] a, final short valueForNull) - Summary: Converts a two-dimensional array of Short objects into a two-dimensional array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Short[][]) — the two-dimensional array of Short objects to be converted. -
valueForNull(short) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\], short)
-
Signature:
public static int[][] unbox(final Integer[][] a) - Summary: Converts a two-dimensional array of Integer objects into a two-dimensional array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (int) 0.
-
Parameters:
-
a(Integer[][]) — the two-dimensional array of Integer objects to be converted.
-
- Returns: a two-dimensional array of primitive integers, {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\]\[\], int), #unbox(Integer\[\])
-
Signature:
@MayReturnNull public static int[][] unbox(final Integer[][] a, final int valueForNull) - Summary: Converts a two-dimensional array of Integer objects into a two-dimensional array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Integer[][]) — the two-dimensional array of Integer objects to be converted. -
valueForNull(int) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive integers, {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\], int)
-
Signature:
public static long[][] unbox(final Long[][] a) - Summary: Converts a two-dimensional array of Long objects into a two-dimensional array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (long) 0.
-
Parameters:
-
a(Long[][]) — the two-dimensional array of Long objects to be converted.
-
- Returns: a two-dimensional array of primitive longs, {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\]\[\], long), #unbox(Long\[\])
-
Signature:
@MayReturnNull public static long[][] unbox(final Long[][] a, final long valueForNull) - Summary: Converts a two-dimensional array of Long objects into a two-dimensional array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Long[][]) — the two-dimensional array of Long objects to be converted. -
valueForNull(long) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive longs, {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\], long)
-
Signature:
public static float[][] unbox(final Float[][] a) - Summary: Converts a two-dimensional array of Float objects into a two-dimensional array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (float) 0.
-
Parameters:
-
a(Float[][]) — the two-dimensional array of Float objects to be converted.
-
- Returns: a two-dimensional array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\]\[\], float), #unbox(Float\[\])
-
Signature:
@MayReturnNull public static float[][] unbox(final Float[][] a, final float valueForNull) - Summary: Converts a two-dimensional array of Float objects into a two-dimensional array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Float[][]) — the two-dimensional array of Float objects to be converted. -
valueForNull(float) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\], float)
-
Signature:
public static double[][] unbox(final Double[][] a) - Summary: Converts a two-dimensional array of Double objects into a two-dimensional array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (double) 0.
-
Parameters:
-
a(Double[][]) — the two-dimensional array of Double objects to be converted.
-
- Returns: a two-dimensional array of primitive doubles, {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\]\[\], double), #unbox(Double\[\])
-
Signature:
@MayReturnNull public static double[][] unbox(final Double[][] a, final double valueForNull) - Summary: Converts a two-dimensional array of Double objects into a two-dimensional array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Double[][]) — the two-dimensional array of Double objects to be converted. -
valueForNull(double) — the value to be used for {@code null} values in the input array.
-
- Returns: a two-dimensional array of primitive doubles, {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\], double)
-
Signature:
public static boolean[][][] unbox(final Boolean[][][] a) - Summary: Converts a three-dimensional array of Boolean objects into a three-dimensional array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (boolean) {@code false} .
-
Parameters:
-
a(Boolean[][][]) — the three-dimensional array of Boolean objects to be converted.
-
- Returns: a three-dimensional array of primitive booleans, {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\]\[\]\[\], boolean)
-
Signature:
@MayReturnNull public static boolean[][][] unbox(final Boolean[][][] a, final boolean valueForNull) - Summary: Converts a three-dimensional array of Boolean objects into a three-dimensional array of primitive booleans.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Boolean[][][]) — the three-dimensional array of Boolean objects to be converted. -
valueForNull(boolean) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive booleans, {@code null} if the input array is {@code null} .
- See also: #unbox(Boolean\[\]\[\], boolean)
-
Signature:
public static char[][][] unbox(final Character[][][] a) - Summary: Converts a three-dimensional array of Character objects into a three-dimensional array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (char) 0.
-
Parameters:
-
a(Character[][][]) — the three-dimensional array of Character objects to be converted.
-
- Returns: a three-dimensional array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\]\[\]\[\], char)
-
Signature:
@MayReturnNull public static char[][][] unbox(final Character[][][] a, final char valueForNull) - Summary: Converts a three-dimensional array of Character objects into a three-dimensional array of primitive chars.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Character[][][]) — the three-dimensional array of Character objects to be converted. -
valueForNull(char) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive chars, {@code null} if the input array is {@code null} .
- See also: #unbox(Character\[\]\[\], char)
-
Signature:
public static byte[][][] unbox(final Byte[][][] a) - Summary: Converts a three-dimensional array of Byte objects into a three-dimensional array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (byte) 0.
-
Parameters:
-
a(Byte[][][]) — the three-dimensional array of Byte objects to be converted.
-
- Returns: a three-dimensional array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\]\[\]\[\], byte)
-
Signature:
@MayReturnNull public static byte[][][] unbox(final Byte[][][] a, final byte valueForNull) - Summary: Converts a three-dimensional array of Byte objects into a three-dimensional array of primitive bytes.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Byte[][][]) — the three-dimensional array of Byte objects to be converted. -
valueForNull(byte) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive bytes, {@code null} if the input array is {@code null} .
- See also: #unbox(Byte\[\]\[\], byte)
-
Signature:
public static short[][][] unbox(final Short[][][] a) - Summary: Converts a three-dimensional array of Short objects into a three-dimensional array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (short) 0.
-
Parameters:
-
a(Short[][][]) — the three-dimensional array of Short objects to be converted.
-
- Returns: a three-dimensional array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\]\[\]\[\], short)
-
Signature:
@MayReturnNull public static short[][][] unbox(final Short[][][] a, final short valueForNull) - Summary: Converts a three-dimensional array of Short objects into a three-dimensional array of primitive shorts.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Short[][][]) — the three-dimensional array of Short objects to be converted. -
valueForNull(short) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive shorts, {@code null} if the input array is {@code null} .
- See also: #unbox(Short\[\]\[\], short)
-
Signature:
public static int[][][] unbox(final Integer[][][] a) - Summary: Converts a three-dimensional array of Integer objects into a three-dimensional array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (int) 0.
-
Parameters:
-
a(Integer[][][]) — the three-dimensional array of Integer objects to be converted.
-
- Returns: a three-dimensional array of primitive integers, {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\]\[\]\[\], int)
-
Signature:
@MayReturnNull public static int[][][] unbox(final Integer[][][] a, final int valueForNull) - Summary: Converts a three-dimensional array of Integer objects into a three-dimensional array of primitive integers.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Integer[][][]) — the three-dimensional array of Integer objects to be converted. -
valueForNull(int) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive integers, {@code null} if the input array is {@code null} .
- See also: #unbox(Integer\[\]\[\], int)
-
Signature:
public static long[][][] unbox(final Long[][][] a) - Summary: Converts a three-dimensional array of Long objects into a three-dimensional array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (long) 0.
-
Parameters:
-
a(Long[][][]) — the three-dimensional array of Long objects to be converted.
-
- Returns: a three-dimensional array of primitive longs, {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\]\[\]\[\], long)
-
Signature:
@MayReturnNull public static long[][][] unbox(final Long[][][] a, final long valueForNull) - Summary: Converts a three-dimensional array of Long objects into a three-dimensional array of primitive longs.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Long[][][]) — the three-dimensional array of Long objects to be converted. -
valueForNull(long) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive longs, {@code null} if the input array is {@code null} .
- See also: #unbox(Long\[\]\[\], long)
-
Signature:
public static float[][][] unbox(final Float[][][] a) - Summary: Converts a three-dimensional array of Float objects into a three-dimensional array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (float) 0.
-
Parameters:
-
a(Float[][][]) — the three-dimensional array of Float objects to be converted.
-
- Returns: a three-dimensional array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\]\[\]\[\], float)
-
Signature:
@MayReturnNull public static float[][][] unbox(final Float[][][] a, final float valueForNull) - Summary: Converts a three-dimensional array of Float objects into a three-dimensional array of primitive floats.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Float[][][]) — the three-dimensional array of Float objects to be converted. -
valueForNull(float) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive floats, {@code null} if the input array is {@code null} .
- See also: #unbox(Float\[\]\[\], float)
-
Signature:
public static double[][][] unbox(final Double[][][] a) - Summary: Converts a three-dimensional array of Double objects into a three-dimensional array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the default value (double) 0.
-
Parameters:
-
a(Double[][][]) — the three-dimensional array of Double objects to be converted.
-
- Returns: a three-dimensional array of primitive doubles, {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\]\[\]\[\], double)
-
Signature:
@MayReturnNull public static double[][][] unbox(final Double[][][] a, final double valueForNull) - Summary: Converts a three-dimensional array of Double objects into a three-dimensional array of primitive doubles.
-
Contract:
- If a {@code null} value is encountered in the input array, it is replaced with the specified default value.
-
Parameters:
-
a(Double[][][]) — the three-dimensional array of Double objects to be converted. -
valueForNull(double) — the value to be used for {@code null} values in the input array.
-
- Returns: a three-dimensional array of primitive doubles, {@code null} if the input array is {@code null} .
- See also: #unbox(Double\[\]\[\], double)
transpose(...) -> boolean\[\]\[\]
-
Signature:
@MayReturnNull @Beta public static boolean[][] transpose(final boolean[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(boolean[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static char[][] transpose(final char[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(char[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static byte[][] transpose(final byte[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(byte[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static short[][] transpose(final short[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(short[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static int[][] transpose(final int[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(int[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static long[][] transpose(final long[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(long[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static float[][] transpose(final float[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(float[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static double[][] transpose(final double[][] a) - Summary: Transposes the input two-dimensional array.
-
Contract:
- If the input is a matrix of size m x n, then the output will be another matrix of size n x m.
- This method will return {@code null} if the input array is {@code null} .
-
Parameters:
-
a(double[][]) — the two-dimensional array to be transposed.
-
- Returns: the transposed two-dimensional array, or {@code null} if the input array is {@code null} .
-
Signature:
@MayReturnNull @Beta public static <T> T[][] transpose(final T[][] a) - Summary: Transposes the given two-dimensional array.
-
Parameters:
-
a(T[][]) — the original two-dimensional array to be transposed.
-
- Returns: a new two-dimensional array representing the transposed matrix, or {@code null} if the input array is {@code null} .
Public Instance Methods
- (none)
Class ArrayUtil (com.landawn.abacus.util.Array.ArrayUtil)
Utility class that extends Array, providing access to all Array methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Ascii (com.landawn.abacus.util.Ascii)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class AsyncExecutor (com.landawn.abacus.util.AsyncExecutor)
The AsyncExecutor class provides a convenient way to execute tasks asynchronously using a configurable thread pool.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public AsyncExecutor() - Summary: Constructs an AsyncExecutor with default configuration.
-
Parameters:
- (none)
-
Signature:
public AsyncExecutor(final int coreThreadPoolSize, final int maxThreadPoolSize, final long keepAliveTime, final TimeUnit unit) throws IllegalArgumentException - Summary: Constructs an AsyncExecutor with specified thread pool configuration.
-
Parameters:
-
coreThreadPoolSize(int) — the number of threads to keep in the pool, even if they are idle -
maxThreadPoolSize(int) — the maximum number of threads to allow in the pool -
keepAliveTime(long) — when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating -
unit(TimeUnit) — the time unit for the keepAliveTime argument
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code coreThreadPoolSize} is negative, if {@code maxThreadPoolSize} is negative, if {@code keepAliveTime} is negative, or if {@code unit} is {@code null} .
-
-
Signature:
public AsyncExecutor(final Executor executor) - Summary: Constructs an AsyncExecutor that wraps an existing Executor.
-
Contract:
- <p> If the provided executor is a ThreadPoolExecutor, its configuration parameters are extracted and used.
-
Parameters:
-
executor(Executor) — the Executor to be used for executing tasks
-
execute(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> execute(final Throwables.Runnable<? extends Exception> command) - Summary: Executes the provided command asynchronously using the underlying executor.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the Runnable command to be executed asynchronously; may throw checked exceptions
-
- Returns: a ContinuableFuture representing the pending completion of this action
-
Signature:
public ContinuableFuture<Void> execute(final Throwables.Runnable<? extends Exception> command, final java.lang.Runnable finallyAction) - Summary: Executes the provided command asynchronously and ensures a final action is performed after execution.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the Runnable command to be executed asynchronously; may throw checked exceptions -
finallyAction(java.lang.Runnable) — the Runnable to be executed after the command completes (in a finally block)
-
- Returns: a ContinuableFuture representing the pending completion of this action
-
Signature:
public List<ContinuableFuture<Void>> execute(final List<? extends Throwables.Runnable<? extends Exception>> commands) - Summary: Executes a list of commands asynchronously in parallel.
-
Contract:
- </p> <p> If the provided list is {@code null} or empty, returns an empty list.
-
Parameters:
-
commands(List<? extends Throwables.Runnable<? extends Exception>>) — the list of Runnable commands to be executed asynchronously; may be {@code null} or empty
-
- Returns: a list of ContinuableFutures representing the pending completion of this action for each command; returns an empty list if commands is {@code null} or empty
-
Signature:
public <R> ContinuableFuture<R> execute(final Callable<R> command) - Summary: Executes the provided Callable command asynchronously and returns its result.
-
Contract:
- The result can be retrieved from the returned ContinuableFuture when the computation completes.
-
Parameters:
-
command(Callable<R>) — the Callable command to be executed asynchronously; may throw exceptions
-
- Returns: a ContinuableFuture representing the pending result of this computation
-
Signature:
public <R> ContinuableFuture<R> execute(final Callable<R> command, final java.lang.Runnable finallyAction) - Summary: Executes the provided Callable command asynchronously and ensures a final action is performed after execution.
-
Parameters:
-
command(Callable<R>) — the Callable command to be executed asynchronously; may throw exceptions -
finallyAction(java.lang.Runnable) — the Runnable to be executed after the command completes (in a finally block)
-
- Returns: a ContinuableFuture representing the pending result of this computation
-
Signature:
public <R> List<ContinuableFuture<R>> execute(final Collection<? extends Callable<R>> commands) - Summary: Executes a collection of Callable commands asynchronously in parallel.
-
Contract:
- </p> <p> If the provided collection is {@code null} or empty, returns an empty list.
-
Parameters:
-
commands(Collection<? extends Callable<R>>) — the collection of Callable commands to be executed asynchronously; may be {@code null} or empty
-
- Returns: a list of ContinuableFutures representing the pending result of this computation for each command; returns an empty list if commands is {@code null} or empty
executeWithRetry(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> executeWithRetry(final Throwables.Runnable<? extends Exception> command, final int retryTimes, final long retryIntervalInMillis, final Predicate<? super Exception> retryCondition) - Summary: Executes a Runnable command asynchronously with automatic retry on failure.
-
Contract:
- <p> The command will be retried up to the specified number of times if it fails and the retry condition evaluates to {@code true} .
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the Runnable to be executed asynchronously; may throw checked exceptions -
retryTimes(int) — the maximum number of retry attempts (0 means no retry, only initial attempt) -
retryIntervalInMillis(long) — the interval in milliseconds to wait between retry attempts -
retryCondition(Predicate<? super Exception>) — the predicate to determine whether to retry based on the caught exception; receives the exception and returns {@code true} to retry, {@code false} to fail immediately
-
- Returns: a ContinuableFuture representing the pending completion of this action (including retries)
-
Signature:
public <R> ContinuableFuture<R> executeWithRetry(final Callable<R> command, final int retryTimes, final long retryIntervalInMillis, final BiPredicate<? super R, ? super Exception> retryCondition) - Summary: Executes a Callable command asynchronously with automatic retry on failure or unsatisfactory result.
-
Contract:
- <p> The command will be retried up to the specified number of times if the retry condition evaluates to {@code true} .
-
Parameters:
-
command(Callable<R>) — the Callable to be executed asynchronously; may throw exceptions -
retryTimes(int) — the maximum number of retry attempts (0 means no retry, only initial attempt) -
retryIntervalInMillis(long) — the interval in milliseconds to wait between retry attempts -
retryCondition(BiPredicate<? super R, ? super Exception>) — the bi-predicate to determine whether to retry based on the result and exception; receives (result, exception) where one may be {@code null} , returns {@code true} to retry, {@code false} to complete
-
- Returns: a ContinuableFuture representing the pending result of this computation (including retries)
getExecutor(...) -> Executor
-
Signature:
@Internal public Executor getExecutor() - Summary: Retrieves the underlying executor used by this AsyncExecutor, initializing it if necessary.
-
Contract:
- Retrieves the underlying executor used by this AsyncExecutor, initializing it if necessary.
- <p> If the executor has not yet been initialized, this method creates a new ThreadPoolExecutor with the configured parameters (core pool size, max pool size, keep-alive time) and an unbounded LinkedBlockingQueue.
- A shutdown hook is automatically registered to ensure graceful termination when the JVM exits.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code AsyncExecutor asyncExecutor = new AsyncExecutor(); Executor executor = asyncExecutor.getExecutor(); // Use the executor directly if needed executor.execute(() -> System.out.println("Direct execution")); } </pre>
-
Parameters:
- (none)
- Returns: the Executor instance used by this AsyncExecutor for executing tasks.
shutdown(...) -> void
-
Signature:
public synchronized void shutdown() - Summary: Initiates an orderly shutdown of the executor used by this AsyncExecutor.
-
Contract:
- </p> <p> If the executor is not an ExecutorService or has not been initialized, this method does nothing.
-
Parameters:
- (none)
-
Signature:
public synchronized void shutdown(final long terminationTimeout, final TimeUnit timeUnit) - Summary: Initiates an orderly shutdown of the executor and waits for task completion with a timeout.
-
Contract:
- If terminationTimeout is greater than 0, the method will wait up to the specified duration for tasks to complete.
- If tasks are still running after the timeout, the method returns without forcing termination (no shutdownNow is called).
- </p> <p> If the executor is not an ExecutorService or has not been initialized, this method does nothing.
- </p> <p> If the calling thread is interrupted while waiting, the executor will still be shut down, but the method will return early and log a warning.
-
Parameters:
-
terminationTimeout(long) — the maximum time to wait for executor termination; if 0 or negative, does not wait for termination -
timeUnit(TimeUnit) — the time unit of the terminationTimeout argument
-
isTerminated(...) -> boolean
-
Signature:
public boolean isTerminated() - Summary: Checks whether all tasks have completed following shutdown.
-
Contract:
- <p> Returns {@code true} if the executor has been shut down and all tasks have completed, or if the executor has never been initialized, or if the executor is not an ExecutorService.
- Returns {@code false} if the executor is still processing tasks.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code executor.shutdown(); if (executor.isTerminated()) { System.out.println("All tasks have completed"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if all tasks have completed following shutdown, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this AsyncExecutor's configuration and state.
-
Contract:
- <p> The returned string includes configuration parameters and current state information: core pool size, maximum pool size, active thread count (if the executor is a ThreadPoolExecutor, otherwise "?"), keep-alive time in milliseconds, and the underlying executor instance details.
-
Parameters:
- (none)
- Returns: a string representation containing the configuration and state of this AsyncExecutor.
Class Beans (com.landawn.abacus.util.Beans)
A comprehensive utility class providing an extensive collection of static methods for JavaBean operations, introspection, property manipulation, and object transformation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
isBeanClass(...) -> boolean
-
Signature:
public static boolean isBeanClass(final Class<?> cls) - Summary: Checks if the specified class is a bean class.
-
Contract:
- Checks if the specified class is a bean class.
- <p> A class is considered a bean class if it: </p> <ul> <li> Is annotated with {@code @Entity} , or </li> <li> Is a record class (Java 14+) or annotated with {@code @Record} , or </li> <li> Has at least one property with getter/setter methods and is not a {@link CharSequence} , {@link Number} , or {@link Map.Entry} implementation </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code boolean isBean = Beans.isBeanClass(User.class); // true for typical POJO boolean isNotBean = Beans.isBeanClass(String.class); // false } </pre>
-
Parameters:
-
cls(Class<?>) — the class to be checked.
-
- Returns: {@code true} if the specified class is a bean class, {@code false} otherwise.
isRecordClass(...) -> boolean
-
Signature:
public static boolean isRecordClass(final Class<?> cls) - Summary: Checks if the specified class is a record class.
-
Contract:
- Checks if the specified class is a record class.
-
Parameters:
-
cls(Class<?>) — the class to be checked.
-
- Returns: {@code true} if the specified class is a record class, {@code false} otherwise.
getBeanInfo(...) -> BeanInfo
-
Signature:
public static BeanInfo getBeanInfo(final java.lang.reflect.Type beanType) - Summary: Retrieves or creates a {@link BeanInfo} instance for the specified class.
-
Parameters:
-
beanType(java.lang.reflect.Type) — the bean type to get bean information for.
-
- Returns: a BeanInfo instance containing metadata about the class.
- See also: ParserUtil#getBeanInfo(Class)
refreshBeanPropInfo(...) -> void
-
Signature:
@Deprecated @Internal public static void refreshBeanPropInfo(final Class<?> cls) - Summary: Refreshes the cached bean property information for the specified class.
-
Parameters:
-
cls(Class<?>) — the class whose bean property information should be refreshed.
-
- See also: ParserUtil#refreshBeanPropInfo(java.lang.reflect.Type)
getBuilderInfo(...) -> Tuple3<Class<?>, com.landawn.abacus.util.function.Supplier<Object>, com.landawn.abacus.util.function.Function<Object, Object>>
-
Signature:
@MayReturnNull public static Tuple3<Class<?>, com.landawn.abacus.util.function.Supplier<Object>, com.landawn.abacus.util.function.Function<Object, Object>> getBuilderInfo( final Class<?> cls) throws IllegalArgumentException - Summary: Retrieves the builder information for the specified class.
-
Contract:
- <p> This method looks for common builder patterns: </p> <ul> <li> Static methods named "builder", "newBuilder", or "createBuilder" </li> <li> Builder classes with "build" or "create" methods </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Tuple3<Class<?>, com.landawn.abacus.util.function.Supplier<Object>, com.landawn.abacus.util.function.Function<Object, Object>> builderInfo = Beans.getBuilderInfo(Person.class); if (builderInfo != null) { Object builder = builderInfo._2.get(); // Create builder Object instance = builderInfo._3.apply(builder); // Build instance } } </pre>
-
Parameters:
-
cls(Class<?>) — the class for which the builder information is to be retrieved.
-
- Returns: a tuple containing the builder class type, a supplier for creating builder instances, and a function to build the target object from the builder, or {@code null} if no builder is found.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified class is {@code null} .
-
registerNonBeanClass(...) -> void
-
Signature:
@SuppressWarnings("deprecation") public static void registerNonBeanClass(final Class<?> cls) - Summary: Registers a class as a non-bean class.
-
Contract:
- <p> This is useful for classes that should not be treated as JavaBeans, such as primitive wrappers, dates, or custom value objects.
-
Parameters:
-
cls(Class<?>) — the class to be registered as a non-bean class.
-
registerNonPropertyAccessor(...) -> void
-
Signature:
@SuppressWarnings("deprecation") public static void registerNonPropertyAccessor(final Class<?> cls, final String propName) - Summary: Registers a non-property get/set method for the specified class.
-
Parameters:
-
cls(Class<?>) — the class for which the non-property get/set method is to be registered. -
propName(String) — the name of the property to be registered as a non-property get/set method.
-
registerPropertyAccessor(...) -> void
-
Signature:
@SuppressWarnings("deprecation") public static void registerPropertyAccessor(final String propName, final Method method) - Summary: Registers a property get/set method for the specified property name.
-
Contract:
- The method must be a getter or setter recognized by {@code Beans} (for example, a method whose name starts with {@code get/is/has/set} , or a field-named accessor).
-
Parameters:
-
propName(String) — the name of the property. -
method(Method) — the method to be registered as a property get/set method.
-
registerXmlBindingClass(...) -> void
-
Signature:
@SuppressWarnings("deprecation") public static void registerXmlBindingClass(final Class<?> cls) - Summary: Registers a class for XML binding (JAXB) support.
-
Contract:
- When a class is registered for XML binding, properties that only have getter methods (without setters) are still considered valid properties if they return collection or map types.
-
Parameters:
-
cls(Class<?>) — the class to be registered for XML binding.
-
isRegisteredXmlBindingClass(...) -> boolean
-
Signature:
public static boolean isRegisteredXmlBindingClass(final Class<?> cls) - Summary: Checks if the specified class is registered for XML binding.
-
Contract:
- Checks if the specified class is registered for XML binding.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (Beans.isRegisteredXmlBindingClass(MyClass.class)) { // Handle XML binding specific logic } } </pre>
-
Parameters:
-
cls(Class<?>) — the class to check.
-
- Returns: {@code true} if the class is registered for XML binding, {@code false} otherwise.
getPropNameByMethod(...) -> String
-
Signature:
public static String getPropNameByMethod(final Method getSetMethod) - Summary: Retrieves the property name associated with the specified getter or setter method.
-
Parameters:
-
getSetMethod(Method) — the method whose property name is to be retrieved.
-
- Returns: the property name associated with the specified method.
getPropNameList(...) -> ImmutableList<String>
-
Signature:
public static ImmutableList<String> getPropNameList(final Class<?> cls) - Summary: Returns an immutable list of property names for the specified class.
-
Parameters:
-
cls(Class<?>) — the class whose property names are to be retrieved.
-
- Returns: an immutable list of property names for the specified class.
getPropNames(...) -> List<String>
-
Signature:
@Deprecated @SuppressWarnings("rawtypes") public static List<String> getPropNames(final Class<?> cls, final Collection<String> propNameToExclude) - Summary: Retrieves a list of property names for the specified class, excluding the specified property names.
-
Parameters:
-
cls(Class<?>) — the class whose property names are to be retrieved. -
propNameToExclude(Collection<String>) — the collection of property names to exclude from the result.
-
- Returns: a list of property names for the specified class, excluding the specified property names.
- See also: #getPropNames(Class, Set)
-
Signature:
public static List<String> getPropNames(final Class<?> cls, final Set<String> propNameToExclude) - Summary: Retrieves a list of property names for the specified class, excluding the specified property names.
-
Contract:
- <p> This method is more efficient than the deprecated Collection-based version when the excluded properties are already in a Set.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Set<String> excluded = Set.of("password", "internalId"); List<String> props = Beans.getPropNames(User.class, excluded); // Returns \["id", "name", "email"\] if User has those properties } </pre>
-
Parameters:
-
cls(Class<?>) — the class whose property names are to be retrieved. -
propNameToExclude(Set<String>) — the set of property names to exclude from the result.
-
- Returns: a list of property names for the specified class, excluding the specified property names.
-
Signature:
public static List<String> getPropNames(final Object bean, final boolean ignoreNullValue) - Summary: Retrieves the property names of the given bean object.
-
Parameters:
-
bean(Object) — the bean object whose property names are to be retrieved. -
ignoreNullValue(boolean) — if {@code true} , the method will ignore property names with {@code null} values.
-
- Returns: a list of strings representing the property names of the given bean object. If {@code ignoreNullValue} is {@code true} , properties with {@code null} values are not included in the list.
- See also: #getPropNameList, #getPropNames
-
Signature:
public static List<String> getPropNames(final Object bean, final Predicate<String> propNameFilter) - Summary: Retrieves a list of property names for the specified bean, filtered by the given predicate.
-
Parameters:
-
bean(Object) — the bean object whose property names are to be retrieved. -
propNameFilter(Predicate<String>) — the predicate to filter property names.
-
- Returns: a list of property names for the specified bean, filtered by the given predicate.
-
Signature:
public static List<String> getPropNames(final Object bean, final BiPredicate<String, Object> propNameValueFilter) - Summary: Retrieves a list of property names for the specified bean, filtered by the given BiPredicate.
-
Parameters:
-
bean(Object) — the bean object whose property names are to be retrieved. -
propNameValueFilter(BiPredicate<String, Object>) — the bi-predicate to filter property names and values, where the first parameter is the property name and the second parameter is the property value.
-
- Returns: a list of property names for the specified bean, filtered by the given bi-predicate.
getIgnoredPropNamesForDiff(...) -> ImmutableSet<String>
-
Signature:
public static ImmutableSet<String> getIgnoredPropNamesForDiff(final Class<?> cls) - Summary: Retrieves a set of property names that are ignored during the {@code MapDifference.of(Object, Object)} operation for the specified class.
-
Contract:
- <p> Properties are ignored if they are annotated with {@code @DiffIgnore} or similar annotations.
-
Parameters:
-
cls(Class<?>) — the class for which the {@code MapDifference.of(Object, Object)} operation ignored property names are to be retrieved.
-
- Returns: an immutable set of property names that are ignored during the {@code MapDifference.of(Object, Object)} operation.
- See also: com.landawn.abacus.util.Difference.MapDifference, com.landawn.abacus.util.Difference.BeanDifference#of(Object, Object)
getPropField(...) -> Field
-
Signature:
@MayReturnNull @SuppressWarnings("deprecation") public static Field getPropField(final Class<?> cls, final String propName) - Summary: Retrieves the field associated with the specified property name from the given class.
-
Parameters:
-
cls(Class<?>) — the class from which the field is to be retrieved. -
propName(String) — the name of the property whose field is to be retrieved.
-
- Returns: the field associated with the specified property name, or {@code null} if no field is found.
getPropFields(...) -> ImmutableMap<String, Field>
-
Signature:
public static ImmutableMap<String, Field> getPropFields(final Class<?> cls) - Summary: Retrieves an immutable map of property fields for the specified class.
-
Parameters:
-
cls(Class<?>) — the class whose property fields are to be retrieved.
-
- Returns: an immutable map of property fields for the specified class.
getPropGetter(...) -> Method
-
Signature:
@MayReturnNull @SuppressWarnings("deprecation") public static Method getPropGetter(final Class<?> cls, final String propName) - Summary: Returns the property get method declared in the specified {@code cls} with the specified property name {@code propName} .
-
Contract:
- {@code null} is returned if no method is found.
-
Parameters:
-
cls(Class<?>) — the class from which the property get method is to be retrieved. -
propName(String) — the name of the property whose get method is to be retrieved.
-
- Returns: the property get method declared in the specified class, or {@code null} if no method is found.
getPropGetters(...) -> ImmutableMap<String, Method>
-
Signature:
public static ImmutableMap<String, Method> getPropGetters(final Class<?> cls) - Summary: Retrieves an immutable map of property get methods for the specified class.
-
Parameters:
-
cls(Class<?>) — the class from which the property get methods are to be retrieved.
-
- Returns: an immutable map of property getter methods for the specified class.
getPropSetter(...) -> Method
-
Signature:
@MayReturnNull @SuppressWarnings("deprecation") public static Method getPropSetter(final Class<?> cls, final String propName) - Summary: Returns the property set method declared in the specified {@code cls} with the specified property name {@code propName} .
-
Contract:
- {@code null} is returned if no method is found.
-
Parameters:
-
cls(Class<?>) — the class from which the property set method is to be retrieved. -
propName(String) — the name of the property whose set method is to be retrieved.
-
- Returns: the property set method declared in the specified class, or {@code null} if no method is found.
getPropSetters(...) -> ImmutableMap<String, Method>
-
Signature:
public static ImmutableMap<String, Method> getPropSetters(final Class<?> cls) - Summary: Retrieves an immutable map of property set methods for the specified class.
-
Parameters:
-
cls(Class<?>) — the class from which the property set methods are to be retrieved.
-
- Returns: an immutable map of property set methods for the specified class.
getPropValue(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public static <T> T getPropValue(final Object bean, final Method propGetMethod) - Summary: Returns the value of the specified property by invoking the given getter method on the provided bean.
-
Parameters:
-
bean(Object) — the object from which the property value is to be retrieved. -
propGetMethod(Method) — the method to be invoked to get the property value.
-
- Returns: the value of the specified property.
-
Signature:
public static <T> T getPropValue(final Object bean, final String propName) - Summary: Returns the value of the specified property by invoking the getter method associated with the given property name on the provided bean.
-
Parameters:
-
bean(Object) — the object from which the property value is to be retrieved. -
propName(String) — the name of the property whose value is to be retrieved.
-
- Returns: the value of the specified property.
- See also: #getPropValue(Object, Method)
-
Signature:
@MayReturnNull public static <T> T getPropValue(final Object bean, final String propName, final boolean ignoreUnmatchedProperty) - Summary: Returns the value of the specified property by invoking the getter method associated with the given property name on the provided bean.
-
Contract:
- If the property cannot be found and ignoreUnmatchedProperty is {@code true} , it returns {@code null} .
- </p> <p> For nested paths, if an intermediate property resolves to {@code null} , this method returns the default value of the final getter's return type (for example {@code 0} for primitives), not {@code null} .
-
Parameters:
-
bean(Object) — the object from which the property value is to be retrieved. -
propName(String) — the name of the property whose value is to be retrieved. -
ignoreUnmatchedProperty(boolean) — if {@code true} , ignores unmatched properties and returns null.
-
- Returns: the value of the specified property, or {@code null} if the property is not found and ignoreUnmatchedProperty is true.
setPropValue(...) -> Object
-
Signature:
public static Object setPropValue(final Object bean, final Method propSetMethod, Object propValue) - Summary: Sets the specified property value on the given bean by invoking the provided setter method.
-
Contract:
- If the property value is {@code null} , it sets the default value of the parameter type.
- If the initial attempt to set the property value fails, it tries to convert the property value to the appropriate type and set it again.
-
Parameters:
-
bean(Object) — the object on which the property value is to be set. -
propSetMethod(Method) — the method to be invoked to set the property value. -
propValue(Object) — the value to be set to the property.
-
- Returns: the final value that was set to the property.
-
Signature:
@Deprecated public static void setPropValue(final Object bean, final String propName, final Object propValue) - Summary: Sets the specified property value on the given bean by invoking the setter method associated with the given property name.
-
Contract:
- If the property value is {@code null} , it sets the default value of the parameter type.
- If the initial attempt to set the property value fails, it tries to convert the property value to the appropriate type and set it again.
-
Parameters:
-
bean(Object) — the object on which the property value is to be set. -
propName(String) — the name of the property whose value is to be set. -
propValue(Object) — the value to be set to the property.
-
-
Signature:
@Deprecated public static boolean setPropValue(final Object bean, final String propName, final Object propValue, final boolean ignoreUnmatchedProperty) - Summary: Sets the specified property value on the given bean by invoking the setter method associated with the given property name.
-
Contract:
- If the property value is {@code null} , it sets the default value of the parameter type.
- If the initial attempt to set the property value fails, it tries to convert the property value to the appropriate type and set it again.
-
Parameters:
-
bean(Object) — the object on which the property value is to be set. -
propName(String) — the name of the property whose value is to be set. -
propValue(Object) — the value to be set to the property. -
ignoreUnmatchedProperty(boolean) — if {@code true} , ignores unmatched properties and returns false.
-
- Returns: {@code true} if the property value has been set, {@code false} otherwise.
setPropValueByGetter(...) -> void
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static void setPropValueByGetter(final Object bean, final Method propGetMethod, final Object propValue) - Summary: Sets the property value by invoking the getter method on the provided bean.
-
Contract:
- The returned type of the get method should be {@code Collection} or {@code Map} .
- And the specified property value and the returned value must be the same type.
- If {@code propValue} is {@code null} , this method does nothing.
-
Parameters:
-
bean(Object) — the object on which the property value is to be set. -
propGetMethod(Method) — the method to be invoked to get the property value. -
propValue(Object) — the value to be set to the property.
-
normalizePropName(...) -> String
-
Signature:
public static String normalizePropName(final String str) - Summary: Normalizes the given property name by converting it to camel case and replacing any reserved keywords with their mapped values.
-
Parameters:
-
str(String) — the property name to be formalized.
-
- Returns: the formalized property name.
toCamelCase(...) -> String
-
Signature:
public static String toCamelCase(final String str) - Summary: Converts the given property name to camel case.
-
Parameters:
-
str(String) — the property name to be converted.
-
- Returns: the camel case version of the property name.
toSnakeCase(...) -> String
-
Signature:
public static String toSnakeCase(final String str) - Summary: Converts the given string to lower case with underscores.
-
Parameters:
-
str(String) — the string to be converted.
-
- Returns: the lower case version of the string with underscores.
toScreamingSnakeCase(...) -> String
-
Signature:
public static String toScreamingSnakeCase(final String str) - Summary: Converts the given string to upper case with underscores.
-
Parameters:
-
str(String) — the string to be converted.
-
- Returns: the upper case version of the string with underscores.
replaceKeysWithCamelCase(...) -> void
-
Signature:
public static void replaceKeysWithCamelCase(final Map<String, Object> props) - Summary: Converts the keys in the provided map from snake_case (or other delimited formats) to camelCase.
-
Contract:
- </p> <p> <b> Conversion Examples: </b> </p> <ul> <li> {@code "user_name"} \\u2192 {@code "userName"} </li> <li> {@code "first_name"} \\u2192 {@code "firstName"} </li> <li> {@code "USER_NAME"} \\u2192 {@code "userName"} </li> <li> {@code "user-name"} \\u2192 {@code "userName"} </li> <li> {@code "userName"} \\u2192 {@code "username"} (already camelCase but re-processed) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert snake_case keys to camelCase Map<String, Object> map = new HashMap<>(); map.put("user_name", "John"); map.put("first_name", "Jane"); map.put("email_address", "john@example.com"); Beans.replaceKeysWithCamelCase(map); // map now contains: {userName=John, firstName=Jane, emailAddress=john@example.com} // Useful when converting database column names to Java property names Map<String, Object> dbRow = queryRow("SELECT user_id, created_at FROM users"); Beans.replaceKeysWithCamelCase(dbRow); // dbRow now contains: {userId=..., createdAt=...} } </pre> <p> <b> Notes: </b> </p> <ul> <li> If the map is {@code null} or empty, this method returns immediately without any action.
- </li> <li> Keys that are already in camelCase may still be modified (e.g., {@code "userName"} becomes {@code "username"} if no delimiter is found but the string is re-lowercased).
- </li> <li> If multiple keys convert to the same camelCase key, an {@link IllegalStateException} is thrown before any modifications are made (e.g., {@code "user_name"} and {@code "USER_NAME"} both convert to {@code "userName"} ).
-
Parameters:
-
props(Map<String, Object>) — the map whose keys are to be converted to camelCase; modified in-place. If {@code null} or empty, no action is taken.
-
- See also: Maps#replaceKeys(Map, Function), Fn#toCamelCase(), Strings#toCamelCase(String), #replaceKeysWithSnakeCase(Map), #replaceKeysWithScreamingSnakeCase(Map)
replaceKeysWithSnakeCase(...) -> void
-
Signature:
public static void replaceKeysWithSnakeCase(final Map<String, Object> props) - Summary: Converts the keys in the provided map from camelCase to snake_case (lowercase with underscores).
-
Contract:
- <p> The conversion inserts an underscore before each uppercase letter (when preceded by a lowercase letter or followed by a lowercase letter) and converts the entire string to lowercase.
- </p> <p> <b> Conversion Examples: </b> </p> <ul> <li> {@code "userName"} \\u2192 {@code "user_name"} </li> <li> {@code "firstName"} \\u2192 {@code "first_name"} </li> <li> {@code "emailAddress"} \\u2192 {@code "email_address"} </li> <li> {@code "userID"} \\u2192 {@code "user_id"} </li> <li> {@code "XMLParser"} \\u2192 {@code "xml_parser"} </li> <li> {@code "user_name"} \\u2192 {@code "user_name"} (already snake_case, unchanged) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert camelCase keys to snake_case Map<String, Object> map = new HashMap<>(); map.put("userName", "John"); map.put("firstName", "Jane"); map.put("emailAddress", "john@example.com"); Beans.replaceKeysWithSnakeCase(map); // map now contains: {user_name=John, first_name=Jane, email_address=john@example.com} // Useful when converting Java bean properties to database column names Map<String, Object> beanProps = Beans.beanToMap(user); Beans.replaceKeysWithSnakeCase(beanProps); // Ready for database insertion with snake_case column names } </pre> <p> <b> Notes: </b> </p> <ul> <li> If the map is {@code null} or empty, this method returns immediately without any action.
- </li> <li> If multiple keys convert to the same snake_case key, an {@link IllegalStateException} is thrown before any modifications are made (e.g., {@code "userName"} and {@code "UserName"} both convert to {@code "user_name"} ).
-
Parameters:
-
props(Map<String, Object>) — the map whose keys are to be converted to snake_case; modified in-place. If {@code null} or empty, no action is taken.
-
- See also: Maps#replaceKeys(Map, Function), Fn#toSnakeCase(), Strings#toSnakeCase(String), #replaceKeysWithCamelCase(Map), #replaceKeysWithScreamingSnakeCase(Map)
replaceKeysWithScreamingSnakeCase(...) -> void
-
Signature:
public static void replaceKeysWithScreamingSnakeCase(final Map<String, Object> props) - Summary: Converts the keys in the provided map from camelCase to SCREAMING_SNAKE_CASE (uppercase with underscores).
-
Contract:
- <p> The conversion inserts an underscore before each uppercase letter (when preceded by a lowercase letter or followed by a lowercase letter) and converts the entire string to uppercase.
- </p> <p> <b> Conversion Examples: </b> </p> <ul> <li> {@code "userName"} \\u2192 {@code "USER_NAME"} </li> <li> {@code "firstName"} \\u2192 {@code "FIRST_NAME"} </li> <li> {@code "emailAddress"} \\u2192 {@code "EMAIL_ADDRESS"} </li> <li> {@code "userID"} \\u2192 {@code "USER_ID"} </li> <li> {@code "XMLParser"} \\u2192 {@code "XML_PARSER"} </li> <li> {@code "maxRetryCount"} \\u2192 {@code "MAX_RETRY_COUNT"} </li> <li> {@code "USER_NAME"} \\u2192 {@code "USER_NAME"} (already SCREAMING_SNAKE_CASE, unchanged) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert camelCase keys to SCREAMING_SNAKE_CASE Map<String, Object> map = new HashMap<>(); map.put("userName", "John"); map.put("firstName", "Jane"); map.put("maxRetryCount", 3); Beans.replaceKeysWithScreamingSnakeCase(map); // map now contains: {USER_NAME=John, FIRST_NAME=Jane, MAX_RETRY_COUNT=3} // Useful when converting configuration properties to environment variable format Map<String, Object> config = loadConfig(); Beans.replaceKeysWithScreamingSnakeCase(config); // Keys now match environment variable naming convention } </pre> <p> <b> Notes: </b> </p> <ul> <li> If the map is {@code null} or empty, this method returns immediately without any action.
- </li> <li> If multiple keys convert to the same SCREAMING_SNAKE_CASE key, an {@link IllegalStateException} is thrown before any modifications are made (e.g., {@code "userName"} and {@code "UserName"} both convert to {@code "USER_NAME"} ).
-
Parameters:
-
props(Map<String, Object>) — the map whose keys are to be converted to SCREAMING_SNAKE_CASE; modified in-place. If {@code null} or empty, no action is taken.
-
- See also: Maps#replaceKeys(Map, Function), Fn#toScreamingSnakeCase(), Strings#toScreamingSnakeCase(String), #replaceKeysWithCamelCase(Map), #replaceKeysWithSnakeCase(Map)
mapToBean(...) -> T
-
Signature:
public static <T> T mapToBean(final Map<String, Object> map, final Class<? extends T> targetType) - Summary: Converts a map into a bean object of the specified type.
-
Parameters:
-
map(Map<String, Object>) — the map to be converted into a bean object. -
targetType(Class<? extends T>) — the type of the bean object to be returned.
-
- Returns: a bean object of the specified type with its properties set to the values from the map.
- See also: #mapToBean(Map, boolean, boolean, Class), #mapToBean(Map, Collection, Class)
-
Signature:
@MayReturnNull @SuppressWarnings("unchecked") public static <T> T mapToBean(final Map<String, Object> map, final boolean ignoreNullProperty, final boolean ignoreUnmatchedProperty, final Class<? extends T> targetType) - Summary: Converts a map into a bean object of the specified type with control over {@code null} and unmatched properties.
-
Contract:
- You can control whether {@code null} properties should be ignored and whether unmatched properties should cause an error.
-
Parameters:
-
map(Map<String, Object>) — the map to be converted into a bean object. -
ignoreNullProperty(boolean) — if {@code true} , {@code null} values in the map will not be set on the bean. -
ignoreUnmatchedProperty(boolean) — if {@code true} , map entries with keys that don't match any bean property will be ignored; if {@code false} , an exception will be thrown. -
targetType(Class<? extends T>) — the type of the bean object to be returned.
-
- Returns: a bean object of the specified type with its properties set to the values from the map, or {@code null} if the input map is {@code null} .
- See also: #mapToBean(Map, Collection, Class)
-
Signature:
@MayReturnNull public static <T> T mapToBean(final Map<String, Object> map, final Collection<String> selectPropNames, final Class<? extends T> targetType) - Summary: Converts a map into a bean object of the specified type, including only selected properties.
-
Contract:
- If {@code selectPropNames} is empty, no properties are set.
-
Parameters:
-
map(Map<String, Object>) — the map to be converted into a bean object. -
selectPropNames(Collection<String>) — a collection of property names to be included in the resulting bean objects. -
targetType(Class<? extends T>) — the type of the bean object to be returned.
-
- Returns: a bean object of the specified type with its properties set to the values from the map, or {@code null} if the input map is {@code null} .
-
Signature:
public static <T> List<T> mapToBean(final Collection<? extends Map<String, Object>> mapList, final Class<? extends T> targetType) - Summary: Converts a collection of maps into a list of bean objects of the specified type.
-
Parameters:
-
mapList(Collection<? extends Map<String, Object>>) — the collection of maps to be converted into bean objects. -
targetType(Class<? extends T>) — the type of the bean objects to be returned.
-
- Returns: a list of bean objects of the specified type with their properties set to the values from the corresponding map.
- See also: #mapToBean(Collection, Collection, Class)
-
Signature:
public static <T> List<T> mapToBean(final Collection<? extends Map<String, Object>> mapList, final boolean ignoreNullProperty, final boolean ignoreUnmatchedProperty, final Class<? extends T> targetType) - Summary: Converts a collection of maps into a list of bean objects of the specified type with control over {@code null} and unmatched properties.
-
Contract:
- The ignoreNullProperty parameter allows the user to specify whether {@code null} properties should be ignored.
- The ignoreUnmatchedProperty parameter allows the user to specify whether unmatched properties should be ignored.
-
Parameters:
-
mapList(Collection<? extends Map<String, Object>>) — the collection of maps to be converted into bean objects. -
ignoreNullProperty(boolean) — a boolean that determines whether {@code null} properties should be ignored. -
ignoreUnmatchedProperty(boolean) — a boolean that determines whether unmatched properties should be ignored. -
targetType(Class<? extends T>) — the type of the bean objects to be returned.
-
- Returns: a list of bean objects of the specified type with their properties set to the values from the corresponding map.
-
Signature:
public static <T> List<T> mapToBean(final Collection<? extends Map<String, Object>> mapList, final Collection<String> selectPropNames, final Class<? extends T> targetType) - Summary: Converts a collection of maps into a list of bean objects of the specified type, including only selected properties.
-
Parameters:
-
mapList(Collection<? extends Map<String, Object>>) — the collection of maps to be converted into bean objects. -
selectPropNames(Collection<String>) — a collection of property names to be included in the resulting bean objects. If this is empty, no properties are set; use the non-select overload to include all properties. -
targetType(Class<? extends T>) — the type of the bean objects to be returned.
-
- Returns: a list of bean objects of the specified type with their properties set to the values from the corresponding map.
beanToMap(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> beanToMap(final Object bean) - Summary: Converts a bean object into a map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> M beanToMap(final Object bean, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a map using the provided map supplier.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new Map instance.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static Map<String, Object> beanToMap(final Object bean, final Collection<String> selectPropNames) - Summary: Converts a bean object into a map, selecting only the properties specified in the provided collection.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the map. If this is {@code null} or empty, all non- {@code null} properties are included.
-
- Returns: a map where the keys are the selected property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> M beanToMap(final Object bean, final Collection<String> selectPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a map, selecting only the properties specified in the provided collection.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the map. If this is {@code null} or empty, all non- {@code null} properties are included. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new Map instance.
-
- Returns: a map where the keys are the selected property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> M beanToMap(final Object bean, final Collection<String> selectPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a map, selecting only the properties specified.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
selectPropNames(Collection<String>) — the collection of property names to be included in the map. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the map. -
mapSupplier(IntFunction<? extends M>) — the supplier function to create a new instance of the map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final M output) - Summary: Converts a bean object into the provided output map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
output(M) — the map into which the bean's properties will be put.
-
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final Collection<String> selectPropNames, final M output) - Summary: Converts a bean object into the provided output map, selecting only specified properties.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the map. If this is {@code null} or empty, all non- {@code null} properties are included. -
output(M) — the map into which the bean's properties will be put.
-
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, final M output) - Summary: Converts a bean object into a map, selecting only the properties specified.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
selectPropNames(Collection<String>) — the set of property names to be included during the conversion. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the map. -
output(M) — the map into which the bean's properties will be put.
-
-
Signature:
public static Map<String, Object> beanToMap(final Object bean, final boolean ignoreNullProperty) - Summary: Converts a bean object into a map with optional {@code null} property filtering.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static Map<String, Object> beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames) - Summary: Converts a bean object into a map with optional {@code null} property filtering and property exclusion.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion. If this is {@code null} , no properties are ignored.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> M beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a map with optional {@code null} property filtering and property exclusion.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion. If this is {@code null} , no properties are ignored. -
mapSupplier(IntFunction<? extends M>) — a function that returns a new map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static Map<String, Object> beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy) - Summary: Converts a bean object into a map with optional {@code null} property filtering, property exclusion, and key naming policy.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion. If this is {@code null} , no properties are ignored. -
keyNamingPolicy(NamingPolicy) — the policy used to name the keys in the map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> M beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a map, selecting only the properties specified.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — the set of property names to be ignored during the conversion. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the map. -
mapSupplier(IntFunction<? extends M>) — the supplier function to create a new instance of the map.
-
- Returns: a map where the keys are the property names of the bean and the values are the corresponding property values of the bean.
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final boolean ignoreNullProperty, final M output) - Summary: Converts a bean object into a map and stores the result in the provided map.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
output(M) — the map where the result should be stored.
-
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final M output) - Summary: Converts a bean object into a map and stores the result in the provided map.
-
Contract:
- If <i> ignoreNullProperty </i> is {@code true} , properties of the bean with {@code null} values will not be included in the map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion. If this is {@code null} , no properties are ignored. -
output(M) — the map where the result should be stored.
-
-
Signature:
public static <M extends Map<String, Object>> void beanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, final M output) - Summary: Converts a bean object into a map, selecting only the properties specified.
-
Parameters:
-
bean(Object) — the bean object to be converted into a map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the map. -
ignoredPropNames(Set<String>) — the set of property names to be ignored during the conversion. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the map. -
output(M) — the map to be filled with the bean's properties.
-
deepBeanToMap(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> deepBeanToMap(final Object bean) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map.
-
- Returns: a Map representation of the provided bean.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M deepBeanToMap(final Object bean, final IntFunction<? extends M> mapSupplier) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
mapSupplier(IntFunction<? extends M>) — a supplier function to create the Map instance.
-
- Returns: a Map representation of the provided bean.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> deepBeanToMap(final Object bean, final Collection<String> selectPropNames) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
selectPropNames(Collection<String>) — a collection of property names to be included during the conversion process.
-
- Returns: a Map representation of the provided bean.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M deepBeanToMap(final Object bean, final Collection<String> selectPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
selectPropNames(Collection<String>) — a collection of property names to be included during the conversion process. -
mapSupplier(IntFunction<? extends M>) — a supplier function to create the Map instance.
-
- Returns: a Map representation of the provided bean.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M deepBeanToMap(final Object bean, final Collection<String> selectPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
selectPropNames(Collection<String>) — a collection of property names to be included during the conversion process. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the resulting Map. -
mapSupplier(IntFunction<? extends M>) — a supplier function to create the Map instance into which the bean properties will be put.
-
- Returns: a Map representation of the provided bean.
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final M output) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
output(M) — the map into which the bean's properties will be put.
-
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final Collection<String> selectPropNames, final M output) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
selectPropNames(Collection<String>) — a collection of property names to be included during the conversion process. -
output(M) — the map into which the bean's properties will be put.
-
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final Collection<String> selectPropNames, final NamingPolicy keyNamingPolicy, final M output) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean to be converted into a Map. -
selectPropNames(Collection<String>) — a collection of property names to be included during the conversion process. -
keyNamingPolicy(NamingPolicy) — the naming policy to be used for the keys in the resulting Map. -
output(M) — the map into which the bean's properties will be put.
-
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> deepBeanToMap(final Object bean, final boolean ignoreNullProperty) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. Can be any Java object with getter/setter methods. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting Map.
-
- Returns: a Map representation of the bean where nested beans are recursively converted to Maps.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. Can be {@code null} .
-
- Returns: a Map representation of the bean with specified properties excluded.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a Map of the specified type containing the bean properties.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the resulting Map. If {@code null} , defaults to CAMEL_CASE.
-
- Returns: a Map representation of the bean with keys transformed according to the naming policy.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts the provided bean into a Map where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the resulting Map. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a Map of the specified type with full customization applied.
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final M output) - Summary: Converts the provided bean into the specified Map instance where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the output Map. -
output(M) — the Map instance into which the bean properties will be put. Existing entries are preserved.
-
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final M output) - Summary: Converts the provided bean into the specified Map instance where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the output Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. -
output(M) — the Map instance into which the bean properties will be put.
-
- See also: #deepBeanToMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void deepBeanToMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy, final M output) - Summary: Converts the provided bean into the specified Map instance where the keys are the property names of the bean and the values are the corresponding property values.
-
Contract:
- This method performs a deep conversion, meaning that if a property value is itself a bean, it will also be converted into a Map.
-
Parameters:
-
bean(Object) — the bean object to be converted into a Map. -
ignoreNullProperty(boolean) — if {@code true} , properties of the bean with {@code null} values will not be included in the output Map. -
ignoredPropNames(Set<String>) — a set of property names to be ignored during the conversion process. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the output Map. -
output(M) — the Map instance into which the bean properties will be put.
-
beanToFlatMap(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> beanToFlatMap(final Object bean) - Summary: Converts a bean object into a flat map representation where nested properties are represented with dot notation.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map.
-
- Returns: a map representing the bean object with nested properties flattened using dot notation.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M beanToFlatMap(final Object bean, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a flat map representation where nested properties are represented with dot notation.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a map of the specified type with nested properties flattened.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> beanToFlatMap(final Object bean, final Collection<String> selectPropNames) - Summary: Converts a bean object into a flat map representation with only selected properties.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the resulting map. Nested properties of selected beans are automatically included.
-
- Returns: a map with only the selected properties flattened.
-
Signature:
public static <M extends Map<String, Object>> M beanToFlatMap(final Object bean, final Collection<String> selectPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a flat map representation with only selected properties and custom Map type.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the resulting map. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a map of the specified type with selected properties flattened.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M beanToFlatMap(final Object bean, final Collection<String> selectPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a flat map representation with selected properties and a specified naming policy.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the resulting map. If this is empty, all non- {@code null} properties are included. -
keyNamingPolicy(NamingPolicy) — the naming policy for the keys in the resulting map. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new map instance. The function argument is the initial map capacity.
-
- Returns: a map representing the bean object. Each key-value pair in the map corresponds to a property of the bean.
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final M output) - Summary: Converts a bean object into a flat map representation and stores the result in the provided Map instance.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
output(M) — the Map instance into which the flattened bean properties will be put. Existing entries are preserved.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final Collection<String> selectPropNames, final M output) - Summary: Converts a bean object into a flat map representation with selected properties and stores the result in the provided Map instance.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the output map. -
output(M) — the Map instance into which the flattened bean properties will be put.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, final M output) - Summary: Converts a bean object into a flat map representation with full customization options and stores the result in the provided Map instance.
-
Contract:
- If {@code selectPropNames} is {@code null} or empty, all non- {@code null} properties are included.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
selectPropNames(Collection<String>) — a collection of property names to be included in the output map. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the output map. -
output(M) — the Map instance into which the flattened bean properties will be put.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> beanToFlatMap(final Object bean, final boolean ignoreNullProperty) - Summary: Converts a bean object into a flat map representation with control over {@code null} property handling.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting map.
-
- Returns: a flat map representation of the bean with {@code null} handling as specified.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames) - Summary: Converts a bean object into a flat map representation with control over {@code null} property handling and property exclusion.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the resulting map.
-
- Returns: a flat map with specified filtering applied.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a flat map representation with control over {@code null} handling, property exclusion, and Map type.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the resulting map. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a map of the specified type with filtering applied.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static Map<String, Object> beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy) - Summary: Converts a bean object into a flat map representation with control over {@code null} handling, property exclusion, and key naming policy.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the resulting map. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the resulting map.
-
- Returns: a flat map with comprehensive customization applied.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> M beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy, final IntFunction<? extends M> mapSupplier) - Summary: Converts a bean object into a flat map representation with full control over all conversion aspects.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the resulting map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the resulting map. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the resulting map. -
mapSupplier(IntFunction<? extends M>) — a function that creates a new Map instance. The function argument is the initial capacity.
-
- Returns: a fully customized flat map representation of the bean.
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final M output) - Summary: Converts a bean object into a flat map representation and stores the result in the provided Map instance with {@code null} handling.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the output map. -
output(M) — the map into which the flattened bean properties will be put.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final M output) - Summary: Converts a bean object into a flat map representation and stores the result in the provided Map instance with filtering options.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the output map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the output map. -
output(M) — the map into which the flattened bean properties will be put.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
-
Signature:
public static <M extends Map<String, Object>> void beanToFlatMap(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames, final NamingPolicy keyNamingPolicy, final M output) - Summary: Converts a bean object into a flat map representation and stores the result in the provided Map instance with full customization.
-
Parameters:
-
bean(Object) — the bean object to be converted into a flat map. -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values will not be included in the output map. -
ignoredPropNames(Set<String>) — a set of property names to be excluded from the output map. -
keyNamingPolicy(NamingPolicy) — the naming policy to apply to the keys in the output map. -
output(M) — the map into which the flattened bean properties will be put.
-
- See also: #beanToFlatMap(Object, Collection, NamingPolicy, IntFunction)
newBean(...) -> T
-
Signature:
public static <T> T newBean(final Class<T> targetType) - Summary: Creates a new instance of the specified bean class.
-
Contract:
- The class must have an accessible no-argument constructor.
-
Parameters:
-
targetType(Class<T>) — the class of the object to be created.
-
- Returns: a new instance of the specified class.
deepCopy(...) -> T
-
Signature:
@MayReturnNull @SuppressWarnings("unchecked") public static <T> T deepCopy(final T obj) - Summary: Creates a deep clone of the given object using serialization.
-
Contract:
- </p> <p> The object must be serializable through either Kryo or XML.
- If Kryo serialization fails, the method automatically falls back to XML serialization.
-
Parameters:
-
obj(T) — a Java object which must be serializable and deserializable through Kryo or XML.
-
- Returns: a deep clone of the object, or {@code null} if the input is {@code null} .
deepCopyAs(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public static <T> T deepCopyAs(final Object obj, @NotNull final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a deep clone of the given object and converts it to the specified target type.
-
Contract:
- This is useful for creating type-converted copies or for ensuring type safety when cloning objects.
- </p> <p> If the source object is {@code null} , the method creates a new instance of the target type by calling {@link #copyAs(Object, Class)} for bean targets or {@link N#newInstance(Class)} for non-bean targets (which requires an accessible no-arg constructor).
-
Parameters:
-
obj(Object) — a Java object which must be serializable and deserializable through Kryo or XML. -
targetType(@NotNull Class<? extends T>) — the class of the target type to create.
-
- Returns: a new instance of the target type with properties cloned from the source object.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null} .
-
copy(...) -> T
-
Signature:
@MayReturnNull @SuppressWarnings("unchecked") public static <T> T copy(final T sourceBean) - Summary: Creates a shallow copy of the given source bean.
-
Parameters:
-
sourceBean(T) — the source bean to copy.
-
- Returns: a new instance with properties copied from the source bean, or {@code null} if the source is {@code null} .
-
Signature:
@MayReturnNull public static <T> T copy(final T sourceBean, final Collection<String> selectPropNames) - Summary: Creates a shallow copy of the source bean with only selected properties.
-
Parameters:
-
sourceBean(T) — the source bean to copy. -
selectPropNames(Collection<String>) — the collection of property names to be copied.
-
- Returns: a new instance with selected properties copied from the source bean, or {@code null} if the source is {@code null} .
-
Signature:
@MayReturnNull public static <T> T copy(final T sourceBean, final BiPredicate<? super String, ?> propFilter) - Summary: Creates a shallow copy of the source bean with properties filtered by a predicate.
-
Contract:
- The predicate receives the property name and value and should return {@code true} to include the property in the copy.
-
Parameters:
-
sourceBean(T) — the source bean to copy. -
propFilter(BiPredicate<? super String, ?>) — the predicate to filter properties to be copied.
-
- Returns: a new instance with filtered properties copied from the source bean, or {@code null} if the source is {@code null} .
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
copyAs(...) -> T
-
Signature:
public static <T> T copyAs(final Object sourceBean, final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the specified target type with properties copied from the source bean.
-
Contract:
- Properties are matched by name - if a property exists in both source and target types with the same name, its value will be copied.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from. -
targetType(Class<? extends T>) — the class of the target type.
-
- Returns: a new instance of the target type with properties copied from the source.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null} .
-
-
Signature:
public static <T> T copyAs(final Object sourceBean, final Collection<String> selectPropNames, @NotNull final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the target type with selected properties copied from the source bean.
-
Contract:
- <p> This method allows selective property copying when converting between different bean types.
- Only properties whose names are in the selection list will be copied, and they must exist in both source and target types.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from. -
selectPropNames(Collection<String>) — the collection of property names to be copied. -
targetType(@NotNull Class<? extends T>) — the class of the target type.
-
- Returns: a new instance of the target type with selected properties copied.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null} .
-
-
Signature:
@SuppressWarnings({ "unchecked" }) public static <T> T copyAs(final Object sourceBean, final Collection<String> selectPropNames, final Function<String, String> propNameConverter, @NotNull final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the target type with selected properties copied from the source bean, applying property name conversion.
-
Contract:
- <p> This method is useful when property names differ between source and target beans.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from. -
selectPropNames(Collection<String>) — the collection of property names to be copied. -
propNameConverter(Function<String, String>) — function to convert property names from source to target format. -
targetType(@NotNull Class<? extends T>) — the class of the target type.
-
- Returns: a new instance of the target type with converted and copied properties.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null} .
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyAs(final Object sourceBean, final BiPredicate<? super String, ?> propFilter, final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the target type with properties filtered by a predicate and copied from the source bean.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from -
propFilter(BiPredicate<? super String, ?>) — predicate to filter which properties should be copied -
targetType(Class<? extends T>) — the class of the target type
-
- Returns: a new instance of the target type with filtered properties copied
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyAs(final Object sourceBean, final BiPredicate<? super String, ?> propFilter, final Function<String, String> propNameConverter, final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the target type with properties filtered by a predicate and copied from the source bean, applying property name conversion.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from -
propFilter(BiPredicate<? super String, ?>) — predicate to filter which properties should be copied -
propNameConverter(Function<String, String>) — function to convert property names from source to target format -
targetType(Class<? extends T>) — the class of the target type
-
- Returns: a new instance of the target type with filtered and converted properties
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
@SuppressWarnings({ "unchecked" }) public static <T> T copyAs(final Object sourceBean, final boolean ignoreUnmatchedProperty, final Set<String> ignoredPropNames, @NotNull final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Creates a new instance of the target type with properties copied from the source bean, excluding specified properties and optionally ignoring unmatched properties.
-
Contract:
- <p> This method is useful when you want to copy most properties except for a specific set.
- The {@code ignoreUnmatchedProperty} parameter controls whether an exception is thrown when a property exists in the source but not in the target.
-
Parameters:
-
sourceBean(Object) — the source bean to copy properties from -
ignoreUnmatchedProperty(boolean) — if {@code true} , properties not found in target are ignored; if {@code false} , throws exception -
ignoredPropNames(Set<String>) — set of property names to exclude from copying -
targetType(@NotNull Class<? extends T>) — the class of the target type
-
- Returns: a new instance of the target type with properties copied except ignored ones
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetType} is {@code null} or if unmatched properties found when not ignoring
-
copyInto(...) -> T
-
Signature:
public static <T> T copyInto(final Object sourceBean, final T targetBean) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(T) — the target bean into which properties are merged
-
- Returns: the same target bean instance with merged properties
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
-
Signature:
public static <T> T copyInto(final Object sourceBean, final T targetBean, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean using a custom merge function.
-
Contract:
- <p> The merge function determines how to combine values when a property exists in both beans.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code User existingUser = new User("John", 25); existingUser.setScore(100); User updates = new User("John", 26); updates.setScore(50); // Merge using max value for numeric properties Beans.copyInto(updates, existingUser, (sourceVal, targetVal) -> { if (sourceVal instanceof Integer && targetVal instanceof Integer) { return Math.max((Integer) sourceVal, (Integer) targetVal); } return sourceVal != null ?
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(T) — the target bean into which properties are merged -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with merged properties
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, final T targetBean, final Function<String, String> propNameConverter, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean with property name conversion and a custom merge function.
-
Contract:
- <p> This method allows property name mapping during the merge operation, useful when source and target beans have different naming conventions.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(T) — the target bean into which properties are merged -
propNameConverter(Function<String, String>) — function to convert property names from source to target format -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with merged properties
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final Collection<String> selectPropNames) throws IllegalArgumentException - Summary: Merges selected properties from the source bean into the target bean.
-
Contract:
- This is useful for partial updates where only specific fields should be modified.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
selectPropNames(Collection<String>) — collection of property names to merge
-
- Returns: the same target bean instance with selected properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final Collection<String> selectPropNames, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges selected properties from the source bean into the target bean using a custom merge function.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code User existingUser = new User("John", 25); existingUser.setScore(100); User updates = new User("Jane", 30); updates.setScore(200); // Only merge age and score, keeping the higher score Beans.copyInto(updates, existingUser, Arrays.asList("age", "score"), (srcVal, tgtVal) -> { if ("score".equals(currentPropName) && srcVal instanceof Integer) { return Math.max((Integer) srcVal, (Integer) tgtVal); } return srcVal; }); // existingUser: name="John", age=30, score=200 } </pre>
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
selectPropNames(Collection<String>) — collection of property names to merge -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with selected properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final Collection<String> selectPropNames, final Function<String, String> propNameConverter) throws IllegalArgumentException - Summary: Merges selected properties from the source bean into the target bean with property name conversion.
-
Contract:
- <p> This method combines selective property merging with name conversion, useful when merging between beans with different naming conventions.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
selectPropNames(Collection<String>) — collection of property names to merge -
propNameConverter(Function<String, String>) — function to convert property names from source to target format
-
- Returns: the same target bean instance with selected properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final Collection<String> selectPropNames, final Function<String, String> propNameConverter, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges selected properties from the source bean into the target bean with property name conversion and a custom merge function.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code SourceBean source = new SourceBean(); source.setFirstName("John"); source.setTotalAmount(150); TargetBean target = new TargetBean(); target.setTotal_amount(100); Beans.copyInto(source, target, Arrays.asList("firstName", "totalAmount"), propName -> Strings.toSnakeCase(propName), (srcVal, tgtVal) -> { // For amounts, add them together if (srcVal instanceof Number && tgtVal instanceof Number) { return ((Number) srcVal).intValue() + ((Number) tgtVal).intValue(); } return srcVal; }); // target.first_name = "John" // target.total_amount = 250 (150 + 100) } </pre>
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
selectPropNames(Collection<String>) — collection of property names to merge -
propNameConverter(Function<String, String>) — function to convert property names from source to target format -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with selected properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, final T targetBean, final BiPredicate<? super String, ?> propFilter) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean based on a filter predicate.
-
Contract:
- <p> The predicate receives each property name and value from the source bean and determines whether that property should be merged into the target.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(T) — the target bean into which properties are merged -
propFilter(BiPredicate<? super String, ?>) — predicate to determine which properties should be merged
-
- Returns: the same target bean instance with filtered properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final BiPredicate<? super String, ?> propFilter, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean based on a filter predicate and using a custom merge function.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Product source = new Product("New Name", 150, 10); Product target = new Product("Old Name", 100, 5); // Merge numeric properties by adding them, others by replacing Beans.copyInto(source, target, (propName, propValue) -> propValue != null, (srcVal, tgtVal) -> { if (srcVal instanceof Number && tgtVal instanceof Number) { return ((Number) srcVal).intValue() + ((Number) tgtVal).intValue(); } return srcVal; }); // target: name="New Name", price=250, quantity=15 } </pre>
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
propFilter(BiPredicate<? super String, ?>) — predicate to determine which properties should be merged -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with filtered properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final BiPredicate<? super String, ?> propFilter, final Function<String, String> propNameConverter) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean based on a filter predicate with property name conversion.
-
Contract:
- <p> This method allows filtering properties and converting their names during the merge, useful when working with beans that have different naming conventions.
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
propFilter(BiPredicate<? super String, ?>) — predicate to determine which properties should be merged -
propNameConverter(Function<String, String>) — function to convert property names from source to target format
-
- Returns: the same target bean instance with filtered and converted properties merged
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final BiPredicate<? super String, ?> propFilter, final Function<String, String> propNameConverter, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean with full control over filtering, name conversion, and merge logic.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code SourceBean source = new SourceBean(); source.setFirstName("John"); source.setTotalCount(10); source.setLastUpdated(new Date()); TargetBean target = new TargetBean(); target.setTotal_count(5); Beans.copyInto(source, target, // Only merge non-null values (propName, propValue) -> propValue != null, // Convert camelCase to snake_case propName -> Strings.toSnakeCase(propName), // Custom merge logic (srcVal, tgtVal) -> { if (srcVal instanceof Integer && tgtVal instanceof Integer) { return ((Integer) srcVal) + ((Integer) tgtVal); } else if (srcVal instanceof Date && tgtVal instanceof Date) { // Keep the more recent date return ((Date) srcVal).after((Date) tgtVal) ?
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged; must not be {@code null} -
propFilter(BiPredicate<? super String, ?>) — predicate to determine which properties should be merged; must not be {@code null} -
propNameConverter(Function<String, String>) — function to convert property names from source to target format; must not be {@code null} -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property; must not be {@code null}
-
- Returns: the same target bean instance with filtered, converted, and merged properties
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null}
-
- See also: BiPredicates#alwaysTrue(), Fn#identity(), Fn#selectFirst()
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final boolean ignoreUnmatchedProperty, final Set<String> ignoredPropNames) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean, excluding specified properties.
-
Contract:
- The {@code ignoreUnmatchedProperty} parameter controls whether an exception is thrown when a property exists in the source but not in the target.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code User source = new User("John", 30, "john@example.com", "password123"); User target = new User("Jane", 25, "jane@example.com", "oldpass"); // Merge all except password Beans.copyInto(source, target, true, // Ignore if source has properties not in target N.asSet("password")); // target: name="John", age=30, email="john@example.com", password="oldpass" } </pre>
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
ignoreUnmatchedProperty(boolean) — if {@code true} , properties not found in target are ignored; if {@code false} , throws exception -
ignoredPropNames(Set<String>) — set of property names to exclude from merging
-
- Returns: the same target bean instance with properties merged except ignored ones
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null} or if unmatched properties found when not ignoring
-
-
Signature:
public static <T> T copyInto(final Object sourceBean, @NotNull final T targetBean, final boolean ignoreUnmatchedProperty, final Set<String> ignoredPropNames, final BinaryOperator<?> mergeFunc) throws IllegalArgumentException - Summary: Merges properties from the source bean into the target bean with a custom merge function, excluding specified properties.
-
Contract:
- <p> This method combines exclusion-based merging with custom merge logic, useful when you want to merge most properties with special handling for certain values.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Product source = new Product("New Product", 200, 15, "2024-01-01"); Product target = new Product("Old Product", 150, 10, "2023-01-01"); // Merge all except createdDate, using custom logic for quantities Beans.copyInto(source, target, true, N.asSet("createdDate"), (srcVal, tgtVal) -> { // For quantities, add them together if (srcVal instanceof Integer && "quantity".equals(currentPropName)) { return ((Integer) srcVal) + ((Integer) tgtVal); } return srcVal; }); // target: name="New Product", price=200, quantity=25, createdDate="2023-01-01" } </pre>
-
Parameters:
-
sourceBean(Object) — the source bean from which properties are copied -
targetBean(@NotNull T) — the target bean into which properties are merged -
ignoreUnmatchedProperty(boolean) — if {@code true} , properties not found in target are ignored; if {@code false} , throws exception -
ignoredPropNames(Set<String>) — set of property names to exclude from merging -
mergeFunc(BinaryOperator<?>) — binary operator to determine the merged value for each property
-
- Returns: the same target bean instance with properties merged using custom logic
-
Throws:
-
java.lang.IllegalArgumentException— if {@code targetBean} is {@code null} or if unmatched properties found when not ignoring
-
clearProps(...) -> void
-
Signature:
public static void clearProps(final Object bean, final String... propNames) - Summary: Erases (sets to default values) the specified properties of the given bean.
-
Parameters:
-
bean(Object) — the bean object whose properties are to be erased -
propNames(String[]) — the names of the properties to be erased
-
-
Signature:
public static void clearProps(final Object bean, final Collection<String> propNames) - Summary: Erases (sets to default values) the specified properties of the given bean.
-
Parameters:
-
bean(Object) — the bean object whose properties are to be erased -
propNames(Collection<String>) — the collection of property names to be erased
-
clearAllProps(...) -> void
-
Signature:
public static void clearAllProps(final Object bean) - Summary: Erases all properties of the given bean, setting them to their default values.
-
Parameters:
-
bean(Object) — the bean object whose properties are to be erased. If this is {@code null} , the method does nothing.
-
randomize(...) -> void
-
Signature:
public static void randomize(final Object bean) throws IllegalArgumentException - Summary: Fills all properties of the specified bean with random values.
-
Parameters:
-
bean(Object) — a bean object with getter/setter methods
-
-
Throws:
-
java.lang.IllegalArgumentException— if bean is {@code null} or not a valid bean class
-
-
Signature:
public static void randomize(final Object bean, final Collection<String> propNamesToFill) - Summary: Fills the specified properties of the bean with random values.
-
Contract:
- This is useful when you want to test specific scenarios with only certain fields populated.
-
Parameters:
-
bean(Object) — a bean object with getter/setter methods -
propNamesToFill(Collection<String>) — collection of property names to fill
-
newRandom(...) -> T
-
Signature:
public static <T> T newRandom(final Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Creates a new instance of the specified bean class and fills all its properties with random values.
-
Parameters:
-
beanClass(Class<? extends T>) — bean class with getter/setter methods
-
- Returns: a new instance with all properties filled with random values
-
Throws:
-
java.lang.IllegalArgumentException— if beanClass is {@code null} or not a valid bean class
-
-
Signature:
public static <T> T newRandom(final Class<? extends T> beanClass, final Collection<String> propNamesToFill) throws IllegalArgumentException - Summary: Creates a new instance of the specified bean class and fills only the specified properties.
-
Parameters:
-
beanClass(Class<? extends T>) — bean class with getter/setter methods -
propNamesToFill(Collection<String>) — collection of property names to fill
-
- Returns: a new instance with specified properties filled with random values
-
Throws:
-
java.lang.IllegalArgumentException— if beanClass is {@code null} or not a valid bean class
-
newRandomList(...) -> List<T>
-
Signature:
public static <T> List<T> newRandomList(final Class<? extends T> beanClass, final int count) throws IllegalArgumentException - Summary: Creates multiple instances of the specified bean class, each filled with random values.
-
Contract:
- <p> This method is useful for generating test data sets or when you need multiple test objects with varying random data.
-
Parameters:
-
beanClass(Class<? extends T>) — bean class with getter/setter methods -
count(int) — number of instances to create
-
- Returns: a list containing the specified number of filled bean instances
-
Throws:
-
java.lang.IllegalArgumentException— if beanClass is {@code null} , not a valid bean class, or count is negative
-
-
Signature:
public static <T> List<T> newRandomList(final Class<? extends T> beanClass, final Collection<String> propNamesToFill, final int count) throws IllegalArgumentException - Summary: Creates multiple instances of the specified bean class with only the specified properties filled.
-
Parameters:
-
beanClass(Class<? extends T>) — bean class with getter/setter methods -
propNamesToFill(Collection<String>) — collection of property names to fill -
count(int) — number of instances to create
-
- Returns: a list containing the specified number of partially filled bean instances
-
Throws:
-
java.lang.IllegalArgumentException— if beanClass is {@code null} , not a valid bean class, or count is negative
-
equalsByCommonProps(...) -> boolean
-
Signature:
public static boolean equalsByCommonProps(@NotNull final Object bean1, @NotNull final Object bean2) throws IllegalArgumentException - Summary: Compares the properties of two beans to determine if they are equal by common properties.
-
Contract:
- Compares the properties of two beans to determine if they are equal by common properties.
- This is useful when comparing objects of different types that share some common properties.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code UserDTO dto = new UserDTO("John", "john@example.com"); UserEntity entity = new UserEntity("John", "john@example.com", new Date()); boolean equal = Beans.equalsByCommonProps(dto, entity); // Returns true if common properties (name, email) are equal } </pre>
-
Parameters:
-
bean1(@NotNull Object) — the first bean to compare; must not be null -
bean2(@NotNull Object) — the second bean to compare; must not be null
-
- Returns: {@code true} if all the common properties of the beans are equal, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if no common property is found
-
equalsByProps(...) -> boolean
-
Signature:
public static boolean equalsByProps(final Object bean1, final Object bean2, final Collection<String> propNamesToCompare) throws IllegalArgumentException - Summary: Compares the properties of two beans to determine if they are equal.
-
Contract:
- Compares the properties of two beans to determine if they are equal.
- If all specified properties are equal, the method returns {@code true} .
-
Parameters:
-
bean1(Object) — the first bean to compare; must not be null -
bean2(Object) — the second bean to compare; must not be null -
propNamesToCompare(Collection<String>) — the collection of property names to compare; must not be {@code null} or empty
-
- Returns: {@code true} if all the specified properties of the beans are equal, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code propNamesToCompare} is empty
-
compareByProps(...) -> int
-
Signature:
@Deprecated @SuppressWarnings("rawtypes") public static int compareByProps(@NotNull final Object bean1, @NotNull final Object bean2, final Collection<String> propNamesToCompare) - Summary: Compares two beans based on the specified properties.
-
Parameters:
-
bean1(@NotNull Object) — the first bean to compare; must not be null -
bean2(@NotNull Object) — the second bean to compare; must not be null -
propNamesToCompare(Collection<String>) — the collection of property names to compare, which may be null
-
- Returns: a negative integer, zero, or a positive integer as the first bean is less than, equal to, or greater than the second bean
- See also: Builder#compare(Object, Object, Comparator), ComparisonBuilder
stream(...) -> Stream<Map.Entry<String, Object>>
-
Signature:
public static Stream<Map.Entry<String, Object>> stream(final Object bean) - Summary: Creates a stream of property name-value pairs from the specified bean.
-
Parameters:
-
bean(Object) — the bean object to extract properties from
-
- Returns: a stream of Map.Entry objects containing property names and values
-
Signature:
public static Stream<Map.Entry<String, Object>> stream(final Object bean, final BiPredicate<String, Object> propFilter) - Summary: Creates a filtered stream of property name-value pairs from the specified bean.
-
Parameters:
-
bean(Object) — the bean object to extract properties from -
propFilter(BiPredicate<String, Object>) — a predicate that tests property name and value; returns {@code true} to include the property
-
- Returns: a stream of Map.Entry objects containing filtered property names and values
Public Instance Methods
- (none)
Class BiIterator (com.landawn.abacus.util.BiIterator)
The BiIterator class is an abstract class that extends ImmutableIterator.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> BiIterator<A, B>
-
Signature:
public static <A, B> BiIterator<A, B> empty() - Summary: Returns an empty {@code BiIterator} instance.
-
Parameters:
- (none)
- Returns: an empty BiIterator instance that contains no elements
of(...) -> BiIterator<K, V>
-
Signature:
public static <K, V> BiIterator<K, V> of(final Map<K, V> map) - Summary: Creates a {@code BiIterator} from the given map's entries.
-
Contract:
- If the map is {@code null} or empty, returns an empty {@code BiIterator} .
-
Parameters:
-
map(Map<K, V>) — the map to create the BiIterator from, may be {@code null}
-
- Returns: a BiIterator over the entries of the map, or an empty BiIterator if the map is {@code null} or empty
-
Signature:
public static <K, V> BiIterator<K, V> of(final Iterator<Map.Entry<K, V>> iter) - Summary: Creates a {@code BiIterator} from an iterator of map entries.
-
Contract:
- If the iterator is {@code null} , returns an empty {@code BiIterator} .
- <p> This method is useful when you already have an iterator over map entries and want to process keys and values separately without creating intermediate {@code Pair} objects.
-
Parameters:
-
iter(Iterator<Map.Entry<K, V>>) — the iterator of map entries to create the BiIterator from, may be {@code null}
-
- Returns: a BiIterator over the entries of the iterator, or an empty BiIterator if the iterator is {@code null}
generate(...) -> BiIterator<A, B>
-
Signature:
public static <A, B> BiIterator<A, B> generate(final Consumer<Pair<A, B>> output) - Summary: Generates an infinite {@code BiIterator} with elements produced by the given output consumer.
-
Contract:
- </p> <p> The output consumer receives a mutable {@code Pair} object that should be populated with the next pair of values using {@code pair.set(a, b)} or {@code pair.setLeft(a)} and {@code pair.setRight(b)} .
-
Parameters:
-
output(Consumer<Pair<A, B>>) — a Consumer that populates a Pair with the next values on each iteration, must not be {@code null}
-
- Returns: an infinite BiIterator that uses the output Consumer to generate its elements
- See also: #generate(BooleanSupplier, Consumer)
-
Signature:
public static <A, B> BiIterator<A, B> generate(final BooleanSupplier hasNext, final Consumer<Pair<A, B>> output) throws IllegalArgumentException - Summary: Generates a {@code BiIterator} with elements produced by the output consumer while the hasNext supplier returns {@code true} .
-
Contract:
- The hasNext supplier controls when the iteration should stop, and the output consumer populates each pair of values.
- The hasNext supplier is called before each element is produced to determine if iteration should continue.
- </p> <p> The output consumer receives a mutable {@code Pair} object that should be populated with the next pair of values using {@code pair.set(a, b)} or {@code pair.setLeft(a)} and {@code pair.setRight(b)} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iterator should have more elements, must not be {@code null} -
output(Consumer<Pair<A, B>>) — a Consumer that populates a Pair with the next values on each iteration, must not be {@code null}
-
- Returns: a BiIterator that uses the hasNext supplier and output consumer to generate its elements
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or output is {@code null}
-
-
Signature:
public static <A, B> BiIterator<A, B> generate(final int fromIndex, final int toIndex, final IntObjConsumer<Pair<A, B>> output) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Generates a {@code BiIterator} over an index range, with elements produced by the output consumer for each index.
-
Contract:
- </p> <p> The output consumer receives the current index and a mutable {@code Pair} object that should be populated with the values corresponding to that index.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive), must be non-negative and not greater than {@code toIndex} -
toIndex(int) — the ending index (exclusive), must be non-negative -
output(IntObjConsumer<Pair<A, B>>) — an IntObjConsumer that accepts an index and a Pair to populate with values, must not be {@code null}
-
- Returns: a BiIterator that generates elements for each index in the range \[fromIndex, toIndex)
-
Throws:
-
java.lang.IllegalArgumentException— if fromIndex is greater than toIndex, or if output is {@code null} -
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is negative or exceeds {@code Integer.MAX_VALUE}
-
zip(...) -> BiIterator<A, B>
-
Signature:
public static <A, B> BiIterator<A, B> zip(final A[] a, final B[] b) - Summary: Zips two arrays into a {@code BiIterator} by pairing elements at corresponding indices.
-
Contract:
- If the arrays have different lengths, iteration stops when the shorter array is exhausted.
- If either array is {@code null} , returns an empty {@code BiIterator} .
-
Parameters:
-
a(A[]) — the first array, may be {@code null} -
b(B[]) — the second array, may be {@code null}
-
- Returns: a BiIterator that produces pairs of elements at matching indices from both arrays
-
Signature:
public static <A, B> BiIterator<A, B> zip(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB) - Summary: Zips two arrays into a {@code BiIterator} with default values for missing elements.
-
Contract:
- The resulting iterator continues until both arrays are exhausted, using default values when one array is shorter than the other.
-
Parameters:
-
a(A[]) — the first array, may be {@code null} -
b(B[]) — the second array, may be {@code null} -
valueForNoneA(A) — the default value used when the first array is shorter -
valueForNoneB(B) — the default value used when the second array is shorter
-
- Returns: a BiIterator that produces pairs until both arrays are exhausted
-
Signature:
public static <A, B> BiIterator<A, B> zip(final Iterable<A> a, final Iterable<B> b) - Summary: Zips two iterables into a {@code BiIterator} by pairing elements at corresponding positions.
-
Contract:
- Iteration stops when the shorter iterable is exhausted.
-
Parameters:
-
a(Iterable<A>) — the first iterable, may be {@code null} -
b(Iterable<B>) — the second iterable, may be {@code null}
-
- Returns: a BiIterator over pairs of elements, or empty if either iterable is {@code null}
-
Signature:
public static <A, B> BiIterator<A, B> zip(final Iterable<A> a, final Iterable<B> b, final A valueForNoneA, final B valueForNoneB) - Summary: Zips two iterables into a {@code BiIterator} with default values for missing elements.
-
Parameters:
-
a(Iterable<A>) — the first iterable, may be {@code null} -
b(Iterable<B>) — the second iterable, may be {@code null} -
valueForNoneA(A) — the default value when the first iterable is shorter -
valueForNoneB(B) — the default value when the second iterable is shorter
-
- Returns: a BiIterator that produces pairs until both iterables are exhausted
-
Signature:
public static <A, B> BiIterator<A, B> zip(final Iterator<A> iterA, final Iterator<B> iterB) - Summary: Zips two iterators into a {@code BiIterator} by pairing elements at corresponding positions.
-
Contract:
- Iteration stops when the shorter iterator is exhausted.
-
Parameters:
-
iterA(Iterator<A>) — the first iterator, may be {@code null} -
iterB(Iterator<B>) — the second iterator, may be {@code null}
-
- Returns: a BiIterator over pairs of elements, or empty if either iterator is {@code null}
-
Signature:
public static <A, B> BiIterator<A, B> zip(final Iterator<A> iterA, final Iterator<B> iterB, final A valueForNoneA, final B valueForNoneB) - Summary: Zips two iterators into a {@code BiIterator} with default values for missing elements.
-
Contract:
- Iteration continues until both iterators are exhausted, using the specified default values when one iterator is shorter than the other.
-
Parameters:
-
iterA(Iterator<A>) — the first iterator, may be {@code null} -
iterB(Iterator<B>) — the second iterator, may be {@code null} -
valueForNoneA(A) — the default value used when the first iterator is exhausted -
valueForNoneB(B) — the default value used when the second iterator is exhausted
-
- Returns: a BiIterator that produces pairs until both iterators are exhausted
unzip(...) -> BiIterator<A, B>
-
Signature:
public static <T, A, B> BiIterator<A, B> unzip(final Iterable<? extends T> iter, final BiConsumer<? super T, Pair<A, B>> unzipFunction) - Summary: Unzips an iterable into a {@code BiIterator} by splitting each element into a pair using the unzip function.
-
Parameters:
-
iter(Iterable<? extends T>) — the iterable to unzip, may be {@code null} -
unzipFunction(BiConsumer<? super T, Pair<A, B>>) — a BiConsumer that splits each element into a pair by populating the provided Pair object
-
- Returns: a BiIterator of pairs produced by the unzip function, or empty if iter is {@code null}
-
Signature:
public static <T, A, B> BiIterator<A, B> unzip(final Iterator<? extends T> iter, final BiConsumer<? super T, Pair<A, B>> unzipFunction) - Summary: Unzips an iterator into a {@code BiIterator} by splitting each element into a pair using the unzip function.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to unzip, may be {@code null} -
unzipFunction(BiConsumer<? super T, Pair<A, B>>) — a BiConsumer that splits each element into a pair by populating the provided Pair object
-
- Returns: a BiIterator of pairs produced by the unzip function, or empty if iter is {@code null}
Public Instance Methods
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final Consumer<? super Pair<A, B>> action) - Summary: Performs the given action for each remaining element in the iterator until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(Consumer<? super Pair<A, B>>) — the action to be performed for each element
-
- See also: #forEachRemaining(BiConsumer)
-
Signature:
public abstract void forEachRemaining(final BiConsumer<? super A, ? super B> action) - Summary: Performs the given action for each remaining pair of elements in this iterator.
-
Parameters:
-
action(BiConsumer<? super A, ? super B>) — the action to be performed for each pair of elements, must not be {@code null}
-
foreachRemaining(...) -> void
-
Signature:
public abstract <E extends Exception> void foreachRemaining(final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Performs the given action for each remaining pair of elements in this iterator.
-
Parameters:
-
action(Throwables.BiConsumer<? super A, ? super B, E>) — a BiConsumer that processes each pair of elements, must not be {@code null}
-
-
Throws:
-
E— if the action throws an exception
-
skip(...) -> BiIterator<A, B>
-
Signature:
public BiIterator<A, B> skip(final long n) throws IllegalArgumentException - Summary: Returns a new {@code BiIterator} that skips the first {@code n} pairs of elements.
-
Parameters:
-
n(long) — the number of pairs to skip from the beginning, must be non-negative
-
- Returns: a new BiIterator that begins after skipping {@code n} pairs, or this iterator if {@code n} is 0
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative
-
limit(...) -> BiIterator<A, B>
-
Signature:
public BiIterator<A, B> limit(final long count) throws IllegalArgumentException - Summary: Returns a new {@code BiIterator} that is limited to at most {@code count} pairs of elements.
-
Contract:
- The resulting iterator will produce at most the specified number of pairs, even if more are available.
-
Parameters:
-
count(long) — the maximum number of pairs to include, must be non-negative
-
- Returns: a new BiIterator limited to {@code count} pairs, or an empty iterator if {@code count} is 0
-
Throws:
-
java.lang.IllegalArgumentException— if {@code count} is negative
-
filter(...) -> BiIterator<A, B>
-
Signature:
public BiIterator<A, B> filter(final BiPredicate<? super A, ? super B> predicate) - Summary: Returns a new {@code BiIterator} that includes only pairs satisfying the given predicate.
-
Parameters:
-
predicate(BiPredicate<? super A, ? super B>) — the predicate to test each pair, must not be {@code null}
-
- Returns: a new BiIterator containing only pairs that satisfy the predicate
map(...) -> ObjIterator<R>
-
Signature:
public abstract <R> ObjIterator<R> map(final BiFunction<? super A, ? super B, ? extends R> mapper) - Summary: Transforms each pair of elements in this {@code BiIterator} using the given mapper function, producing an {@code ObjIterator} of the mapped results.
-
Parameters:
-
mapper(BiFunction<? super A, ? super B, ? extends R>) — the function to apply to each pair of elements, must not be {@code null}
-
- Returns: an ObjIterator containing the results of applying the mapper to each pair
first(...) -> Optional<Pair<A, B>>
-
Signature:
public Optional<Pair<A, B>> first() - Summary: Returns an {@code Optional} containing the first pair of elements, or empty if this iterator has no elements.
-
Contract:
- Returns an {@code Optional} containing the first pair of elements, or empty if this iterator has no elements.
- <p> <b> Usage Examples: </b> </p> <pre> {@code BiIterator<String, Integer> iter = BiIterator.of(Map.of("a", 1, "b", 2)); Optional<Pair<String, Integer>> first = iter.first(); if (first.isPresent()) { System.out.println("First pair: " + first.get().left() + "=" + first.get().right()); } } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the first pair if available, otherwise empty
last(...) -> Optional<Pair<A, B>>
-
Signature:
public Optional<Pair<A, B>> last() - Summary: Returns an {@code Optional} containing the last pair of elements, or empty if this iterator has no elements.
-
Contract:
- Returns an {@code Optional} containing the last pair of elements, or empty if this iterator has no elements.
- <p> <strong> Note: </strong> This operation is expensive for large iterators as it must iterate through all elements.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code BiIterator<String, Integer> iter = BiIterator.of(Map.of("a", 1, "b", 2, "c", 3)); Optional<Pair<String, Integer>> last = iter.last(); if (last.isPresent()) { System.out.println("Last pair: " + last.get().left() + "=" + last.get().right()); } } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the last pair if the iterator is non-empty, otherwise empty
stream(...) -> EntryStream<A, B>
-
Signature:
public EntryStream<A, B> stream() - Summary: Converts this {@code BiIterator} into an {@code EntryStream} for further stream processing.
-
Parameters:
- (none)
- Returns: an EntryStream containing the remaining pairs in this BiIterator
-
Signature:
public <R> Stream<R> stream(final BiFunction<? super A, ? super B, ? extends R> mapper) - Summary: Converts this {@code BiIterator} into a {@code Stream} by applying the mapper function to each pair.
-
Parameters:
-
mapper(BiFunction<? super A, ? super B, ? extends R>) — the function to apply to each pair, must not be {@code null}
-
- Returns: a Stream containing the elements produced by the mapper function
toArray(...) -> Pair<A, B>\[\]
-
Signature:
@SuppressWarnings("deprecation") public Pair<A, B>[] toArray() - Summary: Converts all remaining pairs in this {@code BiIterator} to an array of {@code Pair} objects.
-
Parameters:
- (none)
- Returns: an array containing all remaining pairs from this BiIterator
-
Signature:
@Deprecated public <T> T[] toArray(final T[] a) - Summary: Converts the elements in this BiIterator to an array of the specified type.
-
Parameters:
-
a(T[]) — the array into which the elements of this BiIterator are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
-
- Returns: an array containing the elements of this BiIterator
toList(...) -> List<Pair<A, B>>
-
Signature:
public List<Pair<A, B>> toList() - Summary: Converts all remaining pairs in this {@code BiIterator} to a {@code List} of {@code Pair} objects.
-
Parameters:
- (none)
- Returns: a List containing all remaining pairs from this BiIterator
toMultiList(...) -> Pair<List<A>, List<B>>
-
Signature:
public Pair<List<A>, List<B>> toMultiList(@SuppressWarnings("rawtypes") final Supplier<? extends List> supplier) - Summary: Converts all remaining pairs in this {@code BiIterator} to a {@code Pair} of {@code List} s.
-
Parameters:
-
supplier(@SuppressWarnings(value = "rawtypes") Supplier<? extends List>) — a Supplier that provides new List instances, must not be {@code null}
-
- Returns: a Pair containing two Lists: the first with all first elements, the second with all second elements
toMultiSet(...) -> Pair<Set<A>, Set<B>>
-
Signature:
public Pair<Set<A>, Set<B>> toMultiSet(@SuppressWarnings("rawtypes") final Supplier<? extends Set> supplier) - Summary: Converts all remaining pairs in this {@code BiIterator} to a {@code Pair} of {@code Set} s.
-
Parameters:
-
supplier(@SuppressWarnings(value = "rawtypes") Supplier<? extends Set>) — a Supplier that provides new Set instances, must not be {@code null}
-
- Returns: a Pair containing two Sets: the first with all unique first elements, the second with all unique second elements
Class BiMap (com.landawn.abacus.util.BiMap)
A bidirectional map that preserves the uniqueness of both keys and values, enabling efficient forward and reverse lookups.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BiMap<K, V>
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1) - Summary: Creates a new BiMap with a single key-value pair.
-
Parameters:
-
k1(K) — the key to be inserted into the BiMap. -
v1(V) — the value to be associated with the key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pair.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Creates a new BiMap with two key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Creates a new BiMap with three key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Creates a new BiMap with four key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Creates a new BiMap with five key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Creates a new BiMap with six key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap. -
k6(K) — the sixth key to be inserted into the BiMap. -
v6(V) — the value to be associated with the sixth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Creates a new BiMap with seven key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap. -
k6(K) — the sixth key to be inserted into the BiMap. -
v6(V) — the value to be associated with the sixth key in the BiMap. -
k7(K) — the seventh key to be inserted into the BiMap. -
v7(V) — the value to be associated with the seventh key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8) - Summary: Creates a new BiMap with eight key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap. -
k6(K) — the sixth key to be inserted into the BiMap. -
v6(V) — the value to be associated with the sixth key in the BiMap. -
k7(K) — the seventh key to be inserted into the BiMap. -
v7(V) — the value to be associated with the seventh key in the BiMap. -
k8(K) — the eighth key to be inserted into the BiMap. -
v8(V) — the value to be associated with the eighth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9) - Summary: Creates a new BiMap with nine key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap. -
k6(K) — the sixth key to be inserted into the BiMap. -
v6(V) — the value to be associated with the sixth key in the BiMap. -
k7(K) — the seventh key to be inserted into the BiMap. -
v7(V) — the value to be associated with the seventh key in the BiMap. -
k8(K) — the eighth key to be inserted into the BiMap. -
v8(V) — the value to be associated with the eighth key in the BiMap. -
k9(K) — the ninth key to be inserted into the BiMap. -
v9(V) — the value to be associated with the ninth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
-
Signature:
public static <K, V> BiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9, final K k10, final V v10) - Summary: Creates a new BiMap with ten key-value pairs.
-
Parameters:
-
k1(K) — the first key to be inserted into the BiMap. -
v1(V) — the value to be associated with the first key in the BiMap. -
k2(K) — the second key to be inserted into the BiMap. -
v2(V) — the value to be associated with the second key in the BiMap. -
k3(K) — the third key to be inserted into the BiMap. -
v3(V) — the value to be associated with the third key in the BiMap. -
k4(K) — the fourth key to be inserted into the BiMap. -
v4(V) — the value to be associated with the fourth key in the BiMap. -
k5(K) — the fifth key to be inserted into the BiMap. -
v5(V) — the value to be associated with the fifth key in the BiMap. -
k6(K) — the sixth key to be inserted into the BiMap. -
v6(V) — the value to be associated with the sixth key in the BiMap. -
k7(K) — the seventh key to be inserted into the BiMap. -
v7(V) — the value to be associated with the seventh key in the BiMap. -
k8(K) — the eighth key to be inserted into the BiMap. -
v8(V) — the value to be associated with the eighth key in the BiMap. -
k9(K) — the ninth key to be inserted into the BiMap. -
v9(V) — the value to be associated with the ninth key in the BiMap. -
k10(K) — the tenth key to be inserted into the BiMap. -
v10(V) — the value to be associated with the tenth key in the BiMap.
-
- Returns: a BiMap containing the specified key-value pairs.
copyOf(...) -> BiMap<K, V>
-
Signature:
public static <K, V> BiMap<K, V> copyOf(final Map<? extends K, ? extends V> map) - Summary: Creates a new BiMap that is a copy of the specified map.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose entries are to be placed into the new BiMap.
-
- Returns: a new BiMap containing the same entries as the provided map.
builder(...) -> Builder<K, V>
-
Signature:
public static <K, V> Builder<K, V> builder() - Summary: Creates a new Builder for constructing a BiMap.
-
Parameters:
- (none)
- Returns: a new Builder instance for a BiMap.
-
Signature:
public static <K, V> Builder<K, V> builder(final Map<K, V> map) throws IllegalArgumentException - Summary: Creates a new Builder for a BiMap initialized with the specified map's entries.
-
Parameters:
-
map(Map<K, V>) — the map whose entries are to be placed into the new BiMap.
-
- Returns: a new Builder instance for a BiMap with the specified map as its initial data.
-
Throws:
-
java.lang.IllegalArgumentException
-
Public Instance Methods
<init>(...) -> void
-
Signature:
public BiMap() - Summary: Constructs a BiMap with the default initial capacity.
-
Parameters:
- (none)
-
Signature:
public BiMap(final int initialCapacity) - Summary: Constructs a BiMap with the specified initial capacity.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the BiMap
-
-
Signature:
@SuppressWarnings("deprecation") public BiMap(final int initialCapacity, final float loadFactor) - Summary: Constructs a BiMap with the specified initial capacity and load factor.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the BiMap -
loadFactor(float) — the load factor of the BiMap
-
-
Signature:
@SuppressWarnings("rawtypes") public BiMap(final Class<? extends Map> keyMapType, final Class<? extends Map> valueMapType) - Summary: Constructs a BiMap with the specified types of maps for keys and values.
-
Parameters:
-
keyMapType(Class<? extends Map>) — the Class object representing the type of Map to be used for storing keys; must not be {@code null} -
valueMapType(Class<? extends Map>) — the Class object representing the type of Map to be used for storing values; must not be {@code null}
-
-
Signature:
public BiMap(final Supplier<? extends Map<K, V>> keyMapSupplier, final Supplier<? extends Map<V, K>> valueMapSupplier) - Summary: Constructs a BiMap with the specified suppliers for key and value maps.
-
Parameters:
-
keyMapSupplier(Supplier<? extends Map<K, V>>) — the Supplier object providing the Map to be used for storing keys; must not be {@code null} -
valueMapSupplier(Supplier<? extends Map<V, K>>) — the Supplier object providing the Map to be used for storing values; must not be {@code null}
-
get(...) -> V
-
Signature:
@Override public V get(final Object key) - Summary: Retrieves the value to which the specified key is mapped in this BiMap.
-
Contract:
- Returns {@code null} if this BiMap contains no mapping for the key.
-
Parameters:
-
key(Object) — the key whose associated value is to be returned.
-
- Returns: The value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key.
getByValue(...) -> K
-
Signature:
public K getByValue(final Object value) - Summary: Retrieves the key to which the specified value is mapped in this BiMap.
-
Contract:
- Returns {@code null} if this BiMap contains no mapping for the value.
-
Parameters:
-
value(Object) — the value whose associated key is to be returned.
-
- Returns: The key to which the specified value is mapped, or {@code null} if this map contains no mapping for the value.
getByValueOrDefault(...) -> K
-
Signature:
public K getByValueOrDefault(final Object value, final K defaultValue) - Summary: Retrieves the key associated with the specified value, or returns the default key if this BiMap contains no mapping for the value.
-
Contract:
- Retrieves the key associated with the specified value, or returns the default key if this BiMap contains no mapping for the value.
-
Parameters:
-
value(Object) — the value whose associated key is to be returned. -
defaultValue(K) — the default key to be returned if the map contains no mapping for the value.
-
- Returns: The key to which the specified value is mapped, or the default key if this map contains no mapping for the value.
put(...) -> V
-
Signature:
@Override public V put(final K key, final V value) - Summary: Associates the specified value with the specified key in this BiMap.
-
Contract:
- If the BiMap previously contained a mapping for the key, the old value is replaced.
- <p> <b> Bijective Constraint: </b> Both keys and values must be unique in a BiMap.
- If the specified value is already bound to a different key, this method throws {@code IllegalArgumentException} .
- <p> <b> Behavior Differences: </b> <ul> <li> <b> {@code put()} : </b> Throws exception if value already exists (mapped to a different key) </li> <li> <b> {@code forcePut()} : </b> Silently removes any existing entry with the same value </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code BiMap<String, Integer> map = new BiMap<>(); map.put("one", 1); // adds mapping: "one" -> 1 map.put("one", 2); // replaces value for "one": "one" -> 2 // This throws IllegalArgumentException because 2 is already mapped to "one" // map.put("two", 2); // ERROR!
-
Parameters:
-
key(K) — the key with which the specified value is to be associated. -
value(V) — the value to be associated with the specified key.
-
- Returns: The previous value associated with the key, or {@code null} if there was no mapping for the key.
- See also: #forcePut(Object, Object)
forcePut(...) -> V
-
Signature:
public V forcePut(final K key, final V value) - Summary: An alternate form of {@code put} that silently removes any existing entry with the value {@code value} before proceeding with the {@link #put} operation.
-
Contract:
- If the BiMap previously contained the provided key-value mapping, this method has no effect.
- <p> This method ensures that the value is unique by removing any existing entry with the same value, even if it's mapped to a different key.
- <p> <b> Behavior Differences: </b> <ul> <li> <b> {@code put()} : </b> Throws exception if value already exists (mapped to a different key) </li> <li> <b> {@code forcePut()} : </b> Silently removes any existing entry with the same value </li> </ul> <p> <b> Size Impact: </b> A successful call to this method could cause the size of the BiMap to increase by one, stay the same, or even decrease by one, depending on whether the operation removes existing entries: <ul> <li> <b> Increase by one: </b> New key, new value </li> <li> <b> Stay the same: </b> Existing key, new value OR new key, existing value (removes one, adds one) </li> <li> <b> Decrease by one: </b> Existing key, existing value mapped to different key (removes two, adds one) </li> </ul> <p> <b> Warning: </b> If an existing entry with this value is removed, the key for that entry is discarded and not returned.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated. -
value(V) — the value to be associated with the specified key.
-
- Returns: the previous value associated with the key, or {@code null} if there was no mapping for the key.
- See also: #put(Object, Object)
putAll(...) -> void
-
Signature:
@Override public void putAll(final Map<? extends K, ? extends V> m) - Summary: Inserts all entries from the specified map into this BiMap.
-
Contract:
- If a key in the provided map is already present in this BiMap, the associated value is replaced.
- If the operation fails, some entries may have already been added to the BiMap before the exception was thrown.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the map whose entries are to be added to this BiMap.
-
- See also: #put(Object, Object)
remove(...) -> V
-
Signature:
@Override public V remove(final Object key) - Summary: Removes the mapping for a key from this BiMap if it is present.
-
Contract:
- Removes the mapping for a key from this BiMap if it is present.
-
Parameters:
-
key(Object) — the key whose mapping is to be removed from the BiMap.
-
- Returns: The previous value associated with the key, or {@code null} if there was no mapping for the key.
removeByValue(...) -> K
-
Signature:
public K removeByValue(final Object value) - Summary: Removes the mapping for a value from this BiMap if it is present.
-
Contract:
- Removes the mapping for a value from this BiMap if it is present.
-
Parameters:
-
value(Object) — the value whose mapping is to be removed from the BiMap.
-
- Returns: The key associated with the value, or {@code null} if there was no mapping for the value.
containsKey(...) -> boolean
-
Signature:
@Override public boolean containsKey(final Object key) - Summary: Checks if this BiMap contains a mapping for the specified key.
-
Contract:
- Checks if this BiMap contains a mapping for the specified key.
-
Parameters:
-
key(Object) — the key whose presence in this BiMap is to be tested.
-
- Returns: {@code true} if this BiMap contains a mapping for the specified key, {@code false} otherwise.
containsValue(...) -> boolean
-
Signature:
@Override public boolean containsValue(final Object value) - Summary: Checks if this BiMap contains a mapping for the specified value.
-
Contract:
- Checks if this BiMap contains a mapping for the specified value.
-
Parameters:
-
value(Object) — the value whose presence in this BiMap is to be tested.
-
- Returns: {@code true} if this BiMap contains a mapping for the specified value, {@code false} otherwise.
keySet(...) -> ImmutableSet<K>
-
Signature:
@Override public ImmutableSet<K> keySet() - Summary: Returns an immutable set of keys contained in this BiMap.
-
Parameters:
- (none)
- Returns: An immutable set of the keys contained in this BiMap.
values(...) -> ImmutableSet<V>
-
Signature:
@Override public ImmutableSet<V> values() - Summary: Returns an immutable set of values contained in this BiMap.
-
Parameters:
- (none)
- Returns: An immutable set of the values contained in this BiMap.
entrySet(...) -> ImmutableSet<Map.Entry<K, V>>
-
Signature:
@Override public ImmutableSet<Map.Entry<K, V>> entrySet() - Summary: Returns an immutable set of the entries contained in this BiMap.
-
Parameters:
- (none)
- Returns: An immutable set of the entries (key-value pairs) contained in this BiMap.
inverted(...) -> BiMap<V, K>
-
Signature:
public BiMap<V, K> inverted() - Summary: Returns the inverted view of this BiMap, which maps each of this BiMap's values to its associated key.
-
Parameters:
- (none)
- Returns: The inverted view of this BiMap where keys and values are swapped.
copy(...) -> BiMap<K, V>
-
Signature:
public BiMap<K, V> copy() - Summary: Creates a new BiMap that is a shallow copy of the current BiMap.
-
Parameters:
- (none)
- Returns: a new BiMap containing the same entries as the current BiMap.
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all the mappings from this BiMap.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Checks if this BiMap is empty.
-
Contract:
- Checks if this BiMap is empty.
-
Parameters:
- (none)
- Returns: {@code true} if this BiMap contains no key-value mappings, {@code false} otherwise.
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of key-value mappings in this BiMap.
-
Parameters:
- (none)
- Returns: the number of key-value mappings in this BiMap.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this BiMap.
-
Parameters:
- (none)
- Returns: the hash code value for this BiMap.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares the specified object with this BiMap for equality.
-
Contract:
- Returns {@code true} if the given object is also a BiMap and the two BiMaps represent the same mappings.
- Two BiMaps are considered equal if they have the same key-value mappings.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this BiMap.
-
- Returns: {@code true} if the specified object is equal to this BiMap, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this BiMap.
-
Parameters:
- (none)
- Returns: a string representation of this BiMap.
Class Builder (com.landawn.abacus.util.BiMap.Builder)
This is a static inner class that provides a builder for the BiMap.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> put(final K key, final V value) - Summary: Adds a key-value pair to the BiMap being built.
-
Contract:
- If the BiMap previously contained a mapping for the key, the old value is replaced.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated. -
value(V) — the value to be associated with the specified key.
-
- Returns: This Builder instance to allow for chaining of calls to builder methods.
- See also: #forcePut(Object, Object)
forcePut(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> forcePut(final K key, final V value) - Summary: Associates the specified value with the specified key in this BiMap, forcefully removing any existing mapping with the same value.
-
Contract:
- If the BiMap previously contained a mapping for the key or value, the old value or key is replaced.
- If the BiMap previously contained the provided key-value mapping, this method has no effect.
- <p> Warning: If an existing entry with this value is removed, the key for that entry is discarded and not returned.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated. -
value(V) — the value to be associated with the specified key.
-
- Returns: This Builder instance to allow for chaining of calls to builder methods.
- See also: #put(Object, Object)
putAll(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> putAll(final Map<? extends K, ? extends V> m) - Summary: Inserts all entries from the specified map into the BiMap being built.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the map whose entries are to be added to this BiMap.
-
- Returns: This Builder instance to allow for chaining of calls to builder methods.
- See also: #put(Object, Object), #forcePut(Object, Object)
build(...) -> BiMap<K, V>
-
Signature:
public BiMap<K, V> build() - Summary: Returns the BiMap instance that has been built up by the builder's methods.
-
Parameters:
- (none)
- Returns: The constructed BiMap instance.
Class BigDecimalSummaryStatistics (com.landawn.abacus.util.BigDecimalSummaryStatistics)
A state object for collecting statistics such as count, min, max, sum, and average for a collection of BigDecimal values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public BigDecimalSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, and undefined min/max values.
-
Parameters:
- (none)
-
Signature:
public BigDecimalSummaryStatistics(final long count, final BigDecimal min, final BigDecimal max, final BigDecimal sum) - Summary: Constructs an instance with the specified count, min, max, and sum.
-
Contract:
- <p> This constructor is useful for creating a summary statistics object from pre-calculated values, such as when deserializing or combining results from multiple sources.
-
Parameters:
-
count(long) — the count of values -
min(BigDecimal) — the minimum value -
max(BigDecimal) — the maximum value -
sum(BigDecimal) — the sum of values
-
accept(...) -> void
-
Signature:
@Override public void accept(final BigDecimal value) - Summary: Records a new BigDecimal value into the summary information.
-
Contract:
- Null values should not be passed to this method.
-
Parameters:
-
value(BigDecimal) — the input value to be recorded
-
combine(...) -> void
-
Signature:
public void combine(final BigDecimalSummaryStatistics other) - Summary: Combines the state of another BigDecimalSummaryStatistics into this one.
-
Parameters:
-
other(BigDecimalSummaryStatistics) — another BigDecimalSummaryStatistics to be combined with this one
-
getMin(...) -> BigDecimal
-
Signature:
public final BigDecimal getMin() - Summary: Returns the minimum value recorded, or {@code null} if no values have been recorded.
-
Contract:
- Returns the minimum value recorded, or {@code null} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the minimum value, or {@code null} if none
getMax(...) -> BigDecimal
-
Signature:
public final BigDecimal getMax() - Summary: Returns the maximum value recorded, or {@code null} if no values have been recorded.
-
Contract:
- Returns the maximum value recorded, or {@code null} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the maximum value, or {@code null} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> BigDecimal
-
Signature:
public final BigDecimal getSum() - Summary: Returns the sum of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the sum of values recorded, or zero if no values have been recorded.
-
Parameters:
- (none)
- Returns: the sum of values, or zero if none
getAverage(...) -> BigDecimal
-
Signature:
public final BigDecimal getAverage() - Summary: Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
- If no values have been recorded, this method returns BigDecimal.ZERO.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values, or zero if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this summary statistics object.
-
Parameters:
- (none)
- Returns: a string representation of this summary statistics
Class BigIntegerSummaryStatistics (com.landawn.abacus.util.BigIntegerSummaryStatistics)
A state object for collecting statistics such as count, min, max, sum, and average for a collection of BigInteger values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public BigIntegerSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, and undefined min/max values.
-
Parameters:
- (none)
-
Signature:
public BigIntegerSummaryStatistics(final long count, final BigInteger min, final BigInteger max, final BigInteger sum) - Summary: Constructs an instance with the specified count, min, max, and sum.
-
Contract:
- <p> This constructor is useful for creating a summary statistics object from pre-calculated values, such as when deserializing or combining results from multiple sources.
-
Parameters:
-
count(long) — the count of values -
min(BigInteger) — the minimum value -
max(BigInteger) — the maximum value -
sum(BigInteger) — the sum of values
-
accept(...) -> void
-
Signature:
@Override public void accept(final BigInteger value) - Summary: Records a new BigInteger value into the summary information.
-
Contract:
- Null values should not be passed to this method.
-
Parameters:
-
value(BigInteger) — the input value to be recorded
-
combine(...) -> void
-
Signature:
public void combine(final BigIntegerSummaryStatistics other) - Summary: Combines the state of another BigIntegerSummaryStatistics into this one.
-
Parameters:
-
other(BigIntegerSummaryStatistics) — another BigIntegerSummaryStatistics to be combined with this one
-
getMin(...) -> BigInteger
-
Signature:
public final BigInteger getMin() - Summary: Returns the minimum value recorded, or {@code null} if no values have been recorded.
-
Contract:
- Returns the minimum value recorded, or {@code null} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the minimum value, or {@code null} if none
getMax(...) -> BigInteger
-
Signature:
public final BigInteger getMax() - Summary: Returns the maximum value recorded, or {@code null} if no values have been recorded.
-
Contract:
- Returns the maximum value recorded, or {@code null} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the maximum value, or {@code null} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> BigInteger
-
Signature:
public final BigInteger getSum() - Summary: Returns the sum of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the sum of values recorded, or zero if no values have been recorded.
-
Parameters:
- (none)
- Returns: the sum of values, or zero if none
getAverage(...) -> BigDecimal
-
Signature:
public final BigDecimal getAverage() - Summary: Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values as a BigDecimal, or zero if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this summary statistics object.
-
Parameters:
- (none)
- Returns: a string representation of this summary statistics
Class BooleanIterator (com.landawn.abacus.util.BooleanIterator)
A specialized Iterator for primitive boolean values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> BooleanIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static BooleanIterator empty() - Summary: Returns an empty {@code BooleanIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code BooleanIterator}
of(...) -> BooleanIterator
-
Signature:
public static BooleanIterator of(final boolean... a) - Summary: Creates a {@code BooleanIterator} from the specified boolean array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(boolean[]) — the boolean array (may be {@code null} )
-
- Returns: a new {@code BooleanIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static BooleanIterator of(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code BooleanIterator} from a subsequence of the specified boolean array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(boolean[]) — the boolean array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code BooleanIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
defer(...) -> BooleanIterator
-
Signature:
public static BooleanIterator defer(final Supplier<? extends BooleanIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Returns a BooleanIterator instance created lazily using the provided Supplier.
-
Contract:
- The Supplier is responsible for producing the BooleanIterator instance when the first method in the returned {@code BooleanIterator} is called.
-
Parameters:
-
iteratorSupplier(Supplier<? extends BooleanIterator>) — A Supplier that provides the BooleanIterator when needed
-
- Returns: A BooleanIterator that is initialized on the first call to hasNext() or nextBoolean()
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is {@code null}
-
generate(...) -> BooleanIterator
-
Signature:
public static BooleanIterator generate(final BooleanSupplier supplier) throws IllegalArgumentException - Summary: Returns an infinite {@code BooleanIterator} that generates values using the provided supplier.
-
Parameters:
-
supplier(BooleanSupplier) — the supplier function to generate boolean values
-
- Returns: an infinite BooleanIterator
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
-
Signature:
public static BooleanIterator generate(final BooleanSupplier hasNext, final BooleanSupplier supplier) throws IllegalArgumentException - Summary: Returns a BooleanIterator that generates values while a condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — the supplier that determines if there are more elements -
supplier(BooleanSupplier) — the supplier function to generate boolean values
-
- Returns: a conditional BooleanIterator
-
Throws:
-
java.lang.IllegalArgumentException— if {@code hasNext} or {@code supplier} is {@code null}
-
Public Instance Methods
next(...) -> Boolean
-
Signature:
@Deprecated @Override public Boolean next() - Summary: Returns the next boolean value in the iteration as a boxed Boolean.
-
Parameters:
- (none)
- Returns: the next boolean value as a Boolean object
nextBoolean(...) -> boolean
-
Signature:
public abstract boolean nextBoolean() - Summary: Returns the next boolean value in the iteration.
-
Parameters:
- (none)
- Returns: the next boolean value
skip(...) -> BooleanIterator
-
Signature:
public BooleanIterator skip(final long n) throws IllegalArgumentException - Summary: Skips the specified number of elements in the iteration.
-
Contract:
- After calling this method, the original iterator should not be used directly as it may lead to unexpected behavior.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new BooleanIterator with elements skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> BooleanIterator
-
Signature:
public BooleanIterator limit(final long count) throws IllegalArgumentException - Summary: Limits the number of elements returned by this iterator.
-
Parameters:
-
count(long) — the maximum number of elements to return
-
- Returns: a new BooleanIterator limited to the specified count
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> BooleanIterator
-
Signature:
public BooleanIterator filter(final BooleanPredicate predicate) throws IllegalArgumentException - Summary: Filters elements based on the provided predicate.
-
Parameters:
-
predicate(BooleanPredicate) — the predicate to test elements
-
- Returns: a new BooleanIterator containing only elements that match the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null}
-
first(...) -> OptionalBoolean
-
Signature:
public OptionalBoolean first() - Summary: Returns the first element as an OptionalBoolean, or empty if no elements exist.
-
Contract:
- Returns the first element as an OptionalBoolean, or empty if no elements exist.
-
Parameters:
- (none)
- Returns: an OptionalBoolean containing the first element, or empty
last(...) -> OptionalBoolean
-
Signature:
public OptionalBoolean last() - Summary: Returns the last element as an OptionalBoolean, or empty if no elements exist.
-
Contract:
- Returns the last element as an OptionalBoolean, or empty if no elements exist.
-
Parameters:
- (none)
- Returns: an OptionalBoolean containing the last element, or empty
toArray(...) -> boolean\[\]
-
Signature:
@SuppressWarnings("deprecation") public boolean[] toArray() - Summary: Converts the remaining elements to a boolean array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a boolean array containing all remaining elements
toList(...) -> BooleanList
-
Signature:
public BooleanList toList() - Summary: Converts the remaining elements to a BooleanList.
-
Contract:
- If the iterator is already empty, returns an empty BooleanList.
-
Parameters:
- (none)
- Returns: a BooleanList containing all remaining elements
stream(...) -> Stream<Boolean>
-
Signature:
public Stream<Boolean> stream() - Summary: Converts this iterator to a Stream of Boolean values.
-
Parameters:
- (none)
- Returns: a Stream of Boolean values
indexed(...) -> ObjIterator<IndexedBoolean>
-
Signature:
@Beta public ObjIterator<IndexedBoolean> indexed() - Summary: Returns an iterator of IndexedBoolean elements with indices starting from 0.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedBoolean elements
-
Signature:
@Beta public ObjIterator<IndexedBoolean> indexed(final long startIndex) - Summary: Returns an iterator of IndexedBoolean elements with indices starting from the specified value.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an ObjIterator of IndexedBoolean elements
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Boolean> action) - Summary: For each remaining element, performs the given action.
-
Parameters:
-
action(java.util.function.Consumer<? super Boolean>) — the action to be performed for each element
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.BooleanConsumer<E> action) throws E - Summary: Performs the given action for each remaining element.
-
Parameters:
-
action(Throwables.BooleanConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntBooleanConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element, providing the element index.
-
Parameters:
-
action(Throwables.IntBooleanConsumer<E>) — the action to be performed for each element with its index
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
Class BooleanList (com.landawn.abacus.util.BooleanList)
A high-performance, resizable array implementation for primitive boolean values that provides specialized operations optimized for boolean data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BooleanList
-
Signature:
public static BooleanList of(final boolean... a) - Summary: Creates a new BooleanList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(boolean[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new BooleanList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static BooleanList of(final boolean[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new BooleanList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(boolean[]) — the array of boolean values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new BooleanList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> BooleanList
-
Signature:
public static BooleanList copyOf(final boolean[] a) - Summary: Creates a new BooleanList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(boolean[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new BooleanList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static BooleanList copyOf(final boolean[] a, final int fromIndex, final int toIndex) - Summary: Creates a new BooleanList that is a copy of the specified range within the given array.
-
Parameters:
-
a(boolean[]) — the array from which a range is to be copied; must not be {@code null} -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new BooleanList containing a copy of the elements in the specified range
repeat(...) -> BooleanList
-
Signature:
public static BooleanList repeat(final boolean element, final int len) - Summary: Creates a new BooleanList with the specified element repeated a given number of times.
-
Parameters:
-
element(boolean) — the boolean value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new BooleanList containing the repeated elements
random(...) -> BooleanList
-
Signature:
public static BooleanList random(final int len) - Summary: Creates a new BooleanList with random boolean values.
-
Parameters:
-
len(int) — the number of random boolean values to generate. Must be non-negative.
-
- Returns: a new BooleanList containing random boolean values
Public Instance Methods
<init>(...) -> void
-
Signature:
public BooleanList() - Summary: Constructs an empty BooleanList with an initial capacity of zero.
-
Contract:
- The internal array will be allocated with a default capacity when the first element is added.
-
Parameters:
- (none)
-
Signature:
public BooleanList(final int initialCapacity) - Summary: Constructs an empty BooleanList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid multiple array reallocations during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public BooleanList(final boolean[] a) - Summary: Constructs a BooleanList using the specified array as the element array for this list without copying.
-
Parameters:
-
a(boolean[]) — the array to be used as the element array for this list; must not be {@code null}
-
- Performance: The list will use the provided array as its internal storage without copying, making this operation O(1) in time complexity.
-
Signature:
public BooleanList(final boolean[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a BooleanList using the specified array as the element array for this list without copying.
-
Parameters:
-
a(boolean[]) — the array to be used as the element array for this list; must not be {@code null} -
size(int) — the number of elements in the list. Must be between 0 and the array length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
array(...) -> boolean\[\]
-
Signature:
@Beta @Deprecated @Override public boolean[] array() - Summary: Returns the internal array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal boolean array backing this list
get(...) -> boolean
-
Signature:
public boolean get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> boolean
-
Signature:
public boolean set(final int index, final boolean e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(boolean) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final boolean e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(boolean) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final boolean e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(boolean) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final BooleanList c) - Summary: Appends all elements from the specified BooleanList to the end of this list, in the order that they appear in the specified list.
-
Parameters:
-
c(BooleanList) — the BooleanList containing elements to be added to this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the specified list was not empty); {@code false} otherwise
-
Signature:
@Override public boolean addAll(final int index, final BooleanList c) - Summary: Inserts all elements from the specified BooleanList into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
- <p> The behavior is undefined if the specified list is modified during the operation.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(BooleanList) — the BooleanList containing elements to be added to this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the specified list was not empty); {@code false} otherwise
-
Signature:
@Override public boolean addAll(final boolean[] a) - Summary: Appends all elements from the specified array to the end of this list, in the order that they appear in the array.
-
Parameters:
-
a(boolean[]) — the array containing elements to be added to this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty); {@code false} otherwise
-
Signature:
@Override public boolean addAll(final int index, final boolean[] a) - Summary: Inserts all elements from the specified array into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(boolean[]) — the array containing elements to be added to this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty); {@code false} otherwise
remove(...) -> boolean
-
Signature:
public boolean remove(final boolean e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(boolean) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final boolean e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(boolean) — the element to be removed from this list
-
- Returns: {@code true} if this list was modified (i.e., at least one element was removed); {@code false} otherwise
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final BooleanList c) - Summary: Removes from this list all of its elements that are contained in the specified BooleanList.
-
Contract:
- <p> This method runs in quadratic time in the worst case, but uses a more efficient set-based algorithm when the size conditions make it beneficial.
-
Parameters:
-
c(BooleanList) — the BooleanList containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list was modified as a result of the call; {@code false} otherwise
-
Signature:
@Override public boolean removeAll(final boolean[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Parameters:
-
a(boolean[]) — the array containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list was modified as a result of the call; {@code false} otherwise
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final BooleanPredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(BooleanPredicate) — the predicate which returns {@code true} for elements to be removed; must not be {@code null}
-
- Returns: {@code true} if any elements were removed; {@code false} otherwise
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only distinct values.
-
Parameters:
- (none)
- Returns: {@code true} if the list was modified (i.e., duplicates were removed); {@code false} if the list already contained only distinct values
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final BooleanList c) - Summary: Retains only the elements in this list that are contained in the specified BooleanList.
-
Contract:
- <p> This method runs in quadratic time in the worst case, but uses a more efficient set-based algorithm when the size conditions make it beneficial.
-
Parameters:
-
c(BooleanList) — the BooleanList containing elements to be retained in this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list was modified as a result of the call; {@code false} otherwise
-
Signature:
@Override public boolean retainAll(final boolean[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(boolean[]) — the array containing elements to be retained in this list. If {@code null} or empty, this list remains unchanged
-
- Returns: {@code true} if this list was modified as a result of the call; {@code false} otherwise
delete(...) -> boolean
-
Signature:
public boolean delete(final int index) - Summary: Removes the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes the elements at the specified positions from this list.
-
Contract:
- <p> This method is more efficient than removing elements one by one when multiple elements need to be removed.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed. Duplicate indices are allowed and will be handled appropriately. If {@code null} or empty, this list remains unchanged
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes a range of elements from this list.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive) -
toIndex(int) — the index after the last element to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final BooleanList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified BooleanList.
-
Contract:
- <p> If the replacement list has a different size than the range being replaced, the list will be resized accordingly, and subsequent elements will be shifted.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced (inclusive) -
toIndex(int) — the index after the last element to be replaced (exclusive) -
replacement(BooleanList) — the BooleanList whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final boolean[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified array.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced (inclusive) -
toIndex(int) — the index after the last element to be replaced (exclusive) -
replacement(boolean[]) — the array whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final boolean oldVal, final boolean newVal) - Summary: Replaces all occurrences of the specified value with the new value in this list.
-
Parameters:
-
oldVal(boolean) — the value to be replaced -
newVal(boolean) — the value to replace {@code oldVal}
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final BooleanUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the operator to that element.
-
Parameters:
-
operator(BooleanUnaryOperator) — the operator to apply to each element; must not be {@code null}
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final BooleanPredicate predicate, final boolean newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(BooleanPredicate) — the predicate to test each element; must not be {@code null} -
newValue(boolean) — the value to replace matching elements with
-
- Returns: {@code true} if at least one element was replaced; {@code false} otherwise
fill(...) -> void
-
Signature:
public void fill(final boolean val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(boolean) — the value to be stored in all elements of the list
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final boolean val) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled with the specified value -
toIndex(int) — the index after the last element (exclusive) to be filled with the specified value -
val(boolean) — the value to be stored in the specified range of elements
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
contains(...) -> boolean
-
Signature:
public boolean contains(final boolean valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(boolean) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final BooleanList c) - Summary: Returns {@code true} if this list contains any of the elements in the specified BooleanList.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified BooleanList.
-
Parameters:
-
c(BooleanList) — the BooleanList to be checked for containment in this list
-
- Returns: {@code true} if this list contains any of the elements in the specified list; {@code false} otherwise
- Performance: <p> This method runs in O(n*m) time in the worst case, where n is the size of this list and m is the size of the specified list.
-
Signature:
@Override public boolean containsAny(final boolean[] a) - Summary: Returns {@code true} if this list contains any of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified array.
-
Parameters:
-
a(boolean[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains any of the elements in the specified array; {@code false} otherwise
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final BooleanList c) - Summary: Returns {@code true} if this list contains all of the elements in the specified BooleanList.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified BooleanList.
- However, it may use more efficient set-based algorithms when beneficial.
-
Parameters:
-
c(BooleanList) — the BooleanList to be checked for containment in this list
-
- Returns: {@code true} if this list contains all of the elements in the specified list; {@code false} otherwise
- Performance: <p> This method runs in O(n*m) time in the worst case, where n is the size of this list and m is the size of the specified list.
-
Signature:
@Override public boolean containsAll(final boolean[] a) - Summary: Returns {@code true} if this list contains all of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified array.
-
Parameters:
-
a(boolean[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains all of the elements in the specified array; {@code false} otherwise
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final BooleanList c) - Summary: Returns {@code true} if this list and the specified BooleanList have no elements in common.
-
Contract:
- Returns {@code true} if this list and the specified BooleanList have no elements in common.
- <p> Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(BooleanList) — the BooleanList to be checked for disjointness with this list
-
- Returns: {@code true} if this list and the specified list have no elements in common; {@code false} otherwise
-
Signature:
@Override public boolean disjoint(final boolean[] b) - Summary: Returns {@code true} if this list and the specified array have no elements in common.
-
Contract:
- Returns {@code true} if this list and the specified array have no elements in common.
-
Parameters:
-
b(boolean[]) — the array to be checked for disjointness with this list
-
- Returns: {@code true} if this list and the specified array have no elements in common; {@code false} otherwise
intersection(...) -> BooleanList
-
Signature:
@Override public BooleanList intersection(final BooleanList b) - Summary: Returns a new BooleanList containing all elements that appear in both this list and the specified BooleanList, respecting the frequency of elements.
-
Contract:
- If an element appears multiple times in both lists, it will appear in the result the minimum number of times it appears in either list.
-
Parameters:
-
b(BooleanList) — the BooleanList to intersect with this list
-
- Returns: a new BooleanList containing the intersection of this list and the specified list
- See also: IntList#intersection(IntList)
-
Signature:
@Override public BooleanList intersection(final boolean[] b) - Summary: Returns a new BooleanList containing all elements that appear in both this list and the specified array, respecting the frequency of elements.
-
Parameters:
-
b(boolean[]) — the array to intersect with this list
-
- Returns: a new BooleanList containing the intersection of this list and the specified array
- See also: IntList#intersection(IntList)
difference(...) -> BooleanList
-
Signature:
@Override public BooleanList difference(final BooleanList b) - Summary: Returns a new BooleanList containing the elements that are in this list but not in the specified BooleanList, considering the frequency of elements.
-
Contract:
- <p> If an element appears n times in this list and m times in the specified list, it will appear max(0, n-m) times in the result.
-
Parameters:
-
b(BooleanList) — the BooleanList whose elements will be subtracted from this list
-
- Returns: a new BooleanList containing the elements in this list but not in the specified list
- See also: #symmetricDifference(BooleanList), N#difference(boolean\[\], boolean\[\])
-
Signature:
@Override public BooleanList difference(final boolean[] b) - Summary: Returns a new BooleanList containing the elements that are in this list but not in the specified array, considering the frequency of elements.
-
Parameters:
-
b(boolean[]) — the array whose elements will be subtracted from this list
-
- Returns: a new BooleanList containing the elements in this list but not in the specified array
- See also: #difference(BooleanList), N#difference(boolean\[\], boolean\[\])
symmetricDifference(...) -> BooleanList
-
Signature:
@Override public BooleanList symmetricDifference(final BooleanList b) - Summary: Returns a new BooleanList containing the symmetric difference between this list and the specified BooleanList.
-
Parameters:
-
b(BooleanList) — the BooleanList to compute symmetric difference with
-
- Returns: a new BooleanList containing the symmetric difference of the two lists
- See also: IntList#symmetricDifference(IntList)
-
Signature:
@Override public BooleanList symmetricDifference(final boolean[] b) - Summary: Returns a new BooleanList containing the symmetric difference between this list and the specified array.
-
Parameters:
-
b(boolean[]) — the array to compute symmetric difference with
-
- Returns: a new BooleanList containing the symmetric difference
- See also: IntList#symmetricDifference(IntList)
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final boolean valueToFind) - Summary: Returns the number of times the specified value appears in this list.
-
Parameters:
-
valueToFind(boolean) — the value whose frequency is to be determined
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final boolean valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or {@code -1} if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or {@code -1} if this list does not contain the element.
-
Parameters:
-
valueToFind(boolean) — the element to search for
-
- Returns: the index of the first occurrence of the specified element in this list, or {@code -1} if this list does not contain the element
-
Signature:
public int indexOf(final boolean valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or {@code -1} if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or {@code -1} if the element is not found.
-
Parameters:
-
valueToFind(boolean) — the element to search for -
fromIndex(int) — the index to start searching from (inclusive). If negative, search starts from index 0. If greater than or equal to the list size, returns {@code -1} .
-
- Returns: the index of the first occurrence of the specified element at or after {@code fromIndex} , or {@code -1} if the element is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final boolean valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or {@code -1} if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or {@code -1} if this list does not contain the element.
-
Parameters:
-
valueToFind(boolean) — the element to search for
-
- Returns: the index of the last occurrence of the specified element in this list, or {@code -1} if this list does not contain the element
-
Signature:
public int lastIndexOf(final boolean valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or {@code -1} if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or {@code -1} if the element is not found.
-
Parameters:
-
valueToFind(boolean) — the element to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). If greater than or equal to the list size, search starts from the last element. If negative, returns {@code -1} .
-
- Returns: the index of the last occurrence of the specified element at or before {@code startIndexFromBack} , or {@code -1} if the element is not found
forEach(...) -> void
-
Signature:
public void forEach(final BooleanConsumer action) - Summary: Performs the given action for each element in this list in sequential order.
-
Parameters:
-
action(BooleanConsumer) — the action to be performed for each element; must not be {@code null}
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final BooleanConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element in the specified range of this list.
-
Contract:
- <p> If {@code fromIndex} is greater than {@code toIndex} , the elements are processed in reverse order, from {@code fromIndex} (inclusive) down to {@code toIndex} (exclusive).
- If {@code toIndex} is -1, it is treated as 0 when {@code fromIndex > toIndex} .
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to process -
toIndex(int) — the ending index (exclusive) of the range to process, or -1 to process from fromIndex to 0 -
action(BooleanConsumer) — the action to be performed for each element; must not be {@code null}
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || (fromIndex > toIndex && toIndex != -1)} )
-
first(...) -> OptionalBoolean
-
Signature:
public OptionalBoolean first() - Summary: Returns an {@code OptionalBoolean} containing the first element of this list, or an empty {@code OptionalBoolean} if this list is empty.
-
Contract:
- Returns an {@code OptionalBoolean} containing the first element of this list, or an empty {@code OptionalBoolean} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalBoolean} containing the first element, or empty if the list is empty
last(...) -> OptionalBoolean
-
Signature:
public OptionalBoolean last() - Summary: Returns an {@code OptionalBoolean} containing the last element of this list, or an empty {@code OptionalBoolean} if this list is empty.
-
Contract:
- Returns an {@code OptionalBoolean} containing the last element of this list, or an empty {@code OptionalBoolean} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalBoolean} containing the last element, or empty if the list is empty
distinct(...) -> BooleanList
-
Signature:
@Override public BooleanList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new {@code BooleanList} containing the distinct elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to process -
toIndex(int) — the ending index (exclusive) of the range to process
-
- Returns: a new {@code BooleanList} containing the distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains duplicate elements.
-
Contract:
- For a boolean list, duplicates exist if the list contains at least two elements with the same value (either two or more {@code true} values, or two or more {@code false} values).
-
Parameters:
- (none)
- Returns: {@code true} if this list contains duplicate elements, {@code false} otherwise. An empty list or a list with one element returns {@code false} . A list with exactly two different boolean values (one {@code true} and one false) returns {@code false} .
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if all elements are sorted in ascending order (false before true), {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts this list in ascending order.
-
Parameters:
- (none)
- Performance: <p> This operation modifies the list in-place and has O(n) time complexity.
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts this list in descending order.
-
Parameters:
- (none)
- Performance: <p> This operation modifies the list in-place and has O(n) time complexity.
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
- Performance: <p> This operation modifies the list in-place and has O(n/2) time complexity.
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to reverse -
toIndex(int) — the ending index (exclusive) of the range to reverse
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles the elements in this list using the default random number generator.
-
Parameters:
- (none)
- Performance: <p> This operation modifies the list in-place and has O(n) time complexity.
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles the elements in this list using the specified random number generator.
-
Parameters:
-
rnd(Random) — the random number generator to use for shuffling; must not be {@code null}
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Contract:
- If the specified positions are the same, invoking this method leaves the list unchanged.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> BooleanList
-
Signature:
@Override public BooleanList copy() - Summary: Returns a new {@code BooleanList} containing all elements of this list.
-
Parameters:
- (none)
- Returns: a new {@code BooleanList} containing all elements of this list
-
Signature:
@Override public BooleanList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new {@code BooleanList} containing the elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy
-
- Returns: a new {@code BooleanList} containing the elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public BooleanList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a new {@code BooleanList} containing elements from the specified range of this list, sampled at regular intervals defined by the step parameter.
-
Contract:
- <p> If {@code fromIndex < toIndex} and {@code step > 0} , elements are sampled from low to high indices.
- If {@code fromIndex > toIndex} and {@code step < 0} , elements are sampled from high to low indices.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy. May be -1 when fromIndex > toIndex -
step(int) — the sampling interval; must not be zero. Positive for forward sampling, negative for backward sampling
-
- Returns: a new {@code BooleanList} containing the sampled elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<BooleanList>
-
Signature:
@Override public List<BooleanList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into consecutive chunks of the specified size and returns them as a list of {@code BooleanList} objects.
-
Contract:
- The final chunk may be smaller than the specified size if the range doesn't divide evenly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to split -
toIndex(int) — the ending index (exclusive) of the range to split -
chunkSize(int) — the desired size of each chunk. Must be greater than 0.
-
- Returns: a list of {@code BooleanList} objects, each containing a chunk of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
trimToSize(...) -> BooleanList
-
Signature:
@Override public BooleanList trimToSize() - Summary: Trims the capacity of this list to be the list's current size.
-
Contract:
- <p> If the capacity is already equal to the size, this method does nothing.
-
Parameters:
- (none)
- Returns: this list instance
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Boolean>
-
Signature:
@Override public List<Boolean> boxed() - Summary: Returns a {@code List<Boolean>} containing all elements of this list.
-
Parameters:
- (none)
- Returns: a new {@code List<Boolean>} containing all elements of this list as boxed values
-
Signature:
@Override public List<Boolean> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code List<Boolean>} containing the elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to box -
toIndex(int) — the ending index (exclusive) of the range to box
-
- Returns: a new {@code List<Boolean>} containing the specified range of elements as boxed values
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toArray(...) -> boolean\[\]
-
Signature:
@Override public boolean[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new boolean array containing all elements of this list
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Boolean>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance with the specified initial capacity. The function receives the number of elements as input.
-
- Returns: a Collection containing the boxed boolean values from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Boolean>
-
Signature:
@Override public Multiset<Boolean> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Boolean>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<Multiset<Boolean>>) — a function that creates a new Multiset instance with the specified initial capacity. The function receives the number of elements as input.
-
- Returns: a Multiset containing the boxed boolean values from the specified range with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
iterator(...) -> BooleanIterator
-
Signature:
@Override public BooleanIterator iterator() - Summary: Returns an iterator over the elements in this list in proper sequence.
-
Parameters:
- (none)
- Returns: a {@code BooleanIterator} over the elements in this list
stream(...) -> Stream<Boolean>
-
Signature:
public Stream<Boolean> stream() - Summary: Returns a {@code Stream} with this list as its source.
-
Parameters:
- (none)
- Returns: a sequential {@code Stream} over the elements in this list
-
Signature:
public Stream<Boolean> stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code Stream} with the specified range of this list as its source.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to stream -
toIndex(int) — the ending index (exclusive) of the range to stream
-
- Returns: a sequential {@code Stream} over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
getFirst(...) -> boolean
-
Signature:
public boolean getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first boolean value in the list
getLast(...) -> boolean
-
Signature:
public boolean getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last boolean value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final boolean e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(boolean) — the boolean value to insert at the beginning of the list
-
- Performance: <p> This operation has O(n) time complexity due to the need to shift existing elements.
addLast(...) -> void
-
Signature:
public void addLast(final boolean e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(boolean) — the boolean value to append to the list
-
- Performance: <p> This operation has amortized O(1) time complexity.
removeFirst(...) -> boolean
-
Signature:
public boolean removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first boolean value that was removed from the list
- Performance: <p> This operation has O(n) time complexity due to the need to shift remaining elements.
removeLast(...) -> boolean
-
Signature:
public boolean removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last boolean value that was removed from the list
- Performance: <p> This operation has O(1) time complexity.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this list for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also a {@code BooleanList} , both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class BrotliInputStream (com.landawn.abacus.util.BrotliInputStream)
An InputStream that decompresses data in the Brotli compression format.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public BrotliInputStream(final InputStream source) throws IOException - Summary: Creates a new BrotliInputStream that decompresses data from the specified source stream.
-
Parameters:
-
source(InputStream) — the input stream containing Brotli-compressed data
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while initializing the decompressor
-
-
Signature:
public BrotliInputStream(final InputStream source, final int byteReadBufferSize) throws IOException - Summary: Creates a new BrotliInputStream with a specified internal buffer size.
-
Contract:
- A larger buffer size may improve performance when reading large amounts of data.
-
Parameters:
-
source(InputStream) — the input stream containing Brotli-compressed data -
byteReadBufferSize(int) — the size of the internal buffer for reading, in bytes
-
-
Throws:
-
java.io.IOException— if an I/O error occurs while initializing the decompressor
-
read(...) -> int
-
Signature:
@Override public int read() throws IOException - Summary: Reads the next byte of decompressed data from the input stream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code int b = brotliStream.read(); if (b != -1) { byte data = (byte) b; // Process the byte } } </pre>
-
Parameters:
- (none)
- Returns: the next byte of decompressed data, or -1 if the end of the stream is reached
-
Throws:
-
java.io.IOException— if an I/O error occurs during decompression
-
-
Signature:
@Override public int read(final byte[] b) throws IOException - Summary: Reads decompressed data into an array of bytes.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data
-
Throws:
-
java.io.IOException— if an I/O error occurs during decompression
-
-
Signature:
@Override public int read(final byte[] b, final int off, final int len) throws IOException - Summary: Reads up to len bytes of decompressed data into an array of bytes.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read -
off(int) — the start offset in array b at which the data is written -
len(int) — the maximum number of bytes to read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data
-
Throws:
-
java.io.IOException— if an I/O error occurs during decompression
-
skip(...) -> long
-
Signature:
@Override public long skip(final long n) throws IllegalArgumentException, IOException - Summary: Skips over and discards n bytes of decompressed data from this input stream.
-
Parameters:
-
n(long) — the number of bytes to be skipped
-
- Returns: the actual number of bytes skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.io.IOException— if an I/O error occurs during the skip operation
-
available(...) -> int
-
Signature:
@Override public int available() throws IOException - Summary: Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (brotliStream.available() > 0) { // Data is available to read without blocking byte\[\] data = new byte\[brotliStream.available()\]; brotliStream.read(data); } } </pre>
-
Parameters:
- (none)
- Returns: an estimate of the number of bytes that can be read without blocking, or 0
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
mark(...) -> void
-
Signature:
@Override public synchronized void mark(final int readLimit) - Summary: Marks the current position in this input stream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (brotliStream.markSupported()) { brotliStream.mark(1024); // Mark with 1KB read limit // Read some data brotliStream.reset(); // Return to marked position } } </pre>
-
Parameters:
-
readLimit(int) — the maximum limit of bytes that can be read before the mark position becomes invalid
-
reset(...) -> void
-
Signature:
@Override public synchronized void reset() throws IOException - Summary: Repositions this stream to the position at the time the mark method was last called.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if the stream has not been marked or if the mark has been invalidated
-
markSupported(...) -> boolean
-
Signature:
@Override public boolean markSupported() - Summary: Tests if this input stream supports the mark and reset methods.
-
Contract:
- Tests if this input stream supports the mark and reset methods.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (brotliStream.markSupported()) { System.out.println("Mark/reset operations are supported"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if this stream instance supports the mark and reset methods; {@code false} otherwise
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes this input stream and releases any system resources associated with the stream.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class BufferedCsvWriter (com.landawn.abacus.util.BufferedCsvWriter)
A specialized writer for efficient CSV output with automatic character escaping.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class BufferedJsonWriter (com.landawn.abacus.util.BufferedJsonWriter)
A specialized writer for efficient JSON output with automatic character escaping.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class BufferedXmlWriter (com.landawn.abacus.util.BufferedXmlWriter)
A specialized writer for efficient XML output with automatic character escaping.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Builder (com.landawn.abacus.util.Builder)
A fluent wrapper class that provides a builder pattern for manipulating objects of type {@code T} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BooleanListBuilder
-
Signature:
public static BooleanListBuilder of(final BooleanList val) throws IllegalArgumentException - Summary: Creates a specialized BooleanListBuilder for the given BooleanList.
-
Parameters:
-
val(BooleanList) — the BooleanList to wrap in a builder.
-
- Returns: a new BooleanListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static CharListBuilder of(final CharList val) throws IllegalArgumentException - Summary: Creates a specialized CharListBuilder for the given CharList.
-
Parameters:
-
val(CharList) — the CharList to wrap in a builder.
-
- Returns: a new CharListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static ByteListBuilder of(final ByteList val) throws IllegalArgumentException - Summary: Creates a specialized ByteListBuilder for the given ByteList.
-
Parameters:
-
val(ByteList) — the ByteList to wrap in a builder.
-
- Returns: a new ByteListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static ShortListBuilder of(final ShortList val) throws IllegalArgumentException - Summary: Creates a specialized ShortListBuilder for the given ShortList.
-
Parameters:
-
val(ShortList) — the ShortList to wrap in a builder.
-
- Returns: a new ShortListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static IntListBuilder of(final IntList val) throws IllegalArgumentException - Summary: Creates a specialized IntListBuilder for the given IntList.
-
Parameters:
-
val(IntList) — the IntList to wrap in a builder.
-
- Returns: a new IntListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static LongListBuilder of(final LongList val) throws IllegalArgumentException - Summary: Creates a specialized LongListBuilder for the given LongList.
-
Parameters:
-
val(LongList) — the LongList to wrap in a builder.
-
- Returns: a new LongListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static FloatListBuilder of(final FloatList val) throws IllegalArgumentException - Summary: Creates a specialized FloatListBuilder for the given FloatList.
-
Parameters:
-
val(FloatList) — the FloatList to wrap in a builder.
-
- Returns: a new FloatListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static DoubleListBuilder of(final DoubleList val) throws IllegalArgumentException - Summary: Creates a specialized DoubleListBuilder for the given DoubleList.
-
Parameters:
-
val(DoubleList) — the DoubleList to wrap in a builder.
-
- Returns: a new DoubleListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static <T, L extends List<T>> ListBuilder<T, L> of(final L val) throws IllegalArgumentException - Summary: Creates a specialized ListBuilder for the given List.
-
Parameters:
-
val(L) — the List to wrap in a builder
-
- Returns: a new ListBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static <T, C extends Collection<T>> CollectionBuilder<T, C> of(final C val) throws IllegalArgumentException - Summary: Creates a specialized CollectionBuilder for the given Collection.
-
Parameters:
-
val(C) — the Collection to wrap in a builder
-
- Returns: a new CollectionBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static <K, V, M extends Map<K, V>> MapBuilder<K, V, M> of(final M val) throws IllegalArgumentException - Summary: Creates a specialized MapBuilder for the given Map.
-
Parameters:
-
val(M) — the Map to wrap in a builder
-
- Returns: a new MapBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static <T> MultisetBuilder<T> of(final Multiset<T> val) throws IllegalArgumentException - Summary: Creates a specialized MultisetBuilder for the given Multiset.
-
Parameters:
-
val(Multiset<T>) — the Multiset to wrap in a builder
-
- Returns: a new MultisetBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static <K, E, V extends Collection<E>, M extends Multimap<K, E, V>> MultimapBuilder<K, E, V, M> of(final M val) throws IllegalArgumentException - Summary: Creates a specialized MultimapBuilder for the given Multimap.
-
Parameters:
-
val(M) — the Multimap to wrap in a builder
-
- Returns: a new MultimapBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
public static DatasetBuilder of(final Dataset val) throws IllegalArgumentException - Summary: Creates a specialized DatasetBuilder for the given Dataset.
-
Parameters:
-
val(Dataset) — the Dataset to wrap in a builder
-
- Returns: a new DatasetBuilder instance.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Builder<T> of(final T val) throws IllegalArgumentException - Summary: Creates a Builder for the given value.
-
Contract:
- If the value is a known collection type (List, Set, Map, etc.), a specialized builder is returned.
-
Parameters:
-
val(T) — the value to wrap in a builder
-
- Returns: an appropriate Builder instance for the given value
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code val} is {@code null} .
-
compare(...) -> ComparisonBuilder
-
Signature:
public static <T extends Comparable<? super T>> ComparisonBuilder compare(final T left, final T right) - Summary: Creates a new ComparisonBuilder and compares two comparable objects using their natural ordering.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static <T> ComparisonBuilder compare(final T left, final T right, final Comparator<T> comparator) - Summary: Creates a new ComparisonBuilder and compares two objects using a specified comparator.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare -
comparator(Comparator<T>) — the comparator to use for comparison
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final char left, final char right) - Summary: Creates a new ComparisonBuilder and compares two char values.
-
Parameters:
-
left(char) — the first char to compare -
right(char) — the second char to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final byte left, final byte right) - Summary: Creates a new ComparisonBuilder and compares two byte values.
-
Parameters:
-
left(byte) — the first byte to compare -
right(byte) — the second byte to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final short left, final short right) - Summary: Creates a new ComparisonBuilder and compares two short values.
-
Parameters:
-
left(short) — the first short to compare -
right(short) — the second short to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final int left, final int right) - Summary: Creates a new ComparisonBuilder and compares two int values.
-
Parameters:
-
left(int) — the first int to compare -
right(int) — the second int to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final long left, final long right) - Summary: Creates a new ComparisonBuilder and compares two long values.
-
Parameters:
-
left(long) — the first long to compare -
right(long) — the second long to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final float left, final float right) - Summary: Creates a new ComparisonBuilder and compares two float values.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final float left, final float right, final float tolerance) - Summary: Creates a new ComparisonBuilder and compares two float values with a specified tolerance.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare -
tolerance(float) — the acceptable difference between the two floats
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final double left, final double right) - Summary: Creates a new ComparisonBuilder and compares two double values.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare
-
- Returns: a new ComparisonBuilder for method chaining
-
Signature:
public static ComparisonBuilder compare(final double left, final double right, final double tolerance) - Summary: Creates a new ComparisonBuilder and compares two double values with a specified tolerance.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare -
tolerance(double) — the acceptable difference between the two doubles
-
- Returns: a new ComparisonBuilder for method chaining
compareNullLess(...) -> ComparisonBuilder
-
Signature:
public static <T extends Comparable<? super T>> ComparisonBuilder compareNullLess(final T left, final T right) - Summary: Creates a new ComparisonBuilder and compares two comparable objects, treating {@code null} as smaller.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare
-
- Returns: a new ComparisonBuilder for method chaining
compareNullBigger(...) -> ComparisonBuilder
-
Signature:
public static <T extends Comparable<? super T>> ComparisonBuilder compareNullBigger(final T left, final T right) - Summary: Creates a new ComparisonBuilder and compares two comparable objects, treating {@code null} as bigger.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare
-
- Returns: a new ComparisonBuilder for method chaining
compareFalseLess(...) -> ComparisonBuilder
-
Signature:
public static ComparisonBuilder compareFalseLess(final boolean left, final boolean right) - Summary: Creates a new ComparisonBuilder and compares two boolean values, treating {@code false} as less than {@code true} .
-
Contract:
- This is useful for sorting where {@code false} values should come before {@code true} values.
-
Parameters:
-
left(boolean) — the first boolean to compare -
right(boolean) — the second boolean to compare
-
- Returns: a new ComparisonBuilder for method chaining
compareTrueLess(...) -> ComparisonBuilder
-
Signature:
public static ComparisonBuilder compareTrueLess(final boolean left, final boolean right) - Summary: Creates a new ComparisonBuilder and compares two boolean values, treating {@code true} as less than {@code false} .
-
Contract:
- This is useful for sorting where {@code true} values should come before {@code false} values.
-
Parameters:
-
left(boolean) — the first boolean to compare -
right(boolean) — the second boolean to compare
-
- Returns: a new ComparisonBuilder for method chaining
equals(...) -> EquivalenceBuilder
-
Signature:
public static EquivalenceBuilder equals(final Object left, final Object right) - Summary: Creates a new EquivalenceBuilder and checks equality of two objects.
-
Parameters:
-
left(Object) — the first object to compare -
right(Object) — the second object to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static <T> EquivalenceBuilder equals(final T left, final T right, final BiPredicate<? super T, ? super T> predicate) - Summary: Creates a new EquivalenceBuilder and checks equality using a custom function.
-
Contract:
- The function determines whether the two objects should be considered equal.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare -
predicate(BiPredicate<? super T, ? super T>) — the predicate to check equality, must not be null
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final boolean left, final boolean right) - Summary: Creates a new EquivalenceBuilder and checks equality of two boolean values.
-
Parameters:
-
left(boolean) — the first boolean to compare -
right(boolean) — the second boolean to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final char left, final char right) - Summary: Creates a new EquivalenceBuilder and checks equality of two char values.
-
Parameters:
-
left(char) — the first char to compare -
right(char) — the second char to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final byte left, final byte right) - Summary: Creates a new EquivalenceBuilder and checks equality of two byte values.
-
Parameters:
-
left(byte) — the first byte to compare -
right(byte) — the second byte to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final short left, final short right) - Summary: Creates a new EquivalenceBuilder and checks equality of two short values.
-
Parameters:
-
left(short) — the first short to compare -
right(short) — the second short to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final int left, final int right) - Summary: Creates a new EquivalenceBuilder and checks equality of two int values.
-
Parameters:
-
left(int) — the first int to compare -
right(int) — the second int to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final long left, final long right) - Summary: Creates a new EquivalenceBuilder and checks equality of two long values.
-
Parameters:
-
left(long) — the first long to compare -
right(long) — the second long to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final float left, final float right) - Summary: Creates a new EquivalenceBuilder and checks equality of two float values.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final float left, final float right, final float tolerance) - Summary: Creates a new EquivalenceBuilder and checks equality of two float values with a specified tolerance.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare -
tolerance(float) — the acceptable difference between the two floats
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final double left, final double right) - Summary: Creates a new EquivalenceBuilder and checks equality of two double values.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare
-
- Returns: a new EquivalenceBuilder for method chaining
-
Signature:
public static EquivalenceBuilder equals(final double left, final double right, final double tolerance) - Summary: Creates a new EquivalenceBuilder and checks equality of two double values with a specified tolerance.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare -
tolerance(double) — the acceptable difference between the two doubles
-
- Returns: a new EquivalenceBuilder for method chaining
hash(...) -> HashCodeBuilder
-
Signature:
public static HashCodeBuilder hash(final Object value) - Summary: Creates a new HashCodeBuilder and adds the hash code of the specified object.
-
Parameters:
-
value(Object) — the object whose hash code should be added
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static <T> HashCodeBuilder hash(final T value, final ToIntFunction<? super T> func) - Summary: Creates a new HashCodeBuilder and adds a hash code computed by a custom function.
-
Parameters:
-
value(T) — the object to hash -
func(ToIntFunction<? super T>) — the function that computes the hash code for the value
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final boolean value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a boolean value.
-
Parameters:
-
value(boolean) — the boolean value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final char value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a char value.
-
Parameters:
-
value(char) — the char value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final byte value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a byte value.
-
Parameters:
-
value(byte) — the byte value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final short value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a short value.
-
Parameters:
-
value(short) — the short value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final int value) - Summary: Creates a new HashCodeBuilder and adds the hash code of an int value.
-
Parameters:
-
value(int) — the int value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final long value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a long value.
-
Parameters:
-
value(long) — the long value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final float value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a float value.
-
Parameters:
-
value(float) — the float value to hash
-
- Returns: a new HashCodeBuilder for method chaining
-
Signature:
public static HashCodeBuilder hash(final double value) - Summary: Creates a new HashCodeBuilder and adds the hash code of a double value.
-
Parameters:
-
value(double) — the double value to hash
-
- Returns: a new HashCodeBuilder for method chaining
Public Instance Methods
val(...) -> T
-
Signature:
public T val() - Summary: Returns the wrapped value held by this builder.
-
Parameters:
- (none)
- Returns: the wrapped value
accept(...) -> Builder<T>
-
Signature:
public Builder<T> accept(final Consumer<? super T> consumer) - Summary: Performs the given action on the wrapped value and returns this builder for method chaining.
-
Parameters:
-
consumer(Consumer<? super T>) — the action to perform on the wrapped value
-
- Returns: this builder instance
apply(...) -> R
-
Signature:
public <R> R apply(final Function<? super T, ? extends R> func) - Summary: Applies the given function to the wrapped value and returns the result directly.
-
Parameters:
-
func(Function<? super T, ? extends R>) — the function to apply to the wrapped value, must not be {@code null}
-
- Returns: the result of applying the function to the wrapped value
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Creates a Stream containing only the wrapped value as a single element.
-
Parameters:
- (none)
- Returns: a Stream containing the wrapped value as its only element
Class BooleanListBuilder (com.landawn.abacus.util.Builder.BooleanListBuilder)
Specialized builder for BooleanList that provides fluent methods for adding, removing, and modifying boolean elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> BooleanListBuilder
-
Signature:
public BooleanListBuilder set(final int index, final boolean e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(boolean) — the boolean value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> BooleanListBuilder
-
Signature:
public BooleanListBuilder add(final boolean e) - Summary: Appends the specified boolean value to the end of the list.
-
Parameters:
-
e(boolean) — the boolean value to append
-
- Returns: this builder instance
-
Signature:
public BooleanListBuilder add(final int index, final boolean e) - Summary: Inserts the specified boolean value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(boolean) — the boolean value to be inserted
-
- Returns: this builder instance
addAll(...) -> BooleanListBuilder
-
Signature:
public BooleanListBuilder addAll(final BooleanList c) - Summary: Appends all of the elements in the specified BooleanList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(BooleanList) — the BooleanList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public BooleanListBuilder addAll(final int index, final BooleanList c) - Summary: Inserts all of the elements in the specified BooleanList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(BooleanList) — the BooleanList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> BooleanListBuilder
-
Signature:
public BooleanListBuilder remove(final boolean e) - Summary: Removes the first occurrence of the specified boolean value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified boolean value from this list, if it is present.
-
Parameters:
-
e(boolean) — the boolean value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> BooleanListBuilder
-
Signature:
public BooleanListBuilder removeAll(final BooleanList c) - Summary: Removes from this list all of its elements that are contained in the specified BooleanList.
-
Parameters:
-
c(BooleanList) — the BooleanList containing elements to be removed from this list
-
- Returns: this builder instance
Class CharListBuilder (com.landawn.abacus.util.Builder.CharListBuilder)
Specialized builder for CharList that provides fluent methods for adding, removing, and modifying char elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> CharListBuilder
-
Signature:
public CharListBuilder set(final int index, final char e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(char) — the char value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> CharListBuilder
-
Signature:
public CharListBuilder add(final char e) - Summary: Appends the specified char value to the end of the list.
-
Parameters:
-
e(char) — the char value to append
-
- Returns: this builder instance
-
Signature:
public CharListBuilder add(final int index, final char e) - Summary: Inserts the specified char value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(char) — the char value to be inserted
-
- Returns: this builder instance
addAll(...) -> CharListBuilder
-
Signature:
public CharListBuilder addAll(final CharList c) - Summary: Appends all of the elements in the specified CharList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(CharList) — the CharList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public CharListBuilder addAll(final int index, final CharList c) - Summary: Inserts all of the elements in the specified CharList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(CharList) — the CharList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> CharListBuilder
-
Signature:
public CharListBuilder remove(final char e) - Summary: Removes the first occurrence of the specified char value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified char value from this list, if it is present.
-
Parameters:
-
e(char) — the char value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> CharListBuilder
-
Signature:
public CharListBuilder removeAll(final CharList c) - Summary: Removes from this list all of its elements that are contained in the specified CharList.
-
Parameters:
-
c(CharList) — the CharList containing elements to be removed from this list
-
- Returns: this builder instance
Class ByteListBuilder (com.landawn.abacus.util.Builder.ByteListBuilder)
Specialized builder for ByteList that provides fluent methods for adding, removing, and modifying byte elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> ByteListBuilder
-
Signature:
public ByteListBuilder set(final int index, final byte e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(byte) — the byte value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> ByteListBuilder
-
Signature:
public ByteListBuilder add(final byte e) - Summary: Appends the specified byte value to the end of the list.
-
Parameters:
-
e(byte) — the byte value to append
-
- Returns: this builder instance
-
Signature:
public ByteListBuilder add(final int index, final byte e) - Summary: Inserts the specified byte value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(byte) — the byte value to be inserted
-
- Returns: this builder instance
addAll(...) -> ByteListBuilder
-
Signature:
public ByteListBuilder addAll(final ByteList c) - Summary: Appends all of the elements in the specified ByteList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(ByteList) — the ByteList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public ByteListBuilder addAll(final int index, final ByteList c) - Summary: Inserts all of the elements in the specified ByteList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(ByteList) — the ByteList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> ByteListBuilder
-
Signature:
public ByteListBuilder remove(final byte e) - Summary: Removes the first occurrence of the specified byte value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified byte value from this list, if it is present.
-
Parameters:
-
e(byte) — the byte value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> ByteListBuilder
-
Signature:
public ByteListBuilder removeAll(final ByteList c) - Summary: Removes from this list all of its elements that are contained in the specified ByteList.
-
Parameters:
-
c(ByteList) — the ByteList containing elements to be removed from this list
-
- Returns: this builder instance
Class ShortListBuilder (com.landawn.abacus.util.Builder.ShortListBuilder)
Specialized builder for ShortList that provides fluent methods for adding, removing, and modifying short elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> ShortListBuilder
-
Signature:
public ShortListBuilder set(final int index, final short e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(short) — the short value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> ShortListBuilder
-
Signature:
public ShortListBuilder add(final short e) - Summary: Appends the specified short value to the end of the list.
-
Parameters:
-
e(short) — the short value to append
-
- Returns: this builder instance
-
Signature:
public ShortListBuilder add(final int index, final short e) - Summary: Inserts the specified short value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(short) — the short value to be inserted
-
- Returns: this builder instance
addAll(...) -> ShortListBuilder
-
Signature:
public ShortListBuilder addAll(final ShortList c) - Summary: Appends all of the elements in the specified ShortList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(ShortList) — the ShortList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public ShortListBuilder addAll(final int index, final ShortList c) - Summary: Inserts all of the elements in the specified ShortList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(ShortList) — the ShortList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> ShortListBuilder
-
Signature:
public ShortListBuilder remove(final short e) - Summary: Removes the first occurrence of the specified short value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified short value from this list, if it is present.
-
Parameters:
-
e(short) — the short value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> ShortListBuilder
-
Signature:
public ShortListBuilder removeAll(final ShortList c) - Summary: Removes from this list all of its elements that are contained in the specified ShortList.
-
Parameters:
-
c(ShortList) — the ShortList containing elements to be removed from this list
-
- Returns: this builder instance
Class IntListBuilder (com.landawn.abacus.util.Builder.IntListBuilder)
Specialized builder for IntList that provides fluent methods for adding, removing, and modifying int elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> IntListBuilder
-
Signature:
public IntListBuilder set(final int index, final int e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(int) — the int value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> IntListBuilder
-
Signature:
public IntListBuilder add(final int e) - Summary: Appends the specified int value to the end of the list.
-
Parameters:
-
e(int) — the int value to append
-
- Returns: this builder instance
-
Signature:
public IntListBuilder add(final int index, final int e) - Summary: Inserts the specified int value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(int) — the int value to be inserted
-
- Returns: this builder instance
addAll(...) -> IntListBuilder
-
Signature:
public IntListBuilder addAll(final IntList c) - Summary: Appends all of the elements in the specified IntList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(IntList) — the IntList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public IntListBuilder addAll(final int index, final IntList c) - Summary: Inserts all of the elements in the specified IntList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(IntList) — the IntList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> IntListBuilder
-
Signature:
public IntListBuilder remove(final int e) - Summary: Removes the first occurrence of the specified int value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified int value from this list, if it is present.
-
Parameters:
-
e(int) — the int value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> IntListBuilder
-
Signature:
public IntListBuilder removeAll(final IntList c) - Summary: Removes from this list all of its elements that are contained in the specified IntList.
-
Parameters:
-
c(IntList) — the IntList containing elements to be removed from this list
-
- Returns: this builder instance
Class LongListBuilder (com.landawn.abacus.util.Builder.LongListBuilder)
Specialized builder for LongList that provides fluent methods for adding, removing, and modifying long elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> LongListBuilder
-
Signature:
public LongListBuilder set(final int index, final long e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(long) — the long value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> LongListBuilder
-
Signature:
public LongListBuilder add(final long e) - Summary: Appends the specified long value to the end of the list.
-
Parameters:
-
e(long) — the long value to append
-
- Returns: this builder instance
-
Signature:
public LongListBuilder add(final int index, final long e) - Summary: Inserts the specified long value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(long) — the long value to be inserted
-
- Returns: this builder instance
addAll(...) -> LongListBuilder
-
Signature:
public LongListBuilder addAll(final LongList c) - Summary: Appends all of the elements in the specified LongList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(LongList) — the LongList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public LongListBuilder addAll(final int index, final LongList c) - Summary: Inserts all of the elements in the specified LongList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(LongList) — the LongList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> LongListBuilder
-
Signature:
public LongListBuilder remove(final long e) - Summary: Removes the first occurrence of the specified long value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified long value from this list, if it is present.
-
Parameters:
-
e(long) — the long value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> LongListBuilder
-
Signature:
public LongListBuilder removeAll(final LongList c) - Summary: Removes from this list all of its elements that are contained in the specified LongList.
-
Parameters:
-
c(LongList) — the LongList containing elements to be removed from this list
-
- Returns: this builder instance
Class FloatListBuilder (com.landawn.abacus.util.Builder.FloatListBuilder)
Specialized builder for FloatList that provides fluent methods for adding, removing, and modifying float elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> FloatListBuilder
-
Signature:
public FloatListBuilder set(final int index, final float e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(float) — the float value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> FloatListBuilder
-
Signature:
public FloatListBuilder add(final float e) - Summary: Appends the specified float value to the end of the list.
-
Parameters:
-
e(float) — the float value to append
-
- Returns: this builder instance
-
Signature:
public FloatListBuilder add(final int index, final float e) - Summary: Inserts the specified float value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(float) — the float value to be inserted
-
- Returns: this builder instance
addAll(...) -> FloatListBuilder
-
Signature:
public FloatListBuilder addAll(final FloatList c) - Summary: Appends all of the elements in the specified FloatList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(FloatList) — the FloatList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public FloatListBuilder addAll(final int index, final FloatList c) - Summary: Inserts all of the elements in the specified FloatList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(FloatList) — the FloatList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> FloatListBuilder
-
Signature:
public FloatListBuilder remove(final float e) - Summary: Removes the first occurrence of the specified float value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified float value from this list, if it is present.
-
Parameters:
-
e(float) — the float value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> FloatListBuilder
-
Signature:
public FloatListBuilder removeAll(final FloatList c) - Summary: Removes from this list all of its elements that are contained in the specified FloatList.
-
Parameters:
-
c(FloatList) — the FloatList containing elements to be removed from this list
-
- Returns: this builder instance
Class DoubleListBuilder (com.landawn.abacus.util.Builder.DoubleListBuilder)
Specialized builder for DoubleList that provides fluent methods for adding, removing, and modifying double elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
set(...) -> DoubleListBuilder
-
Signature:
public DoubleListBuilder set(final int index, final double e) - Summary: Sets the element at the specified position in the list to the specified value.
-
Parameters:
-
index(int) — the index of the element to replace -
e(double) — the double value to be stored at the specified position
-
- Returns: this builder instance
add(...) -> DoubleListBuilder
-
Signature:
public DoubleListBuilder add(final double e) - Summary: Appends the specified double value to the end of the list.
-
Parameters:
-
e(double) — the double value to append
-
- Returns: this builder instance
-
Signature:
public DoubleListBuilder add(final int index, final double e) - Summary: Inserts the specified double value at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(double) — the double value to be inserted
-
- Returns: this builder instance
addAll(...) -> DoubleListBuilder
-
Signature:
public DoubleListBuilder addAll(final DoubleList c) - Summary: Appends all of the elements in the specified DoubleList to the end of this list, in the order that they are returned by the specified list's iterator.
-
Parameters:
-
c(DoubleList) — the DoubleList containing elements to be added to this list
-
- Returns: this builder instance
-
Signature:
public DoubleListBuilder addAll(final int index, final DoubleList c) - Summary: Inserts all of the elements in the specified DoubleList into this list, starting at the specified position.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(DoubleList) — the DoubleList containing elements to be added to this list
-
- Returns: this builder instance
remove(...) -> DoubleListBuilder
-
Signature:
public DoubleListBuilder remove(final double e) - Summary: Removes the first occurrence of the specified double value from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified double value from this list, if it is present.
-
Parameters:
-
e(double) — the double value to be removed from this list, if present
-
- Returns: this builder instance
removeAll(...) -> DoubleListBuilder
-
Signature:
public DoubleListBuilder removeAll(final DoubleList c) - Summary: Removes from this list all of its elements that are contained in the specified DoubleList.
-
Parameters:
-
c(DoubleList) — the DoubleList containing elements to be removed from this list
-
- Returns: this builder instance
Class ListBuilder (com.landawn.abacus.util.Builder.ListBuilder)
Specialized builder for List that provides fluent methods for adding, removing, and modifying elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> ListBuilder<T, L>
-
Signature:
@Override public ListBuilder<T, L> add(final T e) -
Parameters:
-
e(T)
-
- Returns: unspecified
-
Signature:
public ListBuilder<T, L> add(final int index, final T e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(T) — the element to be inserted
-
- Returns: this builder instance
addAll(...) -> ListBuilder<T, L>
-
Signature:
@Override public ListBuilder<T, L> addAll(final Collection<? extends T> c) - Summary: Appends all of the elements in the specified collection to the end of the list, in the order that they are returned by the specified collection's iterator.
-
Contract:
- Does nothing if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection containing elements to be added to the list
-
- Returns: this builder instance for method chaining
-
Signature:
@SafeVarargs @Override public final ListBuilder<T, L> addAll(final T... a) - Summary: Appends all of the elements in the specified array to the end of the list, in the order that they appear in the array.
-
Contract:
- Does nothing if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array containing elements to be added to the list
-
- Returns: this builder instance for method chaining
-
Signature:
public ListBuilder<T, L> addAll(final int index, final Collection<? extends T> c) throws IndexOutOfBoundsException - Summary: Inserts all of the elements in the specified collection into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified collection -
c(Collection<? extends T>) — the collection containing elements to be added to this list
-
- Returns: this builder instance
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range
-
remove(...) -> ListBuilder<T, L>
-
Signature:
@Override public ListBuilder<T, L> remove(final Object e) - Summary: Removes the first occurrence of the specified element from the list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from the list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(Object) — the element to be removed from the list, if present
-
- Returns: this builder instance for method chaining
-
Signature:
public ListBuilder<T, L> remove(final int index) - Summary: Removes the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: this builder instance
removeAll(...) -> ListBuilder<T, L>
-
Signature:
@Override public ListBuilder<T, L> removeAll(final Collection<?> c) - Summary: Removes from the list all of its elements that are contained in the specified collection.
-
Contract:
- Does nothing if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be removed from the list
-
- Returns: this builder instance for method chaining
-
Signature:
@SafeVarargs @Override public final ListBuilder<T, L> removeAll(final T... a) - Summary: Removes from the list all of its elements that are contained in the specified array.
-
Contract:
- Does nothing if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array containing elements to be removed from the list
-
- Returns: this builder instance for method chaining
Class CollectionBuilder (com.landawn.abacus.util.Builder.CollectionBuilder)
Builder for Collection that provides fluent methods for adding and removing elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> CollectionBuilder<T, C>
-
Signature:
public CollectionBuilder<T, C> add(final T e) - Summary: Adds the specified element to this collection.
-
Parameters:
-
e(T) — the element to add
-
- Returns: this builder instance
addAll(...) -> CollectionBuilder<T, C>
-
Signature:
public CollectionBuilder<T, C> addAll(final Collection<? extends T> c) - Summary: Adds all of the elements in the specified collection to this collection.
-
Contract:
- The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
-
Parameters:
-
c(Collection<? extends T>) — the collection containing elements to be added to this collection
-
- Returns: this builder instance
-
Signature:
public CollectionBuilder<T, C> addAll(final T... a) - Summary: Adds all of the elements in the specified array to this collection.
-
Parameters:
-
a(T[]) — the array containing elements to be added to this collection
-
- Returns: this builder instance
remove(...) -> CollectionBuilder<T, C>
-
Signature:
public CollectionBuilder<T, C> remove(final Object e) - Summary: Removes a single instance of the specified element from this collection, if it is present.
-
Contract:
- Removes a single instance of the specified element from this collection, if it is present.
-
Parameters:
-
e(Object) — the element to be removed from this collection, if present
-
- Returns: this builder instance
removeAll(...) -> CollectionBuilder<T, C>
-
Signature:
public CollectionBuilder<T, C> removeAll(final Collection<?> c) - Summary: Removes all of this collection's elements that are also contained in the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be removed from this collection
-
- Returns: this builder instance
-
Signature:
public CollectionBuilder<T, C> removeAll(final T... a) - Summary: Removes all of this collection's elements that are also contained in the specified array.
-
Parameters:
-
a(T[]) — the array containing elements to be removed from this collection
-
- Returns: this builder instance
Class MultisetBuilder (com.landawn.abacus.util.Builder.MultisetBuilder)
Specialized builder for Multiset that provides fluent methods for managing element occurrences.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
setCount(...) -> MultisetBuilder<T>
-
Signature:
public MultisetBuilder<T> setCount(final T e, final int occurrences) - Summary: Sets the count of the specified element to the specified non-negative value.
-
Contract:
- If the element is not already in the multiset and occurrences is positive, it will be added.
- If occurrences is zero, the element will be removed entirely.
-
Parameters:
-
e(T) — the element whose count is to be set -
occurrences(int) — the desired count of the element; must be non-negative
-
- Returns: this builder instance
add(...) -> MultisetBuilder<T>
-
Signature:
public MultisetBuilder<T> add(final T e) - Summary: Adds a single occurrence of the specified element to this multiset.
-
Parameters:
-
e(T) — the element to add
-
- Returns: this builder instance
-
Signature:
public MultisetBuilder<T> add(final T e, final int occurrencesToAdd) - Summary: Adds the specified number of occurrences of the specified element to this multiset.
-
Parameters:
-
e(T) — the element to add -
occurrencesToAdd(int) — the number of occurrences to add; may be negative to remove occurrences
-
- Returns: this builder instance
remove(...) -> MultisetBuilder<T>
-
Signature:
public MultisetBuilder<T> remove(final Object e) - Summary: Removes a single occurrence of the specified element from this multiset, if present.
-
Contract:
- Removes a single occurrence of the specified element from this multiset, if present.
-
Parameters:
-
e(Object) — the element to remove one occurrence of
-
- Returns: this builder instance
-
Signature:
public MultisetBuilder<T> remove(final Object e, final int occurrencesToAdd) - Summary: Removes the specified number of occurrences of the specified element from this multiset.
-
Contract:
- If the multiset contains fewer than this number of occurrences, all occurrences will be removed.
-
Parameters:
-
e(Object) — the element to remove occurrences of -
occurrencesToAdd(int) — the number of occurrences to remove
-
- Returns: this builder instance
removeAll(...) -> MultisetBuilder<T>
-
Signature:
@Deprecated public MultisetBuilder<T> removeAll(final Collection<?> c) - Summary: Removes all occurrences of all elements in the specified collection from this multiset.
-
Parameters:
-
c(Collection<?>) — the collection of elements to remove all occurrences of
-
- Returns: this builder instance
- See also: #removeAllOccurrences(Collection)
removeAllOccurrences(...) -> MultisetBuilder<T>
-
Signature:
public MultisetBuilder<T> removeAllOccurrences(final Object e) - Summary: Removes all occurrences of the specified element from this multiset.
-
Parameters:
-
e(Object) — the element to remove all occurrences of
-
- Returns: this builder instance
-
Signature:
public MultisetBuilder<T> removeAllOccurrences(final Collection<?> c) - Summary: Removes all occurrences of all elements in the specified collection from this multiset.
-
Parameters:
-
c(Collection<?>) — the collection of elements to remove all occurrences of
-
- Returns: this builder instance
Class MapBuilder (com.landawn.abacus.util.Builder.MapBuilder)
Specialized builder for Map that provides fluent methods for adding and removing key-value pairs.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> MapBuilder<K, V, M>
-
Signature:
public MapBuilder<K, V, M> put(final K k, final V v) - Summary: Associates the specified value with the specified key in this map.
-
Contract:
- If the map previously contained a mapping for the key, the old value is replaced.
-
Parameters:
-
k(K) — the key with which the specified value is to be associated -
v(V) — the value to be associated with the specified key
-
- Returns: this builder instance
putAll(...) -> MapBuilder<K, V, M>
-
Signature:
public MapBuilder<K, V, M> putAll(final Map<? extends K, ? extends V> m) - Summary: Copies all of the mappings from the specified map to this map.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the mappings to be stored in this map
-
- Returns: this builder instance
putIfAbsent(...) -> MapBuilder<K, V, M>
-
Signature:
public MapBuilder<K, V, M> putIfAbsent(final K key, final V value) - Summary: Associates the specified value with the specified key in this map if the key is not already associated with a value or is associated with {@code null} .
-
Contract:
- Associates the specified value with the specified key in this map if the key is not already associated with a value or is associated with {@code null} .
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
value(V) — the value to be associated with the specified key
-
- Returns: this builder instance
- See also: Map#putIfAbsent(Object, Object)
-
Signature:
public MapBuilder<K, V, M> putIfAbsent(final K key, final Supplier<V> supplier) - Summary: Associates the value produced by the supplier with the specified key in this map if the key is not already associated with a value or is associated with {@code null} .
-
Contract:
- Associates the value produced by the supplier with the specified key in this map if the key is not already associated with a value or is associated with {@code null} .
- The supplier is only invoked if the value needs to be added.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
supplier(Supplier<V>) — the supplier that produces the value to be associated with the specified key
-
- Returns: this builder instance
- See also: Map#putIfAbsent(Object, Object)
remove(...) -> MapBuilder<K, V, M>
-
Signature:
public MapBuilder<K, V, M> remove(final Object k) - Summary: Removes the mapping for a key from this map if it is present.
-
Contract:
- Removes the mapping for a key from this map if it is present.
-
Parameters:
-
k(Object) — the key whose mapping is to be removed from the map
-
- Returns: this builder instance
removeAll(...) -> MapBuilder<K, V, M>
-
Signature:
public MapBuilder<K, V, M> removeAll(final Collection<?> keysToRemove) - Summary: Removes all mappings for the specified keys from this map if they are present.
-
Contract:
- Removes all mappings for the specified keys from this map if they are present.
- If the collection is empty or {@code null} , no changes are made to the map.
-
Parameters:
-
keysToRemove(Collection<?>) — the collection containing keys to be removed from the map
-
- Returns: this builder instance for method chaining
- See also: #remove(Object), Map#remove(Object)
Class MultimapBuilder (com.landawn.abacus.util.Builder.MultimapBuilder)
Specialized builder for {@link Multimap} that provides fluent methods for adding, removing, and manipulating key-value mappings in a multimap structure.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> MultimapBuilder<K, E, V, M>
-
Signature:
public MultimapBuilder<K, E, V, M> put(final K key, final E e) - Summary: Adds a single key-value mapping to the multimap.
-
Contract:
- If the key already exists, the value is added to the collection associated with that key.
-
Parameters:
-
key(K) — the key to map -
e(E) — the value to add to the collection for this key
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> put(final Map<? extends K, ? extends E> m) - Summary: Adds all key-value mappings from the specified map to the multimap.
-
Parameters:
-
m(Map<? extends K, ? extends E>) — the map containing key-value pairs to add
-
- Returns: this builder instance for method chaining
putMany(...) -> MultimapBuilder<K, E, V, M>
-
Signature:
public MultimapBuilder<K, E, V, M> putMany(final K k, final Collection<? extends E> c) - Summary: Adds multiple values for a single key to the multimap.
-
Parameters:
-
k(K) — the key to map -
c(Collection<? extends E>) — the collection of values to add for this key
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> putMany(final Map<? extends K, ? extends Collection<? extends E>> m) - Summary: Adds multiple key-collection mappings from the specified map to the multimap.
-
Parameters:
-
m(Map<? extends K, ? extends Collection<? extends E>>) — the map containing key-collection pairs to add
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> putMany(final Multimap<? extends K, ? extends E, ? extends V> m) - Summary: Adds all key-value mappings from another multimap to this multimap.
-
Parameters:
-
m(Multimap<? extends K, ? extends E, ? extends V>) — the multimap whose mappings should be added
-
- Returns: this builder instance for method chaining
removeOne(...) -> MultimapBuilder<K, E, V, M>
-
Signature:
public MultimapBuilder<K, E, V, M> removeOne(final Object k, final Object e) - Summary: Removes a single occurrence of the specified key-value mapping from the multimap.
-
Contract:
- If the key-value pair exists multiple times, only one occurrence is removed.
-
Parameters:
-
k(Object) — the key of the mapping to remove -
e(Object) — the value to remove from the key's collection
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> removeOne(final Map<? extends K, ? extends E> m) - Summary: Removes single occurrences of all key-value mappings specified in the map.
-
Contract:
- For each entry, one occurrence of the key-value pair is removed if it exists.
-
Parameters:
-
m(Map<? extends K, ? extends E>) — the map containing key-value pairs to remove
-
- Returns: this builder instance for method chaining
removeAll(...) -> MultimapBuilder<K, E, V, M>
-
Signature:
public MultimapBuilder<K, E, V, M> removeAll(final Object k) - Summary: Removes all values associated with the specified key from the multimap.
-
Parameters:
-
k(Object) — the key whose mappings should be removed
-
- Returns: this builder instance for method chaining
removeMany(...) -> MultimapBuilder<K, E, V, M>
-
Signature:
public MultimapBuilder<K, E, V, M> removeMany(final Object k, final Collection<?> valuesToRemove) - Summary: Removes multiple specific values associated with a key from the multimap.
-
Parameters:
-
k(Object) — the key whose values should be partially removed -
valuesToRemove(Collection<?>) — the collection of values to remove for this key
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> removeMany(final Map<?, ? extends Collection<?>> m) - Summary: Removes multiple values for multiple keys as specified in the map.
-
Parameters:
-
m(Map<?, ? extends Collection<?>>) — the map containing key-collection pairs to remove
-
- Returns: this builder instance for method chaining
-
Signature:
public MultimapBuilder<K, E, V, M> removeMany(final Multimap<?, ?, ?> m) - Summary: Removes all key-value mappings that exist in the specified multimap from this multimap.
-
Contract:
- Each key-value pair in the source multimap is removed from this multimap if present.
-
Parameters:
-
m(Multimap<?, ?, ?>) — the multimap containing mappings to remove
-
- Returns: this builder instance for method chaining
Class DatasetBuilder (com.landawn.abacus.util.Builder.DatasetBuilder)
Specialized builder for {@link Dataset} that provides fluent methods for data manipulation operations such as renaming columns, adding/removing columns, transforming data, and combining datasets.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
renameColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder renameColumn(final String columnName, final String newColumnName) - Summary: Renames a single column in the dataset.
-
Parameters:
-
columnName(String) — the current name of the column -
newColumnName(String) — the new name for the column
-
- Returns: this builder instance for method chaining
renameColumns(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder renameColumns(final Map<String, String> oldNewNames) - Summary: Renames multiple columns in the dataset using a map of old names to new names.
-
Parameters:
-
oldNewNames(Map<String, String>) — a map where keys are current column names and values are new names
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder renameColumns(final Collection<String> columnNames, final Function<? super String, String> func) - Summary: Renames specified columns using a function that transforms column names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to rename -
func(Function<? super String, String>) — the function that transforms old names to new names
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder renameColumns(final Function<? super String, String> func) - Summary: Renames all columns in the dataset using a function that transforms column names.
-
Parameters:
-
func(Function<? super String, String>) — the function that transforms old names to new names
-
- Returns: this builder instance for method chaining
addColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder addColumn(final String columnName, final List<?> column) - Summary: Adds a new column to the dataset at the end with the specified name and values.
-
Contract:
- The size of the column list must match the number of rows in the dataset.
-
Parameters:
-
columnName(String) — the name of the new column -
column(List<?>) — the list of values for the new column
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final int columnIndex, final String columnName, final List<?> column) - Summary: Adds a new column to the dataset at the specified position with the given name and values.
-
Parameters:
-
columnIndex(int) — the position where the column should be inserted (0-based) -
columnName(String) — the name of the new column -
column(List<?>) — the list of values for the new column
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final String newColumnName, final String fromColumnName, final Function<?, ?> func) - Summary: Adds a new column by applying a function to values from an existing column.
-
Parameters:
-
newColumnName(String) — the name of the new column -
fromColumnName(String) — the name of the source column -
func(Function<?, ?>) — the function to transform values from the source column
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final int columnIndex, final String newColumnName, final String fromColumnName, final Function<?, ?> func) - Summary: Adds a new column at a specific position by applying a function to values from an existing column.
-
Parameters:
-
columnIndex(int) — the position where the column should be inserted (0-based) -
newColumnName(String) — the name of the new column -
fromColumnName(String) — the name of the source column -
func(Function<?, ?>) — the function to transform values from the source column
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final String newColumnName, final Collection<String> fromColumnNames, final Function<? super DisposableObjArray, ?> func) - Summary: Adds a new column by applying a function to values from multiple existing columns.
-
Parameters:
-
newColumnName(String) — the name of the new column -
fromColumnNames(Collection<String>) — the names of the source columns -
func(Function<? super DisposableObjArray, ?>) — the function that combines values from source columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final int columnIndex, final String newColumnName, final Collection<String> fromColumnNames, final Function<? super DisposableObjArray, ?> func) - Summary: Adds a new column at a specific position by applying a function to values from multiple columns.
-
Parameters:
-
columnIndex(int) — the position where the column should be inserted (0-based) -
newColumnName(String) — the name of the new column -
fromColumnNames(Collection<String>) — the names of the source columns -
func(Function<? super DisposableObjArray, ?>) — the function that combines values from source columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final String newColumnName, final Tuple2<String, String> fromColumnNames, final BiFunction<?, ?, ?> func) - Summary: Adds a new column by applying a binary function to values from two existing columns.
-
Parameters:
-
newColumnName(String) — the name of the new column -
fromColumnNames(Tuple2<String, String>) — a tuple containing the names of two source columns -
func(BiFunction<?, ?, ?>) — the binary function to combine values from the two columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final int columnIndex, final String newColumnName, final Tuple2<String, String> fromColumnNames, final BiFunction<?, ?, ?> func) - Summary: Adds a new column at a specific position by applying a binary function to values from two columns.
-
Parameters:
-
columnIndex(int) — the position where the column should be inserted (0-based) -
newColumnName(String) — the name of the new column -
fromColumnNames(Tuple2<String, String>) — a tuple containing the names of two source columns -
func(BiFunction<?, ?, ?>) — the binary function to combine values from the two columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final String newColumnName, final Tuple3<String, String, String> fromColumnNames, final TriFunction<?, ?, ?, ?> func) - Summary: Adds a new column by applying a ternary function to values from three existing columns.
-
Parameters:
-
newColumnName(String) — the name of the new column -
fromColumnNames(Tuple3<String, String, String>) — a tuple containing the names of three source columns -
func(TriFunction<?, ?, ?, ?>) — the ternary function to combine values from the three columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder addColumn(final int columnIndex, final String newColumnName, final Tuple3<String, String, String> fromColumnNames, final TriFunction<?, ?, ?, ?> func) - Summary: Adds a new column at a specific position by applying a ternary function to values from three columns.
-
Parameters:
-
columnIndex(int) — the position where the column should be inserted (0-based) -
newColumnName(String) — the name of the new column -
fromColumnNames(Tuple3<String, String, String>) — a tuple containing the names of three source columns -
func(TriFunction<?, ?, ?, ?>) — the ternary function to combine values from the three columns
-
- Returns: this builder instance for method chaining
removeColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder removeColumn(final String columnName) - Summary: Removes a column from the dataset by name.
-
Parameters:
-
columnName(String) — the name of the column to remove
-
- Returns: this builder instance for method chaining
removeColumns(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder removeColumns(final Collection<String> columnNames) - Summary: Removes multiple columns from the dataset by their names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to remove
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder removeColumns(final Predicate<? super String> filter) - Summary: Removes all columns that match the specified predicate condition.
-
Parameters:
-
filter(Predicate<? super String>) — the predicate to test column names; columns returning {@code true} are removed
-
- Returns: this builder instance for method chaining
updateColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder updateColumn(final String columnName, final Function<?, ?> func) - Summary: Updates all values in a column by applying a transformation function.
-
Parameters:
-
columnName(String) — the name of the column to update -
func(Function<?, ?>) — the function to transform each value in the column
-
- Returns: this builder instance for method chaining
updateColumns(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder updateColumns(final Collection<String> columnNames, final IntBiObjFunction<String, ?, ?> func) - Summary: Updates all values in multiple columns by applying the same transformation function.
-
Parameters:
-
columnNames(Collection<String>) — the names of columns to update -
func(IntBiObjFunction<String, ?, ?>) — the function to transform values in the specified columns
-
- Returns: this builder instance for method chaining
- See also: Dataset#updateColumns(Collection, IntBiObjFunction)
convertColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder convertColumn(final String columnName, final Class<?> targetType) - Summary: Converts a column's data type to the specified target type.
-
Parameters:
-
columnName(String) — the name of the column to convert -
targetType(Class<?>) — the target class type for the column values
-
- Returns: this builder instance for method chaining
convertColumns(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder convertColumns(final Map<String, Class<?>> columnTargetTypes) - Summary: Converts multiple columns to their specified target types.
-
Parameters:
-
columnTargetTypes(Map<String, Class<?>>) — a map of column names to their target types
-
- Returns: this builder instance for method chaining
combineColumns(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder combineColumns(final Collection<String> columnNames, final String newColumnName, final Class<?> newColumnClass) - Summary: Combines multiple columns into a single new column of the specified type.
-
Parameters:
-
columnNames(Collection<String>) — the names of columns to combine -
newColumnName(String) — the name of the resulting combined column -
newColumnClass(Class<?>) — the class type of the new column
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder combineColumns(final Collection<String> columnNames, final String newColumnName, final Function<? super DisposableObjArray, ?> combineFunc) - Summary: Combines multiple columns into a single new column using a custom combine function.
-
Parameters:
-
columnNames(Collection<String>) — the names of columns to combine -
newColumnName(String) — the name of the resulting combined column -
combineFunc(Function<? super DisposableObjArray, ?>) — the function that combines values from the source columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder combineColumns(final Tuple2<String, String> columnNames, final String newColumnName, final BiFunction<?, ?, ?> combineFunc) - Summary: Combines two columns into a single new column using a binary function.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a tuple containing the names of two columns to combine -
newColumnName(String) — the name of the resulting combined column -
combineFunc(BiFunction<?, ?, ?>) — the binary function to combine values from the two columns
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder combineColumns(final Tuple3<String, String, String> columnNames, final String newColumnName, final TriFunction<?, ?, ?, ?> combineFunc) - Summary: Combines three columns into a single new column using a ternary function.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — a tuple containing the names of three columns to combine -
newColumnName(String) — the name of the resulting combined column -
combineFunc(TriFunction<?, ?, ?, ?>) — the ternary function to combine values from the three columns
-
- Returns: this builder instance for method chaining
divideColumn(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder divideColumn(final String columnName, final Collection<String> newColumnNames, final Function<?, ? extends List<?>> divideFunc) - Summary: Divides a single column into multiple new columns using a function that returns a list.
-
Parameters:
-
columnName(String) — the name of the column to divide -
newColumnNames(Collection<String>) — the names of the new columns to create -
divideFunc(Function<?, ? extends List<?>>) — the function that splits a value into multiple values
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder divideColumn(final String columnName, final Collection<String> newColumnNames, final BiConsumer<?, Object[]> output) - Summary: Divides a single column into multiple new columns using a consumer that populates an array.
-
Parameters:
-
columnName(String) — the name of the column to divide -
newColumnNames(Collection<String>) — the names of the new columns to create -
output(BiConsumer<?, Object[]>) — the consumer that populates the output array with divided values
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder divideColumn(final String columnName, final Tuple2<String, String> newColumnNames, final BiConsumer<?, Pair<Object, Object>> output) - Summary: Divides a single column into two new columns using a consumer that populates a Pair.
-
Parameters:
-
columnName(String) — the name of the column to divide -
newColumnNames(Tuple2<String, String>) — a tuple containing the names of two new columns -
output(BiConsumer<?, Pair<Object, Object>>) — the consumer that populates the output pair
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder divideColumn(final String columnName, final Tuple3<String, String, String> newColumnNames, final BiConsumer<?, Triple<Object, Object, Object>> output) - Summary: Divides a single column into three new columns using a consumer that populates a Triple.
-
Parameters:
-
columnName(String) — the name of the column to divide -
newColumnNames(Tuple3<String, String, String>) — a tuple containing the names of three new columns -
output(BiConsumer<?, Triple<Object, Object, Object>>) — the consumer that populates the output triple
-
- Returns: this builder instance for method chaining
updateAll(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder updateAll(final Function<?, ?> func) - Summary: Updates all values in the entire dataset by applying a transformation function.
-
Parameters:
-
func(Function<?, ?>) — the function to transform all values in the dataset
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder updateAll(final IntBiObjFunction<String, ?, ?> func) - Summary: Updates all the values in the Dataset.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code datasetBuilder.updateAll((rowIndex, colName, value) -> { if ("status".equals(colName) && value == null) { return "inactive"; } return value; }); } </pre>
-
Parameters:
-
func(IntBiObjFunction<String, ?, ?>) — the function to be applied to each value in the Dataset. It takes the row index, column name, and current value, and returns the new value.
-
- Returns: this builder instance for method chaining
- See also: Dataset#updateAll(IntBiObjFunction)
replaceIf(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder replaceIf(final Predicate<?> predicate, final Object newValue) - Summary: Replaces all values in the dataset that match a predicate with a new value.
-
Parameters:
-
predicate(Predicate<?>) — the condition to test each value -
newValue(Object) — the replacement value for matching elements
-
- Returns: this builder instance for method chaining
-
Signature:
public DatasetBuilder replaceIf(final IntBiObjPredicate<String, ?> predicate, final Object newValue) - Summary: Replaces values in the Dataset that satisfy a specified condition with a new value.
-
Contract:
- <br/> The predicate takes the row index, column name, and each value in the Dataset as input, and returns a boolean indicating whether the value should be replaced.
-
Parameters:
-
predicate(IntBiObjPredicate<String, ?>) — the predicate to test each value in the sheet. It takes the row index, column name, and a value from the Dataset as input, and returns a boolean indicating whether the value should be replaced. -
newValue(Object) — the new value to replace the values that satisfy the condition.
-
- Returns: this builder instance for method chaining
- See also: Dataset#replaceIf(IntBiObjPredicate, Object)
prepend(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder prepend(final Dataset other) - Summary: Prepends the rows from another Dataset to the beginning of this Dataset.
-
Contract:
- The columns of both Datasets must be identical.
-
Parameters:
-
other(Dataset) — the Dataset whose rows should be added at the beginning
-
- Returns: this builder instance for method chaining
- See also: Dataset#prepend(Dataset)
append(...) -> DatasetBuilder
-
Signature:
public DatasetBuilder append(final Dataset other) - Summary: Appends the rows from another Dataset to the end of this Dataset.
-
Contract:
- The columns of both Datasets must be identical.
-
Parameters:
-
other(Dataset) — the Dataset whose rows should be added at the end
-
- Returns: this builder instance for method chaining
- See also: Dataset#append(Dataset)
Class ComparisonBuilder (com.landawn.abacus.util.Builder.ComparisonBuilder)
A builder class for performing chained comparisons between objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
compare(...) -> ComparisonBuilder
-
Signature:
public <T extends Comparable<? super T>> ComparisonBuilder compare(final T left, final T right) - Summary: Compares two comparable objects using their natural ordering.
-
Contract:
- If the result of this comparison chain has not already been determined (i.e., all previous comparisons returned 0), this method compares the two objects using {@link Comparable#compareTo} .
-
Parameters:
-
left(T) — the first object to compare, may be null -
right(T) — the second object to compare, may be null
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public <T> ComparisonBuilder compare(final T left, final T right, final Comparator<T> comparator) throws IllegalArgumentException - Summary: Compares two objects using a specified comparator.
-
Contract:
- If the result of this comparison chain has not already been determined, this method uses the provided comparator to compare the objects.
- <p> If the comparator is {@code null} , the natural ordering is used (objects must implement Comparable).
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare -
comparator(Comparator<T>) — the comparator to use, or {@code null} for natural ordering
-
- Returns: this ComparisonBuilder instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if comparator is {@code null} and objects don't implement Comparable
-
-
Signature:
public ComparisonBuilder compare(final char left, final char right) - Summary: Compares two char values numerically.
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the char values based on their numeric values.
-
Parameters:
-
left(char) — the first char value -
right(char) — the second char value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final byte left, final byte right) - Summary: Compares two byte values numerically.
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the byte values.
-
Parameters:
-
left(byte) — the first byte value -
right(byte) — the second byte value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final short left, final short right) - Summary: Compares two short values numerically.
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the short values.
-
Parameters:
-
left(short) — the first short value -
right(short) — the second short value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final int left, final int right) - Summary: Compares two int values numerically.
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the int values.
-
Parameters:
-
left(int) — the first int value -
right(int) — the second int value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final long left, final long right) - Summary: Compares two long values numerically.
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the long values.
-
Parameters:
-
left(long) — the first long value -
right(long) — the second long value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final float left, final float right) - Summary: Compares two float values as specified by {@link Float#compare} .
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the float values handling NaN and infinity correctly.
-
Parameters:
-
left(float) — the first float value -
right(float) — the second float value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final float left, final float right, final float tolerance) - Summary: Compares two float values using a fuzzy comparison with the given tolerance.
-
Contract:
- <p> Values are considered equal if their absolute difference is less than or equal to the specified tolerance.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare -
tolerance(float) — the maximum difference allowed for the values to be considered equal
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final double left, final double right) - Summary: Compares two double values as specified by {@link Double#compare} .
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the double values handling NaN and infinity correctly.
-
Parameters:
-
left(double) — the first double value -
right(double) — the second double value
-
- Returns: this ComparisonBuilder instance for method chaining
-
Signature:
public ComparisonBuilder compare(final double left, final double right, final double tolerance) - Summary: Compares two double values using a fuzzy comparison with the given tolerance.
-
Contract:
- <p> Values are considered equal if their absolute difference is less than or equal to the specified tolerance.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare -
tolerance(double) — the maximum difference allowed for the values to be considered equal
-
- Returns: this ComparisonBuilder instance for method chaining
compareNullLess(...) -> ComparisonBuilder
-
Signature:
public <T extends Comparable<? super T>> ComparisonBuilder compareNullLess(final T left, final T right) - Summary: Compares two comparable objects with {@code null} values considered less than {@code non-null} values.
-
Parameters:
-
left(T) — the first object to compare, may be null -
right(T) — the second object to compare, may be null
-
- Returns: this ComparisonBuilder instance for method chaining
compareNullBigger(...) -> ComparisonBuilder
-
Signature:
public <T extends Comparable<? super T>> ComparisonBuilder compareNullBigger(final T left, final T right) - Summary: Compares two comparable objects with {@code null} values considered greater than {@code non-null} values.
-
Parameters:
-
left(T) — the first object to compare, may be null -
right(T) — the second object to compare, may be null
-
- Returns: this ComparisonBuilder instance for method chaining
compareFalseLess(...) -> ComparisonBuilder
-
Signature:
public ComparisonBuilder compareFalseLess(final boolean left, final boolean right) - Summary: Compares two boolean values with {@code false} considered less than {@code true} .
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the boolean values.
-
Parameters:
-
left(boolean) — the first boolean value -
right(boolean) — the second boolean value
-
- Returns: this ComparisonBuilder instance for method chaining
compareTrueLess(...) -> ComparisonBuilder
-
Signature:
public ComparisonBuilder compareTrueLess(final boolean left, final boolean right) - Summary: Compares two boolean values with {@code true} considered less than {@code false} .
-
Contract:
- If the result of this comparison chain has not already been determined, this method compares the boolean values.
-
Parameters:
-
left(boolean) — the first boolean value -
right(boolean) — the second boolean value
-
- Returns: this ComparisonBuilder instance for method chaining
result(...) -> int
-
Signature:
public int result() - Summary: Returns the result of the comparison chain.
-
Contract:
- <p> The result follows standard comparison conventions: </p> <ul> <li> Returns 0 if all compared values are equal </li> <li> Returns a negative value if the first value is less than the second </li> <li> Returns a positive value if the first value is greater than the second </li> </ul> <p> <strong> Example: </strong> </p> <p> <b> Usage Examples: </b> </p> <pre> {@code int comparison = ComparisonBuilder.create() .compare(obj1.getName(), obj2.getName()) .compare(obj1.getAge(), obj2.getAge()) .result(); if (comparison < 0) { // obj1 is less than obj2 } else if (comparison > 0) { // obj1 is greater than obj2 } else { // obj1 equals obj2 } } </pre>
-
Parameters:
- (none)
- Returns: 0 if all values are equal; a negative value if the first differing value is less; a positive value if the first differing value is greater
Class EquivalenceBuilder (com.landawn.abacus.util.Builder.EquivalenceBuilder)
A builder class for performing chained equality comparisons between objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
equals(...) -> EquivalenceBuilder
-
Signature:
public EquivalenceBuilder equals(final Object left, final Object right) - Summary: Compares two objects for equality using {@link N#equals(Object, Object)} .
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two objects are equal.
-
Parameters:
-
left(Object) — the first object to compare, may be null -
right(Object) — the second object to compare, may be null
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public <T> EquivalenceBuilder equals(final T left, final T right, final BiPredicate<? super T, ? super T> predicate) throws IllegalArgumentException - Summary: Compares two objects for equality using a custom function.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method uses the provided function to check equality.
-
Parameters:
-
left(T) — the first object to compare -
right(T) — the second object to compare -
predicate(BiPredicate<? super T, ? super T>) — the predicate to check equality, must not be null
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
-
Signature:
public EquivalenceBuilder equals(final boolean left, final boolean right) - Summary: Compares two boolean values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two boolean values are equal.
-
Parameters:
-
left(boolean) — the first boolean value -
right(boolean) — the second boolean value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final char left, final char right) - Summary: Compares two char values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two char values are equal.
-
Parameters:
-
left(char) — the first char value -
right(char) — the second char value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final byte left, final byte right) - Summary: Compares two byte values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two byte values are equal.
-
Parameters:
-
left(byte) — the first byte value -
right(byte) — the second byte value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final short left, final short right) - Summary: Compares two short values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two short values are equal.
-
Parameters:
-
left(short) — the first short value -
right(short) — the second short value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final int left, final int right) - Summary: Compares two int values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two int values are equal.
-
Parameters:
-
left(int) — the first int value -
right(int) — the second int value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final long left, final long right) - Summary: Compares two long values for equality.
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two long values are equal.
-
Parameters:
-
left(long) — the first long value -
right(long) — the second long value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final float left, final float right) - Summary: Compares two float values for equality using {@link Float#compare} .
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two float values are equal.
-
Parameters:
-
left(float) — the first float value -
right(float) — the second float value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final float left, final float right, final float tolerance) - Summary: Compares two float values for equality using fuzzy comparison with the given tolerance.
-
Contract:
- <p> Values are considered equal if their absolute difference is less than or equal to the specified tolerance.
-
Parameters:
-
left(float) — the first float to compare -
right(float) — the second float to compare -
tolerance(float) — the maximum difference allowed for the values to be considered equal
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final double left, final double right) - Summary: Compares two double values for equality using {@link Double#compare} .
-
Contract:
- If the result of this equivalence chain has not already been determined to be {@code false} , this method checks if the two double values are equal.
-
Parameters:
-
left(double) — the first double value -
right(double) — the second double value
-
- Returns: this EquivalenceBuilder instance for method chaining
-
Signature:
public EquivalenceBuilder equals(final double left, final double right, final double tolerance) - Summary: Compares two double values for equality using fuzzy comparison with the given tolerance.
-
Contract:
- <p> Values are considered equal if their absolute difference is less than or equal to the specified tolerance.
-
Parameters:
-
left(double) — the first double to compare -
right(double) — the second double to compare -
tolerance(double) — the maximum difference allowed for the values to be considered equal
-
- Returns: this EquivalenceBuilder instance for method chaining
result(...) -> boolean
-
Signature:
public boolean result() - Summary: Returns the result of the equivalence chain.
-
Contract:
- <p> Returns {@code true} if and only if all comparisons in the chain returned {@code true} .
- If any comparison returned {@code false} , this method returns {@code false} .
- </p> <p> <strong> Example: </strong> </p> <p> <b> Usage Examples: </b> </p> <pre> {@code boolean areEqual = EquivalenceBuilder.create() .equals(obj1.getField1(), obj2.getField1()) .equals(obj1.getField2(), obj2.getField2()) .result(); if (areEqual) { // All fields are equal } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if all values compared are equal, {@code false} otherwise
isEquals(...) -> boolean
-
Signature:
public boolean isEquals() - Summary: Returns the result of the equivalence chain.
-
Contract:
- <p> Returns {@code true} if and only if all comparisons in the chain returned {@code true} .
- If any comparison returned {@code false} , this method returns {@code false} .
- </p> <p> <strong> Example: </strong> </p> <p> <b> Usage Examples: </b> </p> <pre> {@code boolean areEqual = Builder.equals(obj1.getName(), obj2.getName()) .equals(obj1.getAge(), obj2.getAge()) .isEquals(); if (areEqual) { // Objects are considered equal based on compared fields } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if all values compared are equal, {@code false} otherwise
- See also: #result()
Class HashCodeBuilder (com.landawn.abacus.util.Builder.HashCodeBuilder)
A builder class for computing hash codes using the standard Java hash code algorithm.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
hash(...) -> HashCodeBuilder
-
Signature:
public HashCodeBuilder hash(final Object value) - Summary: Adds the hash code of the specified object to the running hash code.
-
Parameters:
-
value(Object) — the object whose hash code should be added, may be null
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public <T> HashCodeBuilder hash(final T value, final ToIntFunction<? super T> func) throws IllegalArgumentException - Summary: Adds a custom hash code for the specified value using the provided function.
-
Parameters:
-
value(T) — the value to hash -
func(ToIntFunction<? super T>) — the function to compute the hash code, must not be null
-
- Returns: this HashCodeBuilder instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
-
Signature:
public HashCodeBuilder hash(final boolean value) - Summary: Adds the hash code of a boolean value to the running hash code.
-
Parameters:
-
value(boolean) — the boolean value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final char value) - Summary: Adds the hash code of a char value to the running hash code.
-
Parameters:
-
value(char) — the char value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final byte value) - Summary: Adds the hash code of a byte value to the running hash code.
-
Parameters:
-
value(byte) — the byte value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final short value) - Summary: Adds the hash code of a short value to the running hash code.
-
Parameters:
-
value(short) — the short value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final int value) - Summary: Adds the hash code of an int value to the running hash code.
-
Parameters:
-
value(int) — the int value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final long value) - Summary: Adds the hash code of a long value to the running hash code.
-
Parameters:
-
value(long) — the long value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final float value) - Summary: Adds the hash code of a float value to the running hash code.
-
Parameters:
-
value(float) — the float value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
-
Signature:
public HashCodeBuilder hash(final double value) - Summary: Adds the hash code of a double value to the running hash code.
-
Parameters:
-
value(double) — the double value to hash
-
- Returns: this HashCodeBuilder instance for method chaining
result(...) -> int
-
Signature:
public int result() - Summary: Returns the computed hash code.
-
Parameters:
- (none)
- Returns: the computed hash code
Class ByteArrayOutputStream (com.landawn.abacus.util.ByteArrayOutputStream)
A high-performance implementation of ByteArrayOutputStream that provides direct access to the internal byte array buffer for efficiency.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ByteArrayOutputStream() - Summary: Creates a new ByteArrayOutputStream with a default initial capacity of 32 bytes.
-
Contract:
- <p> The buffer will grow automatically as needed when data is written.
-
Parameters:
- (none)
-
Signature:
public ByteArrayOutputStream(final int initCapacity) - Summary: Creates a new ByteArrayOutputStream with the specified initial capacity.
-
Contract:
- <p> The buffer will grow automatically as needed when data is written beyond the initial capacity.
-
Parameters:
-
initCapacity(int) — the initial capacity of the buffer
-
write(...) -> void
-
Signature:
@Override public void write(final int b) - Summary: Writes the specified byte to this output stream.
-
Parameters:
-
b(int) — the byte to write (as an int)
-
-
Signature:
@Override public void write(final byte[] b, final int off, final int len) - Summary: Writes a portion of the specified byte array to this output stream.
-
Parameters:
-
b(byte[]) — the byte array containing data to write -
off(int) — the start offset in the data -
len(int) — the number of bytes to write
-
-
Signature:
public void write(final byte b) - Summary: Writes a single byte to this output stream.
-
Parameters:
-
b(byte) — the byte to write
-
writeTo(...) -> void
-
Signature:
public void writeTo(final OutputStream out) throws IOException - Summary: Writes the complete contents of this ByteArrayOutputStream to another output stream.
-
Parameters:
-
out(OutputStream) — the output stream to write to
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
capacity(...) -> int
-
Signature:
public int capacity() - Summary: Returns the current capacity of the internal buffer.
-
Parameters:
- (none)
- Returns: the current capacity, or 0 if the buffer is null
array(...) -> byte\[\]
-
Signature:
public byte[] array() - Summary: Returns a reference to the internal byte array buffer.
-
Contract:
- The returned array should not be modified unless you understand the implications.
-
Parameters:
- (none)
- Returns: the internal byte array buffer
size(...) -> int
-
Signature:
public int size() - Summary: Returns the current size (number of valid bytes) in the buffer.
-
Parameters:
- (none)
- Returns: the number of valid bytes in the buffer
reset(...) -> void
-
Signature:
public void reset() - Summary: Resets this stream to the beginning.
-
Parameters:
- (none)
toByteArray(...) -> byte\[\]
-
Signature:
public byte[] toByteArray() - Summary: Creates a new byte array containing a copy of the valid data.
-
Parameters:
- (none)
- Returns: a new byte array containing the valid data
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Converts the buffer contents to a string using the platform's default charset.
-
Parameters:
- (none)
- Returns: a String decoded from the buffer contents
-
Signature:
public String toString(final String charsetName) throws UnsupportedEncodingException - Summary: Converts the buffer contents to a string using the specified charset.
-
Parameters:
-
charsetName(String) — the name of the charset to use for decoding
-
- Returns: a String decoded from the buffer contents
-
Throws:
-
java.io.UnsupportedEncodingException— if the named charset is not supported
-
-
Signature:
public String toString(final Charset charset) - Summary: Converts the buffer contents to a string using the specified charset.
-
Parameters:
-
charset(Charset) — the charset to use for decoding
-
- Returns: a String decoded from the buffer contents
close(...) -> void
-
Signature:
@SuppressWarnings("RedundantThrows") @Override public void close() throws IOException - Summary: Closing a ByteArrayOutputStream has no effect.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— never thrown, but declared for OutputStream compatibility
-
Class ByteIterator (com.landawn.abacus.util.ByteIterator)
An iterator specialized for primitive byte values, providing better performance than {@code Iterator<Byte>} by avoiding boxing/unboxing overhead.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ByteIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static ByteIterator empty() - Summary: Returns an empty {@code ByteIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code ByteIterator}
of(...) -> ByteIterator
-
Signature:
public static ByteIterator of(final byte... a) - Summary: Creates a {@code ByteIterator} from the specified byte array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(byte[]) — the byte array (may be {@code null} )
-
- Returns: a new {@code ByteIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static ByteIterator of(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code ByteIterator} from a subsequence of the specified byte array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(byte[]) — the byte array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code ByteIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
defer(...) -> ByteIterator
-
Signature:
public static ByteIterator defer(final Supplier<? extends ByteIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Returns a ByteIterator instance created lazily using the provided Supplier.
-
Contract:
- The Supplier is invoked only when the first method of the returned iterator is called.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ByteIterator iter = ByteIterator.defer(() -> ByteIterator.of((byte)1, (byte)2, (byte)3)); // Iterator is not created yet if (iter.hasNext()) { // Supplier is invoked here byte b = iter.nextByte(); } } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends ByteIterator>) — A Supplier that provides the ByteIterator when needed
-
- Returns: A ByteIterator that is initialized on first use
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is {@code null}
-
generate(...) -> ByteIterator
-
Signature:
public static ByteIterator generate(final ByteSupplier supplier) throws IllegalArgumentException - Summary: Returns an infinite {@code ByteIterator} that generates values using the provided supplier.
-
Parameters:
-
supplier(ByteSupplier) — the supplier function that generates byte values
-
- Returns: an infinite {@code ByteIterator}
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is {@code null}
-
-
Signature:
public static ByteIterator generate(final BooleanSupplier hasNext, final ByteSupplier supplier) throws IllegalArgumentException - Summary: Returns a {@code ByteIterator} that generates values using the provided supplier while the hasNext condition returns {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — the condition that determines if more elements are available -
supplier(ByteSupplier) — the supplier function that generates byte values
-
- Returns: a conditional {@code ByteIterator}
-
Throws:
-
java.lang.IllegalArgumentException— if any parameter is {@code null}
-
Public Instance Methods
next(...) -> Byte
-
Signature:
@Deprecated @Override public Byte next() - Summary: Returns the next element as a Byte (boxed).
-
Contract:
- It is provided for compatibility with the Iterator interface but should generally be avoided in favor of {@link #nextByte()} .
-
Parameters:
- (none)
- Returns: the next byte value as a Byte object
nextByte(...) -> byte
-
Signature:
public abstract byte nextByte() - Summary: Returns the next byte value in the iteration.
-
Parameters:
- (none)
- Returns: the next byte value
skip(...) -> ByteIterator
-
Signature:
public ByteIterator skip(final long n) throws IllegalArgumentException - Summary: Returns a new iterator that skips the first n elements of this iterator.
-
Contract:
- If n is 0 or negative (after validation), this iterator is returned unchanged.
- If n is greater than the number of remaining elements, all elements are consumed and the returned iterator will be empty.
-
Parameters:
-
n(long) — the number of elements to skip (must be non-negative)
-
- Returns: a new ByteIterator that skips the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> ByteIterator
-
Signature:
public ByteIterator limit(final long count) throws IllegalArgumentException - Summary: Returns a new iterator that limits the number of elements to at most the specified count.
-
Contract:
- If this iterator has fewer than {@code count} elements remaining, all remaining elements will be included.
- If count is 0, an empty iterator is returned immediately.
-
Parameters:
-
count(long) — the maximum number of elements to iterate (must be non-negative)
-
- Returns: a new ByteIterator limited to at most count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> ByteIterator
-
Signature:
public ByteIterator filter(final BytePredicate predicate) throws IllegalArgumentException - Summary: Returns a new iterator that includes only elements matching the specified predicate.
-
Parameters:
-
predicate(BytePredicate) — the predicate to test each element (must not be {@code null} )
-
- Returns: a new ByteIterator containing only elements that match the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is {@code null}
-
first(...) -> OptionalByte
-
Signature:
public OptionalByte first() - Summary: Returns the first element wrapped in an OptionalByte, or an empty OptionalByte if no elements are available.
-
Contract:
- Returns the first element wrapped in an OptionalByte, or an empty OptionalByte if no elements are available.
- After calling this method, the iterator is positioned at the second element (if it exists).
- If the iterator is empty, an empty OptionalByte is returned.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the first element if present, otherwise empty
last(...) -> OptionalByte
-
Signature:
public OptionalByte last() - Summary: Returns the last element wrapped in an OptionalByte, or an empty OptionalByte if no elements are available.
-
Contract:
- Returns the last element wrapped in an OptionalByte, or an empty OptionalByte if no elements are available.
- If the iterator is empty when this method is called, an empty OptionalByte is returned.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the last element if present, otherwise empty
toArray(...) -> byte\[\]
-
Signature:
@SuppressWarnings("deprecation") public byte[] toArray() - Summary: Converts the remaining elements to a byte array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a byte array containing all remaining elements
toList(...) -> ByteList
-
Signature:
public ByteList toList() - Summary: Converts the remaining elements to a ByteList.
-
Contract:
- If the iterator is already empty, returns an empty ByteList.
-
Parameters:
- (none)
- Returns: a ByteList containing all remaining elements
stream(...) -> ByteStream
-
Signature:
public ByteStream stream() - Summary: Converts this iterator to a ByteStream for functional-style operations.
-
Parameters:
- (none)
- Returns: a sequential ByteStream backed by this iterator
indexed(...) -> ObjIterator<IndexedByte>
-
Signature:
@Beta public ObjIterator<IndexedByte> indexed() - Summary: Returns an iterator of IndexedByte elements, where each byte is paired with its index.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedByte elements with 0-based indexing
-
Signature:
@Beta public ObjIterator<IndexedByte> indexed(final long startIndex) - Summary: Returns an iterator of IndexedByte elements, where each byte is paired with its index starting from the specified value.
-
Contract:
- This is useful when you need custom index numbering, such as when processing a subset of a larger sequence.
-
Parameters:
-
startIndex(long) — the starting index value (must be non-negative)
-
- Returns: an ObjIterator of IndexedByte elements with custom starting index
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Byte> action) - Summary: Performs the given action for each remaining element, with boxing overhead.
-
Parameters:
-
action(java.util.function.Consumer<? super Byte>) — the action to perform on each boxed element
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.ByteConsumer<E> action) throws E - Summary: Performs the given action for each remaining element without boxing overhead.
-
Parameters:
-
action(Throwables.ByteConsumer<E>) — the action to perform on each element (must not be {@code null} )
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntByteConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its 0-based index.
-
Parameters:
-
action(Throwables.IntByteConsumer<E>) — the action to perform on each element and its index (must not be {@code null} )
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is {@code null} -
E— if the action throws an exception
-
Class ByteList (com.landawn.abacus.util.ByteList)
A high-performance, resizable array implementation for primitive byte values that provides specialized operations optimized for byte data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ByteList
-
Signature:
public static ByteList of(final byte... a) - Summary: Creates a new ByteList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(byte[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new ByteList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static ByteList of(final byte[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new ByteList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(byte[]) — the array of byte values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new ByteList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> ByteList
-
Signature:
public static ByteList copyOf(final byte[] a) - Summary: Creates a new ByteList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(byte[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new ByteList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static ByteList copyOf(final byte[] a, final int fromIndex, final int toIndex) - Summary: Creates a new ByteList that is a copy of the specified range within the given array.
-
Parameters:
-
a(byte[]) — the array from which a range is to be copied; must not be {@code null} -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new ByteList containing a copy of the elements in the specified range
range(...) -> ByteList
-
Signature:
public static ByteList range(final byte startInclusive, final byte endExclusive) - Summary: Creates a ByteList containing a sequence of byte values from startInclusive to endExclusive.
-
Contract:
- If startInclusive equals endExclusive, an empty list is returned.
- If startInclusive is greater than endExclusive, the sequence decreases by 1 for each element.
-
Parameters:
-
startInclusive(byte) — the starting value (inclusive) of the sequence -
endExclusive(byte) — the ending value (exclusive) of the sequence
-
- Returns: a new ByteList containing the sequential values
-
Signature:
public static ByteList range(final byte startInclusive, final byte endExclusive, final byte by) - Summary: Creates a ByteList containing a sequence of byte values from startInclusive to endExclusive, with a specified step between consecutive values.
-
Contract:
- The step can be positive or negative, but must not be zero.
- If the step is positive, the sequence increases; if negative, it decreases.
- An empty list is returned if the range cannot be traversed with the given step.
-
Parameters:
-
startInclusive(byte) — the starting value (inclusive) of the sequence -
endExclusive(byte) — the ending value (exclusive) of the sequence -
by(byte) — the step value between consecutive elements; must not be zero
-
- Returns: a new ByteList containing the sequential values with the specified step
rangeClosed(...) -> ByteList
-
Signature:
public static ByteList rangeClosed(final byte startInclusive, final byte endInclusive) - Summary: Creates a ByteList containing a sequence of byte values from startInclusive to endInclusive.
-
Contract:
- If startInclusive equals endInclusive, a list with a single element is returned.
- If startInclusive is greater than endInclusive, the sequence decreases by 1 for each element.
-
Parameters:
-
startInclusive(byte) — the starting value (inclusive) of the sequence -
endInclusive(byte) — the ending value (inclusive) of the sequence
-
- Returns: a new ByteList containing the sequential values including both endpoints
-
Signature:
public static ByteList rangeClosed(final byte startInclusive, final byte endInclusive, final byte by) - Summary: Creates a ByteList containing a sequence of byte values from startInclusive to endInclusive, with a specified step between consecutive values.
-
Contract:
- Both endpoints are included if reachable.
- The step can be positive or negative, but must not be zero.
-
Parameters:
-
startInclusive(byte) — the starting value (inclusive) of the sequence -
endInclusive(byte) — the ending value (inclusive) of the sequence -
by(byte) — the step value between consecutive elements; must not be zero
-
- Returns: a new ByteList containing the sequential values with the specified step
repeat(...) -> ByteList
-
Signature:
public static ByteList repeat(final byte element, final int len) - Summary: Creates a ByteList containing the specified element repeated a given number of times.
-
Contract:
- If len is zero or negative, an empty list is returned.
-
Parameters:
-
element(byte) — the byte value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new ByteList containing len copies of the specified element
random(...) -> ByteList
-
Signature:
public static ByteList random(final int len) - Summary: Creates a ByteList containing random byte values.
-
Parameters:
-
len(int) — the number of random byte values to generate. Must be non-negative.
-
- Returns: a new ByteList containing len random byte values
Public Instance Methods
<init>(...) -> void
-
Signature:
public ByteList() - Summary: Constructs an empty ByteList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public ByteList(final int initialCapacity) - Summary: Constructs an empty ByteList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public ByteList(final byte[] a) - Summary: Constructs a ByteList using the specified array as the backing array for this list.
-
Parameters:
-
a(byte[]) — the array to be used as the backing array for this list; must not be {@code null}
-
-
Signature:
public ByteList(final byte[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a ByteList using the specified array as the backing array with a specific size.
-
Contract:
- The size parameter must not exceed the length of the array.
-
Parameters:
-
a(byte[]) — the array to be used as the backing array for this list; must not be {@code null} -
size(int) — the number of elements from the array to be included in the list. Must be between 0 and a.length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> byte\[\]
-
Signature:
@Beta @Deprecated @Override public byte[] array() - Summary: Returns the underlying byte array backing this list without creating a copy.
-
Contract:
- <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal byte array backing this list
get(...) -> byte
-
Signature:
public byte get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> byte
-
Signature:
public byte set(final int index, final byte e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(byte) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final byte e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- The list will automatically grow if necessary to accommodate the new element.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(byte) — the byte value to be appended to this list
-
-
Signature:
public void add(final int index, final byte e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- The index must be within the range from 0 to size() inclusive.
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted. Must be between 0 and size() inclusive. -
e(byte) — the byte value to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final ByteList c) - Summary: Appends all elements from the specified ByteList to the end of this list.
-
Contract:
- If the specified list is empty, this list remains unchanged.
-
Parameters:
-
c(ByteList) — the ByteList containing elements to be added to this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if any elements were added)
-
Signature:
@Override public boolean addAll(final int index, final ByteList c) - Summary: Inserts all elements from the specified ByteList into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices by the number of elements added).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list. Must be between 0 and size() inclusive. -
c(ByteList) — the ByteList containing elements to be inserted into this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if any elements were added)
-
Signature:
@Override public boolean addAll(final byte[] a) - Summary: Appends all elements from the specified array to the end of this list.
-
Contract:
- If the array is {@code null} or empty, this list remains unchanged.
-
Parameters:
-
a(byte[]) — the array containing elements to be added to this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if any elements were added)
-
Signature:
@Override public boolean addAll(final int index, final byte[] a) - Summary: Inserts all elements from the specified array into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices by the length of the array).
-
Parameters:
-
index(int) — the index at which to insert the first element from the array. Must be between 0 and size() inclusive. -
a(byte[]) — the array containing elements to be inserted into this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if any elements were added)
remove(...) -> boolean
-
Signature:
public boolean remove(final byte e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(byte) — the byte value to be removed from this list
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final byte e) - Summary: Removes all occurrences of the specified element from this list.
-
Contract:
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(byte) — the byte value to be removed from this list
-
- Returns: {@code true} if at least one occurrence of the specified element was removed
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final ByteList c) - Summary: Removes from this list all elements that are contained in the specified ByteList.
-
Parameters:
-
c(ByteList) — the ByteList containing elements to be removed from this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean removeAll(final byte[] a) - Summary: Removes from this list all elements that are contained in the specified array.
-
Parameters:
-
a(byte[]) — the array containing elements to be removed from this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final BytePredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(BytePredicate) — the predicate which returns {@code true} for elements to be removed; must not be {@code null}
-
- Returns: {@code true} if any elements were removed; {@code false} if the list was unchanged
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only the first occurrence of each value.
-
Contract:
- If the list is already sorted, this method uses an optimized algorithm.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicate elements were removed
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final ByteList c) - Summary: Retains only the elements in this list that are contained in the specified ByteList.
-
Parameters:
-
c(ByteList) — the ByteList containing elements to be retained in this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean retainAll(final byte[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(byte[]) — the array containing elements to be retained in this list. Can be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
delete(...) -> byte
-
Signature:
public byte delete(final int index) - Summary: Removes the element at the specified position in this list and returns it.
-
Parameters:
-
index(int) — the index of the element to be removed. Must be between 0 and size()-1.
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes elements at the specified positions from this list.
-
Contract:
- <p> This method is useful for batch removal operations when you have multiple indices to remove.
-
Parameters:
-
indices(int[]) — the indices of elements to remove. Can be {@code null} or empty. Invalid indices (negative or > = size) are ignored.
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes a range of elements from this list.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive) -
toIndex(int) — the index after the last element to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds, or if fromIndex > toIndex
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final ByteList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified ByteList.
-
Contract:
- The size of the list may change if the replacement has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced (inclusive) -
toIndex(int) — the index after the last element to be replaced (exclusive) -
replacement(ByteList) — the ByteList containing elements to insert. Can be {@code null} or empty, in which case the range is simply removed.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds, or if fromIndex > toIndex
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final byte[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified array.
-
Contract:
- The size of the list may change if the replacement array has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced (inclusive) -
toIndex(int) — the index after the last element to be replaced (exclusive) -
replacement(byte[]) — the array containing elements to insert. Can be {@code null} or empty, in which case the range is simply removed.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds, or if fromIndex > toIndex
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final byte oldVal, final byte newVal) - Summary: Replaces all occurrences of the specified value with a new value throughout the list.
-
Parameters:
-
oldVal(byte) — the value to be replaced -
newVal(byte) — the value to replace oldVal
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final ByteUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the specified operator to that element.
-
Parameters:
-
operator(ByteUnaryOperator) — the operator to apply to each element; must not be {@code null}
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final BytePredicate predicate, final byte newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(BytePredicate) — the predicate to test each element; must not be {@code null} -
newValue(byte) — the value to replace matching elements with
-
- Returns: {@code true} if at least one element was replaced; {@code false} if no elements matched
fill(...) -> void
-
Signature:
public void fill(final byte val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(byte) — the value to fill the list with
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final byte val) throws IndexOutOfBoundsException - Summary: Replaces elements in the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled -
toIndex(int) — the index after the last element (exclusive) to be filled -
val(byte) — the value to fill the range with
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds, or if fromIndex > toIndex
-
contains(...) -> boolean
-
Signature:
public boolean contains(final byte valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(byte) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final ByteList c) - Summary: Returns {@code true} if this list contains any element from the specified ByteList.
-
Contract:
- Returns {@code true} if this list contains any element from the specified ByteList.
- This method returns {@code true} if there is at least one element that appears in both lists.
-
Parameters:
-
c(ByteList) — the ByteList to check for common elements. Can be {@code null} .
-
- Returns: {@code true} if this list contains any element from the specified list, {@code false} if either list is empty or null
-
Signature:
@Override public boolean containsAny(final byte[] a) - Summary: Returns {@code true} if this list contains any element from the specified array.
-
Contract:
- Returns {@code true} if this list contains any element from the specified array.
- This method returns {@code true} if there is at least one element that appears in both this list and the array.
-
Parameters:
-
a(byte[]) — the array to check for common elements. Can be {@code null} .
-
- Returns: {@code true} if this list contains any element from the specified array, {@code false} if either this list or the array is empty or null
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final ByteList c) - Summary: Returns {@code true} if this list contains all elements from the specified ByteList.
-
Contract:
- Returns {@code true} if this list contains all elements from the specified ByteList.
- This method returns {@code true} if every element in the specified list is also present in this list.
-
Parameters:
-
c(ByteList) — the ByteList to check for containment. Can be {@code null} .
-
- Returns: {@code true} if this list contains all elements from the specified list, {@code true} if the specified list is {@code null} or empty, {@code false} otherwise
-
Signature:
@Override public boolean containsAll(final byte[] a) - Summary: Returns {@code true} if this list contains all elements from the specified array.
-
Contract:
- Returns {@code true} if this list contains all elements from the specified array.
- This method returns {@code true} if every element in the specified array is also present in this list.
-
Parameters:
-
a(byte[]) — the array to check for containment. Can be {@code null} .
-
- Returns: {@code true} if this list contains all elements from the specified array, {@code true} if the specified array is {@code null} or empty, {@code false} otherwise
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final ByteList c) - Summary: Returns {@code true} if this list and the specified ByteList have no elements in common.
-
Contract:
- Returns {@code true} if this list and the specified ByteList have no elements in common.
- Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(ByteList) — the ByteList to check for common elements. Can be {@code null} .
-
- Returns: {@code true} if the two lists have no elements in common, {@code true} if either list is {@code null} or empty, {@code false} otherwise
-
Signature:
@Override public boolean disjoint(final byte[] b) - Summary: Returns {@code true} if this list and the specified array have no elements in common.
-
Contract:
- Returns {@code true} if this list and the specified array have no elements in common.
- This list and the array are disjoint if they share no common elements.
-
Parameters:
-
b(byte[]) — the array to check for common elements. Can be {@code null} .
-
- Returns: {@code true} if this list and the array have no elements in common, {@code true} if either this list or the array is {@code null} or empty, {@code false} otherwise
intersection(...) -> ByteList
-
Signature:
@Override public ByteList intersection(final ByteList b) - Summary: Returns a new ByteList containing the intersection of this list and the specified list.
-
Parameters:
-
b(ByteList) — the list to intersect with this list. Can be {@code null} .
-
- Returns: a new ByteList containing the intersection of the two lists. Returns an empty list if either list is {@code null} or empty.
- See also: #difference(ByteList), #symmetricDifference(ByteList)
-
Signature:
@Override public ByteList intersection(final byte[] b) - Summary: Returns a new ByteList containing the intersection of this list and the specified array.
-
Parameters:
-
b(byte[]) — the array to intersect with this list. Can be {@code null} .
-
- Returns: a new ByteList containing the intersection of this list and the array. Returns an empty list if the array is {@code null} or empty.
- See also: #difference(byte\[\]), #symmetricDifference(byte\[\])
difference(...) -> ByteList
-
Signature:
@Override public ByteList difference(final ByteList b) - Summary: Returns a new ByteList containing elements that are in this list but not in the specified list.
-
Contract:
- If an element appears m times in this list and n times in the specified list, the result will contain max(0, m-n) occurrences of that element.
-
Parameters:
-
b(ByteList) — the list containing elements to be excluded. Can be {@code null} .
-
- Returns: a new ByteList containing elements in this list but not in the specified list. Returns a copy of this list if the specified list is {@code null} or empty.
- See also: #intersection(ByteList), #symmetricDifference(ByteList)
-
Signature:
@Override public ByteList difference(final byte[] b) - Summary: Returns a new ByteList containing elements that are in this list but not in the specified array.
-
Contract:
- If an element appears m times in this list and n times in the array, the result will contain max(0, m-n) occurrences of that element.
-
Parameters:
-
b(byte[]) — the array containing elements to be excluded. Can be {@code null} .
-
- Returns: a new ByteList containing elements in this list but not in the specified array. Returns a copy of this list if the array is {@code null} or empty.
- See also: #intersection(byte\[\]), #symmetricDifference(byte\[\])
symmetricDifference(...) -> ByteList
-
Signature:
@Override public ByteList symmetricDifference(final ByteList b) - Summary: Returns a new ByteList containing the symmetric difference between this list and the specified list.
-
Parameters:
-
b(ByteList) — the list to compare with this list. Can be {@code null} .
-
- Returns: a new ByteList containing elements that are in either list but not in both. Returns a copy of this list if the specified list is {@code null} or empty.
- See also: #difference(ByteList), #intersection(ByteList)
-
Signature:
@Override public ByteList symmetricDifference(final byte[] b) - Summary: Returns a new ByteList containing the symmetric difference between this list and the specified array.
-
Parameters:
-
b(byte[]) — the array to compare with this list. Can be {@code null} .
-
- Returns: a new ByteList containing elements that are in either this list or the array but not in both. Returns a copy of this list if the array is {@code null} or empty, or a new list containing the array elements if this list is empty.
- See also: #difference(byte\[\]), #intersection(byte\[\])
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final byte valueToFind) - Summary: Returns the number of times the specified value appears in this list.
-
Parameters:
-
valueToFind(byte) — the value to count occurrences of
-
- Returns: the number of times the specified value appears in this list; 0 if the value is not found
indexOf(...) -> int
-
Signature:
public int indexOf(final byte valueToFind) - Summary: Returns the index of the first occurrence of the specified value in this list.
-
Parameters:
-
valueToFind(byte) — the value to search for
-
- Returns: the index of the first occurrence of the specified value, or -1 if the value is not found
-
Signature:
public int indexOf(final byte valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified value in this list, starting the search at the specified index.
-
Parameters:
-
valueToFind(byte) — the value to search for -
fromIndex(int) — the index to start searching from (inclusive). If negative, it is treated as 0.
-
- Returns: the index of the first occurrence of the specified value at or after fromIndex, or -1 if the value is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final byte valueToFind) - Summary: Returns the index of the last occurrence of the specified value in this list.
-
Parameters:
-
valueToFind(byte) — the value to search for
-
- Returns: the index of the last occurrence of the specified value, or -1 if the value is not found
-
Signature:
public int lastIndexOf(final byte valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified value in this list, searching backwards from the specified index.
-
Contract:
- The search includes the element at startIndexFromBack if it is within bounds.
-
Parameters:
-
valueToFind(byte) — the value to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). If greater than or equal to size, it is treated as size-1.
-
- Returns: the index of the last occurrence of the specified value at or before startIndexFromBack, or -1 if the value is not found
min(...) -> OptionalByte
-
Signature:
public OptionalByte min() - Summary: Returns the minimum value in this list wrapped in an OptionalByte.
-
Contract:
- If the list is empty, returns an empty OptionalByte.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the minimum value, or an empty OptionalByte if the list is empty
-
Signature:
public OptionalByte min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum value in the specified range of this list wrapped in an OptionalByte.
-
Contract:
- If the range is empty, returns an empty OptionalByte.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to consider -
toIndex(int) — the index after the last element (exclusive) to consider
-
- Returns: an OptionalByte containing the minimum value in the range, or an empty OptionalByte if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds, or if fromIndex > toIndex
-
max(...) -> OptionalByte
-
Signature:
public OptionalByte max() - Summary: Returns the maximum value in this list wrapped in an OptionalByte.
-
Contract:
- If the list is empty, returns an empty OptionalByte.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the maximum value, or an empty OptionalByte if the list is empty
-
Signature:
public OptionalByte max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds and returns the maximum byte value within the specified range of this list.
-
Contract:
- If the range is empty (fromIndex == toIndex), an empty OptionalByte is returned.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to search -
toIndex(int) — the ending index (exclusive) of the range to search
-
- Returns: an OptionalByte containing the maximum value if the range is non-empty, or an empty OptionalByte if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
median(...) -> OptionalByte
-
Signature:
public OptionalByte median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the median value if the list is non-empty, or an empty OptionalByte if the list is empty
-
Signature:
public OptionalByte median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalByte containing the median value if the range is non-empty, or an empty OptionalByte if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final ByteConsumer action) - Summary: Performs the given action for each element in this list in sequential order.
-
Parameters:
-
action(ByteConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final ByteConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element within the specified range of this list.
-
Contract:
- <p> This method supports both forward and backward iteration based on the relative values of fromIndex and toIndex: </p> <ul> <li> If {@code fromIndex <= toIndex} : iterates forward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code fromIndex > toIndex} : iterates backward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code toIndex == -1} : treated as backward iteration from fromIndex to the beginning of the list </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code list.forEach(0, 5, action); // Forward: processes indices 0,1,2,3,4 list.forEach(5, 0, action); // Backward: processes indices 5,4,3,2,1 list.forEach(5, -1, action); // Backward: processes indices 5,4,3,2,1,0 } </pre>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for backward iteration to the start -
action(ByteConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
first(...) -> OptionalByte
-
Signature:
public OptionalByte first() - Summary: Returns the first element of this list wrapped in an OptionalByte.
-
Contract:
- If the list is empty, it returns an empty OptionalByte rather than throwing an exception.
- This is useful when you want to safely check for and retrieve the first element without explicit size checking.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the first element if the list is non-empty, or an empty OptionalByte if the list is empty
last(...) -> OptionalByte
-
Signature:
public OptionalByte last() - Summary: Returns the last element of this list wrapped in an OptionalByte.
-
Contract:
- If the list is empty, it returns an empty OptionalByte rather than throwing an exception.
- This is useful when you want to safely check for and retrieve the last element without explicit size checking.
-
Parameters:
- (none)
- Returns: an OptionalByte containing the last element if the list is non-empty, or an empty OptionalByte if the list is empty
distinct(...) -> ByteList
-
Signature:
@Override public ByteList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new ByteList containing only the distinct elements from the specified range of this list.
-
Contract:
- </p> <p> For example, if the range contains \[1, 2, 2, 3, 1, 4\], the returned list will contain \[1, 2, 3, 4\].
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to process -
toIndex(int) — the ending index (exclusive) of the range to process
-
- Returns: a new ByteList containing only distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> The time complexity is O(n) for small ranges using a boolean array for tracking seen values, where n is the size of the range.
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains any duplicate elements.
-
Contract:
- <p> This method scans through all elements in the list and returns {@code true} if any element appears more than once.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains at least one duplicate element, {@code false} otherwise
- Performance: It uses an efficient algorithm that typically completes in O(n) time for byte values by using a boolean array to track seen values.
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Contract:
- <p> This method verifies if each element in the list is less than or equal to the next element, treating bytes as signed values (-128 to 127).
-
Parameters:
- (none)
- Returns: {@code true} if the list is sorted in ascending order, {@code false} otherwise
- Performance: </p> <p> The check is performed in O(n) time by comparing adjacent elements.
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts all elements in this list in ascending order.
-
Parameters:
- (none)
- Performance: </p> <p> The sorting algorithm used is optimized for primitive arrays and typically performs in O(n log n) time.
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts all elements in this list in ascending order using a parallel sorting algorithm.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts all elements in this list in descending order.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final byte valueToFind) - Summary: Searches for the specified byte value in this sorted list using binary search algorithm.
-
Contract:
- If the list is not sorted, the results are undefined.
- </p> <p> The method returns the index of the search key if it is contained in the list.
- If the key is not found, it returns {@code (-(insertion point) - 1)} , where insertion point is the index at which the key would be inserted to maintain sorted order.
-
Parameters:
-
valueToFind(byte) — the byte value to search for
-
- Returns: the index of the search key if found; otherwise, {@code (-(insertion point) - 1)}
- Performance: The binary search algorithm provides O(log n) performance, making it much faster than linear search for large sorted lists.
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final byte valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified byte value within a range of this sorted list using binary search.
-
Contract:
- The range must be sorted in ascending order before calling this method, or the results are undefined.
- </p> <p> Like the full-list binary search, this returns the index if found, or {@code (-(insertion point) - 1)} if not found.
- </p> <p> This method is useful when you know the value you're searching for is likely to be in a specific portion of a large sorted list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to search -
toIndex(int) — the ending index (exclusive) of the range to search -
valueToFind(byte) — the byte value to search for
-
- Returns: the index of the search key if found; otherwise, {@code (-(insertion point) - 1)}
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
- Performance: </p> <p> The operation is performed in O(n/2) time, where n is the size of the list.
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements within the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to reverse -
toIndex(int) — the ending index (exclusive) of the range to reverse
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles all elements in this list.
-
Parameters:
- (none)
- Performance: The shuffle is performed in-place using the Fisher-Yates algorithm, which runs in O(n) time.
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles all elements in this list using the specified random number generator.
-
Parameters:
-
rnd(Random) — the random number generator to use for shuffling
-
- Performance: This allows you to control the randomness source, which is useful for: </p> <ul> <li> Reproducible shuffles using a seeded Random </li> <li> Cryptographically strong randomness using SecureRandom </li> <li> Custom random number generators </li> </ul> <p> The shuffle is performed in-place using the Fisher-Yates algorithm in O(n) time.
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Contract:
- If {@code i} and {@code j} are equal, the list is unchanged.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> ByteList
-
Signature:
@Override public ByteList copy() - Summary: Creates and returns a copy of this entire list.
-
Parameters:
- (none)
- Returns: a new ByteList containing all elements from this list
-
Signature:
@Override public ByteList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates and returns a copy of the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy
-
- Returns: a new ByteList containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public ByteList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Creates and returns a copy of elements from the specified range with the given step.
-
Contract:
- </p> <p> The step parameter determines the direction and stride: </p> <ul> <li> Positive step: moves forward through the list </li> <li> Negative step: moves backward through the list </li> <li> Step magnitude > 1: skips elements </li> </ul> <p> Special handling for reverse iteration: if {@code fromIndex > toIndex} , the indices are automatically adjusted, and if {@code toIndex == -1} , it's treated as reverse iteration to the start of the list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for reverse iteration to start -
step(int) — the step size (positive for forward, negative for backward)
-
- Returns: a new ByteList containing the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
- See also: N#copyOfRange(byte\[\], int, int, int)
split(...) -> List<ByteList>
-
Signature:
@Override public List<ByteList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into multiple consecutive sublists of the specified size.
-
Contract:
- The last chunk may be smaller if the range size is not evenly divisible by the chunk size.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to split -
toIndex(int) — the ending index (exclusive) of the range to split -
chunkSize(int) — the desired size of each chunk (must be positive)
-
- Returns: a List of ByteList objects, each containing a chunk of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
trimToSize(...) -> ByteList
-
Signature:
@Override public ByteList trimToSize() - Summary: Trims the internal array to the current size of the list.
-
Contract:
- This is useful after a large number of removals or when you know the list size won't increase significantly.
-
Parameters:
- (none)
- Returns: this ByteList instance (for method chaining)
- Performance: This is an O(n) operation where n is the current size of the list.
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Byte>
-
Signature:
@Override public List<Byte> boxed() - Summary: Returns a List containing boxed Byte objects for all elements in this list.
-
Contract:
- This is useful when you need to interface with APIs that require object types rather than primitives.
-
Parameters:
- (none)
- Returns: a new List < Byte > containing boxed versions of all elements
-
Signature:
@Override public List<Byte> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a List containing boxed Byte objects for elements in the specified range.
-
Contract:
- </p> <p> This is useful when you need to: </p> <ul> <li> Pass a subset of values to APIs requiring object types </li> <li> Create a mutable List < Byte > from a range of primitive values </li> <li> Interface with collections frameworks that don't support primitives </li> </ul>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to box -
toIndex(int) — the ending index (exclusive) of the range to box
-
- Returns: a new List < Byte > containing boxed versions of the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toArray(...) -> byte\[\]
-
Signature:
@Override public byte[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new byte array containing all elements of this list
toIntList(...) -> IntList
-
Signature:
public IntList toIntList() - Summary: Converts this ByteList to an IntList.
-
Contract:
- </p> <p> This conversion is useful when you need to: </p> <ul> <li> Perform arithmetic operations that might overflow byte range </li> <li> Interface with APIs that work with int values </li> <li> Avoid repeated byte-to-int conversions in calculations </li> </ul> <p> Note: This creates a new list with a larger memory footprint (4 bytes per element instead of 1 byte).
-
Parameters:
- (none)
- Returns: a new IntList containing all elements from this list converted to int values
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Byte>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of elements to include -
toIndex(int) — the ending index (exclusive) of elements to include -
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance given the required size
-
- Returns: a new Collection containing boxed elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Byte>
-
Signature:
@Override public Multiset<Byte> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Byte>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of elements to include -
toIndex(int) — the ending index (exclusive) of elements to include -
supplier(IntFunction<Multiset<Byte>>) — a function that creates a new Multiset instance given the required size
-
- Returns: a new Multiset containing elements from the specified range with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
iterator(...) -> ByteIterator
-
Signature:
@Override public ByteIterator iterator() - Summary: Returns an iterator over all elements in this list.
-
Contract:
- </p> <p> The returned iterator: </p> <ul> <li> Iterates elements in index order (0 to size-1) </li> <li> Returns an empty iterator if the list is empty </li> <li> Does not support element removal </li> <li> Fails fast if the list is structurally modified during iteration </li> </ul>
-
Parameters:
- (none)
- Returns: a ByteIterator over all elements in this list
stream(...) -> ByteStream
-
Signature:
public ByteStream stream() - Summary: Returns a ByteStream with this list as its source.
-
Parameters:
- (none)
- Returns: a ByteStream over all elements in this list
-
Signature:
public ByteStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a ByteStream for the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) for the stream -
toIndex(int) — the ending index (exclusive) for the stream
-
- Returns: a ByteStream over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
getFirst(...) -> byte
-
Signature:
public byte getFirst() - Summary: Returns the first element in this list.
-
Contract:
- Unlike {@link #first()} , this method throws an exception if the list is empty, making it suitable when you know the list is non-empty or want to fail fast.
-
Parameters:
- (none)
- Returns: the first byte value in the list
getLast(...) -> byte
-
Signature:
public byte getLast() - Summary: Returns the last element in this list.
-
Contract:
- Unlike {@link #last()} , this method throws an exception if the list is empty, making it suitable when you know the list is non-empty or want to fail fast.
-
Parameters:
- (none)
- Returns: the last byte value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final byte e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(byte) — the byte value to add at the beginning
-
- Performance: </p> <p> Note: This operation requires shifting all existing elements and has O(n) time complexity.
addLast(...) -> void
-
Signature:
public void addLast(final byte e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(byte) — the byte value to add at the end
-
removeFirst(...) -> byte
-
Signature:
public byte removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the byte value that was removed from the beginning
- Performance: </p> <p> Note: This operation requires shifting all remaining elements and has O(n) time complexity.
removeLast(...) -> byte
-
Signature:
public byte removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the byte value that was removed from the end
- Performance: Unlike removing from the beginning, this operation is O(1) as no elements need to be shifted.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this list.
-
Contract:
- Two ByteLists are guaranteed to have the same hash code if they contain the same elements in the same order.
- </p> <p> Note: The hash code will change if the list is modified.
-
Parameters:
- (none)
- Returns: a hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this list with the specified object for equality.
-
Contract:
- <p> Returns {@code true} if and only if the specified object is also a ByteList, both lists have the same size, and all corresponding pairs of elements are equal.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class ByteSummaryStatistics (com.landawn.abacus.util.ByteSummaryStatistics)
A state object for collecting statistics such as count, min, max, sum, and average for a stream of byte values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ByteSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, {@code Byte.MAX_VALUE} min, and {@code Byte.MIN_VALUE} max.
-
Parameters:
- (none)
-
Signature:
public ByteSummaryStatistics(final long count, final byte min, final byte max, final long sum) - Summary: Constructs an instance with the specified initial values.
-
Contract:
- <p> This constructor is useful when creating a summary from pre-calculated statistics or when merging multiple summaries.
-
Parameters:
-
count(long) — the count of values -
min(byte) — the minimum value -
max(byte) — the maximum value -
sum(long) — the sum of all values
-
accept(...) -> void
-
Signature:
@Override public void accept(final byte value) - Summary: Records a new byte value into the summary statistics.
-
Parameters:
-
value(byte) — the byte value to record
-
combine(...) -> void
-
Signature:
public void combine(final ByteSummaryStatistics other) - Summary: Combines the state of another {@code ByteSummaryStatistics} into this one.
-
Contract:
- <p> This method is useful when parallelizing statistics collection or when merging statistics from multiple sources.
-
Parameters:
-
other(ByteSummaryStatistics) — another {@code ByteSummaryStatistics} to combine with this one
-
getMin(...) -> byte
-
Signature:
public final byte getMin() - Summary: Returns the minimum value recorded, or {@code Byte.MAX_VALUE} if no values have been recorded.
-
Contract:
- Returns the minimum value recorded, or {@code Byte.MAX_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the minimum value, or {@code Byte.MAX_VALUE} if none
getMax(...) -> byte
-
Signature:
public final byte getMax() - Summary: Returns the maximum value recorded, or {@code Byte.MIN_VALUE} if no values have been recorded.
-
Contract:
- Returns the maximum value recorded, or {@code Byte.MIN_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the maximum value, or {@code Byte.MIN_VALUE} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> Long
-
Signature:
public final Long getSum() - Summary: Returns the sum of values recorded.
-
Parameters:
- (none)
- Returns: the sum of values, as a {@code Long}
getAverage(...) -> Double
-
Signature:
public final Double getAverage() - Summary: Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values, or zero if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this summary, including all statistics.
-
Parameters:
- (none)
- Returns: a string representation of this summary
Enum CalendarField (com.landawn.abacus.util.CalendarField)
An enumeration representing the various calendar fields used for date and time manipulation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> CalendarField
-
Signature:
public static CalendarField of(final int intValue) - Summary: Returns the CalendarField enum constant corresponding to the given Calendar field value.
-
Parameters:
-
intValue(int) — the Calendar field constant value to convert
-
- Returns: the corresponding CalendarField enum constant, never {@code null}
- See also: Calendar, #value(), #valueOf(int)
valueOf(...) -> CalendarField
-
Signature:
@Deprecated public static CalendarField valueOf(final int intValue) - Summary: Returns the CalendarField enum constant corresponding to the given Calendar field value.
-
Parameters:
-
intValue(int) — the Calendar field constant value to convert
-
- Returns: the corresponding CalendarField enum constant, never {@code null}
- See also: #of(int)
Public Instance Methods
value(...) -> int
-
Signature:
public int value() - Summary: Returns the Calendar field constant value for this CalendarField.
-
Parameters:
- (none)
- Returns: the Calendar field constant value (an integer between 1 and 14)
- See also: Calendar#get(int), Calendar#set(int, int), Calendar#add(int, int), Calendar#roll(int, int), #of(int)
Class CharIterator (com.landawn.abacus.util.CharIterator)
An iterator specialized for primitive char values, providing better performance than {@code Iterator<Character>} by avoiding boxing/unboxing overhead.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> CharIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static CharIterator empty() - Summary: Returns an empty {@code CharIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code CharIterator}
of(...) -> CharIterator
-
Signature:
public static CharIterator of(final char... a) - Summary: Creates a {@code CharIterator} from the specified char array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(char[]) — the char array (may be {@code null} )
-
- Returns: a new {@code CharIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static CharIterator of(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code CharIterator} from a subsequence of the specified char array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(char[]) — the char array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code CharIterator} over the specified range, or an empty iterator if the array is {@code null} or the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > a.length} or {@code fromIndex > toIndex}
-
defer(...) -> CharIterator
-
Signature:
public static CharIterator defer(final Supplier<? extends CharIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Returns a {@code CharIterator} instance created lazily using the provided Supplier.
-
Contract:
- <p> The Supplier is invoked only when the first method ( {@code hasNext()} or {@code nextChar()} ) of the returned iterator is called.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code CharIterator iter = CharIterator.defer(() -> CharIterator.of('a', 'b', 'c')); // Iterator is not created yet if (iter.hasNext()) { // Supplier is invoked here char ch = iter.nextChar(); } } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends CharIterator>) — a Supplier that provides the CharIterator when needed, must not be {@code null}
-
- Returns: a {@code CharIterator} that is initialized on first use
-
Throws:
-
java.lang.IllegalArgumentException— if {@code iteratorSupplier} is {@code null}
-
generate(...) -> CharIterator
-
Signature:
public static CharIterator generate(final CharSupplier supplier) throws IllegalArgumentException - Summary: Returns an infinite {@code CharIterator} that generates values using the provided supplier.
-
Contract:
- Be careful when using methods that consume all elements (like {@code toArray()} or {@code toList()} ), as they will never terminate and will eventually cause an {@code OutOfMemoryError} .
-
Parameters:
-
supplier(CharSupplier) — the supplier function that generates char values, must not be {@code null}
-
- Returns: an infinite {@code CharIterator}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
-
Signature:
public static CharIterator generate(final BooleanSupplier hasNext, final CharSupplier supplier) throws IllegalArgumentException - Summary: Returns a {@code CharIterator} that generates values using the provided supplier while the {@code hasNext} condition returns {@code true} .
-
Contract:
- <p> Each call to the iterator's {@code hasNext()} method will invoke the provided {@code hasNext} supplier to determine if more elements are available.
- If it returns {@code true} , the {@code supplier} will be invoked to generate the next value.
- </p> <p> Note: The {@code hasNext} supplier may be called multiple times for the same element (once by the user, once internally for validation), so it should be idempotent or designed to handle multiple calls.
-
Parameters:
-
hasNext(BooleanSupplier) — the condition that determines if more elements are available, must not be {@code null} -
supplier(CharSupplier) — the supplier function that generates char values, must not be {@code null}
-
- Returns: a conditional {@code CharIterator}
-
Throws:
-
java.lang.IllegalArgumentException— if any parameter is {@code null}
-
Public Instance Methods
next(...) -> Character
-
Signature:
@Deprecated @Override public Character next() - Summary: Returns the next element as a boxed {@code Character} .
-
Parameters:
- (none)
- Returns: the next char value as a {@code Character} object
nextChar(...) -> char
-
Signature:
public abstract char nextChar() - Summary: Returns the next char value in the iteration.
-
Parameters:
- (none)
- Returns: the next char value
skip(...) -> CharIterator
-
Signature:
public CharIterator skip(final long n) throws IllegalArgumentException - Summary: Skips the first {@code n} elements from this iterator and returns a new iterator.
-
Parameters:
-
n(long) — the number of elements to skip, must be non-negative
-
- Returns: this iterator if n is 0, otherwise a new CharIterator with n elements skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> CharIterator
-
Signature:
public CharIterator limit(final long count) throws IllegalArgumentException - Summary: Limits this iterator to return at most the specified number of elements.
-
Parameters:
-
count(long) — the maximum number of elements to return, must be non-negative
-
- Returns: an empty iterator if count is 0, otherwise a new CharIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> CharIterator
-
Signature:
public CharIterator filter(final CharPredicate predicate) throws IllegalArgumentException - Summary: Filters elements based on the given predicate.
-
Parameters:
-
predicate(CharPredicate) — the predicate to test elements
-
- Returns: a new CharIterator containing only elements that match the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalChar
-
Signature:
public OptionalChar first() - Summary: Returns the first element wrapped in an {@code OptionalChar} , or an empty {@code OptionalChar} if no elements are available.
-
Contract:
- Returns the first element wrapped in an {@code OptionalChar} , or an empty {@code OptionalChar} if no elements are available.
- <p> This method consumes the first element from the iterator if present.
- After calling this method, the iterator will be positioned at the second element (if it exists).
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing the first element, or {@code OptionalChar.empty()} if the iterator is empty
last(...) -> OptionalChar
-
Signature:
public OptionalChar last() - Summary: Returns the last element wrapped in an {@code OptionalChar} , or an empty {@code OptionalChar} if no elements are available.
-
Contract:
- Returns the last element wrapped in an {@code OptionalChar} , or an empty {@code OptionalChar} if no elements are available.
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing the last element, or {@code OptionalChar.empty()} if the iterator is empty
toArray(...) -> char\[\]
-
Signature:
@SuppressWarnings("deprecation") public char[] toArray() - Summary: Converts the remaining elements to a char array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a char array containing all remaining elements
toList(...) -> CharList
-
Signature:
public CharList toList() - Summary: Converts the remaining elements to a CharList.
-
Contract:
- If the iterator is already empty, returns an empty CharList.
-
Parameters:
- (none)
- Returns: a CharList containing all remaining elements
stream(...) -> CharStream
-
Signature:
public CharStream stream() - Summary: Converts this iterator to a {@code CharStream} .
-
Contract:
- Once the stream is created, the iterator should not be used directly to avoid unpredictable behavior.
-
Parameters:
- (none)
- Returns: a {@code CharStream} backed by this iterator
indexed(...) -> ObjIterator<IndexedChar>
-
Signature:
@Beta public ObjIterator<IndexedChar> indexed() - Summary: Returns an iterator of {@code IndexedChar} elements, where each character is paired with its index.
-
Parameters:
- (none)
- Returns: an {@code ObjIterator} of {@code IndexedChar} elements with indices starting from 0
-
Signature:
@Beta public ObjIterator<IndexedChar> indexed(final long startIndex) - Summary: Returns an iterator of {@code IndexedChar} elements, where each character is paired with its index.
-
Contract:
- This is useful when you need custom index numbering (e.g., starting from 1 instead of 0, or continuing from a previous count).
-
Parameters:
-
startIndex(long) — the starting index value, must not be negative
-
- Returns: an {@code ObjIterator} of {@code IndexedChar} elements with indices starting from {@code startIndex}
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Character> action) - Summary: Performs the given action for each remaining element.
-
Parameters:
-
action(java.util.function.Consumer<? super Character>) — the action to perform on each element, must not be {@code null}
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.CharConsumer<E> action) throws E - Summary: Performs the given action for each remaining element without boxing overhead.
-
Parameters:
-
action(Throwables.CharConsumer<E>) — the action to perform on each element, must not be {@code null}
-
-
Throws:
-
E— if the action throws an exception during processing
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntCharConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its index.
-
Parameters:
-
action(Throwables.IntCharConsumer<E>) — the action to perform on each element and its index, must not be {@code null}
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception during processing
-
Class CharList (com.landawn.abacus.util.CharList)
A high-performance, resizable array implementation for primitive char values that provides specialized operations optimized for character data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> CharList
-
Signature:
public static CharList of(final char... a) - Summary: Creates a new CharList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(char[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new CharList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static CharList of(final char[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new CharList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(char[]) — the array of char values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new CharList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> CharList
-
Signature:
public static CharList copyOf(final char[] a) - Summary: Creates a new CharList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(char[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new CharList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static CharList copyOf(final char[] a, final int fromIndex, final int toIndex) - Summary: Creates a new CharList that is a copy of the specified range within the given array.
-
Parameters:
-
a(char[]) — the array from which a range is to be copied; must not be {@code null} -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new CharList containing a copy of the elements in the specified range
range(...) -> CharList
-
Signature:
public static CharList range(final char startInclusive, final char endExclusive) - Summary: Creates a CharList containing a sequence of char values from startInclusive (inclusive) to endExclusive (exclusive).
-
Parameters:
-
startInclusive(char) — the starting value (inclusive) -
endExclusive(char) — the ending value (exclusive)
-
- Returns: a new CharList containing the range of values
-
Signature:
public static CharList range(final char startInclusive, final char endExclusive, final int by) - Summary: Creates a CharList containing a sequence of char values from startInclusive (inclusive) to endExclusive (exclusive), incrementing by the specified step.
-
Parameters:
-
startInclusive(char) — the starting value (inclusive) -
endExclusive(char) — the ending value (exclusive) -
by(int) — the step size (must be positive)
-
- Returns: a new CharList containing the range of values
rangeClosed(...) -> CharList
-
Signature:
public static CharList rangeClosed(final char startInclusive, final char endInclusive) - Summary: Creates a CharList containing a sequence of char values from startInclusive to endInclusive (both inclusive).
-
Parameters:
-
startInclusive(char) — the starting value (inclusive) -
endInclusive(char) — the ending value (inclusive)
-
- Returns: a new CharList containing the range of values
-
Signature:
public static CharList rangeClosed(final char startInclusive, final char endInclusive, final int by) - Summary: Creates a CharList containing a sequence of char values from startInclusive to endInclusive (both inclusive), incrementing by the specified step.
-
Parameters:
-
startInclusive(char) — the starting value (inclusive) -
endInclusive(char) — the ending value (inclusive) -
by(int) — the step size (must be positive)
-
- Returns: a new CharList containing the range of values
repeat(...) -> CharList
-
Signature:
public static CharList repeat(final char element, final int len) - Summary: Creates a CharList containing the specified element repeated {@code len} times.
-
Parameters:
-
element(char) — the element to repeat -
len(int) — the number of times to repeat the element
-
- Returns: a new CharList containing the repeated element
random(...) -> CharList
-
Signature:
public static CharList random(final int len) - Summary: Creates a CharList of the specified length filled with random char values.
-
Parameters:
-
len(int) — the length of the list to create
-
- Returns: a new CharList containing random char values
-
Signature:
public static CharList random(final char startInclusive, final char endExclusive, final int len) - Summary: Creates a CharList of the specified length filled with random char values within the specified range.
-
Parameters:
-
startInclusive(char) — the minimum value (inclusive) -
endExclusive(char) — the maximum value (exclusive) -
len(int) — the length of the list to create
-
- Returns: a new CharList containing random char values within the specified range
-
Signature:
public static CharList random(final char[] candidates, final int len) - Summary: Creates a CharList of the specified length by randomly selecting from the provided candidate chars.
-
Parameters:
-
candidates(char[]) — the array of candidate chars to choose from -
len(int) — the length of the list to create
-
- Returns: a new CharList containing randomly selected chars from the candidates
Public Instance Methods
<init>(...) -> void
-
Signature:
public CharList() - Summary: Constructs an empty CharList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public CharList(final int initialCapacity) - Summary: Constructs an empty CharList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public CharList(final char[] a) - Summary: Constructs a CharList containing the elements of the specified array.
-
Parameters:
-
a(char[]) — the array whose elements are to be used as the backing array for this list
-
-
Signature:
public CharList(final char[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a CharList using the specified array as the element array for this list without copying action.
-
Parameters:
-
a(char[]) — the array to be used as the element array for this list -
size(int) — the number of elements in the list
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified size is negative or greater than the array length
-
array(...) -> char\[\]
-
Signature:
@Beta @Deprecated @Override public char[] array() - Summary: Returns the underlying char array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal char array backing this list
get(...) -> char
-
Signature:
public char get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> char
-
Signature:
public char set(final int index, final char e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(char) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final char e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(char) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final char e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(char) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final CharList c) - Summary: Appends all of the elements in the specified CharList to the end of this list, in the order that they are returned by the specified collection's iterator.
-
Parameters:
-
c(CharList) — the CharList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean addAll(final int index, final CharList c) - Summary: Inserts all of the elements in the specified CharList into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified collection -
c(CharList) — the CharList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean addAll(final char[] a) - Summary: Appends all of the elements in the specified array to the end of this list.
-
Parameters:
-
a(char[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean addAll(final int index, final char[] a) - Summary: Inserts all of the elements in the specified array into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(char[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
remove(...) -> boolean
-
Signature:
public boolean remove(final char e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(char) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final char e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(char) — the element to be removed from this list
-
- Returns: {@code true} if this list was modified (at least one element was removed)
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final CharList c) - Summary: Removes from this list all of its elements that are contained in the specified CharList.
-
Parameters:
-
c(CharList) — the CharList containing elements to be removed from this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean removeAll(final char[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Parameters:
-
a(char[]) — the array containing elements to be removed from this list
-
- Returns: {@code true} if this list changed as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final CharPredicate p) - Summary: Removes all of the elements of this list that satisfy the given predicate.
-
Parameters:
-
p(CharPredicate) — a predicate which returns {@code true} for elements to be removed; must not be {@code null}
-
- Returns: {@code true} if any elements were removed
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes all duplicate elements from this list, keeping only the first occurrence of each element.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final CharList c) - Summary: Retains only the elements in this list that are contained in the specified CharList.
-
Parameters:
-
c(CharList) — the CharList containing elements to be retained in this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean retainAll(final char[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(char[]) — the array containing elements to be retained in this list
-
- Returns: {@code true} if this list changed as a result of the call
delete(...) -> char
-
Signature:
public char delete(final int index) - Summary: Removes the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes all elements at the specified indices from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes from this list all of the elements whose index is between {@code fromIndex} , inclusive, and {@code toIndex} , exclusive.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed -
toIndex(int) — the index after the last element to be removed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final CharList replacement) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with elements from the replacement CharList.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced -
toIndex(int) — the index after the last element to be replaced -
replacement(CharList) — the CharList whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final char[] replacement) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with elements from the replacement array.
-
Parameters:
-
fromIndex(int) — the index of the first element to be replaced -
toIndex(int) — the index after the last element to be replaced -
replacement(char[]) — the array whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final char oldVal, final char newVal) - Summary: Replaces all occurrences of the specified value with the new value in this list.
-
Parameters:
-
oldVal(char) — the old value to be replaced -
newVal(char) — the new value to replace the old value
-
- Returns: the number of elements replaced
-
Signature:
public void replaceAll(final CharUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the operator to that element.
-
Parameters:
-
operator(CharUnaryOperator) — the operator to apply to each element; must not be {@code null}
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final CharPredicate predicate, final char newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(CharPredicate) — the predicate to test elements; must not be {@code null} -
newValue(char) — the value to replace matching elements with
-
- Returns: {@code true} if any elements were replaced
fill(...) -> void
-
Signature:
public void fill(final char val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(char) — the value to be stored in all elements of the list
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final char val) throws IndexOutOfBoundsException - Summary: Replaces the elements in the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled with the specified value -
toIndex(int) — the index after the last element (exclusive) to be filled with the specified value -
val(char) — the value to be stored in the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
contains(...) -> boolean
-
Signature:
public boolean contains(final char valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(char) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final CharList c) - Summary: Returns {@code true} if this list contains any element from the specified CharList.
-
Contract:
- Returns {@code true} if this list contains any element from the specified CharList.
-
Parameters:
-
c(CharList) — the CharList to check for common elements
-
- Returns: {@code true} if this list contains at least one element from the specified CharList
-
Signature:
@Override public boolean containsAny(final char[] a) - Summary: Returns {@code true} if this list contains any element from the specified array.
-
Contract:
- Returns {@code true} if this list contains any element from the specified array.
-
Parameters:
-
a(char[]) — the array to check for common elements
-
- Returns: {@code true} if this list contains at least one element from the specified array
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final CharList c) - Summary: Returns {@code true} if this list contains all of the elements in the specified CharList.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified CharList.
-
Parameters:
-
c(CharList) — the CharList to be checked for containment in this list
-
- Returns: {@code true} if this list contains all of the elements in the specified CharList
-
Signature:
@Override public boolean containsAll(final char[] a) - Summary: Returns {@code true} if this list contains all of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified array.
-
Parameters:
-
a(char[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains all of the elements in the specified array
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final CharList c) - Summary: Returns {@code true} if this list has no elements in common with the specified CharList.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified CharList.
- Two lists are disjoint if they have no elements in common.
-
Parameters:
-
c(CharList) — the CharList to check for common elements
-
- Returns: {@code true} if the two lists have no elements in common
-
Signature:
@Override public boolean disjoint(final char[] b) - Summary: Returns {@code true} if this list has no elements in common with the specified array.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified array.
-
Parameters:
-
b(char[]) — the array to check for common elements
-
- Returns: {@code true} if this list and the array have no elements in common
intersection(...) -> CharList
-
Signature:
@Override public CharList intersection(final CharList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(CharList) — the list to find common elements with this list
-
- Returns: a new CharList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list. Returns an empty list if either list is {@code null} or empty.
- See also: #intersection(char\[\]), #difference(CharList), #symmetricDifference(CharList), N#intersection(char\[\], char\[\]), N#intersection(int\[\], int\[\])
-
Signature:
@Override public CharList intersection(final char[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(char[]) — the array to find common elements with this list
-
- Returns: a new CharList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source. Returns an empty list if the array is {@code null} or empty.
- See also: #intersection(CharList), #difference(char\[\]), #symmetricDifference(char\[\]), N#intersection(char\[\], char\[\]), N#intersection(int\[\], int\[\])
difference(...) -> CharList
-
Signature:
@Override public CharList difference(final CharList b) - Summary: Returns a new list with the elements in this list but not in the specified list {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(CharList) — the list to compare against this list
-
- Returns: a new CharList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: #difference(char\[\]), #symmetricDifference(CharList), #intersection(CharList), N#difference(char\[\], char\[\]), N#difference(int\[\], int\[\])
-
Signature:
@Override public CharList difference(final char[] b) - Summary: Returns a new list with the elements in this list but not in the specified array {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(char[]) — the array to compare against this list
-
- Returns: a new CharList containing the elements that are present in this list but not in the specified array, considering the number of occurrences. Returns a copy of this list if {@code b} is {@code null} or empty.
- See also: #difference(CharList), #symmetricDifference(char\[\]), #intersection(char\[\]), N#difference(char\[\], char\[\]), N#difference(int\[\], int\[\])
symmetricDifference(...) -> CharList
-
Signature:
@Override public CharList symmetricDifference(final CharList b) - Summary: Returns a new list containing the symmetric difference between this list and the specified CharList.
-
Parameters:
-
b(CharList) — the CharList to find the symmetric difference with
-
- Returns: a new CharList containing elements that are in either list but not in both
- See also: IntList#symmetricDifference(IntList)
-
Signature:
@Override public CharList symmetricDifference(final char[] b) - Summary: Returns a new list containing the symmetric difference between this list and the specified array.
-
Parameters:
-
b(char[]) — the array to find the symmetric difference with
-
- Returns: a new CharList containing elements that are in either the list or array but not in both
- See also: IntList#symmetricDifference(IntList)
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final char valueToFind) - Summary: Returns the number of occurrences of the specified value in this list.
-
Parameters:
-
valueToFind(char) — the value whose occurrences are to be counted
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final char valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(char) — the element to search for
-
- Returns: the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
-
Signature:
public int indexOf(final char valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, starting the search at the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, starting the search at the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(char) — the element to search for -
fromIndex(int) — the index to start the search from (inclusive)
-
- Returns: the index of the first occurrence of the element in this list at position > = fromIndex, or -1 if the element is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final char valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(char) — the element to search for
-
- Returns: the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element
-
Signature:
public int lastIndexOf(final char valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(char) — the element to search for -
startIndexFromBack(int) — the index to start the backward search from (inclusive)
-
- Returns: the index of the last occurrence of the element at position < = startIndexFromBack, or -1 if the element is not found
min(...) -> OptionalChar
-
Signature:
public OptionalChar min() - Summary: Returns the minimum element in this list.
-
Parameters:
- (none)
- Returns: an OptionalChar containing the minimum element, or an empty OptionalChar if this list is empty
-
Signature:
public OptionalChar min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum element in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included in the search -
toIndex(int) — the index of the last element (exclusive) to be included in the search
-
- Returns: an OptionalChar containing the minimum element in the specified range, or an empty OptionalChar if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
max(...) -> OptionalChar
-
Signature:
public OptionalChar max() - Summary: Returns the maximum element in this list.
-
Parameters:
- (none)
- Returns: an OptionalChar containing the maximum element, or an empty OptionalChar if this list is empty
-
Signature:
public OptionalChar max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the maximum element in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included in the search -
toIndex(int) — the index of the last element (exclusive) to be included in the search
-
- Returns: an OptionalChar containing the maximum element in the specified range, or an empty OptionalChar if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
median(...) -> OptionalChar
-
Signature:
public OptionalChar median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalChar containing the median value if the list is non-empty, or an empty OptionalChar if the list is empty
-
Signature:
public OptionalChar median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalChar containing the median value if the range is non-empty, or an empty OptionalChar if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final CharConsumer action) - Summary: Performs the given action for each element of this list.
-
Parameters:
-
action(CharConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final CharConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element in the specified range of this list.
-
Contract:
- If {@code fromIndex > toIndex} , the elements are processed in reverse order.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to process -
toIndex(int) — the index after the last element (exclusive) to process, or -1 to process in reverse from {@code fromIndex} to the beginning -
action(CharConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
first(...) -> OptionalChar
-
Signature:
public OptionalChar first() - Summary: Returns the first element in this list wrapped in an OptionalChar.
-
Parameters:
- (none)
- Returns: an OptionalChar containing the first element, or an empty OptionalChar if this list is empty
last(...) -> OptionalChar
-
Signature:
public OptionalChar last() - Summary: Returns the last element in this list wrapped in an OptionalChar.
-
Parameters:
- (none)
- Returns: an OptionalChar containing the last element, or an empty OptionalChar if this list is empty
distinct(...) -> CharList
-
Signature:
@Override public CharList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new CharList containing only the distinct elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index after the last element (exclusive) to include
-
- Returns: a new CharList containing distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains any duplicate elements.
-
Contract:
- <p> This method iterates through all elements in the list and determines if any char value appears more than once.
-
Parameters:
- (none)
- Returns: {@code true} if the list contains at least one duplicate element, {@code false} otherwise. Returns {@code false} for empty lists.
- Performance: </p> <p> Performance: O(n²) in the worst case for unsorted lists, where n is the size of the list.
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Contract:
- <p> This method verifies if each element is less than or equal to the next element in the list.
- For char values, this means checking if they are in ascending order according to their Unicode values.
-
Parameters:
- (none)
- Returns: {@code true} if the list is sorted in ascending order, {@code false} otherwise. Returns {@code true} for empty lists and lists with a single element.
- Performance: </p> <p> Performance: O(n) where n is the size of the list.
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts the elements of this list in ascending order.
-
Contract:
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
- (none)
- Performance: The sorting algorithm used provides O(n log n) performance on average.
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts the elements of this list in ascending order using a parallel sorting algorithm.
-
Contract:
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts the elements of this list in descending order.
-
Contract:
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
- (none)
- Performance: </p> <p> Performance: O(n log n) for sorting plus O(n) for reversing.
binarySearch(...) -> int
-
Signature:
public int binarySearch(final char valueToFind) - Summary: Searches for the specified char value in this sorted list using binary search algorithm.
-
Contract:
- <p> <b> Important: </b> This list must be sorted in ascending order before calling this method.
- If the list is not sorted, the results are undefined and may be incorrect.
-
Parameters:
-
valueToFind(char) — the char value to search for
-
- Returns: the index of the search key if it is contained in the list; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or {@code size()} if all elements in the list are less than the specified key.
- Performance: </p> <p> Performance: O(log n) where n is the size of the list.
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final char valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified char value within a range of this sorted list using binary search.
-
Contract:
- <p> <b> Important: </b> The specified range must be sorted in ascending order before calling this method.
- If the range is not sorted, the results are undefined and may be incorrect.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be searched -
toIndex(int) — the index of the last element (exclusive) to be searched -
valueToFind(char) — the char value to search for
-
- Returns: the index of the search key if it is contained in the specified range; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the range: the index of the first element in the range greater than the key, or {@code toIndex} if all elements in the range are less than the specified key.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> Performance: O(log(toIndex - fromIndex)) </p>
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Contract:
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
- (none)
- Performance: </p> <p> Performance: O(n/2) where n is the size of the list.
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range within this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be reversed -
toIndex(int) — the index after the last element (exclusive) to be reversed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> Performance: O((toIndex - fromIndex)/2) </p> <p> Note: This method does nothing if the range contains fewer than 2 elements.
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles the elements in this list.
-
Contract:
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
- (none)
- Performance: </p> <p> This implementation uses the Fisher-Yates shuffle algorithm, which runs in O(n) time.
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles the elements in this list using the specified random number generator.
-
Contract:
- This is useful when you need reproducible shuffling (by using a Random with a specific seed) or when you need a cryptographically strong random number generator.
- </p> <p> Note: This method does nothing if the list has fewer than 2 elements.
-
Parameters:
-
rnd(Random) — the random number generator to use for shuffling
-
- Performance: </p> <p> This implementation uses the Fisher-Yates shuffle algorithm, which runs in O(n) time.
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Contract:
- If {@code i} and {@code j} are equal, invoking this method leaves the list unchanged.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
- Performance: </p> <p> Performance: O(1) </p>
copy(...) -> CharList
-
Signature:
@Override public CharList copy() - Summary: Returns a copy of this list.
-
Parameters:
- (none)
- Returns: a new CharList containing all elements from this list
- Performance: </p> <p> Performance: O(n) where n is the size of the list.
-
Signature:
@Override public CharList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a copy of the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be copied -
toIndex(int) — the index after the last element (exclusive) to be copied
-
- Returns: a new CharList containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> Performance: O(toIndex - fromIndex) </p>
-
Signature:
@Override public CharList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a copy of elements from this list with the specified step.
-
Contract:
- </p> <p> Special cases: </p> <ul> <li> If {@code step > 0} : iterates forward from fromIndex to toIndex </li> <li> If {@code step < 0} : iterates backward from fromIndex to toIndex </li> <li> If {@code fromIndex > toIndex} and {@code step < 0} : creates a reversed copy </li> </ul> <p> <b> Usage Examples: </b> </p> <ul> <li> {@code copy(0, 10, 2)} returns elements at indices 0, 2, 4, 6, 8 </li> <li> {@code copy(9, -1, -2)} returns elements at indices 9, 7, 5, 3, 1 </li> </ul>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive for positive step, inclusive for negative step) -
step(int) — the step size between selected elements
-
- Returns: a new CharList containing the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<CharList>
-
Signature:
@Override public List<CharList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into multiple sublists of the specified size.
-
Contract:
- The last sublist may contain fewer elements if the range size is not evenly divisible by {@code chunkSize} .
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index after the last element (exclusive) to be included -
chunkSize(int) — the desired size of each sublist (must be positive)
-
- Returns: a List containing the sublists, each of type CharList
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
trimToSize(...) -> CharList
-
Signature:
@Override public CharList trimToSize() - Summary: Trims the capacity of this list to be the list's current size.
-
Contract:
- If the internal array has excess capacity (i.e., more space than needed for the current elements), this method creates a new array with the exact size needed and copies the elements to it.
- </p> <p> This operation can be useful to minimize memory usage after removing many elements from a list or when a list's size has stabilized.
-
Parameters:
- (none)
- Returns: this CharList instance (for method chaining)
- Performance: </p> <p> Performance: O(n) if trimming is needed, O(1) if the capacity already matches the size.
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() -
Parameters:
- (none)
- Returns: unspecified
boxed(...) -> List<Character>
-
Signature:
@Override public List<Character> boxed() - Summary: Returns a List containing all elements in this list boxed as Character objects.
-
Contract:
- This is useful when you need to work with Java Collections Framework or other APIs that require object types.
-
Parameters:
- (none)
- Returns: a new List < Character > containing all elements from this list
- Performance: </p> <p> Performance: O(n) where n is the size of the list.
-
Signature:
@Override public List<Character> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a List containing elements in the specified range boxed as Character objects.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be boxed -
toIndex(int) — the index after the last element (exclusive) to be boxed
-
- Returns: a new List < Character > containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> Performance: O(toIndex - fromIndex).
toArray(...) -> char\[\]
-
Signature:
@Override public char[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new char array containing all elements of this list
toIntList(...) -> IntList
-
Signature:
public IntList toIntList() - Summary: Converts this CharList to an IntList.
-
Contract:
- This is useful when you need to perform integer arithmetic on character values.
-
Parameters:
- (none)
- Returns: a new IntList containing the widened values of all elements in this list
- Performance: </p> <p> Performance: O(n) where n is the size of the list.
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Character>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index after the last element (exclusive) to include -
supplier(IntFunction<? extends C>) — a function which produces a new collection of the desired type
-
- Returns: a collection containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Character>
-
Signature:
@Override public Multiset<Character> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Character>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index after the last element (exclusive) to include -
supplier(IntFunction<Multiset<Character>>) — a function which produces a new Multiset of the desired type
-
- Returns: a Multiset containing the specified range of elements with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
iterator(...) -> CharIterator
-
Signature:
@Override public CharIterator iterator() - Summary: Returns an iterator over the elements in this list in proper sequence.
-
Contract:
- </p> <p> The iterator is fail-fast: if the list is structurally modified after the iterator is created, it will throw a ConcurrentModificationException on the next access.
-
Parameters:
- (none)
- Returns: a CharIterator over the elements in this list
stream(...) -> CharStream
-
Signature:
public CharStream stream() - Summary: Returns a CharStream with this list as its source.
-
Parameters:
- (none)
- Returns: a CharStream over all elements in this list
-
Signature:
public CharStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a CharStream over the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include in the stream -
toIndex(int) — the index after the last element (exclusive) to include in the stream
-
- Returns: a CharStream over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
getFirst(...) -> char
-
Signature:
public char getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first char value in the list
getLast(...) -> char
-
Signature:
public char getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last char value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final char e) - Summary: Inserts the specified element at the beginning of this list.
-
Contract:
- </p> <p> If the list's capacity needs to be increased, it will be grown automatically.
-
Parameters:
-
e(char) — the char element to add at the beginning of the list
-
- Performance: This operation has O(n) time complexity where n is the size of the list.
addLast(...) -> void
-
Signature:
public void addLast(final char e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- If the list's capacity needs to be increased, it will be grown automatically.
-
Parameters:
-
e(char) — the char element to append to the list
-
- Performance: This operation has amortized O(1) time complexity.
removeFirst(...) -> char
-
Signature:
public char removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first char value that was removed from the list
- Performance: This operation has O(n) time complexity where n is the size of the list.
removeLast(...) -> char
-
Signature:
public char removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last char value that was removed from the list
- Performance: This operation has O(1) time complexity.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this list for equality.
-
Contract:
- <p> Returns {@code true} if and only if the specified object is also a CharList, both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
- In other words, two lists are defined to be equal if they contain the same elements in the same order.
- </p> <p> This implementation first checks if the specified object is this list.
- If so, it returns {@code true} .
- Then, it checks if the specified object is a CharList.
- If not, it returns {@code false} .
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class CharSummaryStatistics (com.landawn.abacus.util.CharSummaryStatistics)
A state object for collecting statistics such as count, min, max, sum, and average for a stream of char values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public CharSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, {@code Character.MAX_VALUE} min, and {@code Character.MIN_VALUE} max.
-
Parameters:
- (none)
-
Signature:
public CharSummaryStatistics(final long count, final char min, final char max, final long sum) - Summary: Constructs an instance with the specified initial values.
-
Contract:
- <p> This constructor is useful when creating a summary from pre-calculated statistics or when merging multiple summaries.
-
Parameters:
-
count(long) — the count of values -
min(char) — the minimum value -
max(char) — the maximum value -
sum(long) — the sum of all values
-
accept(...) -> void
-
Signature:
@Override public void accept(final char value) - Summary: Records a new char value into the summary statistics.
-
Parameters:
-
value(char) — the char value to record
-
combine(...) -> void
-
Signature:
public void combine(final CharSummaryStatistics other) - Summary: Combines the state of another {@code CharSummaryStatistics} into this one.
-
Contract:
- <p> This method is useful when parallelizing statistics collection or when merging statistics from multiple sources.
-
Parameters:
-
other(CharSummaryStatistics) — another {@code CharSummaryStatistics} to combine with this one
-
getMin(...) -> char
-
Signature:
public final char getMin() - Summary: Returns the minimum char value recorded, or {@code Character.MAX_VALUE} if no values have been recorded.
-
Contract:
- Returns the minimum char value recorded, or {@code Character.MAX_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the minimum char value, or {@code Character.MAX_VALUE} if none
getMax(...) -> char
-
Signature:
public final char getMax() - Summary: Returns the maximum char value recorded, or {@code Character.MIN_VALUE} if no values have been recorded.
-
Contract:
- Returns the maximum char value recorded, or {@code Character.MIN_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the maximum char value, or {@code Character.MIN_VALUE} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> Long
-
Signature:
public final Long getSum() - Summary: Returns the sum of values recorded.
-
Parameters:
- (none)
- Returns: the sum of values, as a {@code Long}
getAverage(...) -> Double
-
Signature:
public final Double getAverage() - Summary: Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values, or zero if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this summary, including all statistics.
-
Parameters:
- (none)
- Returns: a string representation of this summary
Class CharacterWriter (com.landawn.abacus.util.CharacterWriter)
An abstract base class for writers that perform automatic character escaping based on configurable replacement rules.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
writeCharacter(...) -> void
-
Signature:
public void writeCharacter(final char ch) throws IOException - Summary: Writes a single character with automatic escaping.
-
Contract:
- <p> If the character needs escaping according to the replacement table, the escape sequence is written instead of the original character.
-
Parameters:
-
ch(char) — the character to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
public void writeCharacter(final char[] cbuf) throws IOException - Summary: Writes a character array with automatic escaping.
-
Contract:
- <p> Each character in the array is checked against the replacement table, and escaped if necessary.
-
Parameters:
-
cbuf(char[]) — the character array to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
public void writeCharacter(final char[] cbuf, final int off, int len) throws IOException - Summary: Writes a portion of a character array with automatic escaping.
-
Parameters:
-
cbuf(char[]) — the character array containing data to write -
off(int) — the start offset in the array -
len(int) — the number of characters to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SuppressWarnings("deprecation") public void writeCharacter(final String str) throws IOException - Summary: Writes a string with automatic escaping.
-
Contract:
- <p> Each character in the string is checked against the replacement table, and escaped if necessary.
- If the string is {@code null} , "null" is written.
-
Parameters:
-
str(String) — the string to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SuppressWarnings("deprecation") public void writeCharacter(final String str, final int off, final int len) throws IOException - Summary: Writes a portion of a string with automatic escaping.
-
Parameters:
-
str(String) — the string containing data to write -
off(int) — the start offset in the string -
len(int) — the number of characters to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class Charsets (com.landawn.abacus.util.Charsets)
A utility class providing convenient access to commonly used character encodings and charset management functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
get(...) -> Charset
-
Signature:
public static Charset get(final String charsetName) - Summary: Returns a charset object for the named charset, utilizing an internal cache for improved performance.
-
Contract:
- When a charset is requested: </p> <ol> <li> The method first checks the internal cache for an existing instance </li> <li> If found, the cached instance is returned immediately </li> <li> If not found, a new charset is created via {@link Charset#forName(String)} </li> <li> The newly created charset is cached for future requests </li> </ol> <p> This caching mechanism significantly improves performance compared to repeatedly calling {@code Charset.forName()} directly, especially in scenarios where the same charset is accessed frequently.
-
Parameters:
-
charsetName(String) — the name of the requested charset; may be either a canonical name (e.g., "UTF-8") or an alias (e.g., "utf8"). Must not be {@code null} .
-
- Returns: a charset object for the named charset, either from cache or newly created
- See also: Charset#forName(String), StandardCharsets
Public Instance Methods
- (none)
Class ClassUtil (com.landawn.abacus.util.ClassUtil)
A comprehensive utility class providing advanced Java reflection operations, class manipulation, and dynamic bean introspection capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getClassLocation(...) -> String
-
Signature:
public static String getClassLocation(final Class<?> clazz) - Summary: Gets the code-source location of the specified class.
-
Contract:
- Returns {@code null} if the code source or location is unavailable.
-
Parameters:
-
clazz(Class<?>) — the class whose source code location is to be retrieved
-
- Returns: the path to the code-source location of the specified class, with URL encoding removed, or {@code null} if unavailable
forName(...) -> Class<T>
-
Signature:
public static <T> Class<T> forName(final String clsName) throws IllegalArgumentException - Summary: Returns the Class object associated with the class or interface with the given string name.
-
Parameters:
-
clsName(String) — the fully qualified name of the desired class
-
- Returns: the Class object for the class with the specified name
-
Throws:
-
java.lang.IllegalArgumentException— if the class cannot be located
-
getTypeName(...) -> String
-
Signature:
public static String getTypeName(final java.lang.reflect.Type type) - Summary: Returns the formatted type name of the specified type.
-
Parameters:
-
type(java.lang.reflect.Type) — the type whose name is to be retrieved
-
- Returns: the formatted name of the specified type
getCanonicalClassName(...) -> String
-
Signature:
public static String getCanonicalClassName(final Class<?> cls) - Summary: Retrieves the canonical name of the specified class.
-
Contract:
- If the canonical name is not available (e.g., for anonymous classes), it returns the class name instead.
-
Parameters:
-
cls(Class<?>) — the class whose canonical name is to be retrieved
-
- Returns: the canonical name of the class, or the class name if the canonical name is not available
- See also: Class#getCanonicalName()
getClassName(...) -> String
-
Signature:
public static String getClassName(final Class<?> cls) - Summary: Retrieves the fully qualified name of the specified class.
-
Parameters:
-
cls(Class<?>) — the class whose name is to be retrieved
-
- Returns: the fully qualified name of the class
getSimpleClassName(...) -> String
-
Signature:
public static String getSimpleClassName(final Class<?> cls) - Summary: Retrieves the simple name of the specified class as returned by {@link Class#getSimpleName()} .
-
Parameters:
-
cls(Class<?>) — the class whose simple name is to be retrieved
-
- Returns: the simple name of the class
getPackage(...) -> Package
-
Signature:
@MayReturnNull public static Package getPackage(final Class<?> cls) - Summary: Retrieves the package of the specified class.
-
Contract:
- Returns {@code null} if the class is a primitive type or if no package is defined.
-
Parameters:
-
cls(Class<?>) — the class whose package is to be retrieved
-
- Returns: the package of the class, or {@code null} if the class is a primitive type or no package is defined
getPackageName(...) -> String
-
Signature:
public static String getPackageName(final Class<?> cls) - Summary: Retrieves the package name of the specified class.
-
Contract:
- If the class is a primitive type or no package is defined, it returns an empty string.
-
Parameters:
-
cls(Class<?>) — the class whose package name is to be retrieved
-
- Returns: the package name of the class, or an empty string if the class is a primitive type or no package is defined
findClassesInPackage(...) -> List<Class<?>>
-
Signature:
public static List<Class<?>> findClassesInPackage(final String pkgName, final boolean isRecursive, final boolean skipClassLoadingException) throws IllegalArgumentException, UncheckedIOException - Summary: Retrieves a list of classes in the specified package.
-
Parameters:
-
pkgName(String) — the name of the package to search for classes -
isRecursive(boolean) — if {@code true} , searches recursively in sub-packages -
skipClassLoadingException(boolean) — if {@code true} , skips classes that cannot be loaded and continues scanning
-
- Returns: a list of classes in the specified package
-
Throws:
-
java.lang.IllegalArgumentException— if no resources are found for the specified package (e.g., package does not exist or JDK packages) -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during package scanning
-
- See also: #findClassesInPackage(String, boolean, boolean, Predicate)
-
Signature:
public static List<Class<?>> findClassesInPackage(final String pkgName, final boolean isRecursive, final boolean skipClassLoadingException, final Predicate<? super Class<?>> predicate) throws IllegalArgumentException, UncheckedIOException - Summary: Retrieves a filtered list of classes in the specified package by scanning the classpath and applying a configurable predicate filter.
-
Parameters:
-
pkgName(String) — the fully qualified name of the package to scan for classes (e.g., "com.example.services"). Must not be null or empty. JDK packages (java., javax.) are not supported. -
isRecursive(boolean) — if {@code true} , recursively scans sub-packages within the specified package hierarchy. If {@code false} , scans only the immediate package without descending into sub-packages. -
skipClassLoadingException(boolean) — if {@code true} , continues scanning when individual classes fail to load, logging warnings for failed attempts. If {@code false} , throws an exception immediately when any class loading operation fails. -
predicate(Predicate<? super Class<?>>) — a filtering predicate applied to each successfully loaded class. Only classes for which this predicate returns {@code true} are included in the result list. Must not be null. Use {@code Fn.alwaysTrue()} to include all discovered classes without filtering.
-
- Returns: a list containing all classes found in the specified package that satisfy the predicate filter. Returns an empty list if no matching classes are found. The list is modifiable and preserves discovery order; duplicate classes may appear if multiple resources overlap.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code pkgName} is null, empty, or if no classpath resources are found for the specified package (e.g., package does not exist, typo in package name, or attempting to scan JDK packages which are not supported). -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during classpath scanning, JAR file reading, or resource enumeration. This typically indicates file system issues, corrupted JAR files, or insufficient permissions for accessing classpath resources.
-
- Performance: </p> <p> <b> Key Features and Capabilities: </b> <ul> <li> <b> Recursive Package Scanning: </b> Optional deep traversal of package hierarchies and sub-packages </li> <li> <b> Flexible Class Filtering: </b> Predicate-based filtering for selective class discovery </li> <li> <b> Error Recovery: </b> Configurable handling of class loading failures during scanning </li> <li> <b> JAR File Support: </b> Comprehensive scanning of classes within JAR archives </li> <li> <b> ClassLoader Compatibility: </b> Works with various class loader implementations </li> <li> <b> Performance Optimized: </b> Efficient scanning algorithms minimizing I/O overhead </li> </ul> <p> <b> Scanning Process and Algorithm: </b> <ol> <li> <b> Resource Discovery: </b> Locate package resources on classpath using class loader </li> <li> <b> Path Analysis: </b> Determine if resources are file system directories or JAR entries </li> <li> <b> Class Enumeration: </b> Recursively enumerate .class files based on recursive flag </li> <li> <b> Class Loading: </b> Attempt to load each discovered class using appropriate class loader </li> <li> <b> Error Handling: </b> Skip or propagate class loading errors based on configuration </li> <li> <b> Filtering: </b> Apply predicate filter to loaded classes for selective inclusion </li> <li> <b> Result Assembly: </b> Collect filtered classes into result list for return </li> </ol> <p> <b> Use Cases and Applications: </b> <ul> <li> <b> Plugin Systems: </b> Dynamic discovery of plugin classes implementing specific interfaces </li> <li> <b> Framework Development: </b> Automatic registration of components, services, and handlers </li> <li> <b> Testing Frameworks: </b> Discovery of test classes and test suites for automated execution </li> <li> <b> Configuration Management: </b> Enumeration of configuration classes for property binding </li> <li> <b> Dependency Injection: </b> Discovery of annotated classes for container registration </li> <li> <b> Code Analysis: </b> Static analysis tools requiring comprehensive class enumeration </li> </ul> <p> <b> Common Usage Patterns: </b> <pre> {@code // Basic package scanning for all classes List<Class<?>> allClasses = ClassUtil.findClassesInPackage( "com.example.myapp", true, // Recursive true, // Skip loading errors Fn.alwaysTrue() // No filtering ); // Filter for interface classes only List<Class<?>> interfaces = ClassUtil.findClassesInPackage( "com.example.api", true, false, Class::isInterface ); // Find classes with specific annotation List<Class<?>> services = ClassUtil.findClassesInPackage( "com.example.services", true, true, cls -> cls.isAnnotationPresent(Service.class) ); // Find concrete implementation classes List<Class<?>> implementations = ClassUtil.findClassesInPackage( "com.example.impl", false, // Non-recursive true, cls -> !cls.isInterface() && !cls.isAbstract() ); } </pre> <p> <b> Advanced Filtering Examples: </b> <pre> {@code // Complex predicate combining multiple criteria Predicate<Class<?>> complexFilter = cls -> !cls.isInterface() && !Modifier.isAbstract(cls.getModifiers()) && cls.isAnnotationPresent(Component.class) && Arrays.stream(cls.getInterfaces()) .anyMatch(intf -> intf.equals(Processor.class)); List<Class<?>> processors = ClassUtil.findClassesInPackage( "com.example.processors", true, true, complexFilter ); // Filter by class hierarchy List<Class<?>> subclasses = ClassUtil.findClassesInPackage( "com.example.handlers", true, false, cls -> BaseHandler.class.isAssignableFrom(cls) && !cls.equals(BaseHandler.class) ); } </pre> <p> <b> Error Handling Strategies: </b> <ul> <li> <b> Skip Loading Errors (skipClassLoadingException = true): </b> <ul> <li> Continues scanning when individual classes fail to load </li> <li> Logs warnings for failed class loading attempts </li> <li> Suitable for exploratory scanning and plugin discovery </li> <li> Prevents single malformed class from stopping entire scan </li> </ul> </li> <li> <b> Fail Fast (skipClassLoadingException = false): </b> <ul> <li> Throws exception immediately when class loading fails </li> <li> Ensures all discovered classes are successfully loadable </li> <li> Suitable for strict validation and deployment verification </li> <li> Provides precise error reporting for debugging purposes </li> </ul> </li> </ul> <p> <b> Performance Considerations: </b> <ul> <li> <b> Classpath Size Impact: </b> Scanning time increases with classpath complexity </li> <li> <b> JAR File Overhead: </b> Additional I/O cost for scanning classes within JAR archives </li> <li> <b> Recursive Scanning Cost: </b> Deep package hierarchies increase scanning time </li> <li> <b> Class Loading Overhead: </b> Each class loading operation has initialization cost </li> <li> <b> Memory Usage: </b> Large result sets consume significant memory </li> </ul> <p> <b> Security and ClassLoader Considerations: </b> <ul> <li> <b> ClassLoader Context: </b> Uses {@code ClassUtil.class.getClassLoader()} first, then the system class loader </li> <li> <b> Security Manager: </b> Respects security manager restrictions on class loading </li> <li> <b> Package Access: </b> May fail for packages with restricted access permissions </li> <li> <b> Module System: </b> Limited compatibility with Java 9+ module system restrictions </li> </ul> <p> <b> Debugging and Troubleshooting: </b> <ul> <li> <b> Empty Results: </b> Check package name spelling and classpath configuration </li> <li> <b> Class Loading Failures: </b> Enable debug logging to identify problematic classes </li> <li> <b> Performance Issues: </b> Use non-recursive scanning for large package hierarchies </li> <li> <b> Memory Consumption: </b> Implement result streaming for large class sets </li> </ul>
- See also: #findClassesInPackage(String, boolean, boolean), java.lang.ClassLoader#getResources(String), java.util.function.Predicate, java.util.jar.JarFile
getAllInterfaces(...) -> Set<Class<?>>
-
Signature:
public static Set<Class<?>> getAllInterfaces(final Class<?> cls) - Summary: Gets a set of all interfaces implemented by the given class and its superclasses.
-
Parameters:
-
cls(Class<?>) — the class to look up
-
- Returns: a set of all interfaces implemented by the class and its superclasses
- See also: #getAllSuperclasses(Class), #getAllSuperTypes(Class)
getAllSuperclasses(...) -> List<Class<?>>
-
Signature:
public static List<Class<?>> getAllSuperclasses(final Class<?> cls) - Summary: Gets a list of all superclasses for the given class, excluding {@code Object.class} .
-
Parameters:
-
cls(Class<?>) — the class to look up
-
- Returns: a list of all superclasses, excluding {@code Object.class}
- See also: #getAllInterfaces(Class), #getAllSuperTypes(Class)
getAllSuperTypes(...) -> Set<Class<?>>
-
Signature:
public static Set<Class<?>> getAllSuperTypes(final Class<?> cls) - Summary: Returns all interfaces and superclasses that the specified class implements or extends, excluding {@code Object.class} .
-
Parameters:
-
cls(Class<?>) — the class to look up
-
- Returns: a set of all interfaces and superclasses, excluding {@code Object.class}
getEnclosingClass(...) -> Class<?>
-
Signature:
@MayReturnNull public static Class<?> getEnclosingClass(final Class<?> cls) - Summary: Retrieves the enclosing class of the specified class.
-
Contract:
- Returns {@code null} if the class is not an inner class or has no enclosing class.
-
Parameters:
-
cls(Class<?>) — the class whose enclosing class is to be retrieved
-
- Returns: the enclosing class of the specified class, or {@code null} if the class is not an inner class
getDeclaredConstructor(...) -> Constructor<T>
-
Signature:
@MayReturnNull public static <T> Constructor<T> getDeclaredConstructor(final Class<T> cls, final Class<?>... parameterTypes) - Summary: Returns the constructor declared in the specified class with the given parameter types.
-
Contract:
- Returns {@code null} if no constructor is found.
-
Parameters:
-
cls(Class<T>) — the class object -
parameterTypes(Class<?>[]) — the parameter types of the constructor
-
- Returns: the constructor declared in the specified class with the specified parameter types, or {@code null} if no constructor is found
getDeclaredMethod(...) -> Method
-
Signature:
@MayReturnNull public static Method getDeclaredMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes) - Summary: Returns the method declared in the specified class with the given method name and parameter types.
-
Contract:
- Returns {@code null} if no method is found with the specified name and parameter types.
-
Parameters:
-
cls(Class<?>) — the class object -
methodName(String) — the name of the method to retrieve -
parameterTypes(Class<?>[]) — the parameter types of the method
-
- Returns: the method declared in the specified class with the specified name and parameter types, or {@code null} if no method is found
getParameterizedTypeNameByField(...) -> String
-
Signature:
public static String getParameterizedTypeNameByField(final Field field) - Summary: Gets the parameterized type name of the specified field, including generic type information.
-
Contract:
- This method attempts to resolve the field's generic type if available.
-
Parameters:
-
field(Field) — the field whose parameterized type name is to be retrieved
-
- Returns: the parameterized type name of the field, including generic type information if available
getParameterizedTypeNameByMethod(...) -> String
-
Signature:
public static String getParameterizedTypeNameByMethod(final Method method) - Summary: Gets the parameterized type name of the specified method, including generic type information.
-
Contract:
- This method examines the method's first parameter type (if present) or the return type to extract generic type information.
-
Parameters:
-
method(Method) — the method whose parameterized type name is to be retrieved
-
- Returns: the parameterized type name of the method's parameter or return type, including generic type information if available
formatParameterizedTypeName(...) -> String
-
Signature:
public static String formatParameterizedTypeName(final String parameterizedTypeName) - Summary: Formats and normalizes parameterized type names by removing unnecessary prefixes, suffixes, and performing intelligent transformations to create clean, readable type representations.
-
Contract:
- toString() methods: </b> Consistent formatting across different type implementations </li> <li> <b> Cross-JVM Compatibility: </b> Standardizes type names across different Java implementations </li> </ul> <p> <b> Error Handling and Edge Cases: </b> <ul> <li> <b> Null Input: </b> Handles null input gracefully without throwing exceptions </li> <li> <b> Empty Strings: </b> Processes empty type names appropriately </li> <li> <b> Malformed Names: </b> Robust handling of unexpected type name formats </li> <li> <b> Unicode Characters: </b> Proper handling of Unicode characters in type names </li> </ul> <p> <b> Best Practices and Recommendations: </b> <ul> <li> Use this method for user-facing type name display to ensure consistency </li> <li> Cache formatted type names if performing repeated formatting operations </li> <li> Combine with other ClassUtil methods for comprehensive type introspection </li> <li> Consider locale-specific formatting requirements for internationalized applications </li> <li> Use in combination with validation to ensure type name accuracy </li> <li> Document the expected input format when integrating with external systems </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code String name1 = ClassUtil.formatParameterizedTypeName("class java.lang.String"); // "String" String name2 = ClassUtil.formatParameterizedTypeName("java.util.List<java.lang.Integer>"); // "java.util.List<Integer>" } </pre>
-
Parameters:
-
parameterizedTypeName(String) — the raw parameterized type name to format, typically obtained from {@code Type.getTypeName()} , {@code Class.getTypeName()} , or reflection operations. May contain prefixes like "class " or "interface ", array notation, generic type parameters, and inner class '$' notation. Null values are handled gracefully.
-
- Returns: a formatted, human-readable type name with prefixes removed, array notation normalized, inner class notation converted to dot notation (when applicable), and built-in type mappings applied. Returns null if the input is null, or an appropriately formatted string representation that is suitable for display, logging, documentation, or user interface purposes.
- Performance: <p> This method addresses the complexity of Java's type system representation by transforming verbose, implementation-specific type names into standardized, readable formats suitable for user interfaces, logging, documentation, and API responses.
- See also: Class#getTypeName(), Class#getSimpleName(), Class#getCanonicalName(), #getParameterizedTypeNameByField(Field), #getParameterizedTypeNameByMethod(Method)
inheritanceDistance(...) -> int
-
Signature:
public static int inheritanceDistance(final Class<?> child, final Class<?> parent) - Summary: Returns the number of inheritance hops between two classes.
-
Parameters:
-
child(Class<?>) — the child class, may be {@code null} -
parent(Class<?>) — the parent class, may be {@code null}
-
- Returns: the number of generations between the child and parent; 0 if the same class; -1 if the classes are not related as child and parent (includes where either class is null)
hierarchy(...) -> ObjIterator<Class<?>>
-
Signature:
public static ObjIterator<Class<?>> hierarchy(final Class<?> type) - Summary: Gets an iterator that can iterate over a class hierarchy in ascending (subclass to superclass) order, excluding interfaces.
-
Parameters:
-
type(Class<?>) — the type to get the class hierarchy from
-
- Returns: an iterator over the class hierarchy of the given class, excluding interfaces
- See also: #hierarchy(Class, boolean)
-
Signature:
public static ObjIterator<Class<?>> hierarchy(final Class<?> type, final boolean includeInterface) - Summary: Gets an iterator that can iterate over a class hierarchy in ascending (subclass to superclass) order.
-
Parameters:
-
type(Class<?>) — the type to get the class hierarchy from -
includeInterface(boolean) — if {@code true} , includes interfaces; if {@code false} , excludes interfaces
-
- Returns: an iterator over the class hierarchy of the given class
- See also: #hierarchy(Class)
invokeConstructor(...) -> T
-
Signature:
public static <T> T invokeConstructor(final Constructor<T> constructor, final Object... args) - Summary: Invokes the specified constructor with the given arguments and returns the newly created instance.
-
Parameters:
-
constructor(Constructor<T>) — the constructor to be invoked -
args(Object[]) — the arguments to be passed to the constructor
-
- Returns: the newly created object
invokeMethod(...) -> T
-
Signature:
public static <T> T invokeMethod(final Method method, final Object... args) - Summary: Invokes the specified static method with the given arguments.
-
Parameters:
-
method(Method) — the static method to be invoked -
args(Object[]) — the arguments to be passed to the method
-
- Returns: the result of invoking the method
- See also: #invokeMethod(Object, Method, Object...)
-
Signature:
public static <T> T invokeMethod(final Object instance, final Method method, final Object... args) - Summary: Invokes the specified method on the given instance with the provided arguments.
-
Parameters:
-
instance(Object) — the object on which the method is to be invoked, or {@code null} for static methods -
method(Method) — the method to be invoked -
args(Object[]) — the arguments to be passed to the method
-
- Returns: the result of invoking the method
- See also: #invokeMethod(Method, Object...)
setAccessible(...) -> void
-
Signature:
@SuppressWarnings("deprecation") public static void setAccessible(final AccessibleObject accessibleObject, final boolean flag) - Summary: Sets the accessibility flag for the specified {@link AccessibleObject} .
-
Parameters:
-
accessibleObject(AccessibleObject) — the object whose accessibility is to be set -
flag(boolean) — the new accessibility flag ( {@code true} to make accessible, {@code false} otherwise)
-
setAccessibleQuietly(...) -> boolean
-
Signature:
@SuppressWarnings({ "deprecation", "UnusedReturnValue" }) public static boolean setAccessibleQuietly(final AccessibleObject accessibleObject, final boolean flag) - Summary: Sets the accessibility flag for the specified {@link AccessibleObject} quietly, suppressing any exceptions.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Field field = MyClass.class.getDeclaredField("privateField"); boolean success = ClassUtil.setAccessibleQuietly(field, true); if (success) { Object value = field.get(instance); } } </pre>
-
Parameters:
-
accessibleObject(AccessibleObject) — the object whose accessibility is to be set -
flag(boolean) — the new accessibility flag ( {@code true} to make accessible, {@code false} otherwise)
-
- Returns: {@code true} if the accessibility was successfully set, {@code false} if an error occurred or the object is {@code null}
isBeanClass(...) -> boolean
-
Signature:
@Deprecated public static boolean isBeanClass(final Class<?> cls) - Summary: Checks if the specified class is a bean class.
-
Contract:
- Checks if the specified class is a bean class.
- Returns {@code false} if {@code cls} is {@code null} .
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a bean class, {@code false} otherwise
isRecordClass(...) -> boolean
-
Signature:
@Deprecated public static boolean isRecordClass(final Class<?> cls) - Summary: Checks if the specified class is a record class.
-
Contract:
- Checks if the specified class is a record class.
- Returns {@code false} if {@code cls} is {@code null} .
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a record class, {@code false} otherwise
isAnonymousClass(...) -> boolean
-
Signature:
public static boolean isAnonymousClass(final Class<?> cls) - Summary: Checks if the specified class is an anonymous class.
-
Contract:
- Checks if the specified class is an anonymous class.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is an anonymous class, {@code false} otherwise
isMemberClass(...) -> boolean
-
Signature:
public static boolean isMemberClass(final Class<?> cls) - Summary: Checks if the specified class is a member class.
-
Contract:
- Checks if the specified class is a member class.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a member class, {@code false} otherwise
isAnonymousOrMemberClass(...) -> boolean
-
Signature:
public static boolean isAnonymousOrMemberClass(final Class<?> cls) - Summary: Checks if the specified class is either an anonymous class or a member class.
-
Contract:
- Checks if the specified class is either an anonymous class or a member class.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is either an anonymous class or a member class, {@code false} otherwise
isPrimitiveType(...) -> boolean
-
Signature:
public static boolean isPrimitiveType(final Class<?> cls) throws IllegalArgumentException - Summary: Checks if the specified class is a primitive type.
-
Contract:
- Checks if the specified class is a primitive type.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a primitive type, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if the class is {@code null}
-
- See also: #isPrimitiveWrapper(Class), #isPrimitiveArrayType(Class)
isPrimitiveWrapper(...) -> boolean
-
Signature:
public static boolean isPrimitiveWrapper(final Class<?> cls) throws IllegalArgumentException - Summary: Checks if the specified class is a primitive wrapper type.
-
Contract:
- Checks if the specified class is a primitive wrapper type.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a primitive wrapper type, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if the class is {@code null}
-
- See also: #isPrimitiveType(Class), #isPrimitiveArrayType(Class)
isPrimitiveArrayType(...) -> boolean
-
Signature:
public static boolean isPrimitiveArrayType(final Class<?> cls) throws IllegalArgumentException - Summary: Checks if the specified class is a primitive array type.
-
Contract:
- Checks if the specified class is a primitive array type.
-
Parameters:
-
cls(Class<?>) — the class to be checked
-
- Returns: {@code true} if the specified class is a primitive array type, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if the class is {@code null}
-
- See also: #isPrimitiveType(Class), #isPrimitiveWrapper(Class)
wrap(...) -> Class<?>
-
Signature:
public static Class<?> wrap(final Class<?> cls) throws IllegalArgumentException - Summary: Returns the corresponding wrapper type of the specified class if it is a primitive type; otherwise returns the class itself.
-
Contract:
- Returns the corresponding wrapper type of the specified class if it is a primitive type; otherwise returns the class itself.
-
Parameters:
-
cls(Class<?>) — the class to be wrapped
-
- Returns: the corresponding wrapper type if {@code cls} is a primitive type or primitive array, otherwise {@code cls} itself
-
Throws:
-
java.lang.IllegalArgumentException— if {@code cls} is {@code null}
-
- See also: #unwrap(Class)
unwrap(...) -> Class<?>
-
Signature:
public static Class<?> unwrap(final Class<?> cls) throws IllegalArgumentException - Summary: Returns the corresponding primitive type of the specified class if it is a wrapper type; otherwise returns the class itself.
-
Contract:
- Returns the corresponding primitive type of the specified class if it is a wrapper type; otherwise returns the class itself.
-
Parameters:
-
cls(Class<?>) — the class to be unwrapped
-
- Returns: the corresponding primitive type if {@code cls} is a wrapper type or wrapper array, otherwise {@code cls} itself
-
Throws:
-
java.lang.IllegalArgumentException— if {@code cls} is {@code null}
-
- See also: #wrap(Class)
createMethodHandle(...) -> MethodHandle
-
Signature:
@SuppressFBWarnings("REC_CATCH_EXCEPTION") public static MethodHandle createMethodHandle(final Method method) - Summary: Creates a MethodHandle for the specified method.
-
Parameters:
-
method(Method) — the method for which the MethodHandle is to be created
-
- Returns: the MethodHandle for the specified method
newNullSentinel(...) -> Object
-
Signature:
public static Object newNullSentinel() - Summary: Creates and returns a new instance of the <i> None </i> class, which serves as a {@code null} mask.
-
Parameters:
- (none)
- Returns: a new instance of the <i> None </i> class that serves as a {@code null} placeholder
Public Instance Methods
- (none)
Class Clazz (com.landawn.abacus.util.Clazz)
A specialized utility class that provides convenient typed Class references for parameterized collection types, designed to work around Java's type erasure limitations while maintaining type safety and code readability.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Class<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<T> of(final Class<? super T> cls) - Summary: Returns a typed Class reference for the specified class.
-
Contract:
- <p> This method is particularly useful when working with APIs that accept {@code Class<?>} parameters but you want to maintain type safety at compile time.
-
Parameters:
-
cls(Class<? super T>) — the class to cast; must not be null
-
- Returns: a typed Class reference with generic type information.
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofList(...) -> Class<List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<List<T>> ofList() - Summary: Returns a Class reference for {@code List} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code List<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<List<T>> ofList(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code List} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code List} interface.
- See also: #ofLinkedList(Class),for a specific List implementation, TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#ofList(Class)
ofLinkedList(...) -> Class<List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<List<T>> ofLinkedList() - Summary: Returns a Class reference for {@code LinkedList} with unspecified element type.
-
Contract:
- Useful when you specifically need a LinkedList implementation reference.
-
Parameters:
- (none)
- Returns: the Class object representing {@code LinkedList<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<List<T>> ofLinkedList(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code LinkedList} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code LinkedList<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofListOfMap(...) -> Class<List<Map<K, V>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<List<Map<K, V>>> ofListOfMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code List<Map<K, V>>} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code List<Map<K, V>>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofSetOfMap(...) -> Class<Set<Map<K, V>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<Set<Map<K, V>>> ofSetOfMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code Set<Map<K, V>>} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code Set<Map<K, V>>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofSet(...) -> Class<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Set<T>> ofSet() - Summary: Returns a Class reference for {@code Set} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Set<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Set<T>> ofSet(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code Set} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code Set<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofLinkedHashSet(...) -> Class<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Set<T>> ofLinkedHashSet() - Summary: Returns a Class reference for {@code LinkedHashSet} with unspecified element type.
-
Contract:
- Useful when you need a Set that preserves insertion order.
-
Parameters:
- (none)
- Returns: the Class object representing {@code LinkedHashSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Set<T>> ofLinkedHashSet(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code LinkedHashSet} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code LinkedHashSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofSortedSet(...) -> Class<SortedSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<SortedSet<T>> ofSortedSet() - Summary: Returns a Class reference for {@code SortedSet} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code SortedSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<SortedSet<T>> ofSortedSet(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code SortedSet} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code SortedSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofNavigableSet(...) -> Class<NavigableSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<NavigableSet<T>> ofNavigableSet() - Summary: Returns a Class reference for {@code NavigableSet} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code NavigableSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<NavigableSet<T>> ofNavigableSet(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code NavigableSet} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code NavigableSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofTreeSet(...) -> Class<NavigableSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<NavigableSet<T>> ofTreeSet() - Summary: Returns a Class reference for {@code TreeSet} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code TreeSet<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<NavigableSet<T>> ofTreeSet(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code TreeSet} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code TreeSet} concrete class.
- Performance: </p> <p> <b> Performance: </b> TreeSet provides O(log n) time for add, remove, and contains operations.
- See also: #ofNavigableSet(Class),for the NavigableSet interface, #ofSortedSet(Class),for the SortedSet interface, TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofQueue(...) -> Class<Queue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofQueue() - Summary: Returns a Class reference for {@code Queue} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Queue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofQueue(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code Queue} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code Queue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofDeque(...) -> Class<Deque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Deque<T>> ofDeque() - Summary: Returns a Class reference for {@code Deque} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Deque<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Deque<T>> ofDeque(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code Deque} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code Deque<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofArrayDeque(...) -> Class<Deque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Deque<T>> ofArrayDeque() - Summary: Returns a Class reference for {@code ArrayDeque} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code ArrayDeque<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Deque<T>> ofArrayDeque(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code ArrayDeque} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code ArrayDeque<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofConcurrentLinkedQueue(...) -> Class<Queue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofConcurrentLinkedQueue() - Summary: Returns a Class reference for {@code ConcurrentLinkedQueue} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code ConcurrentLinkedQueue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofConcurrentLinkedQueue(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code ConcurrentLinkedQueue} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code ConcurrentLinkedQueue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofPriorityQueue(...) -> Class<Queue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofPriorityQueue() - Summary: Returns a Class reference for {@code PriorityQueue} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code PriorityQueue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Queue<T>> ofPriorityQueue(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code PriorityQueue} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code PriorityQueue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofLinkedBlockingQueue(...) -> Class<BlockingQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<BlockingQueue<T>> ofLinkedBlockingQueue() - Summary: Returns a Class reference for {@code LinkedBlockingQueue} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code LinkedBlockingQueue<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<BlockingQueue<T>> ofLinkedBlockingQueue(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code LinkedBlockingQueue} with the specified element type.
-
Contract:
- If no capacity is specified, it defaults to {@code Integer.MAX_VALUE} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Class<BlockingQueue<Task>> taskQueueClass = Clazz.ofLinkedBlockingQueue(Task.class); // Producer-consumer pattern BlockingQueue<Task> queue = new LinkedBlockingQueue<>(100); // capacity of 100 queue.put(new Task()); // blocks if queue is full Task task = queue.take(); // blocks if queue is empty } </pre>
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code LinkedBlockingQueue} concrete class.
- See also: #ofQueue(Class),for a non-blocking queue, TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofCollection(...) -> Class<Collection<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Collection<T>> ofCollection() - Summary: Returns a Class reference for {@code Collection} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Collection<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Collection<T>> ofCollection(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code Collection} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference).
-
- Returns: the Class object representing {@code Collection<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofMap(...) -> Class<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<Map<K, V>> ofMap() - Summary: Returns a Class reference for {@code Map} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Map<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<Map<K, V>> ofMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code Map} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code Map<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofLinkedHashMap(...) -> Class<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<Map<K, V>> ofLinkedHashMap() - Summary: Returns a Class reference for {@code LinkedHashMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code LinkedHashMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<Map<K, V>> ofLinkedHashMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code LinkedHashMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code LinkedHashMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofSortedMap(...) -> Class<SortedMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<SortedMap<K, V>> ofSortedMap() - Summary: Returns a Class reference for {@code SortedMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code SortedMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<SortedMap<K, V>> ofSortedMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code SortedMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code SortedMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofNavigableMap(...) -> Class<NavigableMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<NavigableMap<K, V>> ofNavigableMap() - Summary: Returns a Class reference for {@code NavigableMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code NavigableMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<NavigableMap<K, V>> ofNavigableMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code NavigableMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code NavigableMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofTreeMap(...) -> Class<NavigableMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<NavigableMap<K, V>> ofTreeMap() - Summary: Returns a Class reference for {@code TreeMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code TreeMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<NavigableMap<K, V>> ofTreeMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code TreeMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code TreeMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofConcurrentMap(...) -> Class<ConcurrentMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<ConcurrentMap<K, V>> ofConcurrentMap() - Summary: Returns a Class reference for {@code ConcurrentMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code ConcurrentMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<ConcurrentMap<K, V>> ofConcurrentMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code ConcurrentMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference).
-
- Returns: the Class object representing {@code ConcurrentMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofConcurrentHashMap(...) -> Class<ConcurrentMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<ConcurrentMap<K, V>> ofConcurrentHashMap() - Summary: Returns a Class reference for {@code ConcurrentHashMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code ConcurrentHashMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<ConcurrentMap<K, V>> ofConcurrentHashMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code ConcurrentHashMap} with the specified key and value types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference, not retained at runtime). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code ConcurrentHashMap} concrete class.
- See also: #ofConcurrentMap(Class, Class),for the ConcurrentMap interface, TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofBiMap(...) -> Class<BiMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<BiMap<K, V>> ofBiMap() - Summary: Returns a Class reference for {@code BiMap} with unspecified key and value types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code BiMap<K, V>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Class<BiMap<K, V>> ofBiMap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<V> valueCls) - Summary: Returns a Class reference for {@code BiMap} with the specified key and value types.
-
Contract:
- Unlike a regular map, both keys AND values must be unique.
- </p> <p> <b> Uniqueness Constraint: </b> If you attempt to insert a value that already exists, BiMap will throw an {@code IllegalArgumentException} .
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference, not retained at runtime). -
valueCls(@SuppressWarnings(value = "unused") Class<V>) — the class of map values (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code BiMap} interface.
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofMultiset(...) -> Class<Multiset<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Multiset<T>> ofMultiset() - Summary: Returns a Class reference for {@code Multiset} with unspecified element type.
-
Parameters:
- (none)
- Returns: the Class object representing {@code Multiset<T>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Class<Multiset<T>> ofMultiset(@SuppressWarnings("unused") final Class<T> eleCls) - Summary: Returns a Class reference for {@code Multiset} with the specified element type.
-
Parameters:
-
eleCls(@SuppressWarnings(value = "unused") Class<T>) — the class of elements (used only for type inference, not retained at runtime).
-
- Returns: the Class object representing the {@code Multiset} interface.
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofListMultimap(...) -> Class<ListMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Class<ListMultimap<K, E>> ofListMultimap() - Summary: Returns a Class reference for {@code ListMultimap} with unspecified key and value element types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code ListMultimap<K, E>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Class<ListMultimap<K, E>> ofListMultimap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<E> valueEleCls) - Summary: Returns a Class reference for {@code ListMultimap} with the specified key and value element types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueEleCls(@SuppressWarnings(value = "unused") Class<E>) — the class of value collection elements (used only for type inference).
-
- Returns: the Class object representing {@code ListMultimap<K, E>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
ofSetMultimap(...) -> Class<SetMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Class<SetMultimap<K, E>> ofSetMultimap() - Summary: Returns a Class reference for {@code SetMultimap} with unspecified key and value element types.
-
Parameters:
- (none)
- Returns: the Class object representing {@code SetMultimap<K, E>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Class<SetMultimap<K, E>> ofSetMultimap(@SuppressWarnings("unused") final Class<K> keyCls, @SuppressWarnings("unused") final Class<E> valueEleCls) - Summary: Returns a Class reference for {@code SetMultimap} with the specified key and value element types.
-
Parameters:
-
keyCls(@SuppressWarnings(value = "unused") Class<K>) — the class of map keys (used only for type inference). -
valueEleCls(@SuppressWarnings(value = "unused") Class<E>) — the class of value collection elements (used only for type inference).
-
- Returns: the Class object representing {@code SetMultimap<K, E>} .
- See also: TypeReference#type(), com.landawn.abacus.type.Type#of(String), com.landawn.abacus.type.Type#of(Class)
Public Instance Methods
- (none)
Class CodeGenerationUtil (com.landawn.abacus.util.CodeGenerationUtil)
Utility class for generating property name table classes from entity classes.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
generatePropNameTableClass(...) -> String
-
Signature:
@Beta public static String generatePropNameTableClass(final Class<?> entityClass) - Summary: Generates a property name table class as an inner interface for the specified entity class.
-
Parameters:
-
entityClass(Class<?>) — the entity class to generate property names for
-
- Returns: the generated Java code as a string
- See also: #generatePropNameTableClass(Class, String)
-
Signature:
@Beta public static String generatePropNameTableClass(final Class<?> entityClass, final String propNameTableClassName) - Summary: Generates a property name table class as an inner interface for the specified entity class with a custom interface name.
-
Parameters:
-
entityClass(Class<?>) — the entity class to generate property names for -
propNameTableClassName(String) — the name of the generated interface
-
- Returns: the generated Java code as a string
- See also: #generatePropNameTableClass(Class, String, String)
-
Signature:
@Beta public static String generatePropNameTableClass(final Class<?> entityClass, final String propNameTableClassName, final String srcDir) - Summary: Generates a property name table class as an inner interface for the specified entity class and optionally writes it to the source file.
-
Contract:
- <p> If srcDir is provided, the generated code will be inserted into the existing entity class file.
- If the interface already exists, it will be replaced.
-
Parameters:
-
entityClass(Class<?>) — the entity class to generate property names for -
propNameTableClassName(String) — the name of the generated interface -
srcDir(String) — the source directory to write the file to, or null to only return the code
-
- Returns: the generated Java code as a string
generatePropNameTableClasses(...) -> String
-
Signature:
public static String generatePropNameTableClasses(final Collection<Class<?>> entityClasses) - Summary: Generates property name table classes for multiple entity classes using default settings.
-
Parameters:
-
entityClasses(Collection<Class<?>>) — collection of entity classes to process
-
- Returns: the generated Java code as a string
- See also: #generatePropNameTableClasses(Collection, String)
-
Signature:
public static String generatePropNameTableClasses(final Collection<Class<?>> entityClasses, final String propNameTableClassName) - Summary: Generates property name table classes for multiple entity classes with a custom class name.
-
Parameters:
-
entityClasses(Collection<Class<?>>) — collection of entity classes to process -
propNameTableClassName(String) — the name of the generated class
-
- Returns: the generated Java code as a string
- See also: #generatePropNameTableClasses(Collection, String, String, String)
-
Signature:
public static String generatePropNameTableClasses(final Collection<Class<?>> entityClasses, final String propNameTableClassName, final String propNameTableClassPackageName, final String srcDir) - Summary: Generates property name table classes for multiple entity classes with full customization.
-
Parameters:
-
entityClasses(Collection<Class<?>>) — collection of entity classes to process -
propNameTableClassName(String) — the name of the generated class -
propNameTableClassPackageName(String) — the package name for the generated class -
srcDir(String) — the source directory to write the file to, or null to only return the code
-
- Returns: the generated Java code as a string
-
Signature:
public static String generatePropNameTableClasses(final PropNameTableCodeConfig codeConfig) - Summary: Generates property name table classes using a comprehensive configuration object.
-
Parameters:
-
codeConfig(PropNameTableCodeConfig) — the configuration object containing all generation parameters
-
- Returns: the generated Java code as a string
Public Instance Methods
- (none)
Class PropNameTableCodeConfig (com.landawn.abacus.util.CodeGenerationUtil.PropNameTableCodeConfig)
Configuration class for property name table code generation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public PropNameTableCodeConfig() - Summary: Default constructor.
-
Parameters:
- (none)
Enum Color (com.landawn.abacus.util.Color)
An enumeration representing common colors with their associated integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> Color
-
Signature:
public static Color valueOf(final int intValue) - Summary: Returns the Color enum constant corresponding to the specified integer value.
-
Parameters:
-
intValue(int) — the integer value to look up (must be between 0 and 8 inclusive)
-
- Returns: the Color enum constant associated with the specified integer value
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this color.
-
Contract:
- This method is useful when you need to store or transmit colors as numeric values.
-
Parameters:
- (none)
- Returns: the integer value representing this color (0-8)
Class Comparators (com.landawn.abacus.util.Comparators)
A comprehensive factory utility class providing static methods for creating and combining {@link Comparator} instances with sophisticated null handling, type-specific optimizations, and complex comparison scenarios.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
naturalOrder(...) -> Comparator<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Comparable> Comparator<T> naturalOrder() - Summary: Returns a comparator that compares {@link Comparable} objects in their natural order.
-
Parameters:
- (none)
- Returns: a comparator that imposes the natural ordering with nulls first.
- See also: #nullsFirst(), #reverseOrder()
nullsFirst(...) -> Comparator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> Comparator<T> nullsFirst() - Summary: Returns a comparator that compares {@link Comparable} objects in their natural order with {@code null} values considered less than {@code non-null} values.
-
Parameters:
- (none)
- Returns: a comparator that considers {@code null} less than {@code non-null} values, comparing {@code non-null} values in natural order.
- See also: #naturalOrder(), #nullsLast()
-
Signature:
public static <T> Comparator<T> nullsFirst(final Comparator<T> cmp) - Summary: Returns a comparator that considers {@code null} values to be less than {@code non-null} values.
-
Contract:
- When both values are {@code non-null} , the specified comparator is used for comparison.
-
Parameters:
-
cmp(Comparator<T>) — the comparator to use for {@code non-null} values, may be null.
-
- Returns: a comparator that considers {@code null} less than {@code non-null} values, comparing {@code non-null} values using the specified comparator.
nullsFirstBy(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> nullsFirstBy(@SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key using the provided function.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — the function to extract the comparable key from objects
-
- Returns: a comparator that compares by extracted keys with nulls first
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #comparingByIfNotNullOrElseNullsFirst(Function), #comparingByIfNotNullOrElseNullsLast(Function)
nullsFirstOrElseEqual(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> nullsFirstOrElseEqual() - Summary: Returns a comparator that considers {@code null} values to be less than {@code non-null} values, but treats all {@code non-null} values as equal.
-
Contract:
- This is useful when you only want to separate {@code null} from {@code non-null} values without ordering the {@code non-null} values.
-
Parameters:
- (none)
- Returns: a comparator that puts nulls first and treats all {@code non-null} values as equal
- See also: #nullsFirst(), #nullsLastOrElseEqual()
nullsLast(...) -> Comparator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> Comparator<T> nullsLast() - Summary: Returns a comparator that compares {@link Comparable} objects in their natural order with {@code null} values considered greater than {@code non-null} values.
-
Parameters:
- (none)
- Returns: a comparator that considers {@code null} greater than {@code non-null} values, comparing {@code non-null} values in natural order.
- See also: #nullsFirst()
-
Signature:
public static <T> Comparator<T> nullsLast(final Comparator<T> cmp) - Summary: Returns a comparator that considers {@code null} values to be greater than {@code non-null} values.
-
Contract:
- When both values are {@code non-null} , the specified comparator is used for comparison.
-
Parameters:
-
cmp(Comparator<T>) — the comparator to use for {@code non-null} values, may be null.
-
- Returns: a comparator that considers {@code null} greater than {@code non-null} values, comparing {@code non-null} values using the specified comparator.
nullsLastBy(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> nullsLastBy(@SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key using the provided function.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — the function to extract the comparable key from objects
-
- Returns: a comparator that compares by extracted keys with nulls last
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #comparingByIfNotNullOrElseNullsFirst(Function), #comparingByIfNotNullOrElseNullsLast(Function)
nullsLastOrElseEqual(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> nullsLastOrElseEqual() - Summary: Returns a comparator that considers {@code null} values to be greater than {@code non-null} values, but treats all {@code non-null} values as equal.
-
Contract:
- This is useful when you only want to separate {@code null} from {@code non-null} values without ordering the {@code non-null} values.
-
Parameters:
- (none)
- Returns: a comparator that puts nulls last and treats all {@code non-null} values as equal
- See also: #nullsLast(), #nullsFirstOrElseEqual()
emptiesFirst(...) -> Comparator<u.Optional<T>>
-
Signature:
public static <T extends Comparable<? super T>> Comparator<u.Optional<T>> emptiesFirst() - Summary: Returns a comparator for {@link u.Optional} that considers empty optionals to be less than present optionals.
-
Contract:
- When both optionals are present, their values are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a comparator that treats empty optionals as less than present optionals
- See also: #emptiesLast(), #emptiesFirst(Comparator)
-
Signature:
public static <T> Comparator<u.Optional<T>> emptiesFirst(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator for {@link u.Optional} that considers empty optionals to be less than present optionals.
-
Contract:
- When both optionals are present, their values are compared using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing present values
-
- Returns: a comparator that treats empty optionals as less than present optionals
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
emptiesLast(...) -> Comparator<u.Optional<T>>
-
Signature:
public static <T extends Comparable<? super T>> Comparator<u.Optional<T>> emptiesLast() - Summary: Returns a comparator for {@link u.Optional} that considers empty optionals to be greater than present optionals.
-
Contract:
- When both optionals are present, their values are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a comparator that treats empty optionals as greater than present optionals
- See also: #emptiesFirst(), #emptiesLast(Comparator)
-
Signature:
public static <T> Comparator<u.Optional<T>> emptiesLast(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator for {@link u.Optional} that considers empty optionals to be greater than present optionals.
-
Contract:
- When both optionals are present, their values are compared using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing present values
-
- Returns: a comparator that treats empty optionals as greater than present optionals
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingBy(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingBy(@SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key using the provided function.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — the function to extract the comparable key from objects
-
- Returns: a comparator that compares by extracted keys using natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #nullsFirstBy(Function), #nullsLastBy(Function), #comparingByIfNotNullOrElseNullsFirst(Function), #comparingByIfNotNullOrElseNullsLast(Function)
-
Signature:
public static <T, U> Comparator<T> comparingBy(final Function<? super T, ? extends U> keyExtractor, final Comparator<? super U> keyComparator) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a key using the provided function and comparing the keys with the specified comparator.
-
Parameters:
-
keyExtractor(Function<? super T, ? extends U>) — the function to extract keys from objects -
keyComparator(Comparator<? super U>) — the comparator to use for comparing extracted keys
-
- Returns: a comparator that compares objects by their extracted keys
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or keyComparator is null
-
- See also: #comparingByIfNotNullOrElseNullsFirst(Function, Comparator), #comparingByIfNotNullOrElseNullsLast(Function, Comparator)
comparingByIfNotNullOrElseNullsFirst(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> comparingByIfNotNullOrElseNullsFirst( @SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key using the provided function, but only compares {@code non-null} objects.
-
Contract:
- If either object being compared is {@code null} , it is treated as less than any {@code non-null} object.
- <p> This method is useful when you want to handle {@code null} objects specially while still comparing their extracted keys with null-safe natural ordering.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — the function to extract the comparable key from objects
-
- Returns: a comparator that handles {@code null} objects and {@code null} keys appropriately
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #comparingBy(Function), #comparingByIfNotNullOrElseNullsLast(Function)
-
Signature:
public static <T, U> Comparator<T> comparingByIfNotNullOrElseNullsFirst(final Function<? super T, ? extends U> keyExtractor, final Comparator<? super U> keyComparator) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a key using the provided function and comparing the keys with the specified comparator, but only for {@code non-null} objects.
-
Contract:
- If either object being compared is {@code null} , it is treated as less than any {@code non-null} object.
-
Parameters:
-
keyExtractor(Function<? super T, ? extends U>) — the function to extract keys from objects -
keyComparator(Comparator<? super U>) — the comparator to use for comparing extracted keys
-
- Returns: a comparator that handles {@code null} objects appropriately
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or keyComparator is null
-
comparingByIfNotNullOrElseNullsLast(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> comparingByIfNotNullOrElseNullsLast( @SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key using the provided function, but only compares {@code non-null} objects.
-
Contract:
- If either object being compared is {@code null} , it is treated as greater than any {@code non-null} object.
- <p> This method is useful when you want to handle {@code null} objects specially while still comparing their extracted keys with null-safe natural ordering.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — the function to extract the comparable key from objects
-
- Returns: a comparator that handles {@code null} objects and {@code null} keys appropriately
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #comparingBy(Function), #comparingByIfNotNullOrElseNullsFirst(Function)
-
Signature:
public static <T, U> Comparator<T> comparingByIfNotNullOrElseNullsLast(final Function<? super T, ? extends U> keyExtractor, final Comparator<? super U> keyComparator) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a key using the provided function and comparing the keys with the specified comparator, but only for {@code non-null} objects.
-
Contract:
- If either object being compared is {@code null} , it is treated as greater than any {@code non-null} object.
-
Parameters:
-
keyExtractor(Function<? super T, ? extends U>) — the function to extract keys from objects -
keyComparator(Comparator<? super U>) — the comparator to use for comparing extracted keys
-
- Returns: a comparator that handles {@code null} objects appropriately
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or keyComparator is null
-
comparingBoolean(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingBoolean(final ToBooleanFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a boolean value using the provided function.
-
Parameters:
-
keyExtractor(ToBooleanFunction<? super T>) — the function to extract boolean values from objects
-
- Returns: a comparator that compares by extracted boolean values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingChar(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingChar(final ToCharFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a char value using the provided function.
-
Parameters:
-
keyExtractor(ToCharFunction<? super T>) — the function to extract char values from objects
-
- Returns: a comparator that compares by extracted char values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingByte(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingByte(final ToByteFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a byte value using the provided function.
-
Parameters:
-
keyExtractor(ToByteFunction<? super T>) — the function to extract byte values from objects
-
- Returns: a comparator that compares by extracted byte values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingShort(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingShort(final ToShortFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a short value using the provided function.
-
Parameters:
-
keyExtractor(ToShortFunction<? super T>) — the function to extract short values from objects
-
- Returns: a comparator that compares by extracted short values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingInt(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingInt(final ToIntFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting an int value using the provided function.
-
Parameters:
-
keyExtractor(ToIntFunction<? super T>) — the function to extract int values from objects
-
- Returns: a comparator that compares by extracted int values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingLong(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingLong(final ToLongFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a long value using the provided function.
-
Parameters:
-
keyExtractor(ToLongFunction<? super T>) — the function to extract long values from objects
-
- Returns: a comparator that compares by extracted long values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingFloat(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingFloat(final ToFloatFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a float value using the provided function.
-
Parameters:
-
keyExtractor(ToFloatFunction<? super T>) — the function to extract float values from objects
-
- Returns: a comparator that compares by extracted float values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingDouble(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingDouble(final ToDoubleFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a double value using the provided function.
-
Parameters:
-
keyExtractor(ToDoubleFunction<? super T>) — the function to extract double values from objects
-
- Returns: a comparator that compares by extracted double values
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingIgnoreCase(...) -> Comparator<String>
-
Signature:
public static Comparator<String> comparingIgnoreCase() - Summary: Returns a comparator that compares strings ignoring case differences.
-
Parameters:
- (none)
- Returns: a case-insensitive string comparator with nulls first
-
Signature:
public static <T> Comparator<T> comparingIgnoreCase(final Function<? super T, String> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a String value using the provided function and comparing them ignoring case differences.
-
Parameters:
-
keyExtractor(Function<? super T, String>) — the function to extract String values from objects
-
- Returns: a comparator that performs case-insensitive comparison on extracted strings
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
comparingByKey(...) -> Comparator<Map.Entry<K, V>>
-
Signature:
public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K, V>> comparingByKey() - Summary: Returns a comparator for {@link Map.Entry} objects that compares entries by their keys using the keys' natural ordering.
-
Contract:
- Keys must implement {@link Comparable} .
-
Parameters:
- (none)
- Returns: a comparator that compares map entries by their keys
-
Signature:
public static <K, V> Comparator<Map.Entry<K, V>> comparingByKey(final Comparator<? super K> cmp) throws IllegalArgumentException - Summary: Returns a comparator for {@link Map.Entry} objects that compares entries by their keys using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super K>) — the comparator to use for comparing keys
-
- Returns: a comparator that compares map entries by their keys
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingByValue(...) -> Comparator<Map.Entry<K, V>>
-
Signature:
public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K, V>> comparingByValue() - Summary: Returns a comparator for {@link Map.Entry} objects that compares entries by their values using the values' natural ordering.
-
Contract:
- Values must implement {@link Comparable} .
-
Parameters:
- (none)
- Returns: a comparator that compares map entries by their values
-
Signature:
public static <K, V> Comparator<Map.Entry<K, V>> comparingByValue(final Comparator<? super V> cmp) throws IllegalArgumentException - Summary: Returns a comparator for {@link Map.Entry} objects that compares entries by their values using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super V>) — the comparator to use for comparing values
-
- Returns: a comparator that compares map entries by their values
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingByLength(...) -> Comparator<T>
-
Signature:
public static <T extends CharSequence> Comparator<T> comparingByLength() - Summary: Returns a comparator that compares {@link CharSequence} objects by their length.
-
Parameters:
- (none)
- Returns: a comparator that compares CharSequences by length
comparingByArrayLength(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> comparingByArrayLength() - Summary: Returns a comparator that compares arrays by their length.
-
Parameters:
- (none)
- Returns: a comparator that compares arrays by length
comparingBySize(...) -> Comparator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Collection> Comparator<T> comparingBySize() - Summary: Returns a comparator that compares {@link Collection} objects by their size.
-
Parameters:
- (none)
- Returns: a comparator that compares Collections by size
comparingByMapSize(...) -> Comparator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Map> Comparator<T> comparingByMapSize() - Summary: Returns a comparator that compares {@link Map} objects by their size.
-
Parameters:
- (none)
- Returns: a comparator that compares Maps by size
comparingObjArray(...) -> Comparator<Object\[\]>
-
Signature:
@SuppressWarnings("rawtypes") public static Comparator<Object[]> comparingObjArray(final Comparator<?> cmp) - Summary: Returns a comparator that compares {@code Object\[\]} arrays using the specified comparator for element-wise comparison.
-
Contract:
- The arrays are compared lexicographically, with shorter arrays considered less than longer arrays when all compared elements are equal.
- <p> The comparison algorithm: </p> <ol> <li> Empty arrays are considered less than non-empty arrays </li> <li> Elements are compared in order using the provided comparator </li> <li> The first non-equal comparison determines the result </li> <li> If all compared elements are equal, the shorter array is considered less </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Comparator<Object\[\]> cmp = Comparators.comparingObjArray(String.CASE_INSENSITIVE_ORDER); Object\[\] arr1 = {"apple", "banana"}; Object\[\] arr2 = {"APPLE", "CHERRY"}; int result = cmp.compare(arr1, arr2); // returns negative (banana < cherry) } </pre>
-
Parameters:
-
cmp(Comparator<?>) — the comparator to use for comparing array elements
-
- Returns: a comparator that performs lexicographic comparison of Object arrays
comparingArray(...) -> Comparator<T\[\]>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> Comparator<T[]> comparingArray() - Summary: Returns a comparator that compares arrays of {@link Comparable} elements using their natural ordering.
-
Contract:
- The arrays are compared lexicographically, with shorter arrays considered less than longer arrays when all compared elements are equal.
-
Parameters:
- (none)
- Returns: a comparator that performs lexicographic comparison using natural ordering
-
Signature:
public static <T> Comparator<T[]> comparingArray(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares arrays of elements using the specified comparator for element-wise comparison.
-
Contract:
- <p> The comparison algorithm: </p> <ol> <li> If both arrays are empty or {@code null} , they are considered equal </li> <li> An empty/null array is considered less than a non-empty array </li> <li> Elements are compared in order until a difference is found </li> <li> If all compared elements are equal, the shorter array is considered less </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Comparator<Integer\[\]> cmp = Comparators.comparingArray(Integer::compare); Integer\[\] arr1 = {1, 2, 3}; Integer\[\] arr2 = {1, 2, 3, 4}; int result = cmp.compare(arr1, arr2); // returns negative (arr1 is shorter) } </pre>
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing array elements
-
- Returns: a comparator that performs lexicographic comparison of arrays
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingCollection(...) -> Comparator<C>
-
Signature:
@SuppressWarnings("rawtypes") public static <C extends Collection<? extends Comparable>> Comparator<C> comparingCollection() - Summary: Returns a comparator that compares {@link Collection} objects containing {@link Comparable} elements using their natural ordering.
-
Parameters:
- (none)
- Returns: a comparator that performs lexicographic comparison using natural ordering
-
Signature:
public static <T, C extends Collection<T>> Comparator<C> comparingCollection(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Collection} objects using the specified comparator for element-wise comparison.
-
Contract:
- <p> The comparison algorithm: </p> <ol> <li> Empty collections are considered less than non-empty collections </li> <li> Elements are compared in iteration order until a difference is found </li> <li> If all compared elements are equal, the smaller collection is considered less </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Comparator<List<String>> cmp = Comparators.comparingCollection(String.CASE_INSENSITIVE_ORDER); List<String> list1 = Arrays.asList("apple", "BANANA"); List<String> list2 = Arrays.asList("APPLE", "banana", "cherry"); int result = cmp.compare(list1, list2); // returns negative (smaller size) } </pre>
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing collection elements
-
- Returns: a comparator that performs lexicographic comparison of collections
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingIterable(...) -> Comparator<C>
-
Signature:
@SuppressWarnings("rawtypes") public static <C extends Iterable<? extends Comparable>> Comparator<C> comparingIterable() - Summary: Returns a comparator that compares {@link Iterable} objects containing {@link Comparable} elements using their natural ordering.
-
Parameters:
- (none)
- Returns: a comparator that performs lexicographic comparison using natural ordering
-
Signature:
public static <T, C extends Iterable<T>> Comparator<C> comparingIterable(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Iterable} objects using the specified comparator for element-wise comparison.
-
Contract:
- <p> The comparison algorithm: </p> <ol> <li> Empty iterables are considered less than non-empty iterables </li> <li> Elements are compared in iteration order </li> <li> If one iterable is exhausted first, it is considered less </li> <li> If both are exhausted simultaneously with all elements equal, they are equal </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Comparator<Iterable<Person>> cmp = Comparators.comparingIterable( Comparator.comparing(Person::getAge) ); Iterable<Person> team1 = getTeam1(); Iterable<Person> team2 = getTeam2(); int result = cmp.compare(team1, team2); } </pre>
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing iterable elements
-
- Returns: a comparator that performs lexicographic comparison of iterables
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingIterator(...) -> Comparator<C>
-
Signature:
@SuppressWarnings("rawtypes") public static <C extends Iterator<? extends Comparable>> Comparator<C> comparingIterator() - Summary: Returns a comparator that compares {@link Iterator} objects containing {@link Comparable} elements using their natural ordering.
-
Parameters:
- (none)
- Returns: a comparator that performs lexicographic comparison using natural ordering
-
Signature:
public static <T, C extends Iterator<T>> Comparator<C> comparingIterator(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Iterator} objects using the specified comparator for element-wise comparison.
-
Contract:
- Consider using {@link #comparingIterable(Comparator)} if you need to preserve the original data.
- </p> <p> The comparison algorithm: </p> <ol> <li> Empty iterators are considered less than non-empty iterators </li> <li> Elements are consumed and compared until a difference is found </li> <li> If one iterator is exhausted first, it is considered less </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Iterator<String> iter1 = getDataStream1(); Iterator<String> iter2 = getDataStream2(); Comparator<Iterator<String>> cmp = Comparators.comparingIterator(String::compareToIgnoreCase); int result = cmp.compare(iter1, iter2); // Both iterators are now partially or fully consumed } </pre>
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparing iterator elements
-
- Returns: a comparator that performs lexicographic comparison of iterators
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingMapByKey(...) -> Comparator<M>
-
Signature:
@SuppressWarnings("rawtypes") public static <M extends Map<? extends Comparable, ?>> Comparator<M> comparingMapByKey() - Summary: Returns a comparator that compares {@link Map} objects by their keys using the natural ordering of the keys.
-
Parameters:
- (none)
- Returns: a comparator that compares maps by their keys using natural ordering
-
Signature:
public static <K, M extends Map<K, ?>> Comparator<M> comparingMapByKey(final Comparator<? super K> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Map} objects by their keys using the specified comparator.
-
Contract:
- <p> The comparison algorithm: </p> <ol> <li> Empty maps are considered less than non-empty maps </li> <li> Keys are compared in iteration order using the provided comparator </li> <li> If all compared keys are equal, the smaller map is considered less </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Comparator<Map<String, Integer>> cmp = Comparators.comparingMapByKey( String.CASE_INSENSITIVE_ORDER ); Map<String, Integer> map1 = Map.of("apple", 1, "BANANA", 2); Map<String, Integer> map2 = Map.of("APPLE", 1, "banana", 2, "cherry", 3); int result = cmp.compare(map1, map2); // returns negative (smaller size) } </pre>
-
Parameters:
-
cmp(Comparator<? super K>) — the comparator to use for comparing map keys
-
- Returns: a comparator that compares maps by their keys
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingMapByValue(...) -> Comparator<M>
-
Signature:
@SuppressWarnings("rawtypes") public static <M extends Map<?, ? extends Comparable>> Comparator<M> comparingMapByValue() - Summary: Returns a comparator that compares {@link Map} objects by their values using the natural ordering of the values.
-
Contract:
- This comparator is most useful when the iteration order is meaningful.
-
Parameters:
- (none)
- Returns: a comparator that compares maps by their values using natural ordering
-
Signature:
public static <V, M extends Map<?, V>> Comparator<M> comparingMapByValue(final Comparator<? super V> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Map} objects by their values using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super V>) — the comparator to use for comparing map values
-
- Returns: a comparator that compares maps by their values
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
comparingBeanByProps(...) -> Comparator<T>
-
Signature:
@Deprecated public static <T> Comparator<T> comparingBeanByProps(final Collection<String> propNamesToCompare) throws IllegalArgumentException - Summary: Returns a comparator that compares Java beans by extracting and comparing the specified properties using reflection.
-
Parameters:
-
propNamesToCompare(Collection<String>) — collection of property names to compare in order
-
- Returns: a comparator that compares beans by the specified properties
-
Throws:
-
java.lang.IllegalArgumentException— if propNamesToCompare is {@code null} or contains invalid property names
-
- See also: Builder#compare(Object, Object, Comparator), ComparisonBuilder
reverseOrder(...) -> Comparator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> Comparator<T> reverseOrder() - Summary: Returns a comparator that imposes the reverse of the natural ordering on a collection of {@link Comparable} objects.
-
Contract:
- <p> The returned comparator does NOT throw {@link NullPointerException} when comparing {@code null} values.
- Instead, {@code null} is considered greater than any {@code non-null} value, and when both values are {@code null} , they are considered equal.
-
Parameters:
- (none)
- Returns: a comparator that imposes the reverse natural ordering with nulls last
-
Signature:
public static <T> Comparator<T> reverseOrder(final Comparator<T> cmp) - Summary: Returns a comparator that imposes the reverse ordering of the specified comparator.
-
Contract:
- If the specified comparator is {@code null} or the natural order comparator, returns the reverse natural order comparator.
- If the specified comparator is already the reverse natural order comparator, returns the natural order comparator.
-
Parameters:
-
cmp(Comparator<T>) — the comparator to reverse, or {@code null} for natural order
-
- Returns: a comparator that imposes the reverse ordering of cmp
reversedComparingBoolean(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingBoolean(final ToBooleanFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a boolean key and comparing in reverse order.
-
Contract:
- <p> This is useful when you want to sort items with a boolean property where true values should appear first (since normal boolean ordering places {@code false} before true).
-
Parameters:
-
keyExtractor(ToBooleanFunction<? super T>) — function to extract boolean keys from objects
-
- Returns: a comparator that compares by extracted boolean values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingChar(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingChar(final ToCharFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a char key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToCharFunction<? super T>) — function to extract char keys from objects
-
- Returns: a comparator that compares by extracted char values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingByte(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingByte(final ToByteFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a byte key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToByteFunction<? super T>) — function to extract byte keys from objects
-
- Returns: a comparator that compares by extracted byte values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingShort(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingShort(final ToShortFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a short key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToShortFunction<? super T>) — function to extract short keys from objects
-
- Returns: a comparator that compares by extracted short values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingInt(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingInt(final ToIntFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting an int key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToIntFunction<? super T>) — function to extract int keys from objects
-
- Returns: a comparator that compares by extracted int values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingLong(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingLong(final ToLongFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a long key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToLongFunction<? super T>) — function to extract long keys from objects
-
- Returns: a comparator that compares by extracted long values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingFloat(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingFloat(final ToFloatFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a float key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToFloatFunction<? super T>) — function to extract float keys from objects
-
- Returns: a comparator that compares by extracted float values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingDouble(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingDouble(final ToDoubleFunction<? super T> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a double key and comparing in reverse order.
-
Parameters:
-
keyExtractor(ToDoubleFunction<? super T>) — function to extract double keys from objects
-
- Returns: a comparator that compares by extracted double values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingBy(...) -> Comparator<T>
-
Signature:
public static <T> Comparator<T> reversedComparingBy(@SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key and comparing in reverse order.
-
Contract:
- The extracted keys must implement Comparable and are compared using their natural ordering in reverse.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — function to extract Comparable keys from objects
-
- Returns: a comparator that compares by extracted Comparable values in reverse order
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #reversedComparingByIfNotNullOrElseNullsFirst(Function), #reversedComparingByIfNotNullOrElseNullsLast(Function)
reversedComparingByIfNotNullOrElseNullsFirst(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> reversedComparingByIfNotNullOrElseNullsFirst( @SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key and comparing in reverse order, with special {@code null} handling.
-
Contract:
- If either object being compared is {@code null} , it is treated as the minimum value (nulls first).
- <p> This method is useful when you need reverse ordering but want to ensure that {@code null} objects appear at the beginning of the sorted collection.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — function to extract Comparable keys from objects
-
- Returns: a comparator with reverse ordering and nulls-first behavior
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingByIfNotNullOrElseNullsLast(...) -> Comparator<T>
-
Signature:
@Beta public static <T> Comparator<T> reversedComparingByIfNotNullOrElseNullsLast( @SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a comparator that compares objects by extracting a {@link Comparable} key and comparing in reverse order, with special {@code null} handling.
-
Contract:
- If either object being compared is {@code null} , it is treated as the maximum value (nulls last).
- <p> This method is useful when you need reverse ordering but want to ensure that {@code null} objects appear at the end of the sorted collection.
-
Parameters:
-
keyExtractor(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — function to extract Comparable keys from objects
-
- Returns: a comparator with reverse ordering and nulls-last behavior
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
reversedComparingByKey(...) -> Comparator<Map.Entry<K, V>>
-
Signature:
public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K, V>> reversedComparingByKey() - Summary: Returns a comparator that compares {@link Map.Entry} objects by their keys in reverse natural ordering.
-
Contract:
- The keys must implement {@link Comparable} .
- <p> This comparator is useful for sorting map entries by key in descending order, such as when processing map entries in reverse alphabetical or reverse numeric order.
-
Parameters:
- (none)
- Returns: a comparator that compares entries by key in reverse natural order
-
Signature:
@Beta public static <K, V> Comparator<Map.Entry<K, V>> reversedComparingByKey(final Comparator<? super K> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Map.Entry} objects by their keys in reverse order using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super K>) — the comparator to use for comparing keys (will be reversed)
-
- Returns: a comparator that compares entries by key using reversed cmp
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
reversedComparingByValue(...) -> Comparator<Map.Entry<K, V>>
-
Signature:
public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K, V>> reversedComparingByValue() - Summary: Returns a comparator that compares {@link Map.Entry} objects by their values in reverse natural ordering.
-
Contract:
- The values must implement {@link Comparable} .
-
Parameters:
- (none)
- Returns: a comparator that compares entries by value in reverse natural order
-
Signature:
@Beta public static <K, V> Comparator<Map.Entry<K, V>> reversedComparingByValue(final Comparator<? super V> cmp) throws IllegalArgumentException - Summary: Returns a comparator that compares {@link Map.Entry} objects by their values in reverse order using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super V>) — the comparator to use for comparing values (will be reversed)
-
- Returns: a comparator that compares entries by value using reversed cmp
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
Public Instance Methods
- (none)
Enum CompressionMode (com.landawn.abacus.util.CompressionMode)
Enumeration of supported compression modes for data compression operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class ContinuableFuture (com.landawn.abacus.util.ContinuableFuture)
A powerful and flexible asynchronous computation framework that extends the standard {@link Future} interface with advanced functional composition capabilities, recursive cancellation support, and fluent chaining operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
run(...) -> ContinuableFuture<Void>
-
Signature:
public static ContinuableFuture<Void> run(final Throwables.Runnable<? extends Exception> action) - Summary: Executes the provided action asynchronously and returns a {@code ContinuableFuture} representing the pending completion of the action.
-
Parameters:
-
action(Throwables.Runnable<? extends Exception>) — the action to be executed asynchronously.
-
- Returns: a {@code ContinuableFuture<Void>} representing the pending completion of the action.
- See also: N#asyncExecute(Throwables.Runnable)
-
Signature:
public static ContinuableFuture<Void> run(final Throwables.Runnable<? extends Exception> action, final Executor executor) - Summary: Executes the provided action asynchronously using the specified executor and returns a {@code ContinuableFuture} representing the pending completion of the action.
-
Contract:
- <p> This method allows you to specify a custom executor for running the action, which is useful when you need specific thread pool characteristics or execution policies.
-
Parameters:
-
action(Throwables.Runnable<? extends Exception>) — the action to be executed asynchronously. -
executor(Executor) — the executor to use for running the action.
-
- Returns: a {@code ContinuableFuture<Void>} representing the pending completion of the action.
call(...) -> ContinuableFuture<T>
-
Signature:
public static <T> ContinuableFuture<T> call(final Callable<T> action) - Summary: Executes the provided callable action asynchronously and returns a {@code ContinuableFuture} representing the pending result of the action.
-
Parameters:
-
action(Callable<T>) — the callable action to be executed asynchronously.
-
- Returns: a {@code ContinuableFuture<T>} representing the pending result of the action.
- See also: N#asyncExecute(Callable)
-
Signature:
public static <T> ContinuableFuture<T> call(final Callable<T> action, final Executor executor) - Summary: Executes the provided callable action asynchronously using the specified executor and returns a {@code ContinuableFuture} representing the pending result of the action.
-
Parameters:
-
action(Callable<T>) — the callable action to be executed asynchronously. -
executor(Executor) — the executor to use for running the action.
-
- Returns: a {@code ContinuableFuture<T>} representing the pending result of the action.
completed(...) -> ContinuableFuture<T>
-
Signature:
public static <T> ContinuableFuture<T> completed(final T result) - Summary: Returns a {@code ContinuableFuture} that is already completed with the provided result.
-
Contract:
- This is useful for creating a future that represents an immediately available value, often used in testing or when converting synchronous code to asynchronous patterns.
- <p> The returned future: <ul> <li> Cannot be cancelled (returns false) </li> <li> Is always done (returns true) </li> <li> Returns the provided result immediately from get() methods </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Create a pre-completed future ContinuableFuture<String> future = ContinuableFuture.completed("Hello"); // This doesn't block and returns immediately String result = future.get(); // "Hello" // Useful for conditional async operations ContinuableFuture<Data> loadData(boolean useCache) { if (useCache && cache.contains(key)) { return ContinuableFuture.completed(cache.get(key)); } return ContinuableFuture.call(() -> fetchFromDatabase(key)); } } </pre>
-
Parameters:
-
result(T) — the result that the future should be completed with.
-
- Returns: a {@code ContinuableFuture} that is already completed with the provided result.
wrap(...) -> ContinuableFuture<T>
-
Signature:
public static <T> ContinuableFuture<T> wrap(final Future<T> future) - Summary: Wraps an existing {@code Future} into a {@code ContinuableFuture} , enabling the use of composition and chaining methods.
-
Contract:
- This is useful when integrating with APIs that return standard {@code Future} objects.
-
Parameters:
-
future(Future<T>) — the future to wrap.
-
- Returns: a {@code ContinuableFuture} that wraps the provided future.
Public Instance Methods
cancel(...) -> boolean
-
Signature:
@Override public boolean cancel(final boolean mayInterruptIfRunning) - Summary: Attempts to cancel execution of this task.
-
Contract:
- If the task has already completed, has already been cancelled, or could not be cancelled for some other reason, this attempt will fail.
- Subsequent calls to {@link #isCancelled()} will always return {@code true} if this method returned {@code true} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future = ContinuableFuture.call(() -> { Thread.sleep(5000); return "Result"; }); // Cancel after 1 second Thread.sleep(1000); boolean cancelled = future.cancel(true); // Interrupt if running } </pre>
-
Parameters:
-
mayInterruptIfRunning(boolean) — {@code true} if the thread executing this task should be interrupted;. otherwise, in-progress tasks are allowed to complete.
-
- Returns: {@code false} if the task could not be cancelled, typically because it has already. completed normally; {@code true} otherwise.
- See also: Future#cancel(boolean)
isCancelled(...) -> boolean
-
Signature:
@Override public boolean isCancelled() - Summary: Returns {@code true} if this task was cancelled before it completed normally.
-
Contract:
- Returns {@code true} if this task was cancelled before it completed normally.
- A task that has been cancelled will never complete normally and will throw a {@code CancellationException} when {@link #get()} is called.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future = ContinuableFuture.call(() -> longRunningTask()); // In another thread future.cancel(true); if (future.isCancelled()) { System.out.println("Task was cancelled"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if this task was cancelled before it completed.
- See also: Future#isCancelled()
cancelAll(...) -> boolean
-
Signature:
public boolean cancelAll(final boolean mayInterruptIfRunning) - Summary: Cancels this future and all upstream futures in the chain recursively.
-
Contract:
- This method is useful when you have a chain of dependent futures and want to cancel the entire computation pipeline.
- <p> The method attempts to cancel all futures in the chain and returns {@code true} only if all cancellations were successful.
- If any future in the chain fails to cancel, the method still attempts to cancel the remaining futures.
-
Parameters:
-
mayInterruptIfRunning(boolean) — {@code true} if the thread executing the tasks should be interrupted;. otherwise, in-progress tasks are allowed to complete.
-
- Returns: {@code true} if all futures in the chain were successfully cancelled; {@code false} if. any future failed to cancel.
- See also: #cancel(boolean), Future#cancel(boolean)
isAllCancelled(...) -> boolean
-
Signature:
public boolean isAllCancelled() - Summary: Checks if this task and all upstream futures in the chain have been cancelled.
-
Contract:
- Checks if this task and all upstream futures in the chain have been cancelled.
- <p> Returns {@code true} only if every future in the chain has been cancelled.
- If any future in the chain is not cancelled, this method returns {@code false} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future1 = ContinuableFuture.call(() -> step1()); ContinuableFuture<String> future2 = future1.thenCallAsync(data -> step2(data)); future2.cancelAll(true); if (future2.isAllCancelled()) { System.out.println("Entire chain was cancelled"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if all futures in the chain have been cancelled; {@code false} otherwise.
- See also: #isCancelled(), Future#isCancelled()
isDone(...) -> boolean
-
Signature:
@Override public boolean isDone() - Summary: Returns {@code true} if this task completed.
-
Contract:
- Returns {@code true} if this task completed.
-
Parameters:
- (none)
- Returns: {@code true} if this task completed.
- See also: Future#isDone()
get(...) -> T
-
Signature:
@Override public T get() throws InterruptedException, ExecutionException - Summary: Waits if necessary for the computation to complete, and then retrieves its result.
-
Contract:
- Waits if necessary for the computation to complete, and then retrieves its result.
- <p> If the computation was cancelled, this method throws a {@code CancellationException} .
- If the computation threw an exception, this method throws an {@code ExecutionException} with the original exception as its cause.
-
Parameters:
- (none)
- Returns: the computed result.
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception.
-
- See also: Future#get()
-
Signature:
@Override public T get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Summary: Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
-
Contract:
- Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument.
-
- Returns: the computed result.
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception. -
java.util.concurrent.TimeoutException— if the wait timed out.
-
- See also: Future#get(long, TimeUnit)
gett(...) -> Result<T, Exception>
-
Signature:
public Result<T, Exception> gett() - Summary: Retrieves the result of the computation when it completes, wrapping both the result and any exception into a {@link Result} object.
-
Contract:
- Retrieves the result of the computation when it completes, wrapping both the result and any exception into a {@link Result} object.
- <p> The returned {@code Result} object encapsulates either: <ul> <li> The successful result of the computation </li> <li> The exception that occurred during computation or while waiting </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future = ContinuableFuture.call(() -> riskyOperation()); Result<String, Exception> result = future.gett(); if (result.isSuccess()) { System.out.println("Success: " + result.orElseThrow()); } else { System.err.println("Failed: " + result.getException()); } // Or use functional style String value = result.orElse("default value"); } </pre>
-
Parameters:
- (none)
- Returns: a {@code Result} object containing either the computed result or the exception.
-
Signature:
public Result<T, Exception> gett(final long timeout, final TimeUnit unit) - Summary: Retrieves the result of the computation when it completes within the specified timeout, wrapping both the result and any exception into a {@link Result} object.
-
Contract:
- Retrieves the result of the computation when it completes within the specified timeout, wrapping both the result and any exception into a {@link Result} object.
- <p> This is the timeout version of {@link #gett()} , useful when you want to limit the waiting time but still handle results in a functional style without checked exceptions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> future = ContinuableFuture.call(() -> fetchData()); Result<Data, Exception> result = future.gett(10, TimeUnit.SECONDS); Data data = result.orElseGet(() -> { if (result.getException() instanceof TimeoutException) { return getCachedData(); // Fallback on timeout } return getDefaultData(); }); } </pre>
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument.
-
- Returns: a {@code Result} object containing either the computed result or the exception.
getNow(...) -> T
-
Signature:
public T getNow(final T defaultValue) throws InterruptedException, ExecutionException - Summary: Returns the result value if the computation is already complete, otherwise returns the provided default value without blocking.
-
Contract:
- Returns the result value if the computation is already complete, otherwise returns the provided default value without blocking.
- <p> Note that this method still throws exceptions if the future is done but completed exceptionally.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future = ContinuableFuture.call(() -> slowComputation()); // Check immediately without blocking String result = future.getNow("Computing..."); System.out.println(result); // Prints "Computing..." if not done // Polling pattern while (true) { String current = future.getNow(null); if (current != null) { System.out.println("Got result: " + current); break; } Thread.sleep(100); } } </pre>
-
Parameters:
-
defaultValue(T) — the value to return if the computation is not yet complete.
-
- Returns: the computed result if complete, otherwise the defaultValue.
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while checking. -
java.util.concurrent.ExecutionException— if the computation threw an exception.
-
getThenApply(...) -> U
-
Signature:
public <U, E extends Exception> U getThenApply(final Throwables.Function<? super T, ? extends U, E> action) throws InterruptedException, ExecutionException, E - Summary: Waits for the computation to complete and then applies the provided function to the result.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Integer> future = ContinuableFuture.call(() -> 42); // Transform the result synchronously after completion String result = future.getThenApply(num -> "The answer is: " + num); System.out.println(result); // "The answer is: 42" // Can throw checked exceptions Data processed = future.getThenApply(num -> { if (num < 0) throw new IllegalArgumentException("Negative!"); return processNumber(num); // May throw IOException }); } </pre>
-
Parameters:
-
action(Throwables.Function<? super T, ? extends U, E>) — the function to apply to the result.
-
- Returns: the result of applying the function to the computed result.
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception. -
E— if the function throws an exception.
-
-
Signature:
public <U, E extends Exception> U getThenApply(final long timeout, final TimeUnit unit, final Throwables.Function<? super T, ? extends U, E> action) throws InterruptedException, ExecutionException, TimeoutException, E - Summary: Waits for the computation to complete within the specified timeout and then applies the provided function to the result.
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument. -
action(Throwables.Function<? super T, ? extends U, E>) — the function to apply to the result.
-
- Returns: the result of applying the function to the computed result.
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception. -
java.util.concurrent.TimeoutException— if the wait timed out. -
E— if the function throws an exception.
-
-
Signature:
public <U, E extends Exception> U getThenApply(final Throwables.BiFunction<? super T, ? super Exception, ? extends U, E> action) throws E - Summary: Waits for the computation to complete and then applies the provided bi-function to both the result (if successful) and any exception that occurred.
-
Contract:
- Waits for the computation to complete and then applies the provided bi-function to both the result (if successful) and any exception that occurred.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Integer> future = ContinuableFuture.call(() -> { if (Math.random() > 0.5) throw new RuntimeException("Bad luck!"); return 42; }); String message = future.getThenApply((result, exception) -> { if (exception != null) { return "Failed: " + exception.getMessage(); } return "Success: " + result; }); } </pre>
-
Parameters:
-
action(Throwables.BiFunction<? super T, ? super Exception, ? extends U, E>) — the bi-function to apply to the result and exception.
-
- Returns: the result of applying the function.
-
Throws:
-
E— if the bi-function throws an exception.
-
- See also: #gett()
-
Signature:
public <U, E extends Exception> U getThenApply(final long timeout, final TimeUnit unit, final Throwables.BiFunction<? super T, ? super Exception, ? extends U, E> action) throws E - Summary: Waits for the computation to complete within the specified timeout and then applies the provided bi-function to both the result (if successful) and any exception that occurred.
-
Contract:
- Waits for the computation to complete within the specified timeout and then applies the provided bi-function to both the result (if successful) and any exception that occurred.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> future = ContinuableFuture.call(() -> fetchFromSlowService()); Response response = future.getThenApply(10, TimeUnit.SECONDS, (data, exception) -> { if (exception instanceof TimeoutException) { return Response.timeout(); } else if (exception != null) { return Response.error(exception); } return Response.success(data); }); } </pre>
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument. -
action(Throwables.BiFunction<? super T, ? super Exception, ? extends U, E>) — the bi-function to apply to the result and exception.
-
- Returns: the result of applying the function.
-
Throws:
-
E— if the bi-function throws an exception.
-
- See also: #gett(long, TimeUnit)
getThenAccept(...) -> void
-
Signature:
public <E extends Exception> void getThenAccept(final Throwables.Consumer<? super T, E> action) throws InterruptedException, ExecutionException, E - Summary: Waits for the computation to complete and then consumes the result with the provided consumer.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<String> future = ContinuableFuture.call(() -> downloadFile()); // Process the result when ready future.getThenAccept(filePath -> { System.out.println("Downloaded to: " + filePath); processFile(filePath); }); } </pre>
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the consumer to execute with the result.
-
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception. -
E— if the consumer throws an exception.
-
-
Signature:
public <E extends Exception> void getThenAccept(final long timeout, final TimeUnit unit, final Throwables.Consumer<? super T, E> action) throws InterruptedException, ExecutionException, TimeoutException, E - Summary: Waits for the computation to complete within the specified timeout and then consumes the result with the provided consumer.
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument. -
action(Throwables.Consumer<? super T, E>) — the consumer to execute with the result.
-
-
Throws:
-
java.lang.InterruptedException— if the current thread was interrupted while waiting. -
java.util.concurrent.ExecutionException— if the computation threw an exception. -
java.util.concurrent.TimeoutException— if the wait timed out. -
E— if the consumer throws an exception.
-
-
Signature:
public <E extends Exception> void getThenAccept(final Throwables.BiConsumer<? super T, ? super Exception, E> action) throws E - Summary: Waits for the computation to complete and then consumes both the result (if successful) and any exception that occurred with the provided bi-consumer.
-
Contract:
- Waits for the computation to complete and then consumes both the result (if successful) and any exception that occurred with the provided bi-consumer.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<User> future = ContinuableFuture.call(() -> fetchUser(userId)); future.getThenAccept((user, exception) -> { if (exception != null) { logger.error("Failed to fetch user " + userId, exception); notifyError(exception); } else { logger.info("Fetched user: " + user.getName()); updateCache(user); } }); } </pre>
-
Parameters:
-
action(Throwables.BiConsumer<? super T, ? super Exception, E>) — the bi-consumer to execute with the result and exception.
-
-
Throws:
-
E— if the bi-consumer throws an exception.
-
- See also: #gett()
-
Signature:
public <E extends Exception> void getThenAccept(final long timeout, final TimeUnit unit, final Throwables.BiConsumer<? super T, ? super Exception, E> action) throws E - Summary: Waits for the computation to complete within the specified timeout and then consumes both the result (if successful) and any exception that occurred with the provided bi-consumer.
-
Contract:
- Waits for the computation to complete within the specified timeout and then consumes both the result (if successful) and any exception that occurred with the provided bi-consumer.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Config> future = ContinuableFuture.call(() -> loadConfig()); future.getThenAccept(5, TimeUnit.SECONDS, (config, exception) -> { if (exception instanceof TimeoutException) { useDefaultConfig(); } else if (exception != null) { handleConfigError(exception); } else { applyConfig(config); } }); } </pre>
-
Parameters:
-
timeout(long) — the maximum time to wait. -
unit(TimeUnit) — the time unit of the timeout argument. -
action(Throwables.BiConsumer<? super T, ? super Exception, E>) — the bi-consumer to execute with the result and exception.
-
-
Throws:
-
E— if the bi-consumer throws an exception.
-
- See also: #gett(long, TimeUnit)
map(...) -> ContinuableFuture<U>
-
Signature:
@Beta public <U> ContinuableFuture<U> map(final Throwables.Function<? super T, ? extends U, ? extends Exception> func) - Summary: Transforms the result of this future by applying the provided function when the future completes.
-
Contract:
- Transforms the result of this future by applying the provided function when the future completes.
- This method returns immediately with a new {@code ContinuableFuture} that will complete with the transformed result when this future completes and the function is applied.
- <p> If the function throws an exception, the returned future will complete exceptionally with that exception wrapped in a {@code RuntimeException} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Integer> future = ContinuableFuture.call(() -> 21); // Transform the result asynchronously ContinuableFuture<String> stringFuture = future.map(num -> { return "The result is: " + (num * 2); }); // The transformation happens when the original completes System.out.println(stringFuture.get()); // "The result is: 42" } </pre>
-
Parameters:
-
func(Throwables.Function<? super T, ? extends U, ? extends Exception>) — the function to apply to the result.
-
- Returns: a new {@code ContinuableFuture} with the transformed result.
thenRunAsync(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> thenRunAsync(final Throwables.Runnable<? extends Exception> action) - Summary: Executes the provided action asynchronously after this future completes.
-
Contract:
- <p> This method returns immediately with a new {@code ContinuableFuture<Void>} that completes when the action finishes executing.
-
Parameters:
-
action(Throwables.Runnable<? extends Exception>) — the action to execute after this future completes.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
-
Signature:
public ContinuableFuture<Void> thenRunAsync(final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Executes the provided consumer asynchronously after this future completes, passing the result to the consumer.
-
Contract:
- <p> This method returns immediately with a new {@code ContinuableFuture<Void>} that completes when the consumer finishes executing.
- The consumer receives the result of this future if it completes successfully.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends Exception>) — the consumer to execute with the result.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
-
Signature:
public ContinuableFuture<Void> thenRunAsync(final Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception> action) - Summary: Executes the provided bi-consumer asynchronously after this future completes, passing both the result (if successful) and any exception that occurred.
-
Contract:
- Executes the provided bi-consumer asynchronously after this future completes, passing both the result (if successful) and any exception that occurred.
- <p> This method returns immediately with a new {@code ContinuableFuture<Void>} that completes when the bi-consumer finishes executing.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture.call(() -> riskyOperation()) .thenRunAsync((result, exception) -> { if (exception != null) { logger.error("Operation failed", exception); sendAlert(exception); } else { logger.info("Operation succeeded: " + result); processResult(result); } }) .thenRunAsync(() -> cleanup()); } </pre>
-
Parameters:
-
action(Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception>) — the bi-consumer to execute with the result and exception.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
- See also: #gett()
thenCallAsync(...) -> ContinuableFuture<R>
-
Signature:
public <R> ContinuableFuture<R> thenCallAsync(final Callable<R> action) - Summary: Executes the provided callable asynchronously after this future completes.
-
Parameters:
-
action(Callable<R>) — the callable to execute after this future completes.
-
- Returns: a new {@code ContinuableFuture<R>} with the result of the callable.
-
Signature:
public <R> ContinuableFuture<R> thenCallAsync(final Throwables.Function<? super T, ? extends R, ? extends Exception> action) - Summary: Executes the provided function asynchronously after this future completes, transforming the result.
-
Contract:
- This method is similar to {@link #map(Throwables.Function)} but executes asynchronously in the configured executor rather than synchronously when get() is called.
-
Parameters:
-
action(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to apply to the result.
-
- Returns: a new {@code ContinuableFuture<R>} with the transformed result.
-
Signature:
public <R> ContinuableFuture<R> thenCallAsync(final Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception> action) - Summary: Executes the provided bi-function asynchronously after this future completes, transforming the result based on both the value and any exception.
-
Contract:
- The bi-function is executed using the configured executor of this future and receives both the result (if successful) and any exception that occurred.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> future = ContinuableFuture.call(() -> fetchFromPrimary()) .thenCallAsync((data, exception) -> { if (exception != null) { logger.warn("Primary failed, using fallback", exception); return fetchFromSecondary(); // Recovery } return enhanceData(data); }); } </pre>
-
Parameters:
-
action(Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception>) — the bi-function to apply to the result and exception.
-
- Returns: a new {@code ContinuableFuture<R>} with the transformed result.
- See also: #gett()
runAsyncAfterBoth(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> runAsyncAfterBoth(final ContinuableFuture<?> other, final Throwables.Runnable<? extends Exception> action) - Summary: Executes the provided action asynchronously after both this future and the other future complete.
-
Contract:
- <p> The returned future completes when the action completes.
- If either future fails, the returned future completes exceptionally with the first exception encountered.
-
Parameters:
-
other(ContinuableFuture<?>) — the other future to wait for. -
action(Throwables.Runnable<? extends Exception>) — the action to execute after both futures complete.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
-
Signature:
public <U> ContinuableFuture<Void> runAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.BiConsumer<? super T, ? super U, ? extends Exception> action) - Summary: Executes the provided bi-consumer asynchronously after both this future and the other future complete, passing both results to the consumer.
-
Contract:
- <p> The returned future completes when the consumer completes.
- If either future fails, the returned future completes exceptionally with the first exception encountered.
-
Parameters:
-
other(ContinuableFuture<U>) — the other future to wait for. -
action(Throwables.BiConsumer<? super T, ? super U, ? extends Exception>) — the bi-consumer to execute with both results.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
-
Signature:
public <U> ContinuableFuture<Void> runAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.Consumer<? super Tuple4<T, ? super Exception, U, ? super Exception>, ? extends Exception> action) - Summary: Executes the provided consumer asynchronously after both this future and the other future complete, passing a {@link Tuple4} containing both results and any exceptions to the consumer.
-
Contract:
- <p> The tuple contains: (result1, exception1, result2, exception2) where: <ul> <li> result1/exception1 are from this future </li> <li> result2/exception2 are from the other future </li> <li> If a future succeeds, its result is {@code non-null} and exception is null </li> <li> If a future fails, its result is {@code null} and exception is non-null </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> primary = ContinuableFuture.call(() -> fetchPrimary()); ContinuableFuture<Data> backup = ContinuableFuture.call(() -> fetchBackup()); primary.runAsyncAfterBoth(backup, tuple -> { if (tuple._2 == null) { // primary succeeded processData(tuple._1); } else if (tuple._4 == null) { // backup succeeded processData(tuple._3); } else { handleBothFailed(tuple._2, tuple._4); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<U>) — the other future to wait for. -
action(Throwables.Consumer<? super Tuple4<T, ? super Exception, U, ? super Exception>, ? extends Exception>) — the consumer to execute with the tuple of results and exceptions.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
- See also: #gett()
-
Signature:
public <U> ContinuableFuture<Void> runAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.QuadConsumer<? super T, ? super Exception, ? super U, ? super Exception, ? extends Exception> action) - Summary: Executes the provided quad-consumer asynchronously after both this future and the other future complete, passing all four values (both results and exceptions) as separate parameters.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Order> orderFuture = ContinuableFuture.call(() -> createOrder()); ContinuableFuture<Payment> paymentFuture = ContinuableFuture.call(() -> processPayment()); orderFuture.runAsyncAfterBoth(paymentFuture, (order, orderEx, payment, paymentEx) -> { if (orderEx != null || paymentEx != null) { rollbackTransaction(order, payment, orderEx, paymentEx); } else { confirmTransaction(order, payment); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<U>) — the other future to wait for. -
action(Throwables.QuadConsumer<? super T, ? super Exception, ? super U, ? super Exception, ? extends Exception>) — the quad-consumer to execute with both results and exceptions.
-
- Returns: a new {@code ContinuableFuture<Void>} representing the completion of the action.
- See also: #gett()
callAsyncAfterBoth(...) -> ContinuableFuture<R>
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterBoth(final ContinuableFuture<?> other, final Callable<R> action) - Summary: Executes the provided callable asynchronously after both this future and the other future complete successfully.
-
Contract:
- If either input future fails, the returned future completes exceptionally with the first exception encountered, without executing the callable.
-
Parameters:
-
other(ContinuableFuture<?>) — the other future to wait for completion; must not be null. -
action(Callable<R>) — the callable to execute after both futures complete; must not be null.
-
- Returns: a new {@code ContinuableFuture<R>} that completes with the result of the callable.
-
Signature:
public <U, R> ContinuableFuture<R> callAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.BiFunction<? super T, ? super U, ? extends R, ? extends Exception> action) - Summary: Executes the provided bi-function asynchronously after both this future and the other future complete successfully, passing both results to the bi-function.
-
Contract:
- If either future fails, the returned future completes exceptionally with the first exception encountered, without executing the bi-function.
-
Parameters:
-
other(ContinuableFuture<U>) — the other ContinuableFuture that must complete before executing the action; must not be null. -
action(Throwables.BiFunction<? super T, ? super U, ? extends R, ? extends Exception>) — the bi-function to execute with both results; must not be null.
-
- Returns: a new {@code ContinuableFuture<R>} that completes with the result of the bi-function.
-
Signature:
public <U, R> ContinuableFuture<R> callAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.Function<? super Tuple4<T, ? super Exception, U, ? super Exception>, ? extends R, ? extends Exception> action) - Summary: Executes the provided function asynchronously after both this future and the other future complete, regardless of whether they complete successfully or exceptionally.
-
Contract:
- The function is executed asynchronously using the configured executor of this future and receives a {@link Tuple4} containing both results and their exceptions (if any).
- This is useful when you need to handle the results of both futures regardless of their success/failure status.
- The tuple contains: (result1, exception1, result2, exception2) where results are {@code null} if the corresponding future failed, and exceptions are {@code null} if the corresponding future succeeded.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> primaryFuture = ContinuableFuture.call(() -> fetchPrimaryData()); ContinuableFuture<Data> backupFuture = ContinuableFuture.call(() -> fetchBackupData()); ContinuableFuture<Data> result = primaryFuture.callAsyncAfterBoth(backupFuture, tuple -> { Data primary = tuple._1; Exception primaryError = tuple._2; Data backup = tuple._3; Exception backupError = tuple._4; if (primary != null) return primary; if (backup != null) return backup; throw new DataUnavailableException("Both sources failed"); }); } </pre>
-
Parameters:
-
other(ContinuableFuture<U>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.Function<? super Tuple4<T, ? super Exception, U, ? super Exception>, ? extends R, ? extends Exception>) — the function that processes the tuple of results and exceptions; must not be null.
-
- Returns: a new {@code ContinuableFuture<R>} that completes with the result of the function.
- See also: #gett()
-
Signature:
public <U, R> ContinuableFuture<R> callAsyncAfterBoth(final ContinuableFuture<U> other, final Throwables.QuadFunction<? super T, ? super Exception, ? super U, ? super Exception, ? extends R, ? extends Exception> action) - Summary: Executes the provided QuadFunction asynchronously after both this ContinuableFuture and the other ContinuableFuture complete, regardless of whether they complete successfully or exceptionally.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Response> apiFuture = ContinuableFuture.call(() -> callAPI()); ContinuableFuture<Cache> cacheFuture = ContinuableFuture.call(() -> loadCache()); ContinuableFuture<Result> combined = apiFuture.callAsyncAfterBoth(cacheFuture, (apiResponse, apiError, cacheData, cacheError) -> { if (apiError == null && apiResponse.isValid()) { return Result.fromApi(apiResponse); } else if (cacheError == null) { return Result.fromCache(cacheData); } else { throw new ServiceUnavailableException("Both API and cache failed"); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<U>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.QuadFunction<? super T, ? super Exception, ? super U, ? super Exception, ? extends R, ? extends Exception>) — the QuadFunction that processes both results and exceptions; must not be null.
-
- Returns: a new ContinuableFuture that completes with the result of the QuadFunction.
runAsyncAfterEither(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> runAsyncAfterEither(final ContinuableFuture<?> other, final Throwables.Runnable<? extends Exception> action) - Summary: Executes the provided Runnable action asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).
-
Parameters:
-
other(ContinuableFuture<?>) — the other ContinuableFuture to race against; must not be null. -
action(Throwables.Runnable<? extends Exception>) — the Runnable to execute after either future completes; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
-
Signature:
public ContinuableFuture<Void> runAsyncAfterEither(final ContinuableFuture<? extends T> other, final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Executes the provided Consumer action asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).
-
Contract:
- If the future that completes first fails, the consumer receives {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Weather> localWeather = ContinuableFuture.call(() -> getLocalWeather()); ContinuableFuture<Weather> remoteWeather = ContinuableFuture.call(() -> getRemoteWeather()); localWeather.runAsyncAfterEither(remoteWeather, weather -> { displayWeather(weather); // weather may be null if the first future failed logSource(weather.getSource()); }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to race against; must not be null. -
action(Throwables.Consumer<? super T, ? extends Exception>) — the Consumer to execute with the first available result; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
-
Signature:
public ContinuableFuture<Void> runAsyncAfterEither(final ContinuableFuture<? extends T> other, final Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception> action) - Summary: Executes the provided Consumer action asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).The BiConsumer receives both the result (if successful) and the exception (if failed) from whichever future completes first.
-
Contract:
- Executes the provided Consumer action asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).The BiConsumer receives both the result (if successful) and the exception (if failed) from whichever future completes first.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Config> localConfig = ContinuableFuture.call(() -> loadLocalConfig()); ContinuableFuture<Config> remoteConfig = ContinuableFuture.call(() -> loadRemoteConfig()); localConfig.runAsyncAfterEither(remoteConfig, (config, error) -> { if (error != null) { logger.warn("Config loading failed: " + error.getMessage()); useDefaultConfig(); } else { applyConfig(config); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to race against; must not be null. -
action(Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception>) — the BiConsumer to execute with the result and exception; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
- See also: #gett()
callAsyncAfterEither(...) -> ContinuableFuture<R>
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterEither(final ContinuableFuture<?> other, final Callable<? extends R> action) - Summary: Executes the provided Callable action asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).
-
Contract:
- <p> This method is useful when you need to compute a new value as soon as either future completes, regardless of which one finishes first or whether it succeeds or fails.
-
Parameters:
-
other(ContinuableFuture<?>) — the other ContinuableFuture to race against; must not be null. -
action(Callable<? extends R>) — the Callable to execute after either future completes; must not be null.
-
- Returns: a new ContinuableFuture that completes with the result of the callable.
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterEither(final ContinuableFuture<? extends T> other, final Throwables.Function<? super T, ? extends R, ? extends Exception> action) - Summary: Executes the provided function asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).
-
Contract:
- If the future that completes first fails, the function receives {@code null} .
- <p> This method is useful when you need to compute a new value as soon as either future completes, regardless of which one finishes first or whether it succeeds or fails.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Price> vendorA = ContinuableFuture.call(() -> getPriceFromVendorA()); ContinuableFuture<Price> vendorB = ContinuableFuture.call(() -> getPriceFromVendorB()); ContinuableFuture<Order> order = vendorA.callAsyncAfterEither(vendorB, price -> { // Process the first available price return createOrder(price); // price may be null if the first future failed }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to race against; must not be null. -
action(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to transform the first available result; must not be null.
-
- Returns: a new ContinuableFuture that completes with the transformed result.
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterEither(final ContinuableFuture<? extends T> other, final Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception> action) - Summary: Executes the provided BiFunction asynchronously after either this ContinuableFuture or the other ContinuableFuture completes (successfully or exceptionally).
-
Contract:
- The BiFunction receives both the result (if successful) and the exception (if failed) from whichever future completes first, and returns a transformed result.
- <p> This method is useful when you need to compute a new value as soon as either future completes, regardless of which one finishes first or whether it succeeds or fails.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Data> fastSource = ContinuableFuture.call(() -> fetchFromFastSource()); ContinuableFuture<Data> slowSource = ContinuableFuture.call(() -> fetchFromSlowSource()); ContinuableFuture<ProcessedData> result = fastSource.callAsyncAfterEither(slowSource, (data, error) -> { if (error != null) { return ProcessedData.empty(); } return processData(data); }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to race against; must not be null. -
action(Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception>) — the BiFunction to transform the result and exception; must not be null.
-
- Returns: a new ContinuableFuture that completes with the transformed result.
- See also: #gett()
runAsyncAfterFirstSuccess(...) -> ContinuableFuture<Void>
-
Signature:
public ContinuableFuture<Void> runAsyncAfterFirstSuccess(final ContinuableFuture<?> other, final Throwables.Runnable<? extends Exception> action) - Summary: Executes the provided Runnable action asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- If both futures fail, the action is not executed and the returned future completes exceptionally with the first exception.
- <p> This method waits for at least one successful completion before executing the action, making it useful when you need a successful result from at least one source.
-
Parameters:
-
other(ContinuableFuture<?>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.Runnable<? extends Exception>) — the Runnable to execute after the first successful completion; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
-
Signature:
public ContinuableFuture<Void> runAsyncAfterFirstSuccess(final ContinuableFuture<? extends T> other, final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Executes the provided Consumer action asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- <p> If both futures fail, the action is not executed and the returned future completes exceptionally with the exception from the first future that completed.
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.Consumer<? super T, ? extends Exception>) — the Consumer to execute with the first successful result; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
-
Signature:
@Beta public ContinuableFuture<Void> runAsyncAfterFirstSuccess(final ContinuableFuture<? extends T> other, final Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception> action) - Summary: Executes the provided BiConsumer action asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- Potential changes include: <ul> <li> The behavior when both futures fail may be refined to provide better exception aggregation </li> <li> Additional overloads with timeout parameters may be introduced </li> <li> The method may be renamed for better clarity (e.g., runAfterAnySucceed) </li> <li> Support for more than two futures may be added </li> </ul> <p> If the first future to complete succeeds, the BiConsumer receives (result, null).
- If both futures fail, the BiConsumer receives (null, firstException).
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Config> primaryConfig = ContinuableFuture.call(() -> loadPrimaryConfig()); ContinuableFuture<Config> fallbackConfig = ContinuableFuture.call(() -> loadFallbackConfig()); primaryConfig.runAsyncAfterFirstSuccess(fallbackConfig, (config, error) -> { if (config != null) { applyConfig(config); } else { logger.error("All config sources failed", error); useHardcodedDefaults(); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.BiConsumer<? super T, ? super Exception, ? extends Exception>) — the BiConsumer to execute with the result and exception; must not be null.
-
- Returns: a new ContinuableFuture < Void > that completes after executing the action.
callAsyncAfterFirstSuccess(...) -> ContinuableFuture<R>
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterFirstSuccess(final ContinuableFuture<?> other, final Callable<? extends R> action) - Summary: Executes the provided Callable action asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- If both futures fail, the callable is not executed and the returned future completes exceptionally with the first exception.
- <p> This method ensures that the callable is only executed if at least one of the futures succeeds, making it useful for dependent operations that require a successful prerequisite.
-
Parameters:
-
other(ContinuableFuture<?>) — the other ContinuableFuture to wait for; must not be null. -
action(Callable<? extends R>) — the Callable to execute after the first successful completion; must not be null.
-
- Returns: a new ContinuableFuture that completes with the result of the callable.
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterFirstSuccess(final ContinuableFuture<? extends T> other, final Throwables.Function<? super T, ? extends R, ? extends Exception> action) - Summary: Executes the provided function asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- <p> If both futures fail, the function is not executed and the returned future completes exceptionally with the exception from the first future that completed.
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to transform the first successful result; must not be null.
-
- Returns: a new ContinuableFuture that completes with the transformed result.
-
Signature:
public <R> ContinuableFuture<R> callAsyncAfterFirstSuccess(final ContinuableFuture<? extends T> other, final Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception> action) - Summary: Executes the provided BiFunction asynchronously after the first successful completion between this ContinuableFuture and the other ContinuableFuture.
-
Contract:
- <p> If the first future to complete succeeds, the BiFunction receives (result, null).
- If both futures fail, the BiFunction receives (null, firstException).
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Price> vendorPrice = ContinuableFuture.call(() -> getVendorPrice()); ContinuableFuture<Price> marketPrice = ContinuableFuture.call(() -> getMarketPrice()); ContinuableFuture<Quote> quote = vendorPrice.callAsyncAfterFirstSuccess(marketPrice, (price, error) -> { if (price != null) { return Quote.withPrice(price); } else { // Both sources failed, return quote with error status return Quote.unavailable(error.getMessage()); } }); } </pre>
-
Parameters:
-
other(ContinuableFuture<? extends T>) — the other ContinuableFuture to wait for; must not be null. -
action(Throwables.BiFunction<? super T, ? super Exception, ? extends R, ? extends Exception>) — the BiFunction to transform based on result and exception; must not be null.
-
- Returns: a new ContinuableFuture that completes with the transformed result.
- See also: #gett()
thenDelay(...) -> ContinuableFuture<T>
-
Signature:
@SuppressWarnings("deprecation") public ContinuableFuture<T> thenDelay(final long delay, final TimeUnit unit) - Summary: Configures this ContinuableFuture to delay the execution of the next chained action.
-
Parameters:
-
delay(long) — the delay duration before the next action is executed; must be non-negative. -
unit(TimeUnit) — the time unit of the delay parameter; must not be null.
-
- Returns: a new ContinuableFuture configured with the specified delay if delay > 0, or this future if delay < = 0.
thenUse(...) -> ContinuableFuture<T>
-
Signature:
@SuppressWarnings("deprecation") public ContinuableFuture<T> thenUse(final Executor executor) - Summary: Configures this ContinuableFuture to execute the next chained action using the specified executor.
-
Contract:
- <p> This method is useful when different parts of an asynchronous workflow need to run on different thread pools (e.g., I/O operations on an I/O pool, CPU-intensive work on a computation pool).
-
Parameters:
-
executor(Executor) — the executor to use for subsequent actions in the chain; must not be null.
-
- Returns: a new ContinuableFuture configured with the specified executor.
toCompletableFuture(...) -> CompletableFuture<T>
-
Signature:
@Beta public CompletableFuture<T> toCompletableFuture() - Summary: Converts this ContinuableFuture into a standard {@link CompletableFuture} for interoperability with APIs that require CompletableFuture instances.
-
Contract:
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Non-blocking: </b> Returns immediately; result retrieval happens asynchronously </li> <li> <b> Executor Reuse: </b> Uses this future's asyncExecutor for the conversion </li> <li> <b> Exception Wrapping: </b> All exceptions are wrapped in CompletionException </li> <li> <b> Independent Lifecycle: </b> Returned CompletableFuture has independent cancellation </li> </ul> <p> <b> Common Use Cases: </b> <ul> <li> Integrating ContinuableFuture with CompletableFuture-based frameworks </li> <li> Migrating from ContinuableFuture to CompletableFuture APIs </li> <li> Combining ContinuableFuture with third-party libraries expecting CompletableFuture </li> <li> Leveraging CompletableFuture-specific methods like thenCompose, allOf, anyOf </li> </ul> <p> <b> Usage Examples: </b> <pre> {@code // Basic conversion for framework integration ContinuableFuture<User> userFuture = ContinuableFuture.call(() -> loadUser()); CompletableFuture<User> completable = userFuture.toCompletableFuture(); // Chain with CompletableFuture operations ContinuableFuture<String> dataFuture = ContinuableFuture.call(() -> fetchData()); dataFuture.toCompletableFuture() .thenApply(data -> processData(data)) .thenAccept(result -> saveResult(result)); // Combine with other CompletableFutures CompletableFuture<String> cf1 = continuableFuture1.toCompletableFuture(); CompletableFuture<Integer> cf2 = continuableFuture2.toCompletableFuture(); CompletableFuture<Object> combined = CompletableFuture.anyOf(cf1, cf2); } </pre> <p> <b> Exception Handling: </b> <ul> <li> <b> InterruptedException: </b> Wrapped in CompletionException </li> <li> <b> ExecutionException: </b> Wrapped in CompletionException with cause preserved </li> <li> <b> CancellationException: </b> Wrapped in CompletionException </li> <li> <b> RuntimeException: </b> Wrapped in CompletionException </li> </ul> <p> <b> Important Considerations: </b> <ul> <li> Cancelling the returned CompletableFuture does not cancel this ContinuableFuture </li> <li> Cancelling this ContinuableFuture will cause the CompletableFuture to complete exceptionally </li> <li> The conversion is asynchronous; blocking methods should not be called in the supplier </li> <li> Uses this future's asyncExecutor, which may impact thread pool usage </li> </ul> <p> <b> Performance Implications: </b> <ul> <li> Creates additional task submission overhead </li> <li> Blocks a thread from asyncExecutor until this future completes </li> <li> For already-completed futures, consider using {@link CompletableFuture#completedFuture(Object)} </li> </ul>
-
Parameters:
- (none)
- Returns: a new CompletableFuture that completes with the same result as this ContinuableFuture,. executed asynchronously using this future's asyncExecutor.
- See also: CompletableFuture#supplyAsync(java.util.function.Supplier, Executor), #toCompletableFuture(Executor), CompletionException
-
Signature:
@Beta public CompletableFuture<T> toCompletableFuture(final Executor executor) - Summary: Converts this ContinuableFuture into a standard {@link CompletableFuture} using the specified executor for the conversion operation.
-
Contract:
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Non-blocking: </b> Returns immediately; result retrieval happens asynchronously </li> <li> <b> Custom Executor: </b> Uses the provided executor instead of this future's asyncExecutor </li> <li> <b> Exception Wrapping: </b> All exceptions are wrapped in CompletionException </li> <li> <b> Independent Lifecycle: </b> Returned CompletableFuture has independent cancellation </li> </ul> <p> <b> Common Use Cases: </b> <ul> <li> Converting to CompletableFuture with a specific thread pool (e.g., I/O vs CPU executor) </li> <li> Isolating CompletableFuture operations from ContinuableFuture's execution context </li> <li> Integrating with frameworks that provide their own executors </li> <li> Managing thread pool resources independently for different workflow stages </li> </ul> <p> <b> Usage Examples: </b> <pre> {@code // Use a custom executor for the conversion ExecutorService ioExecutor = Executors.newCachedThreadPool(); ContinuableFuture<Data> dataFuture = ContinuableFuture.call(() -> loadData()); CompletableFuture<Data> completable = dataFuture.toCompletableFuture(ioExecutor); // Integrate with framework-specific executors Executor springTaskExecutor = applicationContext.getBean("taskExecutor", Executor.class); ContinuableFuture<Result> result = ContinuableFuture.call(() -> computeResult()); CompletableFuture<Result> springManaged = result.toCompletableFuture(springTaskExecutor); // Use different executors for different conversion stages ExecutorService cpuExecutor = Executors.newFixedThreadPool(4); ContinuableFuture<ProcessedData> processed = ContinuableFuture.call(() -> process()); processed.toCompletableFuture(cpuExecutor) .thenApplyAsync(data -> furtherProcessing(data), cpuExecutor); } </pre> <p> <b> Exception Handling: </b> <ul> <li> <b> InterruptedException: </b> Wrapped in CompletionException </li> <li> <b> ExecutionException: </b> Wrapped in CompletionException with cause preserved </li> <li> <b> CancellationException: </b> Wrapped in CompletionException </li> <li> <b> RuntimeException: </b> Wrapped in CompletionException </li> </ul> <p> <b> Important Considerations: </b> <ul> <li> Cancelling the returned CompletableFuture does not cancel this ContinuableFuture </li> <li> Cancelling this ContinuableFuture will cause the CompletableFuture to complete exceptionally </li> <li> The conversion is asynchronous; blocking methods should not be called in the supplier </li> <li> The provided executor must be able to accept new tasks </li> <li> Executor shutdown should be managed externally; this method does not manage lifecycle </li> </ul> <p> <b> Performance Implications: </b> <ul> <li> Creates additional task submission overhead to the specified executor </li> <li> Blocks a thread from the provided executor until this future completes </li> <li> Executor choice affects overall performance (e.g., ForkJoinPool vs ThreadPoolExecutor) </li> <li> For already-completed futures, still incurs executor submission cost </li> </ul> <p> <b> Comparison with {@link #toCompletableFuture()} : </b> <ul> <li> This method allows custom executor selection vs using this future's asyncExecutor </li> <li> Useful when asyncExecutor is not suitable for CompletableFuture operations </li> <li> Provides better control over thread pool isolation and resource management </li> </ul>
-
Parameters:
-
executor(Executor) — the executor to use for asynchronous result retrieval; must not be null.
-
- Returns: a new CompletableFuture that completes with the same result as this ContinuableFuture,. executed asynchronously using the provided executor.
- See also: CompletableFuture#supplyAsync(java.util.function.Supplier, Executor), #toCompletableFuture(), CompletionException
Class CsvParser (com.landawn.abacus.util.CsvParser)
A very simple CSV parser released under a commercial-friendly license.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public CsvParser() - Summary: Constructs a CsvParser using default settings.
-
Parameters:
- (none)
-
Signature:
public CsvParser(final char separator) - Summary: Constructs a CsvParser with a custom separator.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries
-
-
Signature:
public CsvParser(final char separator, final char quoteChar) - Summary: Constructs a CsvParser with custom separator and quote characters.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries -
quoteChar(char) — the character to use for quoted elements
-
-
Signature:
public CsvParser(final char separator, final char quoteChar, final char escape) - Summary: Constructs a CsvParser with custom separator, quote, and escape characters.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries -
quoteChar(char) — the character to use for quoted elements -
escape(char) — the character to use for escaping a separator or quote
-
-
Signature:
public CsvParser(final char separator, final char quoteChar, final char escape, final boolean strictQuotes) - Summary: Constructs a CsvParser with custom settings including strict quotes mode.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries -
quoteChar(char) — the character to use for quoted elements -
escape(char) — the character to use for escaping a separator or quote -
strictQuotes(boolean) — if {@code true} , characters outside the quotes are ignored
-
-
Signature:
public CsvParser(final char separator, final char quoteChar, final char escape, final boolean strictQuotes, final boolean ignoreLeadingWhiteSpace) - Summary: Constructs a CsvParser with custom settings including whitespace handling.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries -
quoteChar(char) — the character to use for quoted elements -
escape(char) — the character to use for escaping a separator or quote -
strictQuotes(boolean) — if {@code true} , characters outside the quotes are ignored -
ignoreLeadingWhiteSpace(boolean) — if {@code true} , white space in front of a quote in a field is ignored
-
-
Signature:
public CsvParser(final char separator, final char quoteChar, final char escape, final boolean strictQuotes, final boolean ignoreLeadingWhiteSpace, final boolean ignoreQuotations) - Summary: Constructs a CsvParser with full control over all parsing options.
-
Parameters:
-
separator(char) — the delimiter to use for separating entries -
quoteChar(char) — the character to use for quoted elements -
escape(char) — the character to use for escaping a separator or quote -
strictQuotes(boolean) — if {@code true} , characters outside the quotes are ignored -
ignoreLeadingWhiteSpace(boolean) — if {@code true} , white space in front of a quote in a field is ignored -
ignoreQuotations(boolean) — if {@code true} , treat quotations like any other character
-
getSeparator(...) -> char
-
Signature:
public char getSeparator() - Summary: Returns the separator character used by this parser.
-
Parameters:
- (none)
- Returns: the separator character
getQuoteChar(...) -> char
-
Signature:
public char getQuoteChar() - Summary: Returns the quotation character used by this parser.
-
Parameters:
- (none)
- Returns: the quotation character
getEscape(...) -> char
-
Signature:
public char getEscape() - Summary: Returns the escape character used by this parser.
-
Parameters:
- (none)
- Returns: the escape character
isStrictQuotes(...) -> boolean
-
Signature:
public boolean isStrictQuotes() - Summary: Returns whether this parser uses strict quotes mode.
-
Parameters:
- (none)
- Returns: {@code true} if strict quotes mode is enabled
isIgnoreLeadingWhiteSpace(...) -> boolean
-
Signature:
public boolean isIgnoreLeadingWhiteSpace() - Summary: Returns whether this parser ignores leading whitespace.
-
Contract:
- When {@code true} , whitespace before a quote character is ignored.
-
Parameters:
- (none)
- Returns: {@code true} if leading whitespace is ignored
isIgnoreQuotations(...) -> boolean
-
Signature:
public boolean isIgnoreQuotations() - Summary: Returns whether this parser ignores quotation marks.
-
Contract:
- When {@code true} , quotes are treated as regular characters.
-
Parameters:
- (none)
- Returns: {@code true} if quotations are ignored
parseLine(...) -> List<String>
-
Signature:
public List<String> parseLine(final String nextLine) throws ParsingException - Summary: Parses a CSV line into a list of fields.
-
Parameters:
-
nextLine(String) — the line to be parsed
-
- Returns: a List of String values, or an empty list if nextLine is null
-
Throws:
-
com.landawn.abacus.exception.ParsingException— if the line contains an unterminated quoted field
-
parseLineToArray(...) -> String\[\]
-
Signature:
public String[] parseLineToArray(final String nextLine) throws ParsingException - Summary: Parses a CSV line into an array of fields.
-
Parameters:
-
nextLine(String) — the line to be parsed
-
- Returns: an array of String values, or an empty array if nextLine is null
-
Throws:
-
com.landawn.abacus.exception.ParsingException— if the line contains an unterminated quoted field
-
-
Signature:
public void parseLineToArray(final String nextLine, final String[] output) throws ParsingException - Summary: Parses a CSV line into a pre-allocated array.
-
Contract:
- This method is useful for performance when parsing many lines with the same number of fields, as it avoids array allocation.
-
Parameters:
-
nextLine(String) — the line to be parsed -
output(String[]) — the pre-allocated array to fill with parsed values
-
-
Throws:
-
com.landawn.abacus.exception.ParsingException— if the line contains an unterminated quoted field
-
Class CsvUtil (com.landawn.abacus.util.CsvUtil)
This utility class providing advanced CSV (Comma-Separated Values) data processing capabilities including high-performance parsing, streaming operations, type-safe conversions, and seamless integration with Dataset objects for efficient data manipulation and analysis.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
setHeaderParser(...) -> void
-
Signature:
public static void setHeaderParser(final Function<String, String[]> parser) throws IllegalArgumentException - Summary: Sets the CSV header parser for the current thread.
-
Parameters:
-
parser(Function<String, String[]>) — the Function to set as the CSV header parser, must not be null.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the parser is null.
-
- See also: #resetHeaderParser(), #getCurrentHeaderParser(), #setLineParser(BiConsumer)
setLineParser(...) -> void
-
Signature:
public static void setLineParser(final BiConsumer<String, String[]> parser) throws IllegalArgumentException - Summary: Sets the CSV line parser for the current thread.
-
Parameters:
-
parser(BiConsumer<String, String[]>) — the BiConsumer to set as the CSV line parser, must not be null.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the parser is null.
-
- See also: #resetLineParser(), #getCurrentLineParser(), #setHeaderParser(Function)
resetHeaderParser(...) -> void
-
Signature:
public static void resetHeaderParser() - Summary: Resets the CSV header parser to the default parser for the current thread.
-
Parameters:
- (none)
- See also: #setHeaderParser(Function), #getCurrentHeaderParser(), #resetLineParser()
resetLineParser(...) -> void
-
Signature:
public static void resetLineParser() - Summary: Resets the CSV line parser to the default parser for the current thread.
-
Parameters:
- (none)
- See also: #setLineParser(BiConsumer), #getCurrentLineParser(), #resetHeaderParser()
getCurrentHeaderParser(...) -> Function<String, String\[\]>
-
Signature:
public static Function<String, String[]> getCurrentHeaderParser() - Summary: Returns the CSV header parser currently active in the current thread.
-
Parameters:
- (none)
- Returns: the current CSV header parser as a Function that takes a String and returns a String array.
- See also: #setHeaderParser(Function), #resetHeaderParser(), #getCurrentLineParser()
getCurrentLineParser(...) -> BiConsumer<String, String\[\]>
-
Signature:
public static BiConsumer<String, String[]> getCurrentLineParser() - Summary: Returns the CSV line parser currently active in the current thread.
-
Parameters:
- (none)
- Returns: the current CSV line parser as a BiConsumer that takes a String and a String array.
- See also: #setLineParser(BiConsumer), #resetLineParser(), #getCurrentHeaderParser()
setEscapeCharToBackSlashForWrite(...) -> void
-
Signature:
public static void setEscapeCharToBackSlashForWrite() - Summary: Sets the escape character to backslash for CSV writing operations in the current thread.
-
Contract:
- This affects how special characters are escaped when writing CSV data.
-
Parameters:
- (none)
- See also: #resetEscapeCharForWrite()
resetEscapeCharForWrite(...) -> void
-
Signature:
public static void resetEscapeCharForWrite() - Summary: Resets the escape character setting for CSV writing to the default in the current thread.
-
Parameters:
- (none)
writeField(...) -> void
-
Signature:
public static void writeField(final BufferedCsvWriter writer, final Type<?> type, final Object value) throws IOException - Summary: Writes a single field value to a CSV writer with appropriate formatting and escaping.
-
Parameters:
-
writer(BufferedCsvWriter) — the BufferedCsvWriter to write to. -
type(Type<?>) — the Type of the value, can be {@code null} (defaults to String type for {@code null} values). -
value(Object) — the value to write, can be null.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during writing.
-
load(...) -> Dataset
-
Signature:
public static Dataset load(final File source) throws UncheckedIOException - Summary: Loads CSV data from a file into a Dataset with all columns included.
-
Parameters:
-
source(File) — the File containing CSV data.
-
- Returns: a Dataset containing the loaded CSV data.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while reading the file.
-
- See also: #load(File, Collection), #load(File, Collection, long, long), #load(File, Collection, long, long, Predicate), #load(File, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames) throws UncheckedIOException - Summary: Loads CSV data from a file with specified column selection.
-
Parameters:
-
source(File) — the File containing CSV data. -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns.
-
- Returns: a Dataset containing the loaded CSV data with selected columns.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while reading the file.
-
- See also: #load(File), #load(File, Collection, long, long), #load(File, Collection, long, long, Predicate), #load(File, Collection, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count) throws UncheckedIOException - Summary: Loads CSV data from a file with specified column selection, offset, and row limit.
-
Parameters:
-
source(File) — the File containing CSV data. -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns. -
offset(long) — the number of data rows to skip from the beginning (after header). -
count(long) — the maximum number of rows to process.
-
- Returns: a Dataset containing the loaded CSV data.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #load(File), #load(File, Collection), #load(File, Collection, long, long, Predicate), #load(File, Collection, long, long, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter) throws UncheckedIOException - Summary: Loads CSV data from a file with full control over column selection, pagination, and row filtering.
-
Parameters:
-
source(File) — the File containing CSV data. -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns. -
offset(long) — the number of data rows to skip from the beginning (after header). -
count(long) — the maximum number of rows to process. -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included.
-
- Returns: a Dataset containing the filtered CSV data.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #load(File), #load(File, Collection), #load(File, Collection, long, long), #load(Reader, Collection, long, long, Predicate), #load(File, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final Reader source) throws UncheckedIOException - Summary: Loads CSV data from a Reader with all columns included.
-
Parameters:
-
source(Reader) — the Reader providing CSV data.
-
- Returns: a Dataset containing the loaded CSV data.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #load(Reader, Collection), #load(Reader, Collection, long, long), #load(Reader, Collection, long, long, Predicate), #load(Reader, Class)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames) throws UncheckedIOException - Summary: Loads CSV data from a Reader with specified column selection.
-
Parameters:
-
source(Reader) — the Reader providing CSV data. -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns.
-
- Returns: a Dataset containing the selected columns.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #load(Reader), #load(Reader, Collection, long, long), #load(Reader, Collection, long, long, Predicate), #load(Reader, Collection, Class)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames, final long offset, final long count) throws UncheckedIOException - Summary: Loads CSV data from a Reader with specified column selection, offset, and row limit.
-
Parameters:
-
source(Reader) — the Reader providing CSV data. -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns. -
offset(long) — the number of data rows to skip from the beginning (after header). -
count(long) — the maximum number of rows to process.
-
- Returns: a Dataset containing the loaded CSV data.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #load(Reader), #load(Reader, Collection), #load(Reader, Collection, long, long, Predicate), #load(Reader, Collection, long, long, Class)
-
Signature:
@SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static Dataset load(final Reader source, final Collection<String> selectColumnNames, long offset, long count, final Predicate<? super String[]> rowFilter) throws IllegalArgumentException, UncheckedIOException - Summary: Loads CSV data from a Reader with full control over column selection, pagination, and row filtering.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included
-
- Returns: a Dataset containing the filtered CSV data
-
Throws:
-
java.lang.IllegalArgumentException— if offset or count are negative -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader), #load(Reader, Collection), #load(Reader, Collection, long, long), #load(File, Collection, long, long, Predicate), #load(Reader, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final File source, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a file with automatic type conversion based on a bean class.
-
Parameters:
-
source(File) — the File containing CSV data -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File), #load(File, Collection, Class), #load(File, Collection, long, long, Class), #load(File, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a file with column selection and type conversion based on a bean class.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File, Class), #load(File, Collection, long, long, Class), #load(File, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a file with column selection, pagination, and type conversion.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File, Class), #load(File, Collection, Class), #load(File, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a file with full control including type conversion and row filtering.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed and filtered data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File, Class), #load(File, Collection, Class), #load(File, Collection, long, long, Class), #load(Reader, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final Reader source, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a Reader with automatic type conversion based on a bean class.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader), #load(Reader, Collection, Class), #load(Reader, Collection, long, long, Class), #load(Reader, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a Reader with column selection and type conversion based on a bean class.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Class), #load(Reader, Collection, long, long, Class), #load(Reader, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames, final long offset, final long count, final Class<?> beanClassForColumnType) throws UncheckedIOException - Summary: Loads CSV data from a Reader with column selection, pagination, and type conversion.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Class), #load(Reader, Collection, Class), #load(Reader, Collection, long, long, Predicate, Class)
-
Signature:
@SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static Dataset load(final Reader source, final Collection<String> selectColumnNames, long offset, long count, final Predicate<? super String[]> rowFilter, final Class<?> beanClassForColumnType) throws IllegalArgumentException, UncheckedIOException - Summary: Loads CSV data from a Reader with full control including type conversion and row filtering.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
beanClassForColumnType(Class<?>) — the bean class defining column types
-
- Returns: a Dataset with typed and filtered data
-
Throws:
-
java.lang.IllegalArgumentException— if parameters are invalid -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Class), #load(Reader, Collection, Class), #load(Reader, Collection, long, long, Class), #load(File, Collection, long, long, Predicate, Class)
-
Signature:
public static Dataset load(final File source, final Map<String, ? extends Type<?>> columnTypeMap) throws UncheckedIOException - Summary: Loads CSV data from a file with all columns included and provided column-to-type mapping.
-
Parameters:
-
source(File) — the File containing CSV data -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with explicitly typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File, Collection, long, long, Predicate, Map)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Map<String, ? extends Type<?>> columnTypeMap) throws UncheckedIOException - Summary: Loads CSV data from a file with specified column selection and provided column-to-type mapping.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(File, Collection, long, long, Predicate, Map)
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final Map<String, ? extends Type<?>> columnTypeMap) throws UncheckedIOException - Summary: Loads CSV data from a file with specified column selection, pagination, row filtering and provided column-to-type mapping.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with typed and filtered data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final Reader source, final Map<String, ? extends Type<?>> columnTypeMap) throws UncheckedIOException - Summary: Loads CSV data from a Reader with all columns included and provided column-to-type mapping.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with explicitly typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Collection, long, long, Predicate, Map)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames, final long offset, final long count, final Map<String, ? extends Type<?>> columnTypeMap) throws UncheckedIOException - Summary: Loads CSV data from a Reader with specified column selection and provided column-to-type mapping.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with typed columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Collection, long, long, Predicate, Map)
-
Signature:
@SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static Dataset load(final Reader source, final Collection<String> selectColumnNames, long offset, long count, final Predicate<? super String[]> rowFilter, final Map<String, ? extends Type<?>> columnTypeMap) throws IllegalArgumentException, UncheckedIOException - Summary: Loads CSV data from a Reader with specified column selection, pagination, row filtering and provided column-to-type mapping.
-
Parameters:
-
source(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: a Dataset with typed and filtered data
-
Throws:
-
java.lang.IllegalArgumentException— if parameters are invalid or columnTypeMap is empty -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final File source, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a file with custom row extraction logic.
-
Parameters:
-
source(File) — the File containing CSV data -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — custom logic to extract and convert row data
-
- Returns: a Dataset with custom extracted data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a file with column selection and custom row extraction.
-
Parameters:
-
source(File) — the File containing CSV data -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — custom logic to extract and convert row data
-
- Returns: a Dataset with custom extracted data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final File source, final long offset, final long count, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a file with pagination and custom row extraction.
-
Parameters:
-
source(File) — the File containing CSV data -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — custom logic to extract and convert row data
-
- Returns: a Dataset with custom extracted data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a File source with specified offset, count, row filter, and column type list.
-
Parameters:
-
source(File) — the File source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — a TriConsumer to extract the row data to the output array. The first parameter is the column names, the second parameter is the row data, and the third parameter is the output array.
-
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public static Dataset load(final Reader source, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a Reader source using a custom row extractor function.
-
Parameters:
-
source(Reader) — the Reader source to read CSV data from -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — a TriConsumer to extract the row data to the output array. The first parameter is the column names, the second parameter is the row data, and the third parameter is the output array.
-
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, Collection, TriConsumer)
-
Signature:
public static Dataset load(final Reader source, final Collection<String> selectColumnNames, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a Reader source with column selection and a custom row extractor function.
-
Parameters:
-
source(Reader) — the Reader source to read CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — a TriConsumer to extract the row data to the output array. The first parameter is the column names, the second parameter is the row data, and the third parameter is the output array.
-
- Returns: a Dataset containing the loaded CSV data with selected columns
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, TriConsumer), #load(Reader, Collection, long, long, Predicate, TriConsumer)
-
Signature:
public static Dataset load(final Reader source, final long offset, final long count, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads CSV data from a Reader source with pagination and a custom row extractor function.
-
Parameters:
-
source(Reader) — the Reader source to read CSV data from -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — a TriConsumer to extract the row data to the output array. The first parameter is the column names, the second parameter is the row data, and the third parameter is the output array.
-
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(Reader, TriConsumer), #load(Reader, Collection, long, long, Predicate, TriConsumer)
-
Signature:
@SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static Dataset load(final Reader source, final Collection<String> selectColumnNames, long offset, long count, final Predicate<? super String[]> rowFilter, final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws IllegalArgumentException, UncheckedIOException - Summary: Loads CSV data from a Reader source with specified offset, count, row filter, and column type list.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — a TriConsumer to extract the row data to the output array. The first parameter is the column names, the second parameter is the row data, and the third parameter is the output array.
-
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
java.lang.IllegalArgumentException— if offset or count are negative, or if the size of {@code columnTypeList} is not equal to the size of columns in CSV. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
stream(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> stream(final File source, final Class<? extends T> targetType) - Summary: Streams CSV data from a File source with the specified target type.
-
Contract:
- The stream will automatically close the underlying file reader when the stream is closed.
- <p> The target type can be: <ul> <li> A bean class - rows are converted to bean instances </li> <li> Map - rows are converted to Map < String, Object > </li> <li> Collection - rows are converted to collections of column values </li> <li> Object\[\] - rows are converted to object arrays </li> <li> A single-column primitive type - when only one column is selected </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Stream as bean objects try (Stream<Person> stream = CsvUtil.stream(new File("people.csv"), Person.class)) { stream.filter(p -> p.getAge() > 18) .forEach(System.out::println); } } </pre>
-
Parameters:
-
source(File) — the File source to load CSV data from -
targetType(Class<? extends T>) — the Class of the target type
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, Collection, Class), #stream(File, Collection, long, long, Predicate, Class), #stream(Reader, Class, boolean)
-
Signature:
public static <T> Stream<T> stream(final File source, final Collection<String> selectColumnNames, final Class<? extends T> targetType) - Summary: Streams CSV data from a File source with specified column names and target type.
-
Contract:
- <p> The stream automatically closes the underlying file reader when closed.
-
Parameters:
-
source(File) — the File source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
targetType(Class<? extends T>) — the Class of the target type
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, Class), #stream(File, Collection, long, long, Predicate, Class), #stream(Reader, Collection, Class, boolean)
-
Signature:
public static <T> Stream<T> stream(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final Class<? extends T> targetType) - Summary: Streams CSV data from a File source with full control over column selection, pagination, and filtering.
-
Contract:
- <p> The stream automatically closes the underlying file reader when closed.
-
Parameters:
-
source(File) — the File source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
targetType(Class<? extends T>) — the Class of the target type
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, Class), #stream(File, Collection, Class), #stream(Reader, Collection, long, long, Predicate, Class, boolean)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final Class<? extends T> targetType, final boolean closeReaderWhenStreamIsClosed) - Summary: Streams CSV data from a Reader source with the specified target type.
-
Contract:
- This method provides lazy evaluation of CSV data from a Reader, with control over whether the reader should be closed when the stream terminates.
- <p> This method is useful when you have an existing Reader (e.g., from a network stream, compressed file, or other source) and want to stream its CSV content.
- Set {@code closeReaderWhenStreamIsClosed} to {@code true} if the stream should own the reader lifecycle, or {@code false} if you'll manage the reader externally.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
targetType(Class<? extends T>) — the Class of the target type -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close the reader when the stream is closed, {@code false} otherwise
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(Reader, Collection, Class, boolean), #stream(Reader, Collection, long, long, Predicate, Class, boolean), #stream(File, Class)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final Collection<String> selectColumnNames, final Class<? extends T> targetType, final boolean closeReaderWhenStreamIsClosed) - Summary: Streams CSV data from a Reader source with specified column names and target type.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
targetType(Class<? extends T>) — the Class of the target type -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close the reader when the stream is closed, {@code false} otherwise
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(Reader, Class, boolean), #stream(Reader, Collection, long, long, Predicate, Class, boolean), #stream(File, Collection, Class)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final Class<? extends T> targetType, final boolean closeReaderWhenStreamIsClosed) throws IllegalArgumentException - Summary: Streams CSV data from a Reader source with complete control over all streaming parameters.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
targetType(Class<? extends T>) — the Class of the target type -
closeReaderWhenStreamIsClosed(boolean) — whether to close the Reader when the stream is closed
-
- Returns: a Stream of the specified target type containing the loaded CSV data
-
Throws:
-
java.lang.IllegalArgumentException— if offset or count are negative, or if the target type is {@code null} or not supported.
-
- See also: #stream(Reader, Class, boolean), #stream(Reader, Collection, Class, boolean), #stream(File, Collection, long, long, Predicate, Class)
-
Signature:
public static <T> Stream<T> stream(final File source, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper) - Summary: Streams CSV data from a File source with custom row mapping logic.
-
Contract:
- <p> The row mapper receives: <ul> <li> Column names as an immutable List < String > </li> <li> Row data as a DisposableArray < String > (reused for efficiency) </li> </ul> <p> The stream automatically closes the underlying file reader when closed.
-
Parameters:
-
source(File) — the File source to load CSV data from -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data.
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, Collection, BiFunction), #stream(File, Collection, long, long, Predicate, BiFunction), #stream(Reader, BiFunction, boolean)
-
Signature:
public static <T> Stream<T> stream(final File source, final Collection<String> selectColumnNames, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper) - Summary: Streams CSV data from a File source with column selection and custom row mapping.
-
Contract:
- The mapper receives: <ul> <li> Selected column names as an immutable List < String > </li> <li> Selected column values as a DisposableArray < String > (reused for efficiency) </li> </ul> <p> The stream automatically closes the underlying file reader when closed.
-
Parameters:
-
source(File) — the File source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data.
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, BiFunction), #stream(File, Collection, long, long, Predicate, BiFunction), #stream(Reader, Collection, BiFunction, boolean)
-
Signature:
public static <T> Stream<T> stream(final File source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper) - Summary: Streams CSV data from a File source with full control including custom row mapping.
-
Contract:
- <p> This method supports: <ul> <li> Column selection - include only specified columns </li> <li> Pagination - skip initial rows and limit total rows processed </li> <li> Row filtering - include only rows matching the predicate </li> <li> Custom mapping - complete control over row-to-object conversion </li> </ul> <p> The stream automatically closes the underlying file reader when closed.
-
Parameters:
-
source(File) — the File source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data.
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(File, BiFunction), #stream(File, Collection, BiFunction), #stream(Reader, Collection, long, long, Predicate, BiFunction, boolean)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper, final boolean closeReaderWhenStreamIsClosed) - Summary: Streams CSV data from a Reader source with custom row mapping logic.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data. -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close the reader when the stream is closed, {@code false} otherwise
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(Reader, Collection, BiFunction, boolean), #stream(Reader, Collection, long, long, Predicate, BiFunction, boolean), #stream(File, BiFunction)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final Collection<String> selectColumnNames, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper, final boolean closeReaderWhenStreamIsClosed) - Summary: Streams CSV data from a Reader source with column selection and custom row mapping.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data. -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close the reader when the stream is closed, {@code false} otherwise
-
- Returns: a Stream of the specified target type containing the loaded CSV data
- See also: #stream(Reader, BiFunction, boolean), #stream(Reader, Collection, long, long, Predicate, BiFunction, boolean), #stream(File, Collection, BiFunction)
-
Signature:
public static <T> Stream<T> stream(final Reader source, final Collection<String> selectColumnNames, final long offset, final long count, final Predicate<? super String[]> rowFilter, final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper, final boolean closeReaderWhenStreamIsClosed) throws IllegalArgumentException - Summary: Streams CSV data from a Reader source with complete control including custom row mapping.
-
Parameters:
-
source(Reader) — the Reader source to load CSV data from -
selectColumnNames(Collection<String>) — a Collection of column names to select, {@code null} to include all columns -
offset(long) — the number of data rows to skip from the beginning (after header) -
count(long) — the maximum number of rows to process -
rowFilter(Predicate<? super String[]>) — a Predicate to filter rows, only matching rows are included -
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — converts the row data to the target type. First parameter is the column names, second parameter is the row data. -
closeReaderWhenStreamIsClosed(boolean) — whether to close the Reader when the stream is closed
-
- Returns: a Stream of the specified target type containing the loaded CSV data
-
Throws:
-
java.lang.IllegalArgumentException— if offset or count are negative, or if the rowMapper is null
-
- See also: #stream(Reader, BiFunction, boolean), #stream(Reader, Collection, BiFunction, boolean), #stream(File, Collection, long, long, Predicate, BiFunction)
csvToJson(...) -> long
-
Signature:
public static long csvToJson(final File csvFile, final File jsonFile) throws UncheckedIOException - Summary: Converts a CSV file to JSON format with all columns included.
-
Parameters:
-
csvFile(File) — the source CSV file to convert -
jsonFile(File) — the destination JSON file to create
-
- Returns: the number of rows written to the JSON file
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file operations
-
- See also: #csvToJson(File, Collection, File), #csvToJson(File, Collection, File, Class)
-
Signature:
public static long csvToJson(final File csvFile, final Collection<String> selectColumnNames, final File jsonFile) throws UncheckedIOException - Summary: Converts a CSV file to JSON format with selected columns.
-
Contract:
- This method allows you to specify which columns from the CSV file should be included in the JSON output.
- If {@code selectColumnNames} is {@code null} , all columns will be included.
-
Parameters:
-
csvFile(File) — the source CSV file to convert -
selectColumnNames(Collection<String>) — the collection of column names to include in JSON output, {@code null} to include all columns -
jsonFile(File) — the destination JSON file to create
-
- Returns: the number of rows written to the JSON file
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file operations
-
- See also: #csvToJson(File, File), #csvToJson(File, Collection, File, Class)
-
Signature:
public static long csvToJson(final File csvFile, final Collection<String> selectColumnNames, final File jsonFile, final Class<?> beanClassForColumnTypeInference) throws UncheckedIOException - Summary: Converts a CSV file to JSON format with selected columns and type conversion.
-
Contract:
- The {@code beanClassForColumnTypeInference} parameter defines how each column should be typed in the JSON output - properties of the bean class determine the target types.
-
Parameters:
-
csvFile(File) — the source CSV file to convert -
selectColumnNames(Collection<String>) — the collection of column names to include in JSON output, {@code null} to include all columns -
jsonFile(File) — the destination JSON file to create -
beanClassForColumnTypeInference(Class<?>) — the bean class defining property types for conversion, {@code null} to treat all values as strings
-
- Returns: the number of rows written to the JSON file
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file operations
-
- See also: #csvToJson(File, File), #csvToJson(File, Collection, File)
-
Signature:
public static long csvToJson(final Reader csvReader, final Collection<String> selectColumnNames, final Writer jsonWriter, final Class<?> beanClassForColumnTypeInference) throws UncheckedIOException - Summary: Converts CSV data from a Reader to JSON format and writes it to a Writer.
-
Contract:
- If {@code selectColumnNames} is provided, only those columns will be included in the JSON output.
- If {@code beanClassForColumnTypeInference} is provided, values are converted to their appropriate types as defined by the bean class properties.
-
Parameters:
-
csvReader(Reader) — the Reader providing CSV data -
selectColumnNames(Collection<String>) — the collection of column names to include in JSON output, {@code null} to include all columns -
jsonWriter(Writer) — the Writer to write JSON output to -
beanClassForColumnTypeInference(Class<?>) — the bean class defining property types for conversion, {@code null} to treat all values as strings
-
- Returns: the number of rows written to the JSON output
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading or writing
-
- See also: #csvToJson(File, File), #csvToJson(File, Collection, File), #csvToJson(File, Collection, File, Class)
jsonToCsv(...) -> long
-
Signature:
public static long jsonToCsv(final File jsonFile, final File csvFile) throws UncheckedIOException - Summary: Converts a JSON file to CSV format with all columns included.
-
Contract:
- <p> The JSON file must contain an array of objects where each object represents a row.
-
Parameters:
-
jsonFile(File) — the source JSON file to convert -
csvFile(File) — the destination CSV file to create
-
- Returns: the number of rows written to the CSV file (including header row)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file operations or if the JSON format is invalid
-
- See also: #jsonToCsv(File, Collection, File)
-
Signature:
public static long jsonToCsv(final File jsonFile, final Collection<String> selectCsvHeaders, final File csvFile) throws UncheckedIOException - Summary: Converts a JSON file to CSV format with optional header selection.
-
Contract:
- <p> The JSON file must contain an array of objects where each object represents a row.
- If {@code selectCsvHeaders} is provided, only those properties will be included as columns in the CSV output.
- If {@code selectCsvHeaders} is {@code null} or empty, all properties from the first JSON object will be used as headers.
-
Parameters:
-
jsonFile(File) — the source JSON file to convert -
selectCsvHeaders(Collection<String>) — the collection of property names to include as CSV headers, {@code null} or empty to include all properties from the first object -
csvFile(File) — the destination CSV file to create
-
- Returns: the number of rows written to the CSV file (including header row)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file operations or if the JSON format is invalid
-
- See also: #jsonToCsv(File, File)
-
Signature:
public static long jsonToCsv(final Reader jsonReader, final Collection<String> selectCsvHeaders, final Writer csvWriter) throws UncheckedIOException - Summary: Converts JSON data from a Reader to CSV format and writes it to a Writer.
-
Contract:
- <p> The JSON reader must provide an array of objects where each object represents a row.
- If {@code selectCsvHeaders} is provided, only those properties will be included as columns in the CSV output.
- If {@code selectCsvHeaders} is {@code null} or empty, all properties from the first JSON object will be used as headers.
-
Parameters:
-
jsonReader(Reader) — the Reader providing JSON data (must be an array of objects) -
selectCsvHeaders(Collection<String>) — the collection of property names to include as CSV headers, {@code null} or empty to include all properties from the first object -
csvWriter(Writer) — the Writer to write CSV output to
-
- Returns: the number of rows written to the CSV output (excluding header row)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during reading or writing, or if the JSON format is invalid
-
- See also: #jsonToCsv(File, File), #jsonToCsv(File, Collection, File)
loader(...) -> CSVLoader
-
Signature:
public static CSVLoader loader() - Summary: Creates a new {@link CSVLoader} instance for fluent-style CSV loading operations.
-
Parameters:
- (none)
- Returns: a new CSVLoader instance for configuring and executing CSV load operations
- See also: CSVLoader, #converter()
converter(...) -> CSVConverter
-
Signature:
public static CSVConverter converter() - Summary: Creates a new {@link CSVConverter} instance for fluent-style CSV conversion operations.
-
Parameters:
- (none)
- Returns: a new CSVConverter instance for configuring and executing format conversions
- See also: CSVConverter, #loader()
Public Instance Methods
- (none)
Class CSVLoader (com.landawn.abacus.util.CsvUtil.CSVLoader)
A fluent builder for loading CSV data with customizable parsing options.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
beanClassForColumnTypeInference(...) -> CSVLoader
-
Signature:
@Override public CSVLoader beanClassForColumnTypeInference(final Class<?> beanClassForColumnTypeInference) - Summary: Sets the bean class for automatic type conversion during CSV reading.
-
Parameters:
-
beanClassForColumnTypeInference(Class<?>) — the bean class defining property types
-
- Returns: this instance for method chaining
columnTypeMap(...) -> CSVLoader
-
Signature:
public CSVLoader columnTypeMap(final Map<String, ? extends Type<?>> columnTypeMap) - Summary: Sets the column type mapping for type conversion during CSV loading.
-
Parameters:
-
columnTypeMap(Map<String, ? extends Type<?>>) — mapping of column names to their Types
-
- Returns: this instance for method chaining
rowFilter(...) -> CSVLoader
-
Signature:
public CSVLoader rowFilter(final Predicate<? super String[]> rowFilter) - Summary: Sets a row filter predicate to include only matching rows.
-
Parameters:
-
rowFilter(Predicate<? super String[]>) — predicate to filter rows
-
- Returns: this instance for method chaining
load(...) -> Dataset
-
Signature:
public Dataset load() throws UncheckedIOException - Summary: Loads the CSV data into a Dataset using the configured options.
-
Contract:
- Either a source (file or reader) and a type configuration (columnTypeMap, beanClassForColumnTypeInference) must be set before calling this method.
-
Parameters:
- (none)
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load(TriConsumer)
-
Signature:
public Dataset load(final TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]> rowExtractor) throws UncheckedIOException - Summary: Loads the CSV data into a Dataset using a custom row extractor function.
-
Contract:
- Either a source (file or reader) must be set before calling this method.
-
Parameters:
-
rowExtractor(TriConsumer<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, Object[]>) — function to extract data from each row
-
- Returns: a Dataset containing the loaded CSV data
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #load()
stream(...) -> Stream<T>
-
Signature:
public <T> Stream<T> stream(final BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper) - Summary: Creates a Stream of elements using a custom row mapper function.
-
Contract:
- The reader is not closed automatically when the stream is closed.
-
Parameters:
-
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — function to convert each row to the target type
-
- Returns: a Stream of mapped elements
-
Signature:
public <T> Stream<T> stream(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T> rowMapper, final boolean closeReaderWhenStreamIsClosed) - Summary: Creates a Stream of elements using a custom row mapper function with optional reader closing.
-
Parameters:
-
rowMapper(BiFunction<? super List<String>, ? super NoCachingNoUpdating.DisposableArray<String>, ? extends T>) — function to convert each row to the target type -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close the reader when the stream is closed
-
- Returns: a Stream of mapped elements
Class CSVConverter (com.landawn.abacus.util.CsvUtil.CSVConverter)
A fluent builder for converting between CSV and JSON formats.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
csvToJson(...) -> long
-
Signature:
public long csvToJson(File outputJsonFile) throws UncheckedIOException - Summary: Converts CSV data to JSON format and writes to the specified output file.
-
Parameters:
-
outputJsonFile(File) — the file to write JSON output to
-
- Returns: the number of rows converted
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public long csvToJson(Writer outputJsonWriter) throws UncheckedIOException - Summary: Converts CSV data to JSON format and writes to the specified Writer.
-
Parameters:
-
outputJsonWriter(Writer) — the Writer to write JSON output to
-
- Returns: the number of rows converted
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
jsonToCsv(...) -> long
-
Signature:
public long jsonToCsv(File outputCsvFile) throws UncheckedIOException - Summary: Converts JSON data to CSV format and writes to the specified output file.
-
Parameters:
-
outputCsvFile(File) — the file to write CSV output to
-
- Returns: the number of rows converted
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
-
Signature:
public long jsonToCsv(Writer outputCsvWriter) throws UncheckedIOException - Summary: Converts JSON data to CSV format and writes to the specified Writer.
-
Parameters:
-
outputCsvWriter(Writer) — the Writer to write CSV output to
-
- Returns: the number of rows converted
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
Class DataSourceUtil (com.landawn.abacus.util.DataSourceUtil)
Utility class for managing database resources including connections, statements, and result sets.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
releaseConnection(...) -> void
-
Signature:
public static void releaseConnection(final Connection conn, final javax.sql.DataSource ds) - Summary: Releases a Connection, returning it to the connection pool if applicable.
-
Contract:
- Releases a Connection, returning it to the connection pool if applicable.
- When Spring is present in the classpath, delegates to Spring's DataSourceUtils to ensure proper transaction synchronization.
- <p> This method should be used instead of directly calling {@code Connection.close()} when working with Spring-managed data sources to ensure proper transaction handling.
-
Parameters:
-
conn(Connection) — the Connection to release, may be null -
ds(javax.sql.DataSource) — the DataSource that the Connection was obtained from, may be null
-
close(...) -> void
-
Signature:
public static void close(final ResultSet rs) throws UncheckedSQLException - Summary: Closes a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final ResultSet rs, final boolean closeStatement) throws UncheckedSQLException - Summary: Closes a ResultSet and optionally its associated Statement.
-
Contract:
- If closeStatement is {@code true} , attempts to retrieve and close the Statement that created the ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
closeStatement(boolean) — if {@code true} , also closes the Statement that created the ResultSet
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final ResultSet rs, final boolean closeStatement, final boolean closeConnection) throws IllegalArgumentException, UncheckedSQLException - Summary: Closes a ResultSet and optionally its associated Statement and Connection.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
closeStatement(boolean) — if {@code true} , also closes the Statement that created the ResultSet -
closeConnection(boolean) — if {@code true} , also closes the Connection (requires closeStatement to be true)
-
-
Throws:
-
java.lang.IllegalArgumentException— if closeStatement is {@code false} while closeConnection is true -
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final Statement stmt) throws UncheckedSQLException - Summary: Closes a Statement.
-
Parameters:
-
stmt(Statement) — the Statement to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
@Deprecated public static void close(final Connection conn) throws UncheckedSQLException - Summary: Closes a Connection.
-
Contract:
- Consider using {@link #releaseConnection(Connection, javax.sql.DataSource)} instead when working with Spring-managed connections.
-
Parameters:
-
conn(Connection) — the Connection to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final ResultSet rs, final Statement stmt) throws UncheckedSQLException - Summary: Closes a ResultSet and Statement in the proper order.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
stmt(Statement) — the Statement to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final Statement stmt, final Connection conn) throws UncheckedSQLException - Summary: Closes a Statement and Connection in the proper order.
-
Parameters:
-
stmt(Statement) — the Statement to close, may be null -
conn(Connection) — the Connection to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
-
Signature:
public static void close(final ResultSet rs, final Statement stmt, final Connection conn) throws UncheckedSQLException - Summary: Closes a ResultSet, Statement, and Connection in the proper order.
-
Contract:
- If any close operation fails, the exception is thrown after attempting to close remaining resources.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
stmt(Statement) — the Statement to close, may be null -
conn(Connection) — the Connection to close, may be null
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if a database access error occurs
-
closeQuietly(...) -> void
-
Signature:
public static void closeQuietly(final ResultSet rs) - Summary: Unconditionally closes a ResultSet.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null
-
-
Signature:
public static void closeQuietly(final ResultSet rs, final boolean closeStatement) throws UncheckedSQLException - Summary: Unconditionally closes a ResultSet and optionally its associated Statement.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
closeStatement(boolean) — if {@code true} , also closes the Statement that created the ResultSet
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedSQLException— if unable to retrieve the Statement from ResultSet
-
-
Signature:
public static void closeQuietly(final ResultSet rs, final boolean closeStatement, final boolean closeConnection) throws IllegalArgumentException - Summary: Unconditionally closes a ResultSet and optionally its associated Statement and Connection.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
closeStatement(boolean) — if {@code true} , also closes the Statement that created the ResultSet -
closeConnection(boolean) — if {@code true} , also closes the Connection (requires closeStatement to be true)
-
-
Throws:
-
java.lang.IllegalArgumentException— if closeStatement is {@code false} while closeConnection is true
-
-
Signature:
public static void closeQuietly(final Statement stmt) - Summary: Unconditionally closes a Statement.
-
Parameters:
-
stmt(Statement) — the Statement to close, may be null
-
-
Signature:
@Deprecated public static void closeQuietly(final Connection conn) - Summary: Unconditionally closes a Connection.
-
Contract:
- Consider using {@link #releaseConnection(Connection, javax.sql.DataSource)} instead when working with Spring-managed connections.
-
Parameters:
-
conn(Connection) — the Connection to close, may be null
-
-
Signature:
public static void closeQuietly(final ResultSet rs, final Statement stmt) - Summary: Unconditionally closes a ResultSet and Statement.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
stmt(Statement) — the Statement to close, may be null
-
-
Signature:
public static void closeQuietly(final Statement stmt, final Connection conn) - Summary: Unconditionally closes a Statement and Connection.
-
Parameters:
-
stmt(Statement) — the Statement to close, may be null -
conn(Connection) — the Connection to close, may be null
-
-
Signature:
public static void closeQuietly(final ResultSet rs, final Statement stmt, final Connection conn) - Summary: Unconditionally closes a ResultSet, Statement, and Connection.
-
Parameters:
-
rs(ResultSet) — the ResultSet to close, may be null -
stmt(Statement) — the Statement to close, may be null -
conn(Connection) — the Connection to close, may be null
-
executeBatch(...) -> int\[\]
-
Signature:
@SuppressWarnings("UnusedReturnValue") public static int[] executeBatch(final Statement stmt) throws SQLException - Summary: Executes a batch of commands on a Statement and clears the batch.
-
Contract:
- This method ensures that the batch is cleared even if the execution fails, preventing memory leaks from accumulated batch commands.
-
Parameters:
-
stmt(Statement) — the Statement containing the batch commands to execute
-
- Returns: an array of update counts containing one element for each command in the batch
-
Throws:
-
java.sql.SQLException— if a database access error occurs or the driver does not support batch statements
-
Public Instance Methods
- (none)
Interface Dataset (com.landawn.abacus.util.Dataset)
A interface representing a tabular data structure that provides comprehensive operations for data manipulation, analysis, and transformation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Dataset
-
Signature:
static Dataset empty() - Summary: Returns an immutable empty Dataset.
-
Parameters:
- (none)
- Returns: an immutable empty Dataset with no columns or rows
- See also: #isEmpty(), #size()
rows(...) -> Dataset
-
Signature:
static Dataset rows(final Collection<String> columnNames, final Object[][] rows) throws IllegalArgumentException - Summary: Creates a new Dataset with the specified column names and rows.
-
Contract:
- The order of elements in each row must correspond to the order of column names.
- This method is useful when data is naturally organized by rows, such as reading from database result sets or CSV files.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names (case-sensitive) -
rows(Object[][]) — the two-dimensional array where each subarray represents a row. Can be {@code null} or empty if no rows
-
- Returns: a new Dataset with the specified column names and rows
-
Throws:
-
java.lang.IllegalArgumentException— if {@code rows} contains arrays with length different from {@code columnNames} size
-
- See also: N#newDataset(Collection, Object\[\]\[\]), #columns(Collection, Object\[\]\[\])
-
Signature:
static Dataset rows(final Collection<String> columnNames, final Collection<? extends Collection<?>> rows) throws IllegalArgumentException - Summary: Creates a new Dataset with the specified column names and rows.
-
Contract:
- The order of elements in each row should correspond to the order of column names.
-
Parameters:
-
columnNames(Collection<String>) — a collection of strings representing the names of the columns in the Dataset -
rows(Collection<? extends Collection<?>>) — a collection of collections representing the data in the Dataset. Each sub-collection is a row. Can be {@code null} or empty if no rows
-
- Returns: a new Dataset with the specified column names and rows
-
Throws:
-
java.lang.IllegalArgumentException— if any row has a length different from {@code columnNames} size
-
- See also: N#newDataset(Collection, Collection)
columns(...) -> Dataset
-
Signature:
static Dataset columns(final Collection<String> columnNames, final Object[][] columns) throws IllegalArgumentException - Summary: Creates a new Dataset with the specified column names and columns.
-
Contract:
- The order of elements in each column should correspond to the order of column names.
-
Parameters:
-
columnNames(Collection<String>) — a collection of strings representing the names of the columns in the Dataset -
columns(Object[][]) — a two-dimensional array representing the data in the Dataset. Each subarray is a column. Can be {@code null} or empty if no columns
-
- Returns: a new Dataset with the specified column names and columns
-
Throws:
-
java.lang.IllegalArgumentException— if {@code columnNames} length differs from {@code columns} length, or any column has a length different from the first column
-
-
Signature:
static Dataset columns(final Collection<String> columnNames, final Collection<? extends Collection<?>> columns) throws IllegalArgumentException - Summary: Creates a new Dataset with the specified column names and columns.
-
Parameters:
-
columnNames(Collection<String>) — a collection of strings representing the names of the columns in the Dataset -
columns(Collection<? extends Collection<?>>) — a collection of collections representing the data in the Dataset. Each sub-collection is a column. Can be {@code null} or empty if no columns
-
- Returns: a new Dataset with the specified column names and columns
-
Throws:
-
java.lang.IllegalArgumentException— if {@code columnNames} length differs from {@code columns} length, or any column has a length different from the first column
-
Public Instance Methods
columnNames(...) -> ImmutableList<String>
-
Signature:
ImmutableList<String> columnNames() - Summary: Returns an immutable list of column names in this Dataset.
-
Parameters:
- (none)
- Returns: an ImmutableList of column names
columnCount(...) -> int
-
Signature:
int columnCount() - Summary: Returns the number of columns in this Dataset.
-
Parameters:
- (none)
- Returns: the count of columns
getColumnName(...) -> String
-
Signature:
String getColumnName(int columnIndex) throws IndexOutOfBoundsException - Summary: Returns the column name at the specified index.
-
Parameters:
-
columnIndex(int) — the zero-based index of the column
-
- Returns: the name of the column at the specified index
-
Throws:
-
java.lang.IndexOutOfBoundsException— if columnIndex is negative or > = columnCount()
-
getColumnIndex(...) -> int
-
Signature:
int getColumnIndex(String columnName) throws IllegalArgumentException - Summary: Returns the index of the specified column in the Dataset.
-
Parameters:
-
columnName(String) — the name(case-sensitive) of the column for which the index is required.
-
- Returns: the index of the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
getColumnIndexes(...) -> int\[\]
-
Signature:
int[] getColumnIndexes(Collection<String> columnNames) throws IllegalArgumentException - Summary: Returns an array of column indexes corresponding to the provided column names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names(case-sensitive) for which indexes are required.
-
- Returns: an array of integers representing the indexes of the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the provided column names does not exist in the Dataset.
-
containsColumn(...) -> boolean
-
Signature:
boolean containsColumn(String columnName) - Summary: Checks if the specified column name exists in this Dataset.
-
Contract:
- Checks if the specified column name exists in this Dataset.
-
Parameters:
-
columnName(String) — the name(case-sensitive) of the column to check.
-
- Returns: {@code true} if the column exists, {@code false} otherwise.
containsAllColumns(...) -> boolean
-
Signature:
boolean containsAllColumns(Collection<String> columnNames) - Summary: Checks if this {@code Dataset} contains all the specified columns.
-
Contract:
- Checks if this {@code Dataset} contains all the specified columns.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names(case-sensitive) to check.
-
- Returns: {@code true} if all the specified columns are included in the this {@code Dataset}
renameColumn(...) -> void
-
Signature:
void renameColumn(String columnName, String newColumnName) throws IllegalArgumentException - Summary: Renames a column in the Dataset.
-
Parameters:
-
columnName(String) — the current name of the column. -
newColumnName(String) — the new name for the column.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset or the new column name exists in the Dataset.
-
renameColumns(...) -> void
-
Signature:
void renameColumns(Map<String, String> oldNewNames) throws IllegalArgumentException - Summary: Renames multiple columns in the Dataset.
-
Parameters:
-
oldNewNames(Map<String, String>) — a map where the key is the current name of the column and the value is the new name for the column.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified old column names does not exist in the Dataset or any of the new column names already exists in the Dataset.
-
-
Signature:
void renameColumns(Collection<String> columnNames, Function<? super String, String> func) throws IllegalArgumentException - Summary: Renames multiple columns in the Dataset using a function to determine the new names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of current column names to be renamed. -
func(Function<? super String, String>) — a function that takes the current column name as input and returns the new column name.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified old column names does not exist in the Dataset or any of the new column names already exists in the Dataset.
-
-
Signature:
void renameColumns(Function<? super String, String> func) throws IllegalArgumentException - Summary: Renames all columns in the Dataset using a function to determine the new names.
-
Parameters:
-
func(Function<? super String, String>) — a function that takes the current column name as input and returns the new column name.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the new column names already exists in the Dataset.
-
moveColumn(...) -> void
-
Signature:
void moveColumn(String columnName, int newPosition) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Repositions a single column within the {@code Dataset} to a specified index.
-
Parameters:
-
columnName(String) — the name of the column to move. -
newPosition(int) — the zero-based index where the column should be placed.
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code columnName} does not exist in the dataset. -
java.lang.IndexOutOfBoundsException— if {@code newPosition} is outside the valid range of column indices.
-
moveColumns(...) -> void
-
Signature:
void moveColumns(List<String> columnNames, int newPosition) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Repositions multiple columns within the {@code Dataset} to a specified index.
-
Parameters:
-
columnNames(List<String>) — the list of column names to move; their order in this list is maintained. -
newPosition(int) — the zero-based index at which the first specified column will be placed.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any column name in {@code columnNames} does not exist in the dataset. -
java.lang.IndexOutOfBoundsException— if {@code newPosition} is outside the valid range of column indices.
-
swapColumns(...) -> void
-
Signature:
void swapColumns(String columnNameA, String columnNameB) throws IllegalArgumentException - Summary: Swaps the positions of two columns in the Dataset.
-
Parameters:
-
columnNameA(String) — the name of the first column to be swapped. -
columnNameB(String) — the name of the second column to be swapped.
-
-
Throws:
-
java.lang.IllegalArgumentException— if either of the specified column names does not exist in the Dataset.
-
moveRow(...) -> void
-
Signature:
void moveRow(int rowIndex, int newPosition) throws IndexOutOfBoundsException - Summary: Repositions a row within the {@code Dataset} from one index to another.
-
Parameters:
-
rowIndex(int) — the zero-based index of the row to move. -
newPosition(int) — the zero-based index where the row should be placed.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code rowIndex} or {@code newPosition} is outside the valid range of row indices.
-
moveRows(...) -> void
-
Signature:
void moveRows(int fromRowIndex, int toRowIndex, int newPosition) throws IndexOutOfBoundsException - Summary: Repositions a contiguous block of rows within the {@code Dataset} to a new index.
-
Parameters:
-
fromRowIndex(int) — the zero-based index of the first row in the block to move (inclusive). -
toRowIndex(int) — the zero-based index of the last row in the block to move (exclusive). -
newPosition(int) — the zero-based index where the block of rows should begin.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} , {@code toRowIndex} , or {@code newPosition} is outside the valid range of row indices.
-
swapRows(...) -> void
-
Signature:
void swapRows(int rowIndexA, int rowIndexB) throws IndexOutOfBoundsException - Summary: Swaps the positions of two rows in the Dataset.
-
Parameters:
-
rowIndexA(int) — the index of the first row to be swapped. -
rowIndexB(int) — the index of the second row to be swapped.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if either of the specified row indexes is out of bounds.
-
get(...) -> T
-
Signature:
<T> T get(int rowIndex, int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the value at the specified row and column index in the Dataset.
-
Contract:
- So the column values must be the type which is assignable to target type.
-
Parameters:
-
rowIndex(int) — the index of the row. -
columnIndex(int) — the index of the column.
-
- Returns: the value at the specified row and column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified row or column index is out of bounds.
-
-
Signature:
<T> T get(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to target type.
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
<T> T get(String columnName) - Summary: Retrieves the value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to target type.
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the value at the specified column.
- See also: #get(int)
set(...) -> void
-
Signature:
void set(int rowIndex, int columnIndex, Object element) throws IllegalStateException, IndexOutOfBoundsException - Summary: Sets the value at the specified row and column index in the Dataset.
-
Parameters:
-
rowIndex(int) — the index of the row. -
columnIndex(int) — the index of the column. -
element(Object) — the new value to be set at the specified row and column index.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the specified row or column index is out of bounds.
-
-
Signature:
void set(int columnIndex, Object value) throws IllegalStateException, IndexOutOfBoundsException - Summary: Sets the value at the specified column index in the Dataset for the current row.
-
Parameters:
-
columnIndex(int) — the index of the column. -
value(Object) — the new value to be set at the specified column index.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
void set(String columnName, Object value) throws IllegalStateException, IllegalArgumentException - Summary: Sets the value at the specified column in the Dataset for the current row.
-
Parameters:
-
columnName(String) — the name of the column. -
value(Object) — the new value to be set at the specified column.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #set(int, Object)
isNull(...) -> boolean
-
Signature:
boolean isNull(int rowIndex, int columnIndex) throws IndexOutOfBoundsException - Summary: Checks if the value at the specified row and column index in the Dataset is {@code null} .
-
Contract:
- Checks if the value at the specified row and column index in the Dataset is {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code Dataset dataset = Dataset.rows(Arrays.asList("id", "name"), data); boolean isNull = dataset.isNull(0, 1); // checks if value at row 0, column 1 is null } </pre>
-
Parameters:
-
rowIndex(int) — the index of the row. -
columnIndex(int) — the index of the column.
-
- Returns: {@code true} if the value at the specified row and column index is {@code null} , {@code false} otherwise.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified row or column index is out of bounds.
-
-
Signature:
boolean isNull(int columnIndex) throws IndexOutOfBoundsException - Summary: Checks if the value at the specified column index in the Dataset for the current row is {@code null} .
-
Contract:
- Checks if the value at the specified column index in the Dataset for the current row is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: {@code true} if the value at the specified column index is {@code null} , {@code false} otherwise.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
boolean isNull(String columnName) throws IllegalArgumentException - Summary: Checks if the value at the specified column in the Dataset for the current row is {@code null} .
-
Contract:
- Checks if the value at the specified column in the Dataset for the current row is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: {@code true} if the value at the specified column is {@code null} , {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #isNull(int)
getBoolean(...) -> boolean
-
Signature:
boolean getBoolean(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the boolean value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Boolean} .
- <br/> Returns default value (false) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the boolean value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
boolean getBoolean(String columnName) throws IllegalArgumentException - Summary: Retrieves the boolean value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Boolean} .
- <br/> Returns default value (false) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the boolean value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getBoolean(int)
getChar(...) -> char
-
Signature:
char getChar(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the char value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Character} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the char value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
char getChar(String columnName) throws IllegalArgumentException - Summary: Retrieves the char value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Character} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the char value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getChar(int)
getByte(...) -> byte
-
Signature:
byte getByte(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the byte value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the byte value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
byte getByte(String columnName) throws IllegalArgumentException - Summary: Retrieves the byte value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the byte value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getByte(int)
getShort(...) -> short
-
Signature:
short getShort(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the short value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the short value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
short getShort(String columnName) throws IllegalArgumentException - Summary: Retrieves the short value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the short value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getShort(int)
getInt(...) -> int
-
Signature:
int getInt(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the integer value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the integer value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
int getInt(String columnName) throws IllegalArgumentException - Summary: Retrieves the integer value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the integer value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getInt(int)
getLong(...) -> long
-
Signature:
long getLong(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the long value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the long value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
long getLong(String columnName) throws IllegalArgumentException - Summary: Retrieves the long value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the long value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getLong(int)
getFloat(...) -> float
-
Signature:
float getFloat(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the float value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0f) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the float value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
float getFloat(String columnName) throws IllegalArgumentException - Summary: Retrieves the float value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0f) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the float value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getFloat(int)
getDouble(...) -> double
-
Signature:
double getDouble(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the double value at the specified column index in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0d) if the property is {@code null} .
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: the double value at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
double getDouble(String columnName) throws IllegalArgumentException - Summary: Retrieves the double value at the specified column in the Dataset for the current row.
-
Contract:
- So the column values must be the type which is assignable to {@code Number} .
- <br/> Returns default value (0d) if the property is {@code null} .
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: the double value at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #getDouble(int)
getColumn(...) -> ImmutableList<T>
-
Signature:
<T> ImmutableList<T> getColumn(int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the values of the specified column index in the Dataset as an ImmutableList.
-
Parameters:
-
columnIndex(int) — the index of the column.
-
- Returns: an ImmutableList of values at the specified column index.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified column index is out of bounds.
-
-
Signature:
<T> ImmutableList<T> getColumn(String columnName) throws IllegalArgumentException - Summary: Retrieves the values of the specified column in the Dataset as an ImmutableList.
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: an ImmutableList of values at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
copyColumn(...) -> List<T>
-
Signature:
<T> List<T> copyColumn(String columnName) throws IllegalArgumentException - Summary: Retrieves the values of the specified column in the Dataset as a List.
-
Parameters:
-
columnName(String) — the name of the column.
-
- Returns: a List of values at the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
addColumn(...) -> void
-
Signature:
void addColumn(String newColumnName, Collection<?> column) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset.
-
Contract:
- The size of this list should match the number of rows in the Dataset.
-
Parameters:
-
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
column(Collection<?>) — the data for the new column. It should be a list where each element represents a row in the column.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the new column name already exists in the Dataset or the provided collection is not empty and its size does not match the number of rows in the Dataset.
-
-
Signature:
void addColumn(int newColumnPosition, String newColumnName, Collection<?> column) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset at the specified position.
-
Contract:
- The size of the list provided should match the number of rows in the Dataset.
-
Parameters:
-
newColumnPosition(int) — the position at which the new column should be added. It should be a valid index within the current column range. -
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
column(Collection<?>) — the data for the new column. It should be a collection where each element represents a row in the column.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the supplied arguments reference non-existent columns or otherwise violate dataset constraints or if the provided collection is not empty and its size does not match the number of rows in the Dataset, or the newColumnPosition is out of bounds.
-
-
Signature:
void addColumn(String newColumnName, String fromColumnName, Function<?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset.
-
Parameters:
-
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnName(String) — the name of the existing column to be used as input for the function. -
func(Function<?, ?>) — the function to generate the values for the new column. It takes the value of the existing column for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the new column name already exists in the Dataset or the existing column name does not exist in the Dataset.
-
-
Signature:
void addColumn(int newColumnPosition, String newColumnName, String fromColumnName, Function<?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset at the specified position.
-
Parameters:
-
newColumnPosition(int) — the position at which the new column should be added. It should be a valid index within the current column range. -
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnName(String) — the name of the existing column to be used as input for the function. -
func(Function<?, ?>) — the function to generate the values for the new column. It takes the value of the existing column for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the Dataset, or if the existing column name does not exist in the Dataset.
-
-
Signature:
void addColumn(String newColumnName, Collection<String> fromColumnNames, Function<? super DisposableObjArray, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset.
-
Parameters:
-
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Collection<String>) — the names of the existing columns to be used as input for the function. -
func(Function<? super DisposableObjArray, ?>) — the function to generate the values for the new column. It takes the values of the existing columns for each row and returns the value for the new column for that row. The input to the function is a DisposableObjArray containing the values of the existing columns for a particular row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the new column name already exists in the Dataset or any of the existing column names does not exist in the Dataset.
-
-
Signature:
void addColumn(int newColumnPosition, String newColumnName, Collection<String> fromColumnNames, Function<? super DisposableObjArray, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset at the specified position.
-
Parameters:
-
newColumnPosition(int) — the position at which the new column should be added. It should be a valid index within the current column range. -
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Collection<String>) — the names of the existing columns to be used as input for the function. -
func(Function<? super DisposableObjArray, ?>) — the function to generate the values for the new column. It takes the values of the existing columns for each row and returns the value for the new column for that row. The input to the function is a DisposableObjArray containing the values of the existing columns for a particular row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the Dataset, or if any of the existing column names does not exist in the Dataset.
-
-
Signature:
void addColumn(String newColumnName, Tuple2<String, String> fromColumnNames, BiFunction<?, ?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset.
-
Parameters:
-
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two existing columns to be used as input for the BiFunction. -
func(BiFunction<?, ?, ?>) — the BiFunction to generate the values for the new column. It takes the values of the two existing columns for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the new column name already exists in the Dataset or any of the existing column names does not exist in the Dataset.
-
-
Signature:
void addColumn(int newColumnPosition, String newColumnName, Tuple2<String, String> fromColumnNames, BiFunction<?, ?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset at the specified position.
-
Parameters:
-
newColumnPosition(int) — the position at which the new column should be added. It should be a valid index within the current column range. -
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two existing columns to be used as input for the BiFunction. -
func(BiFunction<?, ?, ?>) — the BiFunction to generate the values for the new column. It takes the values of the two existing columns for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the Dataset, or if any of the existing column names does not exist in the Dataset.
-
-
Signature:
void addColumn(String newColumnName, Tuple3<String, String, String> fromColumnNames, TriFunction<?, ?, ?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset.
-
Parameters:
-
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three existing columns to be used as input for the TriFunction. -
func(TriFunction<?, ?, ?, ?>) — the TriFunction to generate the values for the new column. It takes the values of the three existing columns for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the new column name already exists in the Dataset or any of the existing column names does not exist in the Dataset.
-
-
Signature:
void addColumn(int newColumnPosition, String newColumnName, Tuple3<String, String, String> fromColumnNames, TriFunction<?, ?, ?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to the Dataset at the specified position.
-
Parameters:
-
newColumnPosition(int) — the position at which the new column should be added. It should be a valid index within the current column range. -
newColumnName(String) — the name of the new column to be added. It should not be a name that already exists in the Dataset. -
fromColumnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three existing columns to be used as input for the TriFunction. -
func(TriFunction<?, ?, ?, ?>) — the TriFunction to generate the values for the new column. It takes the values of the three existing columns for each row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the Dataset, or if any of the existing column names does not exist in the Dataset.
-
addColumns(...) -> void
-
Signature:
void addColumns(List<String> newColumnNames, List<? extends Collection<?>> newColumns) throws IllegalStateException, IllegalArgumentException - Summary: Adds multiple columns to the Dataset.
-
Contract:
- Each collection in the list represents a column, and the size of each collection should match the number of rows in the Dataset.
-
Parameters:
-
newColumnNames(List<String>) — a list containing the names of the new columns to be added. These should not be names that already exist in the Dataset. -
newColumns(List<? extends Collection<?>>) — a list of collections, where each collection represents a column. Each collection should have a size that matches the number of rows in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the new column names already exist in the Dataset, if size of {@code newColumnNames} does not match the size of {@code columns} , or if any collection in {@code columns} is not empty and its size does not match the number of rows in the Dataset.
-
-
Signature:
void addColumns(int newColumnPosition, List<String> newColumnNames, List<? extends Collection<?>> newColumns) throws IllegalStateException, IllegalArgumentException - Summary: Adds multiple columns to the Dataset at the specified position.
-
Contract:
- Each collection in the list represents a column, and the size of each collection should match the number of rows in the Dataset.
-
Parameters:
-
newColumnPosition(int) — the position at which the new columns should be added. It should be a valid index within the current column range. -
newColumnNames(List<String>) — a list containing the names of the new columns to be added. These should not be names that already exist in the Dataset. -
newColumns(List<? extends Collection<?>>) — a list of collections, where each collection represents a column. Each collection should have a size that matches the number of rows in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newColumnPosition} is less than zero or bigger than column size or any of the new column names already exist in the Dataset, or if size of {@code newColumnNames} does not match the size of {@code columns} , or if any collection in {@code columns} is not empty and its size does not match the number of rows in the Dataset, or the newColumnPosition is out of bounds.
-
removeColumn(...) -> List<T>
-
Signature:
<T> List<T> removeColumn(String columnName) throws IllegalStateException, IllegalArgumentException - Summary: Removes a column from the Dataset.
-
Parameters:
-
columnName(String) — the name of the column to be removed. It should be a name that exists in the Dataset.
-
- Returns: a List containing the values of the removed column.
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
removeColumns(...) -> void
-
Signature:
void removeColumns(Collection<String> columnNames) throws IllegalStateException, IllegalArgumentException - Summary: Removes multiple columns from the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — a collection containing the names of the columns to be removed. These should be names that exist in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset.
-
-
Signature:
void removeColumns(Predicate<? super String> filter) throws IllegalStateException - Summary: Removes multiple columns from the Dataset.
-
Contract:
- The function is applied to each column name, and if it returns {@code true} , the column is removed.
-
Parameters:
-
filter(Predicate<? super String>) — a Predicate function to determine which columns should be removed. It should return {@code true} for column names that should be removed, and {@code false} for those that should be kept.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only).
-
updateColumn(...) -> void
-
Signature:
void updateColumn(String columnName, Function<?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Updates the values in a specified column of the Dataset.
-
Parameters:
-
columnName(String) — the name of the column to be updated. It should be a name that exists in the Dataset. -
func(Function<?, ?>) — the function to be applied to each value in the column. It takes the current value and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
updateColumns(...) -> void
-
Signature:
void updateColumns(Collection<String> columnNames, IntBiObjFunction<String, ?, ?> func) throws IllegalStateException, IllegalArgumentException - Summary: Updates the values in multiple specified columns of the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — a collection containing the names of the columns to be updated. These should be names that exist in the Dataset. -
func(IntBiObjFunction<String, ?, ?>) — the function to be applied to each value in the columns. It takes the row index, column name, and current value, and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset.
-
convertColumn(...) -> void
-
Signature:
void convertColumn(String columnName, Class<?> targetType) throws IllegalStateException, IllegalArgumentException - Summary: Converts the values in a specified column of the Dataset to a specified target type.
-
Parameters:
-
columnName(String) — the name of the column to be converted. It should be a name that exists in the Dataset. -
targetType(Class<?>) — the Class object representing the target type to which the column values should be converted.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset or a value cannot be converted to the target type.
-
- See also: N#convert(Object, Class)
convertColumns(...) -> void
-
Signature:
void convertColumns(Map<String, Class<?>> columnTargetTypes) throws IllegalStateException, IllegalArgumentException - Summary: Converts the values in multiple specified columns of the Dataset to their respective target types.
-
Parameters:
-
columnTargetTypes(Map<String, Class<?>>) — a map where the key is the column name and the value is the Class object representing the target type to which the column values should be converted. The column names should exist in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or a value cannot be converted to the target type.
-
- See also: N#convert(Object, Class)
combineColumns(...) -> void
-
Signature:
void combineColumns(Collection<String> columnNames, String newColumnName, Class<?> newColumnType) throws IllegalStateException, IllegalArgumentException - Summary: Combines multiple columns into a new column in the Dataset using a default combining strategy.
-
Contract:
- The new column's type must be Object\[\], Collection, Map, or Bean class.
-
Parameters:
-
columnNames(Collection<String>) — a collection containing the names of the columns to be combined. These should be names that exist in the Dataset and will be removed after combination. -
newColumnName(String) — the name of the new column to be created. It should not be a name that already exists in the Dataset. -
newColumnType(Class<?>) — the Class object representing the type of the new column. It must be Object\[\], Collection, Map, or a Bean class.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or {@code columnNames} is empty, or the new column name already exists in the Dataset, or the specified column type is not Object\[\], Collection, Map, or a Bean class. It can't be string or other types.
-
- See also: #combineColumns(Collection, String, Function), #addColumn(String, Collection, Function), #addColumn(int, String, Collection, Function), #toList(Collection, Class)
-
Signature:
void combineColumns(Collection<String> columnNames, String newColumnName, Function<? super DisposableObjArray, ?> combineFunc) throws IllegalStateException, IllegalArgumentException - Summary: Combines multiple columns into a new column in the Dataset using a custom combining function.
-
Parameters:
-
columnNames(Collection<String>) — a collection containing the names of the columns to be combined. These should be names that exist in the Dataset and will be removed after combination. -
newColumnName(String) — the name of the new column to be created. It should not be a name that already exists in the Dataset. -
combineFunc(Function<? super DisposableObjArray, ?>) — the function to generate the values for the new column. It takes a DisposableObjArray of the values in the existing columns for a particular row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or {@code columnNames} is empty, or the new column name already exists in the Dataset.
-
- See also: #combineColumns(Collection, String, Class), #addColumn(String, Collection, Function)
-
Signature:
void combineColumns(Tuple2<String, String> columnNames, String newColumnName, BiFunction<?, ?, ?> combineFunc) throws IllegalStateException, IllegalArgumentException - Summary: Combines two columns into a new column in the Dataset using a custom BiFunction.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be combined. These should be names that exist in the Dataset and will be removed after combination. -
newColumnName(String) — the name of the new column to be created. It should not be a name that already exists in the Dataset. -
combineFunc(BiFunction<?, ?, ?>) — the BiFunction to generate the values for the new column. It takes the values of the two existing columns for a particular row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or the new column name already exists in the Dataset.
-
- See also: #combineColumns(Collection, String, Function), #combineColumns(Tuple3, String, TriFunction), #addColumn(String, Tuple2, BiFunction)
-
Signature:
void combineColumns(Tuple3<String, String, String> columnNames, String newColumnName, TriFunction<?, ?, ?, ?> combineFunc) throws IllegalStateException, IllegalArgumentException - Summary: Combines three columns into a new column in the Dataset using a custom TriFunction.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three columns to be combined. These should be names that exist in the Dataset and will be removed after combination. -
newColumnName(String) — the name of the new column to be created. It should not be a name that already exists in the Dataset. -
combineFunc(TriFunction<?, ?, ?, ?>) — the TriFunction to generate the values for the new column. It takes the values of the three existing columns for a particular row and returns the value for the new column for that row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or the new column name already exists in the Dataset.
-
- See also: #combineColumns(Collection, String, Function), #combineColumns(Tuple2, String, BiFunction), #addColumn(String, Tuple3, TriFunction)
divideColumn(...) -> void
-
Signature:
void divideColumn(String columnName, Collection<String> newColumnNames, Function<?, ? extends List<?>> divideFunc) throws IllegalStateException, IllegalArgumentException - Summary: Divides a column into multiple new columns in the Dataset.
-
Parameters:
-
columnName(String) — the name of the column to be divided. It should be a name that exists in the Dataset and will be removed after division. -
newColumnNames(Collection<String>) — a collection containing the names of the new columns to be created. These should not be names that already exist in the Dataset. The size of this collection should match the size of the Lists returned by the divideFunc. -
divideFunc(Function<?, ? extends List<?>>) — the function to be applied to each value in the column. It takes the current value and returns a List of new values. The size of this List should match the size of the newColumnNames collection.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset, any of the new column names already exist in the Dataset, or {@code newColumnNames} is empty.
-
-
Signature:
void divideColumn(String columnName, Collection<String> newColumnNames, BiConsumer<?, Object[]> output) throws IllegalStateException, IllegalArgumentException - Summary: Divides a column into multiple new columns in the Dataset using a BiConsumer.
-
Contract:
- The BiConsumer takes the current value and an Object array, and it should populate the array with the new values for the new columns.
-
Parameters:
-
columnName(String) — the name of the column to be divided. It should be a name that exists in the Dataset and will be removed after division. -
newColumnNames(Collection<String>) — a collection containing the names of the new columns to be created. These should not be names that already exist in the Dataset. The size of this collection determines the size of the Object array passed to the BiConsumer. -
output(BiConsumer<?, Object[]>) — the BiConsumer to be applied to each value in the column. It takes the current value and an Object array, and it should populate the array with the new values for the new columns. The array size matches the size of {@code newColumnNames} .
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset, or any of the new column names already exist in the Dataset, or {@code newColumnNames} is empty.
-
- See also: #divideColumn(String, Collection, Function), #combineColumns(Collection, String, Function)
-
Signature:
void divideColumn(String columnName, Tuple2<String, String> newColumnNames, BiConsumer<?, Pair<Object, Object>> output) throws IllegalStateException, IllegalArgumentException - Summary: Divides a column into two new columns in the Dataset using a BiConsumer.
-
Contract:
- The BiConsumer takes the current value and a Pair object, and it should populate the Pair with the new values for the new columns.
-
Parameters:
-
columnName(String) — the name of the column to be divided. It should be a name that exists in the Dataset and will be removed after division. -
newColumnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two new columns to be created. These should not be names that already exist in the Dataset. -
output(BiConsumer<?, Pair<Object, Object>>) — the BiConsumer to be applied to each value in the column. It takes the current value and a Pair object, and it should populate the Pair with the new values for the new columns.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset, or any of the new column names already exist in the Dataset.
-
- See also: #divideColumn(String, Collection, Function), #divideColumn(String, Collection, BiConsumer), #combineColumns(Tuple2, String, BiFunction)
-
Signature:
void divideColumn(String columnName, Tuple3<String, String, String> newColumnNames, BiConsumer<?, Triple<Object, Object, Object>> output) throws IllegalStateException, IllegalArgumentException - Summary: Divides a column into three new columns in the Dataset using a BiConsumer.
-
Contract:
- The BiConsumer takes the current value and a Triple object, and it should populate the Triple with the new values for the new columns.
-
Parameters:
-
columnName(String) — the name of the column to be divided. It should be a name that exists in the Dataset and will be removed after division. -
newColumnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three new columns to be created. These should not be names that already exist in the Dataset. -
output(BiConsumer<?, Triple<Object, Object, Object>>) — the BiConsumer to be applied to each value in the column. It takes the current value and a Triple object, and it should populate the Triple with the new values for the new columns.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset, or any of the new column names already exist in the Dataset.
-
- See also: #divideColumn(String, Collection, Function), #divideColumn(String, Collection, BiConsumer), #divideColumn(String, Tuple2, BiConsumer), #combineColumns(Tuple3, String, TriFunction)
columns(...) -> Stream<ImmutableList<Object>>
-
Signature:
Stream<ImmutableList<Object>> columns() - Summary: Retrieves the data of the Dataset as a Stream of ImmutableList.
-
Parameters:
- (none)
- Returns: a Stream containing ImmutableList where each list represents a column of data in the Dataset.
columnMap(...) -> Map<String, ImmutableList<Object>>
-
Signature:
Map<String, ImmutableList<Object>> columnMap() - Summary: Retrieves the data of the Dataset as a Map.
-
Parameters:
- (none)
- Returns: a Map where each entry represents a column in the Dataset.
addRow(...) -> void
-
Signature:
void addRow(Object row) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new row to the Dataset.
-
Parameters:
-
row(Object) — the new row to be added to the Dataset. It can be an Object array, List, Map, or a Bean with getter/setter methods.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the structure of the row does not match the required type - Object array, List, Map, or Bean.
-
-
Signature:
void addRow(int newRowPosition, Object row) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new row to the Dataset at the specified position.
-
Parameters:
-
newRowPosition(int) — the position at which the new row should be added. It should be a valid index within the current row range. -
row(Object) — the new row to be added to the Dataset. It can be an Object array, List, Map, or a Bean with getter/setter methods.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newRowPosition} is less than zero or bigger than row size, or the structure of the row does not match the required type - Object array, List, Map, or Bean.
-
addRows(...) -> void
-
Signature:
void addRows(Collection<?> rows) throws IllegalStateException, IllegalArgumentException - Summary: Adds multiple new rows to the Dataset.
-
Parameters:
-
rows(Collection<?>) — a collection of new rows to be added to the Dataset. Each row can be an Object array, List, Map, or a Bean with getter/setter methods.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the structure of any row does not match the required type - Object array, List, Map, or Bean.
-
-
Signature:
void addRows(int newRowPosition, Collection<?> rows) throws IllegalStateException, IllegalArgumentException - Summary: Adds multiple new rows to the Dataset at the specified position.
-
Parameters:
-
newRowPosition(int) — the position at which the new rows should be added. It should be a valid index within the current row range. -
rows(Collection<?>) — a collection of new rows to be added to the Dataset. Each row can be an Object array, List, Map, or a Bean with getter/setter methods.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified {@code newRowPosition} is less than zero or bigger than row size, or if the structure of any row does not match the required type - Object array, List, Map, or Bean.
-
removeRow(...) -> void
-
Signature:
void removeRow(int rowIndex) throws IllegalStateException, IndexOutOfBoundsException - Summary: Removes a row from the Dataset.
-
Parameters:
-
rowIndex(int) — the index of the row to be removed. It should be a valid index within the current row range.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds.
-
removeRowsAt(...) -> void
-
Signature:
void removeRowsAt(int... rowIndexesToRemove) throws IllegalStateException, IndexOutOfBoundsException - Summary: Removes multiple rows from the Dataset.
-
Parameters:
-
rowIndexesToRemove(int[]) — an array of indices of the rows to be removed.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if any of the specified indices is out of bounds.
-
removeRows(...) -> void
-
Signature:
void removeRows(int inclusiveFromRowIndex, int exclusiveToRowIndex) throws IllegalStateException, IndexOutOfBoundsException - Summary: Removes a range of rows from the Dataset.
-
Parameters:
-
inclusiveFromRowIndex(int) — the start index of the range. It should be a valid index within the current row range. The row at this index is included in the removal. -
exclusiveToRowIndex(int) — the end index of the range. It should be a valid index within the current row range. The row at this index is not included in the removal.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the specified {@code inclusiveFromRowIndex} is less than zero, or the specified {@code exclusiveToRowIndex} is bigger than row size, or {@code inclusiveFromRowIndex} is bigger than {@code exclusiveToRowIndex} .
-
removeDuplicateRowsBy(...) -> void
-
Signature:
void removeDuplicateRowsBy(String keyColumnName) throws IllegalStateException, IllegalArgumentException - Summary: Removes duplicate rows from the Dataset based on values in the specified key column.
-
Parameters:
-
keyColumnName(String) — the name of the column to use for identifying duplicates. It should be a name that exists in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #removeDuplicateRowsBy(String, Function), #removeDuplicateRowsBy(Collection), #distinctBy(String)
-
Signature:
void removeDuplicateRowsBy(String keyColumnName, Function<?, ?> keyExtractor) throws IllegalStateException, IllegalArgumentException - Summary: Removes duplicate rows from the Dataset based on the key extracted from specified column by custom key extractor function.
-
Parameters:
-
keyColumnName(String) — the name of the column to use for identifying duplicates. It should be a name that exists in the Dataset. -
keyExtractor(Function<?, ?>) — the function to extract the key from the column value. It takes the column value as input and returns the key used for comparison.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
- See also: #removeDuplicateRowsBy(String), #removeDuplicateRowsBy(Collection), #distinctBy(String, Function)
-
Signature:
void removeDuplicateRowsBy(Collection<String> keyColumnNames) throws IllegalStateException, IllegalArgumentException - Summary: Removes duplicate rows from the Dataset based on values in the specified key columns.
-
Parameters:
-
keyColumnNames(Collection<String>) — a collection containing the names of the columns to use for identifying duplicates. These should be names that exist in the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnNames} is empty.
-
- See also: #removeDuplicateRowsBy(Collection, Function), #removeDuplicateRowsBy(String), #distinctBy(Collection)
-
Signature:
void removeDuplicateRowsBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalStateException, IllegalArgumentException - Summary: Removes duplicate rows from the Dataset based on the key extracted from specified columns by custom key extractor function.
-
Parameters:
-
keyColumnNames(Collection<String>) — a collection containing the names of the columns to use for identifying duplicates. These should be names that exist in the Dataset. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to extract the key from a DisposableObjArray of column values. It takes a DisposableObjArray representing the values in the specified columns for a particular row and returns the key used for comparison.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, if {@code keyColumnNames} is empty.
-
- See also: #removeDuplicateRowsBy(Collection), #removeDuplicateRowsBy(String), #distinctBy(Collection, Function)
updateRow(...) -> void
-
Signature:
void updateRow(int rowIndex, Function<?, ?> func) throws IllegalStateException, IndexOutOfBoundsException - Summary: Updates a specific row in the Dataset.
-
Parameters:
-
rowIndex(int) — the index of the row to be updated. It should be a valid index within the current row range. -
func(Function<?, ?>) — the function to be applied to each value in the row. It takes the current value and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds.
-
updateRows(...) -> void
-
Signature:
void updateRows(int[] rowIndexesToUpdate, IntBiObjFunction<String, ?, ?> func) throws IllegalStateException, IndexOutOfBoundsException - Summary: Updates the values in the specified rows of the Dataset.
-
Parameters:
-
rowIndexesToUpdate(int[]) — an array of integers representing the indices of the rows to be updated. Each index should be a valid index within the current row range. -
func(IntBiObjFunction<String, ?, ?>) — the function to be applied to each value in the specified rows. It takes the row index, column name, and current value, and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if any of the specified indices is out of bounds.
-
updateAll(...) -> void
-
Signature:
void updateAll(Function<?, ?> func) throws IllegalStateException - Summary: Updates all the values in the Dataset.
-
Parameters:
-
func(Function<?, ?>) — the function to be applied to each value in the Dataset. It takes the current value and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only).
-
-
Signature:
void updateAll(IntBiObjFunction<String, ?, ?> func) throws IllegalStateException - Summary: Updates all the values in the Dataset.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Dataset dataset = Dataset.rows(Arrays.asList("id"), new Object\[\]\[\] {{1}, {2}}); dataset.updateAll((i, c, v) -> { if ("id".equals(c) && v instanceof Integer) { return ((Integer) v) + i; // Increment id by its row index } return v; }); } </pre>
-
Parameters:
-
func(IntBiObjFunction<String, ?, ?>) — the function to be applied to each value in the Dataset. It takes the row index, column name, and current value, and returns the new value.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only).
-
replaceIf(...) -> void
-
Signature:
void replaceIf(Predicate<?> predicate, Object newValue) throws IllegalStateException - Summary: Replaces values in the Dataset that satisfy a specified condition with a new value.
-
Contract:
- <br/> The predicate takes each value in the Dataset as input and returns a boolean indicating whether the value should be replaced.
-
Parameters:
-
predicate(Predicate<?>) — the predicate to test each value in the Dataset. It takes a value from the Dataset as input and returns a boolean indicating whether the value should be replaced. -
newValue(Object) — the new value to replace the values that satisfy the condition.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only).
-
-
Signature:
void replaceIf(IntBiObjPredicate<String, ?> predicate, Object newValue) throws IllegalStateException - Summary: Replaces values in the Dataset that satisfy a specified condition with a new value.
-
Contract:
- <br/> The predicate takes the row index, column name, and each value in the Dataset as input, and returns a boolean indicating whether the value should be replaced.
-
Parameters:
-
predicate(IntBiObjPredicate<String, ?>) — the predicate to test each value in the sheet. It takes the row index, column name, and a value from the Dataset as input, and returns a boolean indicating whether the value should be replaced. -
newValue(Object) — the new value to replace the values that satisfy the condition.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only).
-
prepend(...) -> void
-
Signature:
void prepend(Dataset other) throws IllegalStateException, IllegalArgumentException - Summary: Prepends the provided Dataset to the current Dataset.
-
Contract:
- The structure (columns and their types) of the provided Dataset should match the structure of the current Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to be prepended to the current Dataset. It should have the same structure as the current Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the current Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if this Dataset and the provided Dataset don't have the same column names or if the other Dataset is {@code null} .
-
- See also: #append(Dataset), #merge(Dataset), #union(Dataset), #unionAll(Dataset)
append(...) -> void
-
Signature:
void append(Dataset other) throws IllegalStateException, IllegalArgumentException - Summary: Appends the provided Dataset to the current Dataset.
-
Contract:
- The structure (columns and their types) of the provided Dataset should match the structure of the current Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to be appended to the current Dataset. It should have the same structure as the current Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the current Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if this Dataset and the provided Dataset don't have the same column names or if the other Dataset is {@code null} .
-
- See also: #prepend(Dataset), #merge(Dataset), #union(Dataset), #unionAll(Dataset)
merge(...) -> void
-
Signature:
void merge(Dataset other) throws IllegalStateException, IllegalArgumentException - Summary: Merges all the rows and columns from another Dataset into this Dataset.
-
Contract:
- <br/> If there are columns in the other Dataset that are not present in this Dataset, they will be added to this Dataset with {@code null} values for rows from this Dataset.
- If there are columns in this Dataset that are not present in the other Dataset, they will also be included with {@code null} values for rows from the other Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to merge with this Dataset
-
-
Throws:
-
java.lang.IllegalStateException— if this Dataset is frozen (read-only) -
java.lang.IllegalArgumentException— if the other Dataset is {@code null}
-
- See also: #merge(Dataset, boolean), #prepend(Dataset), #append(Dataset), #union(Dataset), #unionAll(Dataset)
-
Signature:
void merge(Dataset other, boolean requiresSameColumns) throws IllegalStateException, IllegalArgumentException - Summary: Merges all the rows and columns from another Dataset into this Dataset with an option to require the same columns.
-
Contract:
- <br/> If there are columns in the other Dataset that are not present in this Dataset, they will be added to this Dataset with {@code null} values for rows from this Dataset.
- If there are columns in this Dataset that are not present in the other Dataset, they will also be included with {@code null} values for rows from the other Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to merge with this Dataset. Must not be {@code null} . -
requiresSameColumns(boolean) — a boolean value that determines whether the merge operation requires both Datasets to have the same columns. If {@code true} , both Datasets must have identical column structures. If {@code false} , columns from both Datasets are combined.
-
-
Throws:
-
java.lang.IllegalStateException— if this Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if {@code requiresSameColumns} is {@code true} and the Datasets do not have the same columns.
-
- See also: #merge(Dataset), #prepend(Dataset), #append(Dataset), #union(Dataset, boolean), #unionAll(Dataset, boolean)
-
Signature:
@Beta void merge(Dataset other, Collection<String> selectColumnNamesFromOtherToMerge) throws IllegalStateException, IllegalArgumentException - Summary: Merges selected columns from another Dataset into this Dataset.
-
Contract:
- <br/> If there are selected columns in the other Dataset that are not present in this Dataset, they will be added to this Dataset with {@code null} values for rows from this Dataset.
- If there are columns in this Dataset that are not present in the other Dataset, they will also be included with {@code null} values for rows from the other Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to merge selected columns from. Must not be {@code null} . -
selectColumnNamesFromOtherToMerge(Collection<String>) — the collection of column names to select from the other Dataset for merging. Must not be {@code null} or empty.
-
-
Throws:
-
java.lang.IllegalStateException— if this Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if {@code selectColumnNamesFromOtherToMerge} is {@code null} or empty, or if any of the specified column names doesn't exist in the other Dataset.
-
- See also: #merge(Dataset), #merge(Dataset, boolean), #append(Dataset)
-
Signature:
@Beta void merge(Dataset other, int fromRowIndexFromOther, int toRowIndexFromOther, Collection<String> selectColumnNamesFromOtherToMerge) throws IllegalStateException, IndexOutOfBoundsException, IllegalArgumentException - Summary: Merges selected columns from a specified row range of another Dataset into this Dataset.
-
Contract:
- <br/> If there are selected columns in the other Dataset that are not present in this Dataset, they will be added to this Dataset with {@code null} values for rows from this Dataset.
- If there are columns in this Dataset that are not present in the other Dataset, they will also be included with {@code null} values for rows from the other Dataset.
-
Parameters:
-
other(Dataset) — the Dataset to merge selected columns from. Must not be {@code null} . -
fromRowIndexFromOther(int) — the starting index (inclusive) of the row range from the other Dataset to be included in the merge operation. -
toRowIndexFromOther(int) — the ending index (exclusive) of the row range from the other Dataset to be included in the merge operation. -
selectColumnNamesFromOtherToMerge(Collection<String>) — the collection of column names to select from the other Dataset for merging. Must not be {@code null} or empty.
-
-
Throws:
-
java.lang.IllegalStateException— if this Dataset is frozen (read-only). -
java.lang.IndexOutOfBoundsException— if the {@code fromRowIndexFromOther} or {@code toRowIndexFromOther} is out of bounds for the other Dataset. -
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if {@code selectColumnNamesFromOtherToMerge} is {@code null} or empty, or if any of the specified column names doesn't exist in the other Dataset.
-
- See also: #merge(Dataset), #merge(Dataset, boolean), #merge(Dataset, Collection), #append(Dataset)
currentRowIndex(...) -> int
-
Signature:
int currentRowIndex() - Summary: Retrieves the current row number in the Dataset.
-
Contract:
- {@code 0} is returned if {@code absolute(int)} has not been called yet.
- <br/> This method is typically used when iterating over the rows in the Dataset.
-
Parameters:
- (none)
- Returns: the current row number as an integer. The first row is number 0.
moveToRow(...) -> Dataset
-
Signature:
Dataset moveToRow(int rowIndex) - Summary: Moves the cursor to the row in this Dataset object specified by the given index.
-
Contract:
- <br/> This method is typically used when navigating through the rows in the Dataset.
-
Parameters:
-
rowIndex(int) — the index of the row to move to. The first row is 0, the second is 1, and so on.
-
- Returns: the Dataset object itself with the cursor moved to the specified row.
getRow(...) -> Object\[\]
-
Signature:
Object[] getRow(int rowIndex) throws IndexOutOfBoundsException - Summary: Retrieves a row from the Dataset as an array of Objects.
-
Contract:
- <br/> This method is typically used when accessing the data in a specific row.
-
Parameters:
-
rowIndex(int) — the index of the row to retrieve. The first row is 0, the second is 1, and so on.
-
- Returns: an array of Objects representing the data in the specified row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds.
-
-
Signature:
<T> T getRow(int rowIndex, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Retrieves a row from the Dataset and converts it to a specific type.
-
Contract:
- <br/> This method is typically used when accessing the data in a specific row and converting it to a specific type.
-
Parameters:
-
rowIndex(int) — the index of the row to retrieve. The first row is 0, the second is 1, and so on. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an instance of the specified type representing the data in the specified row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds. -
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> T getRow(int rowIndex, Collection<String> columnNames, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Retrieves a row from the Dataset as an instance of the specified type.
-
Contract:
- <br/> This method is typically used when accessing the data in a specific row and converting it to a specific type.
-
Parameters:
-
rowIndex(int) — the index of the row to retrieve. The first row is 0, the second is 1, and so on. -
columnNames(Collection<String>) — the column names to include in the returned row view -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an instance of the specified type representing the data in the specified row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds. -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> T getRow(int rowIndex, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Retrieves a row from the Dataset as an instance of the specified type.
-
Contract:
- <br/> This method is typically used when accessing the data in a specific row and converting it to a specific type.
- It must be Object\[\], Collection, Map, or Bean class.
-
Parameters:
-
rowIndex(int) — the index of the row to retrieve. The first row is 0, the second is 1, and so on. -
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an instance of the specified type representing the data in the specified row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds. -
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> T getRow(int rowIndex, Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Retrieves a row from the Dataset as an instance of the specified type.
-
Contract:
- <br/> This method is typically used when accessing the data in a specific row and converting it to a specific type.
- It must be Object\[\], Collection, Map, or Bean class.
-
Parameters:
-
rowIndex(int) — the index of the row to retrieve. The first row is 0, the second is 1, and so on. -
columnNames(Collection<String>) — the collection of column names to be included in the returned row. -
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an instance of the specified type representing the data in the specified row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code rowIndex} is out of bounds. -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class, or if any of the specified {@code columnNames} does not exist in the Dataset.
-
firstRow(...) -> Optional<Object\[\]>
-
Signature:
Optional<Object[]> firstRow() - Summary: Retrieves the first row from the Dataset as an Optional array of Objects.
-
Contract:
- <br/> This method is typically used when you need to access the first row of data in the Dataset.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
- (none)
- Returns: an Optional array of Objects representing the data in the first row. If the Dataset is empty, the Optional will be empty.
-
Signature:
<T> Optional<T> firstRow(Class<? extends T> rowType) throws IllegalArgumentException - Summary: Retrieves the first row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the first row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an Optional instance of the specified type representing the data in the first row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> firstRow(Collection<String> columnNames, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Retrieves the first row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the first row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the returned row. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an Optional instance of the specified type representing the data in the first row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> firstRow(IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Retrieves the first row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the first row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an Optional instance of the specified type representing the data in the first row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> firstRow(Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Retrieves the first row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the first row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the returned row. -
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an Optional instance of the specified type representing the data in the first row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
lastRow(...) -> Optional<Object\[\]>
-
Signature:
Optional<Object[]> lastRow() - Summary: Retrieves the last row from the Dataset as an Optional array of Objects.
-
Contract:
- <br/> This method is typically used when you need to access the last row of data in the Dataset.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
- (none)
- Returns: an Optional array of Objects representing the data in the last row. If the Dataset is empty, the Optional will be empty.
-
Signature:
<T> Optional<T> lastRow(Class<? extends T> rowType) throws IllegalArgumentException - Summary: Retrieves the last row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the last row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an Optional instance of the specified type representing the data in the last row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> lastRow(Collection<String> columnNames, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Retrieves the last row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the last row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the returned row. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: an Optional instance of the specified type representing the data in the last row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> lastRow(IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Retrieves the last row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the last row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an Optional instance of the specified type representing the data in the last row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Optional<T> lastRow(Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Retrieves the last row from the Dataset as an instance of the specified type wrapped in an Optional.
-
Contract:
- <br/> This method is typically used when you need to access the last row of data in the Dataset and convert it to a specific type.
- If the Dataset is empty, the returned Optional will be empty.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the returned row. -
rowSupplier(IntFunction<? extends T>) — the IntFunction that generates an instance of the target type. It takes an integer as input, which is the number of columns in the row, and returns an instance of the target type.
-
- Returns: an Optional instance of the specified type representing the data in the last row. If the Dataset is empty, the Optional will be empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
forEach(...) -> void
-
Signature:
<E extends Exception> void forEach(Throwables.Consumer<? super DisposableObjArray, E> action) throws E - Summary: Performs the given action for each row of the Dataset until all rows.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on each row in the Dataset.
-
Parameters:
-
action(Throwables.Consumer<? super DisposableObjArray, E>) — the action to be performed on each row. It takes a DisposableObjArray as input, which represents a row in the Dataset. The action should not cache or update the input DisposableObjArray or its values(Array).
-
-
Throws:
-
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(Collection<String> columnNames, Throwables.Consumer<? super DisposableObjArray, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset until all rows.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on each row in the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the DisposableObjArray. -
action(Throwables.Consumer<? super DisposableObjArray, E>) — the action to be performed on each row. It takes a DisposableObjArray as input, which represents a row in the Dataset. The action should not cache or update the input DisposableObjArray or its values(Array).
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(int fromRowIndex, int toRowIndex, Throwables.Consumer<? super DisposableObjArray, E> action) throws IndexOutOfBoundsException, E - Summary: Performs the given action for each row of the Dataset within the specified range.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on a specific range of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be processed. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be processed. This index is exclusive, meaning the row at this index will not be processed. -
action(Throwables.Consumer<? super DisposableObjArray, E>) — the action to be performed on each row. It takes a DisposableObjArray as input, which represents a row in the Dataset. The action should not cache or update the input DisposableObjArray or its values(Array).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Throwables.Consumer<? super DisposableObjArray, E> action) throws IndexOutOfBoundsException, IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset within the specified range.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on a specific range of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be processed. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be processed. This index is exclusive, meaning the row at this index will not be processed. -
columnNames(Collection<String>) — the collection of column names to be included in the DisposableObjArray. -
action(Throwables.Consumer<? super DisposableObjArray, E>) — the action to be performed on each row. It takes a DisposableObjArray as input, which represents a row in the Dataset. The action should not cache or update the input DisposableObjArray or its values(Array).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(Tuple2<String, String> columnNames, Throwables.BiConsumer<?, ?, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on each row in the Dataset.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a Tuple2 representing the names of the two columns to be included in the action. -
action(Throwables.BiConsumer<?, ?, E>) — the action to be performed on each row. It takes two inputs, which represent the values of the two columns specified in the Tuple {@code columnNames} . The action should not cache or update the input values.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset. -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(int fromRowIndex, int toRowIndex, Tuple2<String, String> columnNames, Throwables.BiConsumer<?, ?, E> action) throws IndexOutOfBoundsException, IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset within the specified range.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on a specific range of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be processed. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be processed. This index is exclusive, meaning the row at this index will not be processed. -
columnNames(Tuple2<String, String>) — a Tuple2 representing the names of the two columns to be included in the action. -
action(Throwables.BiConsumer<?, ?, E>) — the action to be performed on each row. It takes two inputs, which represent the values of the two columns specified in the Tuple {@code columnNames} . The action should not cache or update the input values.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset. -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(Tuple3<String, String, String> columnNames, Throwables.TriConsumer<?, ?, ?, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on each row in the Dataset.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — a Tuple3 representing the names of the three columns to be included in the action. -
action(Throwables.TriConsumer<?, ?, ?, E>) — the action to be performed on each row. It takes three inputs, which represent the values of the three columns specified in the Tuple {@code columnNames} . The action should not cache or update the input values.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset. -
E— if the action throws an exception.
-
-
Signature:
<E extends Exception> void forEach(int fromRowIndex, int toRowIndex, Tuple3<String, String, String> columnNames, Throwables.TriConsumer<?, ?, ?, E> action) throws IndexOutOfBoundsException, IllegalArgumentException, E - Summary: Performs the given action for each row of the Dataset within the specified range.
-
Contract:
- <br/> This method is typically used when you need to perform an operation on a specific range of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be processed. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be processed. This index is exclusive, meaning the row at this index will not be processed. -
columnNames(Tuple3<String, String, String>) — a Tuple3 representing the names of the three columns to be included in the action. -
action(Throwables.TriConsumer<?, ?, ?, E>) — the action to be performed on each row. It takes three inputs, which represent the values of the three columns specified in the Tuple {@code columnNames} . The action should not cache or update the input values.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset. -
E— if the action throws an exception.
-
toList(...) -> List<Object\[\]>
-
Signature:
List<Object[]> toList() - Summary: Converts the entire Dataset into a list of Object arrays.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to a different format or system.
-
Parameters:
- (none)
- Returns: a List of Object arrays representing the data in the Dataset. Each Object array is a row in the Dataset.
-
Signature:
List<Object[]> toList(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Converts a specified range of the Dataset into a list of Object arrays.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data in the Dataset to a different format or system.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted.
-
- Returns: a List of Object arrays representing the data in the specified range of the Dataset. Each Object array is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset
-
-
Signature:
<T> List<T> toList(Class<? extends T> rowType) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to a specific type of objects.
-
Parameters:
-
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(Collection<String> columnNames, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type, including only the specified columns.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type, including only the specified columns.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data and specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to a specific type of objects.
-
Parameters:
-
rowSupplier(IntFunction<? extends T>) — the function to create a new instance of the target type. It takes an integer as input, which represents the number of columns in the Dataset.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
rowSupplier(IntFunction<? extends T>) — the function to create a new instance of the target type. It takes an integer as input, which represents the number of columns in the Dataset.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the specified columns.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
rowSupplier(IntFunction<? extends T>) — the function to create a new instance of the target type. It takes an integer as input, which represents the number of columns in the Dataset.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the specified columns.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data and specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
rowSupplier(IntFunction<? extends T>) — the function to create a new instance of the target type. It takes an integer as input, which represents the number of columns in the Dataset.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(Predicate<? super String> columnNameFilter, Function<? super String, String> columnNameConverter, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the columns that pass the specified filter.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
columnNameFilter(Predicate<? super String>) — the predicate to filter the column names. Only the columns that pass this filter will be included in the instance. -
columnNameConverter(Function<? super String, String>) — the function to convert the column names into property names in the instance. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, Predicate<? super String> columnNameFilter, Function<? super String, String> columnNameConverter, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the columns that pass the specified filter.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data and specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
columnNameFilter(Predicate<? super String>) — the predicate to filter the column names. Only the columns that pass this filter will be included in the instance. -
columnNameConverter(Function<? super String, String>) — the function to convert the column names into property names in the instance. -
rowType(Class<? extends T>) — the Class object representing the target type of the row. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> List<T> toList(Predicate<? super String> columnNameFilter, Function<? super String, String> columnNameConverter, IntFunction<? extends T> rowSupplier) - Summary: Converts the entire Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the columns that pass the specified filter.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
columnNameFilter(Predicate<? super String>) — the predicate to filter the column names. Only the columns that pass this filter will be included in the instance. -
columnNameConverter(Function<? super String, String>) — the function to convert the column names into property names in the instance. -
rowSupplier(IntFunction<? extends T>) — the function to create a new instance of the target type. It takes an integer as input, which represents the number of columns in the Dataset.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Signature:
<T> List<T> toList(int fromRowIndex, int toRowIndex, Predicate<? super String> columnNameFilter, Function<? super String, String> columnNameConverter, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Object\[\], Collection, Map, or Bean class, including only the columns that pass the specified filter.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data and specific columns of data in the Dataset to a specific type of objects.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
columnNameFilter(Predicate<? super String>) — the predicate to filter the column names. Only the columns that pass this filter will be included in the instance. -
columnNameConverter(Function<? super String, String>) — the function to convert the column names into property names in the instance. -
rowSupplier(IntFunction<? extends T>) — the supplier that allocates containers for receiving column values during mapping
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
toEntities(...) -> List<T>
-
Signature:
<T> List<T> toEntities(Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, mapping column names to field names based on the provided map.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a specific type of objects (entities), and the column names in the Dataset do not directly match the field names in the entity class.
-
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code beanClass} is not a supported type - Bean class.
-
-
Signature:
<T> List<T> toEntities(int fromRowIndex, int toRowIndex, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Bean class, mapping column names to field names based on the provided map.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data in the Dataset to a specific type of objects (entities), and the column names in the Dataset do not directly match the field names in the entity class.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toEntities(Map, Class)
-
Signature:
<T> List<T> toEntities(Collection<String> columnNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, mapping column names to field names based on the provided map.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the column names in the Dataset do not directly match the field names in the entity class.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toEntities(Map, Class)
-
Signature:
<T> List<T> toEntities(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a specified range of the Dataset into a list of instances of the specified type - Bean class, including only the specified columns, mapping column names to field names based on the provided map.
-
Contract:
- <br/> This method is typically used when you need to export a specific range of data and specific columns of data in the Dataset to a specific type of objects (entities), and the column names in the Dataset do not directly match the field names in the entity class.
-
Parameters:
-
fromRowIndex(int) — the starting index of the range of rows to be converted. The first row is 0, the second is 1, and so on. -
toRowIndex(int) — the ending index of the range of rows to be converted. This index is exclusive, meaning the row at this index will not be converted. -
columnNames(Collection<String>) — the collection of column names to be included in the instance. -
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the specified range of the Dataset. Each instance is a row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toEntities(Map, Class)
toMergedEntities(...) -> List<T>
-
Signature:
<T> List<T> toMergedEntities(Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code beanClass} is not a supported type - Bean class or no id defined in {@code beanClass} .
-
-
Signature:
<T> List<T> toMergedEntities(Collection<String> selectPropNames, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
selectPropNames(Collection<String>) — the collection of property names to be included in the instance. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified property names does not exist in the Dataset or {@code selectPropNames} is empty, or if the specified {@code beanClass} is not a supported type - Bean class or no id defined in {@code beanClass} .
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified property names does not exist in the Dataset or {@code selectPropNames} is empty, or if the specified {@code beanClass} is not a supported type - Bean class or no id defined in {@code beanClass} .
-
-
Signature:
<T> List<T> toMergedEntities(String idPropName, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
idPropName(String) — the property name that is used as the ID for merging rows. Rows with the same ID will be merged into a single instance. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code idPropName} does not exist in the Dataset or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(String idPropName, Collection<String> selectPropNames, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
idPropName(String) — the property name that is used as the ID for merging rows. Rows with the same ID will be merged into a single instance. -
selectPropNames(Collection<String>) — the collection of property names to be included in the instance. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code idPropName} does not exist in the Dataset or {@code idPropNames} is empty, or if any of the specified property names does not exist in the Dataset or {@code selectPropNames} is empty, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(String idPropName, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same ID into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
idPropName(String) — the property name that is used as the ID for merging rows. Rows with the same ID will be merged into a single instance. -
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified property names does not exist in the Dataset or {@code selectPropNames} is empty, or if the specified {@code beanClass} is not a supported type - Bean class or no id defined in {@code beanClass} .
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(Collection<String> idPropNames, Collection<String> selectPropNames, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same IDs into a single instance.
-
Contract:
- <br/> This method is typically used when you need to export specific columns of data in the Dataset to a specific type of objects (entities), and the rows in the Dataset have duplicate IDs.
-
Parameters:
-
idPropNames(Collection<String>) — the collection of property names that are used as the IDs for merging rows. Rows with the same IDs will be merged into a single instance. -
selectPropNames(Collection<String>) — the collection of property names to be included in the instance. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified ID property names does not exist in the Dataset or {@code idPropNames} is empty, or if any of the specified property names does not exist in the Dataset or {@code selectPropNames} is empty, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(Collection<String> idPropNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified type - Bean class, merging rows with the same IDs into a single instance, mapping column names to field names based on the provided map.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a specific type of objects (entities), where rows have duplicate composite IDs and column names don't directly match field names in the entity class.
-
Parameters:
-
idPropNames(Collection<String>) — the collection of property names that are used as the composite IDs for merging rows. Rows with the same ID values will be merged into a single instance. -
prefixAndFieldNameMap(Map<String, String>) — the map that defines the mapping between column names and field names. The key is the column name prefix, and the value is the corresponding field name. -
beanClass(Class<? extends T>) — the Class object representing the target type of the row. It must be a Bean class.
-
- Returns: a List of instances of the specified type representing the data in the Dataset. Each instance is a merged entity in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified ID property names does not exist in the Dataset or {@code idPropNames} is empty, or if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code beanClass} is not a supported type - Bean class.
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
-
Signature:
<T> List<T> toMergedEntities(Collection<String> idPropNames, Collection<String> selectPropNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> beanClass) throws IllegalArgumentException - Summary: Converts the entire Dataset into a list of instances of the specified bean class, <br/> merging rows that share the same ID properties into a single entity.
-
Contract:
- <p> This method is commonly used when exporting selected columns from a Dataset into a list of typed objects (entities), especially when the Dataset contains multiple rows with the same ID values.
-
Parameters:
-
idPropNames(Collection<String>) — the collection of property names used to identify and group rows. Rows with matching values for these properties will be merged into one instance. -
selectPropNames(Collection<String>) — the collection of property names to include in the resulting instances. -
prefixAndFieldNameMap(Map<String, String>) — an optional mapping of column name prefixes to field names in the bean. This supports column headers that are prefixed. -
beanClass(Class<? extends T>) — the class representing the bean type. Must be a valid JavaBean.
-
- Returns: a list of merged entities of the specified type, based on the Dataset content.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code idPropNames} is {@code null} or empty, if any specified ID or selected property name does not exist in the Dataset, if the {@code prefixAndFieldNameMap} is invalid, or if {@code beanClass} is not a supported JavaBean class.
-
- See also: #toMergedEntities(Class), #toMergedEntities(Map, Class)
toMap(...) -> Map<K, V>
-
Signature:
<K, V> Map<K, V> toMap(String keyColumnName, String valueColumnName) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(String keyColumnName, String valueColumnName, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, V> Map<K, V> toMap(int fromRowIndex, int toRowIndex, String keyColumnName, String valueColumnName) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range to be included in the map. -
toRowIndex(int) — the ending index of the row range to be included in the map. -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(int fromRowIndex, int toRowIndex, String keyColumnName, String valueColumnName, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive) -
toRowIndex(int) — the ending index of the row range (exclusive) -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, V> Map<K, V> toMap(String keyColumnName, Collection<String> valueColumnNames, Class<? extends V> rowType) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowType(Class<? extends V>) — the Class object representing the type of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(String keyColumnName, Collection<String> valueColumnNames, Class<? extends V> rowType, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowType(Class<? extends V>) — the Class object representing the type of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V> Map<K, V> toMap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, Class<? extends V> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range to be included in the map. -
toRowIndex(int) — the ending index of the row range to be included in the map. -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowType(Class<? extends V>) — the Class object representing the type of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, Class<? extends V> rowType, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range to be included in the map. -
toRowIndex(int) — the ending index of the row range to be included in the map. -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowType(Class<? extends V>) — the Class object representing the type of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V> Map<K, V> toMap(String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends V> rowSupplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowSupplier(IntFunction<? extends V>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends V> rowSupplier, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowSupplier(IntFunction<? extends V>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V> Map<K, V> toMap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends V> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range to be included in the map. -
toRowIndex(int) — the ending index of the row range to be included in the map. -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowSupplier(IntFunction<? extends V>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, V, M extends Map<K, V>> M toMap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends V> rowSupplier, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Map, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Map, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range to be included in the map. -
toRowIndex(int) — the ending index of the row range to be included in the map. -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the collection of names of the columns in the Dataset that will be used as the values in the resulting map. Each value in the map is an instance of the specified row type, where each property in the instance corresponds to a column in the row. -
rowSupplier(IntFunction<? extends V>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. -
supplier(IntFunction<? extends M>) — a function that generates a new map. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Map where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is an instance of the specified row type, where each property in the instance corresponds to a column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
toMultimap(...) -> ListMultimap<K, T>
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(String keyColumnName, String valueColumnName) throws IllegalArgumentException - Summary: Converts the entire Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map.
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(String keyColumnName, String valueColumnName, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map. -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, String valueColumnName) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map.
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, String valueColumnName, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnName(String) — the name of the column in the Dataset that will be used as the values in the resulting map. -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value column in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} or {@code valueColumnName} does not exist in the Dataset.
-
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(String keyColumnName, Collection<String> valueColumnNames, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Converts the entire Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowType(Class<? extends T>) — the class of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(String keyColumnName, Collection<String> valueColumnNames, Class<? extends T> rowType, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts the entire Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowType(Class<? extends T>) — the class of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class. -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowType(Class<? extends T>) — the class of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, Class<? extends T> rowType, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowType(Class<? extends T>) — the class of the values in the resulting map. It must be Object\[\], Collection, Map, or Bean class. -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowSupplier(IntFunction<? extends T>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. The return value created by specified {@code rowSupplier} must be an Object\[\], Collection, Map, or Bean class
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends T> rowSupplier, IntFunction<? extends M> supplier) throws IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowSupplier(IntFunction<? extends T>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. The return value created by specified {@code rowSupplier} must be an Object\[\], Collection, Map, or Bean class -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T> ListMultimap<K, T> toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a ListMultimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a ListMultimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowSupplier(IntFunction<? extends T>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. The return value created by specified {@code rowSupplier} must be an Object\[\], Collection, Map, or Bean class
-
- Returns: a ListMultimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(int fromRowIndex, int toRowIndex, String keyColumnName, Collection<String> valueColumnNames, IntFunction<? extends T> rowSupplier, IntFunction<? extends M> supplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a Multimap, where each entry in the map corresponds to a row in the Dataset.
-
Contract:
- <br/> This method is typically used when you need to export a range of data in the Dataset to a Multimap, where each key-value pair in the map corresponds to a row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
keyColumnName(String) — the name of the column in the Dataset that will be used as the keys in the resulting map. -
valueColumnNames(Collection<String>) — the names of the columns in the Dataset that will be used as the values in the resulting map. -
rowSupplier(IntFunction<? extends T>) — a function that generates a new row. The function takes an integer argument, which is the initial row capacity. The return value created by specified {@code rowSupplier} must be an Object\[\], Collection, Map, or Bean class -
supplier(IntFunction<? extends M>) — a function that generates a new Multimap. The function takes an integer argument, which is the initial map capacity.
-
- Returns: a Multimap where each key-value pair corresponds to a row in the Dataset. The key of each pair is the value of the specified key column in the row. The value of each pair is the value of the specified value columns in the row.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if the specified {@code keyColumnName} does not exist in the Dataset, or if any of the specified value column names does not exist in the Dataset or {@code valueColumnNames} is empty, or the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
toJson(...) -> String
-
Signature:
String toJson() - Summary: Converts the entire Dataset into a JSON string.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to a JSON format.
-
Parameters:
- (none)
- Returns: a JSON string representing the current Dataset.
- See also: #toJson(int, int, Collection)
-
Signature:
String toJson(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Converts a range of rows in the Dataset into a JSON string.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to a JSON format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive).
-
- Returns: a JSON string representing the specified range of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset
-
-
Signature:
String toJson(int fromRowIndex, int toRowIndex, Collection<String> columnNames) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a JSON string, including only the specified columns.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to a JSON format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the JSON string.
-
- Returns: a JSON string representing the specified range of rows and columns in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
-
Signature:
void toJson(File output) throws UncheckedIOException - Summary: Converts the entire Dataset into a JSON string and writes it to the provided File.
-
Parameters:
-
output(File) — the File where the JSON string will be written
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the File.
-
- See also: #toJson(int, int, Collection, File)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, File output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string and writes it to the provided File.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive) -
toRowIndex(int) — the ending index of the row range (exclusive) -
output(File) — the File where the JSON string will be written
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the File.
-
- See also: #toJson(int, int, Collection, File)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, Collection<String> columnNames, File output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string, including only the specified columns, and writes it to the provided File.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to a JSON format and write it directly to a File.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the JSON string. -
output(File) — the File where the JSON string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the File.
-
-
Signature:
void toJson(OutputStream output) throws UncheckedIOException - Summary: Converts the entire Dataset into a JSON string and writes it to the provided OutputStream.
-
Parameters:
-
output(OutputStream) — the OutputStream where the JSON string will be written
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the OutputStream.
-
- See also: #toJson(int, int, Collection, OutputStream)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, OutputStream output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string and writes it to the provided OutputStream.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive) -
toRowIndex(int) — the ending index of the row range (exclusive) -
output(OutputStream) — the OutputStream where the JSON string will be written
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the OutputStream.
-
- See also: #toJson(int, int, Collection, OutputStream)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, Collection<String> columnNames, OutputStream output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string, including only the specified columns, and writes it to the provided OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to a JSON format and write it directly to an OutputStream, such as a FileOutputStream for writing to a file.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the JSON string. -
output(OutputStream) — the OutputStream where the JSON string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the OutputStream.
-
-
Signature:
void toJson(Writer output) throws UncheckedIOException - Summary: Converts the entire Dataset into a JSON string and writes it to the provided Writer.
-
Parameters:
-
output(Writer) — the Writer where the JSON string will be written
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the output
-
- See also: #toJson(int, int, Collection, Writer)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, Writer output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string and writes it to the provided Writer.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive) -
toRowIndex(int) — the ending index of the row range (exclusive) -
output(Writer) — the Writer where the JSON string will be written
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the row indices are out of bounds -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the output
-
- See also: #toJson(int, int, Collection, Writer)
-
Signature:
void toJson(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Writer output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a JSON string, including only the specified columns, and writes it to the provided Writer.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to a JSON format and write it directly to a Writer, such as a FileWriter for writing to a file.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the JSON string. -
output(Writer) — the Writer where the JSON string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the Writer.
-
toXml(...) -> String
-
Signature:
String toXml() - Summary: Converts the entire Dataset into an XML string, with each row represented as an XML element with the specified name, and returns it as a String.
-
Parameters:
- (none)
- Returns: a String containing the XML representation of the Dataset.
- See also: #toXml(int, int, Collection, String)
-
Signature:
String toXml(String rowElementName) throws IllegalArgumentException - Summary: Converts the entire Dataset into an XML string, with each row represented as an XML element with the specified name, and returns it as a String.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to an XML format.
-
Parameters:
-
rowElementName(String) — the name of the XML element that represents a row in the Dataset.
-
- Returns: a String containing the XML representation of the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code rowElementName} is empty.
-
- See also: #toXml(int, int, Collection, String)
-
Signature:
String toXml(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Converts a range of rows in the Dataset into an XML string and returns it as a String.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
- If you need more control over the XML output (e.g., custom element names, namespaces, etc.), consider using the overloaded method with more parameters.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive).
-
- Returns: a String containing the XML representation of the specified range of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset
-
- See also: #toXml(int, int, Collection, String)
-
Signature:
String toXml(int fromRowIndex, int toRowIndex, String rowElementName) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into an XML string, with each row represented as an XML element with the specified name, and returns it as a String.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowElementName(String) — the name of the XML element that represents a row in the Dataset.
-
- Returns: a String containing the XML representation of the specified range of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if {@code rowElementName} is empty.
-
- See also: #toXml(int, int, Collection, String)
-
Signature:
String toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into an XML string, with each row represented as an XML element with a default name, and returns it as a String.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included in the XML string.
-
- Returns: a String containing the XML representation of the specified range of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty
-
- See also: #toXml(int, int, Collection, String)
-
Signature:
String toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, String rowElementName) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and returns it as a String.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the XML string. -
rowElementName(String) — the name of the XML element that represents a row in the Dataset.
-
- Returns: a String containing the XML representation of the specified range of rows and columns in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if {@code rowElementName} is empty.
-
-
Signature:
void toXml(File output) throws UncheckedIOException - Summary: Writes the entire Dataset as an XML string to the specified File.
-
Contract:
- <br/> This method is typically used when you need to export the entire data in the Dataset to an XML format.
-
Parameters:
-
output(File) — the File where the XML string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
- See also: #toXml(int, int, Collection, String, File)
-
Signature:
void toXml(String rowElementName, File output) throws IllegalArgumentException, UncheckedIOException - Summary: Writes the entire Dataset as an XML string to the specified File, with each row represented as an XML element with the specified name.
-
Contract:
- <br/> This method is typically used when you need to export the entire data in the Dataset to an XML format.
-
Parameters:
-
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(File) — the File where the XML string will be written.
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
- See also: #toXml(int, int, Collection, String, File)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, File output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Writes a range of rows in the Dataset as an XML string to the specified File.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
output(File) — the File where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
- See also: #toXml(int, int, Collection, String, File)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, String rowElementName, File output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Writes a range of rows in the Dataset as an XML string to the specified File, with each row represented as an XML element with the specified name.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(File) — the File where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
- See also: #toXml(int, int, Collection, String, File)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, File output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified File.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the XML string. -
output(File) — the File where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
- See also: #toXml(int, int, Collection, String, File)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, String rowElementName, File output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified File.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the XML string. -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(File) — the File where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the File.
-
-
Signature:
void toXml(OutputStream output) throws UncheckedIOException - Summary: Converts the entire Dataset into an XML string and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export the entire data in the Dataset to an XML format.
-
Parameters:
-
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
- See also: #toXml(int, int, Collection, String, OutputStream)
-
Signature:
void toXml(String rowElementName, OutputStream output) throws UncheckedIOException - Summary: Converts the entire Dataset into an XML string, using the specified row element name, and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export the data in the Dataset to an XML format.
-
Parameters:
-
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
- See also: #toXml(int, int, Collection, String, OutputStream)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, OutputStream output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
- See also: #toXml(int, int, Collection, String, OutputStream)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, String rowElementName, OutputStream output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, using the specified row element name, and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
- See also: #toXml(int, int, Collection, String, OutputStream)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, OutputStream output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included in the XML string. -
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
- See also: #toXml(int, int, Collection, String, OutputStream)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, String rowElementName, OutputStream output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified OutputStream.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the XML string. -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(OutputStream) — the OutputStream where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the OutputStream.
-
-
Signature:
void toXml(Writer output) throws UncheckedIOException - Summary: Writes the entire Dataset as an XML string to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export the entire data in the Dataset to an XML format.
-
Parameters:
-
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
- See also: #toXml(int, int, Collection, String, Writer)
-
Signature:
void toXml(String rowElementName, Writer output) throws IllegalArgumentException, UncheckedIOException - Summary: Writes the entire Dataset as an XML string to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export the entire data in the Dataset to an XML format.
-
Parameters:
-
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
- See also: #toXml(int, int, Collection, String, Writer)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Writer output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string and writes it to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
- See also: #toXml(int, int, Collection, String, Writer)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, String rowElementName, Writer output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string and writes it to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
- See also: #toXml(int, int, Collection, String, Writer)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Writer output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included in the XML string. -
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
- See also: #toXml(int, int, Collection, String, Writer)
-
Signature:
void toXml(int fromRowIndex, int toRowIndex, Collection<String> columnNames, String rowElementName, Writer output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into an XML string, including only the specified columns, and writes it to the specified Writer.
-
Contract:
- <br/> This method is typically used when you need to export a subset of the data in the Dataset to an XML format.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the XML string. -
rowElementName(String) — the name of the XML element that represents a row in the Dataset. -
output(Writer) — the Writer where the XML string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty, or if {@code rowElementName} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs writing to the Writer.
-
toCsv(...) -> String
-
Signature:
String toCsv() - Summary: Converts the entire Dataset into a CSV string.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
- (none)
- Returns: a CSV string representing the entire Dataset.
- See also: #toCsv(int, int, Collection), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
String toCsv(int fromRowIndex, int toRowIndex, Collection<String> columnNames) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Converts a range of rows in the Dataset into a CSV string, including only the specified columns.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the CSV string.
-
- Returns: a CSV string representing the specified range of rows and columns in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
- See also: #toCsv(int, int, Collection), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(File output) throws UncheckedIOException - Summary: Converts the entire Dataset into a CSV string and writes it to a File.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
output(File) — the File where the CSV string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, File), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(int fromRowIndex, int toRowIndex, Collection<String> columnNames, File output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a CSV string, including only the specified columns, and writes it to a File.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the CSV string. -
output(File) — the File where the CSV string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, File), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(OutputStream output) throws UncheckedIOException - Summary: Converts the entire Dataset into a CSV string and writes it to an OutputStream.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
output(OutputStream) — the OutputStream where the CSV string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, OutputStream), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(int fromRowIndex, int toRowIndex, Collection<String> columnNames, OutputStream output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a CSV string, including only the specified columns, and writes it to an OutputStream.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the CSV string. -
output(OutputStream) — the OutputStream where the CSV string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, OutputStream), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(Writer output) throws UncheckedIOException - Summary: Converts the entire Dataset into a CSV string and writes it to a Writer.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
output(Writer) — the Writer where the CSV string will be written.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, Writer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
void toCsv(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Writer output) throws IndexOutOfBoundsException, IllegalArgumentException, UncheckedIOException - Summary: Converts a range of rows in the Dataset into a CSV string, including only the specified columns, and writes it to a Writer.
-
Contract:
- values are quoted with double quotes if the value type is not boolean or number and properly escaped according to CSV format rules.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the names of the columns in the Dataset to be included in the CSV string. -
output(Writer) — the Writer where the CSV string will be written.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty. -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #toCsv(int, int, Collection, Writer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
groupBy(...) -> Dataset
-
Signature:
Dataset groupBy(String keyColumnName, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on another column.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on a column's values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. Must not be {@code null} . -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. Must not be {@code null} . -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnName} , {@code aggregateOnColumnName} , {@code aggregateResultColumnName} , or {@code collector} is {@code null} .
-
- See also: #groupBy(Collection), #groupBy(String, Collection, String, Collector), #rollup(Collection), #cube(Collection), #pivot(String, String, String, Collector), java.util.stream.Collectors
-
Signature:
Dataset groupBy(String keyColumnName, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the class type of the row in the resulting Dataset. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset with the grouped and aggregated data - list of type {@code rowType} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(String keyColumnName, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
<T> Dataset groupBy(String keyColumnName, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — a function that transforms the aggregated rows into a specific type {@code T} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(String keyColumnName, Function<?, ?> keyExtractor, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on a specific column.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on a column's values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
keyExtractor(Function<?, ?>) — a function that transforms the key column values. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(String keyColumnName, Function<?, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
keyExtractor(Function<?, ?>) — a function that transforms the key column values. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the class type of the row in the resulting Dataset. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset with the grouped and aggregated data - list of type {@code rowType} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(String keyColumnName, Function<?, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. -
keyExtractor(Function<?, ?>) — a function that transforms the key column values. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Function, Collection, String, Function, Collector)
-
Signature:
<T> Dataset groupBy(String keyColumnName, Function<?, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by a specified key column and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by another column's values.
-
Parameters:
-
keyColumnName(String) — the name of the column to group by. Must not be {@code null} . -
keyExtractor(Function<?, ?>) — a function that transforms the key column values before grouping. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — a function that transforms the aggregated rows into a specific type {@code T} . Must not be {@code null} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnName} , {@code keyExtractor} , {@code aggregateOnColumnNames} , {@code aggregateResultColumnName} , {@code rowMapper} , or {@code collector} is {@code null} , or if {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(String, String, String, Collector), #groupBy(String, Collection, String, Collector), #rollup(Collection), #cube(Collection), #pivot(String, String, String, Collector), java.util.stream.Collectors, <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns.
-
Contract:
- <br/> This method is typically used when you need to categorize data based on multiple column values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. Must not be {@code null} or empty.
-
- Returns: a new Dataset containing only the specified key columns with unique combinations of their values.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or if {@code keyColumnNames} is {@code null} or empty.
-
- See also: #groupBy(String, String, String, Collector), #groupBy(String, Collection, String, Collector), #groupBy(Collection, String, String, Collector), #rollup(Collection), #cube(Collection), #pivot(String, String, String, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on a specific column.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on a column's values, grouped by other column's values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the class type of the new column that will store the result of the aggregate operation. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset with the grouped and aggregated data - list of type {@code rowType} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
<T> Dataset groupBy(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — the function to transform the rows into a new format. -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns.
-
Contract:
- <br/> This method is typically used when you need to group data by a complex key composed of multiple columns or computed values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to generate the key for grouping. It takes an array of objects (the row) and returns a key object.
-
- Returns: a new Dataset with the grouped data.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on a specific column.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on a column's values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to generate the key for grouping. It takes an array of objects (the row) and returns a key object. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on specific columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to generate the key for grouping. It takes an array of objects (the row) and returns a key object. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the class of the row type. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset with the grouped and aggregated data - list of type {@code rowType} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
Dataset groupBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on specific columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to generate the key for grouping. It takes an array of objects (the row) and returns a key object. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation.
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(Collection, Function, Collection, String, Function, Collector)
-
Signature:
<T> Dataset groupBy(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Groups the rows in the Dataset by the specified key columns and applies an aggregate operation on multiple columns.
-
Contract:
- <br/> This method is typically used when you need to perform operations such as sum, average, count, etc., on multiple columns' values, grouped by other columns' values.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns to group by. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — a function that transforms the key column values before grouping. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — a function that transforms the aggregated rows into a specific type {@code T} . Must not be {@code null} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a new Dataset with the grouped and aggregated data - collected by the specified {@code collector} .
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset, or if {@code keyColumnNames} , {@code keyExtractor} , {@code aggregateOnColumnNames} , {@code aggregateResultColumnName} , {@code rowMapper} , or {@code collector} is {@code null} , or if {@code keyColumnNames} or {@code aggregateOnColumnNames} is empty.
-
- See also: #groupBy(Collection), #groupBy(String, String, String, Collector), #groupBy(Collection, String, String, Collector), #groupBy(Collection, Function, String, String, Collector), #rollup(Collection), #cube(Collection), #pivot(String, String, String, Collector), java.util.stream.Collectors, <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
rollup(...) -> Stream<Dataset>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty.
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty.
-
- See also: #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with aggregation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. Must not be {@code null} . -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or if {@code aggregateOnColumnName} , {@code aggregateResultColumnName} , or {@code collector} is {@code null} .
-
- See also: #rollup(Collection), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with aggregation on multiple columns.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowType(Class<?>) — the class of the row type. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code aggregateResultColumnName} or {@code rowType} is {@code null} , or if the specified {@code rowType} is not a supported type.
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with aggregation on multiple columns.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code aggregateResultColumnName} or {@code collector} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta <T> Stream<Dataset> rollup(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with aggregation on multiple columns using a custom row mapper.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — the function to transform the DisposableObjArray to a custom type T. Must not be {@code null} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code aggregateResultColumnName} , {@code rowMapper} , or {@code collector} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #rollup(Collection, Collection, String, Collector), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with a custom key extractor function.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping purposes. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or if {@code keyExtractor} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #rollup(Collection, Collection, String, Collector), #rollup(Collection, Collection, String, Function, Collector), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with a key extractor function and aggregation on a single column.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping purposes. Must not be {@code null} . -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. Must not be {@code null} . -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
collector(Collector<?, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or if {@code keyExtractor} , {@code aggregateOnColumnName} , {@code aggregateResultColumnName} , or {@code collector} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #rollup(Collection, Collection, String, Collector), #rollup(Collection, Collection, String, Function, Collector), #rollup(Collection, Function), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with a key extractor function and aggregation on multiple columns.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping purposes. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowType(Class<?>) — the class of the row type that defines the aggregate operation. It must be one of the supported types - Object\[\], Collection, Map, or Bean class. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code keyExtractor} , {@code aggregateResultColumnName} , or {@code rowType} is {@code null} , or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #rollup(Collection, Collection, String, Collector), #rollup(Collection, Collection, String, Function, Collector), #rollup(Collection, Function), #rollup(Collection, Function, String, String, Collector), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> rollup(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns with a key extractor function and aggregation on multiple columns with a custom collector.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping purposes. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
collector(Collector<? super Object[], ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code keyExtractor} , {@code aggregateResultColumnName} , or {@code collector} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, String, String, Collector), #rollup(Collection, Collection, String, Class), #rollup(Collection, Collection, String, Collector), #rollup(Collection, Collection, String, Function, Collector), #rollup(Collection, Function), #rollup(Collection, Function, String, String, Collector), #rollup(Collection, Function, Collection, String, Class), #groupBy(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta <T> Stream<Dataset> rollup(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a rollup operation on the Dataset using the specified columns, custom key extractor, row mapper function, and a collector for aggregate operations.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the rollup operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — the function to transform the DisposableObjArray to a custom row before aggregation. Must not be {@code null} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the rollup operation, from most detailed to grand total.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code keyExtractor} , {@code rowMapper} , {@code collector} , or {@code aggregateResultColumnName} is {@code null} .
-
- See also: #rollup(Collection), #rollup(Collection, Function), #groupBy(Collection, Function), #cube(Collection), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
cube(...) -> Stream<Dataset>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. Must not be {@code null} or empty.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation, covering all possible combinations of the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty.
-
- See also: #rollup(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns and an aggregate operation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<?, ?, ?>) — the collector defining the aggregate operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns and an aggregate operation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the Class defining the type of the new column. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns and an aggregate operation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector defining the aggregate operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta <T> Stream<Dataset> cube(Collection<String> keyColumnNames, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns and an aggregate operation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — the function to transform the DisposableObjArray to a type T before the aggregation operation. -
collector(Collector<? super T, ?, ?>) — the collector defining the aggregate operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns and a key mapper function.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a key before the cube operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, String aggregateOnColumnName, String aggregateResultColumnName, Collector<?, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns, a key mapper function, and an aggregate operation.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a key before the cube operation. -
aggregateOnColumnName(String) — the name of the column on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<?, ?, ?>) — the collector defining the aggregate operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Class<?> rowType) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns, a key mapper function, and a row type.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a key before the cube operation. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
rowType(Class<?>) — the class of the rows in the resulting Dataset. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty, or if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta Stream<Dataset> cube(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Collector<? super Object[], ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns, a key mapper function, and a collector.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a key before the cube operation. -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. -
collector(Collector<? super Object[], ?, ?>) — the collector defining the aggregate operation.
-
- Returns: a Stream of Datasets, each representing a level of the cube operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is empty or {@code aggregateOnColumnNames} is empty.
-
- See also: #cube(Collection), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
-
Signature:
@Beta <T> Stream<Dataset> cube(Collection<String> keyColumnNames, Function<? super DisposableObjArray, ?> keyExtractor, Collection<String> aggregateOnColumnNames, String aggregateResultColumnName, Function<? super DisposableObjArray, ? extends T> rowMapper, Collector<? super T, ?, ?> collector) throws IllegalArgumentException - Summary: Performs a cube operation on the Dataset using the specified columns with a key extractor function, row mapper function, and aggregation on multiple columns with a custom collector.
-
Parameters:
-
keyColumnNames(Collection<String>) — the names of the columns on which the cube operation is to be performed. Must not be {@code null} or empty. -
keyExtractor(Function<? super DisposableObjArray, ?>) — the function to transform the DisposableObjArray to a custom key for grouping purposes. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
aggregateResultColumnName(String) — the name of the new column that will store the result of the aggregate operation. Must not be {@code null} . -
rowMapper(Function<? super DisposableObjArray, ? extends T>) — the function to transform the DisposableObjArray to a mapped object before applying the collector. Must not be {@code null} . -
collector(Collector<? super T, ?, ?>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Stream of Datasets, each representing a level of the cube operation, covering all possible combinations of the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code keyColumnNames} is {@code null} or empty, or {@code aggregateOnColumnNames} is {@code null} or empty, or if {@code keyExtractor} , {@code aggregateResultColumnName} , {@code rowMapper} , or {@code collector} is {@code null} .
-
- See also: #rollup(Collection, Function, Collection, String, Function, Collector), #cube(Collection, Function, Collection, String, Function, Collector), <a href="https://stackoverflow.com/questions/37975227">,What is the difference between cube, rollup and groupBy operators?,</a>
pivot(...) -> Sheet<R, C, T>
-
Signature:
@Beta <R, C, T> Sheet<R, C, T> pivot(String keyColumnName, String pivotColumnName, String aggregateOnColumnNames, Collector<?, ?, ? extends T> collector) throws IllegalArgumentException - Summary: Performs a pivot operation on the Dataset using the specified key column, aggregate column, pivot column, and a collector.
-
Parameters:
-
keyColumnName(String) — the name of the column to be used as the row identifier in the resulting Sheet. Must not be {@code null} . -
pivotColumnName(String) — the name of the column to be used as the column identifier in the resulting Sheet. Must not be {@code null} . -
aggregateOnColumnNames(String) — the name of the column on which the aggregate operation is to be performed. Must not be {@code null} . -
collector(Collector<?, ?, ? extends T>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Sheet representing the result of the pivot operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnName} , {@code aggregateOnColumnNames} , {@code pivotColumnName} , or {@code collector} is {@code null} .
-
- See also: #groupBy(Collection), #rollup(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/34702815">,Difference between groupby and pivot_table for pandas dataframes,</a>
-
Signature:
@Beta <R, C, T> Sheet<R, C, T> pivot(String keyColumnName, String pivotColumnName, Collection<String> aggregateOnColumnNames, Collector<? super Object[], ?, ? extends T> collector) throws IllegalArgumentException - Summary: Performs a pivot operation on the Dataset using the specified key column, aggregate columns, pivot column, and a collector.
-
Parameters:
-
keyColumnName(String) — the name of the column to be used as the row identifier in the resulting Sheet. Must not be {@code null} . -
pivotColumnName(String) — the name of the column to be used as the column identifier in the resulting Sheet. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
collector(Collector<? super Object[], ?, ? extends T>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Sheet representing the result of the pivot operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnName} , {@code aggregateOnColumnNames} , {@code pivotColumnName} , or {@code collector} is {@code null} , or if {@code aggregateOnColumnNames} is empty.
-
- See also: #pivot(String, String, String, Collector), #groupBy(Collection), #rollup(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/34702815">,Difference between groupby and pivot_table for pandas dataframes,</a>
-
Signature:
@Beta <R, C, U, T> Sheet<R, C, T> pivot(String keyColumnName, String pivotColumnName, Collection<String> aggregateOnColumnNames, Function<? super DisposableObjArray, ? extends U> rowMapper, Collector<? super U, ?, ? extends T> collector) throws IllegalArgumentException - Summary: Performs a pivot operation on the Dataset using the specified key column, aggregate columns, pivot column, a row mapper, and a collector.
-
Parameters:
-
keyColumnName(String) — the name of the column to be used as the row identifier in the resulting Sheet. Must not be {@code null} . -
pivotColumnName(String) — the name of the column to be used as the column identifier in the resulting Sheet. Must not be {@code null} . -
aggregateOnColumnNames(Collection<String>) — the names of the columns on which the aggregate operation is to be performed. Must not be {@code null} or empty. -
rowMapper(Function<? super DisposableObjArray, ? extends U>) — the function to transform the row data before aggregation. Must not be {@code null} . -
collector(Collector<? super U, ?, ? extends T>) — the collector that defines the aggregate operation. Must not be {@code null} .
-
- Returns: a Sheet representing the result of the pivot operation.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or if {@code keyColumnName} , {@code aggregateOnColumnNames} , {@code pivotColumnName} , {@code rowMapper} , or {@code collector} is {@code null} , or if {@code aggregateOnColumnNames} is empty.
-
- See also: #pivot(String, String, String, Collector), #pivot(String, String, Collection, Collector), #groupBy(Collection), #rollup(Collection), #cube(Collection), <a href="https://stackoverflow.com/questions/34702815">,Difference between groupby and pivot_table for pandas dataframes,</a>
sortBy(...) -> void
-
Signature:
void sortBy(String columnName) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset based on the specified column name.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
-
Signature:
void sortBy(String columnName, Comparator<?> cmp) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset based on the specified column name using the provided Comparator.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting. -
cmp(Comparator<?>) — the Comparator to determine the order of the elements.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
-
Signature:
void sortBy(Collection<String> columnNames) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset based on the specified collection of column names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
-
Signature:
void sortBy(Collection<String> columnNames, Comparator<? super Object[]> cmp) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset based on the specified collection of column names using the provided Comparator.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be used for sorting. -
cmp(Comparator<? super Object[]>) — the Comparator to determine the order of the elements. It compares Object arrays, each representing a row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
-
Signature:
@SuppressWarnings("rawtypes") void sortBy(Collection<String> columnNames, Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset based on the specified column names and a key mapper function.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for sorting. The order of the column names determines the order of the elements in the DisposableObjArray passed to the key mapper function. -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>) — a function that takes a DisposableObjArray representing a row of the Dataset and returns a Comparable object that is used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
parallelSortBy(...) -> void
-
Signature:
void parallelSortBy(String columnName) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset with multi-threads based on the specified column name.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
-
Signature:
void parallelSortBy(String columnName, Comparator<?> cmp) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset with multi-threads based on the specified column name using the provided Comparator.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting. -
cmp(Comparator<?>) — the Comparator to determine the order of the elements.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset.
-
-
Signature:
void parallelSortBy(Collection<String> columnNames) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset with multi-threads based on the specified collection of column names.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
-
Signature:
void parallelSortBy(Collection<String> columnNames, Comparator<? super Object[]> cmp) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset with multi-threads based on the specified collection of column names using the provided Comparator.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be used for sorting. -
cmp(Comparator<? super Object[]>) — the Comparator to determine the order of the elements. It compares Object arrays, each representing a row.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
-
Signature:
@SuppressWarnings("rawtypes") void parallelSortBy(Collection<String> columnNames, Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) throws IllegalStateException, IllegalArgumentException - Summary: Sorts the Dataset with multi-threads based on the specified column names and a key mapper function.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for sorting. The order of the column names determines the order of the elements in the DisposableObjArray passed to the key mapper function. -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>) — a function that takes a DisposableObjArray representing a row of the Dataset and returns a Comparable object that is used for sorting.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen (read-only). -
java.lang.IllegalArgumentException— if any of the specified column names does not exist in the Dataset or {@code columnNames} is empty.
-
topBy(...) -> Dataset
-
Signature:
Dataset topBy(String columnName, int n) throws IllegalArgumentException - Summary: Returns the top <i> n </i> rows from the Dataset based on the values in the specified column.
-
Contract:
- If two rows have the same value in the specified column, their order is determined by their original order in the Dataset.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting. -
n(int) — the number of top rows to return.
-
- Returns: a new Dataset containing the top <i> n </i> rows.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset or <i> n </i> is less than 1.
-
-
Signature:
Dataset topBy(String columnName, int n, Comparator<?> cmp) throws IllegalArgumentException - Summary: Returns the top <i> n </i> rows from the Dataset based on the values in the specified column.
-
Contract:
- If two rows have the same value in the specified column, their order is determined by the Comparator.
-
Parameters:
-
columnName(String) — the name of the column to be used for sorting. -
n(int) — the number of top rows to return. -
cmp(Comparator<?>) — the Comparator to determine the order of the elements.
-
- Returns: a new Dataset containing the top <i> n </i> rows.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name does not exist in the Dataset or <i> n </i> is less than 1.
-
-
Signature:
Dataset topBy(Collection<String> columnNames, int n) throws IllegalArgumentException - Summary: Returns the top <i> n </i> rows from the Dataset based on the values in the specified columns.
-
Contract:
- If two rows have the same values in the specified columns, their order is determined by their original order in the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for sorting. -
n(int) — the number of top rows to return.
-
- Returns: a new Dataset containing the top <i> n </i> rows.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names do not exist in the Dataset or {@code columnNames} is empty or <i> n </i> is less than 1.
-
-
Signature:
Dataset topBy(Collection<String> columnNames, int n, Comparator<? super Object[]> cmp) throws IllegalArgumentException - Summary: Returns the top <i> n </i> rows from the Dataset based on the values in the specified columns.
-
Contract:
- If two rows have the same values in the specified columns, their order is determined by the Comparator.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for sorting. -
n(int) — the number of top rows to return. -
cmp(Comparator<? super Object[]>) — the Comparator to determine the order of the elements. It compares Object arrays, each representing a row.
-
- Returns: a new Dataset containing the top <i> n </i> rows.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names do not exist in the Dataset or {@code columnNames} is empty or <i> n </i> is less than 1.
-
-
Signature:
@SuppressWarnings("rawtypes") Dataset topBy(Collection<String> columnNames, int n, Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) - Summary: Returns the top <i> n </i> rows from the Dataset based on the values in the specified columns.
-
Contract:
- If two rows have the same value in the specified columns, their order is determined by the keyExtractor function.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for sorting. -
n(int) — the number of top rows to return. -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>) — the function to determine the order of the elements. It takes an array of Objects, each representing a row, and returns a Comparable.
-
- Returns: a new Dataset containing the top <i> n </i> rows.
distinct(...) -> Dataset
-
Signature:
@Beta Dataset distinct() - Summary: Returns a new Dataset containing only the distinct rows from the original Dataset.
-
Parameters:
- (none)
- Returns: a new Dataset containing only distinct rows.
- See also: #distinctBy(String), #distinctBy(Collection), #removeDuplicateRowsBy(String), #removeDuplicateRowsBy(Collection)
distinctBy(...) -> Dataset
-
Signature:
Dataset distinctBy(String columnName) - Summary: Returns a new Dataset containing only the distinct rows based on the specified column from the original Dataset.
-
Parameters:
-
columnName(String) — the name of the column to be used for determining distinctness.
-
- Returns: a new Dataset containing only distinct rows based on the specified column.
- See also: #removeDuplicateRowsBy(String), #removeDuplicateRowsBy(Collection)
-
Signature:
Dataset distinctBy(String columnName, Function<?, ?> keyExtractor) - Summary: Returns a new Dataset containing only the distinct rows based on the specified column from the original Dataset.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Dataset employees = Dataset.rows(Arrays.asList("name", "email"), new Object\[\]\[\] { {"alice", "ALICE@example.com"}, {"bob", "bob@example.com"}, {"Alice", "alice@example.com"} }); // Get distinct rows by email, case-insensitive Dataset uniqueEmails = employees.distinctBy("email", (String email) -> email.toLowerCase()); // Result: two rows (alice@example.com appears twice but is treated as one when lowercased) } </pre>
-
Parameters:
-
columnName(String) — the name of the column to be used for determining distinctness. -
keyExtractor(Function<?, ?>) — a function to process the column values before determining distinctness.
-
- Returns: a new Dataset containing only distinct rows based on the specified column and keyExtractor function.
- See also: #removeDuplicateRowsBy(String, Function), #removeDuplicateRowsBy(Collection, Function)
-
Signature:
Dataset distinctBy(Collection<String> columnNames) - Summary: Returns a new Dataset containing only the distinct rows based on the specified columns from the original Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for determining distinctness.
-
- Returns: a new Dataset containing only distinct rows based on the specified columns.
- See also: #distinctBy(Collection, Function), #removeDuplicateRowsBy(Collection), #removeDuplicateRowsBy(Collection, Function)
-
Signature:
Dataset distinctBy(Collection<String> columnNames, Function<? super DisposableObjArray, ?> keyExtractor) - Summary: Returns a new Dataset containing only the distinct rows based on the specified columns from the original Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the names of the columns to be used for determining distinctness. -
keyExtractor(Function<? super DisposableObjArray, ?>) — a function to process the column values before determining distinctness.
-
- Returns: a new Dataset containing only distinct rows based on the specified columns and keyExtractor function.
- See also: #removeDuplicateRowsBy(String, Function), #removeDuplicateRowsBy(Collection, Function)
filter(...) -> Dataset
-
Signature:
Dataset filter(Predicate<? super DisposableObjArray> filter) - Summary: Filters the rows of the Dataset based on the provided predicate.
-
Parameters:
-
filter(Predicate<? super DisposableObjArray>) — the predicate to apply to each row. It takes an instance of DisposableObjArray, which represents a row in the Dataset.
-
- Returns: a new Dataset containing only the rows that satisfy the provided predicate.
-
Signature:
Dataset filter(Predicate<? super DisposableObjArray> filter, int max) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided predicate and limits the number of results.
-
Parameters:
-
filter(Predicate<? super DisposableObjArray>) — the predicate to apply to each row. It takes an instance of DisposableObjArray, which represents a row in the Dataset. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows that satisfy the provided predicate, up to the specified maximum limit.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified max is less than 0.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Predicate<? super DisposableObjArray> filter) throws IndexOutOfBoundsException - Summary: Filters the rows of the Dataset based on the provided predicate and within the specified row index range.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
filter(Predicate<? super DisposableObjArray>) — the predicate to apply to each row within the specified range. It takes an instance of DisposableObjArray, which represents a row in the Dataset.
-
- Returns: a new Dataset containing only the rows within the specified range that satisfy the provided predicate.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Predicate<? super DisposableObjArray> filter, int max) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided predicate, within the specified row index range, and limits the number of results.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
filter(Predicate<? super DisposableObjArray>) — the predicate to apply to each row within the specified range. It takes an instance of DisposableObjArray, which represents a row in the Dataset. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows within the specified range that satisfy the provided predicate, up to the specified maximum limit.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if the specified max is less than 0.
-
-
Signature:
Dataset filter(Tuple2<String, String> columnNames, BiPredicate<?, ?> filter) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided BiPredicate and the specified column names.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used in the BiPredicate. -
filter(BiPredicate<?, ?>) — the BiPredicate to apply to each pair of values from the specified columns. It takes two instances of Objects, which represent the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset containing only the rows where the provided BiPredicate returns {@code true} for the pair of values from the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset filter(Tuple2<String, String> columnNames, BiPredicate<?, ?> filter, int max) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided BiPredicate and the specified column names, and limits the number of results.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used in the BiPredicate. -
filter(BiPredicate<?, ?>) — the BiPredicate to apply to each pair of values from the specified columns. It takes two instances of Objects, which represent the values in the Dataset's row for the specified columns. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided BiPredicate returns {@code true} for the pair of values from the specified columns, up to the specified maximum limit.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Tuple2<String, String> columnNames, BiPredicate<?, ?> filter) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided BiPredicate and the specified column names, within the given row index range.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used in the BiPredicate. -
filter(BiPredicate<?, ?>) — the BiPredicate to apply to each pair of values from the specified columns. It takes two instances of Objects, which represent the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset containing only the rows where the provided BiPredicate returns {@code true} for the pair of values from the specified columns, within the specified row index range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Tuple2<String, String> columnNames, BiPredicate<?, ?> filter, int max) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided BiPredicate and the specified column names, within the given row index range and limits the number of results.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used in the BiPredicate. -
filter(BiPredicate<?, ?>) — the BiPredicate to apply to each pair of values from the specified columns. It takes two instances of Objects, which represent the values in the Dataset's row for the specified columns. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided BiPredicate returns {@code true} for the pair of values from the specified columns, within the specified row index range and up to the specified maximum limit.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(Tuple3<String, String, String> columnNames, TriPredicate<?, ?, ?> filter) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided TriPredicate and the specified column names.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three columns to be used in the TriPredicate. -
filter(TriPredicate<?, ?, ?>) — the TriPredicate to apply to each triplet of values from the specified columns. It takes three instances of Objects, which represent the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset containing only the rows where the provided TriPredicate returns {@code true} for the triplet of values from the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset filter(Tuple3<String, String, String> columnNames, TriPredicate<?, ?, ?> filter, int max) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided TriPredicate and the specified column names, within a limit.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three columns to be used in the TriPredicate. -
filter(TriPredicate<?, ?, ?>) — the TriPredicate to apply to each triplet of values from the specified columns. It takes three instances of Objects, which represent the values in the Dataset's row for the specified columns. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided TriPredicate returns {@code true} for the triplet of values from the specified columns, up to the specified maximum limit.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Tuple3<String, String, String> columnNames, TriPredicate<?, ?, ?> filter) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided TriPredicate and the specified column names, within a specified row index range.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three columns to be used in the TriPredicate. -
filter(TriPredicate<?, ?, ?>) — the TriPredicate to apply to each triplet of values from the specified columns. It takes three instances of Objects, which represent the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset containing only the rows where the provided TriPredicate returns {@code true} for the triplet of values from the specified columns, within the specified row index range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Tuple3<String, String, String> columnNames, TriPredicate<?, ?, ?> filter, int max) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided TriPredicate and the specified column names, within a specified row index range and a maximum limit.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple3<String, String, String>) — a Tuple3 containing the names of the three columns to be used in the TriPredicate. -
filter(TriPredicate<?, ?, ?>) — the TriPredicate to apply to each triplet of values from the specified columns. It takes three instances of Objects, which represent the values in the Dataset's row for the specified columns. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided TriPredicate returns {@code true} for the triplet of values from the specified columns, within the specified row index range and up to the specified maximum limit.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(String columnName, Predicate<?> filter) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided Predicate and the specified column name.
-
Parameters:
-
columnName(String) — the name of the column to be used in the Predicate. -
filter(Predicate<?>) — the Predicate to apply to each value from the specified column. It takes an instance of Object, which represents the value in the Dataset's row for the specified column.
-
- Returns: a new Dataset containing only the rows where the provided Predicate returns {@code true} for the value from the specified column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
-
Signature:
Dataset filter(String columnName, Predicate<?> filter, int max) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided Predicate and the specified column name, with a maximum limit.
-
Parameters:
-
columnName(String) — the name of the column to be used in the Predicate. -
filter(Predicate<?>) — the Predicate to apply to each value from the specified column. It takes an instance of Object, which represents the value in the Dataset's row for the specified column. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided Predicate returns {@code true} for the value from the specified column, up to the specified maximum limit.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, String columnName, Predicate<?> filter) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided Predicate and the specified column name, within a given row index range.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnName(String) — the name of the column to be used in the Predicate. -
filter(Predicate<?>) — the Predicate to apply to each value from the specified column. It takes an instance of Object, which represents the value in the Dataset's row for the specified column.
-
- Returns: a new Dataset containing only the rows within the specified range where the provided Predicate returns {@code true} for the value from the specified column.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, String columnName, Predicate<?> filter, int max) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided predicate function.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnName(String) — the name of the column whose values will be used as input for the predicate function. -
filter(Predicate<?>) — the predicate function to apply to each row of the specified column. It takes an instance of the column's value type and returns a boolean. -
max(int) — the maximum number of rows to include in the resulting Dataset.
-
- Returns: a new Dataset containing only the rows that satisfy the predicate, up to the specified maximum limit.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset or if the specified max is less than 0.
-
-
Signature:
Dataset filter(Collection<String> columnNames, Predicate<? super DisposableObjArray> filter) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided predicate function.
-
Parameters:
-
columnNames(Collection<String>) — a collection of column names whose values will be used as input for the predicate function. -
filter(Predicate<? super DisposableObjArray>) — the predicate function to apply to each row of the specified columns. It takes an instance of DisposableObjArray (which represents the values of the specified columns in a row) and returns a boolean.
-
- Returns: a new Dataset containing only the rows that satisfy the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code columnNames} is empty.
-
-
Signature:
Dataset filter(Collection<String> columnNames, Predicate<? super DisposableObjArray> filter, int max) throws IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided predicate function.
-
Parameters:
-
columnNames(Collection<String>) — a collection of column names whose values will be used as input for the predicate function. -
filter(Predicate<? super DisposableObjArray>) — the predicate function to apply to each row of the specified columns. It takes an instance of DisposableObjArray (which represents the values of the specified columns in a row) and returns a boolean. -
max(int) — the maximum number of rows to include in the resulting Dataset.
-
- Returns: a new Dataset containing only the rows that satisfy the predicate, up to the specified maximum limit.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code columnNames} is empty or if the specified max is less than 0.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Predicate<? super DisposableObjArray> filter) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on a provided predicate function.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — a collection of column names whose values will be used as input for the predicate function. -
filter(Predicate<? super DisposableObjArray>) — the predicate function to apply to each row of the specified columns. It takes an instance of DisposableObjArray (which represents the values of the specified columns in a row) and returns a boolean.
-
- Returns: a new Dataset containing only the rows that satisfy the predicate.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code columnNames} is empty.
-
-
Signature:
Dataset filter(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Predicate<? super DisposableObjArray> filter, int max) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Filters the rows of the Dataset based on the provided Predicate and the specified column names, within the given row index range and limits the number of results.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — a Collection containing the names of the columns to be used in the Predicate. -
filter(Predicate<? super DisposableObjArray>) — the Predicate to apply to each DisposableObjArray from the specified columns. It takes an instance of DisposableObjArray, which represents the values in the Dataset's row for the specified columns. -
max(int) — the maximum number of rows to include in the returned Dataset.
-
- Returns: a new Dataset containing only the rows where the provided Predicate returns {@code true} for the DisposableObjArray from the specified columns, within the specified row index range and up to the specified maximum limit.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromRowIndex} or {@code toRowIndex} is out of the range of the Dataset. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code columnNames} is empty or if the specified max is less than 0.
-
mapColumn(...) -> Dataset
-
Signature:
Dataset mapColumn(String fromColumnName, String newColumnName, String copyingColumnName, Function<?, ?> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified column and creating a new column with the results.
-
Parameters:
-
fromColumnName(String) — the name of the column to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnName(String) — the name of the column to be copied to the new Dataset. -
mapper(Function<?, ?>) — the mapping function to apply to each row of the specified column. It takes an instance of the column's value and returns a new value.
-
- Returns: a new Dataset with the new column added and the specified column copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset mapColumn(String fromColumnName, String newColumnName, Collection<String> copyingColumnNames, Function<?, ?> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified column and creating a new column with the results.
-
Parameters:
-
fromColumnName(String) — the name of the column to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(Function<?, ?>) — the mapping function to apply to each row of the specified column. It takes an instance of the column's value and returns a new value.
-
- Returns: a new Dataset with the new column added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
mapColumns(...) -> Dataset
-
Signature:
Dataset mapColumns(Tuple2<String, String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, BiFunction<?, ?, ?> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified pair of columns and creating a new column with the results.
-
Parameters:
-
fromColumnNames(Tuple2<String, String>) — a Tuple2 containing the pair of column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(BiFunction<?, ?, ?>) — the mapping function to apply to each row of the specified columns. It takes instances of the columns' values and returns a new value.
-
- Returns: a new Dataset with the new column added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset mapColumns(Tuple3<String, String, String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, TriFunction<?, ?, ?, ?> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified columns and creating a new column with the results.
-
Parameters:
-
fromColumnNames(Tuple3<String, String, String>) — a Tuple3 containing the column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(TriFunction<?, ?, ?, ?>) — the mapping function to apply to each row of the specified columns. It takes instances of the columns' values and returns a new value.
-
- Returns: a new Dataset with the new column added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset mapColumns(Collection<String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, Function<? super DisposableObjArray, ?> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified columns and creating a new column with the results.
-
Parameters:
-
fromColumnNames(Collection<String>) — a collection of column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(Function<? super DisposableObjArray, ?>) — the mapping function to apply to each row of the specified columns. It takes an instance of DisposableObjArray, which represents the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset with the new column added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code fromColumnNames} is empty.
-
flatMapColumn(...) -> Dataset
-
Signature:
Dataset flatMapColumn(String fromColumnName, String newColumnName, String copyingColumnName, Function<?, ? extends Collection<?>> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified column and creating new rows with the results.
-
Parameters:
-
fromColumnName(String) — the column name to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnName(String) — the column name to be copied to the new Dataset. -
mapper(Function<?, ? extends Collection<?>>) — the mapping function to apply to each row of the specified column. It takes an instance of the column's value and returns a Collection of new rows.
-
- Returns: a new Dataset with the new rows added and the specified column copied.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
-
Signature:
Dataset flatMapColumn(String fromColumnName, String newColumnName, Collection<String> copyingColumnNames, Function<?, ? extends Collection<?>> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified column and creating new rows with the results.
-
Parameters:
-
fromColumnName(String) — the column name to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(Function<?, ? extends Collection<?>>) — the mapping function to apply to each row of the specified column. It takes an instance of the column's value and returns a Collection of new rows.
-
- Returns: a new Dataset with the new rows added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
flatMapColumns(...) -> Dataset
-
Signature:
Dataset flatMapColumns(Tuple2<String, String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, BiFunction<?, ?, ? extends Collection<?>> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified pair of columns and creating new rows with the results.
-
Parameters:
-
fromColumnNames(Tuple2<String, String>) — a tuple of two column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(BiFunction<?, ?, ? extends Collection<?>>) — the mapper that turns each input row into a dataset whose rows are concatenated
-
- Returns: a new Dataset with the new rows added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset flatMapColumns(Tuple3<String, String, String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, TriFunction<?, ?, ?, ? extends Collection<?>> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified columns and creating new rows with the results.
-
Parameters:
-
fromColumnNames(Tuple3<String, String, String>) — a tuple of three column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(TriFunction<?, ?, ?, ? extends Collection<?>>) — the mapping function to apply to each row of the specified columns. It takes an instance of DisposableObjArray, which represents the values in the Dataset's row for the specified columns, and returns a Collection of new rows.
-
- Returns: a new Dataset with the new rows added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
Dataset flatMapColumns(Collection<String> fromColumnNames, String newColumnName, Collection<String> copyingColumnNames, Function<? super DisposableObjArray, ? extends Collection<?>> mapper) throws IllegalArgumentException - Summary: Transforms the Dataset by applying a mapping function to the specified columns and creating a new column with the results.
-
Parameters:
-
fromColumnNames(Collection<String>) — a collection of column names to be used as input for the mapping function. -
newColumnName(String) — the name of the new column that will store the results of the mapping function. -
copyingColumnNames(Collection<String>) — a collection of column names to be copied to the new Dataset. -
mapper(Function<? super DisposableObjArray, ? extends Collection<?>>) — the mapping function to apply to each row of the specified columns. It takes an instance of DisposableObjArray, which represents the values in the Dataset's row for the specified columns.
-
- Returns: a new Dataset with the new column added and the specified columns copied.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset or {@code fromColumnNames} is empty.
-
innerJoin(...) -> Dataset
-
Signature:
Dataset innerJoin(Dataset right, String columnName, String joinColumnNameOnRight) throws IllegalArgumentException - Summary: Performs an inner join operation between this Dataset and another Dataset based on the specified column names.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
columnName(String) — the name of the column in this Dataset to use for the join. -
joinColumnNameOnRight(String) — the name of the column in the other Dataset to use for the join.
-
- Returns: a new Dataset that is the result of the inner join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} .
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset innerJoin(Dataset right, Map<String, String> onColumnNames) - Summary: Performs an inner join operation between this Dataset and another Dataset based on the specified column names.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset and the value is the corresponding column name in the other Dataset.
-
- Returns: a new Dataset that is the result of the inner join operation.
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset innerJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType) throws IllegalArgumentException - Summary: Performs an inner join operation between this Dataset and another Dataset based on the specified column names.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset and the value is the corresponding column name in the other Dataset. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset that is the result of the inner join operation, including the new column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SuppressWarnings("rawtypes") Dataset innerJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType, IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException - Summary: Performs an inner join operation between this Dataset and another Dataset based on the specified column names.
-
Parameters:
-
right(Dataset) — the Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset and the value is the column name in the right Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column. It must be Object\[\], Collection, Map, or Bean class. -
collSupplier(IntFunction<? extends Collection>) — a function that generates a collection to hold the joined rows for the new column for one-many or many-many mapping.
-
- Returns: a new Dataset that is the result of the inner join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
leftJoin(...) -> Dataset
-
Signature:
Dataset leftJoin(Dataset right, String columnName, String joinColumnNameOnRight) - Summary: Performs a left join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the right side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
columnName(String) — the column name in this Dataset to join on. -
joinColumnNameOnRight(String) — the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the left join operation.
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset leftJoin(Dataset right, Map<String, String> onColumnNames) - Summary: Performs a left join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the right side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the left join operation.
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset leftJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType) throws IllegalArgumentException - Summary: Performs a left join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the right side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset that is the result of the left join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SuppressWarnings("rawtypes") Dataset leftJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType, IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException - Summary: Performs a left join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the right side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class. -
collSupplier(IntFunction<? extends Collection>) — a function that generates a collection to hold the joined rows for the new column for one-many or many-many mapping.
-
- Returns: a new Dataset that is the result of the left join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
rightJoin(...) -> Dataset
-
Signature:
Dataset rightJoin(Dataset right, String columnName, String joinColumnNameOnRight) throws IllegalArgumentException - Summary: Performs a right join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the left side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
columnName(String) — the column name in this Dataset to join on. -
joinColumnNameOnRight(String) — the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the right join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} .
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset rightJoin(Dataset right, Map<String, String> onColumnNames) throws IllegalArgumentException - Summary: Performs a right join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the left side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the right join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} .
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset rightJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType) throws IllegalArgumentException - Summary: Performs a right join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the left side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset that is the result of the right join operation, with the additional column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SuppressWarnings("rawtypes") Dataset rightJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType, IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException - Summary: Performs a right join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the left side.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class. -
collSupplier(IntFunction<? extends Collection>) — a function that generates a collection to hold the joined rows for the new column for one-many or many-many mapping.
-
- Returns: a new Dataset that is the result of the right join operation, with the additional column.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
fullJoin(...) -> Dataset
-
Signature:
Dataset fullJoin(Dataset right, String columnName, String joinColumnNameOnRight) throws IllegalArgumentException - Summary: Performs a full join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the side of the Dataset that does not have a match.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
columnName(String) — the column name in this Dataset to join on. -
joinColumnNameOnRight(String) — the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the full join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} .
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset fullJoin(Dataset right, Map<String, String> onColumnNames) throws IllegalArgumentException - Summary: Performs a full join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the side of the Dataset that does not have a match.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on.
-
- Returns: a new Dataset that is the result of the full join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} .
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
Dataset fullJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType) throws IllegalArgumentException - Summary: Performs a full join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the side of the Dataset that does not have a match.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class.
-
- Returns: a new Dataset that is the result of the full join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SuppressWarnings("rawtypes") Dataset fullJoin(Dataset right, Map<String, String> onColumnNames, String newColumnName, Class<?> newColumnType, IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException - Summary: Performs a full join operation between this Dataset and another Dataset based on the specified column names.
-
Contract:
- If there is no match, the result is {@code null} on the side of the Dataset that does not have a match.
-
Parameters:
-
right(Dataset) — the other Dataset to join with. -
onColumnNames(Map<String, String>) — a map where the key is the column name in this Dataset to join on, and the value is the column name in the other Dataset to join on. -
newColumnName(String) — the name of the new column to be added to the resulting Dataset. -
newColumnType(Class<?>) — the type of the new column to be added to the resulting Dataset. It must be Object\[\], Collection, Map, or Bean class. -
collSupplier(IntFunction<? extends Collection>) — a function that generates a collection to hold the joined rows for the new column for one-many or many-many mapping.
-
- Returns: a new Dataset that is the result of the full join operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column names are not found in the respective Datasets or the specified {@code right} Dataset is {@code null} , or if the specified {@code newColumnType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
- See also: <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
union(...) -> Dataset
-
Signature:
Dataset union(Dataset other) throws IllegalArgumentException - Summary: Performs a union operation between this Dataset and another Dataset.
-
Parameters:
-
other(Dataset) — the other Dataset to union with
-
- Returns: a new Dataset that is the result of the union operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the Datasets do not have the same column structure
-
- See also: #unionAll(Dataset), #unionAll(Dataset, boolean), #intersect(Dataset), #except(Dataset)
-
Signature:
Dataset union(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a union operation between this Dataset and another Dataset.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as they share at least one common column.
-
Parameters:
-
other(Dataset) — the other Dataset to union with -
requiresSameColumns(boolean) — whether both Datasets must have identical column structures
-
- Returns: a new Dataset that is the result of the union operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have identical column structures
-
- See also: #union(Dataset), #unionAll(Dataset), #unionAll(Dataset, boolean), #intersect(Dataset), #except(Dataset)
-
Signature:
Dataset union(Dataset other, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs a union operation between this Dataset and another Dataset.
-
Parameters:
-
other(Dataset) — the other Dataset to union with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for duplicate detection
-
- Returns: a new Dataset that is the result of the union operation with duplicates eliminated based on key columns
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset
-
- See also: #union(Dataset), #union(Dataset, boolean), #unionAll(Dataset), #intersect(Dataset, Collection), #except(Dataset, Collection)
-
Signature:
Dataset union(Dataset other, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a union operation between this Dataset and another Dataset.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as the specified key columns exist in both.
-
Parameters:
-
other(Dataset) — the other Dataset to union with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for duplicate detection -
requiresSameColumns(boolean) — whether both Datasets must have identical column structures
-
- Returns: a new Dataset that is the result of the union operation with duplicates eliminated based on key columns
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if requiresSameColumns is {@code true} and the Datasets do not have identical column structures, or if any of the specified key column names do not exist in either Dataset
-
- See also: #union(Dataset), #union(Dataset, boolean), #union(Dataset, Collection), #unionAll(Dataset), #intersect(Dataset, Collection), #except(Dataset, Collection)
unionAll(...) -> Dataset
-
Signature:
Dataset unionAll(Dataset other) throws IllegalArgumentException - Summary: Performs a union all operation between this Dataset and another Dataset.
-
Parameters:
-
other(Dataset) — the other Dataset to union with
-
- Returns: a new Dataset that is the result of the union all operation with all rows included
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null}
-
- See also: #union(Dataset), #union(Dataset, boolean), #union(Dataset, Collection), #unionAll(Dataset, boolean), #intersect(Dataset), #except(Dataset), #merge(Dataset)
-
Signature:
Dataset unionAll(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a union all operation between this Dataset and another Dataset with an option to require same columns.
-
Parameters:
-
other(Dataset) — the other Dataset to union with -
requiresSameColumns(boolean) — whether both Datasets must have identical column structures
-
- Returns: a new Dataset that is the result of the union all operation with all rows included
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have identical column structures
-
- See also: #union(Dataset), #union(Dataset, boolean), #union(Dataset, Collection), #unionAll(Dataset), #intersect(Dataset), #except(Dataset), #merge(Dataset, boolean)
intersect(...) -> Dataset
-
Signature:
Dataset intersect(Dataset other) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with
-
- Returns: a new Dataset that is the result of the intersection operation
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null}
-
- See also: #union(Dataset), #except(Dataset)
-
Signature:
Dataset intersect(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as they share at least one common column.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the intersection operation
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #intersect(Dataset), #union(Dataset, boolean), #except(Dataset, boolean)
-
Signature:
Dataset intersect(Dataset other, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset using specified key columns.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for intersection
-
- Returns: a new Dataset that is the result of the intersection operation
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} or if the keyColumnNames is {@code null} or empty
-
- See also: #intersect(Dataset), #union(Dataset, Collection), #except(Dataset, Collection)
-
Signature:
Dataset intersect(Dataset other, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset using specified key columns.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as the specified key columns exist in both.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for intersection -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the intersection operation
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , if the keyColumnNames is {@code null} or empty, or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #intersect(Dataset), #intersect(Dataset, Collection), #union(Dataset, Collection, boolean), #except(Dataset, Collection, boolean)
intersectAll(...) -> Dataset
-
Signature:
Dataset intersectAll(Dataset other) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with
-
- Returns: a new Dataset that is the result of the intersection operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null}
-
- See also: #intersect(Dataset), #unionAll(Dataset), #exceptAll(Dataset)
-
Signature:
Dataset intersectAll(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as they share at least one common column.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the intersection operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #intersectAll(Dataset), #intersect(Dataset, boolean), #unionAll(Dataset, boolean), #exceptAll(Dataset, boolean)
-
Signature:
Dataset intersectAll(Dataset other, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset using specified key columns.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the intersection operation
-
- Returns: a new Dataset that is the result of the intersection operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset
-
- See also: #intersectAll(Dataset), #intersectAll(Dataset, boolean), #intersect(Dataset, Collection), #exceptAll(Dataset, Collection)
-
Signature:
Dataset intersectAll(Dataset other, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs an intersection operation between this Dataset and another Dataset using specified key columns.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as the specified key columns exist in both.
-
Parameters:
-
other(Dataset) — the other Dataset to intersect with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the intersection operation -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the intersection operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset, or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #intersectAll(Dataset), #intersectAll(Dataset, boolean), #intersectAll(Dataset, Collection), #intersect(Dataset, Collection, boolean), #exceptAll(Dataset, Collection, boolean)
except(...) -> Dataset
-
Signature:
Dataset except(Dataset other) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset.
-
Contract:
- If the Datasets have different column structures, only the common columns will be used for the comparison.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with
-
- Returns: a new Dataset that is the result of the difference operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null}
-
- See also: #except(Dataset, boolean), #exceptAll(Dataset), #intersect(Dataset), #union(Dataset)
-
Signature:
Dataset except(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset.
-
Contract:
- If the Datasets have different column structures, only the common columns will be used for the comparison.
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as they share at least one common column.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the difference operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #except(Dataset), #except(Dataset, Collection), #exceptAll(Dataset, boolean), #intersect(Dataset, boolean), #union(Dataset, boolean)
-
Signature:
Dataset except(Dataset other, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset based on specified key columns.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the difference operation
-
- Returns: a new Dataset that is the result of the difference operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset
-
- See also: #except(Dataset), #except(Dataset, boolean), #exceptAll(Dataset, Collection), #intersect(Dataset, Collection), #union(Dataset, Collection)
-
Signature:
Dataset except(Dataset other, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset based on specified key columns.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as the specified key columns exist in both.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the difference operation -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the difference operation with duplicates eliminated
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset, or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #except(Dataset), #except(Dataset, boolean), #except(Dataset, Collection), #exceptAll(Dataset, Collection, boolean), #intersect(Dataset, Collection, boolean), #union(Dataset, Collection, boolean)
exceptAll(...) -> Dataset
-
Signature:
Dataset exceptAll(Dataset other) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset.
-
Contract:
- If the Datasets have different column structures, only the common columns will be used for the comparison.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with
-
- Returns: a new Dataset that is the result of the difference operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the Datasets do not have the same column structure
-
- See also: #except(Dataset), #exceptAll(Dataset, boolean), #exceptAll(Dataset, Collection), #intersectAll(Dataset), #unionAll(Dataset)
-
Signature:
Dataset exceptAll(Dataset other, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset.
-
Contract:
- If the Datasets have different column structures, only the common columns will be used for the comparison.
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as they share at least one common column.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the difference operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #except(Dataset, boolean), #exceptAll(Dataset), #exceptAll(Dataset, Collection), #intersectAll(Dataset, boolean), #unionAll(Dataset, boolean)
-
Signature:
Dataset exceptAll(Dataset other, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset based on specified key columns.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the difference operation
-
- Returns: a new Dataset that is the result of the difference operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset, or if the Datasets do not have the same column structure
-
- See also: #except(Dataset, Collection), #exceptAll(Dataset), #exceptAll(Dataset, boolean), #exceptAll(Dataset, Collection, boolean), #intersectAll(Dataset, Collection), #unionAll(Dataset)
-
Signature:
Dataset exceptAll(Dataset other, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Performs a difference operation between this Dataset and another Dataset based on specified key columns.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have the same columns, otherwise an {@code IllegalArgumentException} will be thrown.
- If {@code requiresSameColumns} is {@code false} , the Datasets can have different columns as long as the specified key columns exist in both.
-
Parameters:
-
other(Dataset) — the other Dataset to compare with -
keyColumnNames(Collection<String>) — the collection of column names to be used as keys for the difference operation -
requiresSameColumns(boolean) — whether both Datasets must have the same columns
-
- Returns: a new Dataset that is the result of the difference operation with duplicates preserved
-
Throws:
-
java.lang.IllegalArgumentException— if the other Dataset is {@code null} , or if the keyColumnNames is {@code null} or empty, or if any of the specified key column names do not exist in either Dataset, or if requiresSameColumns is {@code true} and the Datasets do not have the same columns
-
- See also: #except(Dataset, Collection, boolean), #exceptAll(Dataset), #exceptAll(Dataset, boolean), #exceptAll(Dataset, Collection), #intersectAll(Dataset, Collection, boolean), #unionAll(Dataset, boolean)
cartesianProduct(...) -> Dataset
-
Signature:
Dataset cartesianProduct(Dataset other) throws IllegalArgumentException - Summary: Performs a cartesian product operation with this Dataset and another Dataset.
-
Contract:
- If there are columns with the same name in both Datasets, the columns from the other Dataset will be suffixed with a unique identifier to avoid conflicts.
- <br/> For example, if this Dataset has 3 rows and the other Dataset has 2 rows, the resulting Dataset will have 6 rows (3 × 2).
-
Parameters:
-
other(Dataset) — the Dataset to perform the cartesian product with. Must not be {@code null} .
-
- Returns: a new Dataset that is the result of the cartesian product operation.
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code other} Dataset is {@code null} .
-
- See also: #merge(Dataset), #innerJoin(Dataset, String, String), #leftJoin(Dataset, String, String), #union(Dataset)
split(...) -> Stream<Dataset>
-
Signature:
Stream<Dataset> split(int chunkSize) throws IllegalArgumentException - Summary: Splits this Dataset into multiple Datasets, each containing a maximum of <i> chunkSize </i> rows.
-
Parameters:
-
chunkSize(int) — the maximum number of rows each split Dataset should contain.
-
- Returns: a Stream of Datasets, each containing <i> chunkSize </i> rows from the original Dataset, or an empty Stream if this Dataset is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if <i> chunkSize </i> is less than or equal to 0.
-
-
Signature:
Stream<Dataset> split(int chunkSize, Collection<String> columnNames) throws IllegalArgumentException - Summary: Splits this Dataset into multiple Datasets, each containing a maximum of <i> chunkSize </i> rows.
-
Parameters:
-
chunkSize(int) — the maximum number of rows each split Dataset should contain. -
columnNames(Collection<String>) — the collection of column names to be included in the split Datasets.
-
- Returns: a Stream of Datasets, each containing <i> chunkSize </i> rows from the original Dataset, or an empty Stream if this Dataset is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if <i> chunkSize </i> is less than or equal to 0.
-
splitToList(...) -> List<Dataset>
-
Signature:
List<Dataset> splitToList(int chunkSize) throws IllegalArgumentException - Summary: Splits this Dataset into multiple Datasets, each containing a maximum of <i> chunkSize </i> rows.
-
Parameters:
-
chunkSize(int) — the maximum number of rows each split Dataset should contain.
-
- Returns: a List of Datasets, each containing <i> chunkSize </i> rows from the original Dataset, or an empty List if this Dataset is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if <i> chunkSize </i> is less than or equal to 0.
-
-
Signature:
List<Dataset> splitToList(int chunkSize, Collection<String> columnNames) throws IllegalArgumentException - Summary: Splits this Dataset into multiple Datasets, each containing a maximum of <i> chunkSize </i> rows.
-
Parameters:
-
chunkSize(int) — the maximum number of rows each split Dataset should contain. -
columnNames(Collection<String>) — the collection of column names to be included in the split Datasets.
-
- Returns: a List of Datasets, each containing <i> chunkSize </i> rows from the original Dataset, or an empty List if this Dataset is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if <i> chunkSize </i> is less than or equal to 0.
-
slice(...) -> Dataset
-
Signature:
Dataset slice(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns an immutable slice of this Dataset from the specified <i> fromRowIndex </i> to <i> toRowIndex </i> .
-
Parameters:
-
fromRowIndex(int) — the starting index of the slice, inclusive. -
toRowIndex(int) — the ending index of the slice, exclusive.
-
- Returns: a new Dataset containing the rows from <i> fromRowIndex </i> to <i> toRowIndex </i> from the original Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range.
-
- See also: List#subList(int, int)
-
Signature:
Dataset slice(Collection<String> columnNames) throws IllegalArgumentException - Summary: Returns an immutable slice of this Dataset that includes only the columns specified in the <i> columnNames </i> collection from the original Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the sliced Dataset.
-
- Returns: a new Dataset containing the same rows as the original Dataset, but only the columns specified in the <i> columnNames </i> collection.
-
Throws:
-
java.lang.IllegalArgumentException— if the <i> columnNames </i> collection is {@code null} or if any of the column names in the collection do not exist in the original Dataset.
-
- See also: List#subList(int, int)
-
Signature:
Dataset slice(int fromRowIndex, int toRowIndex, Collection<String> columnNames) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns an immutable slice of this Dataset from the specified <i> fromRowIndex </i> to <i> toRowIndex </i> and only includes the columns specified in the <i> columnNames </i> collection.
-
Parameters:
-
fromRowIndex(int) — the starting index of the slice, inclusive. -
toRowIndex(int) — the ending index of the slice, exclusive. -
columnNames(Collection<String>) — the collection of column names to be included in the sliced Dataset.
-
- Returns: a new Dataset containing the rows from <i> fromRowIndex </i> to <i> toRowIndex </i> from the original Dataset, but only the columns specified in the <i> columnNames </i> collection.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the <i> columnNames </i> collection is {@code null} or if any of the column names in the collection do not exist in the original Dataset.
-
copy(...) -> Dataset
-
Signature:
Dataset copy() - Summary: Creates a new Dataset that is a copy of the current Dataset.
-
Parameters:
- (none)
- Returns: a new Dataset that is a copy of the current Dataset.
-
Signature:
Dataset copy(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Creates a new Dataset that is a copy of the current Dataset from the specified <i> fromRowIndex </i> to <i> toRowIndex </i> .
-
Parameters:
-
fromRowIndex(int) — the starting index of the copy, inclusive. -
toRowIndex(int) — the ending index of the copy, exclusive.
-
- Returns: a new Dataset that is a copy of the current Dataset from <i> fromRowIndex </i> to <i> toRowIndex </i> .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range.
-
-
Signature:
Dataset copy(Collection<String> columnNames) - Summary: Creates a new Dataset that is a copy of the current Dataset with only the columns specified in the <i> columnNames </i> collection.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the copy.
-
- Returns: a new Dataset that is a copy of the current Dataset with only the columns specified in the <i> columnNames </i> collection.
-
Signature:
Dataset copy(int fromRowIndex, int toRowIndex, Collection<String> columnNames) - Summary: Creates a new Dataset that is a copy of the current Dataset from the specified <i> fromRowIndex </i> to <i> toRowIndex </i> with only the columns specified in the <i> columnNames </i> collection.
-
Parameters:
-
fromRowIndex(int) — the starting index of the copy, inclusive. -
toRowIndex(int) — the ending index of the copy, exclusive. -
columnNames(Collection<String>) — the collection of column names to be included in the copy.
-
- Returns: a new Dataset that is a copy of the current Dataset from <i> fromRowIndex </i> to <i> toRowIndex </i> with only the columns specified in the <i> columnNames </i> collection.
clone(...) -> Dataset
-
Signature:
@Beta Dataset clone() - Summary: Creates a deep copy of the current Dataset by performing Serialization/Deserialization.
-
Contract:
- The frozen status of the copy will always be {@code false} , even if the original {@code Dataset} is frozen.
-
Parameters:
- (none)
- Returns: a new Dataset that is a deep copy of the current Dataset.
-
Signature:
@Beta Dataset clone(boolean freeze) - Summary: Creates a deep copy of the current Dataset by performing Serialization/Deserialization.
-
Parameters:
-
freeze(boolean) — a boolean value that indicates whether the returned Dataset should be frozen.
-
- Returns: a new Dataset that is a deep copy of the current Dataset.
iterator(...) -> BiIterator<A, B>
-
Signature:
<A, B> BiIterator<A, B> iterator(String columnNameA, String columnNameB) throws IllegalArgumentException - Summary: Creates a BiIterator over the elements in the specified columns of the Dataset.
-
Parameters:
-
columnNameA(String) — the name of the first column to iterate over. -
columnNameB(String) — the name of the second column to iterate over.
-
- Returns: a BiIterator over pairs of elements from the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
<A, B> BiIterator<A, B> iterator(int fromRowIndex, int toRowIndex, String columnNameA, String columnNameB) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a BiIterator over the elements in the specified columns of the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting row index for the iteration. -
toRowIndex(int) — the ending row index for the iteration. -
columnNameA(String) — the name of the first column to iterate over. -
columnNameB(String) — the name of the second column to iterate over.
-
- Returns: a BiIterator over pairs of elements from the specified columns.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if either fromRowIndex or toRowIndex is out of the Dataset's row bounds. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
<A, B, C> TriIterator<A, B, C> iterator(String columnNameA, String columnNameB, String columnNameC) throws IllegalArgumentException - Summary: Creates a TriIterator over the elements in the specified columns of the Dataset.
-
Parameters:
-
columnNameA(String) — the name of the first column to iterate over. -
columnNameB(String) — the name of the second column to iterate over. -
columnNameC(String) — the name of the third column to iterate over.
-
- Returns: a TriIterator over triplets of elements from the specified columns.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
<A, B, C> TriIterator<A, B, C> iterator(int fromRowIndex, int toRowIndex, String columnNameA, String columnNameB, String columnNameC) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a TriIterator over the elements in the specified columns of the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNameA(String) — the name of the first column to iterate over. -
columnNameB(String) — the name of the second column to iterate over. -
columnNameC(String) — the name of the third column to iterate over.
-
- Returns: a TriIterator over triplets of elements from the specified columns.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if either fromRowIndex or toRowIndex is out of the Dataset's row bounds. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
paginate(...) -> Paginated<Dataset>
-
Signature:
Paginated<Dataset> paginate(int pageSize) - Summary: Creates a Paginated < Dataset > Dataset from the current Dataset.
-
Parameters:
-
pageSize(int) — the maximum number of rows each page can contain.
-
- Returns: a Paginated < Dataset > object containing pages of Datasets.
-
Signature:
Paginated<Dataset> paginate(Collection<String> columnNames, int pageSize) - Summary: Creates a Paginated < Dataset > object from the current Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the paginated Dataset. -
pageSize(int) — the maximum number of rows each page can contain.
-
- Returns: a Paginated < Dataset > object containing pages of Datasets.
stream(...) -> Stream<T>
-
Signature:
<T> Stream<T> stream(String columnName) throws IllegalArgumentException - Summary: Returns a Stream with values from the specified column.
-
Parameters:
-
columnName(String) — the name of the column in the Dataset to create the Stream from.
-
- Returns: a Stream containing all values from the specified column in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, String columnName) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns a Stream with values from the specified column.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnName(String) — the name of the column in the Dataset to create the Stream from.
-
- Returns: a Stream containing all values from the specified column in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified row indexes are out of the Dataset's range. -
java.lang.IllegalArgumentException— if the specified column name is not found in the Dataset.
-
-
Signature:
<T> Stream<T> stream(Class<? extends T> rowType) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} converted from rows in the Dataset.
-
Parameters:
-
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of objects of type T, created from rows in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from a subset of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of objects of type T, created from the subset of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(Collection<String> columnNames, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from rows in the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included to the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of objects of type T, created from rows in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class, or if the columnNames are not found in the Dataset or {@code columnNames} is empty.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from a subset of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included to the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Object\[\], Collection, Map, or Bean class.
-
- Returns: a Stream of objects of type T, created from the subset of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the specified {@code rowType} is not a supported type - Object\[\], Collection, Map, or Bean class, or if the columnNames are not found in the Dataset or {@code columnNames} is empty.
-
-
Signature:
<T> Stream<T> stream(IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from the Dataset.
-
Parameters:
-
rowSupplier(IntFunction<? extends T>) — a function that creates a new instance of {@code T} for each row in the Dataset.
-
- Returns: a Stream of objects of type T, created from the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from a subset of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowSupplier(IntFunction<? extends T>) — a function that creates a new instance of {@code T} for each row in the Dataset.
-
- Returns: a Stream of objects of type T, created from the subset of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included to the instances created by rowSupplier. -
rowSupplier(IntFunction<? extends T>) — a function that creates a new instance of {@code T} for each row in the Dataset.
-
- Returns: a Stream of objects of type T, created from the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty, or if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Collection<String> columnNames, IntFunction<? extends T> rowSupplier) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from a subset of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included to the instances created by rowSupplier. -
rowSupplier(IntFunction<? extends T>) — a function that creates a new instance of {@code T} for each row in the Dataset.
-
- Returns: a Stream of objects of type T, created from the subset of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty, or if the return value created by specified {@code rowSupplier} is not a supported type - Object\[\], Collection, Map, or Bean class.
-
-
Signature:
<T> Stream<T> stream(Map<String, String> prefixAndFieldNameMap, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from the Dataset.
-
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) — the map of prefixes and field names to be used for mapping Dataset's columns to the fields of the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Bean class.
-
- Returns: a Stream of objects of type T, created from the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code rowType} is not a supported type - Bean class.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Map<String, String> prefixAndFieldNameMap, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} from a subset of rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
prefixAndFieldNameMap(Map<String, String>) — the map of prefixes and field names to be used for mapping Dataset's columns to the fields of the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Bean class.
-
- Returns: a Stream of objects of type T, created from the subset of rows in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range. -
java.lang.IllegalArgumentException— if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code rowType} is not a supported type - Bean class.
-
-
Signature:
<T> Stream<T> stream(Collection<String> columnNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> rowType) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} converted from rows in the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — the collection of column names to be included in the {@code rowType} . -
prefixAndFieldNameMap(Map<String, String>) — the map of prefixes and field names to be used for mapping Dataset's columns to the fields of the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Bean class.
-
- Returns: a Stream of objects of type T
-
Throws:
-
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty, or if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code rowType} is not a supported type - Bean class.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Map<String, String> prefixAndFieldNameMap, Class<? extends T> rowType) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} converted from rows in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be included in the {@code rowType} . -
prefixAndFieldNameMap(Map<String, String>) — the map of prefixes and field names to be used for mapping Dataset's columns to the fields of the {@code rowType} . -
rowType(Class<? extends T>) — the class of the objects in the resulting Stream. It must be one of the supported types - Bean class.
-
- Returns: a Stream of objects of type T
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty, or if the mapping defined by {@code prefixAndFieldNameMap} is invalid, or if the specified {@code rowType} is not a supported type - Bean class.
-
-
Signature:
<T> Stream<T> stream(IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) - Summary: Creates a Stream of objects of type {@code T} by applying the provided rowMapper function to each row in the Dataset.
-
Parameters:
-
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Dataset, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of objects of type T, created by applying the rowMapper function to each row in the Dataset.
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} by applying the provided rowMapper function to each row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Dataset, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of objects of type T, created by applying the rowMapper function to each row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
java.lang.IllegalArgumentException— if the supplied arguments reference non-existent columns or otherwise violate dataset constraints
-
-
Signature:
<T> Stream<T> stream(Collection<String> columnNames, IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) throws IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} by applying the provided rowMapper function to each row in the Dataset.
-
Parameters:
-
columnNames(Collection<String>) — a collection of column names to be included in the DisposableObjArray passed to the rowMapper function. -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Dataset, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of objects of type T, created by applying the rowMapper function to each row in the Dataset.
-
Throws:
-
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Collection<String> columnNames, IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of objects of type {@code T} by applying the provided rowMapper function to each row in the Dataset.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — a collection of column names to be included in the DisposableObjArray passed to the rowMapper function. -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Dataset, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of objects of type T, created by applying the rowMapper function to each row in the Dataset.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset or {@code columnNames} is empty
-
-
Signature:
<T> Stream<T> stream(Tuple2<String, String> columnNames, BiFunction<?, ?, ? extends T> rowMapper) throws IllegalArgumentException - Summary: Creates a Stream of type T from the Dataset using the specified column names and a row mapper function.
-
Parameters:
-
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used -
rowMapper(BiFunction<?, ?, ? extends T>) — a BiFunction to transform the values of the two columns into an instance of type T
-
- Returns: a Stream of type T
-
Throws:
-
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Tuple2<String, String> columnNames, BiFunction<?, ?, ? extends T> rowMapper) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of type T from the Dataset using the specified column names and a row mapper function.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple2<String, String>) — a Tuple2 containing the names of the two columns to be used -
rowMapper(BiFunction<?, ?, ? extends T>) — a BiFunction to transform the values of the two columns into an instance of type T
-
- Returns: a Stream of type T
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
java.lang.IllegalArgumentException— if the columnNames are not found in the Dataset
-
-
Signature:
<T> Stream<T> stream(Tuple3<String, String, String> columnNames, TriFunction<?, ?, ?, ? extends T> rowMapper) throws IllegalArgumentException - Summary: Creates a Stream of type T from the Dataset using the specified column names and a row mapper function.
-
Parameters:
-
columnNames(Tuple3<String, String, String>) — the names of the columns in the Dataset to create the Stream from. -
rowMapper(TriFunction<?, ?, ?, ? extends T>) — the function to transform the values from the specified columns into an object of type T.
-
- Returns: a Stream containing all values from the specified columns in the Dataset, transformed by the row mapper function.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
-
Signature:
<T> Stream<T> stream(int fromRowIndex, int toRowIndex, Tuple3<String, String, String> columnNames, TriFunction<?, ?, ?, ? extends T> rowMapper) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Creates a Stream of type T from the Dataset using the specified column names and a row mapper function.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Tuple3<String, String, String>) — the names of the columns in the Dataset to create the Stream from. -
rowMapper(TriFunction<?, ?, ?, ? extends T>) — the function to transform the values from the specified columns into an object of type T.
-
- Returns: a Stream containing all values from the specified columns in the Dataset, transformed by the row mapper function.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified row indexes are out of the Dataset's range. -
java.lang.IllegalArgumentException— if any of the specified column names are not found in the Dataset.
-
apply(...) -> R
-
Signature:
<R, E extends Exception> R apply(Throwables.Function<? super Dataset, ? extends R, E> func) throws E - Summary: Applies the provided function to this Dataset and returns the result.
-
Parameters:
-
func(Throwables.Function<? super Dataset, ? extends R, E>) — the function to apply to the Dataset. This function should take a Dataset as input and return a result of type R.
-
- Returns: the result of applying the provided function to the Dataset.
-
Throws:
-
E— if the provided function throws an exception.
-
applyIfNotEmpty(...) -> Optional<R>
-
Signature:
<R, E extends Exception> Optional<R> applyIfNotEmpty(Throwables.Function<? super Dataset, ? extends R, E> func) throws E - Summary: Applies the provided function to this Dataset if it is not empty and returns the result wrapped in an Optional.
-
Contract:
- Applies the provided function to this Dataset if it is not empty and returns the result wrapped in an Optional.
- If the Dataset is empty, it returns an empty Optional.
-
Parameters:
-
func(Throwables.Function<? super Dataset, ? extends R, E>) — the function to apply to the Dataset. This function should take a Dataset as input and return a result of type R.
-
- Returns: an Optional containing the result of applying the provided function to the Dataset, or an empty Optional if the Dataset is empty.
-
Throws:
-
E— if the provided function throws an exception.
-
accept(...) -> void
-
Signature:
<E extends Exception> void accept(Throwables.Consumer<? super Dataset, E> action) throws E - Summary: Performs the provided action on this Dataset.
-
Parameters:
-
action(Throwables.Consumer<? super Dataset, E>) — the action to be performed on the Dataset. This action should take a Dataset as input.
-
-
Throws:
-
E— if the provided action throws an exception.
-
acceptIfNotEmpty(...) -> OrElse
-
Signature:
<E extends Exception> OrElse acceptIfNotEmpty(Throwables.Consumer<? super Dataset, E> action) throws E - Summary: Performs the provided action on this Dataset if it is not empty.
-
Contract:
- Performs the provided action on this Dataset if it is not empty.
- If the Dataset is empty, it does nothing and returns an instance of OrElse.
-
Parameters:
-
action(Throwables.Consumer<? super Dataset, E>) — the action to be performed on the Dataset. This action should take a Dataset as input.
-
- Returns: an instance of OrElse, which can be used to perform an alternative action if the Dataset is empty.
-
Throws:
-
E— if the provided action throws an exception.
-
freeze(...) -> void
-
Signature:
void freeze() - Summary: Freezes the Dataset to prevent further modification.
-
Contract:
- <br/> This method is useful when you want to ensure the Dataset remains constant after a certain point in your program.
-
Parameters:
- (none)
isFrozen(...) -> boolean
-
Signature:
boolean isFrozen() - Summary: Checks if the Dataset is frozen.
-
Contract:
- Checks if the Dataset is frozen.
-
Parameters:
- (none)
- Returns: {@code true} if the Dataset is frozen and cannot be modified, {@code false} otherwise.
clear(...) -> void
-
Signature:
void clear() throws IllegalStateException - Summary: Clears the Dataset.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen and cannot be modified.
-
isEmpty(...) -> boolean
-
Signature:
boolean isEmpty() - Summary: Checks if the Dataset is empty.
-
Contract:
- Checks if the Dataset is empty.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Dataset dataset = Dataset.rows(Arrays.asList("id", "name"), data); if (dataset.isEmpty()) { // handle empty Dataset } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the Dataset is empty, {@code false} otherwise.
trimToSize(...) -> void
-
Signature:
void trimToSize() - Summary: Trims the size of the Dataset to its current size.
-
Parameters:
- (none)
- See also: #freeze(), #isFrozen()
size(...) -> int
-
Signature:
int size() - Summary: Returns the number of rows in the Dataset.
-
Parameters:
- (none)
- Returns: the number of rows in the Dataset.
getProperties(...) -> Map<String, Object>
-
Signature:
@Beta Map<String, Object> getProperties() - Summary: Retrieves the properties of the Dataset as a Map.
-
Parameters:
- (none)
- Returns: a Map containing the properties of the Dataset.
setProperties(...) -> void
-
Signature:
@Beta void setProperties(final Map<String, ?> properties) throws IllegalStateException - Summary: Sets the properties of the Dataset.
-
Parameters:
-
properties(Map<String, ?>) — a Map containing the properties to set on the Dataset.
-
-
Throws:
-
java.lang.IllegalStateException— if the Dataset is frozen and cannot be modified.
-
println(...) -> void
-
Signature:
void println() - Summary: Prints the content of the Dataset to the standard output.
-
Parameters:
- (none)
- See also: #println(String)
-
Signature:
void println(String prefix) - Summary: Prints the content of the Dataset to the standard output.
-
Parameters:
-
prefix(String) — the prefix string to be printed before each line of the Dataset output
-
- See also: #println()
-
Signature:
void println(int fromRowIndex, int toRowIndex) throws IndexOutOfBoundsException - Summary: Prints a portion of the Dataset to the standard output.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range
-
- See also: #println(), #println(String)
-
Signature:
void println(int fromRowIndex, int toRowIndex, Collection<String> columnNames) throws IndexOutOfBoundsException - Summary: Prints a portion of the Dataset to the standard output.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be printed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range
-
- See also: #println(), #println(String)
-
Signature:
void println(Appendable output) throws UncheckedIOException - Summary: Prints the Dataset to the provided Writer.
-
Parameters:
-
output(Appendable) — the appendable where the Dataset will be printed
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #println(), #println(String)
-
Signature:
void println(int fromRowIndex, int toRowIndex, Collection<String> columnNames, Appendable output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Prints a portion of the Dataset to the provided Appendable.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be printed -
output(Appendable) — the appendable where the Dataset will be printed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #println(), #println(String)
-
Signature:
void println(int fromRowIndex, int toRowIndex, Collection<String> columnNames, String prefix, Appendable output) throws IndexOutOfBoundsException, UncheckedIOException - Summary: Prints a portion of the Dataset to the provided Appendable with a custom prefix.
-
Parameters:
-
fromRowIndex(int) — the starting index of the row range (inclusive). -
toRowIndex(int) — the ending index of the row range (exclusive). -
columnNames(Collection<String>) — the collection of column names to be printed -
prefix(String) — the prefix string to be printed before each line of the Dataset output -
output(Appendable) — the appendable where the Dataset will be printed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromRowIndex or toRowIndex is out of the Dataset's range -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs
-
- See also: #println(), #println(String)
Enum DateTimeFormat (com.landawn.abacus.util.DateTimeFormat)
Enumeration defining standard date and time formatting options.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Dates (com.landawn.abacus.util.Dates)
A comprehensive utility class providing date and time manipulation, parsing, formatting, and conversion operations for both legacy Java date/time types (java.util.Date, Calendar, SQL date types) and modern Java 8+ time types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
registerDateCreator(...) -> boolean
-
Signature:
public static <T extends java.util.Date> boolean registerDateCreator(final Class<? extends T> dateClass, final LongFunction<? extends T> dateCreator) - Summary: Registers a custom date creator for a specific date class.
-
Contract:
- The date creator function must accept one argument: the time in milliseconds since the epoch (01-01-1970).
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Custom date class class CustomDate extends java.util.Date { public CustomDate(long timeInMillis) { super(timeInMillis); } } // Register custom creator with LongFunction signature LongFunction<CustomDate> creator = CustomDate::new; boolean registered = Dates.registerDateCreator(CustomDate.class, creator); if (registered) { System.out.println("CustomDate creator registered successfully"); } else { System.out.println("Failed to register CustomDate creator"); } } </pre>
-
Parameters:
-
dateClass(Class<? extends T>) — the class of the date to register the creator for, must not be in restricted packages. -
dateCreator(LongFunction<? extends T>) — the function that creates instances of the date class, taking one argument: the time in milliseconds. Not {@code null} .
-
- Returns: {@code true} if the date creator was successfully registered, {@code false} if the class was already registered or is from a restricted package ( {@code java.} , {@code javax.} , or {@code com.landawn.abacus.*} ).
- See also: #registerCalendarCreator(Class, BiFunction)
registerCalendarCreator(...) -> boolean
-
Signature:
public static <T extends java.util.Calendar> boolean registerCalendarCreator(final Class<? extends T> calendarClass, final BiFunction<? super Long, ? super Calendar, ? extends T> dateCreator) - Summary: Registers a custom calendar creator for a specific calendar class.
-
Contract:
- The calendar creator function must accept two arguments: the time in milliseconds since the epoch (01-01-1970) and a {@code Calendar} instance to use as a template.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Custom calendar class class CustomCalendar extends java.util.GregorianCalendar { public CustomCalendar(long timeInMillis, Calendar template) { super(); this.setTimeInMillis(timeInMillis); } } // Register custom creator with BiFunction signature BiFunction<Long, Calendar, CustomCalendar> creator = (time, template) -> new CustomCalendar(time, template); boolean registered = Dates.registerCalendarCreator(CustomCalendar.class, creator); if (registered) { System.out.println("CustomCalendar creator registered successfully"); } else { System.out.println("Failed to register CustomCalendar creator"); } } </pre>
-
Parameters:
-
calendarClass(Class<? extends T>) — the class of the calendar to register the creator for, must not be in restricted packages. -
dateCreator(BiFunction<? super Long, ? super Calendar, ? extends T>) — the function that creates instances of the calendar class, taking two arguments: the time in milliseconds and a {@code Calendar} template. Not {@code null} .
-
- Returns: {@code true} if the calendar creator was successfully registered, {@code false} if the class was already registered or is from a restricted package ( {@code java.} , {@code javax.} , or {@code com.landawn.abacus.*} ).
- See also: #registerDateCreator(Class, LongFunction)
currentTimeMillis(...) -> long
-
Signature:
@Beta public static long currentTimeMillis() - Summary: Returns the current time in milliseconds.
-
Parameters:
- (none)
- Returns: the current time in milliseconds since the epoch (01-01-1970).
currentTime(...) -> Time
-
Signature:
public static Time currentTime() - Summary: Returns a new instance of {@code java.sql.Time} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code java.sql.Time} instance representing the current time.
currentDate(...) -> Date
-
Signature:
public static Date currentDate() - Summary: Returns a new instance of {@code java.sql.Date} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code java.sql.Date} instance representing the current date.
currentTimestamp(...) -> Timestamp
-
Signature:
public static Timestamp currentTimestamp() - Summary: Returns a new instance of {@code java.sql.Timestamp} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code java.sql.Timestamp} instance representing the current date and time with millisecond precision.
currentJUDate(...) -> java.util.Date
-
Signature:
public static java.util.Date currentJUDate() - Summary: Returns a new instance of {@code java.util.Date} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code java.util.Date} instance representing the current date and time.
currentCalendar(...) -> Calendar
-
Signature:
public static Calendar currentCalendar() - Summary: Returns a new instance of {@code java.util.Calendar} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code Calendar} instance representing the current date and time.
currentGregorianCalendar(...) -> GregorianCalendar
-
Signature:
public static GregorianCalendar currentGregorianCalendar() - Summary: Returns a new instance of {@code GregorianCalendar} based on the current time in the default time zone with the default locale.
-
Parameters:
- (none)
- Returns: a new {@code GregorianCalendar} instance representing the current date and time.
currentXMLGregorianCalendar(...) -> XMLGregorianCalendar
-
Signature:
public static XMLGregorianCalendar currentXMLGregorianCalendar() - Summary: Returns a new instance of {@code XMLGregorianCalendar} based on the current Gregorian Calendar.
-
Parameters:
- (none)
- Returns: a new {@code XMLGregorianCalendar} instance representing the current date and time.
currentTimePlus(...) -> Time
-
Signature:
@Beta public static Time currentTimePlus(final long amount, final TimeUnit unit) - Summary: Returns a new {@code java.sql.Time} instance representing the current time with the specified time amount added or subtracted.
-
Parameters:
-
amount(long) — the amount of time to add (positive) or subtract (negative). -
unit(TimeUnit) — the time unit of the amount parameter (e.g., TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS).
-
- Returns: a new {@code java.sql.Time} instance representing the current time with the specified amount applied.
currentDatePlus(...) -> Date
-
Signature:
@Beta public static Date currentDatePlus(final long amount, final TimeUnit unit) - Summary: Returns a new {@code java.sql.Date} instance representing the current date with the specified time amount added or subtracted.
-
Parameters:
-
amount(long) — the amount of time to add (positive) or subtract (negative). -
unit(TimeUnit) — the time unit of the amount parameter (e.g., TimeUnit.DAYS, TimeUnit.HOURS).
-
- Returns: a new {@code java.sql.Date} instance representing the current date with the specified amount applied.
currentTimestampPlus(...) -> Timestamp
-
Signature:
@Beta public static Timestamp currentTimestampPlus(final long amount, final TimeUnit unit) - Summary: Returns a new {@code java.sql.Timestamp} instance representing the current timestamp with the specified time amount added or subtracted.
-
Parameters:
-
amount(long) — the amount of time to add (positive) or subtract (negative). -
unit(TimeUnit) — the time unit of the amount parameter (e.g., TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS, TimeUnit.DAYS).
-
- Returns: a new {@code java.sql.Timestamp} instance representing the current timestamp with the specified amount applied.
currentJUDatePlus(...) -> java.util.Date
-
Signature:
@Beta public static java.util.Date currentJUDatePlus(final long amount, final TimeUnit unit) - Summary: Returns a new {@code java.util.Date} instance representing the current date/time with the specified time amount added or subtracted.
-
Parameters:
-
amount(long) — the amount of time to add (positive) or subtract (negative). -
unit(TimeUnit) — the time unit of the amount parameter (e.g., TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS, TimeUnit.DAYS).
-
- Returns: a new {@code java.util.Date} instance representing the current date/time with the specified amount applied.
currentCalendarPlus(...) -> Calendar
-
Signature:
@Beta public static Calendar currentCalendarPlus(final long amount, final TimeUnit unit) - Summary: Returns a new {@code java.util.Calendar} instance representing the current date/time with the specified time amount added or subtracted.
-
Parameters:
-
amount(long) — the amount of time to add (positive) or subtract (negative). -
unit(TimeUnit) — the time unit of the amount parameter (e.g., TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS, TimeUnit.DAYS).
-
- Returns: a new {@code java.util.Calendar} instance representing the current date/time with the specified amount applied.
createJUDate(...) -> java.util.Date
-
Signature:
public static java.util.Date createJUDate(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.Date} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.Date} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createJUDate(java.util.Date), #createJUDate(long)
-
Signature:
public static java.util.Date createJUDate(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.Date} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.Date} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createJUDate(Calendar), #createJUDate(long)
-
Signature:
public static java.util.Date createJUDate(final long timeInMillis) - Summary: Creates a new instance of {@code java.util.Date} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.util.Date} instance representing the specified point in time.
- See also: #createJUDate(Calendar), #createJUDate(java.util.Date), #createDate(long), #createTime(long), #createTimestamp(long)
createDate(...) -> Date
-
Signature:
public static Date createDate(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Date} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Date} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createDate(java.util.Date), #createDate(long), #createJUDate(Calendar)
-
Signature:
public static Date createDate(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Date} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Date} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createDate(Calendar), #createDate(long), #createJUDate(java.util.Date)
-
Signature:
public static Date createDate(final long timeInMillis) - Summary: Creates a new instance of {@code java.sql.Date} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.sql.Date} instance representing the specified point in time.
- See also: #createDate(Calendar), #createDate(java.util.Date), #createJUDate(long), #createTime(long), #createTimestamp(long)
createTime(...) -> Time
-
Signature:
public static Time createTime(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Time} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Time} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createTime(java.util.Date), #createTime(long), #createDate(Calendar)
-
Signature:
public static Time createTime(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Time} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Time} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createTime(Calendar), #createTime(long), #createDate(java.util.Date)
-
Signature:
public static Time createTime(final long timeInMillis) - Summary: Creates a new instance of {@code java.sql.Time} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.sql.Time} instance representing the specified point in time.
- See also: #createTime(Calendar), #createTime(java.util.Date), #createDate(long), #createTimestamp(long)
createTimestamp(...) -> Timestamp
-
Signature:
public static Timestamp createTimestamp(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Timestamp} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Timestamp} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createTimestamp(java.util.Date), #createTimestamp(long), #createTime(Calendar)
-
Signature:
public static Timestamp createTimestamp(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.sql.Timestamp} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.sql.Timestamp} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createTimestamp(Calendar), #createTimestamp(long), #createTime(java.util.Date)
-
Signature:
public static Timestamp createTimestamp(final long timeInMillis) - Summary: Creates a new instance of {@code java.sql.Timestamp} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.sql.Timestamp} instance representing the specified point in time.
- See also: #createTimestamp(Calendar), #createTimestamp(java.util.Date), #createTime(long)
createCalendar(...) -> Calendar
-
Signature:
public static Calendar createCalendar(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.Calendar} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.Calendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createCalendar(java.util.Date), #createCalendar(long), #createCalendar(long, TimeZone)
-
Signature:
public static Calendar createCalendar(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.Calendar} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.Calendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createCalendar(Calendar), #createCalendar(long), #createCalendar(long, TimeZone)
-
Signature:
public static Calendar createCalendar(final long timeInMillis) - Summary: Creates a new instance of {@code java.util.Calendar} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.util.Calendar} instance representing the specified point in time.
- See also: #createCalendar(Calendar), #createCalendar(java.util.Date), #createCalendar(long, TimeZone), #createGregorianCalendar(long), #createXMLGregorianCalendar(long)
-
Signature:
public static Calendar createCalendar(final long timeInMillis, final TimeZone tz) - Summary: Creates a new instance of {@code java.util.Calendar} based on the provided time in milliseconds and the specified time zone.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT). -
tz(TimeZone) — the time zone for the calendar; if {@code null} , the default time zone is used.
-
- Returns: a new {@code java.util.Calendar} instance with the specified time and time zone.
- See also: #createCalendar(long), #createCalendar(Calendar), #createCalendar(java.util.Date)
createGregorianCalendar(...) -> GregorianCalendar
-
Signature:
public static GregorianCalendar createGregorianCalendar(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.GregorianCalendar} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.GregorianCalendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createGregorianCalendar(java.util.Date), #createGregorianCalendar(long), #createGregorianCalendar(long, TimeZone)
-
Signature:
public static GregorianCalendar createGregorianCalendar(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code java.util.GregorianCalendar} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code java.util.GregorianCalendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createGregorianCalendar(Calendar), #createGregorianCalendar(long), #createGregorianCalendar(long, TimeZone)
-
Signature:
public static GregorianCalendar createGregorianCalendar(final long timeInMillis) - Summary: Creates a new instance of {@code java.util.GregorianCalendar} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code java.util.GregorianCalendar} instance representing the specified point in time.
- See also: #createGregorianCalendar(Calendar), #createGregorianCalendar(java.util.Date), #createGregorianCalendar(long, TimeZone), #createCalendar(long), #createXMLGregorianCalendar(long)
-
Signature:
public static GregorianCalendar createGregorianCalendar(final long timeInMillis, final TimeZone tz) - Summary: Creates a new instance of {@code java.util.GregorianCalendar} based on the provided time in milliseconds and the specified time zone.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT). -
tz(TimeZone) — the time zone for the calendar; if {@code null} , the default time zone is used.
-
- Returns: a new {@code java.util.GregorianCalendar} instance with the specified time and time zone.
- See also: #createGregorianCalendar(long), #createGregorianCalendar(Calendar), #createGregorianCalendar(java.util.Date)
createXMLGregorianCalendar(...) -> XMLGregorianCalendar
-
Signature:
public static XMLGregorianCalendar createXMLGregorianCalendar(final Calendar calendar) throws IllegalArgumentException - Summary: Creates a new instance of {@code XMLGregorianCalendar} based on the provided calendar's time value.
-
Parameters:
-
calendar(Calendar) — the calendar providing the time value, not {@code null} .
-
- Returns: a new {@code XMLGregorianCalendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if calendar is {@code null} .
-
- See also: #createXMLGregorianCalendar(java.util.Date), #createXMLGregorianCalendar(long), #createXMLGregorianCalendar(long, TimeZone)
-
Signature:
public static XMLGregorianCalendar createXMLGregorianCalendar(final java.util.Date date) throws IllegalArgumentException - Summary: Creates a new instance of {@code XMLGregorianCalendar} based on the provided date's time value.
-
Parameters:
-
date(java.util.Date) — the date providing the time value, not {@code null} .
-
- Returns: a new {@code XMLGregorianCalendar} instance representing the same point in time.
-
Throws:
-
java.lang.IllegalArgumentException— if date is {@code null} .
-
- See also: #createXMLGregorianCalendar(Calendar), #createXMLGregorianCalendar(long), #createXMLGregorianCalendar(long, TimeZone)
-
Signature:
public static XMLGregorianCalendar createXMLGregorianCalendar(final long timeInMillis) - Summary: Creates a new instance of {@code XMLGregorianCalendar} based on the provided time in milliseconds.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
-
- Returns: a new {@code XMLGregorianCalendar} instance representing the specified point in time.
- See also: #createXMLGregorianCalendar(Calendar), #createXMLGregorianCalendar(java.util.Date), #createXMLGregorianCalendar(long, TimeZone), #createCalendar(long), #createGregorianCalendar(long)
-
Signature:
public static XMLGregorianCalendar createXMLGregorianCalendar(final long timeInMillis, final TimeZone tz) - Summary: Creates a new instance of {@code XMLGregorianCalendar} based on the provided time in milliseconds and the specified time zone.
-
Parameters:
-
timeInMillis(long) — the time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT). -
tz(TimeZone) — the time zone for the calendar; if {@code null} , the default time zone is used.
-
- Returns: a new {@code XMLGregorianCalendar} instance with the specified time and time zone.
- See also: #createXMLGregorianCalendar(long), #createXMLGregorianCalendar(Calendar), #createXMLGregorianCalendar(java.util.Date)
parseJUDate(...) -> java.util.Date
-
Signature:
@MayReturnNull public static java.util.Date parseJUDate(final String date) - Summary: Parses a string representation of a date into a {@code java.util.Date} object.
-
Parameters:
-
date(String) — the string representation of the date to be parsed.
-
- Returns: the parsed {@code java.util.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseJUDate(String, String), #parseJUDate(String, String, TimeZone), #createJUDate(long)
-
Signature:
@MayReturnNull public static java.util.Date parseJUDate(final String date, final String format) - Summary: Parses a string representation of a date into a {@code java.util.Date} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
date(String) — the string representation of the date to be parsed. -
format(String) — the date format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.util.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseJUDate(String), #parseJUDate(String, String, TimeZone), SimpleDateFormat
-
Signature:
@MayReturnNull public static java.util.Date parseJUDate(final String date, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a date into a {@code java.util.Date} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
date(String) — the string representation of the date to be parsed. -
format(String) — the date format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.util.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseJUDate(String), #parseJUDate(String, String), SimpleDateFormat
parseDate(...) -> Date
-
Signature:
@MayReturnNull public static Date parseDate(final String date) - Summary: Parses a string representation of a date into a {@code java.sql.Date} object.
-
Parameters:
-
date(String) — the string representation of the date to be parsed.
-
- Returns: the parsed {@code java.sql.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseDate(String, String), #parseDate(String, String, TimeZone), #parseJUDate(String)
-
Signature:
@MayReturnNull public static Date parseDate(final String date, final String format) - Summary: Parses a string representation of a date into a {@code java.sql.Date} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
date(String) — the string representation of the date to be parsed. -
format(String) — the date format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.sql.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseDate(String), #parseDate(String, String, TimeZone), #parseJUDate(String, String)
-
Signature:
@MayReturnNull public static Date parseDate(final String date, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a date into a {@code java.sql.Date} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
date(String) — the string representation of the date to be parsed. -
format(String) — the date format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.sql.Date} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseDate(String), #parseDate(String, String), #parseJUDate(String, String, TimeZone)
parseTime(...) -> Time
-
Signature:
@MayReturnNull public static Time parseTime(final String date) - Summary: Parses a string representation of a time into a {@code java.sql.Time} object.
-
Parameters:
-
date(String) — the string representation of the time to be parsed.
-
- Returns: the parsed {@code java.sql.Time} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTime(String, String), #parseTime(String, String, TimeZone), #parseDate(String)
-
Signature:
@MayReturnNull public static Time parseTime(final String date, final String format) - Summary: Parses a string representation of a time into a {@code java.sql.Time} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
date(String) — the string representation of the time to be parsed. -
format(String) — the time format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.sql.Time} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTime(String), #parseTime(String, String, TimeZone), #parseDate(String, String)
-
Signature:
@MayReturnNull public static Time parseTime(final String date, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a time into a {@code java.sql.Time} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
date(String) — the string representation of the time to be parsed. -
format(String) — the time format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.sql.Time} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTime(String), #parseTime(String, String), #parseDate(String, String, TimeZone)
parseTimestamp(...) -> Timestamp
-
Signature:
@MayReturnNull public static Timestamp parseTimestamp(final String date) - Summary: Parses a string representation of a timestamp into a {@code java.sql.Timestamp} object.
-
Parameters:
-
date(String) — the string representation of the timestamp to be parsed.
-
- Returns: the parsed {@code java.sql.Timestamp} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTimestamp(String, String), #parseTimestamp(String, String, TimeZone), #parseDate(String)
-
Signature:
@MayReturnNull public static Timestamp parseTimestamp(final String date, final String format) - Summary: Parses a string representation of a timestamp into a {@code java.sql.Timestamp} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
date(String) — the string representation of the timestamp to be parsed. -
format(String) — the timestamp format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.sql.Timestamp} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTimestamp(String), #parseTimestamp(String, String, TimeZone), #parseTime(String, String)
-
Signature:
@MayReturnNull public static Timestamp parseTimestamp(final String date, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a timestamp into a {@code java.sql.Timestamp} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
date(String) — the string representation of the timestamp to be parsed. -
format(String) — the timestamp format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.sql.Timestamp} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseTimestamp(String), #parseTimestamp(String, String), #parseTime(String, String, TimeZone)
parseCalendar(...) -> Calendar
-
Signature:
@MayReturnNull @Beta public static Calendar parseCalendar(final String calendar) - Summary: Parses a string representation of a date/time into a {@code java.util.Calendar} object.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed.
-
- Returns: the parsed {@code java.util.Calendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseCalendar(String, String), #parseCalendar(String, String, TimeZone), #createCalendar(long)
-
Signature:
@MayReturnNull @Beta public static Calendar parseCalendar(final String calendar, final String format) - Summary: Parses a string representation of a date/time into a {@code java.util.Calendar} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.util.Calendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseCalendar(String), #parseCalendar(String, String, TimeZone), #parseJUDate(String, String)
-
Signature:
@MayReturnNull @Beta public static Calendar parseCalendar(final String calendar, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a date/time into a {@code java.util.Calendar} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing and for the returned calendar; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.util.Calendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseCalendar(String), #parseCalendar(String, String), #createCalendar(long, TimeZone)
parseGregorianCalendar(...) -> GregorianCalendar
-
Signature:
@MayReturnNull @Beta public static GregorianCalendar parseGregorianCalendar(final String calendar) - Summary: Parses a string representation of a date/time into a {@code java.util.GregorianCalendar} object.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed.
-
- Returns: the parsed {@code java.util.GregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseGregorianCalendar(String, String), #parseGregorianCalendar(String, String, TimeZone), #parseCalendar(String)
-
Signature:
@MayReturnNull @Beta public static GregorianCalendar parseGregorianCalendar(final String calendar, final String format) - Summary: Parses a string representation of a date/time into a {@code java.util.GregorianCalendar} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code java.util.GregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseGregorianCalendar(String), #parseGregorianCalendar(String, String, TimeZone), #parseCalendar(String, String)
-
Signature:
@MayReturnNull @Beta public static GregorianCalendar parseGregorianCalendar(final String calendar, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a date/time into a {@code java.util.GregorianCalendar} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing and for the returned calendar; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code java.util.GregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseGregorianCalendar(String), #parseGregorianCalendar(String, String), #parseCalendar(String, String, TimeZone)
parseXMLGregorianCalendar(...) -> XMLGregorianCalendar
-
Signature:
@MayReturnNull @Beta public static XMLGregorianCalendar parseXMLGregorianCalendar(final String calendar) - Summary: Parses a string representation of a date/time into a {@code javax.xml.datatype.XMLGregorianCalendar} object.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed.
-
- Returns: the parsed {@code javax.xml.datatype.XMLGregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseXMLGregorianCalendar(String, String), #parseXMLGregorianCalendar(String, String, TimeZone), #parseGregorianCalendar(String)
-
Signature:
@MayReturnNull @Beta public static XMLGregorianCalendar parseXMLGregorianCalendar(final String calendar, final String format) - Summary: Parses a string representation of a date/time into a {@code javax.xml.datatype.XMLGregorianCalendar} object using the specified format.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically.
-
- Returns: the parsed {@code javax.xml.datatype.XMLGregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseXMLGregorianCalendar(String), #parseXMLGregorianCalendar(String, String, TimeZone), #parseGregorianCalendar(String, String)
-
Signature:
@MayReturnNull @Beta public static XMLGregorianCalendar parseXMLGregorianCalendar(final String calendar, final String format, final TimeZone timeZone) - Summary: Parses a string representation of a date/time into a {@code javax.xml.datatype.XMLGregorianCalendar} object using the specified format and time zone.
-
Contract:
- If the format is {@code null} , attempts to automatically detect the format.
- If the time zone is {@code null} , uses the default time zone.
-
Parameters:
-
calendar(String) — the string representation of the date/time to be parsed. -
format(String) — the date/time format pattern; if {@code null} , common formats are attempted automatically. -
timeZone(TimeZone) — the time zone for parsing and for the returned calendar; if {@code null} , the default time zone is used.
-
- Returns: the parsed {@code javax.xml.datatype.XMLGregorianCalendar} instance, or {@code null} if the input is {@code null} , empty, or the string "null".
- See also: #parseXMLGregorianCalendar(String), #parseXMLGregorianCalendar(String, String), #parseGregorianCalendar(String, String, TimeZone)
formatLocalDate(...) -> String
-
Signature:
@Beta @MayReturnNull public static String formatLocalDate() - Summary: Formats the current local date using the format {@code yyyy-MM-dd} .
-
Parameters:
- (none)
- Returns: a string representation of the current local date.
- See also: #formatLocalDateTime(), #formatCurrentDateTime()
formatLocalDateTime(...) -> String
-
Signature:
@Beta @MayReturnNull public static String formatLocalDateTime() - Summary: Formats the current local date and time using the format {@code yyyy-MM-dd HH:mm:ss} .
-
Parameters:
- (none)
- Returns: a string representation of the current local date and time.
- See also: #formatLocalDate(), #formatCurrentDateTime()
formatCurrentDateTime(...) -> String
-
Signature:
@MayReturnNull public static String formatCurrentDateTime() - Summary: Formats the current date and time using the ISO 8601 format {@code yyyy-MM-dd'T'HH:mm:ss'Z'} .
-
Parameters:
- (none)
- Returns: a string representation of the current date and time in ISO 8601 format.
- See also: #formatLocalDateTime(), #formatCurrentTimestamp(), #format(java.util.Date)
formatCurrentTimestamp(...) -> String
-
Signature:
@MayReturnNull public static String formatCurrentTimestamp() - Summary: Formats the current date and time including milliseconds using the ISO 8601 format {@code yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} .
-
Parameters:
- (none)
- Returns: a string representation of the current timestamp in ISO 8601 format with milliseconds.
- See also: #formatCurrentDateTime(), #format(java.util.Date)
format(...) -> String
-
Signature:
@MayReturnNull public static String format(final java.util.Date date) - Summary: Formats the provided date using a default format that depends on the date type.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to be formatted; may be {@code null} .
-
- Returns: a string representation of the date, or {@code null} if the date is {@code null} .
- See also: #format(java.util.Date, String), #format(java.util.Date, String, TimeZone), #formatCurrentDateTime(), #formatCurrentTimestamp()
-
Signature:
@MayReturnNull public static String format(final java.util.Date date, final String format) - Summary: Formats the provided date into a string representation using the specified format.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
-
Parameters:
-
date(java.util.Date) — the date to be formatted. -
format(String) — the date format pattern; if {@code null} , the default format is used.
-
- Returns: a string representation of the date, or {@code null} if the date is {@code null} .
- See also: #format(java.util.Date, String, TimeZone), #parseJUDate(String, String), SimpleDateFormat
-
Signature:
@MayReturnNull public static String format(final java.util.Date date, final String format, final TimeZone timeZone) - Summary: Formats the provided date into a string representation using the specified format and time zone.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If no time zone is provided, the default time zone is used.
-
Parameters:
-
date(java.util.Date) — the date to be formatted. -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used.
-
- Returns: a string representation of the date, or {@code null} if the date is {@code null} .
- See also: #format(java.util.Date, String), #parseJUDate(String, String, TimeZone), SimpleDateFormat
-
Signature:
@MayReturnNull public static String format(final Calendar calendar) - Summary: Formats the provided calendar into a string representation using the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ).
-
Parameters:
-
calendar(Calendar) — the calendar to be formatted.
-
- Returns: a string representation of the calendar, or {@code null} if the calendar is {@code null} .
- See also: #format(Calendar, String), #format(Calendar, String, TimeZone), #format(java.util.Date)
-
Signature:
@MayReturnNull public static String format(final Calendar calendar, final String format) - Summary: Formats the provided calendar into a string representation using the specified format.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
-
Parameters:
-
calendar(Calendar) — the calendar to be formatted. -
format(String) — the date format pattern; if {@code null} , the default format is used.
-
- Returns: a string representation of the calendar, or {@code null} if the calendar is {@code null} .
- See also: #format(Calendar), #format(Calendar, String, TimeZone), #parseCalendar(String, String)
-
Signature:
@MayReturnNull public static String format(final Calendar calendar, final String format, final TimeZone timeZone) - Summary: Formats the provided calendar into a string representation using the specified format and time zone.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If no time zone is provided, the default time zone is used.
-
Parameters:
-
calendar(Calendar) — the calendar to be formatted. -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used.
-
- Returns: a string representation of the calendar, or {@code null} if the calendar is {@code null} .
- See also: #format(Calendar, String), #format(Calendar), #parseCalendar(String, String, TimeZone)
-
Signature:
@MayReturnNull public static String format(final XMLGregorianCalendar calendar) - Summary: Formats the provided XMLGregorianCalendar instance using the default ISO 8601 format {@code yyyy-MM-dd'T'HH:mm:ss'Z'} .
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} .
-
- Returns: a string representation of the XMLGregorianCalendar instance, or {@code null} if the calendar is {@code null} .
- See also: #format(Calendar), #format(XMLGregorianCalendar, String), #format(XMLGregorianCalendar, String, TimeZone)
-
Signature:
@MayReturnNull public static String format(final XMLGregorianCalendar calendar, final String format) - Summary: Formats the provided XMLGregorianCalendar instance into a string representation using the specified format.
-
Contract:
- If no format is provided, the default format {@code yyyy-MM-dd'T'HH:mm:ss'Z'} is used.
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used.
-
- Returns: a string representation of the XMLGregorianCalendar instance, or {@code null} if the calendar is {@code null} .
- See also: #format(XMLGregorianCalendar), #format(XMLGregorianCalendar, String, TimeZone), #format(Calendar, String)
-
Signature:
@MayReturnNull public static String format(final XMLGregorianCalendar calendar, final String format, final TimeZone timeZone) - Summary: Formats the provided XMLGregorianCalendar instance into a string representation using the specified format and time zone.
-
Contract:
- If no format is provided, the default format {@code yyyy-MM-dd'T'HH:mm:ss'Z'} is used.
- If no time zone is provided, the default time zone of the system is used.
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used.
-
- Returns: a string representation of the XMLGregorianCalendar instance, or {@code null} if the calendar is {@code null} .
- See also: #format(XMLGregorianCalendar), #format(XMLGregorianCalendar, String), #format(Calendar, String, TimeZone)
formatTo(...) -> void
-
Signature:
public static void formatTo(final java.util.Date date, final Appendable appendable) - Summary: Formats the provided date using a default format and appends the result to the specified Appendable.
-
Contract:
- If the date is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to be formatted; may be {@code null} . -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Date), #formatTo(java.util.Date, String, Appendable), #formatTo(java.util.Date, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final java.util.Date date, final String format, final Appendable appendable) - Summary: Formats the provided date into a string representation using the specified format and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} or {@code yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} for Timestamp) is used.
- If the date is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Date, String), #formatTo(java.util.Date, Appendable), #formatTo(java.util.Date, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final java.util.Date date, final String format, final TimeZone timeZone, final Appendable appendable) - Summary: Formats the provided date into a string representation using the specified format and time zone, and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, a default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} or {@code yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} for Timestamp) is used.
- If no time zone is provided, the default time zone is used.
- If the date is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Date, String, TimeZone), #formatTo(java.util.Date, Appendable), #formatTo(java.util.Date, String, Appendable)
-
Signature:
public static void formatTo(final Calendar calendar, final Appendable appendable) - Summary: Formats the provided calendar using the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) and appends the result to the specified Appendable.
-
Contract:
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(Calendar) — the java.util.Calendar instance to be formatted; may be {@code null} . -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Calendar), #formatTo(Calendar, String, Appendable), #formatTo(Calendar, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final Calendar calendar, final String format, final Appendable appendable) - Summary: Formats the provided calendar into a string representation using the specified format and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(Calendar) — the java.util.Calendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Calendar, String), #formatTo(Calendar, Appendable), #formatTo(Calendar, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final Calendar calendar, final String format, final TimeZone timeZone, final Appendable appendable) - Summary: Formats the provided calendar into a string representation using the specified format and time zone, and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If no time zone is provided, the default time zone is used.
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(Calendar) — the java.util.Calendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(java.util.Calendar, String, TimeZone), #formatTo(Calendar, Appendable), #formatTo(Calendar, String, Appendable)
-
Signature:
public static void formatTo(final XMLGregorianCalendar calendar, final Appendable appendable) - Summary: Formats the provided XMLGregorianCalendar using the default ISO 8601 format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) and appends the result to the specified Appendable.
-
Contract:
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} . -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(XMLGregorianCalendar), #formatTo(XMLGregorianCalendar, String, Appendable), #formatTo(XMLGregorianCalendar, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final XMLGregorianCalendar calendar, final String format, final Appendable appendable) - Summary: Formats the provided XMLGregorianCalendar into a string representation using the specified format and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(XMLGregorianCalendar, String), #formatTo(XMLGregorianCalendar, Appendable), #formatTo(XMLGregorianCalendar, String, TimeZone, Appendable)
-
Signature:
public static void formatTo(final XMLGregorianCalendar calendar, final String format, final TimeZone timeZone, final Appendable appendable) - Summary: Formats the provided XMLGregorianCalendar into a string representation using the specified format and time zone, and appends the result to the specified Appendable.
-
Contract:
- If no format is provided, the default format ( {@code yyyy-MM-dd'T'HH:mm:ss'Z'} ) is used.
- If no time zone is provided, the default time zone of the system is used.
- If the calendar is {@code null} , the string "null" is appended to the Appendable.
-
Parameters:
-
calendar(XMLGregorianCalendar) — the XMLGregorianCalendar instance to be formatted; may be {@code null} . -
format(String) — the date format pattern; if {@code null} , the default format is used. -
timeZone(TimeZone) — the time zone for formatting; if {@code null} , the default time zone is used. -
appendable(Appendable) — the Appendable to which the formatted date string is to be appended; must not be {@code null} .
-
- See also: #format(XMLGregorianCalendar, String, TimeZone), #formatTo(XMLGregorianCalendar, Appendable), #formatTo(XMLGregorianCalendar, String, Appendable)
setYears(...) -> T
-
Signature:
public static <T extends java.util.Date> T setYears(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#YEAR, Calendar#set(int, int)
setMonths(...) -> T
-
Signature:
public static <T extends java.util.Date> T setMonths(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#MONTH, Calendar#set(int, int)
setDays(...) -> T
-
Signature:
public static <T extends java.util.Date> T setDays(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#DAY_OF_MONTH, Calendar#set(int, int)
setHours(...) -> T
-
Signature:
public static <T extends java.util.Date> T setHours(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#HOUR_OF_DAY, Calendar#set(int, int)
setMinutes(...) -> T
-
Signature:
public static <T extends java.util.Date> T setMinutes(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#MINUTE, Calendar#set(int, int)
setSeconds(...) -> T
-
Signature:
public static <T extends java.util.Date> T setSeconds(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#SECOND, Calendar#set(int, int)
setMilliseconds(...) -> T
-
Signature:
public static <T extends java.util.Date> T setMilliseconds(final T date, final int amount) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date(T) — the date, not null. -
amount(int) — the amount to set.
-
- Returns: a new {@code Date} set with the specified value.
- See also: Calendar#MILLISECOND, Calendar#set(int, int)
roll(...) -> T
-
Signature:
@Beta public static <T extends java.util.Date> T roll(final T date, final long amount, final TimeUnit unit) throws IllegalArgumentException - Summary: Adds or subtracts the specified amount of time to the given time unit, based on the calendar's rules.
-
Parameters:
-
date(T) — the date to roll, must not be {@code null} . -
amount(long) — the amount of time to add or subtract (negative values subtract). -
unit(TimeUnit) — the time unit to use for rolling.
-
- Returns: a new instance of Date with the specified amount rolled.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is null.
-
- See also: Calendar#set(int, int)
-
Signature:
@Beta public static <T extends java.util.Date> T roll(final T date, final int amount, final CalendarField unit) throws IllegalArgumentException - Summary: Adds or subtracts the specified amount of time to the given calendar unit, based on the calendar's rules.
-
Parameters:
-
date(T) — the date to roll, must not be {@code null} . -
amount(int) — the amount to add or subtract (negative values subtract). -
unit(CalendarField) — the calendar field unit to use for rolling.
-
- Returns: a new instance of Date with the specified amount rolled.
-
Throws:
-
java.lang.IllegalArgumentException— if the date or unit is null.
-
- See also: Calendar#set(int, int)
-
Signature:
@Beta public static <T extends Calendar> T roll(final T calendar, final long amount, final TimeUnit unit) throws IllegalArgumentException - Summary: Adds or subtracts the specified amount of time to the given time unit, based on the calendar's rules.
-
Parameters:
-
calendar(T) — the calendar to roll, must not be {@code null} . -
amount(long) — the amount of time to add or subtract (negative values subtract). -
unit(TimeUnit) — the time unit to use for rolling.
-
- Returns: a new instance of Calendar with the specified amount rolled.
-
Throws:
-
java.lang.IllegalArgumentException— if the calendar or unit is null.
-
- See also: Calendar#set(int, int)
-
Signature:
@Beta public static <T extends Calendar> T roll(final T calendar, final int amount, final CalendarField unit) throws IllegalArgumentException - Summary: Adds or subtracts the specified amount of time to the given calendar unit, based on the calendar's rules.
-
Parameters:
-
calendar(T) — the calendar to roll, must not be {@code null} . -
amount(int) — the amount to add or subtract (negative values subtract). -
unit(CalendarField) — the calendar field unit to use for rolling.
-
- Returns: a new instance of Calendar with the specified amount rolled.
-
Throws:
-
java.lang.IllegalArgumentException— if the calendar or unit is null.
-
- See also: Calendar#set(int, int)
addYears(...) -> T
-
Signature:
public static <T extends java.util.Date> T addYears(final T date, final int amount) - Summary: Adds a number of years to a date returning a new object.
-
Parameters:
-
date(T) — the date to add years to, not null. -
amount(int) — the amount of years to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of years added.
-
Signature:
public static <T extends Calendar> T addYears(final T calendar, final int amount) - Summary: Adds a number of years to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add years to, not null. -
amount(int) — the amount of years to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of years added.
addMonths(...) -> T
-
Signature:
public static <T extends java.util.Date> T addMonths(final T date, final int amount) - Summary: Adds a number of months to a date returning a new object.
-
Parameters:
-
date(T) — the date to add months to, not null. -
amount(int) — the amount of months to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of months added.
-
Signature:
public static <T extends Calendar> T addMonths(final T calendar, final int amount) - Summary: Adds a number of months to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add months to, not null. -
amount(int) — the amount of months to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of months added.
addWeeks(...) -> T
-
Signature:
public static <T extends java.util.Date> T addWeeks(final T date, final int amount) - Summary: Adds a number of weeks to a date returning a new object.
-
Parameters:
-
date(T) — the date to add weeks to, not null. -
amount(int) — the amount of weeks to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of weeks added.
-
Signature:
public static <T extends Calendar> T addWeeks(final T calendar, final int amount) - Summary: Adds a number of weeks to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add weeks to, not null. -
amount(int) — the amount of weeks to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of weeks added.
addDays(...) -> T
-
Signature:
public static <T extends java.util.Date> T addDays(final T date, final int amount) - Summary: Adds a number of days to a date returning a new object.
-
Parameters:
-
date(T) — the date to add days to, not null. -
amount(int) — the amount of days to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of days added.
-
Signature:
public static <T extends Calendar> T addDays(final T calendar, final int amount) - Summary: Adds a number of days to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add days to, not null. -
amount(int) — the amount of days to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of days added.
addHours(...) -> T
-
Signature:
public static <T extends java.util.Date> T addHours(final T date, final int amount) - Summary: Adds a number of hours to a date returning a new object.
-
Parameters:
-
date(T) — the date to add hours to, not null. -
amount(int) — the amount of hours to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of hours added.
-
Signature:
public static <T extends Calendar> T addHours(final T calendar, final int amount) - Summary: Adds a number of hours to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add hours to, not null. -
amount(int) — the amount of hours to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of hours added.
addMinutes(...) -> T
-
Signature:
public static <T extends java.util.Date> T addMinutes(final T date, final int amount) - Summary: Adds a number of minutes to a date returning a new object.
-
Parameters:
-
date(T) — the date to add minutes to, not null. -
amount(int) — the amount of minutes to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of minutes added.
-
Signature:
public static <T extends Calendar> T addMinutes(final T calendar, final int amount) - Summary: Adds a number of minutes to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add minutes to, not null. -
amount(int) — the amount of minutes to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of minutes added.
addSeconds(...) -> T
-
Signature:
public static <T extends java.util.Date> T addSeconds(final T date, final int amount) - Summary: Adds a number of seconds to a date returning a new object.
-
Parameters:
-
date(T) — the date to add seconds to, not null. -
amount(int) — the amount of seconds to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of seconds added.
-
Signature:
public static <T extends Calendar> T addSeconds(final T calendar, final int amount) - Summary: Adds a number of seconds to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add seconds to, not null. -
amount(int) — the amount of seconds to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of seconds added.
addMilliseconds(...) -> T
-
Signature:
public static <T extends java.util.Date> T addMilliseconds(final T date, final int amount) - Summary: Adds a number of milliseconds to a date returning a new object.
-
Parameters:
-
date(T) — the date to add milliseconds to, not null. -
amount(int) — the amount of milliseconds to add, may be negative to subtract.
-
- Returns: a new {@code Date} instance with the specified number of milliseconds added.
-
Signature:
public static <T extends Calendar> T addMilliseconds(final T calendar, final int amount) - Summary: Adds a number of milliseconds to a calendar returning a new object.
-
Parameters:
-
calendar(T) — the calendar to add milliseconds to, not null. -
amount(int) — the amount of milliseconds to add, may be negative to subtract.
-
- Returns: a new {@code Calendar} instance with the specified number of milliseconds added.
round(...) -> T
-
Signature:
public static <T extends java.util.Date> T round(final T date, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 April 2002 0:00:00.000.
-
Parameters:
-
date(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new date object of type T, rounded to the nearest whole unit as specified by the field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is null.
-
-
Signature:
public static <T extends java.util.Date> T round(final T date, final CalendarField field) - Summary: Rounds the given date to the nearest whole unit as specified by the CalendarField.
-
Contract:
- <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR_OF_DAY, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 April 2002 0:00:00.000.
-
Parameters:
-
date(T) — the date to be rounded. Must not be {@code null} . -
field(CalendarField) — the CalendarField to which the date is to be rounded. Must not be {@code null} .
-
- Returns: a new date object of type T, rounded to the nearest whole unit as specified by the field.
-
Signature:
public static <T extends Calendar> T round(final T calendar, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 April 2002 0:00:00.000.
-
Parameters:
-
calendar(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new calendar object of type T, rounded to the nearest whole unit as specified by the field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
-
Signature:
public static <T extends Calendar> T round(final T calendar, final CalendarField field) - Summary: Rounds the given calendar to the nearest whole unit as specified by the CalendarField.
-
Contract:
- <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR_OF_DAY, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 April 2002 0:00:00.000.
-
Parameters:
-
calendar(T) — the calendar to be rounded. Must not be {@code null} . -
field(CalendarField) — the CalendarField to which the calendar is to be rounded. Must not be {@code null} .
-
- Returns: a new calendar object of type T, rounded to the nearest whole unit as specified by the field.
truncate(...) -> T
-
Signature:
public static <T extends java.util.Date> T truncate(final T date, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 13:00:00.000.
- If this was passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
-
Parameters:
-
date(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new date object of type T, truncated to the specified field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
-
Signature:
public static <T extends java.util.Date> T truncate(final T date, final CalendarField field) - Summary: Truncates the given date, leaving the field specified as the most significant field.
-
Contract:
- <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR_OF_DAY, it would return 28 Mar 2002 13:00:00.000.
- If this was passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
-
Parameters:
-
date(T) — the date to be truncated. Must not be {@code null} . -
field(CalendarField) — the CalendarField to which the date is to be truncated. Must not be {@code null} .
-
- Returns: a new date object of type T, truncated to the specified field.
-
Signature:
public static <T extends Calendar> T truncate(final T calendar, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 13:00:00.000.
- If this was passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
-
Parameters:
-
calendar(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new calendar object of type T, truncated to the specified field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
-
Signature:
public static <T extends Calendar> T truncate(final T calendar, final CalendarField field) - Summary: Truncates the given calendar, leaving the field specified as the most significant field.
-
Contract:
- <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR_OF_DAY, it would return 28 Mar 2002 13:00:00.000.
- If this was passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
-
Parameters:
-
calendar(T) — the calendar to be truncated. Must not be {@code null} . -
field(CalendarField) — the CalendarField to which the calendar is to be truncated. Must not be {@code null} .
-
- Returns: a new calendar object of type T, truncated to the specified field.
ceiling(...) -> T
-
Signature:
public static <T extends java.util.Date> T ceiling(final T date, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 Apr 2002 0:00:00.000.
-
Parameters:
-
date(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new date object of type T, adjusted to the ceiling of the specified field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
-
Signature:
public static <T extends java.util.Date> T ceiling(final T date, final CalendarField field) - Summary: Returns a new date object of the same type as the input, but adjusted to the nearest future unit as specified by the CalendarField.
-
Parameters:
-
date(T) — the date to be adjusted. Must not be {@code null} . -
field(CalendarField) — the CalendarField to which the date is to be adjusted. Must not be {@code null} .
-
- Returns: a new date object of type T, adjusted to the nearest future unit as specified by the field.
-
Signature:
public static <T extends Calendar> T ceiling(final T calendar, final int field) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- </p> <p> For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000.
- If this was passed with MONTH, it would return 1 Apr 2002 0:00:00.000.
-
Parameters:
-
calendar(T) — the date to work with, not null. -
field(int) — the field from {@code Calendar} or {@code SEMI_MONTH} .
-
- Returns: a new calendar object of type T, adjusted to the ceiling of the specified field.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
-
Signature:
public static <T extends Calendar> T ceiling(final T calendar, final CalendarField field) - Summary: Adjusts the given calendar to the ceiling of the specified field.
-
Parameters:
-
calendar(T) — the original calendar object to be adjusted. -
field(CalendarField) — the field to be used for the ceiling operation, as a CalendarField.
-
- Returns: a new calendar object representing the adjusted time.
truncatedEquals(...) -> boolean
-
Signature:
public static boolean truncatedEquals(final Calendar cal1, final Calendar cal2, final CalendarField field) - Summary: Determines if two calendars are equal up to no more than the specified most significant field.
-
Contract:
- Determines if two calendars are equal up to no more than the specified most significant field.
-
Parameters:
-
cal1(Calendar) — the first calendar, not null. -
cal2(Calendar) — the second calendar, not null. -
field(CalendarField) — the field from {@code CalendarField} to be the most significant field for comparison.
-
- Returns: {@code true} if cal1 and cal2 are equal up to the specified field; {@code false} otherwise.
-
Signature:
public static boolean truncatedEquals(final Calendar cal1, final Calendar cal2, final int field) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> Determines if two calendars are equal up to no more than the specified most significant field.
-
Parameters:
-
cal1(Calendar) — the first calendar, not {@code null} . -
cal2(Calendar) — the second calendar, not {@code null} . -
field(int) — the field from {@code Calendar} .
-
- Returns: {@code true} if equal; otherwise {@code false} .
- See also: #truncate(Calendar, int), #truncatedEquals(java.util.Date, java.util.Date, int)
-
Signature:
public static boolean truncatedEquals(final java.util.Date date1, final java.util.Date date2, final CalendarField field) - Summary: Determines if two dates are equal up to no more than the specified most significant field.
-
Contract:
- Determines if two dates are equal up to no more than the specified most significant field.
-
Parameters:
-
date1(java.util.Date) — the first date, not {@code null} . -
date2(java.util.Date) — the second date, not {@code null} . -
field(CalendarField) — the field from {@code CalendarField} to be the most significant field for comparison.
-
- Returns: {@code true} if date1 and date2 are equal up to the specified field; {@code false} otherwise.
-
Signature:
public static boolean truncatedEquals(final java.util.Date date1, final java.util.Date date2, final int field) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> Determines if two dates are equal up to no more than the specified most significant field.
-
Parameters:
-
date1(java.util.Date) — the first date, not {@code null} . -
date2(java.util.Date) — the second date, not {@code null} . -
field(int) — the field from {@code Calendar} .
-
- Returns: {@code true} if equal; otherwise {@code false} .
- See also: #truncate(java.util.Date, int), #truncatedEquals(Calendar, Calendar, int)
truncatedCompareTo(...) -> int
-
Signature:
public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final CalendarField field) - Summary: Compares two Calendar instances up to the specified field.
-
Parameters:
-
cal1(Calendar) — the first Calendar instance to be compared, not {@code null} . -
cal2(Calendar) — the second Calendar instance to be compared, not {@code null} . -
field(CalendarField) — the field from {@code CalendarField} to be the most significant field for comparison.
-
- Returns: a negative integer, zero, or a positive integer as the first Calendar is less than, equal to, or greater than the second.
-
Signature:
public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
cal1(Calendar) — the first calendar, not {@code null} . -
cal2(Calendar) — the second calendar, not {@code null} . -
field(int) — the field from {@code Calendar} .
-
- Returns: a negative integer, zero, or a positive integer as the first. calendar is less than, equal to, or greater than the second.
- See also: #truncate(Calendar, int), #truncatedCompareTo(java.util.Date, java.util.Date, int)
-
Signature:
public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final CalendarField field) - Summary: Compares two Date instances up to the specified field.
-
Parameters:
-
date1(java.util.Date) — the first Date instance to be compared, not {@code null} . -
date2(java.util.Date) — the second Date instance to be compared, not {@code null} . -
field(CalendarField) — the field from {@code CalendarField} to be the most significant field for comparison.
-
- Returns: a negative integer, zero, or a positive integer as the first Date is less than, equal to, or greater than the second.
-
Signature:
public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final int field) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Parameters:
-
date1(java.util.Date) — the first date, not {@code null} . -
date2(java.util.Date) — the second date, not {@code null} . -
field(int) — the field from {@code Calendar} .
-
- Returns: a negative integer, zero, or a positive integer as the first. date is less than, equal to, or greater than the second.
- See also: #truncate(Calendar, int), #truncatedCompareTo(java.util.Date, java.util.Date, int)
getFragmentInMilliseconds(...) -> long
-
Signature:
public static long getFragmentInMilliseconds(final java.util.Date date, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of milliseconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR.
-
Parameters:
-
date(java.util.Date) — the date to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of date to calculate.
-
- Returns: number of milliseconds within the fragment of date.
-
Signature:
public static long getFragmentInMilliseconds(final Calendar calendar, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR.
-
Parameters:
-
calendar(Calendar) — the calendar to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of calendar to calculate.
-
- Returns: number of milliseconds within the fragment of date.
getFragmentInSeconds(...) -> long
-
Signature:
public static long getFragmentInSeconds(final java.util.Date date, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR.
-
Parameters:
-
date(java.util.Date) — the date to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of date to calculate.
-
- Returns: number of seconds within the fragment of date.
-
Signature:
public static long getFragmentInSeconds(final Calendar calendar, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR.
-
Parameters:
-
calendar(Calendar) — the calendar to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of calendar to calculate.
-
- Returns: number of seconds within the fragment of date.
getFragmentInMinutes(...) -> long
-
Signature:
public static long getFragmentInMinutes(final java.util.Date date, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of minutes past this month, your fragment is Calendar.MONTH.
-
Parameters:
-
date(java.util.Date) — the date to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of date to calculate.
-
- Returns: number of minutes within the fragment of date.
-
Signature:
public static long getFragmentInMinutes(final Calendar calendar, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of minutes past this month, your fragment is Calendar.MONTH.
-
Parameters:
-
calendar(Calendar) — the calendar to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of calendar to calculate.
-
- Returns: number of minutes within the fragment of date.
getFragmentInHours(...) -> long
-
Signature:
public static long getFragmentInHours(final java.util.Date date, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of hours past this month, your fragment is Calendar.MONTH.
-
Parameters:
-
date(java.util.Date) — the date to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of date to calculate.
-
- Returns: number of hours within the fragment of date.
-
Signature:
public static long getFragmentInHours(final Calendar calendar, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of hours past this month, your fragment is Calendar.MONTH.
-
Parameters:
-
calendar(Calendar) — the calendar to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of calendar to calculate.
-
- Returns: number of hours within the fragment of date.
getFragmentInDays(...) -> long
-
Signature:
public static long getFragmentInDays(final java.util.Date date, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of days past this year, your fragment is Calendar.YEAR.
-
Parameters:
-
date(java.util.Date) — the date to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of date to calculate.
-
- Returns: number of days within the fragment of date.
-
Signature:
public static long getFragmentInDays(final Calendar calendar, final CalendarField fragment) - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- For example, if you want to calculate the number of days past this year, your fragment is Calendar.YEAR.
-
Parameters:
-
calendar(Calendar) — the calendar to work with, not null. -
fragment(CalendarField) — the {@code Calendar} field part of calendar to calculate.
-
- Returns: number of days within the fragment of date.
isSameDay(...) -> boolean
-
Signature:
public static boolean isSameDay(final java.util.Date date1, final java.util.Date date2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two date objects are on the same day ignoring time.
-
Parameters:
-
date1(java.util.Date) — the first date, not altered, not null. -
date2(java.util.Date) — the second date, not altered, not null.
-
- Returns: {@code true} if they represent the same day.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
-
Signature:
public static boolean isSameDay(final Calendar cal1, final Calendar cal2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two calendar objects are on the same day ignoring time.
-
Parameters:
-
cal1(Calendar) — the first calendar, not altered, not null. -
cal2(Calendar) — the second calendar, not altered, not null.
-
- Returns: {@code true} if they represent the same day.
-
Throws:
-
java.lang.IllegalArgumentException— if either calendar is {@code null} .
-
- See also: #isSameDay(java.util.Date, java.util.Date)
isSameMonth(...) -> boolean
-
Signature:
public static boolean isSameMonth(final java.util.Date date1, final java.util.Date date2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two date objects are in the same month ignoring day and time.
-
Parameters:
-
date1(java.util.Date) — the first date, not altered, not null. -
date2(java.util.Date) — the second date, not altered, not null.
-
- Returns: {@code true} if they represent the same month of the same year.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
-
Signature:
public static boolean isSameMonth(final Calendar cal1, final Calendar cal2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two calendar objects are in the same month ignoring day and time.
-
Parameters:
-
cal1(Calendar) — the first calendar, not altered, not null. -
cal2(Calendar) — the second calendar, not altered, not null.
-
- Returns: {@code true} if they represent the same month of the same year.
-
Throws:
-
java.lang.IllegalArgumentException— if either calendar is {@code null} .
-
isSameYear(...) -> boolean
-
Signature:
public static boolean isSameYear(final java.util.Date date1, final java.util.Date date2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two date objects are in the same year ignoring month, day and time.
-
Parameters:
-
date1(java.util.Date) — the first date, not altered, not null. -
date2(java.util.Date) — the second date, not altered, not null.
-
- Returns: {@code true} if they represent the same year.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
-
Signature:
public static boolean isSameYear(final Calendar cal1, final Calendar cal2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two calendar objects are in the same year ignoring month, day and time.
-
Parameters:
-
cal1(Calendar) — the first calendar, not altered, not null. -
cal2(Calendar) — the second calendar, not altered, not null.
-
- Returns: {@code true} if they represent the same year.
-
Throws:
-
java.lang.IllegalArgumentException— if either calendar is {@code null} .
-
isSameInstant(...) -> boolean
-
Signature:
public static boolean isSameInstant(final java.util.Date date1, final java.util.Date date2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two date objects represent the same instant in time.
-
Parameters:
-
date1(java.util.Date) — the first date, not altered, not null. -
date2(java.util.Date) — the second date, not altered, not null.
-
- Returns: {@code true} if they represent the same millisecond instant.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
- See also: #isSameInstant(Calendar, Calendar)
-
Signature:
public static boolean isSameInstant(final Calendar cal1, final Calendar cal2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two calendar objects represent the same instant in time.
-
Parameters:
-
cal1(Calendar) — the first calendar, not altered, not null. -
cal2(Calendar) — the second calendar, not altered, not null.
-
- Returns: {@code true} if they represent the same millisecond instant.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
isSameLocalTime(...) -> boolean
-
Signature:
public static boolean isSameLocalTime(final Calendar cal1, final Calendar cal2) throws IllegalArgumentException - Summary: Copied from Apache Commons Lang under Apache License v2.
-
Contract:
- <br/> <p> Checks if two calendar objects represent the same local time.
- In addition, both calendars must be the same of the same type.
-
Parameters:
-
cal1(Calendar) — the first calendar, not altered, not null. -
cal2(Calendar) — the second calendar, not altered, not null.
-
- Returns: {@code true} if they represent the same local time.
-
Throws:
-
java.lang.IllegalArgumentException— if either date is {@code null} .
-
isLastDateOfMonth(...) -> boolean
-
Signature:
public static boolean isLastDateOfMonth(final java.util.Date date) throws IllegalArgumentException - Summary: Checks if the provided date is the last date of its month.
-
Contract:
- Checks if the provided date is the last date of its month.
-
Parameters:
-
date(java.util.Date) — the date to check. Must not be {@code null} .
-
- Returns: {@code true} if the provided date is the last date of its month.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
isLastDateOfYear(...) -> boolean
-
Signature:
public static boolean isLastDateOfYear(final java.util.Date date) throws IllegalArgumentException - Summary: Checks if the provided date is the last date of its year.
-
Contract:
- Checks if the provided date is the last date of its year.
-
Parameters:
-
date(java.util.Date) — the date to check. Must not be {@code null} .
-
- Returns: {@code true} if the provided date is the last date of its year.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
getLastDayOfMonth(...) -> int
-
Signature:
public static int getLastDayOfMonth(final java.util.Date date) throws IllegalArgumentException - Summary: Returns the last day of the month for the given date.
-
Parameters:
-
date(java.util.Date) — the date to be evaluated. Must not be {@code null} .
-
- Returns: the last day of the month for the given date as an integer.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
getLastDayOfYear(...) -> int
-
Signature:
public static int getLastDayOfYear(final java.util.Date date) throws IllegalArgumentException - Summary: Returns the last day of the year for the given date.
-
Parameters:
-
date(java.util.Date) — the date to be evaluated. Must not be {@code null} .
-
- Returns: the last day of the year for the given date as an integer.
-
Throws:
-
java.lang.IllegalArgumentException— if the date is {@code null} .
-
isOverlapping(...) -> boolean
-
Signature:
public static boolean isOverlapping(java.util.Date startTimeOne, java.util.Date endTimeOne, java.util.Date startTimeTwo, java.util.Date endTimeTwo) - Summary: Checks if two date ranges overlap.
-
Contract:
- Checks if two date ranges overlap.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Check if two date ranges overlap java.util.Date start1 = Dates.parse("2023-01-01"); java.util.Date end1 = Dates.parse("2023-01-10"); java.util.Date start2 = Dates.parse("2023-01-05"); java.util.Date end2 = Dates.parse("2023-01-15"); boolean overlaps = Dates.isOverlapping(start1, end1, start2, end2); // Result: true (ranges overlap from Jan 5 to Jan 10) // Example 2: Check non-overlapping ranges java.util.Date start1 = Dates.parse("2023-01-01"); java.util.Date end1 = Dates.parse("2023-01-10"); java.util.Date start2 = Dates.parse("2023-01-15"); java.util.Date end2 = Dates.parse("2023-01-20"); boolean overlaps = Dates.isOverlapping(start1, end1, start2, end2); // Result: false (no overlap, there's a gap) // Example 3: Check adjacent ranges (touching but not overlapping) java.util.Date start1 = Dates.parse("2023-01-01"); java.util.Date end1 = Dates.parse("2023-01-10"); java.util.Date start2 = Dates.parse("2023-01-10"); java.util.Date end2 = Dates.parse("2023-01-20"); boolean overlaps = Dates.isOverlapping(start1, end1, start2, end2); // Result: false (ranges are adjacent but don't overlap) } </pre>
-
Parameters:
-
startTimeOne(java.util.Date) — Start time of the first range. Must not be {@code null} . -
endTimeOne(java.util.Date) — End time of the first range. Must not be {@code null} . -
startTimeTwo(java.util.Date) — Start time of the second range. Must not be {@code null} . -
endTimeTwo(java.util.Date) — End time of the second range. Must not be {@code null} .
-
- Returns: {@code true} if the two date ranges overlap.
- See also: #isBetween(java.util.Date, java.util.Date, java.util.Date)
isBetween(...) -> boolean
-
Signature:
@Beta public static boolean isBetween(java.util.Date date, java.util.Date startDate, java.util.Date endDate) - Summary: Checks if the given date is between the specified start date and end date, inclusive.
-
Contract:
- Checks if the given date is between the specified start date and end date, inclusive.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Check if a date is within a range (inclusive) java.util.Date checkDate = Dates.parse("2023-01-15"); java.util.Date startDate = Dates.parse("2023-01-01"); java.util.Date endDate = Dates.parse("2023-01-31"); boolean isWithin = Dates.isBetween(checkDate, startDate, endDate); // Result: true (Jan 15 is between Jan 1 and Jan 31) // Example 2: Check boundary dates (inclusive) java.util.Date checkDate = Dates.parse("2023-01-01"); java.util.Date startDate = Dates.parse("2023-01-01"); java.util.Date endDate = Dates.parse("2023-01-31"); boolean isWithin = Dates.isBetween(checkDate, startDate, endDate); // Result: true (boundary dates are included) // Example 3: Check date outside the range java.util.Date checkDate = Dates.parse("2023-02-15"); java.util.Date startDate = Dates.parse("2023-01-01"); java.util.Date endDate = Dates.parse("2023-01-31"); boolean isWithin = Dates.isBetween(checkDate, startDate, endDate); // Result: false (Feb 15 is after Jan 31) // Example 4: Validate if an event date falls within a campaign period java.util.Date eventDate = Dates.parse("2023-12-25"); java.util.Date campaignStart = Dates.parse("2023-12-01"); java.util.Date campaignEnd = Dates.parse("2023-12-31"); if (Dates.isBetween(eventDate, campaignStart, campaignEnd)) { // Event is within campaign period } } </pre>
-
Parameters:
-
date(java.util.Date) — the date to check. Must not be {@code null} . -
startDate(java.util.Date) — the start time of the range. Must not be {@code null} . -
endDate(java.util.Date) — the end time of the range. Must not be {@code null} .
-
- Returns: {@code true} if the date is within the specified range.
- See also: N#geAndLe(Comparable, Comparable, Comparable), N#gtAndLt(Comparable, Comparable, Comparable)
Public Instance Methods
- (none)
Class DTF (com.landawn.abacus.util.Dates.DTF)
A comprehensive utility class providing date/time formatter constants and operations for modern Java 8+ time types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
format(...) -> String
-
Signature:
@MayReturnNull public String format(final java.util.Date date) - Summary: Formats the provided java.util.Date instance into a string representation.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to format.
-
- Returns: a string representation of the provided java.util.Date instance.
- See also: DateTimeFormatter#format(TemporalAccessor)
-
Signature:
@MayReturnNull public String format(final java.util.Calendar calendar) - Summary: Formats the provided java.util.Calendar instance into a string representation.
-
Parameters:
-
calendar(java.util.Calendar) — the java.util.Calendar instance to format.
-
- Returns: a string representation of the provided java.util.Calendar instance.
- See also: DateTimeFormatter#format(TemporalAccessor)
-
Signature:
@MayReturnNull public String format(final TemporalAccessor temporal) - Summary: Formats the provided TemporalAccessor instance into a string representation.
-
Parameters:
-
temporal(TemporalAccessor) — the TemporalAccessor instance to format.
-
- Returns: a string representation of the provided TemporalAccessor instance.
- See also: DateTimeFormatter#format(TemporalAccessor)
formatTo(...) -> void
-
Signature:
@MayReturnNull public void formatTo(final java.util.Date date, final Appendable appendable) - Summary: Formats the provided java.util.Date instance into a string representation and appends it to the provided Appendable.
-
Parameters:
-
date(java.util.Date) — the java.util.Date instance to format. -
appendable(Appendable) — the Appendable to which the formatted string will be appended.
-
- See also: DateTimeFormatter#formatTo(TemporalAccessor, Appendable)
-
Signature:
@MayReturnNull public void formatTo(final java.util.Calendar calendar, final Appendable appendable) - Summary: Formats the provided java.util.Calendar instance into a string representation and appends it to the provided Appendable.
-
Parameters:
-
calendar(java.util.Calendar) — the java.util.Calendar instance to format. -
appendable(Appendable) — the Appendable to which the formatted string will be appended.
-
- See also: DateTimeFormatter#formatTo(TemporalAccessor, Appendable)
-
Signature:
@MayReturnNull public void formatTo(final TemporalAccessor temporal, final Appendable appendable) - Summary: Formats the provided TemporalAccessor instance into a string representation and appends it to the provided Appendable.
-
Parameters:
-
temporal(TemporalAccessor) — the TemporalAccessor instance to format. -
appendable(Appendable) — the Appendable to which the formatted string will be appended.
-
- See also: DateTimeFormatter#formatTo(TemporalAccessor, Appendable)
parseToLocalDate(...) -> LocalDate
-
Signature:
@MayReturnNull public LocalDate parseToLocalDate(final CharSequence text) - Summary: Parses the provided CharSequence into a LocalDate instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a LocalDate instance representing the parsed date.
- See also: Instant#ofEpochMilli(long), LocalDate#ofInstant(Instant, ZoneId), LocalDate#from(TemporalAccessor)
parseToLocalTime(...) -> LocalTime
-
Signature:
@MayReturnNull public LocalTime parseToLocalTime(final CharSequence text) - Summary: Parses the provided CharSequence into a LocalTime instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a LocalTime instance representing the parsed time.
- See also: Instant#ofEpochMilli(long), LocalTime#ofInstant(Instant, ZoneId), LocalTime#from(TemporalAccessor)
parseToLocalDateTime(...) -> LocalDateTime
-
Signature:
@MayReturnNull public LocalDateTime parseToLocalDateTime(final CharSequence text) - Summary: Parses the provided CharSequence into a LocalDateTime instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a LocalDateTime instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), LocalDateTime#ofInstant(Instant, ZoneId), LocalDateTime#from(TemporalAccessor)
parseToOffsetDateTime(...) -> OffsetDateTime
-
Signature:
@MayReturnNull public OffsetDateTime parseToOffsetDateTime(final CharSequence text) - Summary: Parses the provided CharSequence into an OffsetDateTime instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: an OffsetDateTime instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), OffsetDateTime#ofInstant(Instant, ZoneId), OffsetDateTime#from(TemporalAccessor)
parseToZonedDateTime(...) -> ZonedDateTime
-
Signature:
@MayReturnNull public ZonedDateTime parseToZonedDateTime(final CharSequence text) - Summary: Parses the provided CharSequence into a ZonedDateTime instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a ZonedDateTime instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), OffsetDateTime#ofInstant(Instant, ZoneId), OffsetDateTime#from(TemporalAccessor)
parseToInstant(...) -> Instant
-
Signature:
@MayReturnNull public Instant parseToInstant(final CharSequence text) - Summary: Parses the provided CharSequence into an Instant instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: an Instant instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), Instant#from(TemporalAccessor)
parseToJUDate(...) -> java.util.Date
-
Signature:
@MayReturnNull public java.util.Date parseToJUDate(final CharSequence text) - Summary: Parses the provided CharSequence into a java.util.Date instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a java.util.Date instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.util.Date#from(Instant)
-
Signature:
@MayReturnNull public java.util.Date parseToJUDate(final CharSequence text, final TimeZone tz) - Summary: Parses the provided CharSequence into a java.util.Date instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} . -
tz(TimeZone) — the time zone to use for parsing the date and time.
-
- Returns: a java.util.Date instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.util.Date#from(Instant)
parseToDate(...) -> java.sql.Date
-
Signature:
@MayReturnNull public java.sql.Date parseToDate(final CharSequence text) - Summary: Parses the provided CharSequence into a java.sql.Date instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a java.sql.Date instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Date#from(Instant)
-
Signature:
@MayReturnNull public java.sql.Date parseToDate(final CharSequence text, final TimeZone tz) - Summary: Parses the provided CharSequence into a java.sql.Date instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} . -
tz(TimeZone) — the time zone to use for parsing the date and time.
-
- Returns: a java.sql.Date instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Date#from(Instant)
parseToTime(...) -> Time
-
Signature:
@MayReturnNull public Time parseToTime(final CharSequence text) - Summary: Parses the provided CharSequence into a java.sql.Time instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a java.sql.Time instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Time#from(Instant)
-
Signature:
@MayReturnNull public Time parseToTime(final CharSequence text, final TimeZone tz) - Summary: Parses the provided CharSequence into a java.sql.Time instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} . -
tz(TimeZone) — the time zone to use for parsing the date and time.
-
- Returns: a java.sql.Time instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Time#from(Instant)
parseToTimestamp(...) -> Timestamp
-
Signature:
@MayReturnNull public Timestamp parseToTimestamp(final CharSequence text) - Summary: Parses the provided CharSequence into a java.sql.Timestamp instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a java.sql.Timestamp instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Timestamp#from(Instant)
-
Signature:
@MayReturnNull public Timestamp parseToTimestamp(final CharSequence text, final TimeZone tz) - Summary: Parses the provided CharSequence into a java.sql.Timestamp instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} . -
tz(TimeZone) — the time zone to use for parsing the date and time.
-
- Returns: a java.sql.Timestamp instance representing the parsed date and time.
- See also: Instant#ofEpochMilli(long), java.sql.Timestamp#from(Instant)
parseToCalendar(...) -> Calendar
-
Signature:
@MayReturnNull public Calendar parseToCalendar(final CharSequence text) - Summary: Parses the provided CharSequence into a java.util.Calendar instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} .
-
- Returns: a java.util.Calendar instance representing the parsed date and time.
-
Signature:
@MayReturnNull public Calendar parseToCalendar(final CharSequence text, final TimeZone tz) - Summary: Parses the provided CharSequence into a java.util.Calendar instance.
-
Parameters:
-
text(CharSequence) — the CharSequence to parse. Must not be {@code null} . -
tz(TimeZone) — the time zone to use for parsing the date and time.
-
- Returns: a java.util.Calendar instance representing the parsed date and time.
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DateUtil (com.landawn.abacus.util.Dates.DateUtil)
The Class DateUtil.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Enum DayOfWeek (com.landawn.abacus.util.DayOfWeek)
Represents the days of the week as an enumeration with associated integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> DayOfWeek
-
Signature:
public static DayOfWeek valueOf(final int intValue) - Summary: Returns the DayOfWeek enum constant associated with the specified integer value.
-
Parameters:
-
intValue(int) — the integer value to convert (must be 0-6)
-
- Returns: the corresponding DayOfWeek enum constant
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this day of the week.
-
Parameters:
- (none)
- Returns: the integer value of this day (0 for Sunday through 6 for Saturday)
Class Difference (com.landawn.abacus.util.Difference)
A utility class for comparing two collections, arrays, maps, or beans to identify their differences.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Difference<BooleanList, BooleanList>
-
Signature:
public static Difference<BooleanList, BooleanList> of(final boolean[] a, final boolean[] b) - Summary: Compares two boolean arrays and identifies the differences between them.
-
Contract:
- For example, if {@code true} appears twice in the first array and once in the second array, the result will have one {@code true} in common and one {@code true} in left only.
-
Parameters:
-
a(boolean[]) — the first boolean array to compare. Can be {@code null} , which is treated as an empty array. -
b(boolean[]) — the second boolean array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code BooleanList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<CharList, CharList> of(final char[] a, final char[] b) - Summary: Compares two char arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 'a'} appears twice in the first array and once in the second array, the result will have one {@code 'a'} in common and one {@code 'a'} in left only.
-
Parameters:
-
a(char[]) — the first char array to compare. Can be {@code null} , which is treated as an empty array. -
b(char[]) — the second char array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code CharList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<ByteList, ByteList> of(final byte[] a, final byte[] b) - Summary: Compares two byte arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(byte[]) — the first byte array to compare. Can be {@code null} , which is treated as an empty array. -
b(byte[]) — the second byte array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code ByteList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<ShortList, ShortList> of(final short[] a, final short[] b) - Summary: Compares two short arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(short[]) — the first short array to compare. Can be {@code null} , which is treated as an empty array. -
b(short[]) — the second short array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code ShortList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<IntList, IntList> of(final int[] a, final int[] b) - Summary: Compares two int arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(int[]) — the first int array to compare. Can be {@code null} , which is treated as an empty array. -
b(int[]) — the second int array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code IntList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<LongList, LongList> of(final long[] a, final long[] b) - Summary: Compares two long arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(long[]) — the first long array to compare. Can be {@code null} , which is treated as an empty array. -
b(long[]) — the second long array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code LongList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<FloatList, FloatList> of(final float[] a, final float[] b) - Summary: Compares two float arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(float[]) — the first float array to compare. Can be {@code null} , which is treated as an empty array. -
b(float[]) — the second float array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code FloatList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<DoubleList, DoubleList> of(final double[] a, final double[] b) - Summary: Compares two double arrays and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first array and once in the second array, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(double[]) — the first double array to compare. Can be {@code null} , which is treated as an empty array. -
b(double[]) — the second double array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing {@code DoubleList} instances for common elements, elements only in the first array, and elements only in the second array.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static <T1, T2, L extends List<T1>, R extends List<T2>> Difference<L, R> of(final T1[] a, final T2[] b) - Summary: Compares two object arrays and identifies the differences between them.
-
Contract:
- For example, if {@code "apple"} appears twice in the first array and once in the second array, the result will have one {@code "apple"} in common and one {@code "apple"} in left only.
-
Parameters:
-
a(T1[]) — the first array to compare. Can be {@code null} , which is treated as an empty array. -
b(T2[]) — the second array to compare. Can be {@code null} , which is treated as an empty array.
-
- Returns: a {@code Difference} object containing lists of common elements (type L), elements only in the first array (type L), and elements only in the second array (type R).
- See also: IntList#difference(IntList), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
@SuppressWarnings("unlikely-arg-type") public static <T1, T2, L extends List<T1>, R extends List<T2>> Difference<L, R> of(final Collection<? extends T1> a, final Collection<? extends T2> b) - Summary: Compares two collections and identifies the differences between them.
-
Contract:
- For example, if {@code "apple"} appears twice in the first collection and once in the second collection, the result will have one {@code "apple"} in common and one {@code "apple"} in left only.
-
Parameters:
-
a(Collection<? extends T1>) — the first collection to compare. Can be {@code null} or empty. -
b(Collection<? extends T2>) — the second collection to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing lists of common elements (type L), elements only in the first collection (type L), and elements only in the second collection (type R).
- See also: IntList#difference(IntList), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
public static Difference<BooleanList, BooleanList> of(final BooleanList a, final BooleanList b) - Summary: Compares two BooleanLists and identifies the differences between them.
-
Contract:
- For example, if {@code true} appears twice in the first list and once in the second list, the result will have one {@code true} in common and one {@code true} in left only.
-
Parameters:
-
a(BooleanList) — the first BooleanList to compare. Can be {@code null} or empty. -
b(BooleanList) — the second BooleanList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing BooleanLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<CharList, CharList> of(final CharList a, final CharList b) - Summary: Compares two CharLists and identifies the differences between them.
-
Contract:
- For example, if {@code 'a'} appears twice in the first list and once in the second list, the result will have one {@code 'a'} in common and one {@code 'a'} in left only.
-
Parameters:
-
a(CharList) — the first CharList to compare. Can be {@code null} or empty. -
b(CharList) — the second CharList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing CharLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<ByteList, ByteList> of(final ByteList a, final ByteList b) - Summary: Compares two ByteLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(ByteList) — the first ByteList to compare. Can be {@code null} or empty. -
b(ByteList) — the second ByteList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing ByteLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<ShortList, ShortList> of(final ShortList a, final ShortList b) - Summary: Compares two ShortLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(ShortList) — the first ShortList to compare. Can be {@code null} or empty. -
b(ShortList) — the second ShortList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing ShortLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<IntList, IntList> of(final IntList a, final IntList b) - Summary: Compares two IntLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(IntList) — the first IntList to compare. Can be {@code null} or empty. -
b(IntList) — the second IntList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing IntLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<LongList, LongList> of(final LongList a, final LongList b) - Summary: Compares two LongLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(LongList) — the first LongList to compare. Can be {@code null} or empty. -
b(LongList) — the second LongList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing LongLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<FloatList, FloatList> of(final FloatList a, final FloatList b) - Summary: Compares two FloatLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(FloatList) — the first FloatList to compare. Can be {@code null} or empty. -
b(FloatList) — the second FloatList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing FloatLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
-
Signature:
public static Difference<DoubleList, DoubleList> of(final DoubleList a, final DoubleList b) - Summary: Compares two DoubleLists and identifies the differences between them.
-
Contract:
- For example, if {@code 1} appears twice in the first list and once in the second list, the result will have one {@code 1} in common and one {@code 1} in left only.
-
Parameters:
-
a(DoubleList) — the first DoubleList to compare. Can be {@code null} or empty. -
b(DoubleList) — the second DoubleList to compare. Can be {@code null} or empty.
-
- Returns: a {@code Difference} object containing DoubleLists for common elements, elements only in the first list, and elements only in the second list.
- See also: IntList#difference(IntList), N#difference(Collection, Collection)
Public Instance Methods
common(...) -> L
-
Signature:
public L common() - Summary: Returns the elements that are common to both collections/arrays.
-
Contract:
- For example, if an element appears 3 times in the first collection and 2 times in the second, it will appear 2 times in the common elements.
-
Parameters:
- (none)
- Returns: a collection containing the common elements. The type L is typically a List or similar collection.
onlyOnLeft(...) -> L
-
Signature:
public L onlyOnLeft() - Summary: Returns the elements that exist only in the left (first) collection/array.
-
Contract:
- For example, if an element appears 5 times in the first collection and 2 times in the second collection, it will appear 3 times in the left-only elements.
-
Parameters:
- (none)
- Returns: a collection containing elements only in the left collection. The type L is typically a List or similar collection.
onlyOnRight(...) -> R
-
Signature:
public R onlyOnRight() - Summary: Returns the elements that exist only in the right (second) collection/array.
-
Contract:
- For example, if an element appears 2 times in the first collection and 5 times in the second collection, it will appear 3 times in the right-only elements.
-
Parameters:
- (none)
- Returns: a collection containing elements only in the right collection. The type R is typically a List or similar collection.
areEqual(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") public boolean areEqual() - Summary: Checks whether the two compared collections/arrays contain exactly the same elements with the same occurrences.
-
Contract:
- <p> This method returns {@code true} if and only if: <ul> <li> Both onlyOnLeft and onlyOnRight collections are empty </li> <li> All elements from both input collections are in the common elements </li> </ul> <p> Note that element order is not considered - only the presence and count of each element matters.
-
Parameters:
- (none)
- Returns: {@code true} if the two compared collections have exactly the same elements with the same occurrences, {@code false} otherwise
equals(...) -> boolean
-
Signature:
@Override public boolean equals(Object obj) - Summary: Compares this {@code Difference} object with another object for equality.
-
Contract:
- <p> Two {@code Difference} objects are considered equal if they have the same: <ul> <li> Common elements (compared using equals) </li> <li> Left-only elements (compared using equals) </li> <li> Right-only elements (compared using equals) </li> </ul> <p> This method properly handles {@code null} values and ensures type safety by checking that the compared object is also a {@code Difference} instance.
-
Parameters:
-
obj(Object) — the object to compare with this {@code Difference}
-
- Returns: {@code true} if the specified object is equal to this {@code Difference} , {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this {@code Difference} object.
-
Parameters:
- (none)
- Returns: a hash code value for this {@code Difference} object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code Difference} object.
-
Parameters:
- (none)
- Returns: a string representation of this {@code Difference} object
Class MapDifference (com.landawn.abacus.util.Difference.MapDifference)
Represents the difference between two maps, providing detailed comparison results including common entries, entries unique to each map, and entries with different values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>>
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>> of( final Map<? extends K1, ? extends V1> map1, final Map<? extends K2, ? extends V2> map2) - Summary: Compares two maps and identifies the differences between them using default equality comparison for values.
-
Contract:
- Null values are handled correctly - if both maps have a {@code null} value for the same key, it's considered a common entry.
- <p> The order of entries in the result maps depends on the input map types: <ul> <li> If either input map is a {@link LinkedHashMap} or {@link SortedMap} , results use {@link LinkedHashMap} </li> <li> Otherwise, results use {@link HashMap} </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Integer> map1 = Map.of("a", 1, "b", 2, "c", 3); Map<String, Integer> map2 = Map.of("b", 2, "c", 4, "d", 5); MapDifference<...> diff = MapDifference.of(map1, map2); // Results in: // common: {"b": 2} // onlyOnLeft: {"a": 1} // onlyOnRight: {"d": 5} // differentValues: {"c": Pair.of(3, 4)} } </pre>
-
Parameters:
-
map1(Map<? extends K1, ? extends V1>) — the first map to compare. Can be {@code null} or empty. -
map2(Map<? extends K2, ? extends V2>) — the second map to compare. Can be {@code null} or empty.
-
- Returns: a {@code MapDifference} object containing the comparison results
- See also: Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>> of( final Map<? extends K1, ? extends V1> map1, final Map<? extends K2, ? extends V2> map2, final Collection<CK> keysToCompare) - Summary: Compares two maps and identifies the differences between them, considering only specified keys.
-
Contract:
- Keys not in this collection are ignored, even if they exist in either or both maps.
- <p> If {@code keysToCompare} is {@code null} , all keys from both maps are compared (equivalent to calling {@link #of(Map, Map)} ).
-
Parameters:
-
map1(Map<? extends K1, ? extends V1>) — the first map to compare. Can be {@code null} or empty. -
map2(Map<? extends K2, ? extends V2>) — the second map to compare. Can be {@code null} or empty. -
keysToCompare(Collection<CK>) — the keys to compare between the two maps. If {@code null} , all keys will be compared.
-
- Returns: a {@code MapDifference} object containing the comparison results for the specified keys
- See also: Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>> of( final Map<? extends K1, ? extends V1> map1, final Map<? extends K2, ? extends V2> map2, final BiPredicate<? super V1, ? super V2> valueEquivalence) throws IllegalArgumentException - Summary: Compares two maps using a custom value equivalence predicate to determine if values are equal.
-
Contract:
- Compares two maps using a custom value equivalence predicate to determine if values are equal.
- This is useful when: <ul> <li> Values need fuzzy matching (e.g., floating-point comparison with tolerance) </li> <li> Only certain fields of complex objects should be compared </li> <li> Case-insensitive string comparison is needed </li> </ul> <p> Example with custom equivalence: <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Double> map1 = Map.of("a", 1.0, "b", 2.001); Map<String, Double> map2 = Map.of("a", 1.0, "b", 2.0); // Compare with tolerance of 0.01 BiPredicate<Double, Double> approxEqual = (v1, v2) -> Math.abs(v1 - v2) < 0.01; MapDifference<...> diff = MapDifference.of(map1, map2, approxEqual); // Results in: // common: {"a": 1.0, "b": 2.001} (both are considered equal) // onlyOnLeft: {} // onlyOnRight: {} // differentValues: {} } </pre>
-
Parameters:
-
map1(Map<? extends K1, ? extends V1>) — the first map to compare. Can be {@code null} or empty. -
map2(Map<? extends K2, ? extends V2>) — the second map to compare. Can be {@code null} or empty. -
valueEquivalence(BiPredicate<? super V1, ? super V2>) — the predicate to determine if two values are equivalent. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
-
Throws:
-
java.lang.IllegalArgumentException— if {@code valueEquivalence} is {@code null}
-
- See also: Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>> of( final Map<? extends K1, ? extends V1> map1, final Map<? extends K2, ? extends V2> map2, final TriPredicate<? super K1, ? super V1, ? super V2> valueEquivalence) throws IllegalArgumentException - Summary: Compares two maps using a custom value equivalence predicate that also considers the key.
-
Parameters:
-
map1(Map<? extends K1, ? extends V1>) — the first map to compare. Can be {@code null} or empty. -
map2(Map<? extends K2, ? extends V2>) — the second map to compare. Can be {@code null} or empty. -
valueEquivalence(TriPredicate<? super K1, ? super V1, ? super V2>) — the predicate to determine if two values are equivalent for a given key. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
-
Throws:
-
java.lang.IllegalArgumentException— if {@code valueEquivalence} is {@code null}
-
- See also: Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE") @SuppressWarnings("unlikely-arg-type") public static <CK, K1 extends CK, V1, K2 extends CK, V2> MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>> of( final Map<? extends K1, ? extends V1> map1, final Map<? extends K2, ? extends V2> map2, final Collection<CK> keysToCompare, final TriPredicate<? super K1, ? super V1, ? super V2> valueEquivalence) - Summary: Compares two maps for specified keys using a custom value equivalence predicate.
-
Contract:
- It creates a {@code MapDifference} object that contains: <ul> <li> Common entries: Key-value pairs for specified keys with equivalent values </li> <li> Left-only entries: Key-value pairs for specified keys that exist only in the first map </li> <li> Right-only entries: Key-value pairs for specified keys that exist only in the second map </li> <li> Different values: Specified keys that exist in both maps but with non-equivalent values </li> </ul> <p> The comparison process: <ol> <li> Only keys in {@code keysToCompare} are considered (if {@code null} , all keys are compared) </li> <li> For each key, values are compared using the {@code valueEquivalence} predicate </li> <li> The predicate receives the key and both values, allowing key-dependent comparison </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Object> config1 = Map.of( "timeout", 30, "retries", 3, "debug", true, "url", "http://api.com" ); Map<String, Object> config2 = Map.of( "timeout", 30.0, // Note: different type "retries", 5, "debug", true, "proxy", "proxy.com" ); Collection<String> keysToCheck = Arrays.asList("timeout", "retries", "debug"); // Custom equivalence that handles type differences TriPredicate<String, Object, Object> configEqual = (key, v1, v2) -> { if (key.equals("timeout")) { return v1.toString().equals(v2.toString()); } return Objects.equals(v1, v2); }; MapDifference<...> diff = MapDifference.of(config1, config2, keysToCheck, configEqual); // Results in: // common: {"timeout": 30, "debug": true} // onlyOnLeft: {} // onlyOnRight: {} // differentValues: {"retries": Pair.of(3, 5)} // Note: "url" and "proxy" are not compared } </pre>
-
Parameters:
-
map1(Map<? extends K1, ? extends V1>) — the first map to compare. Can be {@code null} or empty. -
map2(Map<? extends K2, ? extends V2>) — the second map to compare. Can be {@code null} or empty. -
keysToCompare(Collection<CK>) — the keys to compare. If {@code null} , all keys will be compared. -
valueEquivalence(TriPredicate<? super K1, ? super V1, ? super V2>) — the predicate to determine if values are equivalent. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
- See also: Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
-
Signature:
public static <CK, CV, K> MapDifference<List<Map<CK, CV>>, List<Map<CK, CV>>, Map<K, MapDifference<Map<CK, CV>, Map<CK, CV>, Map<CK, Pair<CV, CV>>>>> of( final Collection<? extends Map<CK, CV>> a, final Collection<? extends Map<CK, CV>> b, final Function<? super Map<CK, CV>, ? extends K> idExtractor) - Summary: Compares two collections of maps with the same key and value types, identifying common maps, maps unique to each collection, and maps with different values.
-
Parameters:
-
a(Collection<? extends Map<CK, CV>>) — the first collection of maps to compare. Can be {@code null} or empty. -
b(Collection<? extends Map<CK, CV>>) — the second collection of maps to compare. Can be {@code null} or empty. -
idExtractor(Function<? super Map<CK, CV>, ? extends K>) — Function to extract a unique identifier from each map. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
-
Signature:
public static <CK, CV, K> MapDifference<List<Map<CK, CV>>, List<Map<CK, CV>>, Map<K, MapDifference<Map<CK, CV>, Map<CK, CV>, Map<CK, Pair<CV, CV>>>>> of( final Collection<? extends Map<CK, CV>> a, final Collection<? extends Map<CK, CV>> b, final Collection<CK> keysToCompare, final Function<? super Map<CK, CV>, ? extends K> idExtractor) - Summary: Compares two collections of maps with the same key and value types, considering only specified keys when comparing individual maps.
-
Contract:
- Compares two collections of maps with the same key and value types, considering only specified keys when comparing individual maps.
- <p> This method extends the functionality of {@link #of(Collection, Collection, Function)} by allowing you to specify which keys should be compared when determining if two maps with the same ID have different values.
- <p> The comparison process: <ol> <li> Maps are matched between collections using the {@code idExtractor} </li> <li> When comparing matched maps, only the keys in {@code keysToCompare} are considered </li> <li> Keys not in {@code keysToCompare} are ignored during value comparison </li> </ol> <p> <b> Usage Examples: </b> </p> <pre> {@code List<Map<String, Object>> users1 = Arrays.asList( Map.of("id", 1, "name", "John", "age", 30, "lastLogin", "2024-01-01"), Map.of("id", 2, "name", "Jane", "age", 25, "lastLogin", "2024-01-02") ); List<Map<String, Object>> users2 = Arrays.asList( Map.of("id", 1, "name", "John", "age", 30, "lastLogin", "2024-02-01"), Map.of("id", 2, "name", "Jane", "age", 26, "lastLogin", "2024-02-02") ); // Only compare name and age, ignore lastLogin Collection<String> keysToCompare = Arrays.asList("name", "age"); MapDifference<...> diff = MapDifference.of(users1, users2, keysToCompare, map -> map.get("id")); // Results in: // common: \[{"id": 1, ...}\] (John's record, since name and age match) // onlyOnLeft: \[\] // onlyOnRight: \[\] // differentValues: {2: MapDifference showing age difference for Jane} } </pre>
-
Parameters:
-
a(Collection<? extends Map<CK, CV>>) — the first collection of maps to compare. Can be {@code null} or empty. -
b(Collection<? extends Map<CK, CV>>) — the second collection of maps to compare. Can be {@code null} or empty. -
keysToCompare(Collection<CK>) — the keys to compare within each map. If {@code null} , all keys are compared. -
idExtractor(Function<? super Map<CK, CV>, ? extends K>) — Function to extract a unique identifier from each map. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2, K> MapDifference<List<Map<K1, V1>>, List<Map<K2, V2>>, Map<K, MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>>>> of( final Collection<? extends Map<K1, V1>> a, final Collection<? extends Map<K2, V2>> b, final Function<? super Map<K1, V1>, ? extends K> idExtractor1, final Function<? super Map<K2, V2>, ? extends K> idExtractor2) - Summary: Compares two collections of maps with potentially different key and value types, using separate ID extractors for each collection.
-
Contract:
- <p> This method is useful when comparing collections of maps that represent similar entities but may have different structures.
-
Parameters:
-
a(Collection<? extends Map<K1, V1>>) — the first collection of maps to compare. Can be {@code null} or empty. -
b(Collection<? extends Map<K2, V2>>) — the second collection of maps to compare. Can be {@code null} or empty. -
idExtractor1(Function<? super Map<K1, V1>, ? extends K>) — Function to extract IDs from maps in the first collection. Must not be {@code null} . -
idExtractor2(Function<? super Map<K2, V2>, ? extends K>) — Function to extract IDs from maps in the second collection. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing the comparison results
-
Signature:
public static <CK, K1 extends CK, V1, K2 extends CK, V2, K> MapDifference<List<Map<K1, V1>>, List<Map<K2, V2>>, Map<K, MapDifference<Map<K1, V1>, Map<K2, V2>, Map<CK, Pair<V1, V2>>>>> of( final Collection<? extends Map<K1, V1>> a, final Collection<? extends Map<K2, V2>> b, final Collection<CK> keysToCompare, final Function<? super Map<K1, V1>, ? extends K> idExtractor1, final Function<? super Map<K2, V2>, ? extends K> idExtractor2) - Summary: Compares two collections of maps with potentially different types, using separate ID extractors and considering only specified keys during comparison.
-
Parameters:
-
a(Collection<? extends Map<K1, V1>>) — the first collection of maps to compare. Can be {@code null} or empty. -
b(Collection<? extends Map<K2, V2>>) — the second collection of maps to compare. Can be {@code null} or empty. -
keysToCompare(Collection<CK>) — Keys to compare within matched maps. If {@code null} , all keys are compared. -
idExtractor1(Function<? super Map<K1, V1>, ? extends K>) — Function to extract IDs from maps in the first collection. Must not be {@code null} . -
idExtractor2(Function<? super Map<K2, V2>, ? extends K>) — Function to extract IDs from maps in the second collection. Must not be {@code null} .
-
- Returns: a {@code MapDifference} object containing detailed comparison results
Public Instance Methods
- (none)
Class BeanDifference (com.landawn.abacus.util.Difference.BeanDifference)
Represents the difference between two Java beans, providing detailed comparison results including common properties, properties unique to each bean, and properties with different values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>>
-
Signature:
public static BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>> of(final Object bean1, final Object bean2) - Summary: Compares two beans and identifies the differences between them using default equality comparison.
-
Parameters:
-
bean1(Object) — the first bean to compare. Can be {@code null} . -
bean2(Object) — the second bean to compare. Can be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
- See also: MapDifference#of(Map, Map), BeanDifference#of(Object, Object, Collection), Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), com.landawn.abacus.annotation.DiffIgnore
-
Signature:
public static BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>> of(final Object bean1, final Object bean2, final Collection<String> propNamesToCompare) - Summary: Compares two beans considering only the specified properties.
-
Contract:
- Properties not in this collection are completely ignored, even if they exist in one or both beans.
- <p> Key differences from {@link #of(Object, Object)} : <ul> <li> Only properties in {@code propNamesToCompare} are examined </li> <li> Properties with {@code null} values in both beans ARE included in the common properties </li> <li> {@code @DiffIgnore} annotations are ignored when specific properties are requested </li> <li> If a specified property doesn't exist in a bean, it's treated as a missing property </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code class Employee { private String id; private String name; private Double salary; private String department; // getters and setters...
-
Parameters:
-
bean1(Object) — the first bean to compare. Can be {@code null} . -
bean2(Object) — the second bean to compare. Can be {@code null} . -
propNamesToCompare(Collection<String>) — the property names to compare. If {@code null} or empty, all properties are compared.
-
- Returns: a {@code BeanDifference} object containing the comparison results for the specified properties
- See also: MapDifference#of(Map, Map), BeanDifference#of(Object, Object), Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), com.landawn.abacus.annotation.DiffIgnore
-
Signature:
public static BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>> of(final Object bean1, final Object bean2, final BiPredicate<?, ?> valueEquivalence) - Summary: Compares two beans using a custom value equivalence predicate.
-
Contract:
- <p> This method allows for custom comparison logic when determining if property values are equal.
- The predicate receives both property values and should return {@code true} if they are considered equivalent.
- } Product p1 = new Product("Widget", 10.99, "A useful widget"); Product p2 = new Product("WIDGET", 10.991, "A USEFUL WIDGET"); // Case-insensitive comparison with price tolerance BiPredicate<Object, Object> fuzzyEquals = (v1, v2) -> { if (v1 instanceof String && v2 instanceof String) { return ((String) v1).equalsIgnoreCase((String) v2); } else if (v1 instanceof Double && v2 instanceof Double) { return Math.abs((Double) v1 - (Double) v2) < 0.01; } return Objects.equals(v1, v2); }; BeanDifference<...> diff = BeanDifference.of(p1, p2, fuzzyEquals); // Results in: // common: {"name": "Widget", "price": 10.99, "description": "A useful widget"} // All properties are considered equal due to custom comparison } </pre>
-
Parameters:
-
bean1(Object) — the first bean to compare. Can be {@code null} . -
bean2(Object) — the second bean to compare. Can be {@code null} . -
valueEquivalence(BiPredicate<?, ?>) — the predicate to determine if two property values are equivalent. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
- See also: MapDifference#of(Map, Map), BeanDifference#of(Object, Object, Collection), Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), com.landawn.abacus.annotation.DiffIgnore
-
Signature:
public static BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>> of(final Object bean1, final Object bean2, final TriPredicate<String, ?, ?> valueEquivalence) - Summary: Compares two beans using a property-aware custom value equivalence predicate.
-
Contract:
- } Account acc1 = new Account("ACC001", 1000.001, date1, "ACTIVE"); Account acc2 = new Account("ACC001", 1000.0, date2, "active"); // Property-specific comparison rules TriPredicate<String, Object, Object> smartEquals = (propName, v1, v2) -> { switch (propName) { case "balance": // Allow small rounding differences return Math.abs((Double) v1 - (Double) v2) < 0.01; case "lastActivity": // Ignore time differences less than 1 hour return Math.abs(((Date) v1).getTime() - ((Date) v2).getTime()) < 3600000; case "status": // Case-insensitive comparison return ((String) v1).equalsIgnoreCase((String) v2); default: return Objects.equals(v1, v2); } }; BeanDifference<...> diff = BeanDifference.of(acc1, acc2, smartEquals); // Results may show all properties as common if they meet the criteria } </pre>
-
Parameters:
-
bean1(Object) — the first bean to compare. Can be {@code null} . -
bean2(Object) — the second bean to compare. Can be {@code null} . -
valueEquivalence(TriPredicate<String, ?, ?>) — the predicate to determine if values are equivalent for a given property. Receives (propertyName, value1, value2). Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
- See also: MapDifference#of(Map, Map), BeanDifference#of(Object, Object, Collection), Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), com.landawn.abacus.annotation.DiffIgnore
-
Signature:
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE") public static BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>> of(final Object bean1, final Object bean2, final Collection<String> propNamesToCompare, final TriPredicate<String, ?, ?> valueEquivalence) - Summary: Compares two beans for specified properties using a property-aware custom value equivalence predicate.
-
Contract:
- <p> Behavior: <ul> <li> Only properties in {@code propNamesToCompare} are examined </li> <li> The {@code valueEquivalence} predicate determines equality for each property </li> <li> {@code null} values in both beans are included in comparison (unlike the default behavior) </li> <li> {@code @DiffIgnore} annotations are ignored when specific properties are requested </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code class Customer { private String id; private String name; private String email; private Double creditLimit; private String notes; // getters and setters...
-
Parameters:
-
bean1(Object) — the first bean to compare. Can be {@code null} . -
bean2(Object) — the second bean to compare. Can be {@code null} . -
propNamesToCompare(Collection<String>) — the property names to compare. If {@code null} or empty, all properties are compared. -
valueEquivalence(TriPredicate<String, ?, ?>) — the predicate to determine if values are equivalent for a given property. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
- See also: MapDifference#of(Map, Map), BeanDifference#of(Object, Object, Collection), Maps#difference(Map, Map), Maps#symmetricDifference(Map, Map), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), com.landawn.abacus.annotation.DiffIgnore
-
Signature:
public static <T, C extends List<T>, K> BeanDifference<C, C, Map<K, BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>>>> of( final Collection<? extends T> a, final Collection<? extends T> b, final Function<? super T, K> idExtractor) - Summary: Compares two collections of beans, identifying common beans, beans unique to each collection, and beans that exist in both collections but have different property values.
-
Parameters:
-
a(Collection<? extends T>) — the first collection of beans to compare. Can be {@code null} or empty. -
b(Collection<? extends T>) — the second collection of beans to compare. Can be {@code null} or empty. -
idExtractor(Function<? super T, K>) — the function to extract a unique identifier from each bean. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
-
Signature:
public static <T, C extends List<T>, K> BeanDifference<C, C, Map<K, BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>>>> of( final Collection<? extends T> a, final Collection<? extends T> b, final Collection<String> propNamesToCompare, final Function<? super T, K> idExtractor) - Summary: Compares two collections of beans considering only specified properties.
-
Contract:
- Only the properties listed in {@code propNamesToCompare} are examined when comparing matched beans.
- <p> Use cases: <ul> <li> Comparing only business-critical properties while ignoring metadata </li> <li> Performance optimization by comparing only necessary fields </li> <li> Versioning scenarios where only certain fields should trigger differences </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code class Product { private String sku; private String name; private Double price; private Date lastModified; private String internalNotes; // getters and setters...
-
Parameters:
-
a(Collection<? extends T>) — the first collection of beans to compare. Can be {@code null} or empty. -
b(Collection<? extends T>) — the second collection of beans to compare. Can be {@code null} or empty. -
propNamesToCompare(Collection<String>) — the property names to compare. If {@code null} or empty, all properties are compared. -
idExtractor(Function<? super T, K>) — the function to extract a unique identifier from each bean. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
-
Signature:
public static <T1, T2, L extends List<T1>, R extends List<T2>, K> BeanDifference<L, R, Map<K, BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>>>> of( final Collection<? extends T1> a, final Collection<? extends T2> b, final Function<? super T1, ? extends K> idExtractor1, final Function<? super T2, ? extends K> idExtractor2) - Summary: Compares two collections of potentially different bean types using separate identifier extractors.
-
Contract:
- <p> This method is useful when comparing beans from different systems or versions where: <ul> <li> The bean classes may be different but represent the same concept </li> <li> The identifier extraction logic differs between the collections </li> <li> You need to map between different data models </li> </ul> <p> Only properties with matching names between the bean types are compared.
-
Parameters:
-
a(Collection<? extends T1>) — the first collection of beans to compare. Can be {@code null} or empty. -
b(Collection<? extends T2>) — the second collection of beans to compare. Can be {@code null} or empty. -
idExtractor1(Function<? super T1, ? extends K>) — the function to extract identifiers from beans in the first collection. Must not be {@code null} . -
idExtractor2(Function<? super T2, ? extends K>) — the function to extract identifiers from beans in the second collection. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
-
Signature:
public static <T1, T2, L extends List<T1>, R extends List<T2>, K> BeanDifference<L, R, Map<K, BeanDifference<Map<String, Object>, Map<String, Object>, Map<String, Pair<Object, Object>>>>> of( final Collection<? extends T1> a, final Collection<? extends T2> b, final Collection<String> propNamesToCompare, final Function<? super T1, ? extends K> idExtractor1, final Function<? super T2, ? extends K> idExtractor2) - Summary: Compares two collections of potentially different bean types with separate identifier extractors and selective property comparison.
-
Parameters:
-
a(Collection<? extends T1>) — the first collection of beans to compare. Can be {@code null} or empty. -
b(Collection<? extends T2>) — the second collection of beans to compare. Can be {@code null} or empty. -
propNamesToCompare(Collection<String>) — the property names to compare. If {@code null} or empty, all matching properties are compared. -
idExtractor1(Function<? super T1, ? extends K>) — the function to extract identifiers from beans in the first collection. Must not be {@code null} . -
idExtractor2(Function<? super T2, ? extends K>) — the function to extract identifiers from beans in the second collection. Must not be {@code null} .
-
- Returns: a {@code BeanDifference} object containing the comparison results
Public Instance Methods
- (none)
Class DigestUtil (com.landawn.abacus.util.DigestUtil)
Utility class for generating cryptographic message digests (hashes) using various algorithms.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
digest(...) -> byte\[\]
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final byte[] data) - Summary: Computes the digest of the given byte array using the specified MessageDigest.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(byte[]) — The byte array to digest (must not be {@code null} )
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final ByteBuffer data) - Summary: Reads through a ByteBuffer and computes the digest for the data.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(ByteBuffer) — The ByteBuffer containing data to digest (must not be {@code null} )
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final File data) throws IOException - Summary: Reads through a File and computes the digest for its contents.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(File) — The File to read and digest (must exist and be readable)
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the file
-
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final InputStream data) throws IOException - Summary: Reads through an InputStream and computes the digest for the data.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading from the stream
-
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final Path data, final OpenOption... options) throws IOException - Summary: Reads through a file at the specified Path and computes the digest for the data.
-
Contract:
- The file is opened according to the specified OpenOptions (if no options are provided, the file is opened with default read options).
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(Path) — The Path to the file to digest (must not be {@code null} ) -
options(OpenOption[]) — Optional open options for the file (e.g., StandardOpenOption.READ). If not specified, default options are used.
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the file
-
-
Signature:
public static byte[] digest(final MessageDigest messageDigest, final RandomAccessFile data) throws IOException - Summary: Reads through a RandomAccessFile using non-blocking I/O (NIO) and computes the digest.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest algorithm to use (must not be {@code null} ) -
data(RandomAccessFile) — The RandomAccessFile to read and digest (must not be {@code null} )
-
- Returns: The computed digest as a byte array, length depends on the algorithm used
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the file
-
getDigest(...) -> MessageDigest
-
Signature:
public static MessageDigest getDigest(final String algorithm) - Summary: Returns a MessageDigest instance for the specified algorithm.
-
Contract:
- This method wraps the checked NoSuchAlgorithmException in an unchecked IllegalArgumentException, making it more convenient to use when you know the algorithm is available.
-
Parameters:
-
algorithm(String) — The name of the algorithm (e.g., "MD5", "SHA-256", "SHA-512"). See Java Cryptography Architecture documentation for standard algorithm names. Must not be {@code null} .
-
- Returns: A new MessageDigest instance for the specified algorithm
- See also: MessageDigest#getInstance(String), MessageDigestAlgorithms
-
Signature:
@MayReturnNull public static MessageDigest getDigest(final String algorithm, final MessageDigest defaultMessageDigest) - Summary: Returns a MessageDigest instance for the specified algorithm, or a default digest if the algorithm is not available.
-
Contract:
- Returns a MessageDigest instance for the specified algorithm, or a default digest if the algorithm is not available.
- <p> <b> Usage Examples: </b> </p> <pre> {@code MessageDigest fallback = DigestUtil.getSha256Digest(); MessageDigest md = DigestUtil.getDigest("SHA3-256", fallback); // Returns SHA3-256 if available (Java 9+), otherwise SHA-256 } </pre>
-
Parameters:
-
algorithm(String) — The name of the algorithm to attempt (e.g., "SHA3-512", "BLAKE2b"). Can be {@code null} , in which case the default is returned. -
defaultMessageDigest(MessageDigest) — The MessageDigest to return if the algorithm is not available. Can be {@code null} .
-
- Returns: A MessageDigest instance for the algorithm if available, otherwise returns defaultMessageDigest (which may be {@code null} )
getMd2Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getMd2Digest() - Summary: Returns an MD2 MessageDigest instance.
-
Contract:
- It should NOT be used for any security purposes or new applications.
-
Parameters:
- (none)
- Returns: A new MD2 MessageDigest instance
- See also: MessageDigestAlgorithms#MD2
getMd5Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getMd5Digest() - Summary: Returns an MD5 MessageDigest instance.
-
Contract:
- <p> <strong> WARNING: </strong> MD5 is cryptographically broken and should NOT be used for security purposes such as password hashing, digital signatures, or certificates.
-
Parameters:
- (none)
- Returns: A new MD5 MessageDigest instance
- See also: MessageDigestAlgorithms#MD5
getSha1Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha1Digest() - Summary: Returns an SHA-1 MessageDigest instance.
-
Contract:
- It should NOT be used for digital signatures, certificates, or other security-critical applications.
-
Parameters:
- (none)
- Returns: A new SHA-1 MessageDigest instance (produces 20-byte/160-bit hashes)
- See also: MessageDigestAlgorithms#SHA_1
getSha256Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha256Digest() - Summary: Returns an SHA-256 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA-256 MessageDigest instance (produces 32-byte/256-bit hashes)
- See also: MessageDigestAlgorithms#SHA_256
getSha3_224Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha3_224Digest() - Summary: Returns an SHA3-224 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA3-224 MessageDigest instance (produces 28-byte/224-bit hashes)
- See also: MessageDigestAlgorithms#SHA3_224
getSha3_256Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha3_256Digest() - Summary: Returns an SHA3-256 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA3-256 MessageDigest instance (produces 32-byte/256-bit hashes)
- See also: MessageDigestAlgorithms#SHA3_256
getSha3_384Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha3_384Digest() - Summary: Returns an SHA3-384 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA3-384 MessageDigest instance (produces 48-byte/384-bit hashes)
- See also: MessageDigestAlgorithms#SHA3_384
getSha3_512Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha3_512Digest() - Summary: Returns an SHA3-512 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA3-512 MessageDigest instance (produces 64-byte/512-bit hashes)
- See also: MessageDigestAlgorithms#SHA3_512
getSha384Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha384Digest() - Summary: Returns an SHA-384 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA-384 MessageDigest instance (produces 48-byte/384-bit hashes)
- See also: MessageDigestAlgorithms#SHA_384
getSha512_224Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha512_224Digest() - Summary: Returns an SHA-512/224 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA-512/224 MessageDigest instance (produces 28-byte/224-bit hashes)
- See also: MessageDigestAlgorithms#SHA_512_224
getSha512_256Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha512_256Digest() - Summary: Returns an SHA-512/256 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA-512/256 MessageDigest instance (produces 32-byte/256-bit hashes)
- See also: MessageDigestAlgorithms#SHA_512_256
getSha512Digest(...) -> MessageDigest
-
Signature:
public static MessageDigest getSha512Digest() - Summary: Returns an SHA-512 MessageDigest instance.
-
Parameters:
- (none)
- Returns: A new SHA-512 MessageDigest instance (produces 64-byte/512-bit hashes)
- See also: MessageDigestAlgorithms#SHA_512
getShaDigest(...) -> MessageDigest
-
Signature:
@Deprecated public static MessageDigest getShaDigest() - Summary: Returns an SHA-1 MessageDigest instance.
-
Parameters:
- (none)
- Returns: An SHA-1 MessageDigest instance (produces 20-byte/160-bit hashes)
isAvailable(...) -> boolean
-
Signature:
public static boolean isAvailable(final String messageDigestAlgorithm) - Summary: Tests whether the specified message digest algorithm is available in the current JVM environment.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (DigestUtil.isAvailable("SHA3-256")) { // Use SHA3-256 (available in Java 9+) return DigestUtil.getSha3_256Digest(); } else { // Fall back to SHA-256 return DigestUtil.getSha256Digest(); } } </pre>
-
Parameters:
-
messageDigestAlgorithm(String) — The algorithm name to test (e.g., "SHA-256", "SHA3-512", "BLAKE2b"). Can be {@code null} , which will return {@code false} .
-
- Returns: {@code true} if the algorithm is available and can be used, {@code false} otherwise
md2(...) -> byte\[\]
-
Signature:
public static byte[] md2(final byte[] data) - Summary: Calculates the MD2 digest of the input data and returns it as a 16-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: MD2 digest as a 16-byte array
-
Signature:
public static byte[] md2(final InputStream data) throws IOException - Summary: Calculates the MD2 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: MD2 digest as a 16-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] md2(final String data) - Summary: Calculates the MD2 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: MD2 digest as a 16-byte array
md2Hex(...) -> String
-
Signature:
public static String md2Hex(final byte[] data) - Summary: Calculates the MD2 digest and returns it as a 32-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: MD2 digest as a 32-character lowercase hexadecimal string
-
Signature:
public static String md2Hex(final InputStream data) throws IOException - Summary: Calculates the MD2 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: MD2 digest as a 32-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String md2Hex(final String data) - Summary: Calculates the MD2 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: MD2 digest as a 32-character lowercase hexadecimal string
md5(...) -> byte\[\]
-
Signature:
public static byte[] md5(final byte[] data) - Summary: Calculates the MD5 digest of the input data and returns it as a 16-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: MD5 digest as a 16-byte array
-
Signature:
public static byte[] md5(final InputStream data) throws IOException - Summary: Calculates the MD5 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: MD5 digest as a 16-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] md5(final String data) - Summary: Calculates the MD5 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: MD5 digest as a 16-byte array
md5Hex(...) -> String
-
Signature:
public static String md5Hex(final byte[] data) - Summary: Calculates the MD5 digest and returns it as a 32-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: MD5 digest as a 32-character lowercase hexadecimal string
-
Signature:
public static String md5Hex(final InputStream data) throws IOException - Summary: Calculates the MD5 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: MD5 digest as a 32-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String md5Hex(final String data) - Summary: Calculates the MD5 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: MD5 digest as a 32-character lowercase hexadecimal string
sha(...) -> byte\[\]
-
Signature:
@Deprecated public static byte[] sha(final byte[] data) - Summary: Calculates the SHA-1 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
-
Signature:
@Deprecated public static byte[] sha(final InputStream data) throws IOException - Summary: Calculates the SHA-1 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
@Deprecated public static byte[] sha(final String data) - Summary: Calculates the SHA-1 digest of a string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
sha1(...) -> byte\[\]
-
Signature:
public static byte[] sha1(final byte[] data) - Summary: Calculates the SHA-1 digest of the input data and returns it as a 20-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
-
Signature:
public static byte[] sha1(final InputStream data) throws IOException - Summary: Calculates the SHA-1 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha1(final String data) - Summary: Calculates the SHA-1 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 20-byte array
sha1Hex(...) -> String
-
Signature:
public static String sha1Hex(final byte[] data) - Summary: Calculates the SHA-1 digest and returns it as a 40-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
-
Signature:
public static String sha1Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-1 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha1Hex(final String data) - Summary: Calculates the SHA-1 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
sha256(...) -> byte\[\]
-
Signature:
public static byte[] sha256(final byte[] data) - Summary: Calculates the SHA-256 digest of the input data and returns it as a 32-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 32-byte array
-
Signature:
public static byte[] sha256(final InputStream data) throws IOException - Summary: Calculates the SHA-256 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 32-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha256(final String data) - Summary: Calculates the SHA-256 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 32-byte array
sha256Hex(...) -> String
-
Signature:
public static String sha256Hex(final byte[] data) - Summary: Calculates the SHA-256 digest and returns it as a 64-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 64-character lowercase hexadecimal string
-
Signature:
public static String sha256Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-256 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 64-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha256Hex(final String data) - Summary: Calculates the SHA-256 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-256 digest as a 64-character lowercase hexadecimal string
sha3_224(...) -> byte\[\]
-
Signature:
public static byte[] sha3_224(final byte[] data) - Summary: Calculates the SHA3-224 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 28-byte array
-
Signature:
public static byte[] sha3_224(final InputStream data) throws IOException - Summary: Calculates the SHA3-224 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 28-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha3_224(final String data) - Summary: Calculates the SHA3-224 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 28-byte array
sha3_224Hex(...) -> String
-
Signature:
public static String sha3_224Hex(final byte[] data) - Summary: Calculates the SHA3-224 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 56-character lowercase hexadecimal string
-
Signature:
public static String sha3_224Hex(final InputStream data) throws IOException - Summary: Calculates the SHA3-224 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 56-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha3_224Hex(final String data) - Summary: Calculates the SHA3-224 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-224 digest as a 56-character lowercase hexadecimal string
sha3_256(...) -> byte\[\]
-
Signature:
public static byte[] sha3_256(final byte[] data) - Summary: Calculates the SHA3-256 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 32-byte array
-
Signature:
public static byte[] sha3_256(final InputStream data) throws IOException - Summary: Calculates the SHA3-256 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 32-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha3_256(final String data) - Summary: Calculates the SHA3-256 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 32-byte array
sha3_256Hex(...) -> String
-
Signature:
public static String sha3_256Hex(final byte[] data) - Summary: Calculates the SHA3-256 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 64-character lowercase hexadecimal string
-
Signature:
public static String sha3_256Hex(final InputStream data) throws IOException - Summary: Calculates the SHA3-256 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 64-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha3_256Hex(final String data) - Summary: Calculates the SHA3-256 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-256 digest as a 64-character lowercase hexadecimal string
sha3_384(...) -> byte\[\]
-
Signature:
public static byte[] sha3_384(final byte[] data) - Summary: Calculates the SHA3-384 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 48-byte array
-
Signature:
public static byte[] sha3_384(final InputStream data) throws IOException - Summary: Calculates the SHA3-384 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 48-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha3_384(final String data) - Summary: Calculates the SHA3-384 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 48-byte array
sha3_384Hex(...) -> String
-
Signature:
public static String sha3_384Hex(final byte[] data) - Summary: Calculates the SHA3-384 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 96-character lowercase hexadecimal string
-
Signature:
public static String sha3_384Hex(final InputStream data) throws IOException - Summary: Calculates the SHA3-384 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 96-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha3_384Hex(final String data) - Summary: Calculates the SHA3-384 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-384 digest as a 96-character lowercase hexadecimal string
sha3_512(...) -> byte\[\]
-
Signature:
public static byte[] sha3_512(final byte[] data) - Summary: Calculates the SHA3-512 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 64-byte array
-
Signature:
public static byte[] sha3_512(final InputStream data) throws IOException - Summary: Calculates the SHA3-512 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 64-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha3_512(final String data) - Summary: Calculates the SHA3-512 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 64-byte array
sha3_512Hex(...) -> String
-
Signature:
public static String sha3_512Hex(final byte[] data) - Summary: Calculates the SHA3-512 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 128-character lowercase hexadecimal string
-
Signature:
public static String sha3_512Hex(final InputStream data) throws IOException - Summary: Calculates the SHA3-512 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 128-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha3_512Hex(final String data) - Summary: Calculates the SHA3-512 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA3-512 digest as a 128-character lowercase hexadecimal string
sha384(...) -> byte\[\]
-
Signature:
public static byte[] sha384(final byte[] data) - Summary: Calculates the SHA-384 digest of the input data and returns it as a 48-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 48-byte array
-
Signature:
public static byte[] sha384(final InputStream data) throws IOException - Summary: Calculates the SHA-384 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 48-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha384(final String data) - Summary: Calculates the SHA-384 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 48-byte array
sha384Hex(...) -> String
-
Signature:
public static String sha384Hex(final byte[] data) - Summary: Calculates the SHA-384 digest and returns it as a 96-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 96-character lowercase hexadecimal string
-
Signature:
public static String sha384Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-384 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 96-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha384Hex(final String data) - Summary: Calculates the SHA-384 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-384 digest as a 96-character lowercase hexadecimal string
sha512(...) -> byte\[\]
-
Signature:
public static byte[] sha512(final byte[] data) - Summary: Calculates the SHA-512 digest of the input data and returns it as a 64-byte array.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-512 digest as a 64-byte array
-
Signature:
public static byte[] sha512(final InputStream data) throws IOException - Summary: Calculates the SHA-512 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512 digest as a 64-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha512(final String data) - Summary: Calculates the SHA-512 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512 digest as a 64-byte array
sha512_224(...) -> byte\[\]
-
Signature:
public static byte[] sha512_224(final byte[] data) - Summary: Calculates the SHA-512/224 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 28-byte array
-
Signature:
public static byte[] sha512_224(final InputStream data) throws IOException - Summary: Calculates the SHA-512/224 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 28-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha512_224(final String data) - Summary: Calculates the SHA-512/224 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 28-byte array
sha512_224Hex(...) -> String
-
Signature:
public static String sha512_224Hex(final byte[] data) - Summary: Calculates the SHA-512/224 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 56-character lowercase hexadecimal string
-
Signature:
public static String sha512_224Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-512/224 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 56-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha512_224Hex(final String data) - Summary: Calculates the SHA-512/224 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512/224 digest as a 56-character lowercase hexadecimal string
sha512_256(...) -> byte\[\]
-
Signature:
public static byte[] sha512_256(final byte[] data) - Summary: Calculates the SHA-512/256 digest of the input data.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 32-byte array
-
Signature:
public static byte[] sha512_256(final InputStream data) throws IOException - Summary: Calculates the SHA-512/256 digest of data from an InputStream.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 32-byte array
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static byte[] sha512_256(final String data) - Summary: Calculates the SHA-512/256 digest of a string (converted to UTF-8 bytes).
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 32-byte array
sha512_256Hex(...) -> String
-
Signature:
public static String sha512_256Hex(final byte[] data) - Summary: Calculates the SHA-512/256 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 64-character lowercase hexadecimal string
-
Signature:
public static String sha512_256Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-512/256 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 64-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha512_256Hex(final String data) - Summary: Calculates the SHA-512/256 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512/256 digest as a 64-character lowercase hexadecimal string
sha512Hex(...) -> String
-
Signature:
public static String sha512Hex(final byte[] data) - Summary: Calculates the SHA-512 digest and returns it as a 128-character hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest.
-
- Returns: SHA-512 digest as a hex string.
-
Signature:
public static String sha512Hex(final InputStream data) throws IOException - Summary: Calculates the SHA-512 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-512 digest as a 128-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
public static String sha512Hex(final String data) - Summary: Calculates the SHA-512 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-512 digest as a 128-character lowercase hexadecimal string
shaHex(...) -> String
-
Signature:
@Deprecated public static String shaHex(final byte[] data) - Summary: Calculates the SHA-1 digest and returns it as a hexadecimal string.
-
Parameters:
-
data(byte[]) — The data to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
-
Signature:
@Deprecated public static String shaHex(final InputStream data) throws IOException - Summary: Calculates the SHA-1 digest of stream data and returns it as a hex string.
-
Parameters:
-
data(InputStream) — The InputStream to read and digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the stream
-
-
Signature:
@Deprecated public static String shaHex(final String data) - Summary: Calculates the SHA-1 digest of a string and returns it as a hex string.
-
Parameters:
-
data(String) — The string to digest (must not be {@code null} )
-
- Returns: SHA-1 digest as a 40-character lowercase hexadecimal string
updateDigest(...) -> MessageDigest
-
Signature:
public static MessageDigest updateDigest(final MessageDigest messageDigest, final byte[] valueToDigest) - Summary: Updates the given MessageDigest with the specified byte array data.
-
Contract:
- This method is useful when computing digests incrementally.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest to update. -
valueToDigest(byte[]) — The byte array to add to the digest.
-
- Returns: The updated MessageDigest (same instance as input).
-
Signature:
public static MessageDigest updateDigest(final MessageDigest messageDigest, final ByteBuffer valueToDigest) - Summary: Updates the given MessageDigest with data from a ByteBuffer.
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest to update (must not be {@code null} ) -
valueToDigest(ByteBuffer) — The ByteBuffer containing data to add to the digest (must not be {@code null} )
-
- Returns: The updated MessageDigest (same instance as input)
-
Signature:
public static MessageDigest updateDigest(final MessageDigest digest, final File data) throws IOException - Summary: Reads through a File and updates the MessageDigest with its contents.
-
Parameters:
-
digest(MessageDigest) — The MessageDigest to update (must not be {@code null} ) -
data(File) — The File to read (must exist and be readable)
-
- Returns: The updated MessageDigest (same instance as input)
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the file
-
-
Signature:
public static MessageDigest updateDigest(final MessageDigest digest, final InputStream inputStream) throws IOException - Summary: Reads through an InputStream and updates the MessageDigest with the data.
-
Parameters:
-
digest(MessageDigest) — The MessageDigest to update. -
inputStream(InputStream) — The InputStream to read.
-
- Returns: The updated MessageDigest (same instance as input).
-
Throws:
-
java.io.IOException— If an error occurs while reading the stream.
-
-
Signature:
public static MessageDigest updateDigest(final MessageDigest digest, final Path path, final OpenOption... options) throws IOException - Summary: Reads through a file at the specified Path and updates the MessageDigest.
-
Parameters:
-
digest(MessageDigest) — The MessageDigest to update (must not be {@code null} ) -
path(Path) — The Path to the file to read (must not be {@code null} ) -
options(OpenOption[]) — Optional open options for the file (e.g., StandardOpenOption.READ). If not specified, default options are used.
-
- Returns: The updated MessageDigest (same instance as input)
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading the file
-
-
Signature:
public static MessageDigest updateDigest(final MessageDigest digest, final RandomAccessFile data) throws IOException - Summary: Reads through a RandomAccessFile using NIO and updates the MessageDigest.
-
Parameters:
-
digest(MessageDigest) — The MessageDigest to update (must not be {@code null} ) -
data(RandomAccessFile) — The RandomAccessFile to read (must not be {@code null} )
-
- Returns: The updated MessageDigest (same instance as input)
-
Throws:
-
java.io.IOException— If an I/O error occurs while reading
-
-
Signature:
public static MessageDigest updateDigest(final MessageDigest messageDigest, final String valueToDigest) - Summary: Updates the given MessageDigest with a string value (converted to UTF-8 bytes).
-
Parameters:
-
messageDigest(MessageDigest) — The MessageDigest to update. -
valueToDigest(String) — The string value to add to the digest.
-
- Returns: The updated MessageDigest (same instance as input).
Public Instance Methods
- (none)
Class DoubleIterator (com.landawn.abacus.util.DoubleIterator)
A specialized iterator for primitive double values that extends ImmutableIterator.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> DoubleIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static DoubleIterator empty() - Summary: Returns an empty {@code DoubleIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code DoubleIterator}
of(...) -> DoubleIterator
-
Signature:
public static DoubleIterator of(final double... a) - Summary: Creates a {@code DoubleIterator} from the specified double array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(double[]) — the double array (may be {@code null} )
-
- Returns: a new {@code DoubleIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static DoubleIterator of(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code DoubleIterator} from a subsequence of the specified double array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(double[]) — the double array (may be {@code null} ) -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: a new {@code DoubleIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds
-
defer(...) -> DoubleIterator
-
Signature:
public static DoubleIterator defer(final Supplier<? extends DoubleIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Creates a DoubleIterator that is initialized lazily using the provided Supplier.
-
Contract:
- The Supplier is invoked only when the first method on the returned iterator is called.
-
Parameters:
-
iteratorSupplier(Supplier<? extends DoubleIterator>) — a Supplier that provides the DoubleIterator when needed
-
- Returns: a lazily initialized DoubleIterator
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> DoubleIterator
-
Signature:
public static DoubleIterator generate(final DoubleSupplier supplier) throws IllegalArgumentException - Summary: Creates an infinite DoubleIterator that generates values using the provided supplier.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate random doubles infinitely DoubleIterator randomIter = DoubleIterator.generate(Math::random); // Must use limit() to avoid infinite iteration randomIter.limit(5).foreachRemaining(System.out::println); } </pre>
-
Parameters:
-
supplier(DoubleSupplier) — the DoubleSupplier that generates values
-
- Returns: an infinite DoubleIterator
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
-
Signature:
public static DoubleIterator generate(final BooleanSupplier hasNext, final DoubleSupplier supplier) throws IllegalArgumentException - Summary: Creates a DoubleIterator that generates values while the hasNext condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — the BooleanSupplier that determines if more elements exist -
supplier(DoubleSupplier) — the DoubleSupplier that generates values
-
- Returns: a conditional DoubleIterator
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
next(...) -> Double
-
Signature:
@Deprecated @Override public Double next() - Summary: Returns the next element as a boxed Double.
-
Parameters:
- (none)
- Returns: the next double value as a Double object
nextDouble(...) -> double
-
Signature:
public abstract double nextDouble() - Summary: Returns the next double value in the iteration.
-
Parameters:
- (none)
- Returns: the next double value
skip(...) -> DoubleIterator
-
Signature:
public DoubleIterator skip(final long n) throws IllegalArgumentException - Summary: Skips the specified number of elements in this iterator.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new DoubleIterator with the first n elements skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> DoubleIterator
-
Signature:
public DoubleIterator limit(final long count) throws IllegalArgumentException - Summary: Limits this iterator to return at most the specified number of elements.
-
Parameters:
-
count(long) — the maximum number of elements to iterate
-
- Returns: a new DoubleIterator limited to the specified count
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> DoubleIterator
-
Signature:
public DoubleIterator filter(final DoublePredicate predicate) throws IllegalArgumentException - Summary: Returns a filtered DoubleIterator that only includes elements matching the predicate.
-
Parameters:
-
predicate(DoublePredicate) — the predicate to test each element
-
- Returns: a new filtered DoubleIterator
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalDouble
-
Signature:
public OptionalDouble first() - Summary: Returns the first element in this iterator wrapped in an OptionalDouble.
-
Contract:
- After calling this method, the iterator will be positioned at the second element (if it exists).
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the first element, or empty if no elements
last(...) -> OptionalDouble
-
Signature:
public OptionalDouble last() - Summary: Returns the last element in this iterator wrapped in an OptionalDouble.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the last element, or empty if no elements
toArray(...) -> double\[\]
-
Signature:
@SuppressWarnings("deprecation") public double[] toArray() - Summary: Converts the remaining elements to a double array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a double array containing all remaining elements
toList(...) -> DoubleList
-
Signature:
public DoubleList toList() - Summary: Converts the remaining elements to a DoubleList.
-
Contract:
- If the iterator is already empty, returns an empty DoubleList.
-
Parameters:
- (none)
- Returns: a DoubleList containing all remaining elements
stream(...) -> DoubleStream
-
Signature:
public DoubleStream stream() - Summary: Converts this iterator to a DoubleStream.
-
Parameters:
- (none)
- Returns: a DoubleStream backed by this iterator
indexed(...) -> ObjIterator<IndexedDouble>
-
Signature:
@Beta public ObjIterator<IndexedDouble> indexed() - Summary: Returns an iterator of IndexedDouble objects that pairs each element with its index.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedDouble objects
-
Signature:
@Beta public ObjIterator<IndexedDouble> indexed(final long startIndex) - Summary: Returns an iterator of IndexedDouble objects that pairs each element with its index, starting from the specified start index.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an ObjIterator of IndexedDouble objects
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Double> action) - Summary: Performs the given action for each remaining element.
-
Parameters:
-
action(java.util.function.Consumer<? super Double>) — the action to perform on each element
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.DoubleConsumer<E> action) throws E - Summary: Performs the given action for each remaining double element.
-
Parameters:
-
action(Throwables.DoubleConsumer<E>) — the action to perform on each element
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntDoubleConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its index.
-
Parameters:
-
action(Throwables.IntDoubleConsumer<E>) — the action to perform on each element with its index
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class DoubleList (com.landawn.abacus.util.DoubleList)
A high-performance, resizable array implementation for primitive double values that provides specialized operations optimized for double-precision floating-point data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> DoubleList
-
Signature:
public static DoubleList of(final double... a) - Summary: Creates a new DoubleList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(double[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new DoubleList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static DoubleList of(final double[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new DoubleList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(double[]) — the array of double values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new DoubleList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> DoubleList
-
Signature:
public static DoubleList copyOf(final double[] a) - Summary: Creates a new DoubleList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(double[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new DoubleList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static DoubleList copyOf(final double[] a, final int fromIndex, final int toIndex) - Summary: Creates a new DoubleList that is a copy of the specified range within the given array.
-
Parameters:
-
a(double[]) — the array from which a range is to be copied. Must not be {@code null} . -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new DoubleList containing a copy of the elements in the specified range
repeat(...) -> DoubleList
-
Signature:
public static DoubleList repeat(final double element, final int len) - Summary: Creates a new DoubleList with the specified element repeated a given number of times.
-
Parameters:
-
element(double) — the double value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new DoubleList containing <i> len </i> copies of the specified element
random(...) -> DoubleList
-
Signature:
public static DoubleList random(final int len) - Summary: Creates a new DoubleList filled with random double values.
-
Parameters:
-
len(int) — the number of random double values to generate. Must be non-negative.
-
- Returns: a new DoubleList containing <i> len </i> random double values
Public Instance Methods
<init>(...) -> void
-
Signature:
public DoubleList() - Summary: Constructs an empty DoubleList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public DoubleList(final int initialCapacity) - Summary: Constructs an empty DoubleList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public DoubleList(final double[] a) - Summary: Constructs a DoubleList using the specified array as the backing array.
-
Parameters:
-
a(double[]) — the array to be used as the backing array for this list. Must not be {@code null} .
-
-
Signature:
public DoubleList(final double[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a DoubleList using the specified array as the backing array with a specific size.
-
Contract:
- This constructor is useful when working with arrays that are larger than the actual data they contain.
-
Parameters:
-
a(double[]) — the array to be used as the backing array for this list. Must not be {@code null} . -
size(int) — the number of elements in the list. Must be between 0 and a.length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> double\[\]
-
Signature:
@Beta @Deprecated @Override public double[] array() - Summary: Returns the underlying double array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal double array backing this list
get(...) -> double
-
Signature:
public double get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> double
-
Signature:
public double set(final int index, final double e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(double) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final double e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- The list will automatically grow if necessary to accommodate the new element.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(double) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final double e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(double) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final DoubleList c) - Summary: Appends all elements from the specified DoubleList to the end of this list.
-
Parameters:
-
c(DoubleList) — the DoubleList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final int index, final DoubleList c) - Summary: Inserts all elements from the specified DoubleList into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(DoubleList) — the DoubleList containing elements to be inserted into this list
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final double[] a) - Summary: Appends all elements from the specified array to the end of this list.
-
Parameters:
-
a(double[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty)
-
Signature:
@Override public boolean addAll(final int index, final double[] a) - Summary: Inserts all elements from the specified array into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(double[]) — the array containing elements to be inserted into this list
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty)
remove(...) -> boolean
-
Signature:
public boolean remove(final double e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(double) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final double e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(double) — the element to be removed from this list
-
- Returns: {@code true} if at least one occurrence was removed from the list
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final DoubleList c) - Summary: Removes from this list all of its elements that are contained in the specified DoubleList.
-
Contract:
- If an element appears multiple times, all occurrences are removed.
-
Parameters:
-
c(DoubleList) — the DoubleList containing elements to be removed from this list
-
- Returns: {@code true} if this list was modified as a result of this operation
-
Signature:
@Override public boolean removeAll(final double[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Contract:
- If an element appears multiple times, all occurrences are removed.
-
Parameters:
-
a(double[]) — the array containing elements to be removed from this list
-
- Returns: {@code true} if this list was modified as a result of this operation
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final DoublePredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(DoublePredicate) — the predicate which returns {@code true} for elements to be removed
-
- Returns: {@code true} if any elements were removed
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only the first occurrence of each value.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed from the list
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final DoubleList c) - Summary: Retains only the elements in this list that are contained in the specified DoubleList.
-
Parameters:
-
c(DoubleList) — the DoubleList containing elements to be retained in this list
-
- Returns: {@code true} if this list was modified as a result of this operation
-
Signature:
@Override public boolean retainAll(final double[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(double[]) — the array containing elements to be retained in this list
-
- Returns: {@code true} if this list was modified as a result of this operation
delete(...) -> double
-
Signature:
public double delete(final int index) - Summary: Removes the element at the specified position in this list and returns it.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes all elements at the specified indices from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed. Can be empty, unordered, or contain duplicates.
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes a range of elements from this list.
-
Parameters:
-
fromIndex(int) — the starting index of the range to be removed (inclusive) -
toIndex(int) — the ending index of the range to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final DoubleList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified DoubleList.
-
Contract:
- The size of the list may change if the replacement has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the starting index of the range to be replaced (inclusive) -
toIndex(int) — the ending index of the range to be replaced (exclusive) -
replacement(DoubleList) — the DoubleList whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final double[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified array.
-
Contract:
- The size of the list may change if the replacement array has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the starting index of the range to be replaced (inclusive) -
toIndex(int) — the ending index of the range to be replaced (exclusive) -
replacement(double[]) — the array whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final double oldVal, final double newVal) - Summary: Replaces all occurrences of a specified value with a new value throughout the list.
-
Parameters:
-
oldVal(double) — the value to be replaced -
newVal(double) — the value to replace oldVal
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final DoubleUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the specified operator to that element.
-
Parameters:
-
operator(DoubleUnaryOperator) — the operator to apply to each element
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final DoublePredicate predicate, final double newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(DoublePredicate) — the predicate to test elements -
newValue(double) — the value to replace matching elements with
-
- Returns: {@code true} if at least one element was replaced
fill(...) -> void
-
Signature:
public void fill(final double val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(double) — the value to fill the list with
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final double val) throws IndexOutOfBoundsException - Summary: Replaces elements in the specified range with the specified value.
-
Parameters:
-
fromIndex(int) — the starting index of the range to fill (inclusive) -
toIndex(int) — the ending index of the range to fill (exclusive) -
val(double) — the value to fill the range with
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
contains(...) -> boolean
-
Signature:
public boolean contains(final double valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code Double.compare(e, valueToFind) == 0} .
-
Parameters:
-
valueToFind(double) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final DoubleList c) - Summary: Checks if this list contains any element from the specified DoubleList.
-
Contract:
- Checks if this list contains any element from the specified DoubleList.
- Returns {@code true} if there is at least one element that appears in both lists.
-
Parameters:
-
c(DoubleList) — the DoubleList to check for common elements
-
- Returns: {@code true} if this list contains any element from the specified list
-
Signature:
@Override public boolean containsAny(final double[] a) - Summary: Checks if this list contains any element from the specified array.
-
Contract:
- Checks if this list contains any element from the specified array.
- Returns {@code true} if there is at least one element that appears in both this list and the array.
-
Parameters:
-
a(double[]) — the array to check for common elements
-
- Returns: {@code true} if this list contains any element from the specified array
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final DoubleList c) - Summary: Checks if this list contains all elements from the specified DoubleList.
-
Contract:
- Checks if this list contains all elements from the specified DoubleList.
- Returns {@code true} only if every element in the specified list is also present in this list.
-
Parameters:
-
c(DoubleList) — the DoubleList to check for containment
-
- Returns: {@code true} if this list contains all elements from the specified list
-
Signature:
@Override public boolean containsAll(final double[] a) - Summary: Checks if this list contains all elements from the specified array.
-
Contract:
- Checks if this list contains all elements from the specified array.
- Returns {@code true} only if every element in the specified array is also present in this list.
-
Parameters:
-
a(double[]) — the array to check for containment
-
- Returns: {@code true} if this list contains all elements from the specified array
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final DoubleList c) - Summary: Checks if this list and the specified DoubleList have no elements in common.
-
Contract:
- Checks if this list and the specified DoubleList have no elements in common.
- Returns {@code true} if the two lists are disjoint (i.e., have no common elements).
-
Parameters:
-
c(DoubleList) — the DoubleList to check for disjointness
-
- Returns: {@code true} if this list and the specified list have no elements in common
-
Signature:
@Override public boolean disjoint(final double[] b) - Summary: Checks if this list and the specified array have no elements in common.
-
Contract:
- Checks if this list and the specified array have no elements in common.
- Returns {@code true} if the list and array are disjoint (i.e., have no common elements).
-
Parameters:
-
b(double[]) — the array to check for disjointness
-
- Returns: {@code true} if this list and the specified array have no elements in common
intersection(...) -> DoubleList
-
Signature:
@Override public DoubleList intersection(final DoubleList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(DoubleList) — the list to find common elements with this list
-
- Returns: a new DoubleList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list. Returns an empty list if either list is {@code null} or empty.
- See also: #intersection(double\[\]), #difference(DoubleList), #symmetricDifference(DoubleList), N#intersection(double\[\], double\[\]), N#intersection(int\[\], int\[\])
-
Signature:
@Override public DoubleList intersection(final double[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(double[]) — the array to find common elements with this list
-
- Returns: a new DoubleList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source. Returns an empty list if the array is {@code null} or empty.
- See also: #intersection(DoubleList), #difference(double\[\]), #symmetricDifference(double\[\]), N#intersection(double\[\], double\[\]), N#intersection(int\[\], int\[\])
difference(...) -> DoubleList
-
Signature:
@Override public DoubleList difference(final DoubleList b) - Summary: Returns a new list with the elements in this list but not in the specified list {@code b} , considering the number of occurrences of each element.
-
Contract:
- If an element appears n times in this list and m times in the specified list, the result will contain (n - m) occurrences of that element (or zero if m > = n).
-
Parameters:
-
b(DoubleList) — the list to compare against this list
-
- Returns: a new DoubleList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: #difference(double\[\]), #symmetricDifference(DoubleList), #intersection(DoubleList), N#difference(double\[\], double\[\]), N#difference(int\[\], int\[\])
-
Signature:
@Override public DoubleList difference(final double[] b) - Summary: Returns a new list with the elements in this list but not in the specified array {@code b} , considering the number of occurrences of each element.
-
Contract:
- If an element appears n times in this list and m times in the specified array, the result will contain (n - m) occurrences of that element (or zero if m > = n).
-
Parameters:
-
b(double[]) — the array to compare against this list
-
- Returns: a new DoubleList containing the elements that are present in this list but not in the specified array, considering the number of occurrences. Returns a copy of this list if {@code b} is {@code null} or empty.
- See also: #difference(DoubleList), #symmetricDifference(double\[\]), #intersection(double\[\]), N#difference(double\[\], double\[\]), N#difference(double\[\], double\[\])
symmetricDifference(...) -> DoubleList
-
Signature:
@Override public DoubleList symmetricDifference(final DoubleList b) - Summary: Returns a new DoubleList containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
b(DoubleList) — the list to compare with this list for symmetric difference
-
- Returns: a new DoubleList containing elements that are present in either this list or the specified list, but not in both, considering the number of occurrences
- See also: #symmetricDifference(double\[\]), #difference(DoubleList), #intersection(DoubleList), N#symmetricDifference(double\[\], double\[\]), N#symmetricDifference(int\[\], int\[\])
-
Signature:
@Override public DoubleList symmetricDifference(final double[] b) - Summary: Returns a new DoubleList containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
b(double[]) — the array to compare with this list for symmetric difference
-
- Returns: a new DoubleList containing elements that are present in either this list or the specified array, but not in both, considering the number of occurrences
- See also: #symmetricDifference(DoubleList), #difference(double\[\]), #intersection(double\[\]), N#symmetricDifference(double\[\], double\[\]), N#symmetricDifference(int\[\], int\[\])
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final double valueToFind) - Summary: Counts the number of occurrences of the specified value in this list.
-
Parameters:
-
valueToFind(double) — the value to count occurrences of
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final double valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the element.
-
Parameters:
-
valueToFind(double) — the element to search for
-
- Returns: the index of the first occurrence of the specified element, or {@code N.INDEX_NOT_FOUND} (-1) if not found
-
Signature:
public int indexOf(final double valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, starting the search at the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, starting the search at the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the element is not found.
-
Parameters:
-
valueToFind(double) — the element to search for -
fromIndex(int) — the index to start the search from (inclusive)
-
- Returns: the index of the first occurrence of the specified element at or after fromIndex, or {@code N.INDEX_NOT_FOUND} (-1) if not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final double valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(double) — the element to search for
-
- Returns: the index of the last occurrence of the specified element, or -1 if not found
-
Signature:
public int lastIndexOf(final double valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(double) — the element to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). The search includes this index and proceeds towards index 0.
-
- Returns: the index of the last occurrence of the specified element at or before startIndexFromBack, or -1 if not found
min(...) -> OptionalDouble
-
Signature:
public OptionalDouble min() - Summary: Returns the minimum element in this list wrapped in an OptionalDouble.
-
Contract:
- If the list is empty, returns an empty OptionalDouble.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the minimum element, or empty if the list is empty
-
Signature:
public OptionalDouble min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum element in the specified range of this list wrapped in an OptionalDouble.
-
Contract:
- If the range is empty (fromIndex == toIndex), returns an empty OptionalDouble.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: an OptionalDouble containing the minimum element in the range, or empty if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
max(...) -> OptionalDouble
-
Signature:
public OptionalDouble max() - Summary: Returns the maximum element in this list wrapped in an OptionalDouble.
-
Contract:
- If the list is empty, returns an empty OptionalDouble.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the maximum element, or empty if the list is empty
-
Signature:
public OptionalDouble max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the maximum element in the specified range of this list wrapped in an OptionalDouble.
-
Contract:
- If the range is empty (fromIndex == toIndex), returns an empty OptionalDouble.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: an OptionalDouble containing the maximum element in the range, or empty if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
median(...) -> OptionalDouble
-
Signature:
public OptionalDouble median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the median value if the list is non-empty, or an empty OptionalDouble if the list is empty
-
Signature:
public OptionalDouble median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalDouble containing the median value if the range is non-empty, or an empty OptionalDouble if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final DoubleConsumer action) - Summary: Performs the given action for each element in this list, in the order elements occur in the list, until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(DoubleConsumer) — the action to be performed for each element. Must not be {@code null} .
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final DoubleConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element in the specified range of this list, in the order elements occur in the list (or reverse order if fromIndex > toIndex), until all elements have been processed or the action throws an exception.
-
Contract:
- Performs the given action for each element in the specified range of this list, in the order elements occur in the list (or reverse order if fromIndex > toIndex), until all elements have been processed or the action throws an exception.
- <p> If {@code fromIndex <= toIndex} , iteration proceeds from fromIndex (inclusive) to toIndex (exclusive).
- If {@code fromIndex > toIndex} , iteration proceeds from fromIndex (inclusive) down to toIndex (exclusive) in reverse order.
- </p> <p> Special case: if {@code toIndex == -1} and {@code fromIndex > toIndex} , iteration starts from fromIndex down to 0 (inclusive).
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be processed -
toIndex(int) — the index of the last element (exclusive) to be processed, or -1 for reverse iteration to the beginning -
action(DoubleConsumer) — the action to be performed for each element. Must not be {@code null} .
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range ( {@code fromIndex < 0 || toIndex > size() || (fromIndex > toIndex && toIndex != -1)} )
-
first(...) -> OptionalDouble
-
Signature:
public OptionalDouble first() - Summary: Returns an {@code OptionalDouble} containing the first element of this list, or an empty {@code OptionalDouble} if this list is empty.
-
Contract:
- Returns an {@code OptionalDouble} containing the first element of this list, or an empty {@code OptionalDouble} if this list is empty.
- <p> This method provides a null-safe way to access the first element without risking an exception when the list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing the first element if present, otherwise an empty {@code OptionalDouble}
last(...) -> OptionalDouble
-
Signature:
public OptionalDouble last() - Summary: Returns an {@code OptionalDouble} containing the last element of this list, or an empty {@code OptionalDouble} if this list is empty.
-
Contract:
- Returns an {@code OptionalDouble} containing the last element of this list, or an empty {@code OptionalDouble} if this list is empty.
- <p> This method provides a null-safe way to access the last element without risking an exception when the list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing the last element if present, otherwise an empty {@code OptionalDouble}
distinct(...) -> DoubleList
-
Signature:
@Override public DoubleList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new {@code DoubleList} containing only the distinct elements from the specified range of this list, preserving their original order of first occurrence.
-
Contract:
- </p> <p> For example, if the range contains \[1.0, 2.0, 1.0, 3.0, 2.0\], the returned list will contain \[1.0, 2.0, 3.0\].
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to process -
toIndex(int) — the index of the last element (exclusive) to process
-
- Returns: a new {@code DoubleList} containing the distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains any duplicate elements.
-
Contract:
- <p> This method returns {@code true} if any value appears more than once in the list, {@code false} if all elements are unique.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains at least one duplicate element, {@code false} if all elements are unique
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Contract:
- <p> Returns {@code true} if the list is empty, contains only one element, or all elements are arranged in non-decreasing order (each element is less than or equal to the next element).
-
Parameters:
- (none)
- Returns: {@code true} if this list is sorted in ascending order, {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts the elements of this list into ascending order.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no sorting is performed.
-
Parameters:
- (none)
- Performance: This algorithm offers O(n log(n)) performance on many data sets.
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts the elements of this list into ascending order using a parallel sort algorithm.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no sorting is performed.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts the elements of this list into descending order.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no sorting is performed.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final double valueToFind) - Summary: Searches for the specified value in this sorted list using the binary search algorithm.
-
Contract:
- <p> The list must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
- If the list contains multiple elements with the specified value, there is no guarantee which one will be found.
-
Parameters:
-
valueToFind(double) — the value to search for
-
- Returns: the index of the search key, if it is contained in the list; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or {@code size()} if all elements in the list are less than the specified key.
- Performance: </p> <p> This method runs in O(log n) time for a list of size n.
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final double valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified value within the specified range of this sorted list using the binary search algorithm.
-
Contract:
- <p> The range must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
- If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be searched -
toIndex(int) — the index of the last element (exclusive) to be searched -
valueToFind(double) — the value to search for
-
- Returns: the index of the search key, if it is contained in the specified range; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the range: the index of the first element greater than the key, or {@code toIndex} if all elements in the range are less than the specified key.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
- Performance: </p> <p> This method runs in O(log(toIndex - fromIndex)) time.
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no reversal is performed.
-
Parameters:
- (none)
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Contract:
- </p> <p> If the range contains fewer than 2 elements, no reversal is performed.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be reversed -
toIndex(int) — the index of the last element (exclusive) to be reversed
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly permutes the elements in this list using a default source of randomness.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no shuffling is performed.
-
Parameters:
- (none)
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly permutes the elements in this list using the specified source of randomness.
-
Contract:
- </p> <p> If the list contains fewer than 2 elements, no shuffling is performed.
-
Parameters:
-
rnd(Random) — the source of randomness to use to shuffle the list. Must not be {@code null} .
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Parameters:
-
i(int) — the index of one element to be swapped -
j(int) — the index of the other element to be swapped
-
copy(...) -> DoubleList
-
Signature:
@Override public DoubleList copy() - Summary: Returns a shallow copy of this list.
-
Parameters:
- (none)
- Returns: a new {@code DoubleList} containing all elements of this list
-
Signature:
@Override public DoubleList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a shallow copy of the portion of this list between the specified {@code fromIndex} (inclusive) and {@code toIndex} (exclusive).
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be copied -
toIndex(int) — the index of the last element (exclusive) to be copied
-
- Returns: a new {@code DoubleList} containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public DoubleList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a shallow copy of the portion of this list between the specified {@code fromIndex} and {@code toIndex} with the specified step.
-
Contract:
- If {@code step} is negative and {@code fromIndex > toIndex} , elements are copied in reverse order.
-
Parameters:
-
fromIndex(int) — the index of the first element to be copied -
toIndex(int) — the index boundary (exclusive) for copying -
step(int) — the increment between successive elements to be copied. Must not be zero.
-
- Returns: a new {@code DoubleList} containing the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<DoubleList>
-
Signature:
@Override public List<DoubleList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Returns a list of {@code DoubleList} instances, each containing a consecutive subsequence of elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index of the last element (exclusive) to be included -
chunkSize(int) — the desired size of each subsequence. Must be positive.
-
- Returns: a list of {@code DoubleList} instances, each containing a chunk of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
trimToSize(...) -> DoubleList
-
Signature:
@Override public DoubleList trimToSize() - Summary: Trims the capacity of this list to be the list's current size.
-
Contract:
- If the backing array has excess capacity, a new array of the exact size is allocated and the elements are copied into it.
-
Parameters:
- (none)
- Returns: this {@code DoubleList} instance (for method chaining)
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Double>
-
Signature:
@Override public List<Double> boxed() - Summary: Returns a {@code List<Double>} containing all elements of this list.
-
Parameters:
- (none)
- Returns: a new {@code List<Double>} containing all elements of this list
-
Signature:
@Override public List<Double> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code List<Double>} containing the elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index of the last element (exclusive) to be included
-
- Returns: a new {@code List<Double>} containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toArray(...) -> double\[\]
-
Signature:
@Override public double[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new double array containing all elements of this list
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Double>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index of the last element (exclusive) to be included -
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified initial capacity
-
- Returns: a collection containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Double>
-
Signature:
@Override public Multiset<Double> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Double>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index of the last element (exclusive) to be included -
supplier(IntFunction<Multiset<Double>>) — a function that creates a new {@code Multiset} instance with the specified initial capacity
-
- Returns: a {@code Multiset} containing the specified range of elements with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
iterator(...) -> DoubleIterator
-
Signature:
@Override public DoubleIterator iterator() - Summary: Returns an iterator over the elements in this list in proper sequence.
-
Contract:
- <p> The returned iterator is fail-fast: if the list is structurally modified at any time after the iterator is created, the iterator may throw a {@code ConcurrentModificationException} .
- This behavior is not guaranteed and should not be relied upon for correctness.
-
Parameters:
- (none)
- Returns: a {@code DoubleIterator} over the elements in this list
stream(...) -> DoubleStream
-
Signature:
public DoubleStream stream() - Summary: Returns a {@code DoubleStream} with this list as its source.
-
Parameters:
- (none)
- Returns: a sequential {@code DoubleStream} over the elements in this list
-
Signature:
public DoubleStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code DoubleStream} with the specified range of this list as its source.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included -
toIndex(int) — the index of the last element (exclusive) to be included
-
- Returns: a sequential {@code DoubleStream} over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
getFirst(...) -> double
-
Signature:
public double getFirst() - Summary: Returns the first element in this list.
-
Contract:
- <p> This method provides direct access to the first element without creating an {@code Optional} wrapper, but will throw an exception if the list is empty.
-
Parameters:
- (none)
- Returns: the first double value in the list
getLast(...) -> double
-
Signature:
public double getLast() - Summary: Returns the last element in this list.
-
Contract:
- <p> This method provides direct access to the last element without creating an {@code Optional} wrapper, but will throw an exception if the list is empty.
-
Parameters:
- (none)
- Returns: the last double value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final double e) - Summary: Inserts the specified element at the beginning of this list.
-
Contract:
- <p> Shifts the element currently at position 0 (if any) and any subsequent elements to the right (adds one to their indices).
-
Parameters:
-
e(double) — the element to add at the beginning of the list
-
- Performance: This operation has O(n) time complexity where n is the size of the list.
addLast(...) -> void
-
Signature:
public void addLast(final double e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(double) — the element to add at the end of the list
-
- Performance: <p> This is equivalent to calling {@code add(e)} and has amortized constant time complexity.
removeFirst(...) -> double
-
Signature:
public double removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first double value that was removed from the list
- Performance: This operation has O(n) time complexity where n is the size of the list.
removeLast(...) -> double
-
Signature:
public double removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last double value that was removed from the list
- Performance: <p> This operation has O(1) time complexity.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this list for equality.
-
Contract:
- <p> Returns {@code true} if and only if the specified object is also a {@code DoubleList} , both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
- Two double values are considered equal if they have the same bit pattern (which means that {@code NaN} equals {@code NaN} and {@code -0.0} does not equal {@code 0.0} for this method).
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Contract:
- </p> <p> If the list is empty, returns "\[\]".
-
Parameters:
- (none)
- Returns: a string representation of this list
Class Duration (com.landawn.abacus.util.Duration)
A high-performance, immutable representation of a time-based amount of duration measured in milliseconds, designed as an efficient alternative to {@code java.time.Duration} for scenarios where nanosecond precision is not required.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
ofDays(...) -> Duration
-
Signature:
public static Duration ofDays(final long days) - Summary: Creates a Duration representing the specified number of days.
-
Contract:
- This method will throw an ArithmeticException if the multiplication would cause an overflow.
-
Parameters:
-
days(long) — the number of days, positive or negative.
-
- Returns: a Duration representing the specified number of days.
ofHours(...) -> Duration
-
Signature:
public static Duration ofHours(final long hours) - Summary: Creates a Duration representing the specified number of hours.
-
Contract:
- This method will throw an ArithmeticException if the multiplication would cause an overflow.
-
Parameters:
-
hours(long) — the number of hours, positive or negative.
-
- Returns: a Duration representing the specified number of hours.
ofMinutes(...) -> Duration
-
Signature:
public static Duration ofMinutes(final long minutes) - Summary: Creates a Duration representing the specified number of minutes.
-
Contract:
- This method will throw an ArithmeticException if the multiplication would cause an overflow.
-
Parameters:
-
minutes(long) — the number of minutes, positive or negative.
-
- Returns: a Duration representing the specified number of minutes.
ofSeconds(...) -> Duration
-
Signature:
public static Duration ofSeconds(final long seconds) - Summary: Creates a Duration representing the specified number of seconds.
-
Contract:
- This method will throw an ArithmeticException if the multiplication would cause an overflow.
-
Parameters:
-
seconds(long) — the number of seconds, positive or negative.
-
- Returns: a Duration representing the specified number of seconds.
ofMillis(...) -> Duration
-
Signature:
public static Duration ofMillis(final long millis) - Summary: Creates a Duration representing the specified number of milliseconds.
-
Contract:
- If the milliseconds value is 0, this method returns the constant ZERO instance for efficiency.
-
Parameters:
-
millis(long) — the number of milliseconds, positive or negative.
-
- Returns: a Duration representing the specified number of milliseconds.
between(...) -> Duration
-
Signature:
public static Duration between(final java.util.Date start, final java.util.Date end) - Summary: Calculates the duration between two dates by determining the time difference from the first date to the second.
-
Contract:
- The result represents the time interval as a {@link Duration} object, which can be positive (if {@code end} is after {@code start} ), negative (if {@code end} is before {@code start} ), or zero (if both dates represent the same instant).
- perform operation Date end = new Date(); Duration elapsed = Duration.between(start, end); long millisElapsed = elapsed.toMillis(); // Calculating age Date birthDate = Dates.parseDate("1990-05-15"); Date today = new Date(); Duration age = Duration.between(birthDate, today); long ageInDays = age.toDays(); // Time until deadline Date now = new Date(); Date deadline = Dates.parseDate("2024-12-31"); Duration remaining = Duration.between(now, deadline); if (remaining.isNegative()) { System.out.println("Deadline has passed"); } else { System.out.println("Days remaining: " + remaining.toDays()); } } </pre> <p> <b> Time Zone: </b> Operates on UTC millisecond timestamps, unaffected by time zones.
-
Parameters:
-
start(java.util.Date) — the start date (inclusive), must not be {@code null} . -
end(java.util.Date) — the end date (exclusive), must not be {@code null} .
-
- Returns: a {@link Duration} representing the time difference from {@code start} to {@code end} , positive if {@code end} is after {@code start} , negative if {@code end} is before {@code start} .
- See also: #between(java.util.Calendar, java.util.Calendar), #between(java.time.temporal.Temporal, java.time.temporal.Temporal), java.time.Duration#between(java.time.temporal.Temporal, java.time.temporal.Temporal)
-
Signature:
public static Duration between(final java.util.Calendar start, final java.util.Calendar end) - Summary: Calculates the duration between two calendar instances by determining the time difference from the first calendar to the second.
-
Contract:
- The result represents the time interval as a {@link Duration} object, which can be positive (if {@code end} is after {@code start} ), negative (if {@code end} is before {@code start} ), or zero (if both calendars represent the same instant).
- perform operation Calendar end = Calendar.getInstance(); Duration elapsed = Duration.between(start, end); long millisElapsed = elapsed.toMillis(); // Calculating age Calendar birthDate = Calendar.getInstance(); birthDate.set(1990, Calendar.MAY, 15); Calendar today = Calendar.getInstance(); Duration age = Duration.between(birthDate, today); long ageInDays = age.toDays(); // Time until deadline Calendar now = Calendar.getInstance(); Calendar deadline = Calendar.getInstance(); deadline.set(2024, Calendar.DECEMBER, 31); Duration remaining = Duration.between(now, deadline); if (remaining.isNegative()) { System.out.println("Deadline has passed"); } else { System.out.println("Days remaining: " + remaining.toDays()); } } </pre> <p> <b> Time Zone: </b> Operates on UTC millisecond timestamps, unaffected by time zones.
-
Parameters:
-
start(java.util.Calendar) — the start calendar (inclusive), must not be {@code null} . -
end(java.util.Calendar) — the end calendar (exclusive), must not be {@code null} .
-
- Returns: a {@link Duration} representing the time difference from {@code start} to {@code end} , positive if {@code end} is after {@code start} , negative if {@code end} is before {@code start} .
- See also: #between(java.util.Date, java.util.Date), #between(java.time.temporal.Temporal, java.time.temporal.Temporal), java.time.Duration#between(java.time.temporal.Temporal, java.time.temporal.Temporal)
-
Signature:
public static Duration between(final Temporal start, final Temporal end) - Summary: Calculates the duration between two temporal objects by determining the time difference from the first temporal to the second.
-
Contract:
- The result represents the time interval as a {@link Duration} object, which can be positive (if {@code end} is after {@code start} ), negative (if {@code end} is before {@code start} ), or zero (if both temporals represent the same instant).
- perform operation Instant end = Instant.now(); Duration elapsed = Duration.between(start, end); long millisElapsed = elapsed.toMillis(); // Calculating age LocalDateTime birthDate = LocalDateTime.of(1990, Month.MAY, 15, 0, 0); LocalDateTime today = LocalDateTime.now(); Duration age = Duration.between(birthDate, today); long ageInDays = age.toDays(); // Time until deadline LocalDateTime now = LocalDateTime.now(); LocalDateTime deadline = LocalDateTime.of(2024, Month.DECEMBER, 31, 0, 0); Duration remaining = Duration.between(now, deadline); if (remaining.isNegative()) { System.out.println("Deadline has passed"); } else { System.out.println("Days remaining: " + remaining.toDays()); } } </pre>
-
Parameters:
-
start(Temporal) — the start temporal (inclusive), must not be {@code null} . -
end(Temporal) — the end temporal (exclusive), must not be {@code null} .
-
- Returns: a {@link Duration} representing the time difference from {@code start} to {@code end} , positive if {@code end} is after {@code start} , negative if {@code end} is before {@code start} .
- See also: #between(java.util.Date, java.util.Date), #between(java.util.Calendar, java.util.Calendar), Temporal#until(java.time.temporal.Temporal, java.time.temporal.TemporalUnit), TemporalUnit#between(Temporal, Temporal), ChronoUnit#between(Temporal, Temporal), java.time.Duration#between(java.time.temporal.Temporal, java.time.temporal.Temporal)
Public Instance Methods
isZero(...) -> boolean
-
Signature:
public boolean isZero() - Summary: Checks if this duration represents zero time.
-
Contract:
- Checks if this duration represents zero time.
- <p> A duration is considered zero if its internal milliseconds value is exactly 0.
- This is useful for checking if a duration represents no elapsed time.
-
Parameters:
- (none)
- Returns: {@code true} if this duration is zero, {@code false} otherwise.
isNegative(...) -> boolean
-
Signature:
public boolean isNegative() - Summary: Checks if this duration represents a negative amount of time.
-
Contract:
- Checks if this duration represents a negative amount of time.
- <p> A duration is considered negative if its internal milliseconds value is less than 0.
-
Parameters:
- (none)
- Returns: {@code true} if this duration is negative, {@code false} otherwise.
plus(...) -> Duration
-
Signature:
public Duration plus(final Duration duration) - Summary: Returns a copy of this duration with the specified duration added.
-
Contract:
- The addition is performed with overflow checking, throwing an ArithmeticException if the result would overflow.
-
Parameters:
-
duration(Duration) — the duration to add, not null.
-
- Returns: a Duration based on this duration with the specified duration added.
plusDays(...) -> Duration
-
Signature:
public Duration plusDays(final long daysToAdd) - Summary: Returns a copy of this duration with the specified number of days added.
-
Parameters:
-
daysToAdd(long) — the days to add, may be negative.
-
- Returns: a Duration based on this duration with the specified days added.
plusHours(...) -> Duration
-
Signature:
public Duration plusHours(final long hoursToAdd) - Summary: Returns a copy of this duration with the specified number of hours added.
-
Parameters:
-
hoursToAdd(long) — the hours to add, may be negative.
-
- Returns: a Duration based on this duration with the specified hours added.
plusMinutes(...) -> Duration
-
Signature:
public Duration plusMinutes(final long minutesToAdd) - Summary: Returns a copy of this duration with the specified number of minutes added.
-
Parameters:
-
minutesToAdd(long) — the minutes to add, may be negative.
-
- Returns: a Duration based on this duration with the specified minutes added.
plusSeconds(...) -> Duration
-
Signature:
public Duration plusSeconds(final long secondsToAdd) - Summary: Returns a copy of this duration with the specified number of seconds added.
-
Parameters:
-
secondsToAdd(long) — the seconds to add, may be negative.
-
- Returns: a Duration based on this duration with the specified seconds added.
plusMillis(...) -> Duration
-
Signature:
public Duration plusMillis(final long millisToAdd) - Summary: Returns a copy of this duration with the specified number of milliseconds added.
-
Contract:
- <p> This method performs the addition with overflow checking, throwing an ArithmeticException if the result would overflow.
- If the millisToAdd parameter is 0, this method returns the current instance for efficiency.
-
Parameters:
-
millisToAdd(long) — the milliseconds to add, may be negative.
-
- Returns: a Duration based on this duration with the specified milliseconds added, or this instance if millisToAdd is 0.
minus(...) -> Duration
-
Signature:
public Duration minus(final Duration duration) - Summary: Returns a copy of this duration with the specified duration subtracted.
-
Contract:
- The subtraction is performed with overflow checking, throwing an ArithmeticException if the result would overflow.
-
Parameters:
-
duration(Duration) — the duration to subtract, not null.
-
- Returns: a Duration based on this duration with the specified duration subtracted.
minusDays(...) -> Duration
-
Signature:
public Duration minusDays(final long daysToSubtract) - Summary: Returns a copy of this duration with the specified number of days subtracted.
-
Parameters:
-
daysToSubtract(long) — the days to subtract, may be negative.
-
- Returns: a Duration based on this duration with the specified days subtracted.
minusHours(...) -> Duration
-
Signature:
public Duration minusHours(final long hoursToSubtract) - Summary: Returns a copy of this duration with the specified number of hours subtracted.
-
Parameters:
-
hoursToSubtract(long) — the hours to subtract, may be negative.
-
- Returns: a Duration based on this duration with the specified hours subtracted.
minusMinutes(...) -> Duration
-
Signature:
public Duration minusMinutes(final long minutesToSubtract) - Summary: Returns a copy of this duration with the specified number of minutes subtracted.
-
Parameters:
-
minutesToSubtract(long) — the minutes to subtract, may be negative.
-
- Returns: a Duration based on this duration with the specified minutes subtracted.
minusSeconds(...) -> Duration
-
Signature:
public Duration minusSeconds(final long secondsToSubtract) - Summary: Returns a copy of this duration with the specified number of seconds subtracted.
-
Parameters:
-
secondsToSubtract(long) — the seconds to subtract, may be negative.
-
- Returns: a Duration based on this duration with the specified seconds subtracted.
minusMillis(...) -> Duration
-
Signature:
public Duration minusMillis(final long millisToSubtract) - Summary: Returns a copy of this duration with the specified number of milliseconds subtracted.
-
Contract:
- <p> This method performs the subtraction with overflow checking, throwing an ArithmeticException if the result would overflow.
- If the millisToSubtract parameter is 0, this method returns the current instance for efficiency.
-
Parameters:
-
millisToSubtract(long) — the milliseconds to subtract, may be negative.
-
- Returns: a Duration based on this duration with the specified milliseconds subtracted, or this instance if millisToSubtract is 0.
multipliedBy(...) -> Duration
-
Signature:
public Duration multipliedBy(final long multiplicand) - Summary: Returns a copy of this duration multiplied by the scalar.
-
Contract:
- Special cases: <ul> <li> If the multiplicand is 0, returns the ZERO constant </li> <li> If the multiplicand is 1, returns this instance </li> <li> Otherwise, returns a new Duration with the multiplied value </li> </ul> <p> This instance is immutable and unaffected by this method call.
-
Parameters:
-
multiplicand(long) — the value to multiply the duration by, positive or negative.
-
- Returns: a Duration based on this duration multiplied by the specified scalar.
dividedBy(...) -> Duration
-
Signature:
public Duration dividedBy(final long divisor) - Summary: Returns a copy of this duration divided by the specified value.
-
Contract:
- Special cases: <ul> <li> If the divisor is 0, throws ArithmeticException </li> <li> If the divisor is 1, returns this instance </li> <li> Otherwise, returns a new Duration with the divided value (truncated) </li> </ul> <p> This instance is immutable and unaffected by this method call.
-
Parameters:
-
divisor(long) — the value to divide the duration by, positive or negative but not zero.
-
- Returns: a Duration based on this duration divided by the specified divisor.
negated(...) -> Duration
-
Signature:
public Duration negated() - Summary: Returns a copy of this duration with the length negated.
-
Parameters:
- (none)
- Returns: a Duration based on this duration with the amount negated.
abs(...) -> Duration
-
Signature:
public Duration abs() - Summary: Returns a duration with a positive length.
-
Contract:
- If the duration is already positive or zero, it returns this instance.
- If the duration is negative, it returns a negated copy.
-
Parameters:
- (none)
- Returns: a Duration based on this duration with an absolute length.
toDays(...) -> long
-
Signature:
public long toDays() - Summary: Gets the number of days in this duration.
-
Parameters:
- (none)
- Returns: the number of days in the duration, may be negative.
toHours(...) -> long
-
Signature:
public long toHours() - Summary: Gets the number of hours in this duration.
-
Parameters:
- (none)
- Returns: the number of hours in the duration, may be negative.
toMinutes(...) -> long
-
Signature:
public long toMinutes() - Summary: Gets the number of minutes in this duration.
-
Parameters:
- (none)
- Returns: the number of minutes in the duration, may be negative.
toSeconds(...) -> long
-
Signature:
public long toSeconds() - Summary: Gets the number of seconds in this duration.
-
Parameters:
- (none)
- Returns: the number of seconds in the duration, may be negative.
toMillis(...) -> long
-
Signature:
public long toMillis() - Summary: Gets the number of milliseconds in this duration.
-
Parameters:
- (none)
- Returns: the number of milliseconds in the duration, may be negative.
toJdkDuration(...) -> java.time.Duration
-
Signature:
public java.time.Duration toJdkDuration() - Summary: Converts this {@code Duration} to a {@code java.time.Duration} .
-
Parameters:
- (none)
- Returns: a {@code java.time.Duration} with the same milliseconds value, not null.
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final Duration other) - Summary: Compares this duration to another duration based on their length.
-
Contract:
- A duration is considered less than another if it represents a shorter amount of time, regardless of whether the durations are positive or negative.
-
Parameters:
-
other(Duration) — the other duration to compare to, not null.
-
- Returns: the comparator value, negative if less, positive if greater, zero if equal.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this duration is equal to another duration.
-
Contract:
- Checks if this duration is equal to another duration.
- Two durations are considered equal if they represent the exact same amount of time.
-
Parameters:
-
obj(Object) — the object to check, {@code null} returns false.
-
- Returns: {@code true} if this is equal to the other duration.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this duration.
-
Parameters:
- (none)
- Returns: a suitable hash code.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this duration using ISO-8601 seconds based representation.
-
Contract:
- <p> The format of the returned string will be {@code PTnHnMnS} , where: <ul> <li> P is the duration designator (historically called "period") placed at the start </li> <li> T is the time designator that precedes the time components </li> <li> H represents hours and is shown only if non-zero </li> <li> M represents minutes and is shown only if non-zero </li> <li> S represents seconds and is always shown (even if zero) unless both hours and minutes are present and seconds are zero </li> </ul> Examples: <ul> <li> "PT0S" - zero duration </li> <li> "PT1H" - 1 hour </li> <li> "PT1H30M" - 1 hour and 30 minutes </li> <li> "PT1H30M25S" - 1 hour, 30 minutes and 25 seconds </li> <li> "PT25.5S" - 25.5 seconds (25 seconds and 500 milliseconds) </li> <li> "PT-0.5S" - negative 500 milliseconds </li> </ul>
-
Parameters:
- (none)
- Returns: an ISO-8601 representation of this duration, not null.
Class EmailUtil (com.landawn.abacus.util.EmailUtil)
Utility class for sending emails using JavaMail API.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
sendEmail(...) -> void
-
Signature:
public static void sendEmail(final String[] recipients, final String from, final String subject, final String content, final String userName, final String password, final Properties props) - Summary: Sends a plain text email to the specified recipients.
-
Parameters:
-
recipients(String[]) — array of email addresses to send the email to; must not be {@code null} or empty -
from(String) — the sender's email address; must not be {@code null} or empty -
subject(String) — the email subject. May be {@code null} or empty -
content(String) — the plain text content of the email. May be {@code null} or empty -
userName(String) — the username for SMTP authentication; must not be {@code null} -
password(String) — the password for SMTP authentication; must not be {@code null} -
props(Properties) — mail server properties; must not be {@code null} . Common properties include: <ul> <li> {@code mail.smtp.host} - SMTP server host (required) </li> <li> {@code mail.smtp.port} - SMTP server port (e.g., 25, 587, 465) </li> <li> {@code mail.smtp.auth} - enable authentication (true/false) </li> <li> {@code mail.smtp.starttls.enable} - enable STARTTLS (true/false) </li> <li> {@code mail.smtp.ssl.enable} - enable SSL (true/false) </li> <li> {@code mail.smtp.ssl.trust} - trusted hosts </li> </ul>
-
- See also: #sendEmailWithAttachment(String\[\], String, String, String, String\[\], String, String, Properties), #sendHtmlEmail(String\[\], String, String, String, String, String, Properties)
sendEmailWithAttachment(...) -> void
-
Signature:
public static void sendEmailWithAttachment(final String[] recipients, final String from, final String subject, final String content, final String[] attachedFiles, final String userName, final String password, final Properties props) - Summary: Sends a plain text email with file attachments to the specified recipients.
-
Parameters:
-
recipients(String[]) — array of email addresses to send the email to; must not be {@code null} or empty -
from(String) — the sender's email address; must not be {@code null} or empty -
subject(String) — the email subject. May be {@code null} or empty -
content(String) — the plain text content of the email. May be {@code null} or empty -
attachedFiles(String[]) — array of file paths (absolute or relative) to attach, or {@code null} if no attachments. Files must exist and be readable. The file name (not full path) will be used as the attachment name -
userName(String) — the username for SMTP authentication; must not be {@code null} -
password(String) — the password for SMTP authentication; must not be {@code null} -
props(Properties) — mail server properties; must not be {@code null} . Common properties include: <ul> <li> {@code mail.smtp.host} - SMTP server host (required) </li> <li> {@code mail.smtp.port} - SMTP server port (e.g., 25, 587, 465) </li> <li> {@code mail.smtp.auth} - enable authentication (true/false) </li> <li> {@code mail.smtp.starttls.enable} - enable STARTTLS (true/false) </li> <li> {@code mail.smtp.ssl.enable} - enable SSL (true/false) </li> <li> {@code mail.smtp.ssl.trust} - trusted hosts </li> </ul>
-
- See also: #sendEmail(String\[\], String, String, String, String, String, Properties), #sendHtmlEmailWithAttachment(String\[\], String, String, String, String\[\], String, String, Properties)
sendHtmlEmail(...) -> void
-
Signature:
public static void sendHtmlEmail(final String[] recipients, final String from, final String subject, final String content, final String userName, final String password, final Properties props) - Summary: Sends an HTML email to the specified recipients.
-
Parameters:
-
recipients(String[]) — array of email addresses to send the email to; must not be {@code null} or empty -
from(String) — the sender's email address; must not be {@code null} or empty -
subject(String) — the email subject. May be {@code null} or empty -
content(String) — the HTML content of the email. May be {@code null} or empty -
userName(String) — the username for SMTP authentication; must not be {@code null} -
password(String) — the password for SMTP authentication; must not be {@code null} -
props(Properties) — mail server properties; must not be {@code null} . Common properties include: <ul> <li> {@code mail.smtp.host} - SMTP server host (required) </li> <li> {@code mail.smtp.port} - SMTP server port (e.g., 25, 587, 465) </li> <li> {@code mail.smtp.auth} - enable authentication (true/false) </li> <li> {@code mail.smtp.starttls.enable} - enable STARTTLS (true/false) </li> <li> {@code mail.smtp.ssl.enable} - enable SSL (true/false) </li> <li> {@code mail.smtp.ssl.trust} - trusted hosts </li> </ul>
-
- See also: #sendHtmlEmailWithAttachment(String\[\], String, String, String, String\[\], String, String, Properties), #sendEmail(String\[\], String, String, String, String, String, Properties)
sendHtmlEmailWithAttachment(...) -> void
-
Signature:
public static void sendHtmlEmailWithAttachment(final String[] recipients, final String from, final String subject, final String content, final String[] attachedFiles, final String userName, final String password, final Properties props) - Summary: Sends an HTML email with file attachments to the specified recipients.
-
Parameters:
-
recipients(String[]) — array of email addresses to send the email to; must not be {@code null} or empty -
from(String) — the sender's email address; must not be {@code null} or empty -
subject(String) — the email subject. May be {@code null} or empty -
content(String) — the HTML content of the email. May be {@code null} or empty -
attachedFiles(String[]) — array of file paths (absolute or relative) to attach, or {@code null} if no attachments. Files must exist and be readable. The file name (not full path) will be used as the attachment name -
userName(String) — the username for SMTP authentication; must not be {@code null} -
password(String) — the password for SMTP authentication; must not be {@code null} -
props(Properties) — mail server properties; must not be {@code null} . Common properties include: <ul> <li> {@code mail.smtp.host} - SMTP server host (required) </li> <li> {@code mail.smtp.port} - SMTP server port (e.g., 25, 587, 465) </li> <li> {@code mail.smtp.auth} - enable authentication (true/false) </li> <li> {@code mail.smtp.starttls.enable} - enable STARTTLS (true/false) </li> <li> {@code mail.smtp.ssl.enable} - enable SSL (true/false) </li> <li> {@code mail.smtp.ssl.trust} - trusted hosts </li> </ul>
-
- See also: #sendHtmlEmail(String\[\], String, String, String, String, String, Properties), #sendEmailWithAttachment(String\[\], String, String, String, String\[\], String, String, Properties)
Public Instance Methods
- (none)
Interface EntityId (com.landawn.abacus.util.EntityId)
Represents a unique identifier for an entity, consisting of property names and their values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> EntityId
-
Signature:
static EntityId of(final String propName, final Object propValue) - Summary: Creates an EntityId with a single property.
-
Contract:
- The property name should include the entity name for clarity (e.g., "User.id").
-
Parameters:
-
propName(String) — property name with entity name, for example {@code Account.id} -
propValue(Object) — the property value
-
- Returns: a new EntityId instance
-
Signature:
@SuppressWarnings("deprecation") static EntityId of(final String entityName, final String propName, final Object propValue) - Summary: Creates an EntityId with a single property for a specific entity.
-
Parameters:
-
entityName(String) — the name of the entity -
propName(String) — the property name -
propValue(Object) — the property value
-
- Returns: a new EntityId instance
-
Signature:
static EntityId of(final String propName1, final Object propValue1, final String propName2, final Object propValue2) - Summary: Creates an EntityId with two properties.
-
Contract:
- Property names should include entity names for clarity.
-
Parameters:
-
propName1(String) — property name with entity name, for example {@code Account.id} -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value
-
- Returns: a new EntityId instance
-
Signature:
@SuppressWarnings("deprecation") static EntityId of(final String entityName, final String propName1, final Object propValue1, final String propName2, final Object propValue2) - Summary: Creates an EntityId with two properties for a specific entity.
-
Parameters:
-
entityName(String) — the name of the entity -
propName1(String) — the first property name -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value
-
- Returns: a new EntityId instance
-
Signature:
static EntityId of(final String propName1, final Object propValue1, final String propName2, final Object propValue2, final String propName3, final Object propValue3) - Summary: Creates an EntityId with three properties.
-
Contract:
- Property names should include entity names for clarity.
-
Parameters:
-
propName1(String) — property name with entity name, for example {@code Account.id} -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value -
propName3(String) — the third property name -
propValue3(Object) — the third property value
-
- Returns: a new EntityId instance
-
Signature:
@SuppressWarnings("deprecation") static EntityId of(final String entityName, final String propName1, final Object propValue1, final String propName2, final Object propValue2, final String propName3, final Object propValue3) - Summary: Creates an EntityId with three properties for a specific entity.
-
Parameters:
-
entityName(String) — the name of the entity -
propName1(String) — the first property name -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value -
propName3(String) — the third property name -
propValue3(Object) — the third property value
-
- Returns: a new EntityId instance
create(...) -> EntityId
-
Signature:
static EntityId create(final Map<String, Object> nameValues) - Summary: Creates an EntityId from a map of property names to values.
-
Contract:
- The entity name is inferred from the property names if they contain dots.
-
Parameters:
-
nameValues(Map<String, Object>) — a map of property names to their values
-
- Returns: a new EntityId instance
-
Signature:
@SuppressWarnings("deprecation") static EntityId create(final String entityName, final Map<String, Object> nameValues) - Summary: Creates an EntityId from a map of property names to values for a specific entity.
-
Parameters:
-
entityName(String) — the name of the entity -
nameValues(Map<String, Object>) — a map of property names to their values
-
- Returns: a new EntityId instance
-
Signature:
static EntityId create(final Object entity) - Summary: Creates an EntityId by extracting ID properties from an entity object.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code User user = new User(); user.setUserId(12345); user.setName("John"); EntityId id = EntityId.create(user); // Extracts userId if marked as @Id } </pre>
-
Parameters:
-
entity(Object) — the entity object to extract ID from
-
- Returns: a new EntityId instance
-
Signature:
static EntityId create(final Object entity, final Collection<String> idPropNames) - Summary: Creates an EntityId by extracting specific properties from an entity object.
-
Parameters:
-
entity(Object) — the entity object to extract properties from -
idPropNames(Collection<String>) — the collection of property names to use as ID
-
- Returns: a new EntityId instance
builder(...) -> EntityIdBuilder
-
Signature:
static EntityIdBuilder builder() - Summary: Creates a new EntityIdBuilder for building EntityId instances.
-
Parameters:
- (none)
- Returns: a new EntityIdBuilder instance
-
Signature:
static EntityIdBuilder builder(final String entityName) - Summary: Creates a new EntityIdBuilder for building EntityId instances with a specific entity name.
-
Parameters:
-
entityName(String) — the name of the entity
-
- Returns: a new EntityIdBuilder instance
Public Instance Methods
entityName(...) -> String
-
Signature:
String entityName() - Summary: Returns the entity name associated with this EntityId.
-
Parameters:
- (none)
- Returns: the entity name as a String
get(...) -> T
-
Signature:
@MayReturnNull <T> T get(String propName) - Summary: Gets the value of a property by name.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value, or {@code null} if not found
-
Signature:
@MayReturnNull <T> T get(String propName, Class<? extends T> targetType) - Summary: Gets the value of a property and converts it to the specified type.
-
Parameters:
-
propName(String) — the property name -
targetType(Class<? extends T>) — the class to convert the value to
-
- Returns: the property value converted to the target type, or {@code null} if not found
getInt(...) -> int
-
Signature:
int getInt(String propName) - Summary: Gets the value of a property as an int.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value as int, or 0 if not found or not a number
getLong(...) -> long
-
Signature:
long getLong(String propName) - Summary: Gets the value of a property as a long.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value as long, or 0 if not found or not a number
containsKey(...) -> boolean
-
Signature:
boolean containsKey(String propName) - Summary: Checks if this EntityId contains a property with the given name.
-
Contract:
- Checks if this EntityId contains a property with the given name.
-
Parameters:
-
propName(String) — the property name to check
-
- Returns: {@code true} if the property exists, {@code false} otherwise
keySet(...) -> Set<String>
-
Signature:
Set<String> keySet() - Summary: Returns a set of all property names in this EntityId.
-
Parameters:
- (none)
- Returns: a Set containing all property names
entrySet(...) -> Set<Map.Entry<String, Object>>
-
Signature:
Set<Map.Entry<String, Object>> entrySet() - Summary: Returns a set of all property name-value entries in this EntityId.
-
Parameters:
- (none)
- Returns: a Set of Map.Entry objects containing property names and values
size(...) -> int
-
Signature:
int size() - Summary: Returns the number of properties in this EntityId.
-
Parameters:
- (none)
- Returns: the number of properties
isEmpty(...) -> boolean
-
Signature:
default boolean isEmpty() - Summary: Checks if this EntityId is empty (contains no properties).
-
Contract:
- Checks if this EntityId is empty (contains no properties).
-
Parameters:
- (none)
- Returns: {@code true} if this EntityId contains no properties, {@code false} otherwise
Class EntityIdBuilder (com.landawn.abacus.util.EntityId.EntityIdBuilder)
Builder class for constructing EntityId instances fluently.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> EntityIdBuilder
-
Signature:
@SuppressWarnings("deprecation") public EntityIdBuilder put(final String idPropName, final Object idPropVal) - Summary: Adds a property to the EntityId being built.
-
Parameters:
-
idPropName(String) — the property name -
idPropVal(Object) — the property value
-
- Returns: this builder for method chaining
build(...) -> EntityId
-
Signature:
@SuppressWarnings("deprecation") public EntityId build() - Summary: Builds and returns the EntityId instance.
-
Parameters:
- (none)
- Returns: the constructed EntityId
Enum EnumType (com.landawn.abacus.util.EnumType)
Defines strategies for representing enum values during type conversion.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Enumerations (com.landawn.abacus.util.Enumerations)
Utility class providing static methods for working with {@link Enumeration} objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Enumeration<T>
-
Signature:
public static <T> Enumeration<T> empty() - Summary: Returns an empty Enumeration singleton instance.
-
Parameters:
- (none)
- Returns: an empty Enumeration
just(...) -> Enumeration<T>
-
Signature:
public static <T> Enumeration<T> just(final T single) - Summary: Creates an Enumeration containing a single element.
-
Parameters:
-
single(T) — the single element to enumerate
-
- Returns: an Enumeration containing only the specified element
of(...) -> Enumeration<T>
-
Signature:
@SafeVarargs public static <T> Enumeration<T> of(final T... a) - Summary: Creates an Enumeration from a varargs array of elements.
-
Parameters:
-
a(T[]) — the elements to enumerate
-
- Returns: an Enumeration over the specified elements
create(...) -> Enumeration<T>
-
Signature:
public static <T> Enumeration<T> create(final Collection<? extends T> c) - Summary: Creates an Enumeration from a Collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection to create an Enumeration from
-
- Returns: an Enumeration over the collection's elements, or empty if collection is null/empty
-
Signature:
public static <T> Enumeration<T> create(final Iterator<? extends T> iter) - Summary: Creates an Enumeration from an Iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to wrap as an Enumeration
-
- Returns: an Enumeration that delegates to the specified Iterator
concat(...) -> Enumeration<T>
-
Signature:
@SafeVarargs public static <T> Enumeration<T> concat(final Enumeration<? extends T>... a) - Summary: Concatenates multiple Enumerations into a single Enumeration.
-
Parameters:
-
a(Enumeration<? extends T>[]) — the Enumerations to concatenate
-
- Returns: a single Enumeration containing all elements from all input Enumerations
-
Signature:
public static <T> Enumeration<T> concat(final Collection<? extends Enumeration<? extends T>> c) - Summary: Concatenates a collection of Enumerations into a single Enumeration.
-
Parameters:
-
c(Collection<? extends Enumeration<? extends T>>) — a collection of Enumerations to concatenate
-
- Returns: a single Enumeration containing all elements from all input Enumerations
toIterator(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> toIterator(final Enumeration<? extends T> e) - Summary: Converts an Enumeration to an ObjIterator.
-
Parameters:
-
e(Enumeration<? extends T>) — the Enumeration to convert, may be null
-
- Returns: an ObjIterator over the Enumeration's elements, or empty iterator if null
toList(...) -> List<T>
-
Signature:
public static <T> List<T> toList(final Enumeration<? extends T> e) - Summary: Converts an Enumeration to a List.
-
Parameters:
-
e(Enumeration<? extends T>) — the Enumeration to convert, may be null
-
- Returns: a new ArrayList containing all elements from the Enumeration, or empty list if null
toSet(...) -> Set<T>
-
Signature:
public static <T> Set<T> toSet(final Enumeration<? extends T> e) - Summary: Converts an Enumeration to a Set.
-
Parameters:
-
e(Enumeration<? extends T>) — the Enumeration to convert, may be null
-
- Returns: a new HashSet containing unique elements from the Enumeration, or empty set if null
toCollection(...) -> C
-
Signature:
public static <T, C extends Collection<T>> C toCollection(final Enumeration<? extends T> e, final Supplier<? extends C> supplier) - Summary: Converts an Enumeration to a Collection using the provided Supplier.
-
Parameters:
-
e(Enumeration<? extends T>) — the Enumeration to convert, may be null -
supplier(Supplier<? extends C>) — the supplier to create the target collection
-
- Returns: a collection containing all elements from the Enumeration
Public Instance Methods
- (none)
Class EscapeUtil (com.landawn.abacus.util.EscapeUtil)
<p> Escapes and unescapes {@code String} s for Java, Java Script, HTML and XML.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
escapeJava(...) -> String
-
Signature:
public static String escapeJava(final String input) - Summary: Escapes characters in a string using Java String literal rules, converting special characters to their escaped representations (e.g., newline to {@code \\n} , tab to {@code \\t} ).
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for use in Java code, or {@code null} if {@code null} input
- See also: #unescapeJava(String), #escapeEcmaScript(String)
escapeEcmaScript(...) -> String
-
Signature:
public static String escapeEcmaScript(final String input) - Summary: Escapes characters in a string using EcmaScript (JavaScript/ActionScript) String rules, converting special characters to their escaped representations.
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for use in EcmaScript code, or {@code null} if {@code null} input
- See also: #unescapeEcmaScript(String), #escapeJava(String)
escapeJson(...) -> String
-
Signature:
public static String escapeJson(final String input) - Summary: Escapes characters in a string using JSON String rules as defined in RFC 4627, converting special characters to their JSON-safe escaped representations.
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for use in JSON, or {@code null} if {@code null} input
- See also: <a href="http://www.ietf.org/rfc/rfc4627.txt">,RFC 4627 - JSON,</a>, #unescapeJson(String)
unescapeJava(...) -> String
-
Signature:
public static String unescapeJava(final String input) - Summary: Unescapes a string containing Java String literal escape sequences, converting them back to their original characters (e.g., {@code \\n} to newline, {@code \\t} to tab).
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeJava(String)
unescapeEcmaScript(...) -> String
-
Signature:
public static String unescapeEcmaScript(final String input) - Summary: Unescapes a string containing EcmaScript (JavaScript/ActionScript) escape sequences, converting them back to their original characters.
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeEcmaScript(String), #unescapeJava(String)
unescapeJson(...) -> String
-
Signature:
public static String unescapeJson(final String input) - Summary: Unescapes a string containing JSON escape sequences as defined in RFC 4627, converting them back to their original characters.
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeJson(String), #unescapeJava(String)
escapeHtml4(...) -> String
-
Signature:
public static String escapeHtml4(final String input) - Summary: Escapes characters in a string using HTML 4.0 entities, converting special characters to their HTML entity representations (e.g., {@code <} to {@code <} , {@code &} to {@code &} ).
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for use in HTML 4.0, or {@code null} if {@code null} input
- See also: <a href="http://www.w3.org/TR/html401/charset.html#h-5.3">,HTML 4.01 Character References,</a>, #unescapeHtml4(String), #escapeHtml3(String)
escapeHtml3(...) -> String
-
Signature:
public static String escapeHtml3(final String input) - Summary: Escapes characters in a string using HTML 3.0 entities, a subset of HTML 4.0 entities.
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for use in HTML 3.0, or {@code null} if {@code null} input
- See also: #unescapeHtml3(String), #escapeHtml4(String)
unescapeHtml4(...) -> String
-
Signature:
public static String unescapeHtml4(final String input) - Summary: Unescapes a string containing HTML 4.0 entities, converting them back to their corresponding Unicode characters.
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeHtml4(String)
unescapeHtml3(...) -> String
-
Signature:
public static String unescapeHtml3(final String input) - Summary: Unescapes a string containing HTML 3.0 entities, converting them back to their corresponding Unicode characters.
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeHtml3(String), #unescapeHtml4(String)
escapeXml10(...) -> String
-
Signature:
public static String escapeXml10(final String input) - Summary: Escapes characters in a string using XML 1.0 entities and removes characters that are invalid in XML 1.0.
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for XML 1.0, or {@code null} if {@code null} input
- See also: #unescapeXml(String), #escapeXml11(String)
escapeXml11(...) -> String
-
Signature:
public static String escapeXml11(final String input) - Summary: Escapes characters in a string using XML 1.1 entities and removes/escapes characters according to XML 1.1 rules.
-
Parameters:
-
input(String) — the string to escape, which may be null
-
- Returns: the escaped string safe for XML 1.1, or {@code null} if {@code null} input
- See also: #unescapeXml(String), #escapeXml10(String)
unescapeXml(...) -> String
-
Signature:
public static String unescapeXml(final String input) - Summary: Unescapes a string containing XML entity escapes, converting them back to their corresponding Unicode characters.
-
Parameters:
-
input(String) — the string to unescape, which may be null
-
- Returns: the unescaped string, or {@code null} if {@code null} input
- See also: #escapeXml10(String), #escapeXml11(String)
escapeCsv(...) -> String
-
Signature:
public static String escapeCsv(final String input) - Summary: Escapes a CSV column value according to RFC 4180 rules by enclosing it in double quotes if necessary and escaping embedded double quotes.
-
Contract:
- Escapes a CSV column value according to RFC 4180 rules by enclosing it in double quotes if necessary and escaping embedded double quotes.
- <p> If the input contains a comma, newline (CR or LF), or double quote character, the entire value is enclosed in double quotes.
- </p> <p> If the input does not contain any special CSV characters (comma, newline, or double quote), it is returned unchanged without quotes.
-
Parameters:
-
input(String) — the input CSV column String, which may be null
-
- Returns: the escaped CSV string with quotes if needed, or {@code null} if {@code null} input
- See also: <a href="https://tools.ietf.org/html/rfc4180">,RFC 4180,</a>, <a href="http://en.wikipedia.org/wiki/Comma-separated_values">,CSV on Wikipedia,</a>, #unescapeCsv(String)
unescapeCsv(...) -> String
-
Signature:
public static String unescapeCsv(final String input) - Summary: Unescapes a CSV column value by removing surrounding double quotes and unescaping internal double quotes according to RFC 4180 rules.
-
Contract:
- <p> If the input is enclosed in double quotes, the quotes are stripped and any escaped double quotes (represented as {@code ""} ) within the value are converted back to single double quotes ( {@code "} ).
- </p> <p> If the input is not enclosed in double quotes, it is returned unchanged.
-
Parameters:
-
input(String) — the input CSV column String, which may be null
-
- Returns: the unescaped CSV string with quotes removed and internal quotes unescaped, or {@code null} if {@code null} input
- See also: <a href="https://tools.ietf.org/html/rfc4180">,RFC 4180,</a>, <a href="http://en.wikipedia.org/wiki/Comma-separated_values">,CSV on Wikipedia,</a>, #escapeCsv(String)
Public Instance Methods
- (none)
Class CharSequenceTranslator (com.landawn.abacus.util.EscapeUtil.CharSequenceTranslator)
An API for translating text.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
hex(...) -> String
-
Signature:
public static String hex(final int codepoint) - Summary: <p> Returns an upper case hexadecimal {@code String} for the given character.
-
Parameters:
-
codepoint(int) — The codepoint to convert.
-
- Returns: An upper case hexadecimal {@code String}
Public Instance Methods
translate(...) -> int
-
Signature:
public abstract int translate(CharSequence input, int index, Writer out) throws IOException - Summary: Translate a set of codepoints, represented by an int index into a CharSequence, into another set of codepoints.
-
Contract:
- The number of codepoints consumed must be returned, and the only IOExceptions thrown must be from interacting with the Writer so that the top level API may reliably ignore StringWriter IOExceptions.
-
Parameters:
-
input(CharSequence) — CharSequence that is being translated -
index(int) — int representing the current point of translation -
out(Writer) — Writer to translate the text to
-
- Returns: int count of codepoints consumed
-
Throws:
-
java.io.IOException— if and only if the Writer produces an IOException
-
-
Signature:
@MayReturnNull public final String translate(final CharSequence input) - Summary: Translates the input CharSequence and returns the result as a String.
-
Parameters:
-
input(CharSequence) — CharSequence to be translated, may be null
-
- Returns: the translated String, or {@code null} if the input is {@code null}
-
Signature:
public final void translate(final CharSequence input, final Writer out) throws IOException - Summary: Translate an input onto a Writer.
-
Parameters:
-
input(CharSequence) — CharSequence that is being translated -
out(Writer) — Writer to translate the text to
-
-
Throws:
-
java.io.IOException— if and only if the Writer produces an IOException
-
with(...) -> CharSequenceTranslator
-
Signature:
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) - Summary: Helper method to create a merger of this translator with another set of translators.
-
Parameters:
-
translators(CharSequenceTranslator[]) — CharSequenceTranslator array of translators to merge with this one
-
- Returns: CharSequenceTranslator merging this translator with the others
Class ExceptionUtil (com.landawn.abacus.util.ExceptionUtil)
Utility class for exception handling and conversion.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
registerRuntimeExceptionMapper(...) -> void
-
Signature:
public static <E extends Throwable> void registerRuntimeExceptionMapper(final Class<E> exceptionClass, final Function<E, RuntimeException> runtimeExceptionMapper) - Summary: Registers a custom mapper for converting specific exception types to RuntimeException.
-
Parameters:
-
exceptionClass(Class<E>) — the class of the exception to map -
runtimeExceptionMapper(Function<E, RuntimeException>) — the function that converts the exception to RuntimeException
-
-
Signature:
@SuppressWarnings("rawtypes") public static <E extends Throwable> void registerRuntimeExceptionMapper(final Class<E> exceptionClass, final Function<E, RuntimeException> runtimeExceptionMapper, final boolean force) throws IllegalArgumentException - Summary: Registers a custom mapper for converting specific exception types to RuntimeException, with an option to force overwrite existing mappings.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Force registration even if mapper already exists ExceptionUtil.registerRuntimeExceptionMapper( CustomException.class, e -> new CustomRuntimeException(e), true // force overwrite ); } </pre>
-
Parameters:
-
exceptionClass(Class<E>) — the class of the exception to map -
runtimeExceptionMapper(Function<E, RuntimeException>) — the function that converts the exception to RuntimeException -
force(boolean) — if {@code true} , overwrites existing mapper; if {@code false} , throws exception if mapper exists
-
-
Throws:
-
java.lang.IllegalArgumentException— if trying to register built-in classes (classes with package starting with "java.", "javax.", or "com.landawn.abacus"), or if a mapper for the specified exception class already exists and force is {@code false}
-
toRuntimeException(...) -> RuntimeException
-
Signature:
public static RuntimeException toRuntimeException(final Exception e) - Summary: Converts the specified Exception to a RuntimeException if it's a checked exception.
-
Contract:
- Converts the specified Exception to a RuntimeException if it's a checked exception.
- If it's already a RuntimeException, returns itself.
-
Parameters:
-
e(Exception) — the exception to convert
-
- Returns: the converted runtime exception or the original if already runtime
-
Signature:
public static RuntimeException toRuntimeException(final Exception e, final boolean callInterrupt) - Summary: Converts the specified Exception to a RuntimeException with option to call Thread.interrupt().
-
Contract:
- Useful when handling InterruptedException to preserve interrupted status.
-
Parameters:
-
e(Exception) — the exception to convert -
callInterrupt(boolean) — whether to call {@code Thread.currentThread().interrupt()} if the exception is an InterruptedException
-
- Returns: the converted runtime exception
-
Signature:
public static RuntimeException toRuntimeException(final Throwable e) - Summary: Converts the specified Throwable to a RuntimeException if it's a checked exception.
-
Contract:
- Converts the specified Throwable to a RuntimeException if it's a checked exception.
- If it's already a RuntimeException, returns itself.
-
Parameters:
-
e(Throwable) — the throwable to convert
-
- Returns: the converted runtime exception
-
Signature:
public static RuntimeException toRuntimeException(final Throwable e, final boolean callInterrupt) - Summary: Converts the specified Throwable to a RuntimeException with option to call Thread.interrupt().
-
Contract:
- If it's an Error and throwIfItIsError is {@code false} , wraps it in RuntimeException.
-
Parameters:
-
e(Throwable) — the throwable to convert -
callInterrupt(boolean) — whether to call {@code Thread.currentThread().interrupt()} if the exception is an InterruptedException
-
- Returns: the converted runtime exception
-
Signature:
public static RuntimeException toRuntimeException(final Throwable e, final boolean callInterrupt, final boolean throwIfItIsError) - Summary: Converts the specified Throwable to a RuntimeException with full control over behavior.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { criticalOperation(); } catch (Throwable t) { // Convert to runtime, call interrupt if needed, throw Error as-is throw ExceptionUtil.toRuntimeException(t, true, true); } } </pre>
-
Parameters:
-
e(Throwable) — the throwable to convert -
callInterrupt(boolean) — whether to call {@code Thread.currentThread().interrupt()} if the exception is an InterruptedException -
throwIfItIsError(boolean) — whether to throw the throwable if it is an Error
-
- Returns: the converted runtime exception
tryToGetOriginalCheckedException(...) -> Exception
-
Signature:
public static Exception tryToGetOriginalCheckedException(final Exception e) - Summary: Attempts to extract the original checked exception from a runtime exception wrapper.
-
Contract:
- This is useful when dealing with wrapped exceptions from reflection or concurrent operations.
-
Parameters:
-
e(Exception) — the exception to unwrap
-
- Returns: the original checked exception if found, otherwise returns the input exception
hasCause(...) -> boolean
-
Signature:
public static boolean hasCause(final Throwable e, final Class<? extends Throwable> targetExceptionType) - Summary: Checks if the exception or any of its causes is of the specified type.
-
Contract:
- Checks if the exception or any of its causes is of the specified type.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { complexDatabaseOperation(); } catch (Exception e) { if (ExceptionUtil.hasCause(e, SQLException.class)) { handleDatabaseError(); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to check -
targetExceptionType(Class<? extends Throwable>) — the exception type to look for
-
- Returns: {@code true} if the exception or any cause is of the specified type
-
Signature:
public static boolean hasCause(final Throwable e, final Predicate<? super Throwable> targetExceptionTester) - Summary: Checks if the exception or any of its causes matches the specified predicate.
-
Contract:
- Checks if the exception or any of its causes matches the specified predicate.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { operation(); } catch (Exception e) { if (ExceptionUtil.hasCause(e, ex -> ex.getMessage().contains("timeout"))) { handleTimeout(); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to check -
targetExceptionTester(Predicate<? super Throwable>) — the predicate to test each exception in the cause chain
-
- Returns: {@code true} if any exception in the cause chain matches the predicate
hasSQLCause(...) -> boolean
-
Signature:
public static boolean hasSQLCause(final Throwable e) - Summary: Checks if the exception or any of its causes is a SQLException or UncheckedSQLException.
-
Contract:
- Checks if the exception or any of its causes is a SQLException or UncheckedSQLException.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { databaseOperation(); } catch (Exception e) { if (ExceptionUtil.hasSQLCause(e)) { rollbackTransaction(); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to check
-
- Returns: {@code true} if the exception chain contains a SQL-related exception
hasIOCause(...) -> boolean
-
Signature:
public static boolean hasIOCause(final Throwable e) - Summary: Checks if the exception or any of its causes is an IOException or UncheckedIOException.
-
Contract:
- Checks if the exception or any of its causes is an IOException or UncheckedIOException.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { fileOperation(); } catch (Exception e) { if (ExceptionUtil.hasIOCause(e)) { handleFileError(); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to check
-
- Returns: {@code true} if the exception chain contains an IO-related exception
isNullPointerOrIllegalArgumentException(...) -> boolean
-
Signature:
@Beta public static boolean isNullPointerOrIllegalArgumentException(final Throwable e) - Summary: Checks if the throwable is either NullPointerException or IllegalArgumentException.
-
Contract:
- Checks if the throwable is either NullPointerException or IllegalArgumentException.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { validateInput(input); } catch (Exception e) { if (ExceptionUtil.isNullPointerOrIllegalArgumentException(e)) { return BAD_REQUEST; } } } </pre>
-
Parameters:
-
e(Throwable) — the throwable to check
-
- Returns: {@code true} if the throwable is NullPointerException or IllegalArgumentException
listCause(...) -> List<Throwable>
-
Signature:
public static List<Throwable> listCause(final Throwable e) - Summary: Returns a list containing all exceptions in the cause chain.
-
Parameters:
-
e(Throwable) — the starting exception
-
- Returns: a list of all exceptions in the cause chain
firstCause(...) -> Throwable
-
Signature:
public static Throwable firstCause(final Throwable e) - Summary: Returns the first cause in the exception chain (the root cause).
-
Contract:
- If there is no cause, returns the input throwable itself.
-
Parameters:
-
e(Throwable) — the exception to traverse
-
- Returns: the root cause or the input if no cause found
findCause(...) -> Optional<E>
-
Signature:
public static <E extends Throwable> Optional<E> findCause(final Throwable e, final Class<? extends E> targetExceptionType) - Summary: Finds the first occurrence of the specified exception type in the cause chain.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { serviceCall(); } catch (Exception e) { Optional<IOException> ioError = ExceptionUtil.findCause(e, IOException.class); if (ioError.isPresent()) { handleIOError(ioError.get()); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to search through -
targetExceptionType(Class<? extends E>) — the class of the exception to find
-
- Returns: an Optional containing the found exception, or empty if not found
-
Signature:
public static <E extends Throwable> Optional<E> findCause(final Throwable e, final Predicate<? super Throwable> targetExceptionTester) - Summary: Finds the first exception in the cause chain that matches the specified predicate.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code try { complexOperation(); } catch (Exception e) { Optional<Throwable> timeoutError = ExceptionUtil.findCause(e, ex -> ex.getMessage() != null && ex.getMessage().contains("timeout") ); if (timeoutError.isPresent()) { handleTimeout(); } } } </pre>
-
Parameters:
-
e(Throwable) — the exception to search through -
targetExceptionTester(Predicate<? super Throwable>) — the predicate to match exceptions
-
- Returns: an Optional containing the found exception, or empty if not found
getStackTrace(...) -> String
-
Signature:
public static String getStackTrace(final Throwable throwable) - Summary: Gets the stack trace from a Throwable as a String.
-
Parameters:
-
throwable(Throwable) — the {@link Throwable} to be examined, which may be null
-
- Returns: the stack trace as generated by the exception's {@code printStackTrace(PrintWriter)} method, or an empty String if {@code null} input
getErrorMessage(...) -> String
-
Signature:
public static String getErrorMessage(final Throwable e) - Summary: Gets the error message from an exception.
-
Contract:
- If the exception has no message, attempts to get the message from its cause.
-
Parameters:
-
e(Throwable) — the exception
-
- Returns: the error message, or the exception class name if no message is available
-
Signature:
public static String getErrorMessage(final Throwable e, final boolean withExceptionClassName) - Summary: Gets the error message from an exception with optional exception class name prefix.
-
Parameters:
-
e(Throwable) — the exception -
withExceptionClassName(boolean) — if {@code true} , prefixes the message with the exception class name
-
- Returns: the formatted error message
Public Instance Methods
- (none)
Class FastJson (com.landawn.abacus.util.FastJson)
A utility class that provides convenient wrapper methods for JSON serialization and deserialization operations using Alibaba's FastJSON2 library.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toJson(...) -> String
-
Signature:
public static String toJson(final Object obj) - Summary: Converts the specified object to its JSON string representation.
-
Parameters:
-
obj(Object) — the object to be converted to JSON string
-
- Returns: the JSON string representation of the object, or "null" if the object is null
-
Signature:
public static String toJson(final Object obj, final boolean prettyFormat) - Summary: Converts the specified object to its JSON string representation with optional pretty formatting.
-
Contract:
- When pretty formatting is enabled, the JSON output will be formatted with proper indentation and line breaks for improved readability.
-
Parameters:
-
obj(Object) — the object to be converted to JSON string -
prettyFormat(boolean) — {@code true} to enable pretty formatting with indentation and line breaks, {@code false} for compact output
-
- Returns: the JSON string representation of the object with or without pretty formatting
-
Signature:
public static String toJson(final Object obj, final JSONWriter.Feature... features) - Summary: Converts the specified object to its JSON string representation using the specified JSONWriter features.
-
Parameters:
-
obj(Object) — the object to be converted to JSON string -
features(JSONWriter.Feature[]) — variable number of JSONWriter features to control serialization behavior
-
- Returns: the JSON string representation of the object with the specified features applied
-
Signature:
public static String toJson(final Object obj, final JSONWriter.Context context) - Summary: Converts the specified object to its JSON string representation using the specified JSONWriter context.
-
Parameters:
-
obj(Object) — the object to be converted to JSON string -
context(JSONWriter.Context) — the JSONWriter context containing serialization configuration
-
- Returns: the JSON string representation of the object using the specified context
-
Signature:
public static void toJson(final Object obj, final File output) - Summary: Serializes the specified object to JSON and writes it to the specified file.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(File) — the file where the JSON will be written
-
-
Signature:
public static void toJson(final Object obj, final File output, final JSONWriter.Feature... features) - Summary: Serializes the specified object to JSON and writes it to the specified file using the given JSONWriter features.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(File) — the file where the JSON will be written -
features(JSONWriter.Feature[]) — variable number of JSONWriter features to control serialization behavior
-
-
Signature:
public static void toJson(final Object obj, final File output, final JSONWriter.Context context) - Summary: Serializes the specified object to JSON and writes it to the specified file using the given JSONWriter context.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(File) — the file where the JSON will be written -
context(JSONWriter.Context) — the JSONWriter context containing serialization configuration
-
-
Signature:
public static void toJson(final Object obj, final OutputStream output) - Summary: Serializes the specified object to JSON and writes it to the specified OutputStream.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(OutputStream) — the OutputStream where the JSON will be written
-
-
Signature:
public static void toJson(final Object obj, final OutputStream output, final JSONWriter.Feature... features) - Summary: Serializes the specified object to JSON and writes it to the specified OutputStream using the given JSONWriter features.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(OutputStream) — the OutputStream where the JSON will be written -
features(JSONWriter.Feature[]) — variable number of JSONWriter features to control serialization behavior
-
-
Signature:
public static void toJson(final Object obj, final OutputStream output, final JSONWriter.Context context) - Summary: Serializes the specified object to JSON and writes it to the specified OutputStream using the given JSONWriter context.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(OutputStream) — the OutputStream where the JSON will be written -
context(JSONWriter.Context) — the JSONWriter context containing serialization configuration
-
-
Signature:
public static void toJson(final Object obj, final Writer output) - Summary: Serializes the specified object to JSON and writes it to the specified Writer.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(Writer) — the Writer where the JSON will be written
-
-
Signature:
public static void toJson(final Object obj, final Writer output, final JSONWriter.Feature... features) - Summary: Serializes the specified object to JSON and writes it to the specified Writer using the given JSONWriter features.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(Writer) — the Writer where the JSON will be written -
features(JSONWriter.Feature[]) — variable number of JSONWriter features to control serialization behavior
-
-
Signature:
public static void toJson(final Object obj, final Writer output, final JSONWriter.Context context) - Summary: Serializes the specified object to JSON and writes it to the specified Writer using the given JSONWriter context.
-
Parameters:
-
obj(Object) — the object to be serialized to JSON -
output(Writer) — the Writer where the JSON will be written -
context(JSONWriter.Context) — the JSONWriter context containing serialization configuration
-
fromJson(...) -> T
-
Signature:
@MayReturnNull public static <T> T fromJson(final byte[] json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a byte array into an object of the specified target type.
-
Contract:
- This method is useful when working with JSON data received as byte arrays, such as from network communications or binary storage.
-
Parameters:
-
json(byte[]) — the byte array containing JSON data -
targetType(Class<? extends T>) — the Class object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final byte[] json, final int offset, final int len, final Class<? extends T> targetType) - Summary: Deserializes JSON from a byte array segment into an object of the specified target type.
-
Contract:
- This method allows parsing JSON from a specific portion of a byte array, which is useful when the JSON data is embedded within a larger byte array.
-
Parameters:
-
json(byte[]) — the byte array containing JSON data -
offset(int) — the starting position in the byte array -
len(int) — the number of bytes to read from the starting position -
targetType(Class<? extends T>) — the Class object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a string into an object of the specified target type.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Class<? extends T>) — the Class object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Class<? extends T> targetType, final JSONReader.Feature... features) - Summary: Deserializes JSON from a string into an object of the specified target type using the given JSONReader features.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Class<? extends T>) — the Class object representing the target type -
features(JSONReader.Feature[]) — variable number of JSONReader features to control deserialization behavior
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Class<? extends T> targetType, final JSONReader.Context context) - Summary: Deserializes JSON from a string into an object of the specified target type using the given JSONReader context.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Class<? extends T>) — the Class object representing the target type -
context(JSONReader.Context) — the JSONReader context containing deserialization configuration
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Type targetType) - Summary: Deserializes JSON from a string into an object of the specified target Type.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Type) — the Type object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Type targetType, final JSONReader.Feature... features) - Summary: Deserializes JSON from a string into an object of the specified target Type using the given JSONReader features.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Type) — the Type object representing the target type -
features(JSONReader.Feature[]) — variable number of JSONReader features to control deserialization behavior
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final Type targetType, final JSONReader.Context context) - Summary: Deserializes JSON from a string into an object of the specified target Type using the given JSONReader context.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
targetType(Type) — the Type object representing the target type -
context(JSONReader.Context) — the JSONReader context containing deserialization configuration
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final TypeReference<T> typeReference) - Summary: Deserializes JSON from a string into an object of the type specified by the TypeReference.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
typeReference(TypeReference<T>) — the TypeReference object containing type information
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final TypeReference<T> typeReference, final JSONReader.Feature... features) - Summary: Deserializes JSON from a string into an object of the type specified by the TypeReference using the given JSONReader features.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
typeReference(TypeReference<T>) — the TypeReference object containing type information -
features(JSONReader.Feature[]) — variable number of JSONReader features to control deserialization behavior
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final String json, final TypeReference<T> typeReference, final JSONReader.Context context) - Summary: Deserializes JSON from a string into an object of the type specified by the TypeReference using the given JSONReader context.
-
Parameters:
-
json(String) — the JSON string to be deserialized -
typeReference(TypeReference<T>) — the TypeReference object containing type information -
context(JSONReader.Context) — the JSONReader context containing deserialization configuration
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final Reader json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a Reader into an object of the specified target type.
-
Contract:
- This method is useful when reading JSON from various input sources such as files, network streams, or other character-based input sources.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Class<? extends T>) — the Class object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final Reader json, final Class<? extends T> targetType, final JSONReader.Feature... features) - Summary: Deserializes JSON from a Reader into an object of the specified target type using the given JSONReader features.
-
Contract:
- This method allows customization of the deserialization process when reading from character-based sources.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Class<? extends T>) — the Class object representing the target type -
features(JSONReader.Feature[]) — variable number of JSONReader features to control deserialization behavior
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull @Beta public static <T> T fromJson(final Reader json, final Class<? extends T> targetType, final JSONReader.Context context) - Summary: Deserializes JSON from a Reader into an object of the specified target type using the given JSONReader context.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Class<? extends T>) — the Class object representing the target type -
context(JSONReader.Context) — the JSONReader context containing deserialization configuration
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final Reader json, final Type targetType) - Summary: Deserializes JSON from a Reader into an object of the specified target Type.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Type) — the Type object representing the target type
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull public static <T> T fromJson(final Reader json, final Type targetType, final JSONReader.Feature... features) - Summary: Deserializes JSON from a Reader into an object of the specified target Type using the given JSONReader features.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Type) — the Type object representing the target type -
features(JSONReader.Feature[]) — variable number of JSONReader features to control deserialization behavior
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
-
Signature:
@MayReturnNull @Beta public static <T> T fromJson(final Reader json, final Type targetType, final JSONReader.Context context) - Summary: Deserializes JSON from a Reader into an object of the specified target Type using the given JSONReader context.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Type) — the Type object representing the target type -
context(JSONReader.Context) — the JSONReader context containing deserialization configuration
-
- Returns: the deserialized object of type T, or {@code null} if the JSON represents null
Public Instance Methods
- (none)
Class FilenameUtil (com.landawn.abacus.util.FilenameUtil)
General filename and filepath manipulation utilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
normalize(...) -> String
-
Signature:
@MayReturnNull public static String normalize(final String filename) - Summary: Normalizes a path, removing double and single dot path steps.
-
Contract:
- If the double dot has no parent path segment, {@code null} is returned.
-
Parameters:
-
filename(String) — the filename to normalize, {@code null} returns {@code null}
-
- Returns: the normalized filename, or {@code null} if invalid. Null bytes inside string will be removed
- See also: IOUtil#simplifyPath(String)
-
Signature:
@MayReturnNull public static String normalize(final String filename, final boolean unixSeparator) - Summary: Normalizes a path with control over the separator character.
-
Parameters:
-
filename(String) — the filename to normalize, {@code null} returns {@code null} -
unixSeparator(boolean) — {@code true} if a unix separator should be used, {@code false} if a windows separator should be used
-
- Returns: the normalized filename, or {@code null} if invalid. Null bytes inside string will be removed
- See also: IOUtil#simplifyPath(String)
normalizeNoEndSeparator(...) -> String
-
Signature:
@MayReturnNull public static String normalizeNoEndSeparator(final String filename) - Summary: Normalizes a path, removing double and single dot path steps, and removing any final directory separator.
-
Contract:
- <p> This method is similar to {@link #normalize(String)} but removes the trailing slash if present.
-
Parameters:
-
filename(String) — the filename to normalize, {@code null} returns {@code null}
-
- Returns: the normalized filename without trailing separator, or {@code null} if invalid. Null bytes inside string will be removed
-
Signature:
@MayReturnNull public static String normalizeNoEndSeparator(final String filename, final boolean unixSeparator) - Summary: Normalizes a path with control over the separator and trailing slash.
-
Parameters:
-
filename(String) — the filename to normalize, {@code null} returns {@code null} -
unixSeparator(boolean) — {@code true} if a unix separator should be used, {@code false} if a windows separator should be used
-
- Returns: the normalized filename without trailing separator, or {@code null} if invalid. Null bytes inside string will be removed
concat(...) -> String
-
Signature:
@MayReturnNull public static String concat(final String basePath, final String fullFilenameToAdd) - Summary: Concatenates a filename to a base path using normal command line style rules.
-
Contract:
- </p> <p> If {@code fullFilenameToAdd} is absolute, it will be normalized and returned.
-
Parameters:
-
basePath(String) — the base path to attach to, always treated as a path, {@code null} returns {@code null} -
fullFilenameToAdd(String) — the filename (or path) to attach to the base, {@code null} returns {@code null}
-
- Returns: the concatenated path, or {@code null} if invalid. Null bytes inside string will be removed
directoryContains(...) -> boolean
-
Signature:
public static boolean directoryContains(final String canonicalParent, final String canonicalChild) - Summary: Determines whether the parent directory contains the child element (a file or directory).
-
Contract:
- </p> <p> Edge cases: </p> <ul> <li> A directory must not be null: if {@code null} , throws IllegalArgumentException </li> <li> A directory does not contain itself: returns false </li> <li> A {@code null} child file is not contained in any parent: returns false </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code FilenameUtil.directoryContains("/Users/john", "/Users/john/documents"); // Returns true FilenameUtil.directoryContains("/Users/john", "/Users/jane/documents"); // Returns false FilenameUtil.directoryContains("/Users/john", "/Users/john"); // Returns false } </pre>
-
Parameters:
-
canonicalParent(String) — the file to consider as the parent, must not be {@code null} -
canonicalChild(String) — the file to consider as the child, {@code null} returns {@code false}
-
- Returns: {@code true} if the child is under the parent directory, {@code false} otherwise
separatorsToUnix(...) -> String
-
Signature:
public static String separatorsToUnix(final String path) - Summary: Converts all separators to the Unix separator of forward slash.
-
Parameters:
-
path(String) — the path to be changed, {@code null} returns {@code null}
-
- Returns: the updated path with Unix separators, or the same reference if no changes were made
separatorsToWindows(...) -> String
-
Signature:
public static String separatorsToWindows(final String path) - Summary: Converts all separators to the Windows separator of backslash.
-
Parameters:
-
path(String) — the path to be changed, {@code null} returns {@code null}
-
- Returns: the updated path with Windows separators, or the same reference if no changes were made
separatorsToSystem(...) -> String
-
Signature:
@MayReturnNull public static String separatorsToSystem(final String path) - Summary: Converts all separators to the system separator.
-
Parameters:
-
path(String) — the path to be changed, {@code null} returns {@code null}
-
- Returns: the updated path with system separators, or the same reference if no changes were made
getPrefixLength(...) -> int
-
Signature:
public static int getPrefixLength(final String filename) - Summary: Returns the length of the filename prefix, such as {@code C:/} or {@code ~/} .
-
Contract:
- The prefix length includes the first slash in the full filename if applicable.
-
Parameters:
-
filename(String) — the filename to find the prefix in, {@code null} returns -1
-
- Returns: the length of the prefix, -1 if invalid or {@code null}
indexOfLastSeparator(...) -> int
-
Signature:
public static int indexOfLastSeparator(final String filename) - Summary: Returns the index of the last directory separator character.
-
Parameters:
-
filename(String) — the filename to find the last path separator in, {@code null} returns -1
-
- Returns: the index of the last separator character, or -1 if there is no such character or if {@code null}
indexOfExtension(...) -> int
-
Signature:
public static int indexOfExtension(final String filename) - Summary: Returns the index of the last extension separator character (dot).
-
Parameters:
-
filename(String) — the filename to find the last extension separator in, {@code null} returns -1
-
- Returns: the index of the last extension separator character, or -1 if there is no such character or if {@code null}
getPrefix(...) -> String
-
Signature:
@MayReturnNull public static String getPrefix(final String filename) - Summary: Gets the prefix from a full filename, such as {@code C:/} or {@code ~/} .
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns null
-
- Returns: the prefix of the file, {@code null} if invalid. Null bytes inside string will be removed
getPath(...) -> String
-
Signature:
@MayReturnNull public static String getPath(final String filename) - Summary: Gets the path from a full filename, which excludes the prefix.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the path of the file, an empty string if none exists, {@code null} if invalid. Null bytes inside string will be removed
- See also: #getFullPath(String)
getPathNoEndSeparator(...) -> String
-
Signature:
@MayReturnNull public static String getPathNoEndSeparator(final String filename) - Summary: Gets the path from a full filename, excluding the prefix and final directory separator.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the path of the file without trailing separator, an empty string if none exists, {@code null} if invalid. Null bytes inside string will be removed
- See also: #getFullPathNoEndSeparator(String)
getFullPath(...) -> String
-
Signature:
@MayReturnNull public static String getFullPath(final String filename) - Summary: Gets the full path from a full filename, which is the prefix + path.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the path of the file, an empty string if none exists, {@code null} if invalid. Null bytes inside string will be removed
getFullPathNoEndSeparator(...) -> String
-
Signature:
@MayReturnNull public static String getFullPathNoEndSeparator(final String filename) - Summary: Gets the full path from a full filename, excluding the final directory separator.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the path of the file without trailing separator, an empty string if none exists, {@code null} if invalid. Null bytes inside string will be removed
getName(...) -> String
-
Signature:
@MayReturnNull public static String getName(final String filename) - Summary: Gets the name minus the path from a full filename.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the name of the file without the path, or an empty string if none exists, or {@code null} if the filename is {@code null} . Null bytes inside string will be removed
getBaseName(...) -> String
-
Signature:
@MayReturnNull public static String getBaseName(final String filename) - Summary: Gets the base name minus the full path and extension from a full filename.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the name of the file without path or extension, or {@code null} if the filename is {@code null} . Null bytes inside string will be removed
- See also: #getName(String), #getExtension(String), #removeExtension(String)
getExtension(...) -> String
-
Signature:
@MayReturnNull public static String getExtension(final String filename) - Summary: Gets the extension of a filename.
-
Contract:
- There must be no directory separator after the dot.
-
Parameters:
-
filename(String) — the filename to retrieve the extension of, {@code null} returns {@code null}
-
- Returns: the extension of the file or an empty string if none exists, or {@code null} if the filename is {@code null}
- See also: #getBaseName(String), #removeExtension(String)
removeExtension(...) -> String
-
Signature:
@MayReturnNull public static String removeExtension(final String filename) - Summary: Removes the file extension from a filename.
-
Contract:
- If no extension is found, the original filename is returned unchanged.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code null}
-
- Returns: the filename minus the extension, or {@code null} if the filename is {@code null}
- See also: #getBaseName(String), #getExtension(String)
equals(...) -> boolean
-
Signature:
public static boolean equals(final String filename1, final String filename2) - Summary: Checks whether two filenames are equal exactly.
-
Parameters:
-
filename1(String) — the first filename to query, {@code null} is allowed -
filename2(String) — the second filename to query, {@code null} is allowed
-
- Returns: {@code true} if the filenames are equal, {@code null} equals {@code null}
- See also: IOCase#SENSITIVE
-
Signature:
public static boolean equals(String filename1, String filename2, final boolean normalized, IOCase caseSensitivity) - Summary: Checks whether two filenames are equal with full control over processing and case sensitivity.
-
Contract:
- When normalization is enabled, both filenames are normalized before comparison using {@link #normalize(String)} .
- If {@code null} is provided, defaults to case-sensitive.
-
Parameters:
-
filename1(String) — the first filename to query, {@code null} is allowed -
filename2(String) — the second filename to query, {@code null} is allowed -
normalized(boolean) — whether to normalize the filenames before comparison -
caseSensitivity(IOCase) — what case sensitivity rule to use, {@code null} means case-sensitive
-
- Returns: {@code true} if the filenames are equal, {@code null} equals {@code null}
equalsOnSystem(...) -> boolean
-
Signature:
public static boolean equalsOnSystem(final String filename1, final String filename2) - Summary: Checks whether two filenames are equal using the case rules of the system.
-
Parameters:
-
filename1(String) — the first filename to query, {@code null} is allowed -
filename2(String) — the second filename to query, {@code null} is allowed
-
- Returns: {@code true} if the filenames are equal, {@code null} equals {@code null}
- See also: IOCase#SYSTEM
equalsNormalized(...) -> boolean
-
Signature:
public static boolean equalsNormalized(final String filename1, final String filename2) - Summary: Checks whether two filenames are equal after both have been normalized.
-
Parameters:
-
filename1(String) — the first filename to query, {@code null} is allowed -
filename2(String) — the second filename to query, {@code null} is allowed
-
- Returns: {@code true} if the filenames are equal, {@code null} equals {@code null}
- See also: IOCase#SENSITIVE
equalsNormalizedOnSystem(...) -> boolean
-
Signature:
public static boolean equalsNormalizedOnSystem(final String filename1, final String filename2) - Summary: Checks whether two filenames are equal after normalization and using system case rules.
-
Parameters:
-
filename1(String) — the first filename to query, {@code null} is allowed -
filename2(String) — the second filename to query, {@code null} is allowed
-
- Returns: {@code true} if the filenames are equal, {@code null} equals {@code null}
- See also: IOCase#SYSTEM
isExtension(...) -> boolean
-
Signature:
public static boolean isExtension(final String filename, final String extension) - Summary: Checks whether the extension of the filename is that specified.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code false} -
extension(String) — the extension to check for, {@code null} or empty checks for no extension
-
- Returns: {@code true} if the filename has the specified extension
-
Signature:
public static boolean isExtension(final String filename, final String[] extensions) - Summary: Checks whether the extension of the filename is one of those specified.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code false} -
extensions(String[]) — the extensions to check for, {@code null} or empty array checks for no extension
-
- Returns: {@code true} if the filename is one of the extensions
-
Signature:
public static boolean isExtension(final String filename, final Collection<String> extensions) - Summary: Checks whether the extension of the filename is one of those specified.
-
Parameters:
-
filename(String) — the filename to query, {@code null} returns {@code false} -
extensions(Collection<String>) — the extensions to check for, {@code null} or empty collection checks for no extension
-
- Returns: {@code true} if the filename is one of the extensions
wildcardMatch(...) -> boolean
-
Signature:
public static boolean wildcardMatch(final String filename, final String wildcardMatcher) - Summary: Checks a filename to see if it matches the specified wildcard matcher.
-
Contract:
- Checks a filename to see if it matches the specified wildcard matcher.
-
Parameters:
-
filename(String) — the filename to match on, {@code null} returns {@code true} only if wildcardMatcher is also {@code null} -
wildcardMatcher(String) — the wildcard string to match against, {@code null} returns {@code true} only if filename is also {@code null}
-
- Returns: {@code true} if the filename matches the wildcard string
- See also: IOCase#SENSITIVE
-
Signature:
public static boolean wildcardMatch(final String filename, final String wildcardMatcher, IOCase caseSensitivity) - Summary: Checks a filename against a wildcard matcher with full control over case-sensitivity.
-
Parameters:
-
filename(String) — the filename to match on, {@code null} returns {@code true} only if wildcardMatcher is also {@code null} -
wildcardMatcher(String) — the wildcard string to match against, {@code null} returns {@code true} only if filename is also {@code null} -
caseSensitivity(IOCase) — what case sensitivity rule to use, {@code null} means case-sensitive
-
- Returns: {@code true} if the filename matches the wildcard string, both {@code null} returns {@code true}
wildcardMatchOnSystem(...) -> boolean
-
Signature:
public static boolean wildcardMatchOnSystem(final String filename, final String wildcardMatcher) - Summary: Checks a filename against a wildcard matcher using system case rules.
-
Parameters:
-
filename(String) — the filename to match on, {@code null} returns {@code true} only if wildcardMatcher is also {@code null} -
wildcardMatcher(String) — the wildcard string to match against, {@code null} returns {@code true} only if filename is also {@code null}
-
- Returns: {@code true} if the filename matches the wildcard string
- See also: IOCase#SYSTEM
Public Instance Methods
- (none)
Class FloatIterator (com.landawn.abacus.util.FloatIterator)
A specialized iterator for primitive float values that avoids the overhead of boxing.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> FloatIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static FloatIterator empty() - Summary: Returns an empty {@code FloatIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code FloatIterator}
of(...) -> FloatIterator
-
Signature:
public static FloatIterator of(final float... a) - Summary: Creates a {@code FloatIterator} from the specified float array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(float[]) — the float array (may be {@code null} )
-
- Returns: a new {@code FloatIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static FloatIterator of(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code FloatIterator} from a subsequence of the specified float array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(float[]) — the float array (may be {@code null} ) -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: a new {@code FloatIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
defer(...) -> FloatIterator
-
Signature:
public static FloatIterator defer(final Supplier<? extends FloatIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Returns a FloatIterator instance created lazily using the provided Supplier.
-
Contract:
- The Supplier is invoked only when the first method is called on the returned iterator.
- <p> <b> Usage Examples: </b> </p> <pre> {@code FloatIterator lazy = FloatIterator.defer(() -> { // Expensive computation float\[\] data = loadFloatData(); return FloatIterator.of(data); }); // Iterator is not created until first use if (lazy.hasNext()) { // Supplier is invoked here float value = lazy.nextFloat(); } } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends FloatIterator>) — A Supplier that provides the FloatIterator when needed
-
- Returns: A FloatIterator that is initialized on first use
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> FloatIterator
-
Signature:
public static FloatIterator generate(final FloatSupplier supplier) throws IllegalArgumentException - Summary: Returns an infinite FloatIterator that generates values using the provided supplier.
-
Parameters:
-
supplier(FloatSupplier) — the supplier function to generate float values
-
- Returns: an infinite FloatIterator
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
-
Signature:
public static FloatIterator generate(final BooleanSupplier hasNext, final FloatSupplier supplier) throws IllegalArgumentException - Summary: Returns a FloatIterator that generates values while the hasNext condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that determines if more elements are available -
supplier(FloatSupplier) — the supplier function to generate float values
-
- Returns: a FloatIterator that terminates when hasNext returns false
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
next(...) -> Float
-
Signature:
@Deprecated @Override public Float next() - Summary: Returns the next element as a boxed Float.
-
Parameters:
- (none)
- Returns: the next element as a Float object
nextFloat(...) -> float
-
Signature:
public abstract float nextFloat() - Summary: Returns the next float value in the iteration.
-
Parameters:
- (none)
- Returns: the next float value
skip(...) -> FloatIterator
-
Signature:
public FloatIterator skip(final long n) throws IllegalArgumentException - Summary: Returns a new FloatIterator that skips the first n elements.
-
Contract:
- If n is greater than the number of remaining elements, an empty iterator is returned.
- The skipping is performed lazily when the returned iterator is first accessed.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new FloatIterator with the first n elements skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> FloatIterator
-
Signature:
public FloatIterator limit(final long count) throws IllegalArgumentException - Summary: Returns a new FloatIterator that contains at most the specified number of elements.
-
Contract:
- If the iterator contains fewer elements than the limit, all elements are included.
-
Parameters:
-
count(long) — the maximum number of elements to iterate
-
- Returns: a new FloatIterator limited to the specified count
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> FloatIterator
-
Signature:
public FloatIterator filter(final FloatPredicate predicate) throws IllegalArgumentException - Summary: Returns a new FloatIterator that only includes elements matching the given predicate.
-
Parameters:
-
predicate(FloatPredicate) — the predicate to test elements
-
- Returns: a new FloatIterator containing only matching elements
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalFloat
-
Signature:
public OptionalFloat first() - Summary: Returns the first element wrapped in an OptionalFloat, or empty if no elements exist.
-
Contract:
- Returns the first element wrapped in an OptionalFloat, or empty if no elements exist.
- This consumes the first element from the iterator if present.
-
Parameters:
- (none)
- Returns: OptionalFloat containing the first element, or empty if iterator is empty
last(...) -> OptionalFloat
-
Signature:
public OptionalFloat last() - Summary: Returns the last element wrapped in an OptionalFloat, or empty if no elements exist.
-
Contract:
- Returns the last element wrapped in an OptionalFloat, or empty if no elements exist.
-
Parameters:
- (none)
- Returns: OptionalFloat containing the last element, or empty if iterator is empty
toArray(...) -> float\[\]
-
Signature:
@SuppressWarnings("deprecation") public float[] toArray() - Summary: Converts the remaining elements to a float array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a float array containing all remaining elements
toList(...) -> FloatList
-
Signature:
public FloatList toList() - Summary: Converts the remaining elements to a FloatList.
-
Contract:
- If the iterator is already empty, returns an empty FloatList.
-
Parameters:
- (none)
- Returns: a FloatList containing all remaining elements
stream(...) -> FloatStream
-
Signature:
public FloatStream stream() - Summary: Converts this iterator to a FloatStream for use with the Stream API.
-
Parameters:
- (none)
- Returns: a new FloatStream backed by this iterator
indexed(...) -> ObjIterator<IndexedFloat>
-
Signature:
@Beta public ObjIterator<IndexedFloat> indexed() - Summary: Returns an ObjIterator that yields IndexedFloat objects pairing each element with its index.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedFloat objects
-
Signature:
@Beta public ObjIterator<IndexedFloat> indexed(final long startIndex) - Summary: Returns an ObjIterator that yields IndexedFloat objects pairing each element with its index.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an ObjIterator of IndexedFloat objects
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Float> action) - Summary: Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(java.util.function.Consumer<? super Float>) — the action to be performed for each element, must not be null
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.FloatConsumer<E> action) throws E - Summary: Performs the given action for each remaining float element.
-
Parameters:
-
action(Throwables.FloatConsumer<E>) — the action to be performed for each element, must not be null
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntFloatConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its index.
-
Contract:
- This method is useful when you need to track the position of elements during iteration.
-
Parameters:
-
action(Throwables.IntFloatConsumer<E>) — the action to be performed for each element with its index, must not be null
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class FloatList (com.landawn.abacus.util.FloatList)
A high-performance, resizable array implementation for primitive float values that provides specialized operations optimized for single-precision floating-point data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> FloatList
-
Signature:
public static FloatList of(final float... a) - Summary: Creates a new FloatList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(float[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new FloatList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static FloatList of(final float[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new FloatList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(float[]) — the array of float values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new FloatList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> FloatList
-
Signature:
public static FloatList copyOf(final float[] a) - Summary: Creates a new FloatList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(float[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new FloatList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static FloatList copyOf(final float[] a, final int fromIndex, final int toIndex) - Summary: Creates a new FloatList that is a copy of the specified range within the given array.
-
Parameters:
-
a(float[]) — the array from which a range is to be copied. Must not be {@code null} . -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new FloatList containing a copy of the elements in the specified range
repeat(...) -> FloatList
-
Signature:
public static FloatList repeat(final float element, final int len) - Summary: Creates a new FloatList with the specified element repeated the given number of times.
-
Parameters:
-
element(float) — the float value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new FloatList containing the repeated elements
random(...) -> FloatList
-
Signature:
public static FloatList random(final int len) - Summary: Creates a new FloatList filled with random float values between 0.0 (inclusive) and 1.0 (exclusive).
-
Parameters:
-
len(int) — the number of random float values to generate. Must be non-negative.
-
- Returns: a new FloatList containing the specified number of random float values
Public Instance Methods
<init>(...) -> void
-
Signature:
public FloatList() - Summary: Constructs an empty FloatList with an initial capacity of zero.
-
Parameters:
- (none)
-
Signature:
public FloatList(final int initialCapacity) - Summary: Constructs an empty FloatList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public FloatList(final float[] a) - Summary: Constructs a FloatList using the specified array as the backing array for this list.
-
Parameters:
-
a(float[]) — the array to be used as the backing array for this list. Must not be {@code null} .
-
-
Signature:
public FloatList(final float[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a FloatList using the specified array as the backing array for this list, with a specified size.
-
Parameters:
-
a(float[]) — the array to be used as the backing array for this list. Must not be {@code null} . -
size(int) — the number of elements in the list. Must be between 0 and a.length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> float\[\]
-
Signature:
@Beta @Deprecated @Override public float[] array() - Summary: Returns the underlying float array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal float array backing this list
get(...) -> float
-
Signature:
public float get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> float
-
Signature:
public float set(final int index, final float e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(float) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final float e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- The list will be automatically resized if necessary to accommodate the new element.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(float) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final float e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- The list will be automatically resized if necessary.
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted. Must be between 0 and size (inclusive). -
e(float) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final FloatList c) - Summary: Appends all elements from the specified FloatList to the end of this list, in the order that they appear in the specified list.
-
Contract:
- The behavior of this operation is undefined if the specified list is modified during the operation.
-
Parameters:
-
c(FloatList) — the FloatList containing elements to be added to this list. Must not be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final int index, final FloatList c) - Summary: Inserts all elements from the specified FloatList into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list. Must be between 0 and size (inclusive). -
c(FloatList) — the FloatList containing elements to be inserted into this list. Must not be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final float[] a) - Summary: Appends all elements from the specified array to the end of this list, in array order.
-
Contract:
- The list will be automatically resized if necessary to accommodate the new elements.
-
Parameters:
-
a(float[]) — the array containing elements to be added to this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not {@code null} or empty)
-
Signature:
@Override public boolean addAll(final int index, final float[] a) - Summary: Inserts all elements from the specified array into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array. Must be between 0 and size (inclusive). -
a(float[]) — the array containing elements to be inserted into this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not {@code null} or empty)
remove(...) -> boolean
-
Signature:
public boolean remove(final float e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If this list does not contain the element, it is unchanged.
-
Parameters:
-
e(float) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final float e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(float) — the element to be removed from this list
-
- Returns: {@code true} if this list contained one or more occurrences of the specified element
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final FloatList c) - Summary: Removes from this list all of its elements that are contained in the specified FloatList.
-
Parameters:
-
c(FloatList) — the FloatList containing elements to be removed from this list. Must not be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean removeAll(final float[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Parameters:
-
a(float[]) — the array containing elements to be removed from this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list changed as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final FloatPredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(FloatPredicate) — the predicate which returns {@code true} for elements to be removed. Must not be {@code null} .
-
- Returns: {@code true} if any elements were removed
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only the first occurrence of each value.
-
Contract:
- If the list is already sorted, the operation is optimized to run in linear time.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicate elements were removed, {@code false} if all elements were already unique
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final FloatList c) - Summary: Retains only the elements in this list that are contained in the specified FloatList.
-
Parameters:
-
c(FloatList) — the FloatList containing elements to be retained in this list. Must not be {@code null} .
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean retainAll(final float[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(float[]) — the array containing elements to be retained in this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list changed as a result of the call
delete(...) -> float
-
Signature:
public float delete(final int index) - Summary: Removes the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to be removed. Must be between 0 (inclusive) and size (exclusive).
-
- Returns: the element previously at the specified position
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes all elements at the specified indices from this list.
-
Contract:
- The indices must be valid positions within the list.
-
Parameters:
-
indices(int[]) — the array of indices at which elements should be removed. May be {@code null} or empty. Duplicate indices are handled correctly.
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes a range of elements from this list.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive). Must be non-negative. -
toIndex(int) — the index after the last element to be removed (exclusive). Must be > = fromIndex.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final FloatList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified FloatList.
-
Contract:
- The size of the list may change if the replacement has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the starting index of the range to be replaced (inclusive). Must be non-negative. -
toIndex(int) — the ending index of the range to be replaced (exclusive). Must be > = fromIndex. -
replacement(FloatList) — the FloatList whose elements will replace the specified range. May be {@code null} or empty.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final float[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with elements from the specified array.
-
Contract:
- The size of the list may change if the replacement array has a different number of elements than the range being replaced.
-
Parameters:
-
fromIndex(int) — the starting index of the range to be replaced (inclusive). Must be non-negative. -
toIndex(int) — the ending index of the range to be replaced (exclusive). Must be > = fromIndex. -
replacement(float[]) — the array whose elements will replace the specified range. May be {@code null} or empty.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final float oldVal, final float newVal) - Summary: Replaces all occurrences of a specified value with a new value throughout the entire list.
-
Parameters:
-
oldVal(float) — the old value to be replaced -
newVal(float) — the new value to replace oldVal
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final FloatUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the specified operator to that element.
-
Parameters:
-
operator(FloatUnaryOperator) — the operator to apply to each element. Must not be {@code null} .
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final FloatPredicate predicate, final float newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(FloatPredicate) — the predicate to test each element. Must not be {@code null} . -
newValue(float) — the value to replace matching elements with
-
- Returns: {@code true} if any elements were replaced, {@code false} otherwise
fill(...) -> void
-
Signature:
public void fill(final float val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(float) — the value to be stored in all elements of the list
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final float val) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled with the specified value. Must be non-negative. -
toIndex(int) — the index after the last element (exclusive) to be filled with the specified value. Must be > = fromIndex. -
val(float) — the value to be stored in the specified range of the list
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
contains(...) -> boolean
-
Signature:
public boolean contains(final float valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code Float.compare(e, valueToFind) == 0} .
-
Parameters:
-
valueToFind(float) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final FloatList c) - Summary: Returns {@code true} if this list contains any of the elements in the specified FloatList.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified FloatList.
-
Parameters:
-
c(FloatList) — the FloatList to be checked for containment in this list. Must not be {@code null} .
-
- Returns: {@code true} if this list contains any element from the specified FloatList, {@code false} if this list is empty, c is empty, or no elements match
-
Signature:
@Override public boolean containsAny(final float[] a) - Summary: Returns {@code true} if this list contains any of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified array.
-
Parameters:
-
a(float[]) — the array to be checked for containment in this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list contains any element from the specified array, {@code false} if this list is empty, the array is {@code null} or empty, or no elements match
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final FloatList c) - Summary: Returns {@code true} if this list contains all of the elements in the specified FloatList.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified FloatList.
-
Parameters:
-
c(FloatList) — the FloatList to be checked for containment in this list. Must not be {@code null} .
-
- Returns: {@code true} if this list contains all distinct elements from the specified FloatList, {@code false} otherwise. Returns {@code true} if c is empty.
-
Signature:
@Override public boolean containsAll(final float[] a) - Summary: Returns {@code true} if this list contains all of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified array.
-
Parameters:
-
a(float[]) — the array to be checked for containment in this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list contains all distinct elements from the specified array, {@code false} otherwise. Returns {@code true} if the array is {@code null} or empty.
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final FloatList c) - Summary: Returns {@code true} if this list has no elements in common with the specified FloatList.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified FloatList.
- Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(FloatList) — the FloatList to be checked for disjointness with this list. Must not be {@code null} .
-
- Returns: {@code true} if this list has no elements in common with the specified FloatList, {@code false} if they share at least one element. Returns {@code true} if either list is empty.
-
Signature:
@Override public boolean disjoint(final float[] b) - Summary: Returns {@code true} if this list has no elements in common with the specified array.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified array.
- This list and the array are disjoint if they share no common elements.
-
Parameters:
-
b(float[]) — the array to be checked for disjointness with this list. May be {@code null} or empty.
-
- Returns: {@code true} if this list has no elements in common with the specified array, {@code false} if they share at least one element. Returns {@code true} if either this list or the array is empty or {@code null} .
intersection(...) -> FloatList
-
Signature:
@Override public FloatList intersection(final FloatList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(FloatList) — the list to find common elements with this list
-
- Returns: a new FloatList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list. Returns an empty list if either list is {@code null} or empty.
- See also: #intersection(float\[\]), #difference(FloatList), #symmetricDifference(FloatList), N#intersection(float\[\], float\[\]), N#intersection(int\[\], int\[\])
-
Signature:
@Override public FloatList intersection(final float[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(float[]) — the array to find common elements with this list
-
- Returns: a new FloatList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source. Returns an empty list if the array is {@code null} or empty.
- See also: #intersection(FloatList), #difference(float\[\]), #symmetricDifference(float\[\]), N#intersection(float\[\], float\[\]), N#intersection(int\[\], int\[\])
difference(...) -> FloatList
-
Signature:
@Override public FloatList difference(final FloatList b) - Summary: Returns a new list with the elements in this list but not in the specified list {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(FloatList) — the list to compare against this list
-
- Returns: a new FloatList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: #difference(float\[\]), #symmetricDifference(FloatList), #intersection(FloatList), N#difference(float\[\], float\[\]), N#difference(int\[\], int\[\])
-
Signature:
@Override public FloatList difference(final float[] b) - Summary: Returns a new list with the elements in this list but not in the specified array {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(float[]) — the array to compare against this list
-
- Returns: a new FloatList containing the elements that are present in this list but not in the specified array, considering the number of occurrences. Returns a copy of this list if {@code b} is {@code null} or empty.
- See also: #difference(FloatList), #symmetricDifference(float\[\]), #intersection(float\[\]), N#difference(float\[\], float\[\]), N#difference(int\[\], int\[\])
symmetricDifference(...) -> FloatList
-
Signature:
@Override public FloatList symmetricDifference(final FloatList b) - Summary: Returns a new FloatList containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
b(FloatList) — the list to compare with this list for symmetric difference
-
- Returns: a new FloatList containing elements that are present in either this list or the specified list, but not in both, considering the number of occurrences
- See also: #symmetricDifference(float\[\]), #difference(FloatList), #intersection(FloatList), N#symmetricDifference(float\[\], float\[\]), N#symmetricDifference(int\[\], int\[\])
-
Signature:
@Override public FloatList symmetricDifference(final float[] b) - Summary: Returns a new FloatList containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
b(float[]) — the array to compare with this list for symmetric difference
-
- Returns: a new FloatList containing elements that are present in either this list or the specified array, but not in both, considering the number of occurrences
- See also: #symmetricDifference(FloatList), #difference(float\[\]), #intersection(float\[\]), N#symmetricDifference(float\[\], float\[\]), N#symmetricDifference(int\[\], int\[\])
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final float valueToFind) - Summary: Counts the number of occurrences of the specified value in this list.
-
Parameters:
-
valueToFind(float) — the value whose occurrences are to be counted
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final float valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the element.
-
Parameters:
-
valueToFind(float) — the element to search for
-
- Returns: the index of the first occurrence of the specified element in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the element
-
Signature:
public int indexOf(final float valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the element is not found.
-
Parameters:
-
valueToFind(float) — the element to search for -
fromIndex(int) — the index to start searching from (inclusive). May be negative, in which case it is treated as 0.
-
- Returns: the index of the first occurrence of the element at position > = fromIndex, or {@code N.INDEX_NOT_FOUND} (-1) if the element is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final float valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(float) — the element to search for
-
- Returns: the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element
-
Signature:
public int lastIndexOf(final float valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(float) — the element to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). If > = size, the search starts from the last element.
-
- Returns: the index of the last occurrence of the element at position < = startIndexFromBack, or -1 if the element is not found or startIndexFromBack is negative
min(...) -> OptionalFloat
-
Signature:
public OptionalFloat min() - Summary: Returns the minimum element in this list wrapped in an OptionalFloat.
-
Contract:
- If the list is empty, returns an empty OptionalFloat.
-
Parameters:
- (none)
- Returns: an OptionalFloat containing the minimum element, or an empty OptionalFloat if this list is empty
-
Signature:
public OptionalFloat min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum element in the specified range of this list wrapped in an OptionalFloat.
-
Contract:
- If the range is empty (fromIndex == toIndex), returns an empty OptionalFloat.
-
Parameters:
-
fromIndex(int) — the index of the first element in the range (inclusive). Must be non-negative. -
toIndex(int) — the index after the last element in the range (exclusive). Must be > = fromIndex.
-
- Returns: an OptionalFloat containing the minimum element in the range, or an empty OptionalFloat if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
max(...) -> OptionalFloat
-
Signature:
public OptionalFloat max() - Summary: Returns the maximum value in this list as an OptionalFloat.
-
Parameters:
- (none)
- Returns: an OptionalFloat containing the maximum value, or an empty OptionalFloat if this list is empty
-
Signature:
public OptionalFloat max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the maximum value in the specified range of this list as an OptionalFloat.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be included in the max calculation -
toIndex(int) — the index of the last element (exclusive) to be included in the max calculation
-
- Returns: an OptionalFloat containing the maximum value in the specified range, or an empty OptionalFloat if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
median(...) -> OptionalFloat
-
Signature:
public OptionalFloat median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalFloat containing the median value if the list is non-empty, or an empty OptionalFloat if the list is empty
-
Signature:
public OptionalFloat median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalFloat containing the median value if the range is non-empty, or an empty OptionalFloat if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final FloatConsumer action) - Summary: Performs the given action for each element in this list in sequential order.
-
Parameters:
-
action(FloatConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final FloatConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element within the specified range of this list.
-
Contract:
- <p> This method supports both forward and backward iteration based on the relative values of fromIndex and toIndex: </p> <ul> <li> If {@code fromIndex <= toIndex} : iterates forward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code fromIndex > toIndex} : iterates backward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code toIndex == -1} : treated as backward iteration from fromIndex to the beginning of the list </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code FloatList list = FloatList.of(1.0f, 2.0f, 3.0f, 4.0f, 5.0f); list.forEach(0, 3, action); // Forward: processes indices 0,1,2 list.forEach(3, 0, action); // Backward: processes indices 3,2,1 list.forEach(4, -1, action); // Backward: processes indices 4,3,2,1,0 } </pre>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for backward iteration to the start -
action(FloatConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
first(...) -> OptionalFloat
-
Signature:
public OptionalFloat first() - Summary: Returns the first element in this list as an OptionalFloat.
-
Parameters:
- (none)
- Returns: an OptionalFloat containing the first element, or an empty OptionalFloat if this list is empty
last(...) -> OptionalFloat
-
Signature:
public OptionalFloat last() - Summary: Returns the last element in this list as an OptionalFloat.
-
Parameters:
- (none)
- Returns: an OptionalFloat containing the last element, or an empty OptionalFloat if this list is empty
distinct(...) -> FloatList
-
Signature:
@Override public FloatList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new FloatList containing only the distinct elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index of the last element (exclusive) to include
-
- Returns: a new FloatList containing the distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Returns {@code true} if this list contains any duplicate elements.
-
Contract:
- Returns {@code true} if this list contains any duplicate elements.
- Two elements are considered duplicates if they are equal according to {@code Float.compare()} .
-
Parameters:
- (none)
- Returns: {@code true} if this list contains duplicate elements, {@code false} otherwise
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks if the elements in this list are sorted in ascending order.
-
Contract:
- Checks if the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if this list is sorted in ascending order or is empty, {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts the elements in this list in ascending order.
-
Parameters:
- (none)
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts the elements in this list in ascending order using a parallel sort algorithm.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts the elements in this list in descending order.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final float valueToFind) - Summary: Searches for the specified value in this list using the binary search algorithm.
-
Contract:
- The list must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
- <p> If the list contains multiple elements equal to the specified value, there is no guarantee which one will be found.
-
Parameters:
-
valueToFind(float) — the value to search for
-
- Returns: the index of the search key, if it is contained in the list; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or {@code size()} if all elements in the list are less than the specified key
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final float valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified value in the specified range of this list using the binary search algorithm.
-
Contract:
- The range must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to search -
toIndex(int) — the index of the last element (exclusive) to search -
valueToFind(float) — the value to search for
-
- Returns: the index of the search key, if it is contained in the range; otherwise, {@code (-(insertion point) - 1)} . The insertion point is defined as the point at which the key would be inserted into the range: the index of the first element greater than the key, or {@code toIndex} if all elements in the range are less than the specified key
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to reverse -
toIndex(int) — the index of the last element (exclusive) to reverse
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles the elements in this list using a default source of randomness.
-
Parameters:
- (none)
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles the elements in this list using the specified source of randomness.
-
Parameters:
-
rnd(Random) — the source of randomness to use to shuffle the list
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> FloatList
-
Signature:
@Override public FloatList copy() - Summary: Returns a shallow copy of this FloatList instance.
-
Parameters:
- (none)
- Returns: a new FloatList containing the same elements as this list
-
Signature:
@Override public FloatList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new FloatList containing a copy of the elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to copy -
toIndex(int) — the index of the last element (exclusive) to copy
-
- Returns: a new FloatList containing a copy of the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public FloatList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a new FloatList containing a copy of the elements in the specified range of this list, selecting elements at the specified step interval.
-
Contract:
- <p> Examples: </p> <ul> <li> If step is 1, all elements in the range are included </li> <li> If step is 2, every other element is included </li> <li> If step is negative and fromIndex > toIndex, elements are selected in reverse order </li> </ul>
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to copy. Can be greater than toIndex for reverse iteration -
toIndex(int) — the index of the last element (exclusive) to copy. If -1 and fromIndex > toIndex, it's treated as 0 -
step(int) — the step size for selecting elements. Must not be zero
-
- Returns: a new FloatList containing a copy of the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
- See also: N#copyOfRange(float\[\], int, int, int)
split(...) -> List<FloatList>
-
Signature:
@Override public List<FloatList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into consecutive chunks of the specified size and returns them as a list of FloatLists.
-
Contract:
- The last chunk may be smaller than the specified size if the range doesn't divide evenly.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include in the split -
toIndex(int) — the index of the last element (exclusive) to include in the split -
chunkSize(int) — the desired size of each chunk (must be positive)
-
- Returns: a List of FloatLists, each containing a chunk of elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
trimToSize(...) -> FloatList
-
Signature:
@Override public FloatList trimToSize() - Summary: Trims the capacity of this FloatList instance to be the list's current size.
-
Parameters:
- (none)
- Returns: this FloatList instance
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Float>
-
Signature:
@Override public List<Float> boxed() - Summary: Returns a List containing all elements in this FloatList, boxed as Float objects.
-
Parameters:
- (none)
- Returns: a new List < Float > containing all elements from this list
-
Signature:
@Override public List<Float> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a List containing elements in the specified range of this FloatList, boxed as Float objects.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to box -
toIndex(int) — the index of the last element (exclusive) to box
-
- Returns: a new List < Float > containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toArray(...) -> float\[\]
-
Signature:
@Override public float[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new float array containing all elements of this list
toDoubleList(...) -> DoubleList
-
Signature:
public DoubleList toDoubleList() - Summary: Converts this FloatList to a DoubleList.
-
Parameters:
- (none)
- Returns: a new DoubleList containing all elements from this list converted to double values
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Float>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index of the last element (exclusive) to include -
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance with the specified initial capacity
-
- Returns: a Collection containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Float>
-
Signature:
@Override public Multiset<Float> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Float>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include -
toIndex(int) — the index of the last element (exclusive) to include -
supplier(IntFunction<Multiset<Float>>) — a function that creates a new Multiset instance with the specified initial capacity
-
- Returns: a Multiset containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
iterator(...) -> FloatIterator
-
Signature:
@Override public FloatIterator iterator() - Summary: Returns an iterator over the elements in this list in proper sequence.
-
Contract:
- <p> The returned iterator is fail-fast: if the list is structurally modified at any time after the iterator is created, the iterator may throw a {@code ConcurrentModificationException} .
- This behavior is not guaranteed and should not be relied upon for correctness.
-
Parameters:
- (none)
- Returns: a FloatIterator over the elements in this list
stream(...) -> FloatStream
-
Signature:
public FloatStream stream() - Summary: Returns a FloatStream with this list as its source.
-
Parameters:
- (none)
- Returns: a FloatStream over the elements in this list
-
Signature:
public FloatStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a FloatStream with the specified range of this list as its source.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to include in the stream -
toIndex(int) — the index of the last element (exclusive) to include in the stream
-
- Returns: a FloatStream over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
getFirst(...) -> float
-
Signature:
public float getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first float value in the list
getLast(...) -> float
-
Signature:
public float getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last float value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final float e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(float) — the element to add at the beginning of this list
-
addLast(...) -> void
-
Signature:
public void addLast(final float e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(float) — the element to add at the end of this list
-
removeFirst(...) -> float
-
Signature:
public float removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first float value that was removed from the list
removeLast(...) -> float
-
Signature:
public float removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last float value that was removed from the list
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this list.
-
Parameters:
- (none)
- Returns: a hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this list for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also a FloatList, both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class FloatSummaryStatistics (com.landawn.abacus.util.FloatSummaryStatistics)
A state object for collecting statistics about float values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public FloatSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, {@code Float.POSITIVE_INFINITY} min, {@code Float.NEGATIVE_INFINITY} max, and zero average.
-
Parameters:
- (none)
-
Signature:
public FloatSummaryStatistics(final long count, final float min, final float max, final double sum) - Summary: Constructs a non-empty instance with the specified count, min, max, and sum.
-
Parameters:
-
count(long) — the count of values (must be non-negative) -
min(float) — the minimum value -
max(float) — the maximum value -
sum(double) — the sum of all values
-
accept(...) -> void
-
Signature:
@Override public void accept(final float value) - Summary: Records a new float value into the summary information.
-
Parameters:
-
value(float) — the input value to be recorded
-
combine(...) -> void
-
Signature:
public void combine(final FloatSummaryStatistics other) - Summary: Combines the state of another {@code FloatSummaryStatistics} into this one.
-
Parameters:
-
other(FloatSummaryStatistics) — another {@code FloatSummaryStatistics} to be combined with this one
-
getMin(...) -> float
-
Signature:
public final float getMin() - Summary: Returns the minimum value recorded, or {@code Float.POSITIVE_INFINITY} if no values have been recorded.
-
Contract:
- Returns the minimum value recorded, or {@code Float.POSITIVE_INFINITY} if no values have been recorded.
- <p> Note: If any recorded value was NaN, then the result will be NaN.
-
Parameters:
- (none)
- Returns: the minimum value, or {@code Float.POSITIVE_INFINITY} if none
getMax(...) -> float
-
Signature:
public final float getMax() - Summary: Returns the maximum value recorded, or {@code Float.NEGATIVE_INFINITY} if no values have been recorded.
-
Contract:
- Returns the maximum value recorded, or {@code Float.NEGATIVE_INFINITY} if no values have been recorded.
- <p> Note: If any recorded value was NaN, then the result will be NaN.
-
Parameters:
- (none)
- Returns: the maximum value, or {@code Float.NEGATIVE_INFINITY} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> Double
-
Signature:
public final Double getSum() - Summary: Returns the sum of values recorded.
-
Contract:
- If no values have been recorded, returns 0.0.
-
Parameters:
- (none)
- Returns: the sum of values, or zero if none
getAverage(...) -> Double
-
Signature:
public final Double getAverage() - Summary: Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or zero if no values have been recorded.
- <p> Note: If the sum is NaN or infinite, or if the count is zero, special rules apply as per floating-point arithmetic.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values, or zero if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this statistics object.
-
Parameters:
- (none)
- Returns: a string representation of this object
Class Fn (com.landawn.abacus.util.Fn)
A comprehensive factory utility class providing static methods for creating and manipulating standard Java functional interfaces.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
memoize(...) -> Supplier<T>
-
Signature:
public static <T> Supplier<T> memoize(final java.util.function.Supplier<T> supplier) - Summary: Returns a {@code Supplier} which returns a single instance created by calling the specified {@code supplier.get()} .
-
Parameters:
-
supplier(java.util.function.Supplier<T>) — the supplier whose result should be memoized
-
- Returns: a memoized Supplier that caches the result of the first invocation
-
Signature:
public static <T, R> Function<T, R> memoize(final java.util.function.Function<? super T, ? extends R> func) - Summary: Returns a memoized (cached) version of the provided function.
-
Contract:
- The memoized function caches the results of previous invocations and returns the cached result when called again with the same input, avoiding repeated computation.
- If the function returns {@code null} for a given input, that {@code null} result will be cached and returned on subsequent invocations with the same input, without re-executing the function.
-
Parameters:
-
func(java.util.function.Function<? super T, ? extends R>) — the function whose results should be memoized (must not be null)
-
- Returns: a memoized version of the function that caches results based on input values
- See also: ConcurrentHashMap
memoizeWithExpiration(...) -> Supplier<T>
-
Signature:
public static <T> Supplier<T> memoizeWithExpiration(final java.util.function.Supplier<T> supplier, final long duration, final TimeUnit unit) throws IllegalArgumentException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
supplier(java.util.function.Supplier<T>) — the delegate supplier whose results should be cached. Must not be {@code null} . This supplier will be called to provide values when the cache is empty or expired -
duration(long) — the length of time after a value is created that it should remain in the cache before expiring. Must be positive. After this duration passes, the next call to {@code get()} will invoke the delegate supplier again -
unit(TimeUnit) — the time unit for the duration parameter. Must not be {@code null} . Common units include {@code TimeUnit.SECONDS} , {@code TimeUnit.MINUTES} , etc.
-
- Returns: a new supplier that caches the result of the delegate supplier for the specified duration. The returned supplier's {@code get()} method will return cached values within the expiration window and fetch fresh values when the cache expires
-
Throws:
-
java.lang.IllegalArgumentException— if {@code duration} is not positive (i.e., duration \\u2264 0)
-
-
Signature:
public static <T> Supplier<T> memoizeWithExpiration(final java.util.function.Supplier<T> supplier, final Duration duration) - Summary: Creates a memoizing supplier that caches the result of the delegate supplier and automatically expires the cached value after the specified duration.
-
Parameters:
-
supplier(java.util.function.Supplier<T>) — the delegate supplier whose results should be cached. Must not be {@code null} . This supplier will be called to provide values when the cache is empty or expired -
duration(Duration) — the length of time after a value is created that it should remain in the cache before expiring. Must represent a positive duration when converted to milliseconds. After this duration passes, the next call to {@code get()} will invoke the delegate supplier again
-
- Returns: a new supplier that caches the result of the delegate supplier for the specified duration. The returned supplier's {@code get()} method will return cached values within the expiration window and fetch fresh values when the cache expires
- See also: #memoizeWithExpiration(java.util.function.Supplier, long, TimeUnit), Duration
close(...) -> Runnable
-
Signature:
public static Runnable close(final AutoCloseable closeable) - Summary: Returns a Runnable that closes the specified AutoCloseable resource.
-
Contract:
- The returned Runnable ensures the resource is closed only once, even if called multiple times.
-
Parameters:
-
closeable(AutoCloseable) — the AutoCloseable resource to close
-
- Returns: a Runnable that closes the resource when executed
- See also: IOUtil#close(AutoCloseable)
-
Signature:
public static <T extends AutoCloseable> Consumer<T> close() - Summary: Returns a Consumer that closes AutoCloseable resources.
-
Parameters:
- (none)
- Returns: a Consumer that closes AutoCloseable resources
- See also: AutoCloseable#close()
closeAll(...) -> Runnable
-
Signature:
public static Runnable closeAll(final AutoCloseable... a) - Summary: Returns a Runnable that closes all specified AutoCloseable resources.
-
Contract:
- The returned Runnable ensures all resources are closed only once, even if called multiple times.
-
Parameters:
-
a(AutoCloseable[]) — the array of AutoCloseable resources to close
-
- Returns: a Runnable that closes all resources when executed
- See also: IOUtil#closeAll(AutoCloseable...)
-
Signature:
public static Runnable closeAll(final Collection<? extends AutoCloseable> c) - Summary: Returns a Runnable that closes all AutoCloseable resources in the specified collection.
-
Contract:
- The returned Runnable ensures all resources are closed only once, even if called multiple times.
-
Parameters:
-
c(Collection<? extends AutoCloseable>) — the collection of AutoCloseable resources to close
-
- Returns: a Runnable that closes all resources when executed
- See also: IOUtil#closeAll(Iterable)
closeQuietly(...) -> Runnable
-
Signature:
public static Runnable closeQuietly(final AutoCloseable closeable) - Summary: Returns a Runnable that quietly closes the specified AutoCloseable resource.
-
Contract:
- The returned Runnable ensures the resource is closed only once, even if called multiple times.
-
Parameters:
-
closeable(AutoCloseable) — the AutoCloseable resource to close quietly
-
- Returns: a Runnable that closes the resource quietly when executed
- See also: IOUtil#closeQuietly(AutoCloseable)
-
Signature:
public static <T extends AutoCloseable> Consumer<T> closeQuietly() - Summary: Returns a Consumer that quietly closes AutoCloseable resources.
-
Parameters:
- (none)
- Returns: a Consumer that quietly closes AutoCloseable resources
- See also: IOUtil#closeQuietly(AutoCloseable)
closeAllQuietly(...) -> Runnable
-
Signature:
public static Runnable closeAllQuietly(final AutoCloseable... a) - Summary: Returns a Runnable that quietly closes all specified AutoCloseable resources.
-
Contract:
- The returned Runnable ensures all resources are closed only once, even if called multiple times.
-
Parameters:
-
a(AutoCloseable[]) — the array of AutoCloseable resources to close quietly
-
- Returns: a Runnable that closes all resources quietly when executed
- See also: IOUtil#closeAllQuietly(AutoCloseable...)
-
Signature:
public static Runnable closeAllQuietly(final Collection<? extends AutoCloseable> c) - Summary: Returns a Runnable that quietly closes all AutoCloseable resources in the specified collection.
-
Contract:
- The returned Runnable ensures all resources are closed only once, even if called multiple times.
-
Parameters:
-
c(Collection<? extends AutoCloseable>) — the collection of AutoCloseable resources to close quietly
-
- Returns: a Runnable that closes all resources quietly when executed
- See also: IOUtil#closeAllQuietly(Iterable)
emptyAction(...) -> Runnable
-
Signature:
public static Runnable emptyAction() - Summary: Returns an empty Runnable that performs no operation when executed.
-
Contract:
- Returns an empty Runnable that performs no operation when executed.
-
Parameters:
- (none)
- Returns: an empty Runnable which does nothing
shutDown(...) -> Runnable
-
Signature:
public static Runnable shutDown(final ExecutorService service) - Summary: Returns a Runnable that shuts down the specified ExecutorService.
-
Contract:
- The returned Runnable ensures the service is shut down only once, even if called multiple times.
-
Parameters:
-
service(ExecutorService) — the ExecutorService to shut down
-
- Returns: a Runnable that shuts down the service when executed
- See also: ExecutorService#shutdown()
-
Signature:
public static Runnable shutDown(final ExecutorService service, final long terminationTimeout, final TimeUnit timeUnit) - Summary: Returns a Runnable that shuts down the specified ExecutorService and waits for termination.
-
Contract:
- The returned Runnable ensures the service is shut down only once, even if called multiple times.
-
Parameters:
-
service(ExecutorService) — the ExecutorService to shut down -
terminationTimeout(long) — the maximum time to wait for termination -
timeUnit(TimeUnit) — the time unit of the timeout argument
-
- Returns: a Runnable that shuts down the service and waits for termination
- See also: ExecutorService#shutdown(), ExecutorService#awaitTermination(long, TimeUnit)
doNothing(...) -> Consumer<T>
-
Signature:
@Deprecated public static <T> Consumer<T> doNothing() - Summary: Returns an empty Consumer that performs no operation on its input.
-
Parameters:
- (none)
- Returns: an empty Consumer which does nothing
- See also: #emptyConsumer()
emptyConsumer(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> emptyConsumer() - Summary: Returns an empty Consumer that performs no operation on its input.
-
Parameters:
- (none)
- Returns: an empty Consumer which does nothing
throwRuntimeException(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> throwRuntimeException(final String errorMessage) - Summary: Returns a Consumer that throws a RuntimeException with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message for the RuntimeException
-
- Returns: a Consumer that throws RuntimeException when invoked
throwException(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> throwException(final java.util.function.Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a Consumer that throws a RuntimeException created by the specified supplier.
-
Parameters:
-
exceptionSupplier(java.util.function.Supplier<? extends RuntimeException>) — the supplier that creates the exception to throw
-
- Returns: a Consumer that throws the supplied exception when invoked
toRuntimeException(...) -> Function<Throwable, RuntimeException>
-
Signature:
public static Function<Throwable, RuntimeException> toRuntimeException() - Summary: Returns a Function that converts Throwable to RuntimeException.
-
Contract:
- If the input is already a RuntimeException, it is returned as-is.
-
Parameters:
- (none)
- Returns: a Function that converts Throwable to RuntimeException
sleep(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> sleep(final long millis) - Summary: Returns a Consumer that sleeps for the specified number of milliseconds.
-
Parameters:
-
millis(long) — the sleep duration in milliseconds
-
- Returns: a Consumer that sleeps for the specified duration
- See also: N#sleep(long)
sleepUninterruptibly(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> sleepUninterruptibly(final long millis) - Summary: Returns a Consumer that sleeps uninterruptibly for the specified number of milliseconds.
-
Contract:
- If interrupted, the interrupt status is preserved.
-
Parameters:
-
millis(long) — the sleep duration in milliseconds
-
- Returns: a Consumer that sleeps uninterruptibly for the specified duration
- See also: N#sleepUninterruptibly(long)
rateLimiter(...) -> Consumer<T>
-
Signature:
@Stateful public static <T> Consumer<T> rateLimiter(final double permitsPerSecond) - Summary: Returns a stateful Consumer that rate-limits execution based on permits per second.
-
Parameters:
-
permitsPerSecond(double) — the rate limit in permits per second
-
- Returns: a stateful Consumer that rate-limits execution
- See also: RateLimiter#acquire(), RateLimiter#create(double)
-
Signature:
@Stateful public static <T> Consumer<T> rateLimiter(final RateLimiter rateLimiter) - Summary: Returns a stateful Consumer that rate-limits execution using the provided RateLimiter.
-
Parameters:
-
rateLimiter(RateLimiter) — the RateLimiter to use for rate limiting
-
- Returns: a stateful Consumer that rate-limits execution
- See also: RateLimiter#acquire()
println(...) -> Consumer<T>
-
Signature:
public static <T> Consumer<T> println() - Summary: Returns a Consumer that prints its input to standard output using N.println().
-
Parameters:
- (none)
- Returns: a Consumer that prints its input
- See also: N#println(Object)
-
Signature:
public static <T, U> BiConsumer<T, U> println(final String separator) throws IllegalArgumentException - Summary: Returns a BiConsumer that prints its two inputs separated by the specified separator.
-
Parameters:
-
separator(String) — the separator to use between the two values
-
- Returns: a BiConsumer that prints both inputs with separator
-
Throws:
-
java.lang.IllegalArgumentException— if separator is null
-
- See also: N#println(Object)
toStr(...) -> Function<T, String>
-
Signature:
public static <T> Function<T, String> toStr() - Summary: Returns a Function that converts its input to a String using String.valueOf().
-
Parameters:
- (none)
- Returns: a Function that converts its input to String
- See also: String#valueOf(Object)
toLowerCase(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> toLowerCase() - Summary: Returns a UnaryOperator that converts strings to lower case.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts strings to lower case
- See also: String#toLowerCase()
toUpperCase(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> toUpperCase() - Summary: Returns a UnaryOperator that converts strings to upper case.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts strings to upper case
- See also: String#toUpperCase()
toCamelCase(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> toCamelCase() - Summary: Returns a UnaryOperator that converts strings to camel case.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts strings to camel case
- See also: Strings#toCamelCase(String)
toSnakeCase(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> toSnakeCase() - Summary: Returns a UnaryOperator that converts strings to lower case with underscores.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts strings to lower case with underscores
- See also: Strings#toSnakeCase(String)
toScreamingSnakeCase(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> toScreamingSnakeCase() - Summary: Returns a UnaryOperator that converts strings to upper case with underscores.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts strings to upper case with underscores
- See also: Strings#toScreamingSnakeCase(String)
toJson(...) -> Function<T, String>
-
Signature:
public static <T> Function<T, String> toJson() - Summary: Returns a Function that converts objects to JSON string representation.
-
Parameters:
- (none)
- Returns: a Function that converts objects to JSON
- See also: N#toJson(Object)
toXml(...) -> Function<T, String>
-
Signature:
public static <T> Function<T, String> toXml() - Summary: Returns a Function that converts objects to XML string representation.
-
Parameters:
- (none)
- Returns: a Function that converts objects to XML
- See also: N#toXml(Object)
identity(...) -> Function<T, T>
-
Signature:
public static <T> Function<T, T> identity() - Summary: Returns an identity Function that returns its input unchanged.
-
Parameters:
- (none)
- Returns: an identity Function
- See also: Function#identity()
keyed(...) -> Function<T, Keyed<K, T>>
-
Signature:
public static <K, T> Function<T, Keyed<K, T>> keyed(final java.util.function.Function<? super T, K> keyExtractor) throws IllegalArgumentException - Summary: Returns a Function that wraps an object with its key extracted by the keyExtractor.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super T, K>) — the function to extract the key from the value
-
- Returns: a Function that creates Keyed objects
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: Keyed#of(Object, Object)
val(...) -> Function<Keyed<K, T>, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, T> Function<Keyed<K, T>, T> val() - Summary: Returns a Function that extracts the value from a Keyed object.
-
Parameters:
- (none)
- Returns: a Function that extracts values from Keyed objects
- See also: Keyed#val()
kkv(...) -> Function<Map.Entry<Keyed<K, T>, V>, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, T, V> Function<Map.Entry<Keyed<K, T>, V>, T> kkv() - Summary: Returns a Function that extracts the value from a Map.Entry with a Keyed key.
-
Contract:
- This is useful when working with entries where the key itself is a Keyed object.
-
Parameters:
- (none)
- Returns: a Function that extracts the value from the Keyed key
wrap(...) -> Function<T, Wrapper<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<T, Wrapper<T>> wrap() - Summary: Returns a Function that wraps objects in a Wrapper.
-
Parameters:
- (none)
- Returns: a Function that creates Wrapper objects
- See also: Wrapper#of(Object)
-
Signature:
public static <T> Function<T, Wrapper<T>> wrap(final java.util.function.ToIntFunction<? super T> hashFunction, final java.util.function.BiPredicate<? super T, ? super T> equalsFunction) throws IllegalArgumentException - Summary: Returns a Function that wraps objects with custom hash and equals functions.
-
Parameters:
-
hashFunction(java.util.function.ToIntFunction<? super T>) — the function to compute hash codes -
equalsFunction(java.util.function.BiPredicate<? super T, ? super T>) — the function to test equality
-
- Returns: a Function that creates Wrapper objects with custom behavior
-
Throws:
-
java.lang.IllegalArgumentException— if hashFunction or equalsFunction is null
-
- See also: Wrapper#of(Object, java.util.function.ToIntFunction, java.util.function.BiPredicate)
unwrap(...) -> Function<Wrapper<T>, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Wrapper<T>, T> unwrap() - Summary: Returns a Function that unwraps Wrapper objects to get their values.
-
Parameters:
- (none)
- Returns: a Function that extracts values from Wrapper objects
- See also: Wrapper#value()
key(...) -> Function<Entry<K, V>, K>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Function<Entry<K, V>, K> key() - Summary: Returns a Function that extracts the key from a Map.Entry.
-
Parameters:
- (none)
- Returns: a Function that extracts keys from Map.Entry objects
- See also: Map.Entry#getKey()
value(...) -> Function<Entry<K, V>, V>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Function<Entry<K, V>, V> value() - Summary: Returns a Function that extracts the value from a Map.Entry.
-
Parameters:
- (none)
- Returns: a Function that extracts values from Map.Entry objects
- See also: Map.Entry#getValue()
left(...) -> Function<Pair<L, R>, L>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, R> Function<Pair<L, R>, L> left() - Summary: Returns a Function that extracts the left element from a Pair.
-
Parameters:
- (none)
- Returns: a Function that extracts the left element from Pair objects
- See also: Pair#left()
right(...) -> Function<Pair<L, R>, R>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, R> Function<Pair<L, R>, R> right() - Summary: Returns a Function that extracts the right element from a Pair.
-
Parameters:
- (none)
- Returns: a Function that extracts the right element from Pair objects
- See also: Pair#right()
invert(...) -> Function<Entry<K, V>, Entry<V, K>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Function<Entry<K, V>, Entry<V, K>> invert() - Summary: Returns a Function that inverts a Map.Entry by swapping its key and value.
-
Parameters:
- (none)
- Returns: a Function that inverts Map.Entry objects
entry(...) -> BiFunction<K, V, Map.Entry<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> BiFunction<K, V, Map.Entry<K, V>> entry() - Summary: Returns a BiFunction that creates a Map.Entry from a key and value.
-
Parameters:
- (none)
- Returns: a BiFunction that creates Map.Entry objects
- See also: ImmutableEntry
-
Signature:
@Deprecated public static <K, V> Function<V, Map.Entry<K, V>> entry(final K key) - Summary: Returns a Function that creates Map.Entry objects with a fixed key.
-
Parameters:
-
key(K) — the fixed key for all created entries
-
- Returns: a Function that creates Map.Entry objects with the fixed key
- See also: #entryWithKey(Object)
-
Signature:
@Deprecated public static <K, V> Function<V, Map.Entry<K, V>> entry(final java.util.function.Function<? super V, K> keyExtractor) - Summary: Returns a Function that creates Map.Entry objects by extracting keys from values.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super V, K>) — the function to extract keys from values
-
- Returns: a Function that creates Map.Entry objects
- See also: #entryByKeyMapper(java.util.function.Function)
entryWithKey(...) -> Function<V, Map.Entry<K, V>>
-
Signature:
public static <K, V> Function<V, Map.Entry<K, V>> entryWithKey(final K key) - Summary: Returns a Function that creates Map.Entry objects with a fixed key.
-
Parameters:
-
key(K) — the fixed key for all created entries
-
- Returns: a Function that creates Map.Entry objects with the fixed key
entryByKeyMapper(...) -> Function<V, Map.Entry<K, V>>
-
Signature:
public static <K, V> Function<V, Map.Entry<K, V>> entryByKeyMapper(final java.util.function.Function<? super V, K> keyExtractor) throws IllegalArgumentException - Summary: Returns a Function that creates Map.Entry objects by extracting keys from values.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super V, K>) — the function to extract keys from values
-
- Returns: a Function that creates Map.Entry objects
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
entryWithValue(...) -> Function<K, Map.Entry<K, V>>
-
Signature:
public static <K, V> Function<K, Map.Entry<K, V>> entryWithValue(final V value) - Summary: Returns a Function that creates Map.Entry objects with a fixed value.
-
Parameters:
-
value(V) — the fixed value for all created entries
-
- Returns: a Function that creates Map.Entry objects with the fixed value
entryByValueMapper(...) -> Function<K, Map.Entry<K, V>>
-
Signature:
public static <K, V> Function<K, Map.Entry<K, V>> entryByValueMapper(final java.util.function.Function<? super K, V> valueExtractor) throws IllegalArgumentException - Summary: Returns a Function that creates Map.Entry objects by extracting values from keys.
-
Parameters:
-
valueExtractor(java.util.function.Function<? super K, V>) — the function to extract values from keys
-
- Returns: a Function that creates Map.Entry objects
-
Throws:
-
java.lang.IllegalArgumentException— if valueExtractor is null
-
pair(...) -> BiFunction<L, R, Pair<L, R>>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, R> BiFunction<L, R, Pair<L, R>> pair() - Summary: Returns a BiFunction that creates Pair objects from two elements.
-
Parameters:
- (none)
- Returns: a BiFunction that creates Pair objects
- See also: Pair#of(Object, Object)
triple(...) -> TriFunction<L, M, R, Triple<L, M, R>>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, M, R> TriFunction<L, M, R, Triple<L, M, R>> triple() - Summary: Returns a TriFunction that creates Triple objects from three elements.
-
Parameters:
- (none)
- Returns: a TriFunction that creates Triple objects
- See also: Triple#of(Object, Object, Object)
tuple1(...) -> Function<T, Tuple1<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<T, Tuple1<T>> tuple1() - Summary: Returns a Function that creates Tuple1 objects from a single element.
-
Parameters:
- (none)
- Returns: a Function that creates Tuple1 objects
- See also: Tuple1#of(Object)
tuple2(...) -> BiFunction<T, U, Tuple2<T, U>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, U> BiFunction<T, U, Tuple2<T, U>> tuple2() - Summary: Returns a BiFunction that creates Tuple2 objects from two elements.
-
Parameters:
- (none)
- Returns: a BiFunction that creates Tuple2 objects
- See also: Tuple2#of(Object, Object)
tuple3(...) -> TriFunction<A, B, C, Tuple3<A, B, C>>
-
Signature:
@SuppressWarnings("rawtypes") public static <A, B, C> TriFunction<A, B, C, Tuple3<A, B, C>> tuple3() - Summary: Returns a TriFunction that creates Tuple3 objects from three elements.
-
Parameters:
- (none)
- Returns: a TriFunction that creates Tuple3 objects
- See also: Tuple3#of(Object, Object, Object)
tuple4(...) -> QuadFunction<A, B, C, D, Tuple4<A, B, C, D>>
-
Signature:
@SuppressWarnings({ "rawtypes" }) public static <A, B, C, D> QuadFunction<A, B, C, D, Tuple4<A, B, C, D>> tuple4() - Summary: Returns a QuadFunction that creates Tuple4 objects from four elements.
-
Parameters:
- (none)
- Returns: a QuadFunction that creates Tuple4 objects
- See also: Tuple4#of(Object, Object, Object, Object)
trim(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> trim() - Summary: Returns a UnaryOperator that trims strings by removing leading and trailing whitespace.
-
Parameters:
- (none)
- Returns: a UnaryOperator that trims strings
- See also: String#trim()
trimToEmpty(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> trimToEmpty() - Summary: Returns a UnaryOperator that trims strings and converts {@code null} to empty string.
-
Parameters:
- (none)
- Returns: a UnaryOperator that trims strings to empty
- See also: Strings#trimToEmpty(String)
trimToNull(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> trimToNull() - Summary: Returns a UnaryOperator that trims strings and converts empty results to {@code null} .
-
Parameters:
- (none)
- Returns: a UnaryOperator that trims strings to null
- See also: Strings#trimToNull(String)
strip(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> strip() - Summary: Returns a UnaryOperator that strips strings by removing leading and trailing whitespace.
-
Parameters:
- (none)
- Returns: a UnaryOperator that strips strings
- See also: Strings#strip(String)
stripToEmpty(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> stripToEmpty() - Summary: Returns a UnaryOperator that strips strings and converts {@code null} to empty string.
-
Parameters:
- (none)
- Returns: a UnaryOperator that strips strings to empty
- See also: Strings#stripToEmpty(String)
stripToNull(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> stripToNull() - Summary: Returns a UnaryOperator that strips strings and converts empty results to {@code null} .
-
Parameters:
- (none)
- Returns: a UnaryOperator that strips strings to null
- See also: Strings#stripToNull(String)
nullToEmpty(...) -> UnaryOperator<String>
-
Signature:
public static UnaryOperator<String> nullToEmpty() - Summary: Returns a UnaryOperator that converts {@code null} strings to empty strings.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts {@code null} to empty string
- See also: Strings#nullToEmpty(String)
nullToEmptyList(...) -> UnaryOperator<List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> UnaryOperator<List<T>> nullToEmptyList() - Summary: Returns a UnaryOperator that converts {@code null} Lists to empty Lists.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts {@code null} to empty List
- See also: N#emptyList()
nullToEmptySet(...) -> UnaryOperator<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> UnaryOperator<Set<T>> nullToEmptySet() - Summary: Returns a UnaryOperator that converts {@code null} Sets to empty Sets.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts {@code null} to empty Set
- See also: N#emptySet()
nullToEmptyMap(...) -> UnaryOperator<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> UnaryOperator<Map<K, V>> nullToEmptyMap() - Summary: Returns a UnaryOperator that converts {@code null} Maps to empty Maps.
-
Parameters:
- (none)
- Returns: a UnaryOperator that converts {@code null} to empty Map
- See also: N#emptyMap()
len(...) -> Function<T\[\], Integer>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<T[], Integer> len() - Summary: Returns a Function that calculates the length of an array.
-
Parameters:
- (none)
- Returns: a Function that returns array length
length(...) -> Function<T, Integer>
-
Signature:
public static <T extends CharSequence> Function<T, Integer> length() - Summary: Returns a Function that calculates the length of a CharSequence.
-
Parameters:
- (none)
- Returns: a Function that returns CharSequence length
- See also: CharSequence#length()
size(...) -> Function<T, Integer>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Collection> Function<T, Integer> size() - Summary: Returns a Function that calculates the size of a Collection.
-
Parameters:
- (none)
- Returns: a Function that returns Collection size
- See also: Collection#size()
sizeM(...) -> Function<T, Integer>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Map> Function<T, Integer> sizeM() - Summary: Returns a Function that calculates the size of a Map.
-
Parameters:
- (none)
- Returns: a Function that returns Map size
- See also: Map#size()
cast(...) -> Function<T, U>
-
Signature:
public static <T, U> Function<T, U> cast(final Class<U> clazz) throws IllegalArgumentException - Summary: Returns a Function that casts objects to the specified class.
-
Contract:
- This performs an unchecked cast and should be used with caution.
-
Parameters:
-
clazz(Class<U>) — the class to cast to
-
- Returns: a Function that performs type casting
-
Throws:
-
java.lang.IllegalArgumentException— if clazz is null
-
- See also: Class#cast(Object)
alwaysTrue(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> alwaysTrue() - Summary: Returns a Predicate that always evaluates to {@code true} .
-
Parameters:
- (none)
- Returns: a Predicate that always returns true
alwaysFalse(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> alwaysFalse() - Summary: Returns a Predicate that always evaluates to {@code false} .
-
Parameters:
- (none)
- Returns: a Predicate that always returns false
isNull(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> isNull() - Summary: Returns a Predicate that tests if the input is {@code null} .
-
Contract:
- Returns a Predicate that tests if the input is {@code null} .
-
Parameters:
- (none)
- Returns: a Predicate that tests for null
-
Signature:
public static <T> Predicate<T> isNull(final java.util.function.Function<T, ?> valueExtractor) - Summary: Returns a Predicate that tests if a value extracted by the valueExtractor is {@code null} .
-
Contract:
- Returns a Predicate that tests if a value extracted by the valueExtractor is {@code null} .
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ?>) — the function to extract the value to test
-
- Returns: a Predicate that tests if the extracted value is null
isEmpty(...) -> Predicate<T>
-
Signature:
public static <T extends CharSequence> Predicate<T> isEmpty() - Summary: Returns a Predicate that tests if a CharSequence is {@code null} or empty.
-
Contract:
- Returns a Predicate that tests if a CharSequence is {@code null} or empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests for {@code null} or empty
- See also: Strings#isEmpty(CharSequence)
-
Signature:
public static <T> Predicate<T> isEmpty(final java.util.function.Function<T, ? extends CharSequence> valueExtractor) - Summary: Returns a Predicate that tests if a CharSequence extracted by valueExtractor is empty.
-
Contract:
- Returns a Predicate that tests if a CharSequence extracted by valueExtractor is empty.
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ? extends CharSequence>) — the function to extract the CharSequence to test
-
- Returns: a Predicate that tests if the extracted value is empty
isBlank(...) -> Predicate<T>
-
Signature:
public static <T extends CharSequence> Predicate<T> isBlank() - Summary: Returns a Predicate that tests if a CharSequence is {@code null} , empty, or contains only whitespace.
-
Contract:
- Returns a Predicate that tests if a CharSequence is {@code null} , empty, or contains only whitespace.
-
Parameters:
- (none)
- Returns: a Predicate that tests for {@code null} , empty, or blank
- See also: Strings#isBlank(CharSequence)
-
Signature:
public static <T> Predicate<T> isBlank(final java.util.function.Function<T, ? extends CharSequence> valueExtractor) - Summary: Returns a Predicate that tests if a CharSequence extracted by valueExtractor is blank.
-
Contract:
- Returns a Predicate that tests if a CharSequence extracted by valueExtractor is blank.
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ? extends CharSequence>) — the function to extract the CharSequence to test
-
- Returns: a Predicate that tests if the extracted value is blank
isEmptyA(...) -> Predicate<T\[\]>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> Predicate<T[]> isEmptyA() - Summary: Returns a Predicate that tests if an array is {@code null} or empty.
-
Contract:
- Returns a Predicate that tests if an array is {@code null} or empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if arrays are empty
isEmptyC(...) -> Predicate<T>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Collection> Predicate<T> isEmptyC() - Summary: Returns a Predicate that tests if a Collection is {@code null} or empty.
-
Contract:
- Returns a Predicate that tests if a Collection is {@code null} or empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Collections are empty
isEmptyM(...) -> Predicate<T>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Map> Predicate<T> isEmptyM() - Summary: Returns a Predicate that tests if a Map is {@code null} or empty.
-
Contract:
- Returns a Predicate that tests if a Map is {@code null} or empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Maps are empty
notNull(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> notNull() - Summary: Returns a Predicate that tests if the input is not {@code null} .
-
Contract:
- Returns a Predicate that tests if the input is not {@code null} .
-
Parameters:
- (none)
- Returns: a Predicate that tests for non-null
-
Signature:
public static <T> Predicate<T> notNull(final java.util.function.Function<T, ?> valueExtractor) - Summary: Returns a Predicate that tests if a value extracted by the valueExtractor is not {@code null} .
-
Contract:
- Returns a Predicate that tests if a value extracted by the valueExtractor is not {@code null} .
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ?>) — the function to extract the value to test
-
- Returns: a Predicate that tests if the extracted value is not null
notEmpty(...) -> Predicate<T>
-
Signature:
public static <T extends CharSequence> Predicate<T> notEmpty() - Summary: Returns a Predicate that tests if a CharSequence is not {@code null} and not empty.
-
Contract:
- Returns a Predicate that tests if a CharSequence is not {@code null} and not empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests for non-empty
- See also: Strings#isNotEmpty(CharSequence)
-
Signature:
public static <T> Predicate<T> notEmpty(final java.util.function.Function<T, ? extends CharSequence> valueExtractor) - Summary: Returns a Predicate that tests if a CharSequence extracted by valueExtractor is not empty.
-
Contract:
- Returns a Predicate that tests if a CharSequence extracted by valueExtractor is not empty.
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ? extends CharSequence>) — the function to extract the CharSequence to test
-
- Returns: a Predicate that tests if the extracted value is not empty
notBlank(...) -> Predicate<T>
-
Signature:
public static <T extends CharSequence> Predicate<T> notBlank() - Summary: Returns a Predicate that tests if a CharSequence is not {@code null} , not empty, and not blank.
-
Contract:
- Returns a Predicate that tests if a CharSequence is not {@code null} , not empty, and not blank.
-
Parameters:
- (none)
- Returns: a Predicate that tests for non-blank
- See also: Strings#isNotBlank(CharSequence)
-
Signature:
public static <T> Predicate<T> notBlank(final java.util.function.Function<T, ? extends CharSequence> valueExtractor) - Summary: Returns a Predicate that tests if a CharSequence extracted by valueExtractor is not blank.
-
Contract:
- Returns a Predicate that tests if a CharSequence extracted by valueExtractor is not blank.
-
Parameters:
-
valueExtractor(java.util.function.Function<T, ? extends CharSequence>) — the function to extract the CharSequence to test
-
- Returns: a Predicate that tests if the extracted value is not blank
notEmptyA(...) -> Predicate<T\[\]>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> Predicate<T[]> notEmptyA() - Summary: Returns a Predicate that tests if an array is not {@code null} and not empty.
-
Contract:
- Returns a Predicate that tests if an array is not {@code null} and not empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if arrays are not empty
notEmptyC(...) -> Predicate<T>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Collection> Predicate<T> notEmptyC() - Summary: Returns a Predicate that tests if a Collection is not {@code null} and not empty.
-
Contract:
- Returns a Predicate that tests if a Collection is not {@code null} and not empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Collections are not empty
notEmptyM(...) -> Predicate<T>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Map> Predicate<T> notEmptyM() - Summary: Returns a Predicate that tests if a Map is not {@code null} and not empty.
-
Contract:
- Returns a Predicate that tests if a Map is not {@code null} and not empty.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Maps are not empty
isFile(...) -> Predicate<File>
-
Signature:
public static Predicate<File> isFile() - Summary: Returns a Predicate that tests if a File is a regular file.
-
Contract:
- Returns a Predicate that tests if a File is a regular file.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Files are regular files
- See also: File#isFile()
isDirectory(...) -> Predicate<File>
-
Signature:
public static Predicate<File> isDirectory() - Summary: Returns a Predicate that tests if a File is a directory.
-
Contract:
- Returns a Predicate that tests if a File is a directory.
-
Parameters:
- (none)
- Returns: a Predicate that tests if Files are directories
- See also: File#isDirectory()
equal(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> equal(final Object target) - Summary: Returns a Predicate that tests if the input equals the target value.
-
Contract:
- Returns a Predicate that tests if the input equals the target value.
-
Parameters:
-
target(Object) — the value to compare against
-
- Returns: a Predicate that tests for equality with target
- See also: N#equals(Object, Object)
-
Signature:
public static <T, U> BiPredicate<T, U> equal() - Summary: Returns a BiPredicate that tests if two objects are equal using N.equals().
-
Contract:
- Returns a BiPredicate that tests if two objects are equal using N.equals().
-
Parameters:
- (none)
- Returns: a BiPredicate that tests for equality
- See also: N#equals(Object, Object)
eqOr(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> eqOr(final Object targetValue1, final Object targetValue2) - Summary: Returns a Predicate that tests if the input equals either of two target values.
-
Contract:
- Returns a Predicate that tests if the input equals either of two target values.
-
Parameters:
-
targetValue1(Object) — the first value to compare against -
targetValue2(Object) — the second value to compare against
-
- Returns: a Predicate that tests for equality with either target
-
Signature:
public static <T> Predicate<T> eqOr(final Object targetValue1, final Object targetValue2, final Object targetValue3) - Summary: Returns a Predicate that tests if the input equals any of three target values.
-
Contract:
- Returns a Predicate that tests if the input equals any of three target values.
-
Parameters:
-
targetValue1(Object) — the first value to compare against -
targetValue2(Object) — the second value to compare against -
targetValue3(Object) — the third value to compare against
-
- Returns: a Predicate that tests for equality with any target
notEqual(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> notEqual(final Object target) - Summary: Returns a Predicate that tests if the input does not equal the target value.
-
Contract:
- Returns a Predicate that tests if the input does not equal the target value.
-
Parameters:
-
target(Object) — the value to compare against
-
- Returns: a Predicate that tests for inequality with target
- See also: N#equals(Object, Object)
-
Signature:
public static <T, U> BiPredicate<T, U> notEqual() - Summary: Returns a BiPredicate that tests if two objects are not equal using N.equals().
-
Contract:
- Returns a BiPredicate that tests if two objects are not equal using N.equals().
-
Parameters:
- (none)
- Returns: a BiPredicate that tests for inequality
- See also: N#equals(Object, Object)
greaterThan(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> greaterThan(final T target) - Summary: Returns a Predicate that tests if a Comparable is greater than the target value.
-
Contract:
- Returns a Predicate that tests if a Comparable is greater than the target value.
-
Parameters:
-
target(T) — the value to compare against
-
- Returns: a Predicate that tests if input > target
- See also: N#compare(Comparable, Comparable)
-
Signature:
public static <T extends Comparable<? super T>> BiPredicate<T, T> greaterThan() - Summary: Returns a BiPredicate that tests if the first Comparable is greater than the second.
-
Contract:
- Returns a BiPredicate that tests if the first Comparable is greater than the second.
-
Parameters:
- (none)
- Returns: a BiPredicate that tests if first > second
- See also: N#compare(Comparable, Comparable)
greaterEqual(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> greaterEqual(final T target) - Summary: Returns a Predicate that tests if a Comparable is greater than or equal to the target value.
-
Contract:
- Returns a Predicate that tests if a Comparable is greater than or equal to the target value.
-
Parameters:
-
target(T) — the value to compare against
-
- Returns: a Predicate that tests if input > = target
- See also: N#compare(Comparable, Comparable)
-
Signature:
public static <T extends Comparable<? super T>> BiPredicate<T, T> greaterEqual() - Summary: Returns a BiPredicate that tests if the first Comparable is greater than or equal to the second.
-
Contract:
- Returns a BiPredicate that tests if the first Comparable is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a BiPredicate that tests if first > = second
- See also: N#compare(Comparable, Comparable)
lessThan(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> lessThan(final T target) - Summary: Returns a Predicate that tests if a Comparable is less than the target value.
-
Contract:
- Returns a Predicate that tests if a Comparable is less than the target value.
-
Parameters:
-
target(T) — the value to compare against
-
- Returns: a Predicate that tests if input < target
- See also: N#compare(Comparable, Comparable)
-
Signature:
public static <T extends Comparable<? super T>> BiPredicate<T, T> lessThan() - Summary: Returns a BiPredicate that tests if the first Comparable is less than the second.
-
Contract:
- Returns a BiPredicate that tests if the first Comparable is less than the second.
-
Parameters:
- (none)
- Returns: a BiPredicate that tests if first < second
- See also: N#compare(Comparable, Comparable)
lessEqual(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> lessEqual(final T target) - Summary: Returns a Predicate that tests if a Comparable is less than or equal to the target value.
-
Contract:
- Returns a Predicate that tests if a Comparable is less than or equal to the target value.
-
Parameters:
-
target(T) — the value to compare against
-
- Returns: a Predicate that tests if input < = target
- See also: N#compare(Comparable, Comparable)
-
Signature:
public static <T extends Comparable<? super T>> BiPredicate<T, T> lessEqual() - Summary: Returns a BiPredicate that tests if the first Comparable is less than or equal to the second.
-
Contract:
- Returns a BiPredicate that tests if the first Comparable is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a BiPredicate that tests if first < = second
- See also: N#compare(Comparable, Comparable)
gtAndLt(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> gtAndLt(final T minValue, final T maxValue) - Summary: Returns a Predicate that tests if a value is strictly between two bounds.
-
Contract:
- Returns a Predicate that tests if a value is strictly between two bounds.
-
Parameters:
-
minValue(T) — the lower bound (exclusive) -
maxValue(T) — the upper bound (exclusive)
-
- Returns: a Predicate that tests if minValue < input < maxValue
- See also: N#compare(Comparable, Comparable)
geAndLt(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> geAndLt(final T minValue, final T maxValue) - Summary: Returns a Predicate that tests if a value is between two bounds (inclusive lower).
-
Contract:
- Returns a Predicate that tests if a value is between two bounds (inclusive lower).
-
Parameters:
-
minValue(T) — the lower bound (inclusive) -
maxValue(T) — the upper bound (exclusive)
-
- Returns: a Predicate that tests if minValue < = input < maxValue
- See also: N#compare(Comparable, Comparable)
geAndLe(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> geAndLe(final T minValue, final T maxValue) - Summary: Returns a Predicate that tests if a value is between two bounds (both inclusive).
-
Contract:
- Returns a Predicate that tests if a value is between two bounds (both inclusive).
-
Parameters:
-
minValue(T) — the lower bound (inclusive) -
maxValue(T) — the upper bound (inclusive)
-
- Returns: a Predicate that tests if minValue < = input < = maxValue
- See also: N#compare(Comparable, Comparable)
gtAndLe(...) -> Predicate<T>
-
Signature:
public static <T extends Comparable<? super T>> Predicate<T> gtAndLe(final T minValue, final T maxValue) - Summary: Returns a Predicate that tests if a value is between two bounds (inclusive upper).
-
Contract:
- Returns a Predicate that tests if a value is between two bounds (inclusive upper).
-
Parameters:
-
minValue(T) — the lower bound (exclusive) -
maxValue(T) — the upper bound (inclusive)
-
- Returns: a Predicate that tests if minValue < input < = maxValue
- See also: N#compare(Comparable, Comparable)
between(...) -> Predicate<T>
-
Signature:
@Deprecated public static <T extends Comparable<? super T>> Predicate<T> between(final T minValue, final T maxValue) - Summary: Returns a Predicate that tests if a value is strictly between two bounds.
-
Contract:
- Returns a Predicate that tests if a value is strictly between two bounds.
-
Parameters:
-
minValue(T) — the lower bound (exclusive) -
maxValue(T) — the upper bound (exclusive)
-
- Returns: a Predicate that tests if minValue < input < maxValue
- See also: #gtAndLt(Comparable, Comparable)
in(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> in(final Collection<?> c) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a value is contained in the specified collection.
-
Contract:
- Returns a Predicate that tests if a value is contained in the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection to check membership in
-
- Returns: a Predicate that tests for collection membership
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
- See also: Collection#contains(Object)
notIn(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> notIn(final Collection<?> c) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a value is not contained in the specified collection.
-
Contract:
- Returns a Predicate that tests if a value is not contained in the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection to check membership in
-
- Returns: a Predicate that tests for non-membership in a collection
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
- See also: Collection#contains(Object)
instanceOf(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> instanceOf(final Class<?> clazz) throws IllegalArgumentException - Summary: Returns a Predicate that tests if an object is an instance of the specified class.
-
Contract:
- Returns a Predicate that tests if an object is an instance of the specified class.
-
Parameters:
-
clazz(Class<?>) — the class to test instance membership
-
- Returns: a Predicate that tests if objects are instances of clazz
-
Throws:
-
java.lang.IllegalArgumentException— if clazz is null
-
- See also: Class#isInstance(Object)
subtypeOf(...) -> Predicate<Class<?>>
-
Signature:
public static Predicate<Class<?>> subtypeOf(final Class<?> clazz) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a Class is a subtype of the specified class.
-
Contract:
- Returns a Predicate that tests if a Class is a subtype of the specified class.
-
Parameters:
-
clazz(Class<?>) — the superclass to test against
-
- Returns: a Predicate that tests if classes are subtypes of clazz
-
Throws:
-
java.lang.IllegalArgumentException— if clazz is null
-
- See also: Class#isAssignableFrom(Class)
startsWith(...) -> Predicate<String>
-
Signature:
public static Predicate<String> startsWith(final String prefix) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String starts with the specified prefix.
-
Contract:
- Returns a Predicate that tests if a String starts with the specified prefix.
-
Parameters:
-
prefix(String) — the prefix to test for
-
- Returns: a Predicate that tests if strings start with prefix
-
Throws:
-
java.lang.IllegalArgumentException— if prefix is null
-
- See also: String#startsWith(String)
endsWith(...) -> Predicate<String>
-
Signature:
public static Predicate<String> endsWith(final String suffix) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String ends with the specified suffix.
-
Contract:
- Returns a Predicate that tests if a String ends with the specified suffix.
-
Parameters:
-
suffix(String) — the suffix to test for
-
- Returns: a Predicate that tests if strings end with suffix
-
Throws:
-
java.lang.IllegalArgumentException— if suffix is null
-
- See also: String#endsWith(String)
contains(...) -> Predicate<String>
-
Signature:
public static Predicate<String> contains(final String valueToFind) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String contains the specified substring.
-
Contract:
- Returns a Predicate that tests if a String contains the specified substring.
-
Parameters:
-
valueToFind(String) — the substring to search for
-
- Returns: a Predicate that tests if strings contain the substring
-
Throws:
-
java.lang.IllegalArgumentException— if valueToFind is null
-
- See also: String#contains(CharSequence)
notStartsWith(...) -> Predicate<String>
-
Signature:
public static Predicate<String> notStartsWith(final String prefix) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String does not start with the specified prefix.
-
Contract:
- Returns a Predicate that tests if a String does not start with the specified prefix.
-
Parameters:
-
prefix(String) — the prefix to test against
-
- Returns: a Predicate that tests if strings don't start with prefix
-
Throws:
-
java.lang.IllegalArgumentException— if prefix is null
-
- See also: String#startsWith(String)
notEndsWith(...) -> Predicate<String>
-
Signature:
public static Predicate<String> notEndsWith(final String suffix) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String does not end with the specified suffix.
-
Contract:
- Returns a Predicate that tests if a String does not end with the specified suffix.
-
Parameters:
-
suffix(String) — the suffix to test against
-
- Returns: a Predicate that tests if strings don't end with suffix
-
Throws:
-
java.lang.IllegalArgumentException— if suffix is null
-
- See also: String#endsWith(String)
notContains(...) -> Predicate<String>
-
Signature:
public static Predicate<String> notContains(final String str) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a String does not contain the specified substring.
-
Contract:
- Returns a Predicate that tests if a String does not contain the specified substring.
-
Parameters:
-
str(String) — the substring to test against
-
- Returns: a Predicate that tests if strings don't contain the substring
-
Throws:
-
java.lang.IllegalArgumentException— if str is null
-
- See also: String#contains(CharSequence)
matches(...) -> Predicate<CharSequence>
-
Signature:
public static Predicate<CharSequence> matches(final Pattern pattern) throws IllegalArgumentException - Summary: Returns a Predicate that tests if a CharSequence matches the specified Pattern.
-
Contract:
- Returns a Predicate that tests if a CharSequence matches the specified Pattern.
-
Parameters:
-
pattern(Pattern) — the Pattern to match against
-
- Returns: a Predicate that tests if CharSequences match the pattern
-
Throws:
-
java.lang.IllegalArgumentException— if pattern is null
-
- See also: Pattern#matcher(CharSequence), Matcher#find()
not(...) -> Predicate<T>
-
Signature:
public static <T> Predicate<T> not(final java.util.function.Predicate<T> predicate) throws IllegalArgumentException - Summary: Returns a Predicate that negates the result of the specified predicate.
-
Parameters:
-
predicate(java.util.function.Predicate<T>) — the predicate to negate
-
- Returns: a Predicate that returns the opposite of the input predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
-
Signature:
public static <T, U> BiPredicate<T, U> not(final java.util.function.BiPredicate<T, U> biPredicate) throws IllegalArgumentException - Summary: Returns a BiPredicate that negates the result of the specified bi-predicate.
-
Parameters:
-
biPredicate(java.util.function.BiPredicate<T, U>) — the bi-predicate to negate
-
- Returns: a BiPredicate that returns the opposite of the input bi-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if biPredicate is null
-
-
Signature:
public static <A, B, C> TriPredicate<A, B, C> not(final TriPredicate<A, B, C> triPredicate) throws IllegalArgumentException - Summary: Returns a TriPredicate that negates the result of the specified tri-predicate.
-
Parameters:
-
triPredicate(TriPredicate<A, B, C>) — the tri-predicate to negate
-
- Returns: a TriPredicate that returns the opposite of the input tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
and(...) -> BooleanSupplier
-
Signature:
public static BooleanSupplier and(final java.util.function.BooleanSupplier first, final java.util.function.BooleanSupplier second) throws IllegalArgumentException - Summary: Returns a BooleanSupplier that performs logical AND on two boolean suppliers.
-
Parameters:
-
first(java.util.function.BooleanSupplier) — the first boolean supplier -
second(java.util.function.BooleanSupplier) — the second boolean supplier
-
- Returns: a BooleanSupplier that returns first AND second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static BooleanSupplier and(final java.util.function.BooleanSupplier first, final java.util.function.BooleanSupplier second, final java.util.function.BooleanSupplier third) throws IllegalArgumentException - Summary: Returns a BooleanSupplier that performs logical AND on three boolean suppliers.
-
Parameters:
-
first(java.util.function.BooleanSupplier) — the first boolean supplier -
second(java.util.function.BooleanSupplier) — the second boolean supplier -
third(java.util.function.BooleanSupplier) — the third boolean supplier
-
- Returns: a BooleanSupplier that returns first AND second AND third
-
Throws:
-
java.lang.IllegalArgumentException— if any supplier is null
-
-
Signature:
public static <T> Predicate<T> and(final java.util.function.Predicate<? super T> first, final java.util.function.Predicate<? super T> second) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical AND on two predicates.
-
Parameters:
-
first(java.util.function.Predicate<? super T>) — the first predicate -
second(java.util.function.Predicate<? super T>) — the second predicate
-
- Returns: a Predicate that returns first AND second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static <T> Predicate<T> and(final java.util.function.Predicate<? super T> first, final java.util.function.Predicate<? super T> second, final java.util.function.Predicate<? super T> third) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical AND on three predicates.
-
Parameters:
-
first(java.util.function.Predicate<? super T>) — the first predicate -
second(java.util.function.Predicate<? super T>) — the second predicate -
third(java.util.function.Predicate<? super T>) — the third predicate
-
- Returns: a Predicate that returns first AND second AND third
-
Throws:
-
java.lang.IllegalArgumentException— if any predicate is null
-
-
Signature:
public static <T> Predicate<T> and(final Collection<? extends java.util.function.Predicate<? super T>> c) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical AND on all predicates in the collection.
-
Parameters:
-
c(Collection<? extends java.util.function.Predicate<? super T>>) — the collection of predicates
-
- Returns: a Predicate that returns {@code true} only if all predicates return true
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or empty
-
-
Signature:
public static <T, U> BiPredicate<T, U> and(final java.util.function.BiPredicate<? super T, ? super U> first, final java.util.function.BiPredicate<? super T, ? super U> second) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical AND on two bi-predicates.
-
Parameters:
-
first(java.util.function.BiPredicate<? super T, ? super U>) — the first bi-predicate -
second(java.util.function.BiPredicate<? super T, ? super U>) — the second bi-predicate
-
- Returns: a BiPredicate that returns first AND second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static <T, U> BiPredicate<T, U> and(final java.util.function.BiPredicate<? super T, ? super U> first, final java.util.function.BiPredicate<? super T, ? super U> second, final java.util.function.BiPredicate<? super T, ? super U> third) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical AND on three bi-predicates.
-
Parameters:
-
first(java.util.function.BiPredicate<? super T, ? super U>) — the first bi-predicate -
second(java.util.function.BiPredicate<? super T, ? super U>) — the second bi-predicate -
third(java.util.function.BiPredicate<? super T, ? super U>) — the third bi-predicate
-
- Returns: a BiPredicate that returns first AND second AND third
-
Throws:
-
java.lang.IllegalArgumentException— if any bi-predicate is null
-
-
Signature:
public static <T, U> BiPredicate<T, U> and(final List<? extends java.util.function.BiPredicate<? super T, ? super U>> c) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical AND on all bi-predicates in the list.
-
Parameters:
-
c(List<? extends java.util.function.BiPredicate<? super T, ? super U>>) — the list of bi-predicates
-
- Returns: a BiPredicate that returns {@code true} only if all bi-predicates return true
-
Throws:
-
java.lang.IllegalArgumentException— if the list is {@code null} or empty
-
or(...) -> BooleanSupplier
-
Signature:
public static BooleanSupplier or(final java.util.function.BooleanSupplier first, final java.util.function.BooleanSupplier second) throws IllegalArgumentException - Summary: Returns a BooleanSupplier that performs logical OR on two boolean suppliers.
-
Parameters:
-
first(java.util.function.BooleanSupplier) — the first boolean supplier -
second(java.util.function.BooleanSupplier) — the second boolean supplier
-
- Returns: a BooleanSupplier that returns first OR second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static BooleanSupplier or(final java.util.function.BooleanSupplier first, final java.util.function.BooleanSupplier second, final java.util.function.BooleanSupplier third) throws IllegalArgumentException - Summary: Returns a BooleanSupplier that performs logical OR on three boolean suppliers.
-
Parameters:
-
first(java.util.function.BooleanSupplier) — the first boolean supplier -
second(java.util.function.BooleanSupplier) — the second boolean supplier -
third(java.util.function.BooleanSupplier) — the third boolean supplier
-
- Returns: a BooleanSupplier that returns first OR second OR third
-
Throws:
-
java.lang.IllegalArgumentException— if any supplier is null
-
-
Signature:
public static <T> Predicate<T> or(final java.util.function.Predicate<? super T> first, final java.util.function.Predicate<? super T> second) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical OR on two predicates.
-
Parameters:
-
first(java.util.function.Predicate<? super T>) — the first predicate -
second(java.util.function.Predicate<? super T>) — the second predicate
-
- Returns: a Predicate that returns first OR second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static <T> Predicate<T> or(final java.util.function.Predicate<? super T> first, final java.util.function.Predicate<? super T> second, final java.util.function.Predicate<? super T> third) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical OR on three predicates.
-
Parameters:
-
first(java.util.function.Predicate<? super T>) — the first predicate -
second(java.util.function.Predicate<? super T>) — the second predicate -
third(java.util.function.Predicate<? super T>) — the third predicate
-
- Returns: a Predicate that returns first OR second OR third
-
Throws:
-
java.lang.IllegalArgumentException— if any predicate is null
-
-
Signature:
public static <T> Predicate<T> or(final Collection<? extends java.util.function.Predicate<? super T>> c) throws IllegalArgumentException - Summary: Returns a Predicate that performs logical OR on all predicates in the collection.
-
Parameters:
-
c(Collection<? extends java.util.function.Predicate<? super T>>) — the collection of predicates
-
- Returns: a Predicate that returns {@code true} if any predicate returns true
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or empty
-
-
Signature:
public static <T, U> BiPredicate<T, U> or(final java.util.function.BiPredicate<? super T, ? super U> first, final java.util.function.BiPredicate<? super T, ? super U> second) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical OR on two bi-predicates.
-
Parameters:
-
first(java.util.function.BiPredicate<? super T, ? super U>) — the first bi-predicate -
second(java.util.function.BiPredicate<? super T, ? super U>) — the second bi-predicate
-
- Returns: a BiPredicate that returns first OR second
-
Throws:
-
java.lang.IllegalArgumentException— if first or second is null
-
-
Signature:
public static <T, U> BiPredicate<T, U> or(final java.util.function.BiPredicate<? super T, ? super U> first, final java.util.function.BiPredicate<? super T, ? super U> second, final java.util.function.BiPredicate<? super T, ? super U> third) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical OR on three bi-predicates.
-
Parameters:
-
first(java.util.function.BiPredicate<? super T, ? super U>) — the first bi-predicate -
second(java.util.function.BiPredicate<? super T, ? super U>) — the second bi-predicate -
third(java.util.function.BiPredicate<? super T, ? super U>) — the third bi-predicate
-
- Returns: a BiPredicate that returns first OR second OR third
-
Throws:
-
java.lang.IllegalArgumentException— if any bi-predicate is null
-
-
Signature:
public static <T, U> BiPredicate<T, U> or(final List<? extends java.util.function.BiPredicate<? super T, ? super U>> c) throws IllegalArgumentException - Summary: Returns a BiPredicate that performs logical OR on all bi-predicates in the list.
-
Parameters:
-
c(List<? extends java.util.function.BiPredicate<? super T, ? super U>>) — the list of bi-predicates
-
- Returns: a BiPredicate that returns {@code true} if any bi-predicate returns true
-
Throws:
-
java.lang.IllegalArgumentException— if the list is {@code null} or empty
-
testByKey(...) -> Predicate<Map.Entry<K, V>>
-
Signature:
public static <K, V> Predicate<Map.Entry<K, V>> testByKey(final java.util.function.Predicate<? super K> predicate) throws IllegalArgumentException - Summary: Returns a Predicate for Map.Entry that tests the key using the specified predicate.
-
Parameters:
-
predicate(java.util.function.Predicate<? super K>) — the predicate to apply to the key
-
- Returns: a Predicate that tests Map.Entry keys
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
testByValue(...) -> Predicate<Map.Entry<K, V>>
-
Signature:
public static <K, V> Predicate<Map.Entry<K, V>> testByValue(final java.util.function.Predicate<? super V> predicate) throws IllegalArgumentException - Summary: Returns a Predicate for Map.Entry that tests the value using the specified predicate.
-
Parameters:
-
predicate(java.util.function.Predicate<? super V>) — the predicate to apply to the value
-
- Returns: a Predicate that tests Map.Entry values
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
acceptByKey(...) -> Consumer<Map.Entry<K, V>>
-
Signature:
public static <K, V> Consumer<Map.Entry<K, V>> acceptByKey(final java.util.function.Consumer<? super K> consumer) throws IllegalArgumentException - Summary: Returns a Consumer for Map.Entry that applies the specified consumer to the key.
-
Parameters:
-
consumer(java.util.function.Consumer<? super K>) — the consumer to apply to the key
-
- Returns: a Consumer that operates on Map.Entry keys
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
acceptByValue(...) -> Consumer<Map.Entry<K, V>>
-
Signature:
public static <K, V> Consumer<Map.Entry<K, V>> acceptByValue(final java.util.function.Consumer<? super V> consumer) throws IllegalArgumentException - Summary: Returns a Consumer for Map.Entry that applies the specified consumer to the value.
-
Parameters:
-
consumer(java.util.function.Consumer<? super V>) — the consumer to apply to the value
-
- Returns: a Consumer that operates on Map.Entry values
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
applyByKey(...) -> Function<Map.Entry<K, V>, R>
-
Signature:
public static <K, V, R> Function<Map.Entry<K, V>, R> applyByKey(final java.util.function.Function<? super K, ? extends R> func) throws IllegalArgumentException - Summary: Returns a Function for Map.Entry that applies the specified function to the key.
-
Parameters:
-
func(java.util.function.Function<? super K, ? extends R>) — the function to apply to the key
-
- Returns: a Function that transforms Map.Entry keys
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
applyByValue(...) -> Function<Map.Entry<K, V>, R>
-
Signature:
public static <K, V, R> Function<Map.Entry<K, V>, R> applyByValue(final java.util.function.Function<? super V, ? extends R> func) throws IllegalArgumentException - Summary: Returns a Function for Map.Entry that applies the specified function to the value.
-
Parameters:
-
func(java.util.function.Function<? super V, ? extends R>) — the function to apply to the value
-
- Returns: a Function that transforms Map.Entry values
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
mapKey(...) -> Function<Map.Entry<K, V>, Map.Entry<KK, V>>
-
Signature:
public static <K, V, KK> Function<Map.Entry<K, V>, Map.Entry<KK, V>> mapKey(final java.util.function.Function<? super K, ? extends KK> func) throws IllegalArgumentException - Summary: Returns a Function that transforms a Map.Entry by applying a function to its key.
-
Parameters:
-
func(java.util.function.Function<? super K, ? extends KK>) — the function to transform the key
-
- Returns: a Function that creates new Map.Entry with transformed key
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
mapValue(...) -> Function<Map.Entry<K, V>, Map.Entry<K, VV>>
-
Signature:
public static <K, V, VV> Function<Map.Entry<K, V>, Map.Entry<K, VV>> mapValue(final java.util.function.Function<? super V, ? extends VV> func) throws IllegalArgumentException - Summary: Returns a Function that transforms a Map.Entry by applying a function to its value.
-
Parameters:
-
func(java.util.function.Function<? super V, ? extends VV>) — the function to transform the value
-
- Returns: a Function that creates new Map.Entry with transformed value
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
testKeyVal(...) -> Predicate<Map.Entry<K, V>>
-
Signature:
public static <K, V> Predicate<Map.Entry<K, V>> testKeyVal(final java.util.function.BiPredicate<? super K, ? super V> predicate) throws IllegalArgumentException - Summary: Returns a Predicate for Map.Entry that tests both key and value using a BiPredicate.
-
Contract:
- This is particularly useful when filtering Map entry streams where you need to test both the key and value together.
-
Parameters:
-
predicate(java.util.function.BiPredicate<? super K, ? super V>) — the bi-predicate to test key and value together (must not be null)
-
- Returns: a Predicate that tests Map.Entry by extracting and testing its key and value
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
- See also: #acceptKeyVal(java.util.function.BiConsumer), #applyKeyVal(java.util.function.BiFunction)
acceptKeyVal(...) -> Consumer<Map.Entry<K, V>>
-
Signature:
public static <K, V> Consumer<Map.Entry<K, V>> acceptKeyVal(final java.util.function.BiConsumer<? super K, ? super V> consumer) throws IllegalArgumentException - Summary: Returns a Consumer for Map.Entry that accepts both key and value using a BiConsumer.
-
Parameters:
-
consumer(java.util.function.BiConsumer<? super K, ? super V>) — the bi-consumer to accept key and value
-
- Returns: a Consumer that operates on Map.Entry key and value
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
applyKeyVal(...) -> Function<Map.Entry<K, V>, R>
-
Signature:
public static <K, V, R> Function<Map.Entry<K, V>, R> applyKeyVal(final java.util.function.BiFunction<? super K, ? super V, ? extends R> func) throws IllegalArgumentException - Summary: Returns a Function for Map.Entry that applies a BiFunction to both key and value.
-
Contract:
- This is particularly useful when transforming Map entry streams where you need to combine or process both the key and value to produce a result.
-
Parameters:
-
func(java.util.function.BiFunction<? super K, ? super V, ? extends R>) — the bi-function to apply to key and value together (must not be null)
-
- Returns: a Function that transforms Map.Entry by extracting and applying the function to its key and value
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
- See also: #testKeyVal(java.util.function.BiPredicate), #acceptKeyVal(java.util.function.BiConsumer)
acceptIfNotNull(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> acceptIfNotNull(final java.util.function.Consumer<? super T> consumer) throws IllegalArgumentException - Summary: Returns a Consumer that only accepts {@code non-null} values.
-
Contract:
- If the value is {@code null} , the consumer is not invoked.
-
Parameters:
-
consumer(java.util.function.Consumer<? super T>) — the consumer to invoke for {@code non-null} values (must not be null)
-
- Returns: a Consumer that only processes {@code non-null} values
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
- See also: #acceptIf(java.util.function.Predicate, java.util.function.Consumer)
acceptIf(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> acceptIf(final java.util.function.Predicate<? super T> predicate, final java.util.function.Consumer<? super T> consumer) throws IllegalArgumentException - Summary: Returns a Consumer that only accepts values that satisfy the predicate.
-
Parameters:
-
predicate(java.util.function.Predicate<? super T>) — the condition to test (must not be null) -
consumer(java.util.function.Consumer<? super T>) — the consumer to invoke when predicate is true (must not be null)
-
- Returns: a Consumer that conditionally processes values
-
Throws:
-
java.lang.IllegalArgumentException— if predicate or consumer is null
-
- See also: #acceptIfNotNull(java.util.function.Consumer), #acceptIfOrElse(java.util.function.Predicate, java.util.function.Consumer, java.util.function.Consumer)
acceptIfOrElse(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> acceptIfOrElse(final java.util.function.Predicate<? super T> predicate, final java.util.function.Consumer<? super T> consumerForTrue, final java.util.function.Consumer<? super T> consumerForFalse) throws IllegalArgumentException - Summary: Returns a Consumer that accepts values based on a predicate, with different consumers for true/false cases.
-
Parameters:
-
predicate(java.util.function.Predicate<? super T>) — the condition to test (must not be null) -
consumerForTrue(java.util.function.Consumer<? super T>) — the consumer to invoke when predicate is true (must not be null) -
consumerForFalse(java.util.function.Consumer<? super T>) — the consumer to invoke when predicate is false (must not be null)
-
- Returns: a Consumer that conditionally processes values
-
Throws:
-
java.lang.IllegalArgumentException— if any parameter is null
-
- See also: #acceptIf(java.util.function.Predicate, java.util.function.Consumer)
applyIfNotNullOrEmpty(...) -> Function<T, Collection<R>>
-
Signature:
@Beta public static <T, R> Function<T, Collection<R>> applyIfNotNullOrEmpty(final java.util.function.Function<T, ? extends Collection<R>> mapper) - Summary: Returns a Function that applies a mapper and returns an empty list if the input is {@code null} .
-
Contract:
- Returns a Function that applies a mapper and returns an empty list if the input is {@code null} .
- When the input is null, an empty list is returned instead of throwing a NullPointerException or returning null.
-
Parameters:
-
mapper(java.util.function.Function<T, ? extends Collection<R>>) — the function to apply to {@code non-null} inputs (must not be null)
-
- Returns: a Function that safely handles {@code null} inputs
- See also: #applyIfNotNullOrDefault(java.util.function.Function, java.util.function.Function, Object)
applyIfNotNullOrDefault(...) -> Function<A, R>
-
Signature:
public static <A, B, R> Function<A, R> applyIfNotNullOrDefault(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, ? extends R> mapperB, final R defaultValue) throws IllegalArgumentException - Summary: Returns a Function that applies two mappers in sequence, returning a default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies two mappers in sequence, returning a default value if any step produces {@code null} .
- If the input is null, or if any mapper in the chain returns null, the default value is returned instead of propagating null or throwing a NullPointerException.
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper (must not be null) -
mapperB(java.util.function.Function<B, ? extends R>) — the second mapper (must not be null) -
defaultValue(R) — the default value to return if any step is null
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if mapperA or mapperB is null
-
- See also: #applyIfNotNullOrElseGet(java.util.function.Function, java.util.function.Function, java.util.function.Supplier)
-
Signature:
public static <A, B, C, R> Function<A, R> applyIfNotNullOrDefault(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, C> mapperB, final java.util.function.Function<C, ? extends R> mapperC, final R defaultValue) throws IllegalArgumentException - Summary: Returns a Function that applies three mappers in sequence, returning a default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies three mappers in sequence, returning a default value if any step produces {@code null} .
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper -
mapperB(java.util.function.Function<B, C>) — the second mapper -
mapperC(java.util.function.Function<C, ? extends R>) — the third mapper -
defaultValue(R) — the default value to return if any step is null
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if any mapper is null
-
-
Signature:
public static <A, B, C, D, R> Function<A, R> applyIfNotNullOrDefault(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, C> mapperB, final java.util.function.Function<C, D> mapperC, final java.util.function.Function<D, ? extends R> mapperD, final R defaultValue) throws IllegalArgumentException - Summary: Returns a Function that applies four mappers in sequence, returning a default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies four mappers in sequence, returning a default value if any step produces {@code null} .
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper -
mapperB(java.util.function.Function<B, C>) — the second mapper -
mapperC(java.util.function.Function<C, D>) — the third mapper -
mapperD(java.util.function.Function<D, ? extends R>) — the fourth mapper -
defaultValue(R) — the default value to return if any step is null
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if any mapper is null
-
applyIfNotNullOrElseGet(...) -> Function<A, R>
-
Signature:
public static <A, B, R> Function<A, R> applyIfNotNullOrElseGet(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, ? extends R> mapperB, final java.util.function.Supplier<R> supplier) throws IllegalArgumentException - Summary: Returns a Function that applies two mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies two mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper -
mapperB(java.util.function.Function<B, ? extends R>) — the second mapper -
supplier(java.util.function.Supplier<R>) — the supplier for the default value
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if mapperA or mapperB is null
-
-
Signature:
public static <A, B, C, R> Function<A, R> applyIfNotNullOrElseGet(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, C> mapperB, final java.util.function.Function<C, ? extends R> mapperC, final java.util.function.Supplier<R> supplier) throws IllegalArgumentException - Summary: Returns a Function that applies three mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies three mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper -
mapperB(java.util.function.Function<B, C>) — the second mapper -
mapperC(java.util.function.Function<C, ? extends R>) — the third mapper -
supplier(java.util.function.Supplier<R>) — the supplier for the default value
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if any mapper is null
-
-
Signature:
public static <A, B, C, D, R> Function<A, R> applyIfNotNullOrElseGet(final java.util.function.Function<A, B> mapperA, final java.util.function.Function<B, C> mapperB, final java.util.function.Function<C, D> mapperC, final java.util.function.Function<D, ? extends R> mapperD, final java.util.function.Supplier<R> supplier) throws IllegalArgumentException - Summary: Returns a Function that applies four mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Contract:
- Returns a Function that applies four mappers in sequence, using a supplier for the default value if any step produces {@code null} .
-
Parameters:
-
mapperA(java.util.function.Function<A, B>) — the first mapper -
mapperB(java.util.function.Function<B, C>) — the second mapper -
mapperC(java.util.function.Function<C, D>) — the third mapper -
mapperD(java.util.function.Function<D, ? extends R>) — the fourth mapper -
supplier(java.util.function.Supplier<R>) — the supplier for the default value
-
- Returns: a Function with null-safe chaining
-
Throws:
-
java.lang.IllegalArgumentException— if any mapper is null
-
applyIfOrElseDefault(...) -> Function<T, R>
-
Signature:
@Beta public static <T, R> Function<T, R> applyIfOrElseDefault(final java.util.function.Predicate<? super T> predicate, final java.util.function.Function<? super T, ? extends R> func, final R defaultValue) throws IllegalArgumentException - Summary: Returns a Function that conditionally applies a function based on a predicate, with a default value.
-
Contract:
- If the input satisfies the predicate, the function is applied; otherwise, the default value is returned.
-
Parameters:
-
predicate(java.util.function.Predicate<? super T>) — the condition to test (must not be null) -
func(java.util.function.Function<? super T, ? extends R>) — the function to apply when predicate is true (must not be null) -
defaultValue(R) — the value to return when predicate is false
-
- Returns: a Function that conditionally applies transformation
-
Throws:
-
java.lang.IllegalArgumentException— if predicate or func is null
-
- See also: #applyIfOrElseGet(java.util.function.Predicate, java.util.function.Function, java.util.function.Supplier)
applyIfOrElseGet(...) -> Function<T, R>
-
Signature:
@Beta public static <T, R> Function<T, R> applyIfOrElseGet(final java.util.function.Predicate<? super T> predicate, final java.util.function.Function<? super T, ? extends R> func, final java.util.function.Supplier<? extends R> supplier) throws IllegalArgumentException - Summary: Returns a Function that conditionally applies a function based on a predicate, with a supplier for the else value.
-
Contract:
- If the input satisfies the predicate, the function is applied; otherwise, the supplier is invoked to provide the default value.
-
Parameters:
-
predicate(java.util.function.Predicate<? super T>) — the condition to test (must not be null) -
func(java.util.function.Function<? super T, ? extends R>) — the function to apply when predicate is true (must not be null) -
supplier(java.util.function.Supplier<? extends R>) — the supplier for the value when predicate is false (must not be null)
-
- Returns: a Function that conditionally applies transformation
-
Throws:
-
java.lang.IllegalArgumentException— if any parameter is null
-
- See also: #applyIfOrElseDefault(java.util.function.Predicate, java.util.function.Function, Object)
flatmapValue(...) -> Function<Map<K, ? extends Collection<V>>, List<Map<K, V>>>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <K, V> Function<Map<K, ? extends Collection<V>>, List<Map<K, V>>> flatmapValue() - Summary: Returns a Function that flattens a Map with Collection values into a List of Maps.
-
Parameters:
- (none)
- Returns: a Function that flattens Maps with Collection values
- See also: Maps#flatToMap(Map)
parseByte(...) -> ToByteFunction<String>
-
Signature:
public static ToByteFunction<String> parseByte() - Summary: Returns a ToByteFunction that parses Strings to byte values.
-
Parameters:
- (none)
- Returns: a ToByteFunction that parses strings to byte values
- See also: Numbers#toByte(String), #parseShort(), #parseInt()
parseShort(...) -> ToShortFunction<String>
-
Signature:
public static ToShortFunction<String> parseShort() - Summary: Returns a ToShortFunction that parses Strings to short values.
-
Parameters:
- (none)
- Returns: a ToShortFunction that parses strings to short values
- See also: Numbers#toShort(String), #parseByte(), #parseInt()
parseInt(...) -> ToIntFunction<String>
-
Signature:
public static ToIntFunction<String> parseInt() - Summary: Returns a ToIntFunction that parses Strings to int values.
-
Parameters:
- (none)
- Returns: a ToIntFunction that parses strings to int values
- See also: Numbers#toInt(String), #parseLong(), #parseDouble()
parseLong(...) -> ToLongFunction<String>
-
Signature:
public static ToLongFunction<String> parseLong() - Summary: Returns a ToLongFunction that parses Strings to long values.
-
Parameters:
- (none)
- Returns: a ToLongFunction that parses strings to long values
- See also: Numbers#toLong(String), #parseInt(), #parseDouble()
parseFloat(...) -> ToFloatFunction<String>
-
Signature:
public static ToFloatFunction<String> parseFloat() - Summary: Returns a ToFloatFunction that parses Strings to float values.
-
Parameters:
- (none)
- Returns: a ToFloatFunction that parses strings to float values
- See also: Numbers#toFloat(String), #parseDouble(), #parseInt()
parseDouble(...) -> ToDoubleFunction<String>
-
Signature:
public static ToDoubleFunction<String> parseDouble() - Summary: Returns a ToDoubleFunction that parses Strings to double values.
-
Parameters:
- (none)
- Returns: a ToDoubleFunction that parses strings to double values
- See also: Numbers#toDouble(String), #parseInt(), #parseFloat()
createNumber(...) -> Function<String, Number>
-
Signature:
public static Function<String, Number> createNumber() - Summary: Returns a Function that creates Number objects from Strings.
-
Contract:
- It's useful when the numeric type is not known in advance.
-
Parameters:
- (none)
- Returns: a Function that creates Number objects from string representations
- See also: Numbers#createNumber(String), #parseInt(), #parseLong(), #parseDouble()
numToInt(...) -> ToIntFunction<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Number> ToIntFunction<T> numToInt() - Summary: Returns a ToIntFunction that converts Number objects to int values.
-
Parameters:
- (none)
- Returns: a ToIntFunction that converts Numbers to int
- See also: Number#intValue(), #numToLong(), #numToDouble()
numToLong(...) -> ToLongFunction<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Number> ToLongFunction<T> numToLong() - Summary: Returns a ToLongFunction that converts Number objects to long values.
-
Parameters:
- (none)
- Returns: a ToLongFunction that converts Numbers to long
- See also: Number#longValue(), #numToInt(), #numToDouble()
numToDouble(...) -> ToDoubleFunction<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Number> ToDoubleFunction<T> numToDouble() - Summary: Returns a ToDoubleFunction that converts Number objects to double values.
-
Parameters:
- (none)
- Returns: a ToDoubleFunction that converts Numbers to double
- See also: Number#doubleValue(), #numToInt(), #numToLong()
atMost(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> atMost(final int count) throws IllegalArgumentException - Summary: Returns a stateful Predicate that limits the number of elements that pass through.
-
Contract:
- It's safe to use in parallel streams (uses AtomicInteger), but should not be saved or cached for reuse across multiple streams.
-
Parameters:
-
count(int) — the maximum number of elements to accept (must be non-negative)
-
- Returns: a stateful Predicate that limits elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
- See also: #limitThenFilter(int, java.util.function.Predicate), #filterThenLimit(java.util.function.Predicate, int)
limitThenFilter(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> limitThenFilter(final int limit, final java.util.function.Predicate<T> predicate) throws IllegalArgumentException - Summary: Returns a stateful {@code Predicate} that first limits the number of tests to perform, then applies the provided predicate to those limited elements.
-
Contract:
- <p> <b> Important: </b> This method tests elements in a specific order: <ol> <li> First, check if the limit has been reached (using an internal counter) </li> <li> If within limit, then apply the predicate to test the element </li> <li> Once the limit is exhausted, all subsequent elements automatically fail (return false) </li> </ol> <p> This is useful when you only want to test the first N elements of a stream, and you want to filter those N elements according to some condition.
-
Parameters:
-
limit(int) — the maximum number of elements to test (must be non-negative) -
predicate(java.util.function.Predicate<T>) — the predicate to apply to elements within the limit (must not be null)
-
- Returns: a stateful {@code Predicate} that tests at most <i> limit </i> elements using the provided predicate
-
Throws:
-
java.lang.IllegalArgumentException— if limit is negative or predicate is null
-
- See also: #filterThenLimit(java.util.function.Predicate, int)
-
Signature:
@Beta @Stateful public static <T, U> BiPredicate<T, U> limitThenFilter(final int limit, final java.util.function.BiPredicate<T, U> predicate) throws IllegalArgumentException - Summary: Returns a stateful {@code BiPredicate} .
-
Parameters:
-
limit(int) — the maximum number of element pairs that can pass the bi-predicate -
predicate(java.util.function.BiPredicate<T, U>) — the bi-predicate to test element pairs after checking the limit
-
- Returns: a stateful {@code BiPredicate} . Don't save or cache for reuse, but it can be used in parallel stream.
-
Throws:
-
java.lang.IllegalArgumentException— if limit is negative or predicate is null
-
filterThenLimit(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> filterThenLimit(final java.util.function.Predicate<T> predicate, final int limit) throws IllegalArgumentException - Summary: Returns a stateful {@code Predicate} .
-
Parameters:
-
predicate(java.util.function.Predicate<T>) — the predicate to test elements before applying the limit -
limit(int) — the maximum number of elements that pass the predicate to allow through
-
- Returns: a stateful {@code Predicate} . Don't save or cache for reuse, but it can be used in parallel stream.
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is {@code null} or limit is negative
-
-
Signature:
@Beta @Stateful public static <T, U> BiPredicate<T, U> filterThenLimit(final java.util.function.BiPredicate<T, U> predicate, final int limit) throws IllegalArgumentException - Summary: Returns a stateful {@code BiPredicate} .
-
Parameters:
-
predicate(java.util.function.BiPredicate<T, U>) — the bi-predicate to test element pairs before applying the limit -
limit(int) — the maximum number of element pairs that pass the bi-predicate to allow through
-
- Returns: a stateful {@code BiPredicate} . Don't save or cache for reuse, but it can be used in parallel stream.
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is {@code null} or limit is negative
-
timeLimit(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> timeLimit(final long timeInMillis) throws IllegalArgumentException - Summary: Returns a stateful {@code Predicate} .
-
Parameters:
-
timeInMillis(long) — the time limit in milliseconds
-
- Returns: a stateful {@code Predicate} . Don't save or cache for reuse, but it can be used in parallel stream.
-
Throws:
-
java.lang.IllegalArgumentException— if timeInMillis is negative
-
-
Signature:
@Beta @Stateful public static <T> Predicate<T> timeLimit(final Duration duration) throws IllegalArgumentException - Summary: Returns a stateful {@code Predicate} .
-
Parameters:
-
duration(Duration) — the time limit as a Duration
-
- Returns: a stateful {@code Predicate} . Don't save or cache for reuse, but it can be used in parallel stream.
-
Throws:
-
java.lang.IllegalArgumentException— if duration is null
-
indexed(...) -> Function<T, Indexed<T>>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Function<T, Indexed<T>> indexed() - Summary: Returns a stateful {@code Function} .
-
Parameters:
- (none)
- Returns: a stateful {@code Function} . Don't save or cache for reuse or use it in parallel stream.
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Predicate<T> indexed(final IntObjPredicate<T> predicate) - Summary: Returns a stateful {@code Predicate} .
-
Parameters:
-
predicate(IntObjPredicate<T>) — the predicate that tests elements along with their indices
-
- Returns: a stateful {@code Predicate} . Don't save or cache for reuse or use it in parallel stream.
selectFirst(...) -> BinaryOperator<T>
-
Signature:
public static <T> BinaryOperator<T> selectFirst() - Summary: Returns a BinaryOperator that always returns the first argument.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Keep first occurrence when collecting to a map with duplicate keys Map<String, Integer> map = Stream.of( Pair.of("a", 1), Pair.of("b", 2), Pair.of("a", 3)) .collect(Collectors.toMap(Pair::getKey, Pair::getValue, Fn.selectFirst())); // Result: {a=1, b=2} } </pre>
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the first argument
- See also: #selectSecond()
selectSecond(...) -> BinaryOperator<T>
-
Signature:
public static <T> BinaryOperator<T> selectSecond() - Summary: Returns a BinaryOperator that always returns the second argument.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Keep last occurrence when collecting to a map with duplicate keys Map<String, Integer> map = Stream.of( Pair.of("a", 1), Pair.of("b", 2), Pair.of("a", 3)) .collect(Collectors.toMap(Pair::getKey, Pair::getValue, Fn.selectSecond())); // Result: {a=3, b=2} } </pre>
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the second argument
- See also: #selectFirst()
min(...) -> BinaryOperator<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Comparable<? super T>> BinaryOperator<T> min() - Summary: Returns a BinaryOperator that finds the minimum of two Comparable values.
-
Contract:
- <p> Null values are considered greater than {@code non-null} values, so a non-null value will always be chosen over null when comparing.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the minimum value
- See also: #max(), #min(Comparator), #minBy(java.util.function.Function)
-
Signature:
public static <T> BinaryOperator<T> min(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a BinaryOperator that finds the minimum of two values using the given Comparator.
-
Contract:
- It's particularly useful when working with objects that don't implement Comparable or when you need a different ordering than the natural order.
-
Parameters:
-
comparator(Comparator<? super T>) — the Comparator to determine the minimum (must not be null)
-
- Returns: a BinaryOperator that returns the minimum value according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if comparator is null
-
- See also: #min(), #max(Comparator), #minBy(java.util.function.Function)
minBy(...) -> BinaryOperator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> BinaryOperator<T> minBy(final java.util.function.Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a BinaryOperator that finds the minimum of two values by comparing a key extracted from each.
-
Contract:
- <p> The key must be Comparable.
- This is useful when you want to find the minimum element based on a specific property.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super T, ? extends Comparable>) — the function to extract the Comparable key (must not be null)
-
- Returns: a BinaryOperator that returns the element with the minimum key
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #maxBy(java.util.function.Function), #min(Comparator)
minByKey(...) -> BinaryOperator<Map.Entry<K, V>>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K extends Comparable<? super K>, V> BinaryOperator<Map.Entry<K, V>> minByKey() - Summary: Returns a BinaryOperator for Map.Entry that finds the entry with the minimum key.
-
Contract:
- <p> Keys must be Comparable.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the entry with the minimum key
minByValue(...) -> BinaryOperator<Map.Entry<K, V>>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V extends Comparable<? super V>> BinaryOperator<Map.Entry<K, V>> minByValue() - Summary: Returns a BinaryOperator for Map.Entry that finds the entry with the minimum value.
-
Contract:
- <p> Values must be Comparable.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the entry with the minimum value
max(...) -> BinaryOperator<T>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Comparable<? super T>> BinaryOperator<T> max() - Summary: Returns a BinaryOperator that finds the maximum of two Comparable values.
-
Contract:
- <p> Null values are considered less than {@code non-null} values, so a non-null value will always be chosen over null when comparing.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the maximum value
- See also: #min(), #max(Comparator), #maxBy(java.util.function.Function)
-
Signature:
public static <T> BinaryOperator<T> max(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a BinaryOperator that finds the maximum of two values using the given Comparator.
-
Parameters:
-
comparator(Comparator<? super T>) — the Comparator to determine the maximum
-
- Returns: a BinaryOperator that returns the maximum value according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if comparator is null
-
maxBy(...) -> BinaryOperator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> BinaryOperator<T> maxBy(final java.util.function.Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a BinaryOperator that finds the maximum of two values by comparing a key extracted from each.
-
Contract:
- <p> The key must be Comparable.
- This is useful when you want to find the maximum element based on a specific property.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super T, ? extends Comparable>) — the function to extract the Comparable key (must not be null)
-
- Returns: a BinaryOperator that returns the element with the maximum key
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: #minBy(java.util.function.Function), #max(Comparator)
maxByKey(...) -> BinaryOperator<Map.Entry<K, V>>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K extends Comparable<? super K>, V> BinaryOperator<Map.Entry<K, V>> maxByKey() - Summary: Returns a BinaryOperator for Map.Entry that finds the entry with the maximum key.
-
Contract:
- <p> Keys must be Comparable.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the entry with the maximum key
maxByValue(...) -> BinaryOperator<Map.Entry<K, V>>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V extends Comparable<? super V>> BinaryOperator<Map.Entry<K, V>> maxByValue() - Summary: Returns a BinaryOperator for Map.Entry that finds the entry with the maximum value.
-
Contract:
- <p> Values must be Comparable.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the entry with the maximum value
compareTo(...) -> Function<T, Integer>
-
Signature:
public static <T extends Comparable<? super T>> Function<T, Integer> compareTo(final T target) - Summary: Returns a Function that compares its input to the target value.
-
Parameters:
-
target(T) — the value to compare against
-
- Returns: a Function that compares its input to the target
- See also: #compareTo(Object, Comparator), #compare()
-
Signature:
public static <T> Function<T, Integer> compareTo(final T target, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a Function that compares its input to the target value using the specified Comparator.
-
Parameters:
-
target(T) — the value to compare against -
cmp(Comparator<? super T>) — the Comparator to use (uses natural order if null)
-
- Returns: a Function that compares its input to the target using the comparator
-
Throws:
-
java.lang.IllegalArgumentException
-
compare(...) -> BiFunction<T, T, Integer>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable<? super T>> BiFunction<T, T, Integer> compare() - Summary: Returns a BiFunction that compares two Comparable values.
-
Parameters:
- (none)
- Returns: a BiFunction that compares two values
-
Signature:
public static <T> BiFunction<T, T, Integer> compare(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a BiFunction that compares two values using the specified Comparator.
-
Parameters:
-
cmp(Comparator<? super T>) — the Comparator to use (uses natural order if null)
-
- Returns: a BiFunction that compares two values using the comparator
-
Throws:
-
java.lang.IllegalArgumentException
-
futureGetOrDefaultOnError(...) -> Function<Future<T>, T>
-
Signature:
@Beta public static <T> Function<Future<T>, T> futureGetOrDefaultOnError(final T defaultValue) - Summary: Returns a Function that gets the result from a Future, returning the default value on error.
-
Contract:
- <p> If the Future throws an InterruptedException or ExecutionException, the function will return the provided default value instead of propagating the exception.
-
Parameters:
-
defaultValue(T) — the value to return if the Future throws an exception
-
- Returns: a Function that gets the Future's result or returns the default value on error
- See also: #futureGet()
futureGet(...) -> Function<Future<T>, T>
-
Signature:
@SuppressWarnings("rawtypes") @Beta public static <T> Function<Future<T>, T> futureGet() - Summary: Returns a Function that gets the result from a Future.
-
Contract:
- <p> If the Future throws an InterruptedException or ExecutionException, the function will wrap it in a RuntimeException and throw it.
-
Parameters:
- (none)
- Returns: a Function that gets the Future's result
from(...) -> Supplier<T>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> Supplier<T> from(final java.util.function.Supplier<T> supplier) - Summary: Converts a java.util.function.Supplier to a Supplier, preserving the instance if already a Supplier.
-
Contract:
- Converts a java.util.function.Supplier to a Supplier, preserving the instance if already a Supplier.
-
Parameters:
-
supplier(java.util.function.Supplier<T>) — the supplier to convert
-
- Returns: a Supplier instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> IntFunction<T> from(final java.util.function.IntFunction<? extends T> func) - Summary: Converts a java.util.function.IntFunction to an IntFunction, preserving the instance if already an IntFunction.
-
Contract:
- Converts a java.util.function.IntFunction to an IntFunction, preserving the instance if already an IntFunction.
-
Parameters:
-
func(java.util.function.IntFunction<? extends T>) — the function to convert
-
- Returns: an IntFunction instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> Predicate<T> from(final java.util.function.Predicate<T> predicate) - Summary: Converts a java.util.function.Predicate to a Predicate, preserving the instance if already a Predicate.
-
Contract:
- Converts a java.util.function.Predicate to a Predicate, preserving the instance if already a Predicate.
-
Parameters:
-
predicate(java.util.function.Predicate<T>) — the predicate to convert
-
- Returns: a Predicate instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U> BiPredicate<T, U> from(final java.util.function.BiPredicate<T, U> predicate) - Summary: Converts a java.util.function.BiPredicate to a BiPredicate, preserving the instance if already a BiPredicate.
-
Contract:
- Converts a java.util.function.BiPredicate to a BiPredicate, preserving the instance if already a BiPredicate.
-
Parameters:
-
predicate(java.util.function.BiPredicate<T, U>) — the bi-predicate to convert
-
- Returns: a BiPredicate instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> Consumer<T> from(final java.util.function.Consumer<T> consumer) - Summary: Converts a java.util.function.Consumer to a Consumer, preserving the instance if already a Consumer.
-
Contract:
- Converts a java.util.function.Consumer to a Consumer, preserving the instance if already a Consumer.
-
Parameters:
-
consumer(java.util.function.Consumer<T>) — the consumer to convert
-
- Returns: a Consumer instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U> BiConsumer<T, U> from(final java.util.function.BiConsumer<T, U> consumer) - Summary: Converts a java.util.function.BiConsumer to a BiConsumer, preserving the instance if already a BiConsumer.
-
Contract:
- Converts a java.util.function.BiConsumer to a BiConsumer, preserving the instance if already a BiConsumer.
-
Parameters:
-
consumer(java.util.function.BiConsumer<T, U>) — the bi-consumer to convert
-
- Returns: a BiConsumer instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, R> Function<T, R> from(final java.util.function.Function<T, ? extends R> function) - Summary: Converts a java.util.function.Function to a Function, preserving the instance if already a Function.
-
Contract:
- Converts a java.util.function.Function to a Function, preserving the instance if already a Function.
-
Parameters:
-
function(java.util.function.Function<T, ? extends R>) — the function to convert
-
- Returns: a Function instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U, R> BiFunction<T, U, R> from(final java.util.function.BiFunction<T, U, ? extends R> function) - Summary: Converts a java.util.function.BiFunction to a BiFunction, preserving the instance if already a BiFunction.
-
Contract:
- Converts a java.util.function.BiFunction to a BiFunction, preserving the instance if already a BiFunction.
-
Parameters:
-
function(java.util.function.BiFunction<T, U, ? extends R>) — the bi-function to convert
-
- Returns: a BiFunction instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> UnaryOperator<T> from(final java.util.function.UnaryOperator<T> op) - Summary: Converts a java.util.function.UnaryOperator to a UnaryOperator, preserving the instance if already a UnaryOperator.
-
Contract:
- Converts a java.util.function.UnaryOperator to a UnaryOperator, preserving the instance if already a UnaryOperator.
-
Parameters:
-
op(java.util.function.UnaryOperator<T>) — the unary operator to convert
-
- Returns: a UnaryOperator instance
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T> BinaryOperator<T> from(final java.util.function.BinaryOperator<T> op) - Summary: Converts a java.util.function.BinaryOperator to a BinaryOperator, preserving the instance if already a BinaryOperator.
-
Contract:
- Converts a java.util.function.BinaryOperator to a BinaryOperator, preserving the instance if already a BinaryOperator.
-
Parameters:
-
op(java.util.function.BinaryOperator<T>) — the binary operator to convert
-
- Returns: a BinaryOperator instance
s(...) -> Supplier<T>
-
Signature:
@Beta public static <T> Supplier<T> s(final Supplier<T> supplier) - Summary: <p> Returns the provided supplier as is - a shorthand identity method for suppliers.
-
Parameters:
-
supplier(Supplier<T>) — the supplier to return
-
- Returns: the supplier unchanged
- See also: #s(Object, Function), #ss(com.landawn.abacus.util.Throwables.Supplier), #ss(Object, com.landawn.abacus.util.Throwables.Function), Suppliers#of(Supplier), Suppliers#of(Object, Function), IntFunctions#of(IntFunction)
-
Signature:
@Beta public static <A, T> Supplier<T> s(final A a, final Function<? super A, ? extends T> func) - Summary: <p> Returns a supplier that applies the given function to the provided argument.
-
Contract:
- It can be useful when you want to create a supplier that computes a value based on a specific input.
-
Parameters:
-
a(A) — the input argument -
func(Function<? super A, ? extends T>) — the function to apply to the argument
-
- Returns: a supplier that computes the result by applying the function to the argument
- See also: #s(Supplier), #ss(com.landawn.abacus.util.Throwables.Supplier), #ss(Object, com.landawn.abacus.util.Throwables.Function), Suppliers#of(Supplier), Suppliers#of(Object, Function), IntFunctions#of(IntFunction)
p(...) -> Predicate<T>
-
Signature:
@Beta public static <T> Predicate<T> p(final Predicate<T> predicate) - Summary: <p> Returns the provided predicate as is - a shorthand identity method for predicates.
-
Parameters:
-
predicate(Predicate<T>) — the predicate to return
-
- Returns: the predicate unchanged
- See also: #p(Object, java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, T> Predicate<T> p(final A a, final java.util.function.BiPredicate<A, T> biPredicate) throws IllegalArgumentException - Summary: <p> Creates a predicate that tests the input against a fixed value using the provided bi-predicate.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Create a predicate that checks if a string contains a specific substring String searchText = "error"; Predicate<String> containsError = Fn.p(searchText, String::contains); boolean result = containsError.test("runtime error occurred"); // Returns true boolean result2 = containsError.test("success"); // Returns false } </pre>
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-predicate -
biPredicate(java.util.function.BiPredicate<A, T>) — the bi-predicate to apply with the fixed first argument
-
- Returns: a predicate that applies the input as the second argument to the bi-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the biPredicate is null
-
- See also: #p(Predicate)
-
Signature:
@Beta public static <A, B, T> Predicate<T> p(final A a, final B b, final TriPredicate<A, B, T> triPredicate) throws IllegalArgumentException - Summary: <p> Creates a predicate that tests inputs against two fixed values using the provided tri-predicate.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Create a predicate that checks if a substring appears between two indices String text = "error message"; Predicate<Integer> containsErrorBetween = Fn.p(text, 0, (str, start, end) -> str.substring(start, end).contains("error")); boolean result = containsErrorBetween.test(5); // Returns true boolean result2 = containsErrorBetween.test(14); // Returns false } </pre>
-
Parameters:
-
a(A) — the first fixed value to use as an argument to the tri-predicate -
b(B) — the second fixed value to use as an argument to the tri-predicate -
triPredicate(TriPredicate<A, B, T>) — the tri-predicate to apply with the fixed arguments
-
- Returns: a predicate that applies the input as the third argument to the tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the triPredicate is null
-
-
Signature:
@Beta public static <T, U> BiPredicate<T, U> p(final BiPredicate<T, U> biPredicate) - Summary: <p> Returns the provided bi-predicate as is - a shorthand identity method for bi-predicates.
-
Parameters:
-
biPredicate(BiPredicate<T, U>) — the bi-predicate to return
-
- Returns: the bi-predicate unchanged
- See also: #p(Predicate), #p(Object, java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, T, U> BiPredicate<T, U> p(final A a, final TriPredicate<A, T, U> triPredicate) throws IllegalArgumentException - Summary: <p> Creates a bi-predicate that tests inputs against a fixed value using the provided tri-predicate.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Create a bi-predicate that checks if a substring appears between two indices String text = "error message"; BiPredicate<Integer, Integer> containsErrorBetween = Fn.p(text, (str, start, end) -> str.substring(start, end).contains("error")); boolean result = containsErrorBetween.test(0, 5); // Returns true boolean result2 = containsErrorBetween.test(6, 14); // Returns false } </pre>
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-predicate -
triPredicate(TriPredicate<A, T, U>) — the tri-predicate to apply with the fixed first argument
-
- Returns: a bi-predicate that applies the inputs as the second and third arguments to the tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the triPredicate is null
-
- See also: #p(BiPredicate), #p(Object, java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, B, C> TriPredicate<A, B, C> p(final TriPredicate<A, B, C> triPredicate) - Summary: <p> Returns the provided tri-predicate as is - a shorthand identity method for tri-predicates.
-
Parameters:
-
triPredicate(TriPredicate<A, B, C>) — the tri-predicate to return
-
- Returns: the tri-predicate unchanged
- See also: #p(Predicate), #p(BiPredicate), #p(Object, TriPredicate)
c(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> c(final Consumer<T> consumer) - Summary: <p> Returns the provided consumer as is - a shorthand identity method for consumers.
-
Parameters:
-
consumer(Consumer<T>) — the consumer to return
-
- Returns: the consumer unchanged
- See also: #p(Predicate), #s(Supplier)
-
Signature:
@Beta public static <A, T> Consumer<T> c(final A a, final java.util.function.BiConsumer<A, T> biConsumer) throws IllegalArgumentException - Summary: <p> Creates a consumer that applies inputs along with a fixed value to the provided bi-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-consumer -
biConsumer(java.util.function.BiConsumer<A, T>) — the bi-consumer to apply with the fixed first argument
-
- Returns: a consumer that applies the input as the second argument to the bi-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the biConsumer is null
-
- See also: #c(Consumer), #p(Object, java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, B, T> Consumer<T> c(final A a, final B b, final TriConsumer<A, B, T> triConsumer) throws IllegalArgumentException - Summary: <p> Creates a consumer that applies inputs along with two fixed values to the provided tri-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-consumer -
b(B) — the fixed value to use as the second argument to the tri-consumer -
triConsumer(TriConsumer<A, B, T>) — the tri-consumer to apply with the fixed first and second arguments
-
- Returns: a consumer that applies the input as the third argument to the tri-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the triConsumer is null
-
-
Signature:
@Beta public static <T, U> BiConsumer<T, U> c(final BiConsumer<T, U> biConsumer) - Summary: Returns the provided bi-consumer as is - a shorthand identity method for bi-consumers.
-
Parameters:
-
biConsumer(BiConsumer<T, U>) — the bi-consumer to return
-
- Returns: the bi-consumer unchanged
- See also: #c(Object, TriConsumer), #c(TriConsumer)
-
Signature:
@Beta public static <A, T, U> BiConsumer<T, U> c(final A a, final TriConsumer<A, T, U> triConsumer) throws IllegalArgumentException - Summary: Creates a bi-consumer that applies inputs along with a fixed value to the provided tri-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-consumer -
triConsumer(TriConsumer<A, T, U>) — the tri-consumer to apply with the fixed first argument
-
- Returns: a bi-consumer that applies the inputs as the second and third arguments to the tri-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the triConsumer is null
-
- See also: #c(BiConsumer), #c(TriConsumer)
-
Signature:
@Beta public static <A, B, C> TriConsumer<A, B, C> c(final TriConsumer<A, B, C> triConsumer) - Summary: Returns the provided tri-consumer as is - a shorthand identity method for tri-consumers.
-
Parameters:
-
triConsumer(TriConsumer<A, B, C>) — the tri-consumer to return
-
- Returns: the tri-consumer unchanged
- See also: #c(BiConsumer), #c(Object, TriConsumer)
-
Signature:
public static <R> Callable<R> c(final Callable<R> callable) throws IllegalArgumentException - Summary: Returns the provided callable as is - a shorthand identity method for callables.
-
Parameters:
-
callable(Callable<R>) — the callable to return
-
- Returns: the callable unchanged
-
Throws:
-
java.lang.IllegalArgumentException— if the callable is null
-
- See also: #r(Runnable)
f(...) -> Function<T, R>
-
Signature:
@Beta public static <T, R> Function<T, R> f(final Function<T, R> function) - Summary: Returns the provided function as is - a shorthand identity method for functions.
-
Parameters:
-
function(Function<T, R>) — the function to return
-
- Returns: the function unchanged
- See also: #f(Object, java.util.function.BiFunction), #f(Object, Object, TriFunction)
-
Signature:
@Beta public static <A, T, R> Function<T, R> f(final A a, final java.util.function.BiFunction<A, T, R> biFunction) throws IllegalArgumentException - Summary: Creates a function that applies the given argument to the provided bi-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-function -
biFunction(java.util.function.BiFunction<A, T, R>) — the bi-function to apply with the fixed first argument
-
- Returns: a function that applies the input as the second argument to the bi-function
-
Throws:
-
java.lang.IllegalArgumentException— if the biFunction is null
-
- See also: #f(Function), #f(Object, Object, TriFunction)
-
Signature:
@Beta public static <A, B, T, R> Function<T, R> f(final A a, final B b, final TriFunction<A, B, T, R> triFunction) throws IllegalArgumentException - Summary: Creates a function that applies the given arguments to the provided tri-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-function -
b(B) — the fixed value to use as the second argument to the tri-function -
triFunction(TriFunction<A, B, T, R>) — the tri-function to apply with the fixed first and second arguments
-
- Returns: a function that applies the input as the third argument to the tri-function
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #f(Function), #f(Object, java.util.function.BiFunction)
-
Signature:
@Beta public static <T, U, R> BiFunction<T, U, R> f(final BiFunction<T, U, R> biFunction) - Summary: Returns the provided bi-function as is - a shorthand identity method for bi-functions.
-
Parameters:
-
biFunction(BiFunction<T, U, R>) — the bi-function to return
-
- Returns: the bi-function unchanged
- See also: #f(Function), #f(Object, TriFunction)
-
Signature:
@Beta public static <A, T, U, R> BiFunction<T, U, R> f(final A a, final TriFunction<A, T, U, R> triFunction) throws IllegalArgumentException - Summary: Creates a bi-function that applies the given argument to the provided tri-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-function -
triFunction(TriFunction<A, T, U, R>) — the tri-function to apply with the fixed first argument
-
- Returns: a bi-function that applies the inputs as the second and third arguments to the tri-function
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #f(BiFunction), #f(TriFunction)
-
Signature:
@Beta public static <A, B, C, R> TriFunction<A, B, C, R> f(final TriFunction<A, B, C, R> triFunction) - Summary: Returns the provided tri-function as is - a shorthand identity method for tri-functions.
-
Parameters:
-
triFunction(TriFunction<A, B, C, R>) — the tri-function to return
-
- Returns: the tri-function unchanged
- See also: #f(Function), #f(BiFunction)
o(...) -> UnaryOperator<T>
-
Signature:
@Beta public static <T> UnaryOperator<T> o(final UnaryOperator<T> unaryOperator) - Summary: Returns the provided unary operator as is - a shorthand identity method for unary operators.
-
Parameters:
-
unaryOperator(UnaryOperator<T>) — the unary operator to return
-
- Returns: the unary operator unchanged
- See also: #o(BinaryOperator)
-
Signature:
@Beta public static <T> BinaryOperator<T> o(final BinaryOperator<T> binaryOperator) - Summary: Returns the provided binary operator as is - a shorthand identity method for binary operators.
-
Parameters:
-
binaryOperator(BinaryOperator<T>) — the binary operator to return
-
- Returns: the binary operator unchanged
- See also: #o(UnaryOperator)
mc(...) -> java.util.function.BiConsumer<T, Consumer<U>>
-
Signature:
@Beta public static <T, U> java.util.function.BiConsumer<T, Consumer<U>> mc( final java.util.function.BiConsumer<? super T, ? extends java.util.function.Consumer<U>> mapper) - Summary: Returns the provided {@code java.util.function.BiConsumer} as-is.
-
Contract:
- This is a shorthand identity method for a mapper that can help with type inference in certain contexts, particularly when used with stream operations like {@code Stream.mapMulti(mapper)} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Using mc() to help with type inference in a stream operation Stream<List<String>> listStream = ...; Stream<String> flatStream = listStream.mapMulti( Fn.mc((List<String> list, Consumer<String> consumer) -> { for (String item : list) { if (item != null && !item.isEmpty()) { consumer.accept(item); } } })); } </pre>
-
Parameters:
-
mapper(java.util.function.BiConsumer<? super T, ? extends java.util.function.Consumer<U>>) — the mapping bi-consumer to return
-
- Returns: the bi-consumer unchanged
- See also: Stream#mapMulti(java.util.function.BiConsumer), Seq#mapMulti(Throwables.BiConsumer), Fnn#mc(Throwables.BiConsumer)
ss(...) -> Supplier<T>
-
Signature:
@Beta public static <T> Supplier<T> ss(final Throwables.Supplier<? extends T, ? extends Exception> supplier) - Summary: Returns a supplier that wraps a throwable supplier, converting checked exceptions to runtime exceptions.
-
Parameters:
-
supplier(Throwables.Supplier<? extends T, ? extends Exception>) — the throwable supplier to wrap
-
- Returns: a supplier that applies the supplier and converts exceptions
- See also: #ss(Object, Throwables.Function)
-
Signature:
@Beta public static <A, T> Supplier<T> ss(final A a, final Throwables.Function<? super A, ? extends T, ? extends Exception> func) - Summary: Creates a supplier that applies the given argument to the provided throwable function.
-
Parameters:
-
a(A) — the fixed value to use as the argument to the function -
func(Throwables.Function<? super A, ? extends T, ? extends Exception>) — the throwable function to apply with the fixed argument
-
- Returns: a supplier that computes the result by applying the function to the argument
- See also: #ss(Throwables.Supplier)
pp(...) -> Predicate<T>
-
Signature:
@Beta public static <T> Predicate<T> pp(final Throwables.Predicate<T, ? extends Exception> predicate) throws IllegalArgumentException - Summary: Returns a predicate that wraps a throwable predicate, converting checked exceptions to runtime exceptions.
-
Parameters:
-
predicate(Throwables.Predicate<T, ? extends Exception>) — the throwable predicate to wrap
-
- Returns: a predicate that applies the input to the throwable predicate and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null
-
- See also: #pp(Object, Throwables.BiPredicate), #pp(Object, Object, Throwables.TriPredicate)
-
Signature:
@Beta public static <A, T> Predicate<T> pp(final A a, final Throwables.BiPredicate<A, T, ? extends Exception> biPredicate) throws IllegalArgumentException - Summary: Creates a predicate that applies the given argument to the provided throwable bi-predicate.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-predicate -
biPredicate(Throwables.BiPredicate<A, T, ? extends Exception>) — the throwable bi-predicate to apply with the fixed first argument
-
- Returns: a predicate that applies the input as the second argument to the bi-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the biPredicate is null
-
- See also: #pp(Throwables.Predicate), #pp(Object, Object, Throwables.TriPredicate)
-
Signature:
@Beta public static <A, B, T> Predicate<T> pp(final A a, final B b, final Throwables.TriPredicate<A, B, T, ? extends Exception> triPredicate) throws IllegalArgumentException - Summary: Creates a predicate that applies inputs along with two fixed values to the provided throwable tri-predicate.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-predicate -
b(B) — the fixed value to use as the second argument to the tri-predicate -
triPredicate(Throwables.TriPredicate<A, B, T, ? extends Exception>) — the throwable tri-predicate to apply with the fixed first and second arguments
-
- Returns: a predicate that applies the input as the third argument to the tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the triPredicate is null
-
- See also: #pp(Object, Throwables.BiPredicate), #pp(Throwables.Predicate)
-
Signature:
@Beta public static <T, U> BiPredicate<T, U> pp(final Throwables.BiPredicate<T, U, ? extends Exception> biPredicate) throws IllegalArgumentException - Summary: Creates a bi-predicate that safely wraps a throwable bi-predicate by converting any checked exceptions into runtime exceptions.
-
Parameters:
-
biPredicate(Throwables.BiPredicate<T, U, ? extends Exception>) — the throwable bi-predicate to be wrapped
-
- Returns: a bi-predicate that delegates to the given throwable bi-predicate, converting any checked exceptions to runtime exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the biPredicate is null
-
- See also: #pp(Throwables.Predicate), #pp(Object, Throwables.BiPredicate), #pp(Object, Object, Throwables.TriPredicate)
-
Signature:
@Beta public static <A, T, U> BiPredicate<T, U> pp(final A a, final Throwables.TriPredicate<A, T, U, ? extends Exception> triPredicate) throws IllegalArgumentException - Summary: Creates a bi-predicate that applies the given argument to the provided throwable tri-predicate.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-predicate -
triPredicate(Throwables.TriPredicate<A, T, U, ? extends Exception>) — the throwable tri-predicate to apply with the fixed first argument
-
- Returns: a bi-predicate that applies the inputs as the second and third arguments to the tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the triPredicate is null
-
- See also: #pp(Throwables.BiPredicate), #pp(Throwables.TriPredicate)
-
Signature:
@Beta public static <A, B, C> TriPredicate<A, B, C> pp(final Throwables.TriPredicate<A, B, C, ? extends Exception> triPredicate) throws IllegalArgumentException - Summary: Creates a tri-predicate that safely wraps a throwable tri-predicate by converting any checked exceptions into runtime exceptions.
-
Parameters:
-
triPredicate(Throwables.TriPredicate<A, B, C, ? extends Exception>) — the throwable tri-predicate to be wrapped
-
- Returns: a tri-predicate that delegates to the given throwable tri-predicate, converting any checked exceptions to runtime exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the triPredicate is null
-
- See also: #pp(Throwables.Predicate), #pp(Throwables.BiPredicate)
cc(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> cc(final Throwables.Consumer<T, ? extends Exception> consumer) throws IllegalArgumentException - Summary: Returns a consumer that wraps a throwable consumer, converting checked exceptions to runtime exceptions.
-
Parameters:
-
consumer(Throwables.Consumer<T, ? extends Exception>) — the throwable consumer to wrap
-
- Returns: a consumer that applies the input to the throwable consumer and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the consumer is null
-
- See also: #cc(Object, Throwables.BiConsumer), #cc(Object, Object, Throwables.TriConsumer)
-
Signature:
@Beta public static <A, T> Consumer<T> cc(final A a, final Throwables.BiConsumer<A, T, ? extends Exception> biConsumer) throws IllegalArgumentException - Summary: Creates a consumer that applies the given argument to the provided throwable bi-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-consumer -
biConsumer(Throwables.BiConsumer<A, T, ? extends Exception>) — the throwable bi-consumer to apply with the fixed first argument
-
- Returns: a consumer that applies the input as the second argument to the bi-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the biConsumer is null
-
- See also: #cc(Throwables.Consumer), #cc(Object, Object, Throwables.TriConsumer)
-
Signature:
@Beta public static <A, B, T> Consumer<T> cc(final A a, final B b, final Throwables.TriConsumer<A, B, T, ? extends Exception> triConsumer) throws IllegalArgumentException - Summary: Creates a consumer that applies inputs along with two fixed values to the provided throwable tri-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-consumer -
b(B) — the fixed value to use as the second argument to the tri-consumer -
triConsumer(Throwables.TriConsumer<A, B, T, ? extends Exception>) — the throwable tri-consumer to apply with the fixed first and second arguments
-
- Returns: a consumer that applies the input as the third argument to the tri-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the triConsumer is null
-
- See also: #cc(Throwables.Consumer), #cc(Object, Throwables.BiConsumer)
-
Signature:
@Beta public static <T, U> BiConsumer<T, U> cc(final Throwables.BiConsumer<T, U, ? extends Exception> biConsumer) throws IllegalArgumentException - Summary: Returns a bi-consumer that wraps a throwable bi-consumer, converting checked exceptions to runtime exceptions.
-
Parameters:
-
biConsumer(Throwables.BiConsumer<T, U, ? extends Exception>) — the throwable bi-consumer to wrap
-
- Returns: a bi-consumer that applies the inputs to the throwable bi-consumer and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the biConsumer is null
-
- See also: #cc(Throwables.Consumer), #cc(Object, Throwables.TriConsumer)
-
Signature:
@Beta public static <A, T, U> BiConsumer<T, U> cc(final A a, final Throwables.TriConsumer<A, T, U, ? extends Exception> triConsumer) throws IllegalArgumentException - Summary: Creates a bi-consumer that applies the given argument to the provided throwable tri-consumer.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-consumer -
triConsumer(Throwables.TriConsumer<A, T, U, ? extends Exception>) — the throwable tri-consumer to apply with the fixed first argument
-
- Returns: a bi-consumer that applies the inputs as the second and third arguments to the tri-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the triConsumer is null
-
- See also: #cc(Throwables.BiConsumer), #cc(Throwables.TriConsumer)
-
Signature:
@Beta public static <A, B, C> TriConsumer<A, B, C> cc(final Throwables.TriConsumer<A, B, C, ? extends Exception> triConsumer) throws IllegalArgumentException - Summary: Returns a tri-consumer that wraps a throwable tri-consumer, converting checked exceptions to runtime exceptions.
-
Parameters:
-
triConsumer(Throwables.TriConsumer<A, B, C, ? extends Exception>) — the throwable tri-consumer to wrap
-
- Returns: a tri-consumer that applies the inputs to the throwable tri-consumer and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the triConsumer is null
-
- See also: #cc(Throwables.Consumer), #cc(Throwables.BiConsumer)
-
Signature:
public static <R> Callable<R> cc(final Throwables.Callable<R, ? extends Exception> callable) - Summary: Wraps a throwable callable to convert checked exceptions to runtime exceptions.
-
Parameters:
-
callable(Throwables.Callable<R, ? extends Exception>) — the throwable callable to wrap
-
- Returns: a callable that executes the throwable callable and converts checked exceptions to runtime exceptions
- See also: #rr(Throwables.Runnable)
ff(...) -> Function<T, R>
-
Signature:
@Beta public static <T, R> Function<T, R> ff(final Throwables.Function<T, ? extends R, ? extends Exception> function) throws IllegalArgumentException - Summary: Returns a function that wraps a throwable function, converting checked exceptions to runtime exceptions.
-
Parameters:
-
function(Throwables.Function<T, ? extends R, ? extends Exception>) — the throwable function to wrap
-
- Returns: a function that applies the input to the throwable function and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the function is null
-
- See also: #ff(Throwables.Function, Object), #ff(Object, Throwables.BiFunction)
-
Signature:
@Beta public static <T, R> Function<T, R> ff(final Throwables.Function<T, ? extends R, ? extends Exception> function, final R defaultOnError) throws IllegalArgumentException - Summary: Creates a function that safely wraps a throwable function by returning a default value if the function throws an exception.
-
Contract:
- Creates a function that safely wraps a throwable function by returning a default value if the function throws an exception.
-
Parameters:
-
function(Throwables.Function<T, ? extends R, ? extends Exception>) — the throwable function to be wrapped -
defaultOnError(R) — the default value to return if the function throws an exception
-
- Returns: a function that delegates to the given throwable function, returning the default value if an exception occurs
-
Throws:
-
java.lang.IllegalArgumentException— if the function is null
-
- See also: #ff(Throwables.Function), #pp(Throwables.Predicate), #cc(Throwables.Consumer)
-
Signature:
@Beta public static <A, T, R> Function<T, R> ff(final A a, final Throwables.BiFunction<A, T, R, ? extends Exception> biFunction) throws IllegalArgumentException - Summary: Creates a function that applies the given argument to the provided throwable bi-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the bi-function -
biFunction(Throwables.BiFunction<A, T, R, ? extends Exception>) — the throwable bi-function to apply with the fixed first argument
-
- Returns: a function that applies the input as the second argument to the bi-function
-
Throws:
-
java.lang.IllegalArgumentException— if the biFunction is null
-
- See also: #ff(Throwables.Function), #ff(Object, Object, Throwables.TriFunction)
-
Signature:
@Beta public static <A, B, T, R> Function<T, R> ff(final A a, final B b, final Throwables.TriFunction<A, B, T, R, ? extends Exception> triFunction) throws IllegalArgumentException - Summary: Creates a function that applies inputs along with two fixed values to the provided throwable tri-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-function -
b(B) — the fixed value to use as the second argument to the tri-function -
triFunction(Throwables.TriFunction<A, B, T, R, ? extends Exception>) — the throwable tri-function to apply with the fixed first and second arguments
-
- Returns: a function that applies the input as the third argument to the tri-function
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #ff(Throwables.Function), #ff(Object, Throwables.BiFunction)
-
Signature:
@Beta public static <T, U, R> BiFunction<T, U, R> ff(final Throwables.BiFunction<T, U, R, ? extends Exception> biFunction) throws IllegalArgumentException - Summary: Returns a bi-function that wraps a throwable bi-function, converting checked exceptions to runtime exceptions.
-
Parameters:
-
biFunction(Throwables.BiFunction<T, U, R, ? extends Exception>) — the throwable bi-function to wrap
-
- Returns: a bi-function that applies the inputs to the throwable bi-function and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the biFunction is null
-
- See also: #ff(Throwables.Function), #ff(Throwables.BiFunction, Object)
-
Signature:
@Beta public static <T, U, R> BiFunction<T, U, R> ff(final Throwables.BiFunction<T, U, R, ? extends Exception> biFunction, final R defaultOnError) throws IllegalArgumentException - Summary: Creates a bi-function that safely wraps a throwable bi-function by returning a default value if the function throws an exception.
-
Contract:
- Creates a bi-function that safely wraps a throwable bi-function by returning a default value if the function throws an exception.
-
Parameters:
-
biFunction(Throwables.BiFunction<T, U, R, ? extends Exception>) — the throwable bi-function to be wrapped -
defaultOnError(R) — the default value to return if the function throws an exception
-
- Returns: a bi-function that delegates to the given throwable bi-function, returning the default value if an exception occurs
-
Throws:
-
java.lang.IllegalArgumentException— if the biFunction is null
-
- See also: #ff(Throwables.BiFunction), #ff(Throwables.Function, Object)
-
Signature:
@Beta public static <A, T, U, R> BiFunction<T, U, R> ff(final A a, final Throwables.TriFunction<A, T, U, R, ? extends Exception> triFunction) throws IllegalArgumentException - Summary: Creates a bi-function that applies the given argument to the provided throwable tri-function.
-
Parameters:
-
a(A) — the fixed value to use as the first argument to the tri-function -
triFunction(Throwables.TriFunction<A, T, U, R, ? extends Exception>) — the throwable tri-function to apply with the fixed first argument
-
- Returns: a bi-function that applies the inputs as the second and third arguments to the tri-function
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #ff(Throwables.BiFunction), #ff(Throwables.TriFunction)
-
Signature:
@Beta public static <A, B, C, R> TriFunction<A, B, C, R> ff(final Throwables.TriFunction<A, B, C, R, ? extends Exception> triFunction) throws IllegalArgumentException - Summary: Returns a tri-function that wraps a throwable tri-function, converting checked exceptions to runtime exceptions.
-
Parameters:
-
triFunction(Throwables.TriFunction<A, B, C, R, ? extends Exception>) — the throwable tri-function to wrap
-
- Returns: a tri-function that applies the inputs to the throwable tri-function and converts exceptions
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #ff(Throwables.Function), #ff(Throwables.BiFunction)
-
Signature:
@Beta public static <A, B, C, R> TriFunction<A, B, C, R> ff(final Throwables.TriFunction<A, B, C, R, ? extends Exception> triFunction, final R defaultOnError) throws IllegalArgumentException - Summary: Creates a tri-function that safely wraps a throwable tri-function by returning a default value if the function throws an exception.
-
Contract:
- Creates a tri-function that safely wraps a throwable tri-function by returning a default value if the function throws an exception.
-
Parameters:
-
triFunction(Throwables.TriFunction<A, B, C, R, ? extends Exception>) — the throwable tri-function to be wrapped -
defaultOnError(R) — the default value to return if the function throws an exception
-
- Returns: a tri-function that delegates to the given throwable tri-function, returning the default value if an exception occurs
-
Throws:
-
java.lang.IllegalArgumentException— if the triFunction is null
-
- See also: #ff(Throwables.TriFunction), #ff(Throwables.BiFunction, Object)
sp(...) -> Predicate<T>
-
Signature:
@Beta public static <T> Predicate<T> sp(final Object mutex, final java.util.function.Predicate<T> predicate) throws IllegalArgumentException - Summary: Creates a synchronized predicate that safely wraps a standard predicate by ensuring all tests are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when testing values -
predicate(java.util.function.Predicate<T>) — the predicate to be wrapped with synchronization
-
- Returns: a predicate that delegates to the given predicate within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or predicate is null
-
- See also: #pp(Throwables.Predicate), #p(Predicate)
-
Signature:
@Beta public static <A, T> Predicate<T> sp(final Object mutex, final A a, final java.util.function.BiPredicate<A, T> biPredicate) throws IllegalArgumentException - Summary: Creates a synchronized predicate that applies the given argument to the provided bi-predicate within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when testing values -
a(A) — the fixed value to use as the first argument to the bi-predicate -
biPredicate(java.util.function.BiPredicate<A, T>) — the bi-predicate to apply with the fixed first argument
-
- Returns: a synchronized predicate that applies the input as the second argument to the bi-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biPredicate is null
-
- See also: #sp(Object, java.util.function.Predicate)
-
Signature:
@Beta public static <T, U> BiPredicate<T, U> sp(final Object mutex, final java.util.function.BiPredicate<T, U> biPredicate) throws IllegalArgumentException - Summary: Creates a synchronized bi-predicate that safely wraps a standard bi-predicate by ensuring all tests are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when testing values -
biPredicate(java.util.function.BiPredicate<T, U>) — the bi-predicate to be wrapped with synchronization
-
- Returns: a bi-predicate that delegates to the given bi-predicate within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biPredicate is null
-
- See also: #sp(Object, TriPredicate)
-
Signature:
@Beta public static <A, B, C> TriPredicate<A, B, C> sp(final Object mutex, final TriPredicate<A, B, C> triPredicate) throws IllegalArgumentException - Summary: Creates a synchronized tri-predicate that safely wraps a tri-predicate by ensuring all tests are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when testing values -
triPredicate(TriPredicate<A, B, C>) — the tri-predicate to be wrapped with synchronization
-
- Returns: a tri-predicate that delegates to the given tri-predicate within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or triPredicate is null
-
- See also: #sp(Object, java.util.function.Predicate), #sp(Object, java.util.function.BiPredicate)
sc(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> sc(final Object mutex, final java.util.function.Consumer<T> consumer) throws IllegalArgumentException - Summary: Creates a synchronized consumer that safely wraps a standard consumer by ensuring all accept operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when accepting values -
consumer(java.util.function.Consumer<T>) — the consumer to be wrapped with synchronization
-
- Returns: a consumer that delegates to the given consumer within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or consumer is null
-
- See also: #cc(Throwables.Consumer), #c(Consumer)
-
Signature:
@Beta public static <A, T> Consumer<T> sc(final Object mutex, final A a, final java.util.function.BiConsumer<A, T> biConsumer) throws IllegalArgumentException - Summary: Creates a synchronized consumer that applies the given argument to the provided bi-consumer within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when accepting values -
a(A) — the fixed value to use as the first argument to the bi-consumer -
biConsumer(java.util.function.BiConsumer<A, T>) — the bi-consumer to apply with the fixed first argument
-
- Returns: a synchronized consumer that applies the input as the second argument to the bi-consumer
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biConsumer is null
-
- See also: #sc(Object, java.util.function.Consumer)
-
Signature:
@Beta public static <T, U> BiConsumer<T, U> sc(final Object mutex, final java.util.function.BiConsumer<T, U> biConsumer) throws IllegalArgumentException - Summary: Creates a synchronized bi-consumer that safely wraps a standard bi-consumer by ensuring all accept operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when accepting values -
biConsumer(java.util.function.BiConsumer<T, U>) — the bi-consumer to be wrapped with synchronization
-
- Returns: a bi-consumer that delegates to the given bi-consumer within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biConsumer is null
-
- See also: #sc(Object, java.util.function.Consumer)
-
Signature:
@Beta public static <A, B, C> TriConsumer<A, B, C> sc(final Object mutex, final TriConsumer<A, B, C> triConsumer) throws IllegalArgumentException - Summary: Creates a synchronized tri-consumer that safely wraps a tri-consumer by ensuring all accept operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when accepting values -
triConsumer(TriConsumer<A, B, C>) — the tri-consumer to be wrapped with synchronization
-
- Returns: a tri-consumer that delegates to the given tri-consumer within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or triConsumer is null
-
- See also: #sc(Object, java.util.function.Consumer), #sc(Object, java.util.function.BiConsumer)
sf(...) -> Function<T, R>
-
Signature:
@Beta public static <T, R> Function<T, R> sf(final Object mutex, final java.util.function.Function<T, ? extends R> function) throws IllegalArgumentException - Summary: Creates a synchronized function that safely wraps a standard function by ensuring all apply operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when applying the function -
function(java.util.function.Function<T, ? extends R>) — the function to be wrapped with synchronization
-
- Returns: a function that delegates to the given function within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or function is null
-
- See also: #ff(Throwables.Function), #f(Function)
-
Signature:
@Beta public static <A, T, R> Function<T, R> sf(final Object mutex, final A a, final java.util.function.BiFunction<A, T, R> biFunction) throws IllegalArgumentException - Summary: Creates a synchronized function that applies the given argument to the provided bi-function within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when applying the function -
a(A) — the fixed value to use as the first argument to the bi-function -
biFunction(java.util.function.BiFunction<A, T, R>) — the bi-function to apply with the fixed first argument
-
- Returns: a synchronized function that applies the input as the second argument to the bi-function
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biFunction is null
-
- See also: #sf(Object, java.util.function.Function)
-
Signature:
@Beta public static <T, U, R> BiFunction<T, U, R> sf(final Object mutex, final java.util.function.BiFunction<T, U, R> biFunction) throws IllegalArgumentException - Summary: Creates a synchronized bi-function that safely wraps a standard bi-function by ensuring all apply operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when applying the function -
biFunction(java.util.function.BiFunction<T, U, R>) — the bi-function to be wrapped with synchronization
-
- Returns: a bi-function that delegates to the given bi-function within a synchronized block on the mutex
-
Throws:
-
java.lang.IllegalArgumentException— if the mutex or biFunction is null
-
- See also: #sf(Object, java.util.function.Function), #sf(Object, TriFunction)
-
Signature:
@Beta public static <A, B, C, R> TriFunction<A, B, C, R> sf(final Object mutex, final TriFunction<A, B, C, R> triFunction) - Summary: Creates a synchronized tri-function that safely wraps a tri-function by ensuring all apply operations are performed within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on when applying the function -
triFunction(TriFunction<A, B, C, R>) — the tri-function to be wrapped with synchronization
-
- Returns: a tri-function that delegates to the given tri-function within a synchronized block on the mutex
- See also: #sf(Object, java.util.function.Function), #sf(Object, java.util.function.BiFunction)
c2f(...) -> Function<T, Void>
-
Signature:
@Beta public static <T> Function<T, Void> c2f(final java.util.function.Consumer<? super T> action) throws IllegalArgumentException - Summary: Converts a consumer to a function that returns void (null) after executing the consumer.
-
Contract:
- <p> This method is useful when you need to use a consumer in a context that requires a function, such as in stream map operations where you want side effects but also need to continue the stream.
-
Parameters:
-
action(java.util.function.Consumer<? super T>) — the consumer to convert to a function
-
- Returns: a function that executes the consumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(java.util.function.Consumer, Object), #f2c(java.util.function.Function)
-
Signature:
@Beta public static <T, R> Function<T, R> c2f(final java.util.function.Consumer<? super T> action, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a consumer to a function that returns a specified value after executing the consumer.
-
Contract:
- <p> This method is useful when you need to use a consumer in a context that requires a function and want to return a specific value after the consumer executes, such as for chaining operations.
-
Parameters:
-
action(java.util.function.Consumer<? super T>) — the consumer to convert to a function -
valueToReturn(R) — the value to return after the consumer executes
-
- Returns: a function that executes the consumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(java.util.function.Consumer), #f2c(java.util.function.Function)
-
Signature:
@Beta public static <T, U> BiFunction<T, U, Void> c2f(final java.util.function.BiConsumer<? super T, ? super U> action) throws IllegalArgumentException - Summary: Converts a bi-consumer to a bi-function that returns void (null) after executing the bi-consumer.
-
Contract:
- <p> This method is useful when you need to use a bi-consumer in a context that requires a bi-function, allowing you to perform side effects while maintaining functional composition.
-
Parameters:
-
action(java.util.function.BiConsumer<? super T, ? super U>) — the bi-consumer to convert to a bi-function
-
- Returns: a bi-function that executes the bi-consumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(java.util.function.BiConsumer, Object), #f2c(java.util.function.Function)
-
Signature:
@Beta public static <T, U, R> BiFunction<T, U, R> c2f(final java.util.function.BiConsumer<? super T, ? super U> action, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a bi-consumer to a bi-function that returns a specified value after executing the bi-consumer.
-
Contract:
- <p> This method is useful when you need to use a bi-consumer in a context that requires a bi-function and want to return a specific value after the bi-consumer executes.
-
Parameters:
-
action(java.util.function.BiConsumer<? super T, ? super U>) — the bi-consumer to convert to a bi-function -
valueToReturn(R) — the value to return after the bi-consumer executes
-
- Returns: a bi-function that executes the bi-consumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(java.util.function.Consumer), #f2c(java.util.function.BiFunction)
-
Signature:
@Beta public static <A, B, C> TriFunction<A, B, C, Void> c2f(final TriConsumer<? super A, ? super B, ? super C> action) throws IllegalArgumentException - Summary: Converts a tri-consumer to a tri-function that returns void (null) after executing the tri-consumer.
-
Contract:
- <p> This method is useful when you need to use a tri-consumer in a context that requires a tri-function, allowing you to perform side effects while maintaining functional composition.
-
Parameters:
-
action(TriConsumer<? super A, ? super B, ? super C>) — the tri-consumer to convert to a tri-function
-
- Returns: a tri-function that executes the tri-consumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(TriConsumer, Object), #f2c(TriFunction)
-
Signature:
@Beta public static <A, B, C, R> TriFunction<A, B, C, R> c2f(final TriConsumer<? super A, ? super B, ? super C> action, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a tri-consumer to a tri-function that returns a specified value after executing the tri-consumer.
-
Contract:
- <p> This method is useful when you need to use a tri-consumer in a context that requires a tri-function and want to return a specific value after the tri-consumer executes.
-
Parameters:
-
action(TriConsumer<? super A, ? super B, ? super C>) — the tri-consumer to convert to a tri-function -
valueToReturn(R) — the value to return after the tri-consumer executes
-
- Returns: a tri-function that executes the tri-consumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if the action is null
-
- See also: #c2f(TriConsumer), #f2c(TriFunction)
f2c(...) -> Consumer<T>
-
Signature:
@Beta public static <T> Consumer<T> f2c(final java.util.function.Function<? super T, ?> func) throws IllegalArgumentException - Summary: Converts a function to a consumer by discarding the function's return value.
-
Contract:
- <p> This method is useful when you have a function but need a consumer, and you don't care about the return value.
-
Parameters:
-
func(java.util.function.Function<? super T, ?>) — the function to convert to a consumer
-
- Returns: a consumer that executes the function and discards its return value
-
Throws:
-
java.lang.IllegalArgumentException— if the func is null
-
- See also: #c2f(java.util.function.Consumer)
-
Signature:
@Beta public static <T, U> BiConsumer<T, U> f2c(final java.util.function.BiFunction<? super T, ? super U, ?> func) throws IllegalArgumentException - Summary: Converts a bi-function to a bi-consumer by discarding the bi-function's return value.
-
Contract:
- <p> This method is useful when you have a bi-function but need a bi-consumer, and you don't care about the return value.
-
Parameters:
-
func(java.util.function.BiFunction<? super T, ? super U, ?>) — the bi-function to convert to a bi-consumer
-
- Returns: a bi-consumer that executes the bi-function and discards its return value
-
Throws:
-
java.lang.IllegalArgumentException— if the func is null
-
- See also: #c2f(java.util.function.BiConsumer)
-
Signature:
@Beta public static <A, B, C> TriConsumer<A, B, C> f2c(final TriFunction<? super A, ? super B, ? super C, ?> func) throws IllegalArgumentException - Summary: Converts a tri-function to a tri-consumer by discarding the tri-function's return value.
-
Contract:
- <p> This method is useful when you have a tri-function but need a tri-consumer, and you don't care about the return value.
-
Parameters:
-
func(TriFunction<? super A, ? super B, ? super C, ?>) — the tri-function to convert to a tri-consumer
-
- Returns: a tri-consumer that executes the tri-function and discards its return value
-
Throws:
-
java.lang.IllegalArgumentException— if the func is null
-
- See also: #c2f(TriConsumer)
rr(...) -> Runnable
-
Signature:
public static Runnable rr(final Throwables.Runnable<? extends Exception> runnable) - Summary: Wraps a throwable runnable to convert checked exceptions to runtime exceptions.
-
Parameters:
-
runnable(Throwables.Runnable<? extends Exception>) — the throwable runnable to wrap
-
- Returns: a runnable that executes the throwable runnable and converts checked exceptions to runtime exceptions
- See also: #cc(Throwables.Callable)
r(...) -> Runnable
-
Signature:
public static Runnable r(final Runnable runnable) throws IllegalArgumentException - Summary: Returns the provided runnable as is - a shorthand identity method for runnables.
-
Parameters:
-
runnable(Runnable) — the runnable to return
-
- Returns: the runnable unchanged
-
Throws:
-
java.lang.IllegalArgumentException— if the runnable is null
-
- See also: #c(Callable)
jr(...) -> java.lang.Runnable
-
Signature:
public static java.lang.Runnable jr(final java.lang.Runnable runnable) throws IllegalArgumentException - Summary: Returns the provided Java runnable as is - a shorthand identity method for Java runnables.
-
Contract:
- <p> This method serves as a shorthand convenience method that can help with type inference in certain contexts when working with java.lang.Runnable.
-
Parameters:
-
runnable(java.lang.Runnable) — the Java runnable to return
-
- Returns: the Java runnable unchanged
-
Throws:
-
java.lang.IllegalArgumentException— if the runnable is null
-
- See also: #jc(java.util.concurrent.Callable)
jc(...) -> java.util.concurrent.Callable<R>
-
Signature:
public static <R> java.util.concurrent.Callable<R> jc(final java.util.concurrent.Callable<R> callable) throws IllegalArgumentException - Summary: Returns the provided Java callable as is - a shorthand identity method for Java callables.
-
Contract:
- <p> This method serves as a shorthand convenience method that can help with type inference in certain contexts when working with java.util.concurrent.Callable.
-
Parameters:
-
callable(java.util.concurrent.Callable<R>) — the Java callable to return
-
- Returns: the Java callable unchanged
-
Throws:
-
java.lang.IllegalArgumentException— if the callable is null
-
- See also: #jr(java.lang.Runnable)
r2c(...) -> Callable<Void>
-
Signature:
public static Callable<Void> r2c(final java.lang.Runnable runnable) throws IllegalArgumentException - Summary: Converts a runnable to a callable that returns void (null).
-
Contract:
- <p> This method is useful when you need to use a runnable in a context that requires a callable, such as with executor services when you want to track completion but don't need a return value.
-
Parameters:
-
runnable(java.lang.Runnable) — the runnable to convert to a callable
-
- Returns: a callable that executes the runnable and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if the runnable is null
-
- See also: #r2c(java.lang.Runnable, Object), #c2r(Callable)
-
Signature:
public static <R> Callable<R> r2c(final java.lang.Runnable runnable, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a runnable to a callable that returns a specified value.
-
Contract:
- <p> This method is useful when you need to use a runnable in a context that requires a callable and want to return a specific value after the runnable executes.
-
Parameters:
-
runnable(java.lang.Runnable) — the runnable to convert to a callable -
valueToReturn(R) — the value to return after the runnable executes
-
- Returns: a callable that executes the runnable and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if the runnable is null
-
- See also: #r2c(java.lang.Runnable), #c2r(Callable)
c2r(...) -> Runnable
-
Signature:
public static <R> Runnable c2r(final Callable<R> callable) throws IllegalArgumentException - Summary: Converts a callable to a runnable by discarding the callable's return value.
-
Contract:
- <p> This method is useful when you have a callable but need a runnable, and you don't care about the return value.
-
Parameters:
-
callable(Callable<R>) — the callable to convert to a runnable
-
- Returns: a runnable that executes the callable and discards its return value
-
Throws:
-
java.lang.IllegalArgumentException— if the callable is null
-
- See also: #r2c(java.lang.Runnable)
jr2r(...) -> Runnable
-
Signature:
public static Runnable jr2r(final java.lang.Runnable runnable) throws IllegalArgumentException - Summary: Converts a Java runnable to an abacus Runnable.
-
Parameters:
-
runnable(java.lang.Runnable) — the Java runnable to convert
-
- Returns: an abacus Runnable that delegates to the Java runnable
-
Throws:
-
java.lang.IllegalArgumentException— if the runnable is null
-
- See also: #jc2c(java.util.concurrent.Callable)
jc2c(...) -> Callable<R>
-
Signature:
public static <R> Callable<R> jc2c(final java.util.concurrent.Callable<R> callable) throws IllegalArgumentException - Summary: Converts a Java callable to an abacus Callable.
-
Parameters:
-
callable(java.util.concurrent.Callable<R>) — the Java callable to convert
-
- Returns: an abacus Callable that delegates to the Java callable
-
Throws:
-
java.lang.IllegalArgumentException— if the callable is null
-
- See also: #jr2r(java.lang.Runnable)
jc2r(...) -> Runnable
-
Signature:
public static Runnable jc2r(final java.util.concurrent.Callable<?> callable) throws IllegalArgumentException - Summary: Converts a callable to a Java runnable by discarding the callable's return value.
-
Contract:
- <p> This method is useful when you have a callable but need a Java runnable for use with thread creation or other Java APIs that expect Runnable.
-
Parameters:
-
callable(java.util.concurrent.Callable<?>) — the Java callable to convert to a runnable
-
- Returns: a Java runnable that executes the callable and discards its return value
-
Throws:
-
java.lang.IllegalArgumentException— if the callable is null
-
- See also: #r2c(java.lang.Runnable)
throwingMerger(...) -> BinaryOperator<T>
-
Signature:
public static <T> BinaryOperator<T> throwingMerger() - Summary: Returns a BinaryOperator that always throws an exception when attempting to merge duplicate keys.
-
Contract:
- Returns a BinaryOperator that always throws an exception when attempting to merge duplicate keys.
- <p> This operator is useful in collectors and map operations where duplicate keys should be treated as an error condition rather than being silently merged.
-
Parameters:
- (none)
- Returns: a BinaryOperator that throws IllegalStateException on merge attempts
- See also: #ignoringMerger(), #replacingMerger()
ignoringMerger(...) -> BinaryOperator<T>
-
Signature:
public static <T> BinaryOperator<T> ignoringMerger() - Summary: Returns a BinaryOperator that ignores the second value when merging duplicates, keeping the first value.
-
Contract:
- Returns a BinaryOperator that ignores the second value when merging duplicates, keeping the first value.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the first operand
- See also: #throwingMerger(), #replacingMerger()
replacingMerger(...) -> BinaryOperator<T>
-
Signature:
public static <T> BinaryOperator<T> replacingMerger() - Summary: Returns a BinaryOperator that replaces the first value with the second value when merging duplicates.
-
Contract:
- Returns a BinaryOperator that replaces the first value with the second value when merging duplicates.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the second operand
- See also: #throwingMerger(), #ignoringMerger()
getIfPresentOrElseNull(...) -> Function<Optional<T>, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Optional<T>, T> getIfPresentOrElseNull() - Summary: Returns a Function that extracts the value from an Optional, returning {@code null} if the Optional is empty.
-
Contract:
- Returns a Function that extracts the value from an Optional, returning {@code null} if the Optional is empty.
-
Parameters:
- (none)
- Returns: a Function that extracts the Optional's value or returns null
- See also: #getIfPresentOrElseNullJdk(), #isPresent()
getIfPresentOrElseNullJdk(...) -> Function<java.util.Optional<T>, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<java.util.Optional<T>, T> getIfPresentOrElseNullJdk() - Summary: Returns a Function that extracts the value from a Java Optional, returning {@code null} if the Optional is empty.
-
Contract:
- Returns a Function that extracts the value from a Java Optional, returning {@code null} if the Optional is empty.
-
Parameters:
- (none)
- Returns: a Function that extracts the Java Optional's value or returns null
- See also: #getIfPresentOrElseNull(), #isPresentJdk()
isPresent(...) -> Predicate<Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Predicate<Optional<T>> isPresent() - Summary: Returns a Predicate that tests whether an Optional contains a value.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the Optional contains a value
- See also: #isPresentJdk(), #getIfPresentOrElseNull()
isPresentJdk(...) -> Predicate<java.util.Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Predicate<java.util.Optional<T>> isPresentJdk() - Summary: Returns a Predicate that tests whether a Java Optional contains a value.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the Java Optional contains a value
- See also: #isPresent(), #getIfPresentOrElseNullJdk()
alternate(...) -> BiFunction<T, T, MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> BiFunction<T, T, MergeResult> alternate() - Summary: Returns a stateful BiFunction that alternates between returning MergeResult.TAKE_FIRST and MergeResult.TAKE_SECOND.
-
Parameters:
- (none)
- Returns: a stateful BiFunction that alternates between TAKE_FIRST and TAKE_SECOND
Public Instance Methods
- (none)
Class LongSuppliers (com.landawn.abacus.util.Fn.LongSuppliers)
Utility class providing commonly used {@code LongSupplier} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
ofCurrentTimeMillis(...) -> LongSupplier
-
Signature:
public static LongSupplier ofCurrentTimeMillis() - Summary: Returns a LongSupplier that supplies the current time in milliseconds.
-
Parameters:
- (none)
- Returns: a LongSupplier that returns System.currentTimeMillis()
Public Instance Methods
- (none)
Class Predicates (com.landawn.abacus.util.Fn.Predicates)
Utility class providing various Predicate implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
indexed(...) -> Predicate<T>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Predicate<T> indexed(final IntObjPredicate<T> predicate) throws IllegalArgumentException - Summary: Returns a stateful Predicate that tests elements based on their index position.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
predicate(IntObjPredicate<T>) — the IntObjPredicate that accepts an index and element for testing
-
- Returns: a stateful Predicate that applies the given IntObjPredicate with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
distinct(...) -> Predicate<T>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Predicate<T> distinct() - Summary: Returns a stateful Predicate that maintains a set of seen elements and returns {@code true} only for distinct elements.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful Predicate that returns {@code true} for first occurrence of each distinct element
distinctBy(...) -> Predicate<T>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Predicate<T> distinctBy(final java.util.function.Function<? super T, ?> mapper) - Summary: Returns a stateful Predicate that maintains distinct elements based on a key extracted by the mapper function.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
mapper(java.util.function.Function<? super T, ?>) — the function to extract the key for distinctness comparison
-
- Returns: a stateful Predicate that returns {@code true} for elements with distinct mapped keys
concurrentDistinct(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> concurrentDistinct() - Summary: Returns a stateful Predicate that maintains a concurrent set of seen elements and returns {@code true} only for distinct elements.
-
Contract:
- This method is marked as Beta and Stateful, indicating it should not be saved or cached for reuse.
-
Parameters:
- (none)
- Returns: a stateful thread-safe Predicate that returns {@code true} for first occurrence of each distinct element
concurrentDistinctBy(...) -> Predicate<T>
-
Signature:
@Beta @Stateful public static <T> Predicate<T> concurrentDistinctBy(final java.util.function.Function<? super T, ?> mapper) - Summary: Returns a stateful Predicate that maintains distinct elements based on a key extracted by the mapper function.
-
Contract:
- This method is marked as Beta and Stateful, indicating it should not be saved or cached for reuse.
-
Parameters:
-
mapper(java.util.function.Function<? super T, ?>) — the function to extract the key for distinctness comparison
-
- Returns: a stateful thread-safe Predicate that returns {@code true} for elements with distinct mapped keys
skipRepeats(...) -> Predicate<T>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Predicate<T> skipRepeats() - Summary: Returns a stateful Predicate that removes continuous repeat elements.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful Predicate that returns {@code true} for elements different from their immediate predecessor
Public Instance Methods
- (none)
Class BiPredicates (com.landawn.abacus.util.Fn.BiPredicates)
Utility class providing various BiPredicate implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
alwaysTrue(...) -> BiPredicate<T, U>
-
Signature:
public static <T, U> BiPredicate<T, U> alwaysTrue() - Summary: Returns a BiPredicate that always returns {@code true} regardless of input.
-
Parameters:
- (none)
- Returns: a BiPredicate that always returns true
alwaysFalse(...) -> BiPredicate<T, U>
-
Signature:
public static <T, U> BiPredicate<T, U> alwaysFalse() - Summary: Returns a BiPredicate that always returns {@code false} regardless of input.
-
Parameters:
- (none)
- Returns: a BiPredicate that always returns false
indexed(...) -> BiPredicate<T, U>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T, U> BiPredicate<T, U> indexed(final IntBiObjPredicate<T, U> predicate) throws IllegalArgumentException - Summary: Returns a stateful BiPredicate that tests elements based on their index position.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
predicate(IntBiObjPredicate<T, U>) — the IntBiObjPredicate that accepts an index and two elements for testing
-
- Returns: a stateful BiPredicate that applies the given IntBiObjPredicate with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
Public Instance Methods
- (none)
Class TriPredicates (com.landawn.abacus.util.Fn.TriPredicates)
Utility class providing various TriPredicate implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
alwaysTrue(...) -> TriPredicate<A, B, C>
-
Signature:
public static <A, B, C> TriPredicate<A, B, C> alwaysTrue() - Summary: Returns a TriPredicate that always returns {@code true} regardless of input.
-
Parameters:
- (none)
- Returns: a TriPredicate that always returns true
alwaysFalse(...) -> TriPredicate<A, B, C>
-
Signature:
public static <A, B, C> TriPredicate<A, B, C> alwaysFalse() - Summary: Returns a TriPredicate that always returns {@code false} regardless of input.
-
Parameters:
- (none)
- Returns: a TriPredicate that always returns false
Public Instance Methods
- (none)
Class Consumers (com.landawn.abacus.util.Fn.Consumers)
Utility class providing various Consumer implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
indexed(...) -> Consumer<T>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> Consumer<T> indexed(final IntObjConsumer<T> action) throws IllegalArgumentException - Summary: Returns a stateful Consumer that accepts elements based on their index position.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
action(IntObjConsumer<T>) — the IntObjConsumer that accepts an index and element
-
- Returns: a stateful Consumer that applies the given IntObjConsumer with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if action is null
-
Public Instance Methods
- (none)
Class BiConsumers (com.landawn.abacus.util.Fn.BiConsumers)
Utility class providing various BiConsumer implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
doNothing(...) -> BiConsumer<T, U>
-
Signature:
public static <T, U> BiConsumer<T, U> doNothing() - Summary: Returns a BiConsumer that does nothing.
-
Parameters:
- (none)
- Returns: a BiConsumer that performs no operation
ofAdd(...) -> BiConsumer<C, T>
-
Signature:
public static <T, C extends Collection<? super T>> BiConsumer<C, T> ofAdd() - Summary: Returns a BiConsumer that adds an element to a collection.
-
Parameters:
- (none)
- Returns: a BiConsumer that adds the second argument to the first argument collection
ofAddAll(...) -> BiConsumer<C, C>
-
Signature:
public static <T, C extends Collection<T>> BiConsumer<C, C> ofAddAll() - Summary: Returns a BiConsumer that adds all elements from one collection to another.
-
Parameters:
- (none)
- Returns: a BiConsumer that adds all elements from the second collection to the first collection
ofAddAlll(...) -> BiConsumer<T, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends PrimitiveList> BiConsumer<T, T> ofAddAlll() - Summary: Returns a BiConsumer that adds all elements from one PrimitiveList to another.
-
Parameters:
- (none)
- Returns: a BiConsumer that adds all elements from the second PrimitiveList to the first PrimitiveList
ofRemove(...) -> BiConsumer<C, T>
-
Signature:
public static <T, C extends Collection<? super T>> BiConsumer<C, T> ofRemove() - Summary: Returns a BiConsumer that removes an element from a collection.
-
Parameters:
- (none)
- Returns: a BiConsumer that removes the second argument from the first argument collection
ofRemoveAll(...) -> BiConsumer<C, C>
-
Signature:
public static <T, C extends Collection<T>> BiConsumer<C, C> ofRemoveAll() - Summary: Returns a BiConsumer that removes all elements of one collection from another.
-
Parameters:
- (none)
- Returns: a BiConsumer that removes all elements in the second collection from the first collection
ofRemoveAlll(...) -> BiConsumer<T, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends PrimitiveList> BiConsumer<T, T> ofRemoveAlll() - Summary: Returns a BiConsumer that removes all elements of one PrimitiveList from another.
-
Parameters:
- (none)
- Returns: a BiConsumer that removes all elements in the second PrimitiveList from the first PrimitiveList
ofPut(...) -> BiConsumer<M, E>
-
Signature:
public static <K, V, M extends Map<K, V>, E extends Map.Entry<K, V>> BiConsumer<M, E> ofPut() - Summary: Returns a BiConsumer that puts a Map.Entry into a Map.
-
Parameters:
- (none)
- Returns: a BiConsumer that puts the entry into the map
ofPutAll(...) -> BiConsumer<M, M>
-
Signature:
public static <K, V, M extends Map<K, V>> BiConsumer<M, M> ofPutAll() - Summary: Returns a BiConsumer that puts all entries from one map into another.
-
Parameters:
- (none)
- Returns: a BiConsumer that puts all entries from the second map into the first map
ofRemoveByKey(...) -> BiConsumer<M, K>
-
Signature:
public static <K, V, M extends Map<K, V>> BiConsumer<M, K> ofRemoveByKey() - Summary: Returns a BiConsumer that removes an entry from a map by key.
-
Parameters:
- (none)
- Returns: a BiConsumer that removes the entry with the given key from the map
ofMerge(...) -> BiConsumer<Joiner, Joiner>
-
Signature:
public static BiConsumer<Joiner, Joiner> ofMerge() - Summary: Returns a BiConsumer that merges two Joiner instances.
-
Parameters:
- (none)
- Returns: a BiConsumer that merges the second Joiner into the first Joiner
ofAppend(...) -> BiConsumer<StringBuilder, T>
-
Signature:
public static <T> BiConsumer<StringBuilder, T> ofAppend() - Summary: Returns a BiConsumer that appends an object to a StringBuilder.
-
Parameters:
- (none)
- Returns: a BiConsumer that appends the second argument to the first argument StringBuilder
indexed(...) -> BiConsumer<T, U>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T, U> BiConsumer<T, U> indexed(final IntBiObjConsumer<T, U> action) throws IllegalArgumentException - Summary: Returns a stateful BiConsumer that accepts elements based on their index position.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
action(IntBiObjConsumer<T, U>) — the IntBiObjConsumer that accepts an index and two elements
-
- Returns: a stateful BiConsumer that applies the given IntBiObjConsumer with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if action is null
-
Public Instance Methods
- (none)
Class TriConsumers (com.landawn.abacus.util.Fn.TriConsumers)
Utility class providing various TriConsumer implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Functions (com.landawn.abacus.util.Fn.Functions)
Utility class providing various Function implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
indexed(...) -> Function<T, R>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T, R> Function<T, R> indexed(final IntObjFunction<T, ? extends R> func) throws IllegalArgumentException - Summary: Returns a stateful Function that applies a function based on element index position.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
func(IntObjFunction<T, ? extends R>) — the IntObjFunction that accepts an index and element and produces a result
-
- Returns: a stateful Function that applies the given IntObjFunction with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
Public Instance Methods
- (none)
Class BiFunctions (com.landawn.abacus.util.Fn.BiFunctions)
Utility class providing various BiFunction implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
selectFirst(...) -> BiFunction<T, U, T>
-
Signature:
public static <T, U> BiFunction<T, U, T> selectFirst() - Summary: Returns a BiFunction that always returns the first argument.
-
Parameters:
- (none)
- Returns: a BiFunction that returns the first argument
selectSecond(...) -> BiFunction<T, U, U>
-
Signature:
public static <T, U> BiFunction<T, U, U> selectSecond() - Summary: Returns a BiFunction that always returns the second argument.
-
Parameters:
- (none)
- Returns: a BiFunction that returns the second argument
ofAdd(...) -> BiFunction<C, T, C>
-
Signature:
public static <T, C extends Collection<? super T>> BiFunction<C, T, C> ofAdd() - Summary: Returns a BiFunction that adds an element to a collection and returns the collection.
-
Parameters:
- (none)
- Returns: a BiFunction that adds the second argument to the first argument collection and returns the collection
ofAddAll(...) -> BiFunction<C, C, C>
-
Signature:
public static <T, C extends Collection<T>> BiFunction<C, C, C> ofAddAll() - Summary: Returns a BiFunction that adds all elements from one collection to another and returns the target collection.
-
Parameters:
- (none)
- Returns: a BiFunction that adds all elements from the second collection to the first and returns the first collection
ofAddAlll(...) -> BiFunction<T, T, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends PrimitiveList> BiFunction<T, T, T> ofAddAlll() - Summary: Returns a BiFunction that adds all elements from one PrimitiveList to another and returns the target list.
-
Parameters:
- (none)
- Returns: a BiFunction that adds all elements from the second PrimitiveList to the first and returns the first list
ofRemove(...) -> BiFunction<C, T, C>
-
Signature:
public static <T, C extends Collection<? super T>> BiFunction<C, T, C> ofRemove() - Summary: Returns a BiFunction that removes an element from a collection and returns the collection.
-
Parameters:
- (none)
- Returns: a BiFunction that removes the second argument from the first argument collection and returns the collection
ofRemoveAll(...) -> BiFunction<C, C, C>
-
Signature:
public static <T, C extends Collection<T>> BiFunction<C, C, C> ofRemoveAll() - Summary: Returns a BiFunction that removes all elements of one collection from another and returns the target collection.
-
Parameters:
- (none)
- Returns: a BiFunction that removes all elements in the second collection from the first and returns the first collection
ofRemoveAlll(...) -> BiFunction<T, T, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends PrimitiveList> BiFunction<T, T, T> ofRemoveAlll() - Summary: Returns a BiFunction that removes all elements of one PrimitiveList from another and returns the target list.
-
Parameters:
- (none)
- Returns: a BiFunction that removes all elements in the second PrimitiveList from the first and returns the first list
ofPut(...) -> BiFunction<M, E, M>
-
Signature:
public static <K, V, M extends Map<K, V>, E extends Map.Entry<K, V>> BiFunction<M, E, M> ofPut() - Summary: Returns a BiFunction that puts a Map.Entry into a Map and returns the map.
-
Parameters:
- (none)
- Returns: a BiFunction that puts the entry into the map and returns the map
ofPutAll(...) -> BiFunction<M, M, M>
-
Signature:
public static <K, V, M extends Map<K, V>> BiFunction<M, M, M> ofPutAll() - Summary: Returns a BiFunction that puts all entries from one map into another and returns the target map.
-
Parameters:
- (none)
- Returns: a BiFunction that puts all entries from the second map into the first and returns the first map
ofRemoveByKey(...) -> BiFunction<M, K, M>
-
Signature:
public static <K, V, M extends Map<K, V>> BiFunction<M, K, M> ofRemoveByKey() - Summary: Returns a BiFunction that removes an entry from a map by key and returns the map.
-
Parameters:
- (none)
- Returns: a BiFunction that removes the entry with the given key from the map and returns the map
ofMerge(...) -> BiFunction<Joiner, Joiner, Joiner>
-
Signature:
public static BiFunction<Joiner, Joiner, Joiner> ofMerge() - Summary: Returns a BiFunction that merges two Joiner instances and returns the result.
-
Parameters:
- (none)
- Returns: a BiFunction that merges the second Joiner into the first and returns the result
ofAppend(...) -> BiFunction<StringBuilder, T, StringBuilder>
-
Signature:
public static <T> BiFunction<StringBuilder, T, StringBuilder> ofAppend() - Summary: Returns a BiFunction that appends an object to a StringBuilder and returns the StringBuilder.
-
Parameters:
- (none)
- Returns: a BiFunction that appends the second argument to the first argument StringBuilder and returns the StringBuilder
indexed(...) -> BiFunction<T, U, R>
-
Signature:
@Beta @SequentialOnly @Stateful public static <T, U, R> BiFunction<T, U, R> indexed(final IntBiObjFunction<T, U, ? extends R> func) throws IllegalArgumentException - Summary: Returns a stateful BiFunction that applies a function based on element index position.
-
Contract:
- <p> <b> Important: </b> This method is marked as {@code @Beta} , {@code @SequentialOnly} , and {@code @Stateful} , indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
func(IntBiObjFunction<T, U, ? extends R>) — the IntBiObjFunction that accepts an index and two elements and produces a result
-
- Returns: a stateful BiFunction that applies the given IntBiObjFunction with an incrementing index
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
Public Instance Methods
- (none)
Class TriFunctions (com.landawn.abacus.util.Fn.TriFunctions)
Utility class providing various TriFunction implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class BinaryOperators (com.landawn.abacus.util.Fn.BinaryOperators)
Utility class providing various BinaryOperator implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
ofAddAll(...) -> BinaryOperator<C>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <T, C extends Collection<T>> BinaryOperator<C> ofAddAll() - Summary: Returns a BinaryOperator that adds all elements from the second collection to the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds all elements from the second collection to the first and returns the first
ofAddAllToFirst(...) -> BinaryOperator<C>
-
Signature:
@SuppressWarnings("unchecked") public static <T, C extends Collection<T>> BinaryOperator<C> ofAddAllToFirst() - Summary: Returns a BinaryOperator that adds all elements from the second collection to the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds all elements from the second collection to the first and returns the first
ofAddAllToBigger(...) -> BinaryOperator<C>
-
Signature:
@SuppressWarnings("unchecked") public static <T, C extends Collection<T>> BinaryOperator<C> ofAddAllToBigger() - Summary: Returns a BinaryOperator that adds all elements to the bigger collection.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds all elements to the bigger collection and returns it
ofRemoveAll(...) -> BinaryOperator<C>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <T, C extends Collection<T>> BinaryOperator<C> ofRemoveAll() - Summary: Returns a BinaryOperator that removes all elements of the second collection from the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that removes all elements of the second collection from the first and returns the first
ofRemoveAllFromFirst(...) -> BinaryOperator<C>
-
Signature:
@SuppressWarnings("unchecked") public static <T, C extends Collection<T>> BinaryOperator<C> ofRemoveAllFromFirst() - Summary: Returns a BinaryOperator that removes all elements of the second collection from the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that removes all elements of the second collection from the first and returns the first
ofPutAll(...) -> BinaryOperator<M>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <K, V, M extends Map<K, V>> BinaryOperator<M> ofPutAll() - Summary: Returns a BinaryOperator that puts all entries from the second map into the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that puts all entries from the second map into the first and returns the first
ofPutAllToFirst(...) -> BinaryOperator<M>
-
Signature:
@SuppressWarnings("unchecked") public static <K, V, M extends Map<K, V>> BinaryOperator<M> ofPutAllToFirst() - Summary: Returns a BinaryOperator that puts all entries from the second map into the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that puts all entries from the second map into the first and returns the first
ofPutAllToBigger(...) -> BinaryOperator<M>
-
Signature:
@SuppressWarnings("unchecked") public static <K, V, M extends Map<K, V>> BinaryOperator<M> ofPutAllToBigger() - Summary: Returns a BinaryOperator that puts all entries into the bigger map.
-
Parameters:
- (none)
- Returns: a BinaryOperator that puts all entries into the bigger map and returns it
ofMerge(...) -> BinaryOperator<Joiner>
-
Signature:
@Deprecated public static BinaryOperator<Joiner> ofMerge() - Summary: Returns a BinaryOperator that merges two Joiners.
-
Parameters:
- (none)
- Returns: a BinaryOperator that merges the second Joiner into the first and returns the first
ofMergeToFirst(...) -> BinaryOperator<Joiner>
-
Signature:
public static BinaryOperator<Joiner> ofMergeToFirst() - Summary: Returns a BinaryOperator that merges the second Joiner into the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that merges the second Joiner into the first and returns the first
ofMergeToBigger(...) -> BinaryOperator<Joiner>
-
Signature:
public static BinaryOperator<Joiner> ofMergeToBigger() - Summary: Returns a BinaryOperator that merges to the bigger Joiner.
-
Parameters:
- (none)
- Returns: a BinaryOperator that merges to the bigger Joiner and returns it
ofAppend(...) -> BinaryOperator<StringBuilder>
-
Signature:
@Deprecated public static BinaryOperator<StringBuilder> ofAppend() - Summary: Returns a BinaryOperator that appends the second StringBuilder to the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that appends the second StringBuilder to the first and returns the first
ofAppendToFirst(...) -> BinaryOperator<StringBuilder>
-
Signature:
public static BinaryOperator<StringBuilder> ofAppendToFirst() - Summary: Returns a BinaryOperator that appends the second StringBuilder to the first.
-
Parameters:
- (none)
- Returns: a BinaryOperator that appends the second StringBuilder to the first and returns the first
ofAppendToBigger(...) -> BinaryOperator<StringBuilder>
-
Signature:
public static BinaryOperator<StringBuilder> ofAppendToBigger() - Summary: Returns a BinaryOperator that appends to the bigger StringBuilder.
-
Parameters:
- (none)
- Returns: a BinaryOperator that appends to the bigger StringBuilder and returns it
ofConcat(...) -> BinaryOperator<String>
-
Signature:
public static BinaryOperator<String> ofConcat() - Summary: Returns a BinaryOperator that concatenates two strings.
-
Parameters:
- (none)
- Returns: a BinaryOperator that concatenates two strings
ofAddInt(...) -> BinaryOperator<Integer>
-
Signature:
public static BinaryOperator<Integer> ofAddInt() - Summary: Returns a BinaryOperator that adds two Integer values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds two Integer values
ofAddLong(...) -> BinaryOperator<Long>
-
Signature:
public static BinaryOperator<Long> ofAddLong() - Summary: Returns a BinaryOperator that adds two Long values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds two Long values
ofAddDouble(...) -> BinaryOperator<Double>
-
Signature:
public static BinaryOperator<Double> ofAddDouble() - Summary: Returns a BinaryOperator that adds two Double values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds two Double values
ofAddBigInteger(...) -> BinaryOperator<BigInteger>
-
Signature:
public static BinaryOperator<BigInteger> ofAddBigInteger() - Summary: Returns a BinaryOperator that adds two BigInteger values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds two BigInteger values
ofAddBigDecimal(...) -> BinaryOperator<BigDecimal>
-
Signature:
public static BinaryOperator<BigDecimal> ofAddBigDecimal() - Summary: Returns a BinaryOperator that adds two BigDecimal values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that adds two BigDecimal values
Public Instance Methods
- (none)
Class UnaryOperators (com.landawn.abacus.util.Fn.UnaryOperators)
Utility class providing various UnaryOperator implementations and factory methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> UnaryOperator<T>
-
Signature:
public static <T> UnaryOperator<T> identity() - Summary: Returns a UnaryOperator that always returns its input argument unchanged.
-
Parameters:
- (none)
- Returns: a UnaryOperator that returns its input argument
Public Instance Methods
- (none)
Class Entries (com.landawn.abacus.util.Fn.Entries)
Utility class providing functions for working with Map.Entry objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
f(...) -> Function<Map.Entry<K, V>, T>
-
Signature:
public static <K, V, T> Function<Map.Entry<K, V>, T> f(final java.util.function.BiFunction<? super K, ? super V, ? extends T> f) throws IllegalArgumentException - Summary: Adapts a BiFunction to work with Map.Entry by extracting key and value.
-
Parameters:
-
f(java.util.function.BiFunction<? super K, ? super V, ? extends T>) — the BiFunction to adapt
-
- Returns: a Function that extracts key and value from an entry and applies the BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
p(...) -> Predicate<Map.Entry<K, V>>
-
Signature:
public static <K, V> Predicate<Map.Entry<K, V>> p(final java.util.function.BiPredicate<? super K, ? super V> p) throws IllegalArgumentException - Summary: Adapts a BiPredicate to work with Map.Entry by extracting key and value.
-
Parameters:
-
p(java.util.function.BiPredicate<? super K, ? super V>) — the BiPredicate to adapt
-
- Returns: a Predicate that extracts key and value from an entry and applies the BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
c(...) -> Consumer<Map.Entry<K, V>>
-
Signature:
public static <K, V> Consumer<Map.Entry<K, V>> c(final java.util.function.BiConsumer<? super K, ? super V> c) throws IllegalArgumentException - Summary: Adapts a BiConsumer to work with Map.Entry by extracting key and value.
-
Parameters:
-
c(java.util.function.BiConsumer<? super K, ? super V>) — the BiConsumer to adapt
-
- Returns: a Consumer that extracts key and value from an entry and applies the BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
ef(...) -> Throwables.Function<Map.Entry<K, V>, T, E>
-
Signature:
@Beta public static <K, V, T, E extends Exception> Throwables.Function<Map.Entry<K, V>, T, E> ef( final Throwables.BiFunction<? super K, ? super V, ? extends T, E> f) throws IllegalArgumentException - Summary: Adapts a Throwables.BiFunction to work with Map.Entry by extracting key and value.
-
Parameters:
-
f(Throwables.BiFunction<? super K, ? super V, ? extends T, E>) — the Throwables.BiFunction to adapt
-
- Returns: a Throwables.Function that extracts key and value from an entry and applies the BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
ep(...) -> Throwables.Predicate<Map.Entry<K, V>, E>
-
Signature:
@Beta public static <K, V, E extends Exception> Throwables.Predicate<Map.Entry<K, V>, E> ep(final Throwables.BiPredicate<? super K, ? super V, E> p) throws IllegalArgumentException - Summary: Adapts a Throwables.BiPredicate to work with Map.Entry by extracting key and value.
-
Parameters:
-
p(Throwables.BiPredicate<? super K, ? super V, E>) — the Throwables.BiPredicate to adapt
-
- Returns: a Throwables.Predicate that extracts key and value from an entry and applies the BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
ec(...) -> Throwables.Consumer<Map.Entry<K, V>, E>
-
Signature:
@Beta public static <K, V, E extends Exception> Throwables.Consumer<Map.Entry<K, V>, E> ec(final Throwables.BiConsumer<? super K, ? super V, E> c) throws IllegalArgumentException - Summary: Adapts a Throwables.BiConsumer to work with Map.Entry by extracting key and value.
-
Parameters:
-
c(Throwables.BiConsumer<? super K, ? super V, E>) — the Throwables.BiConsumer to adapt
-
- Returns: a Throwables.Consumer that extracts key and value from an entry and applies the BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
ff(...) -> Function<Map.Entry<K, V>, T>
-
Signature:
public static <K, V, T> Function<Map.Entry<K, V>, T> ff(final Throwables.BiFunction<? super K, ? super V, ? extends T, ? extends Exception> f) throws IllegalArgumentException - Summary: Adapts a Throwables.BiFunction to work with Map.Entry by extracting key and value, wrapping exceptions.
-
Parameters:
-
f(Throwables.BiFunction<? super K, ? super V, ? extends T, ? extends Exception>) — the Throwables.BiFunction to adapt
-
- Returns: a Function that extracts key and value from an entry and applies the BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
pp(...) -> Predicate<Map.Entry<K, V>>
-
Signature:
public static <K, V> Predicate<Map.Entry<K, V>> pp(final Throwables.BiPredicate<? super K, ? super V, ? extends Exception> p) throws IllegalArgumentException - Summary: Adapts a Throwables.BiPredicate to work with Map.Entry by extracting key and value, wrapping exceptions.
-
Parameters:
-
p(Throwables.BiPredicate<? super K, ? super V, ? extends Exception>) — the Throwables.BiPredicate to adapt
-
- Returns: a Predicate that extracts key and value from an entry and applies the BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
cc(...) -> Consumer<Map.Entry<K, V>>
-
Signature:
public static <K, V> Consumer<Map.Entry<K, V>> cc(final Throwables.BiConsumer<? super K, ? super V, ? extends Exception> c) throws IllegalArgumentException - Summary: Adapts a Throwables.BiConsumer to work with Map.Entry by extracting key and value, wrapping exceptions.
-
Parameters:
-
c(Throwables.BiConsumer<? super K, ? super V, ? extends Exception>) — the Throwables.BiConsumer to adapt
-
- Returns: a Consumer that extracts key and value from an entry and applies the BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
Public Instance Methods
- (none)
Class Pairs (com.landawn.abacus.util.Fn.Pairs)
Utility class providing functions for working with Pair objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toList(...) -> Function<Pair<T, T>, List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Pair<T, T>, List<T>> toList() - Summary: Returns a Function that converts a Pair into a List containing its two elements.
-
Parameters:
- (none)
- Returns: a Function that converts a Pair < T,T > to a List < T >
toSet(...) -> Function<Pair<T, T>, Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Pair<T, T>, Set<T>> toSet() - Summary: Returns a Function that converts a Pair into a Set containing its two elements.
-
Contract:
- If both elements are equal, the set will contain only one element.
-
Parameters:
- (none)
- Returns: a Function that converts a Pair < T,T > to a Set < T >
Public Instance Methods
- (none)
Class Triples (com.landawn.abacus.util.Fn.Triples)
Utility class providing functions for working with Triple objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toList(...) -> Function<Triple<T, T, T>, List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Triple<T, T, T>, List<T>> toList() - Summary: Returns a Function that converts a Triple into a List containing its three elements.
-
Parameters:
- (none)
- Returns: a Function that converts a Triple < T,T,T > to a List < T >
toSet(...) -> Function<Triple<T, T, T>, Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Function<Triple<T, T, T>, Set<T>> toSet() - Summary: Returns a Function that converts a Triple into a Set containing its three elements.
-
Parameters:
- (none)
- Returns: a Function that converts a Triple < T,T,T > to a Set < T >
Public Instance Methods
- (none)
Class Disposables (com.landawn.abacus.util.Fn.Disposables)
Utility class providing functions for working with DisposableArray objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
cloneArray(...) -> Function<A, T\[\]>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, A extends DisposableArray<T>> Function<A, T[]> cloneArray() - Summary: Returns a Function that creates a copy of a DisposableArray's underlying array.
-
Parameters:
- (none)
- Returns: a Function that copies the DisposableArray's content to a new array
toStr(...) -> Function<A, String>
-
Signature:
@SuppressWarnings("rawtypes") public static <A extends DisposableArray> Function<A, String> toStr() - Summary: Returns a Function that converts a DisposableArray to its string representation.
-
Parameters:
- (none)
- Returns: a Function that converts a DisposableArray to String
join(...) -> Function<A, String>
-
Signature:
@SuppressWarnings("rawtypes") public static <A extends DisposableArray> Function<A, String> join(final String delimiter) - Summary: Returns a Function that joins the elements of a DisposableArray with the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to be used between each element
-
- Returns: a Function that joins the DisposableArray elements with the delimiter
Public Instance Methods
- (none)
Class FC (com.landawn.abacus.util.Fn.FC)
Utility class for CharPredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
isZero(...) -> CharPredicate
-
Signature:
public static CharPredicate isZero() - Summary: Returns a CharPredicate that tests if a character is zero.
-
Contract:
- Returns a CharPredicate that tests if a character is zero.
-
Parameters:
- (none)
- Returns: a CharPredicate that returns {@code true} if the character is <i> \\0 </i>
isWhitespace(...) -> CharPredicate
-
Signature:
public static CharPredicate isWhitespace() - Summary: Returns a CharPredicate that tests if a character is whitespace.
-
Contract:
- Returns a CharPredicate that tests if a character is whitespace.
-
Parameters:
- (none)
- Returns: a CharPredicate that returns {@code true} if the character is whitespace
equal(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate equal() - Summary: Returns a CharBiPredicate that tests if two characters are equal.
-
Contract:
- Returns a CharBiPredicate that tests if two characters are equal.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the two characters are equal
notEqual(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate notEqual() - Summary: Returns a CharBiPredicate that tests if two characters are not equal.
-
Contract:
- Returns a CharBiPredicate that tests if two characters are not equal.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the two characters are not equal
greaterThan(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate greaterThan() - Summary: Returns a CharBiPredicate that tests if the first character is greater than the second.
-
Contract:
- Returns a CharBiPredicate that tests if the first character is greater than the second.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the first character is greater than the second
greaterEqual(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate greaterEqual() - Summary: Returns a CharBiPredicate that tests if the first character is greater than or equal to the second.
-
Contract:
- Returns a CharBiPredicate that tests if the first character is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the first character is greater than or equal to the second
lessThan(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate lessThan() - Summary: Returns a CharBiPredicate that tests if the first character is less than the second.
-
Contract:
- Returns a CharBiPredicate that tests if the first character is less than the second.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the first character is less than the second
lessEqual(...) -> CharBiPredicate
-
Signature:
public static CharBiPredicate lessEqual() - Summary: Returns a CharBiPredicate that tests if the first character is less than or equal to the second.
-
Contract:
- Returns a CharBiPredicate that tests if the first character is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a CharBiPredicate that returns {@code true} if the first character is less than or equal to the second
unbox(...) -> ToCharFunction<Character>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToCharFunction<Character> unbox() - Summary: Returns a ToCharFunction that converts a Character object to a primitive char.
-
Parameters:
- (none)
- Returns: a ToCharFunction that unboxes Character to char
p(...) -> CharPredicate
-
Signature:
public static CharPredicate p(final CharPredicate p) throws IllegalArgumentException - Summary: Returns the provided CharPredicate as-is.
-
Parameters:
-
p(CharPredicate) — the CharPredicate to return
-
- Returns: the same CharPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> CharFunction<R>
-
Signature:
public static <R> CharFunction<R> f(final CharFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided CharFunction as-is.
-
Parameters:
-
f(CharFunction<R>) — the CharFunction to return
-
- Returns: the same CharFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> CharConsumer
-
Signature:
public static CharConsumer c(final CharConsumer c) throws IllegalArgumentException - Summary: Returns the provided CharConsumer as-is.
-
Parameters:
-
c(CharConsumer) — the CharConsumer to return
-
- Returns: the same CharConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<char\[\], Integer>
-
Signature:
public static Function<char[], Integer> len() - Summary: Returns a Function that calculates the length of a char array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a char array or 0 if null
alternate(...) -> CharBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static CharBiFunction<MergeResult> alternate() - Summary: Returns a stateful CharBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful CharBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class CharBinaryOperators (com.landawn.abacus.util.Fn.FC.CharBinaryOperators)
Utility class providing CharBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FB (com.landawn.abacus.util.Fn.FB)
Utility class for BytePredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> BytePredicate
-
Signature:
public static BytePredicate positive() - Summary: Returns a BytePredicate that tests if a byte value is positive (greater than zero).
-
Contract:
- Returns a BytePredicate that tests if a byte value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: a BytePredicate that returns {@code true} if the byte is greater than 0
notNegative(...) -> BytePredicate
-
Signature:
public static BytePredicate notNegative() - Summary: Returns a BytePredicate that tests if a byte value is not negative (greater than or equal to zero).
-
Contract:
- Returns a BytePredicate that tests if a byte value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: a BytePredicate that returns {@code true} if the byte is greater than or equal to 0
equal(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate equal() - Summary: Returns a ByteBiPredicate that tests if two byte values are equal.
-
Contract:
- Returns a ByteBiPredicate that tests if two byte values are equal.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the two bytes are equal
notEqual(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate notEqual() - Summary: Returns a ByteBiPredicate that tests if two byte values are not equal.
-
Contract:
- Returns a ByteBiPredicate that tests if two byte values are not equal.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the two bytes are not equal
greaterThan(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate greaterThan() - Summary: Returns a ByteBiPredicate that tests if the first byte is greater than the second.
-
Contract:
- Returns a ByteBiPredicate that tests if the first byte is greater than the second.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the first byte is greater than the second
greaterEqual(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate greaterEqual() - Summary: Returns a ByteBiPredicate that tests if the first byte is greater than or equal to the second.
-
Contract:
- Returns a ByteBiPredicate that tests if the first byte is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the first byte is greater than or equal to the second
lessThan(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate lessThan() - Summary: Returns a ByteBiPredicate that tests if the first byte is less than the second.
-
Contract:
- Returns a ByteBiPredicate that tests if the first byte is less than the second.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the first byte is less than the second
lessEqual(...) -> ByteBiPredicate
-
Signature:
public static ByteBiPredicate lessEqual() - Summary: Returns a ByteBiPredicate that tests if the first byte is less than or equal to the second.
-
Contract:
- Returns a ByteBiPredicate that tests if the first byte is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a ByteBiPredicate that returns {@code true} if the first byte is less than or equal to the second
unbox(...) -> ToByteFunction<Byte>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToByteFunction<Byte> unbox() - Summary: Returns a ToByteFunction that converts a Byte object to a primitive byte.
-
Parameters:
- (none)
- Returns: a ToByteFunction that unboxes Byte to byte
p(...) -> BytePredicate
-
Signature:
public static BytePredicate p(final BytePredicate p) throws IllegalArgumentException - Summary: Returns the provided BytePredicate as-is.
-
Parameters:
-
p(BytePredicate) — the BytePredicate to return
-
- Returns: the same BytePredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> ByteFunction<R>
-
Signature:
public static <R> ByteFunction<R> f(final ByteFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided ByteFunction as-is.
-
Parameters:
-
f(ByteFunction<R>) — the ByteFunction to return
-
- Returns: the same ByteFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> ByteConsumer
-
Signature:
public static ByteConsumer c(final ByteConsumer c) throws IllegalArgumentException - Summary: Returns the provided ByteConsumer as-is.
-
Parameters:
-
c(ByteConsumer) — the ByteConsumer to return
-
- Returns: the same ByteConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<byte\[\], Integer>
-
Signature:
public static Function<byte[], Integer> len() - Summary: Returns a Function that calculates the length of a byte array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a byte array or 0 if null
sum(...) -> Function<byte\[\], Integer>
-
Signature:
public static Function<byte[], Integer> sum() - Summary: Returns a Function that calculates the sum of all elements in a byte array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of byte array elements
average(...) -> Function<byte\[\], Double>
-
Signature:
public static Function<byte[], Double> average() - Summary: Returns a Function that calculates the average of all elements in a byte array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of byte array elements
alternate(...) -> ByteBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static ByteBiFunction<MergeResult> alternate() - Summary: Returns a stateful ByteBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful ByteBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class ByteBinaryOperators (com.landawn.abacus.util.Fn.FB.ByteBinaryOperators)
Utility class providing ByteBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FS (com.landawn.abacus.util.Fn.FS)
Utility class for ShortPredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> ShortPredicate
-
Signature:
public static ShortPredicate positive() - Summary: Returns a ShortPredicate that tests if a short value is positive (greater than zero).
-
Contract:
- Returns a ShortPredicate that tests if a short value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: a ShortPredicate that returns {@code true} if the short is greater than 0
notNegative(...) -> ShortPredicate
-
Signature:
public static ShortPredicate notNegative() - Summary: Returns a ShortPredicate that tests if a short value is not negative (greater than or equal to zero).
-
Contract:
- Returns a ShortPredicate that tests if a short value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: a ShortPredicate that returns {@code true} if the short is greater than or equal to 0
equal(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate equal() - Summary: Returns a ShortBiPredicate that tests if two short values are equal.
-
Contract:
- Returns a ShortBiPredicate that tests if two short values are equal.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the two shorts are equal
notEqual(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate notEqual() - Summary: Returns a ShortBiPredicate that tests if two short values are not equal.
-
Contract:
- Returns a ShortBiPredicate that tests if two short values are not equal.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the two shorts are not equal
greaterThan(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate greaterThan() - Summary: Returns a ShortBiPredicate that tests if the first short is greater than the second.
-
Contract:
- Returns a ShortBiPredicate that tests if the first short is greater than the second.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the first short is greater than the second
greaterEqual(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate greaterEqual() - Summary: Returns a ShortBiPredicate that tests if the first short is greater than or equal to the second.
-
Contract:
- Returns a ShortBiPredicate that tests if the first short is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the first short is greater than or equal to the second
lessThan(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate lessThan() - Summary: Returns a ShortBiPredicate that tests if the first short is less than the second.
-
Contract:
- Returns a ShortBiPredicate that tests if the first short is less than the second.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the first short is less than the second
lessEqual(...) -> ShortBiPredicate
-
Signature:
public static ShortBiPredicate lessEqual() - Summary: Returns a ShortBiPredicate that tests if the first short is less than or equal to the second.
-
Contract:
- Returns a ShortBiPredicate that tests if the first short is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a ShortBiPredicate that returns {@code true} if the first short is less than or equal to the second
unbox(...) -> ToShortFunction<Short>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToShortFunction<Short> unbox() - Summary: Returns a ToShortFunction that converts a Short object to a primitive short.
-
Parameters:
- (none)
- Returns: a ToShortFunction that unboxes Short to short
p(...) -> ShortPredicate
-
Signature:
public static ShortPredicate p(final ShortPredicate p) throws IllegalArgumentException - Summary: Returns the provided ShortPredicate as-is.
-
Parameters:
-
p(ShortPredicate) — the ShortPredicate to return
-
- Returns: the same ShortPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> ShortFunction<R>
-
Signature:
public static <R> ShortFunction<R> f(final ShortFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided ShortFunction as-is.
-
Parameters:
-
f(ShortFunction<R>) — the ShortFunction to return
-
- Returns: the same ShortFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> ShortConsumer
-
Signature:
public static ShortConsumer c(final ShortConsumer c) throws IllegalArgumentException - Summary: Returns the provided ShortConsumer as-is.
-
Parameters:
-
c(ShortConsumer) — the ShortConsumer to return
-
- Returns: the same ShortConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<short\[\], Integer>
-
Signature:
public static Function<short[], Integer> len() - Summary: Returns a Function that calculates the length of a short array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a short array or 0 if null
sum(...) -> Function<short\[\], Integer>
-
Signature:
public static Function<short[], Integer> sum() - Summary: Returns a Function that calculates the sum of all elements in a short array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of short array elements
average(...) -> Function<short\[\], Double>
-
Signature:
public static Function<short[], Double> average() - Summary: Returns a Function that calculates the average of all elements in a short array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of short array elements
alternate(...) -> ShortBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static ShortBiFunction<MergeResult> alternate() - Summary: Returns a stateful ShortBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful ShortBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class ShortBinaryOperators (com.landawn.abacus.util.Fn.FS.ShortBinaryOperators)
Utility class providing ShortBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FI (com.landawn.abacus.util.Fn.FI)
Utility class for IntPredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> IntPredicate
-
Signature:
public static IntPredicate positive() - Summary: Returns an IntPredicate that tests if an int value is positive (greater than zero).
-
Contract:
- Returns an IntPredicate that tests if an int value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: an IntPredicate that returns {@code true} if the int is greater than 0
notNegative(...) -> IntPredicate
-
Signature:
public static IntPredicate notNegative() - Summary: Returns an IntPredicate that tests if an int value is not negative (greater than or equal to zero).
-
Contract:
- Returns an IntPredicate that tests if an int value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: an IntPredicate that returns {@code true} if the int is greater than or equal to 0
equal(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate equal() - Summary: Returns an IntBiPredicate that tests if two int values are equal.
-
Contract:
- Returns an IntBiPredicate that tests if two int values are equal.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the two ints are equal
notEqual(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate notEqual() - Summary: Returns an IntBiPredicate that tests if two int values are not equal.
-
Contract:
- Returns an IntBiPredicate that tests if two int values are not equal.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the two ints are not equal
greaterThan(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate greaterThan() - Summary: Returns an IntBiPredicate that tests if the first int is greater than the second.
-
Contract:
- Returns an IntBiPredicate that tests if the first int is greater than the second.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the first int is greater than the second
greaterEqual(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate greaterEqual() - Summary: Returns an IntBiPredicate that tests if the first int is greater than or equal to the second.
-
Contract:
- Returns an IntBiPredicate that tests if the first int is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the first int is greater than or equal to the second
lessThan(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate lessThan() - Summary: Returns an IntBiPredicate that tests if the first int is less than the second.
-
Contract:
- Returns an IntBiPredicate that tests if the first int is less than the second.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the first int is less than the second
lessEqual(...) -> IntBiPredicate
-
Signature:
public static IntBiPredicate lessEqual() - Summary: Returns an IntBiPredicate that tests if the first int is less than or equal to the second.
-
Contract:
- Returns an IntBiPredicate that tests if the first int is less than or equal to the second.
-
Parameters:
- (none)
- Returns: an IntBiPredicate that returns {@code true} if the first int is less than or equal to the second
unbox(...) -> ToIntFunction<Integer>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToIntFunction<Integer> unbox() - Summary: Returns a ToIntFunction that converts an Integer object to a primitive int.
-
Parameters:
- (none)
- Returns: a ToIntFunction that unboxes Integer to int
p(...) -> IntPredicate
-
Signature:
public static IntPredicate p(final IntPredicate p) throws IllegalArgumentException - Summary: Returns the provided IntPredicate as-is.
-
Parameters:
-
p(IntPredicate) — the IntPredicate to return
-
- Returns: the same IntPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> IntFunction<R>
-
Signature:
public static <R> IntFunction<R> f(final IntFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided IntFunction as-is.
-
Parameters:
-
f(IntFunction<R>) — the IntFunction to return
-
- Returns: the same IntFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> IntConsumer
-
Signature:
public static IntConsumer c(final IntConsumer c) throws IllegalArgumentException - Summary: Returns the provided IntConsumer as-is.
-
Parameters:
-
c(IntConsumer) — the IntConsumer to return
-
- Returns: the same IntConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<int\[\], Integer>
-
Signature:
public static Function<int[], Integer> len() - Summary: Returns a Function that calculates the length of an int array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of an int array or 0 if null
sum(...) -> Function<int\[\], Integer>
-
Signature:
public static Function<int[], Integer> sum() - Summary: Returns a Function that calculates the sum of all elements in an int array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of int array elements
average(...) -> Function<int\[\], Double>
-
Signature:
public static Function<int[], Double> average() - Summary: Returns a Function that calculates the average of all elements in an int array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of int array elements
alternate(...) -> IntBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static IntBiFunction<MergeResult> alternate() - Summary: Returns a stateful IntBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful IntBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class IntBinaryOperators (com.landawn.abacus.util.Fn.FI.IntBinaryOperators)
Utility class providing IntBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FL (com.landawn.abacus.util.Fn.FL)
Utility class for LongPredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> LongPredicate
-
Signature:
public static LongPredicate positive() - Summary: Returns a LongPredicate that tests if a long value is positive (greater than zero).
-
Contract:
- Returns a LongPredicate that tests if a long value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: a LongPredicate that returns {@code true} if the long is greater than 0
notNegative(...) -> LongPredicate
-
Signature:
public static LongPredicate notNegative() - Summary: Returns a LongPredicate that tests if a long value is not negative (greater than or equal to zero).
-
Contract:
- Returns a LongPredicate that tests if a long value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: a LongPredicate that returns {@code true} if the long is greater than or equal to 0
equal(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate equal() - Summary: Returns a LongBiPredicate that tests if two long values are equal.
-
Contract:
- Returns a LongBiPredicate that tests if two long values are equal.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the two longs are equal
notEqual(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate notEqual() - Summary: Returns a LongBiPredicate that tests if two long values are not equal.
-
Contract:
- Returns a LongBiPredicate that tests if two long values are not equal.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the two longs are not equal
greaterThan(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate greaterThan() - Summary: Returns a LongBiPredicate that tests if the first long is greater than the second.
-
Contract:
- Returns a LongBiPredicate that tests if the first long is greater than the second.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the first long is greater than the second
greaterEqual(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate greaterEqual() - Summary: Returns a LongBiPredicate that tests if the first long is greater than or equal to the second.
-
Contract:
- Returns a LongBiPredicate that tests if the first long is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the first long is greater than or equal to the second
lessThan(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate lessThan() - Summary: Returns a LongBiPredicate that tests if the first long is less than the second.
-
Contract:
- Returns a LongBiPredicate that tests if the first long is less than the second.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the first long is less than the second
lessEqual(...) -> LongBiPredicate
-
Signature:
public static LongBiPredicate lessEqual() - Summary: Returns a LongBiPredicate that tests if the first long is less than or equal to the second.
-
Contract:
- Returns a LongBiPredicate that tests if the first long is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a LongBiPredicate that returns {@code true} if the first long is less than or equal to the second
unbox(...) -> ToLongFunction<Long>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToLongFunction<Long> unbox() - Summary: Returns a ToLongFunction that converts a Long object to a primitive long.
-
Parameters:
- (none)
- Returns: a ToLongFunction that unboxes Long to long
p(...) -> LongPredicate
-
Signature:
public static LongPredicate p(final LongPredicate p) throws IllegalArgumentException - Summary: Returns the provided LongPredicate as-is.
-
Parameters:
-
p(LongPredicate) — the LongPredicate to return
-
- Returns: the same LongPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> LongFunction<R>
-
Signature:
public static <R> LongFunction<R> f(final LongFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided LongFunction as-is.
-
Parameters:
-
f(LongFunction<R>) — the LongFunction to return
-
- Returns: the same LongFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> LongConsumer
-
Signature:
public static LongConsumer c(final LongConsumer c) throws IllegalArgumentException - Summary: Returns the provided LongConsumer as-is.
-
Parameters:
-
c(LongConsumer) — the LongConsumer to return
-
- Returns: the same LongConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<long\[\], Integer>
-
Signature:
public static Function<long[], Integer> len() - Summary: Returns a Function that calculates the length of a long array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a long array or 0 if null
sum(...) -> Function<long\[\], Long>
-
Signature:
public static Function<long[], Long> sum() - Summary: Returns a Function that calculates the sum of all elements in a long array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of long array elements
average(...) -> Function<long\[\], Double>
-
Signature:
public static Function<long[], Double> average() - Summary: Returns a Function that calculates the average of all elements in a long array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of long array elements
alternate(...) -> LongBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static LongBiFunction<MergeResult> alternate() - Summary: Returns a stateful LongBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful LongBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class LongBinaryOperators (com.landawn.abacus.util.Fn.FL.LongBinaryOperators)
Utility class providing LongBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FF (com.landawn.abacus.util.Fn.FF)
Utility class for FloatPredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> FloatPredicate
-
Signature:
public static FloatPredicate positive() - Summary: Returns a FloatPredicate that tests if a float value is positive (greater than zero).
-
Contract:
- Returns a FloatPredicate that tests if a float value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: a FloatPredicate that returns {@code true} if the float is greater than 0
notNegative(...) -> FloatPredicate
-
Signature:
public static FloatPredicate notNegative() - Summary: Returns a FloatPredicate that tests if a float value is not negative (greater than or equal to zero).
-
Contract:
- Returns a FloatPredicate that tests if a float value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: a FloatPredicate that returns {@code true} if the float is greater than or equal to 0
equal(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate equal() - Summary: Returns a FloatBiPredicate that tests if two float values are equal.
-
Contract:
- Returns a FloatBiPredicate that tests if two float values are equal.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the two floats are equal
notEqual(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate notEqual() - Summary: Returns a FloatBiPredicate that tests if two float values are not equal.
-
Contract:
- Returns a FloatBiPredicate that tests if two float values are not equal.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the two floats are not equal
greaterThan(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate greaterThan() - Summary: Returns a FloatBiPredicate that tests if the first float is greater than the second.
-
Contract:
- Returns a FloatBiPredicate that tests if the first float is greater than the second.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the first float is greater than the second
greaterEqual(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate greaterEqual() - Summary: Returns a FloatBiPredicate that tests if the first float is greater than or equal to the second.
-
Contract:
- Returns a FloatBiPredicate that tests if the first float is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the first float is greater than or equal to the second
lessThan(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate lessThan() - Summary: Returns a FloatBiPredicate that tests if the first float is less than the second.
-
Contract:
- Returns a FloatBiPredicate that tests if the first float is less than the second.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the first float is less than the second
lessEqual(...) -> FloatBiPredicate
-
Signature:
public static FloatBiPredicate lessEqual() - Summary: Returns a FloatBiPredicate that tests if the first float is less than or equal to the second.
-
Contract:
- Returns a FloatBiPredicate that tests if the first float is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a FloatBiPredicate that returns {@code true} if the first float is less than or equal to the second
unbox(...) -> ToFloatFunction<Float>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToFloatFunction<Float> unbox() - Summary: Returns a ToFloatFunction that converts a Float object to a primitive float.
-
Parameters:
- (none)
- Returns: a ToFloatFunction that unboxes Float to float
p(...) -> FloatPredicate
-
Signature:
public static FloatPredicate p(final FloatPredicate p) throws IllegalArgumentException - Summary: Returns the provided FloatPredicate as-is.
-
Parameters:
-
p(FloatPredicate) — the FloatPredicate to return
-
- Returns: the same FloatPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> FloatFunction<R>
-
Signature:
public static <R> FloatFunction<R> f(final FloatFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided FloatFunction as-is.
-
Parameters:
-
f(FloatFunction<R>) — the FloatFunction to return
-
- Returns: the same FloatFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> FloatConsumer
-
Signature:
public static FloatConsumer c(final FloatConsumer c) throws IllegalArgumentException - Summary: Returns the provided FloatConsumer as-is.
-
Parameters:
-
c(FloatConsumer) — the FloatConsumer to return
-
- Returns: the same FloatConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<float\[\], Integer>
-
Signature:
public static Function<float[], Integer> len() - Summary: Returns a Function that calculates the length of a float array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a float array or 0 if null
sum(...) -> Function<float\[\], Float>
-
Signature:
public static Function<float[], Float> sum() - Summary: Returns a Function that calculates the sum of all elements in a float array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of float array elements
average(...) -> Function<float\[\], Double>
-
Signature:
public static Function<float[], Double> average() - Summary: Returns a Function that calculates the average of all elements in a float array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of float array elements as a Double
alternate(...) -> FloatBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static FloatBiFunction<MergeResult> alternate() - Summary: Returns a stateful FloatBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful FloatBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class FloatBinaryOperators (com.landawn.abacus.util.Fn.FF.FloatBinaryOperators)
Utility class providing FloatBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class FD (com.landawn.abacus.util.Fn.FD)
Utility class for DoublePredicate/Function/Consumer operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
positive(...) -> DoublePredicate
-
Signature:
public static DoublePredicate positive() - Summary: Returns a DoublePredicate that tests if a double value is positive (greater than zero).
-
Contract:
- Returns a DoublePredicate that tests if a double value is positive (greater than zero).
-
Parameters:
- (none)
- Returns: a DoublePredicate that returns {@code true} if the double is greater than 0
notNegative(...) -> DoublePredicate
-
Signature:
public static DoublePredicate notNegative() - Summary: Returns a DoublePredicate that tests if a double value is not negative (greater than or equal to zero).
-
Contract:
- Returns a DoublePredicate that tests if a double value is not negative (greater than or equal to zero).
-
Parameters:
- (none)
- Returns: a DoublePredicate that returns {@code true} if the double is greater than or equal to 0
equal(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate equal() - Summary: Returns a DoubleBiPredicate that tests if two double values are equal.
-
Contract:
- Returns a DoubleBiPredicate that tests if two double values are equal.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the two doubles are equal
notEqual(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate notEqual() - Summary: Returns a DoubleBiPredicate that tests if two double values are not equal.
-
Contract:
- Returns a DoubleBiPredicate that tests if two double values are not equal.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the two doubles are not equal
greaterThan(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate greaterThan() - Summary: Returns a DoubleBiPredicate that tests if the first double is greater than the second.
-
Contract:
- Returns a DoubleBiPredicate that tests if the first double is greater than the second.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the first double is greater than the second
greaterEqual(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate greaterEqual() - Summary: Returns a DoubleBiPredicate that tests if the first double is greater than or equal to the second.
-
Contract:
- Returns a DoubleBiPredicate that tests if the first double is greater than or equal to the second.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the first double is greater than or equal to the second
lessThan(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate lessThan() - Summary: Returns a DoubleBiPredicate that tests if the first double is less than the second.
-
Contract:
- Returns a DoubleBiPredicate that tests if the first double is less than the second.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the first double is less than the second
lessEqual(...) -> DoubleBiPredicate
-
Signature:
public static DoubleBiPredicate lessEqual() - Summary: Returns a DoubleBiPredicate that tests if the first double is less than or equal to the second.
-
Contract:
- Returns a DoubleBiPredicate that tests if the first double is less than or equal to the second.
-
Parameters:
- (none)
- Returns: a DoubleBiPredicate that returns {@code true} if the first double is less than or equal to the second
unbox(...) -> ToDoubleFunction<Double>
-
Signature:
@SuppressWarnings("SameReturnValue") public static ToDoubleFunction<Double> unbox() - Summary: Returns a ToDoubleFunction that converts a Double object to a primitive double.
-
Parameters:
- (none)
- Returns: a ToDoubleFunction that unboxes Double to double
p(...) -> DoublePredicate
-
Signature:
public static DoublePredicate p(final DoublePredicate p) throws IllegalArgumentException - Summary: Returns the provided DoublePredicate as-is.
-
Parameters:
-
p(DoublePredicate) — the DoublePredicate to return
-
- Returns: the same DoublePredicate
-
Throws:
-
java.lang.IllegalArgumentException— if p is null
-
f(...) -> DoubleFunction<R>
-
Signature:
public static <R> DoubleFunction<R> f(final DoubleFunction<R> f) throws IllegalArgumentException - Summary: Returns the provided DoubleFunction as-is.
-
Parameters:
-
f(DoubleFunction<R>) — the DoubleFunction to return
-
- Returns: the same DoubleFunction
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
c(...) -> DoubleConsumer
-
Signature:
public static DoubleConsumer c(final DoubleConsumer c) throws IllegalArgumentException - Summary: Returns the provided DoubleConsumer as-is.
-
Parameters:
-
c(DoubleConsumer) — the DoubleConsumer to return
-
- Returns: the same DoubleConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if c is null
-
len(...) -> Function<double\[\], Integer>
-
Signature:
public static Function<double[], Integer> len() - Summary: Returns a Function that calculates the length of a double array.
-
Parameters:
- (none)
- Returns: a Function that returns the length of a double array or 0 if null
sum(...) -> Function<double\[\], Double>
-
Signature:
public static Function<double[], Double> sum() - Summary: Returns a Function that calculates the sum of all elements in a double array.
-
Parameters:
- (none)
- Returns: a Function that returns the sum of double array elements
average(...) -> Function<double\[\], Double>
-
Signature:
public static Function<double[], Double> average() - Summary: Returns a Function that calculates the average of all elements in a double array.
-
Parameters:
- (none)
- Returns: a Function that returns the average of double array elements
alternate(...) -> DoubleBiFunction<MergeResult>
-
Signature:
@Beta @SequentialOnly @Stateful public static DoubleBiFunction<MergeResult> alternate() - Summary: Returns a stateful DoubleBiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful DoubleBiFunction that alternates between merge results
Public Instance Methods
- (none)
Class DoubleBinaryOperators (com.landawn.abacus.util.Fn.FD.DoubleBinaryOperators)
Utility class providing DoubleBinaryOperator implementations for common operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Fnn (com.landawn.abacus.util.Fnn)
A comprehensive utility class providing static factory methods for creating and manipulating {@link Throwables} functional interfaces that can throw checked exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
memoize(...) -> Throwables.Supplier<T, E>
-
Signature:
public static <T, E extends Throwable> Throwables.Supplier<T, E> memoize(final Throwables.Supplier<T, E> supplier) - Summary: Returns a memoized Supplier that caches the result of the first invocation and returns the cached value on subsequent calls.
-
Contract:
- This is particularly useful for expensive initialization operations that should only execute once.
- <p> The returned supplier is <b> thread-safe </b> and guarantees that the underlying supplier is called at most once, even when accessed concurrently from multiple threads.
-
Parameters:
-
supplier(Throwables.Supplier<T, E>) — the supplier whose result should be memoized; must not be null
-
- Returns: a memoized version of the supplier that caches the result after the first call
- See also: #memoizeWithExpiration(Throwables.Supplier, long, TimeUnit), Throwables.LazyInitializer#of(Throwables.Supplier)
-
Signature:
public static <T, R, E extends Throwable> Throwables.Function<T, R, E> memoize(final Throwables.Function<? super T, ? extends R, E> func) - Summary: Returns a memoized version of the input Function that caches results for each distinct input value.
-
Parameters:
-
func(Throwables.Function<? super T, ? extends R, E>) — the function to memoize; must not be null
-
- Returns: a memoized version of the function that caches results by input value
- See also: #memoize(Throwables.Supplier), #memoizeWithExpiration(Throwables.Supplier, long, TimeUnit), ConcurrentHashMap
memoizeWithExpiration(...) -> Throwables.Supplier<T, E>
-
Signature:
public static <T, E extends Throwable> Throwables.Supplier<T, E> memoizeWithExpiration(final Throwables.Supplier<T, E> supplier, final long duration, final TimeUnit unit) throws IllegalArgumentException - Summary: Returns a memoized Supplier with time-based expiration that caches the supplied value for a specified duration.
-
Contract:
- </p> <p> <b> Exception Handling: </b> If the underlying supplier throws an exception, the value is not cached and subsequent calls will retry the computation.
-
Parameters:
-
supplier(Throwables.Supplier<T, E>) — the delegate supplier whose results should be memoized; must not be null -
duration(long) — the length of time after a value is created before it expires and must be recomputed -
unit(TimeUnit) — the time unit for the duration parameter; must not be null
-
- Returns: a supplier that caches results with time-based expiration
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null, unit is null, or duration is not positive
-
- See also: #memoize(Throwables.Supplier), #memoize(Throwables.Function), TimeUnit, <a href="http://en.wikipedia.org/wiki/Memoization">,Memoization on Wikipedia,</a>
identity(...) -> Throwables.Function<T, T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Function<T, T, E> identity() - Summary: Returns the identity Function that always returns its input argument unchanged.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Use as default mapper Throwables.Function<String, String, IOException> mapper = shouldTransform ?
-
Parameters:
- (none)
- Returns: a function that always returns its input argument unchanged
- See also: java.util.function.Function#identity()
alwaysTrue(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Predicate<T, E> alwaysTrue() - Summary: Returns a Predicate that always evaluates to {@code true} regardless of the input.
-
Contract:
- It's useful as a default or placeholder predicate when all elements should pass a filter.
-
Parameters:
- (none)
- Returns: a predicate that always returns {@code true}
- See also: #alwaysFalse()
alwaysFalse(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Predicate<T, E> alwaysFalse() - Summary: Returns a Predicate that always evaluates to {@code false} regardless of the input.
-
Contract:
- It's useful as a default or placeholder predicate when all elements should be filtered out.
-
Parameters:
- (none)
- Returns: a predicate that always returns {@code false}
- See also: #alwaysTrue()
toStr(...) -> Throwables.Function<T, String, E>
-
Signature:
public static <T, E extends Exception> Throwables.Function<T, String, E> toStr() - Summary: Returns a Function that converts its input to a String representation using {@link String#valueOf(Object)} .
-
Parameters:
- (none)
- Returns: a function that converts its input to a String using {@code String.valueOf()}
- See also: String#valueOf(Object)
key(...) -> Throwables.Function<Map.Entry<K, V>, K, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V, E extends Exception> Throwables.Function<Map.Entry<K, V>, K, E> key() - Summary: Returns a Function that extracts the key component from a {@link Map.Entry} .
-
Parameters:
- (none)
- Returns: a function that extracts and returns the key from a Map.Entry
- See also: Map.Entry#getKey(), #value()
value(...) -> Throwables.Function<Map.Entry<K, V>, V, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V, E extends Exception> Throwables.Function<Map.Entry<K, V>, V, E> value() - Summary: Returns a Function that extracts the value component from a {@link Map.Entry} .
-
Parameters:
- (none)
- Returns: a function that extracts and returns the value from a Map.Entry
- See also: Map.Entry#getValue(), #key()
invert(...) -> Throwables.Function<Entry<K, V>, Entry<V, K>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V, E extends Exception> Throwables.Function<Entry<K, V>, Entry<V, K>, E> invert() - Summary: Returns a Function that inverts a {@link Map.Entry} by swapping its key and value.
-
Parameters:
- (none)
- Returns: a function that returns a new Entry with key and value swapped
- See also: Map.Entry, #key(), #value()
entry(...) -> Throwables.BiFunction<K, V, Map.Entry<K, V>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V, E extends Exception> Throwables.BiFunction<K, V, Map.Entry<K, V>, E> entry() - Summary: Returns a BiFunction that creates a {@link Map.Entry} from a key and value pair.
-
Contract:
- This factory function combines two separate values into a single Map.Entry, useful for constructing entries in stream operations or when building maps programmatically.
-
Parameters:
- (none)
- Returns: a BiFunction that creates a Map.Entry from a key and value
- See also: Map.Entry, java.util.AbstractMap.SimpleEntry
pair(...) -> Throwables.BiFunction<L, R, Pair<L, R>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, R, E extends Exception> Throwables.BiFunction<L, R, Pair<L, R>, E> pair() - Summary: Returns a BiFunction that creates a {@link Pair} from two values.
-
Parameters:
- (none)
- Returns: a BiFunction that creates a Pair from left and right values
- See also: Pair, #triple(), #entry()
triple(...) -> Throwables.TriFunction<L, M, R, Triple<L, M, R>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <L, M, R, E extends Exception> Throwables.TriFunction<L, M, R, Triple<L, M, R>, E> triple() - Summary: Returns a TriFunction that creates a {@link Triple} from three values.
-
Parameters:
- (none)
- Returns: a TriFunction that creates a Triple from left, middle, and right values
- See also: Triple, #pair(), #tuple3()
tuple1(...) -> Throwables.Function<T, Tuple1<T>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, E extends Exception> Throwables.Function<T, Tuple1<T>, E> tuple1() - Summary: Returns a Function that wraps a single value in a {@link Tuple1} .
-
Parameters:
- (none)
- Returns: a Function that creates a Tuple1 from a single value
- See also: Tuple1, #tuple2(), #tuple3()
tuple2(...) -> Throwables.BiFunction<T, U, Tuple2<T, U>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, U, E extends Exception> Throwables.BiFunction<T, U, Tuple2<T, U>, E> tuple2() - Summary: Returns a BiFunction that wraps two values in a {@link Tuple2} .
-
Parameters:
- (none)
- Returns: a BiFunction that creates a Tuple2 from two values
- See also: Tuple2, #tuple1(), #tuple3(), #pair()
tuple3(...) -> Throwables.TriFunction<A, B, C, Tuple3<A, B, C>, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <A, B, C, E extends Exception> Throwables.TriFunction<A, B, C, Tuple3<A, B, C>, E> tuple3() - Summary: Returns a TriFunction that wraps three values in a {@link Tuple3} .
-
Parameters:
- (none)
- Returns: a TriFunction that creates a Tuple3 from three values
- See also: Tuple3, #tuple1(), #tuple2(), #triple()
emptyAction(...) -> Throwables.Runnable<E>
-
Signature:
public static <E extends Exception> Throwables.Runnable<E> emptyAction() - Summary: Returns a no-op Runnable that performs no operation when executed.
-
Contract:
- Returns a no-op Runnable that performs no operation when executed.
-
Parameters:
- (none)
- Returns: a Runnable that performs no operation
- See also: #doNothing()
doNothing(...) -> Throwables.Consumer<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Consumer<T, E> doNothing() - Summary: Returns a no-op Consumer that performs no operation on its input.
-
Contract:
- It's useful as a placeholder or default consumer when an operation is required but no action should be taken.
-
Parameters:
- (none)
- Returns: a Consumer that performs no operation
- See also: #emptyAction()
throwRuntimeException(...) -> Throwables.Consumer<T, RuntimeException>
-
Signature:
public static <T> Throwables.Consumer<T, RuntimeException> throwRuntimeException(final String errorMessage) - Summary: Returns a Throwables.Consumer that throws a RuntimeException with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message for the exception
-
- Returns: a Consumer that throws a RuntimeException
throwIOException(...) -> Throwables.Consumer<T, IOException>
-
Signature:
public static <T> Throwables.Consumer<T, IOException> throwIOException(final String errorMessage) - Summary: Returns a Throwables.Consumer that throws an IOException with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message for the exception
-
- Returns: a Consumer that throws an IOException
throwException(...) -> Throwables.Consumer<T, Exception>
-
Signature:
public static <T> Throwables.Consumer<T, Exception> throwException(final String errorMessage) - Summary: Returns a Throwables.Consumer that throws an Exception with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message for the exception
-
- Returns: a Consumer that throws an Exception
-
Signature:
public static <T, E extends Exception> Throwables.Consumer<T, E> throwException(final java.util.function.Supplier<? extends E> exceptionSupplier) - Summary: Returns a Throwables.Consumer that throws an exception provided by the supplier.
-
Parameters:
-
exceptionSupplier(java.util.function.Supplier<? extends E>) — the supplier that provides the exception to throw
-
- Returns: a Consumer that throws the supplied exception
sleep(...) -> Throwables.Consumer<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Consumer<T, E> sleep(final long millis) - Summary: Returns a Throwables.Consumer that sleeps for the specified number of milliseconds.
-
Parameters:
-
millis(long) — the number of milliseconds to sleep
-
- Returns: a Consumer that sleeps for the specified duration
sleepUninterruptibly(...) -> Throwables.Consumer<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Consumer<T, E> sleepUninterruptibly(final long millis) - Summary: Returns a Throwables.Consumer that sleeps uninterruptibly for the specified number of milliseconds.
-
Parameters:
-
millis(long) — the number of milliseconds to sleep
-
- Returns: a Consumer that sleeps uninterruptibly for the specified duration
rateLimiter(...) -> Throwables.Consumer<T, E>
-
Signature:
@Stateful public static <T, E extends Exception> Throwables.Consumer<T, E> rateLimiter(final double permitsPerSecond) - Summary: Returns a stateful Throwables.Consumer that rate limits execution to the specified permits per second.
-
Contract:
- This consumer is stateful and should not be saved or cached for reuse, but it can be used in parallel streams.
-
Parameters:
-
permitsPerSecond(double) — the number of permits per second
-
- Returns: a stateful Consumer that rate limits execution
- See also: RateLimiter#acquire(), RateLimiter#create(double)
-
Signature:
@Stateful public static <T, E extends Exception> Throwables.Consumer<T, E> rateLimiter(final RateLimiter rateLimiter) - Summary: Returns a stateful Throwables.Consumer that rate limits execution using the provided RateLimiter.
-
Contract:
- This consumer is stateful and should not be saved or cached for reuse, but it can be used in parallel streams.
-
Parameters:
-
rateLimiter(RateLimiter) — the RateLimiter to use
-
- Returns: a stateful Consumer that rate limits execution
- See also: RateLimiter#acquire()
close(...) -> Throwables.Consumer<T, Exception>
-
Signature:
public static <T extends AutoCloseable> Throwables.Consumer<T, Exception> close() - Summary: Returns a Throwables.Consumer that closes an AutoCloseable resource.
-
Contract:
- The consumer calls close() on the resource if it is not {@code null} .
-
Parameters:
- (none)
- Returns: a Consumer that closes the AutoCloseable resource
closeQuietly(...) -> Throwables.Consumer<T, E>
-
Signature:
public static <T extends AutoCloseable, E extends Exception> Throwables.Consumer<T, E> closeQuietly() - Summary: Returns a Throwables.Consumer that closes an AutoCloseable resource quietly.
-
Parameters:
- (none)
- Returns: a Consumer that closes the AutoCloseable resource quietly
println(...) -> Throwables.Consumer<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Consumer<T, E> println() - Summary: Returns a Throwables.Consumer that prints its input to standard output.
-
Parameters:
- (none)
- Returns: a Consumer that prints to standard output
-
Signature:
public static <T, U, E extends Exception> Throwables.BiConsumer<T, U, E> println(final String separator) - Summary: Returns a Throwables.BiConsumer that prints its two inputs to standard output with a separator.
-
Parameters:
-
separator(String) — the separator string to use between the two values
-
- Returns: a BiConsumer that prints two values with a separator
isNull(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta public static <T, E extends Exception> Throwables.Predicate<T, E> isNull() - Summary: Returns a Throwables.Predicate that tests if its input is {@code null} .
-
Contract:
- Returns a Throwables.Predicate that tests if its input is {@code null} .
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input is null
isEmpty(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T extends CharSequence, E extends Exception> Throwables.Predicate<T, E> isEmpty() - Summary: Returns a Throwables.Predicate that tests if a CharSequence is empty.
-
Contract:
- Returns a Throwables.Predicate that tests if a CharSequence is empty.
- The predicate returns {@code true} if the CharSequence has length 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the CharSequence is empty
isBlank(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T extends CharSequence, E extends Exception> Throwables.Predicate<T, E> isBlank() - Summary: Returns a Throwables.Predicate that tests if a CharSequence is blank.
-
Contract:
- Returns a Throwables.Predicate that tests if a CharSequence is blank.
- The predicate returns {@code true} if the CharSequence is empty or contains only whitespace characters.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the CharSequence is blank
isEmptyA(...) -> Throwables.Predicate<T\[\], E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Exception> Throwables.Predicate<T[], E> isEmptyA() - Summary: Returns a Throwables.Predicate that tests if an array is empty.
-
Contract:
- Returns a Throwables.Predicate that tests if an array is empty.
- The predicate returns {@code true} if the array is {@code null} or has length 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the array is empty
isEmptyC(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Collection, E extends Exception> Throwables.Predicate<T, E> isEmptyC() - Summary: Returns a Throwables.Predicate that tests if a Collection is empty.
-
Contract:
- Returns a Throwables.Predicate that tests if a Collection is empty.
- The predicate returns {@code true} if the Collection is {@code null} or has size 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the Collection is empty
isEmptyM(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Map, E extends Exception> Throwables.Predicate<T, E> isEmptyM() - Summary: Returns a Throwables.Predicate that tests if a Map is empty.
-
Contract:
- Returns a Throwables.Predicate that tests if a Map is empty.
- The predicate returns {@code true} if the Map is {@code null} or has size 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the Map is empty
notNull(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta public static <T, E extends Exception> Throwables.Predicate<T, E> notNull() - Summary: Returns a Predicate that tests whether its input is not {@code null} .
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input is not {@code null} , {@code false} otherwise
- See also: java.util.Objects#nonNull(Object)
notEmpty(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T extends CharSequence, E extends Exception> Throwables.Predicate<T, E> notEmpty() - Summary: Returns a Predicate that tests whether a CharSequence is not empty.
-
Contract:
- A CharSequence is considered not empty if it is not {@code null} and has a length greater than 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input CharSequence is not empty, {@code false} otherwise
- See also: CharSequence#length()
notBlank(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T extends CharSequence, E extends Exception> Throwables.Predicate<T, E> notBlank() - Summary: Returns a Predicate that tests whether a CharSequence is not blank.
-
Contract:
- A CharSequence is considered not blank if it is not {@code null} , not empty, and contains at least one non-whitespace character.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input CharSequence is not blank, {@code false} otherwise
- See also: Character#isWhitespace(char)
notEmptyA(...) -> Throwables.Predicate<T\[\], E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Exception> Throwables.Predicate<T[], E> notEmptyA() - Summary: Returns a Predicate that tests whether an array is not empty.
-
Contract:
- An array is considered not empty if it is not {@code null} and has a length greater than 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input array is not empty, {@code false} otherwise
- See also: java.lang.reflect.Array#getLength(Object)
notEmptyC(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Collection, E extends Exception> Throwables.Predicate<T, E> notEmptyC() - Summary: Returns a Predicate that tests whether a Collection is not empty.
-
Contract:
- A Collection is considered not empty if it is not {@code null} and has a size greater than 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input Collection is not empty, {@code false} otherwise
- See also: Collection#isEmpty()
notEmptyM(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T extends Map, E extends Exception> Throwables.Predicate<T, E> notEmptyM() - Summary: Returns a Predicate that tests whether a Map is not empty.
-
Contract:
- A Map is considered not empty if it is not {@code null} and has a size greater than 0.
-
Parameters:
- (none)
- Returns: a Predicate that returns {@code true} if the input Map is not empty, {@code false} otherwise
- See also: Map#isEmpty()
throwingMerger(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.BinaryOperator<T, E> throwingMerger() - Summary: Returns a BinaryOperator that throws an exception when attempting to merge duplicate keys.
-
Contract:
- Returns a BinaryOperator that throws an exception when attempting to merge duplicate keys.
- This merger is typically used in Collectors.toMap() when duplicate keys should not be allowed.
-
Parameters:
- (none)
- Returns: a BinaryOperator that throws an exception for any merge operation
- See also: java.util.stream.Collectors#toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, Supplier)
ignoringMerger(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.BinaryOperator<T, E> ignoringMerger() - Summary: Returns a BinaryOperator that ignores the second value and returns the first value.
-
Contract:
- This merger is typically used in Collectors.toMap() when keeping the first occurrence of duplicate keys.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the first operand
- See also: java.util.stream.Collectors#toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, Supplier)
replacingMerger(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.BinaryOperator<T, E> replacingMerger() - Summary: Returns a BinaryOperator that replaces the first value with the second value.
-
Contract:
- This merger is typically used in Collectors.toMap() when keeping the last occurrence of duplicate keys.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the second operand
- See also: java.util.stream.Collectors#toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, Supplier)
testByKey(...) -> Throwables.Predicate<Map.Entry<K, V>, E>
-
Signature:
public static <K, V, E extends Throwable> Throwables.Predicate<Map.Entry<K, V>, E> testByKey(final Throwables.Predicate<? super K, E> predicate) throws IllegalArgumentException - Summary: Returns a Predicate that tests Map.Entry objects by applying the given predicate to the entry's key.
-
Parameters:
-
predicate(Throwables.Predicate<? super K, E>) — the predicate to apply to the entry's key
-
- Returns: a Predicate that tests Map.Entry objects by their keys
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
- See also: Map.Entry#getKey()
testByValue(...) -> Throwables.Predicate<Map.Entry<K, V>, E>
-
Signature:
public static <K, V, E extends Throwable> Throwables.Predicate<Map.Entry<K, V>, E> testByValue(final Throwables.Predicate<? super V, E> predicate) throws IllegalArgumentException - Summary: Returns a Predicate that tests Map.Entry objects by applying the given predicate to the entry's value.
-
Parameters:
-
predicate(Throwables.Predicate<? super V, E>) — the predicate to apply to the entry's value
-
- Returns: a Predicate that tests Map.Entry objects by their values
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
- See also: Map.Entry#getValue()
acceptByKey(...) -> Throwables.Consumer<Map.Entry<K, V>, E>
-
Signature:
public static <K, V, E extends Throwable> Throwables.Consumer<Map.Entry<K, V>, E> acceptByKey(final Throwables.Consumer<? super K, E> consumer) throws IllegalArgumentException - Summary: Returns a Consumer that accepts Map.Entry objects and applies the given consumer to the entry's key.
-
Parameters:
-
consumer(Throwables.Consumer<? super K, E>) — the consumer to apply to the entry's key
-
- Returns: a Consumer that processes Map.Entry objects by their keys
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
- See also: Map.Entry#getKey()
acceptByValue(...) -> Throwables.Consumer<Map.Entry<K, V>, E>
-
Signature:
public static <K, V, E extends Throwable> Throwables.Consumer<Map.Entry<K, V>, E> acceptByValue(final Throwables.Consumer<? super V, E> consumer) throws IllegalArgumentException - Summary: Returns a Consumer that accepts Map.Entry objects and applies the given consumer to the entry's value.
-
Parameters:
-
consumer(Throwables.Consumer<? super V, E>) — the consumer to apply to the entry's value
-
- Returns: a Consumer that processes Map.Entry objects by their values
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
- See also: Map.Entry#getValue()
applyByKey(...) -> Throwables.Function<Map.Entry<K, V>, R, E>
-
Signature:
public static <K, V, R, E extends Throwable> Throwables.Function<Map.Entry<K, V>, R, E> applyByKey( final Throwables.Function<? super K, ? extends R, E> func) throws IllegalArgumentException - Summary: Returns a Function that applies the given function to a Map.Entry's key.
-
Parameters:
-
func(Throwables.Function<? super K, ? extends R, E>) — the function to apply to the entry's key
-
- Returns: a Function that transforms Map.Entry objects by applying a function to their keys
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
- See also: Map.Entry#getKey()
applyByValue(...) -> Throwables.Function<Map.Entry<K, V>, R, E>
-
Signature:
public static <K, V, R, E extends Throwable> Throwables.Function<Map.Entry<K, V>, R, E> applyByValue( final Throwables.Function<? super V, ? extends R, E> func) throws IllegalArgumentException - Summary: Returns a Function that applies the given function to a Map.Entry's value.
-
Parameters:
-
func(Throwables.Function<? super V, ? extends R, E>) — the function to apply to the entry's value
-
- Returns: a Function that transforms Map.Entry objects by applying a function to their values
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
- See also: Map.Entry#getValue()
selectFirst(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> selectFirst() - Summary: Returns a BinaryOperator that always returns the first of its two operands.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the first operand
- See also: BinaryOperator
selectSecond(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> selectSecond() - Summary: Returns a BinaryOperator that always returns the second of its two operands.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the second operand
- See also: BinaryOperator
min(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Comparable<? super T>, E extends Throwable> Throwables.BinaryOperator<T, E> min() - Summary: Returns a BinaryOperator that returns the minimum of two Comparable values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the smaller of two Comparable values
- See also: Comparable#compareTo(Object)
-
Signature:
public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> min(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a BinaryOperator that returns the minimum of two values according to the specified Comparator.
-
Contract:
- If the comparator indicates the values are equal, the first value is returned.
-
Parameters:
-
comparator(Comparator<? super T>) — the Comparator to use for comparing values
-
- Returns: a BinaryOperator that returns the smaller of two values according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if comparator is null
-
- See also: Comparator#compare(Object, Object)
minBy(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> minBy( final java.util.function.Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a BinaryOperator that returns the minimum of two values by comparing the results of applying a key extractor function.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super T, ? extends Comparable>) — the function to extract a Comparable key from each operand
-
- Returns: a BinaryOperator that returns the operand with the smaller extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: Comparable#compareTo(Object)
minByKey(...) -> Throwables.BinaryOperator<Map.Entry<K, V>, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K extends Comparable<? super K>, V, E extends Throwable> Throwables.BinaryOperator<Map.Entry<K, V>, E> minByKey() - Summary: Returns a BinaryOperator that returns the minimum of two Map.Entry objects by comparing their keys.
-
Contract:
- The keys must be Comparable and are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the Map.Entry with the smaller key
- See also: Map.Entry#getKey(), Comparable#compareTo(Object)
minByValue(...) -> Throwables.BinaryOperator<Map.Entry<K, V>, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V extends Comparable<? super V>, E extends Throwable> Throwables.BinaryOperator<Map.Entry<K, V>, E> minByValue() - Summary: Returns a BinaryOperator that returns the minimum of two Map.Entry objects by comparing their values.
-
Contract:
- The values must be Comparable and are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the Map.Entry with the smaller value
- See also: Map.Entry#getValue(), Comparable#compareTo(Object)
max(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends Comparable<? super T>, E extends Throwable> Throwables.BinaryOperator<T, E> max() - Summary: Returns a BinaryOperator that returns the maximum of two Comparable values.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the larger of two Comparable values
- See also: Comparable#compareTo(Object)
-
Signature:
public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> max(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a BinaryOperator that returns the maximum of two values according to the specified Comparator.
-
Contract:
- If the comparator indicates the values are equal, the first value is returned.
-
Parameters:
-
comparator(Comparator<? super T>) — the Comparator to use for comparing values
-
- Returns: a BinaryOperator that returns the larger of two values according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if comparator is null
-
- See also: Comparator#compare(Object, Object)
maxBy(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> maxBy( final java.util.function.Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns a BinaryOperator that returns the maximum of two values by comparing the results of applying a key extractor function.
-
Parameters:
-
keyExtractor(java.util.function.Function<? super T, ? extends Comparable>) — the function to extract a Comparable key from each operand
-
- Returns: a BinaryOperator that returns the operand with the larger extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor is null
-
- See also: Comparable#compareTo(Object)
maxByKey(...) -> Throwables.BinaryOperator<Map.Entry<K, V>, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K extends Comparable<? super K>, V, E extends Throwable> Throwables.BinaryOperator<Map.Entry<K, V>, E> maxByKey() - Summary: Returns a BinaryOperator that returns the maximum of two Map.Entry objects by comparing their keys.
-
Contract:
- The keys must be Comparable and are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the Map.Entry with the larger key
- See also: Map.Entry#getKey(), Comparable#compareTo(Object)
maxByValue(...) -> Throwables.BinaryOperator<Map.Entry<K, V>, E>
-
Signature:
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V extends Comparable<? super V>, E extends Throwable> Throwables.BinaryOperator<Map.Entry<K, V>, E> maxByValue() - Summary: Returns a BinaryOperator that returns the maximum of two Map.Entry objects by comparing their values.
-
Contract:
- The values must be Comparable and are compared using their natural ordering.
-
Parameters:
- (none)
- Returns: a BinaryOperator that returns the Map.Entry with the larger value
- See also: Map.Entry#getValue(), Comparable#compareTo(Object)
not(...) -> Throwables.Predicate<T, E>
-
Signature:
public static <T, E extends Throwable> Throwables.Predicate<T, E> not(final Throwables.Predicate<T, E> predicate) throws IllegalArgumentException - Summary: Returns a Predicate that represents the logical negation of the given predicate.
-
Contract:
- When evaluated, the returned predicate returns {@code true} if the given predicate returns {@code false} , and vice versa.
-
Parameters:
-
predicate(Throwables.Predicate<T, E>) — the predicate to negate
-
- Returns: a Predicate that represents the logical negation of the given predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
- See also: Predicate#negate()
-
Signature:
public static <T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> not(final Throwables.BiPredicate<T, U, E> biPredicate) throws IllegalArgumentException - Summary: Returns a BiPredicate that represents the logical negation of the given bi-predicate.
-
Contract:
- When evaluated, the returned bi-predicate returns {@code true} if the given bi-predicate returns {@code false} , and vice versa.
-
Parameters:
-
biPredicate(Throwables.BiPredicate<T, U, E>) — the bi-predicate to negate
-
- Returns: a BiPredicate that represents the logical negation of the given bi-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if biPredicate is null
-
- See also: BiPredicate#negate()
-
Signature:
public static <A, B, C, E extends Throwable> Throwables.TriPredicate<A, B, C, E> not(final Throwables.TriPredicate<A, B, C, E> triPredicate) throws IllegalArgumentException - Summary: Returns a TriPredicate that represents the logical negation of the given tri-predicate.
-
Contract:
- When evaluated, the returned tri-predicate returns {@code true} if the given tri-predicate returns {@code false} , and vice versa.
-
Parameters:
-
triPredicate(Throwables.TriPredicate<A, B, C, E>) — the tri-predicate to negate
-
- Returns: a TriPredicate that represents the logical negation of the given tri-predicate
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
atMost(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta @Stateful public static <T, E extends Throwable> Throwables.Predicate<T, E> atMost(final int count) throws IllegalArgumentException - Summary: Returns a stateful Predicate that returns {@code true} for at most the specified number of evaluations.
-
Parameters:
-
count(int) — the maximum number of times the predicate should return true
-
- Returns: a stateful Predicate that limits the number of {@code true} results. Don't save or cache for reuse.
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
from(...) -> Throwables.Supplier<T, E>
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.Supplier<T, E> from(final java.util.function.Supplier<T> supplier) - Summary: Converts a standard Java Supplier to a Throwables.Supplier.
-
Contract:
- If the input is already a Throwables.Supplier, it is returned as-is.
-
Parameters:
-
supplier(java.util.function.Supplier<T>) — the Java Supplier to convert
-
- Returns: a Throwables.Supplier that delegates to the given supplier
- See also: java.util.function.Supplier
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.IntFunction<T, E> from(final java.util.function.IntFunction<? extends T> func) - Summary: Converts a standard Java IntFunction to a Throwables.IntFunction.
-
Contract:
- If the input is already a Throwables.IntFunction, it is returned as-is.
-
Parameters:
-
func(java.util.function.IntFunction<? extends T>) — the Java IntFunction to convert
-
- Returns: a Throwables.IntFunction that delegates to the given function
- See also: java.util.function.IntFunction
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.Predicate<T, E> from(final java.util.function.Predicate<T> predicate) - Summary: Converts a standard Java Predicate to a Throwables.Predicate.
-
Contract:
- If the input is already a Throwables.Predicate, it is returned as-is.
-
Parameters:
-
predicate(java.util.function.Predicate<T>) — the Java Predicate to convert
-
- Returns: a Throwables.Predicate that delegates to the given predicate
- See also: java.util.function.Predicate
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> from(final java.util.function.BiPredicate<T, U> predicate) - Summary: Converts a standard Java BiPredicate to a Throwables.BiPredicate.
-
Contract:
- If the input is already a Throwables.BiPredicate, it is returned as-is.
-
Parameters:
-
predicate(java.util.function.BiPredicate<T, U>) — the Java BiPredicate to convert
-
- Returns: a Throwables.BiPredicate that delegates to the given predicate
- See also: java.util.function.BiPredicate
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.Consumer<T, E> from(final java.util.function.Consumer<T> consumer) - Summary: Converts a standard Java Consumer to a Throwables.Consumer.
-
Contract:
- If the input is already a Throwables.Consumer, it is returned as-is.
-
Parameters:
-
consumer(java.util.function.Consumer<T>) — the Java Consumer to convert
-
- Returns: a Throwables.Consumer that delegates to the given consumer
- See also: java.util.function.Consumer
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> from(final java.util.function.BiConsumer<T, U> consumer) - Summary: Converts a standard Java BiConsumer to a Throwables.BiConsumer.
-
Contract:
- If the input is already a Throwables.BiConsumer, it is returned as-is.
-
Parameters:
-
consumer(java.util.function.BiConsumer<T, U>) — the Java BiConsumer to convert
-
- Returns: a Throwables.BiConsumer that delegates to the given consumer
- See also: java.util.function.BiConsumer
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, R, E extends Throwable> Throwables.Function<T, R, E> from(final java.util.function.Function<T, ? extends R> function) - Summary: Converts a standard Java Function to a Throwables.Function.
-
Contract:
- If the input is already a Throwables.Function, it is returned as-is.
-
Parameters:
-
function(java.util.function.Function<T, ? extends R>) — the Java Function to convert
-
- Returns: a Throwables.Function that delegates to the given function
- See also: java.util.function.Function
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> from(final java.util.function.BiFunction<T, U, ? extends R> function) - Summary: Converts a standard Java BiFunction to a Throwables.BiFunction.
-
Contract:
- If the input is already a Throwables.BiFunction, it is returned as-is.
-
Parameters:
-
function(java.util.function.BiFunction<T, U, ? extends R>) — the Java BiFunction to convert
-
- Returns: a Throwables.BiFunction that delegates to the given function
- See also: java.util.function.BiFunction
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.UnaryOperator<T, E> from(final java.util.function.UnaryOperator<T> op) - Summary: Converts a standard Java UnaryOperator to a Throwables.UnaryOperator.
-
Contract:
- If the input is already a Throwables.UnaryOperator, it is returned as-is.
-
Parameters:
-
op(java.util.function.UnaryOperator<T>) — the Java UnaryOperator to convert
-
- Returns: a Throwables.UnaryOperator that delegates to the given operator
- See also: java.util.function.UnaryOperator
-
Signature:
@Beta @SuppressWarnings("rawtypes") public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> from(final java.util.function.BinaryOperator<T> op) - Summary: Converts a standard Java BinaryOperator to a Throwables.BinaryOperator.
-
Contract:
- If the input is already a Throwables.BinaryOperator, it is returned as-is.
-
Parameters:
-
op(java.util.function.BinaryOperator<T>) — the Java BinaryOperator to convert
-
- Returns: a Throwables.BinaryOperator that delegates to the given operator
- See also: java.util.function.BinaryOperator
s(...) -> Throwables.Supplier<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Supplier<T, E> s(final Throwables.Supplier<T, E> supplier) - Summary: Returns the provided Throwables.Supplier as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
supplier(Throwables.Supplier<T, E>) — the supplier to return
-
- Returns: the supplier unchanged
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Supplier<T, E> s(final A a, final Throwables.Function<? super A, ? extends T, E> func) - Summary: Creates a Throwables.Supplier by partially applying a function to a fixed argument.
-
Contract:
- The returned supplier will invoke the function with the provided argument when called.
-
Parameters:
-
a(A) — the fixed argument to apply to the function -
func(Throwables.Function<? super A, ? extends T, E>) — the function to partially apply
-
- Returns: a Supplier that applies the function to the fixed argument
p(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Predicate<T, E> p(final Throwables.Predicate<T, E> predicate) - Summary: Returns the provided Throwables.Predicate as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
predicate(Throwables.Predicate<T, E>) — the predicate to return
-
- Returns: the predicate unchanged
- See also: #from(java.util.function.Predicate)
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Predicate<T, E> p(final A a, final Throwables.BiPredicate<A, T, E> biPredicate) throws IllegalArgumentException - Summary: Creates a Throwables.Predicate by partially applying a BiPredicate to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the bi-predicate -
biPredicate(Throwables.BiPredicate<A, T, E>) — the bi-predicate to partially apply
-
- Returns: a Predicate that applies the bi-predicate with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if biPredicate is null
-
-
Signature:
@Beta public static <A, B, T, E extends Throwable> Throwables.Predicate<T, E> p(final A a, final B b, final Throwables.TriPredicate<A, B, T, E> triPredicate) throws IllegalArgumentException - Summary: Creates a Throwables.Predicate by partially applying a TriPredicate to fixed first and second arguments.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-predicate -
b(B) — the fixed second argument to apply to the tri-predicate -
triPredicate(Throwables.TriPredicate<A, B, T, E>) — the tri-predicate to partially apply
-
- Returns: a Predicate that applies the tri-predicate with the fixed arguments
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> p(final Throwables.BiPredicate<T, U, E> biPredicate) - Summary: Returns the provided Throwables.BiPredicate as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
biPredicate(Throwables.BiPredicate<T, U, E>) — the bi-predicate to return
-
- Returns: the bi-predicate unchanged
- See also: #from(java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> p(final A a, final Throwables.TriPredicate<A, T, U, E> triPredicate) throws IllegalArgumentException - Summary: Creates a Throwables.BiPredicate by partially applying a TriPredicate to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-predicate -
triPredicate(Throwables.TriPredicate<A, T, U, E>) — the tri-predicate to partially apply
-
- Returns: a BiPredicate that applies the tri-predicate with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
-
Signature:
@Beta public static <A, B, C, E extends Throwable> Throwables.TriPredicate<A, B, C, E> p(final Throwables.TriPredicate<A, B, C, E> triPredicate) - Summary: Returns the provided Throwables.TriPredicate as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
triPredicate(Throwables.TriPredicate<A, B, C, E>) — the tri-predicate to return
-
- Returns: the tri-predicate unchanged
c(...) -> Throwables.Consumer<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Consumer<T, E> c(final Throwables.Consumer<T, E> consumer) - Summary: Returns the provided Throwables.Consumer as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
consumer(Throwables.Consumer<T, E>) — the consumer to return
-
- Returns: the consumer unchanged
- See also: #from(java.util.function.Consumer)
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Consumer<T, E> c(final A a, final Throwables.BiConsumer<A, T, E> biConsumer) throws IllegalArgumentException - Summary: Creates a Throwables.Consumer by partially applying a BiConsumer to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the bi-consumer -
biConsumer(Throwables.BiConsumer<A, T, E>) — the bi-consumer to partially apply
-
- Returns: a Consumer that applies the bi-consumer with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if biConsumer is null
-
-
Signature:
@Beta public static <A, B, T, E extends Throwable> Throwables.Consumer<T, E> c(final A a, final B b, final Throwables.TriConsumer<A, B, T, E> triConsumer) throws IllegalArgumentException - Summary: Creates a Throwables.Consumer by partially applying a TriConsumer to fixed first and second arguments.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-consumer -
b(B) — the fixed second argument to apply to the tri-consumer -
triConsumer(Throwables.TriConsumer<A, B, T, E>) — the tri-consumer to partially apply
-
- Returns: a Consumer that applies the tri-consumer with the fixed arguments
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> c(final Throwables.BiConsumer<T, U, E> biConsumer) - Summary: Returns the provided Throwables.BiConsumer as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
biConsumer(Throwables.BiConsumer<T, U, E>) — the bi-consumer to return
-
- Returns: the bi-consumer unchanged
- See also: #from(java.util.function.BiConsumer)
-
Signature:
@Beta public static <A, T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> c(final A a, final Throwables.TriConsumer<A, T, U, E> triConsumer) throws IllegalArgumentException - Summary: Creates a Throwables.BiConsumer by partially applying a TriConsumer to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-consumer -
triConsumer(Throwables.TriConsumer<A, T, U, E>) — the tri-consumer to partially apply
-
- Returns: a BiConsumer that applies the tri-consumer with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
@Beta public static <A, B, C, E extends Throwable> Throwables.TriConsumer<A, B, C, E> c(final Throwables.TriConsumer<A, B, C, E> triConsumer) - Summary: Returns the provided Throwables.TriConsumer as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
triConsumer(Throwables.TriConsumer<A, B, C, E>) — the tri-consumer to return
-
- Returns: the tri-consumer unchanged
-
Signature:
public static <R, E extends Throwable> Throwables.Callable<R, E> c(final Throwables.Callable<R, E> callable) throws IllegalArgumentException - Summary: Returns the provided Callable as a Throwables.Callable.
-
Contract:
- This helps with type inference when passing callables to generic methods.
-
Parameters:
-
callable(Throwables.Callable<R, E>) — the callable to return
-
- Returns: the same Throwables.Callable that was provided
-
Throws:
-
java.lang.IllegalArgumentException— if callable is null
-
f(...) -> Throwables.Function<T, R, E>
-
Signature:
@Beta public static <T, R, E extends Throwable> Throwables.Function<T, R, E> f(final Throwables.Function<T, R, E> function) - Summary: Returns the provided Throwables.Function as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
function(Throwables.Function<T, R, E>) — the function to return
-
- Returns: the function unchanged
- See also: #from(java.util.function.Function)
-
Signature:
@Beta public static <A, T, R, E extends Throwable> Throwables.Function<T, R, E> f(final A a, final Throwables.BiFunction<A, T, R, E> biFunction) throws IllegalArgumentException - Summary: Creates a Throwables.Function by partially applying a BiFunction to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the bi-function -
biFunction(Throwables.BiFunction<A, T, R, E>) — the bi-function to partially apply
-
- Returns: a Function that applies the bi-function with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if biFunction is null
-
-
Signature:
@Beta public static <A, B, T, R, E extends Throwable> Throwables.Function<T, R, E> f(final A a, final B b, final Throwables.TriFunction<A, B, T, R, E> triFunction) throws IllegalArgumentException - Summary: Creates a Throwables.Function by partially applying a TriFunction to fixed first and second arguments.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-function -
b(B) — the fixed second argument to apply to the tri-function -
triFunction(Throwables.TriFunction<A, B, T, R, E>) — the tri-function to partially apply
-
- Returns: a Function that applies the tri-function with the fixed arguments
-
Throws:
-
java.lang.IllegalArgumentException— if triFunction is null
-
-
Signature:
@Beta public static <T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> f(final Throwables.BiFunction<T, U, R, E> biFunction) - Summary: Returns the provided Throwables.BiFunction as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
biFunction(Throwables.BiFunction<T, U, R, E>) — the bi-function to return
-
- Returns: the bi-function unchanged
- See also: #from(java.util.function.BiFunction)
-
Signature:
@Beta public static <A, T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> f(final A a, final Throwables.TriFunction<A, T, U, R, E> triFunction) throws IllegalArgumentException - Summary: Creates a Throwables.BiFunction by partially applying a TriFunction to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-function -
triFunction(Throwables.TriFunction<A, T, U, R, E>) — the tri-function to partially apply
-
- Returns: a BiFunction that applies the tri-function with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if triFunction is null
-
-
Signature:
@Beta public static <A, B, C, R, E extends Throwable> Throwables.TriFunction<A, B, C, R, E> f(final Throwables.TriFunction<A, B, C, R, E> triFunction) - Summary: Returns the provided Throwables.TriFunction as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
triFunction(Throwables.TriFunction<A, B, C, R, E>) — the tri-function to return
-
- Returns: the tri-function unchanged
o(...) -> Throwables.UnaryOperator<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.UnaryOperator<T, E> o(final Throwables.UnaryOperator<T, E> unaryOperator) - Summary: Returns the provided Throwables.UnaryOperator as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
unaryOperator(Throwables.UnaryOperator<T, E>) — the unary operator to return
-
- Returns: the unary operator unchanged
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.BinaryOperator<T, E> o(final Throwables.BinaryOperator<T, E> binaryOperator) - Summary: Returns the provided Throwables.BinaryOperator as-is.
-
Contract:
- This is a shorthand identity method that can help with type inference in certain contexts, particularly when passing lambda expressions or method references to generic methods.
-
Parameters:
-
binaryOperator(Throwables.BinaryOperator<T, E>) — the binary operator to return
-
- Returns: the binary operator unchanged
mc(...) -> Throwables.BiConsumer<T, java.util.function.Consumer<U>, E>
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiConsumer<T, java.util.function.Consumer<U>, E> mc( final Throwables.BiConsumer<? super T, ? extends java.util.function.Consumer<U>, E> mapper) - Summary: Returns the provided Throwables.BiConsumer as-is.
-
Contract:
- This is a shorthand identity method for a mapper that can help with type inference in certain contexts, particularly when used with stream operations like mapMulti.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Using mc() to help with type inference in a stream operation Seq<List<String>, Exception> seq = ...; seq<String, Exception> flatStream = seq.mapMulti( Fnn.mc((List<String> list, Consumer<String> consumer) -> { for (String item : list) { if (item != null && !item.isEmpty()) { consumer.accept(item); } } })); } </pre>
-
Parameters:
-
mapper(Throwables.BiConsumer<? super T, ? extends java.util.function.Consumer<U>, E>) — the mapping bi-consumer to return
-
- Returns: the bi-consumer unchanged
- See also: Seq#mapMulti(Throwables.BiConsumer), Stream#mapMulti(java.util.function.BiConsumer), Fn#mc(java.util.function.BiConsumer)
pp(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Predicate<T, E> pp(final Predicate<T> predicate) throws IllegalArgumentException - Summary: Casts a standard Java Predicate to a Throwables.Predicate.
-
Contract:
- This method performs an unchecked cast and should be used with caution.
-
Parameters:
-
predicate(Predicate<T>) — the Java Predicate to cast
-
- Returns: the predicate cast to Throwables.Predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
- See also: #from(java.util.function.Predicate)
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Predicate<T, E> pp(final A a, final java.util.function.BiPredicate<A, T> biPredicate) throws IllegalArgumentException - Summary: Creates a Throwables.Predicate by partially applying a standard Java BiPredicate to a fixed first argument.
-
Parameters:
-
a(A) — the fixed first argument to apply to the bi-predicate -
biPredicate(java.util.function.BiPredicate<A, T>) — the Java BiPredicate to partially apply
-
- Returns: a Throwables.Predicate that applies the bi-predicate with the fixed first argument
-
Throws:
-
java.lang.IllegalArgumentException— if biPredicate is null
-
-
Signature:
@Beta public static <A, B, T, E extends Throwable> Throwables.Predicate<T, E> pp(final A a, final B b, final TriPredicate<A, B, T> triPredicate) throws IllegalArgumentException - Summary: Creates a Throwables.Predicate by partially applying a TriPredicate to fixed first and second arguments.
-
Parameters:
-
a(A) — the fixed first argument to apply to the tri-predicate -
b(B) — the fixed second argument to apply to the tri-predicate -
triPredicate(TriPredicate<A, B, T>) — the TriPredicate to partially apply
-
- Returns: a Throwables.Predicate that applies the tri-predicate with the fixed arguments
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> pp(final BiPredicate<T, U> biPredicate) throws IllegalArgumentException - Summary: Returns a BiPredicate that can throw checked exceptions by wrapping the provided BiPredicate.
-
Parameters:
-
biPredicate(BiPredicate<T, U>) — the BiPredicate to wrap
-
- Returns: a Throwables.BiPredicate that wraps the provided BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if biPredicate is null
-
- See also: #from(java.util.function.BiPredicate)
-
Signature:
@Beta public static <A, T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> pp(final A a, final TriPredicate<A, T, U> triPredicate) throws IllegalArgumentException - Summary: Returns a BiPredicate that partially applies the first argument to a TriPredicate.
-
Parameters:
-
a(A) — the first argument to be partially applied to the TriPredicate -
triPredicate(TriPredicate<A, T, U>) — the TriPredicate to be partially applied
-
- Returns: a Throwables.BiPredicate that partially applies the first argument to the TriPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
-
Signature:
@Beta public static <A, B, C, E extends Throwable> Throwables.TriPredicate<A, B, C, E> pp(final TriPredicate<A, B, C> triPredicate) throws IllegalArgumentException - Summary: Returns a TriPredicate that can throw checked exceptions by wrapping the provided TriPredicate.
-
Parameters:
-
triPredicate(TriPredicate<A, B, C>) — the TriPredicate to wrap
-
- Returns: a Throwables.TriPredicate that wraps the provided TriPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if triPredicate is null
-
cc(...) -> Throwables.Consumer<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Consumer<T, E> cc(final Consumer<T> consumer) throws IllegalArgumentException - Summary: Returns a Consumer that can throw checked exceptions by wrapping the provided Consumer.
-
Parameters:
-
consumer(Consumer<T>) — the Consumer to wrap
-
- Returns: a Throwables.Consumer that wraps the provided Consumer
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
- See also: #from(java.util.function.Consumer)
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Consumer<T, E> cc(final A a, final java.util.function.BiConsumer<A, T> biConsumer) throws IllegalArgumentException - Summary: Returns a Consumer that partially applies the first argument to a BiConsumer.
-
Parameters:
-
a(A) — the first argument to be partially applied to the BiConsumer -
biConsumer(java.util.function.BiConsumer<A, T>) — the BiConsumer to be partially applied
-
- Returns: a Throwables.Consumer that partially applies the first argument to the BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if biConsumer is null
-
-
Signature:
@Beta public static <A, B, T, E extends Throwable> Throwables.Consumer<T, E> cc(final A a, final B b, final TriConsumer<A, B, T> triConsumer) throws IllegalArgumentException - Summary: Returns a Consumer that partially applies the first two arguments to a TriConsumer.
-
Parameters:
-
a(A) — the first argument to be partially applied to the TriConsumer -
b(B) — the second argument to be partially applied to the TriConsumer -
triConsumer(TriConsumer<A, B, T>) — the TriConsumer to be partially applied
-
- Returns: a Throwables.Consumer that partially applies the first two arguments to the TriConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> cc(final BiConsumer<T, U> biConsumer) throws IllegalArgumentException - Summary: Returns a BiConsumer that can throw checked exceptions by wrapping the provided BiConsumer.
-
Parameters:
-
biConsumer(BiConsumer<T, U>) — the BiConsumer to wrap
-
- Returns: a Throwables.BiConsumer that wraps the provided BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if biConsumer is null
-
- See also: #from(java.util.function.BiConsumer)
-
Signature:
@Beta public static <A, T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> cc(final A a, final TriConsumer<A, T, U> triConsumer) throws IllegalArgumentException - Summary: Returns a BiConsumer that partially applies the first argument to a TriConsumer.
-
Parameters:
-
a(A) — the first argument to be partially applied to the TriConsumer -
triConsumer(TriConsumer<A, T, U>) — the TriConsumer to be partially applied
-
- Returns: a Throwables.BiConsumer that partially applies the first argument to the TriConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
@Beta public static <A, B, C, E extends Throwable> Throwables.TriConsumer<A, B, C, E> cc(final TriConsumer<A, B, C> triConsumer) throws IllegalArgumentException - Summary: Returns a TriConsumer that can throw checked exceptions by wrapping the provided TriConsumer.
-
Parameters:
-
triConsumer(TriConsumer<A, B, C>) — the TriConsumer to wrap
-
- Returns: a Throwables.TriConsumer that wraps the provided TriConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
public static <R, E extends Throwable> Throwables.Callable<R, E> cc(final Callable<R> callable) - Summary: Casts a standard java.util.concurrent.Callable to a Throwables.Callable that can throw checked exceptions.
-
Contract:
- This method performs an unchecked cast and should be used with caution.
-
Parameters:
-
callable(Callable<R>) — the standard Callable to cast
-
- Returns: a Throwables.Callable that wraps the provided Callable
ff(...) -> Throwables.Function<T, R, E>
-
Signature:
@Beta public static <T, R, E extends Throwable> Throwables.Function<T, R, E> ff(final Function<T, ? extends R> function) throws IllegalArgumentException - Summary: Returns a Function that can throw checked exceptions by wrapping the provided Function.
-
Parameters:
-
function(Function<T, ? extends R>) — the Function to wrap
-
- Returns: a Throwables.Function that wraps the provided Function
-
Throws:
-
java.lang.IllegalArgumentException— if function is null
-
- See also: #from(java.util.function.Function)
-
Signature:
@Beta public static <A, T, R, E extends Throwable> Throwables.Function<T, R, E> ff(final A a, final java.util.function.BiFunction<A, T, R> biFunction) throws IllegalArgumentException - Summary: Returns a Function that partially applies the first argument to a BiFunction.
-
Parameters:
-
a(A) — the first argument to be partially applied to the BiFunction -
biFunction(java.util.function.BiFunction<A, T, R>) — the BiFunction to be partially applied
-
- Returns: a Throwables.Function that partially applies the first argument to the BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if biFunction is null
-
-
Signature:
@Beta public static <A, B, T, R, E extends Throwable> Throwables.Function<T, R, E> ff(final A a, final B b, final TriFunction<A, B, T, R> triFunction) throws IllegalArgumentException - Summary: Returns a Function that partially applies the first two arguments to a TriFunction.
-
Parameters:
-
a(A) — the first argument to be partially applied to the TriFunction -
b(B) — the second argument to be partially applied to the TriFunction -
triFunction(TriFunction<A, B, T, R>) — the TriFunction to be partially applied
-
- Returns: a Throwables.Function that partially applies the first two arguments to the TriFunction
-
Throws:
-
java.lang.IllegalArgumentException— if triFunction is null
-
-
Signature:
@Beta public static <T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> ff(final BiFunction<T, U, R> biFunction) throws IllegalArgumentException - Summary: Returns a BiFunction that can throw checked exceptions by wrapping the provided BiFunction.
-
Parameters:
-
biFunction(BiFunction<T, U, R>) — the BiFunction to wrap
-
- Returns: a Throwables.BiFunction that wraps the provided BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if biFunction is null
-
- See also: #from(java.util.function.BiFunction)
-
Signature:
@Beta public static <A, T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> ff(final A a, final TriFunction<A, T, U, R> triFunction) throws IllegalArgumentException - Summary: Returns a BiFunction that partially applies the first argument to a TriFunction.
-
Parameters:
-
a(A) — the first argument to be partially applied to the TriFunction -
triFunction(TriFunction<A, T, U, R>) — the TriFunction to be partially applied
-
- Returns: a Throwables.BiFunction that partially applies the first argument to the TriFunction
-
Throws:
-
java.lang.IllegalArgumentException— if triFunction is null
-
-
Signature:
@Beta public static <A, B, C, R, E extends Throwable> Throwables.TriFunction<A, B, C, R, E> ff(final TriFunction<A, B, C, R> triFunction) throws IllegalArgumentException - Summary: Returns a TriFunction that can throw checked exceptions by wrapping the provided TriFunction.
-
Parameters:
-
triFunction(TriFunction<A, B, C, R>) — the TriFunction to wrap
-
- Returns: a Throwables.TriFunction that wraps the provided TriFunction
-
Throws:
-
java.lang.IllegalArgumentException— if triFunction is null
-
sp(...) -> Throwables.Predicate<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Predicate<T, E> sp(final Object mutex, final Throwables.Predicate<T, E> predicate) throws IllegalArgumentException - Summary: Returns a synchronized Predicate that executes the provided predicate within a synchronized block.
-
Contract:
- This is useful for making predicates thread-safe when accessing shared mutable state.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
predicate(Throwables.Predicate<T, E>) — the predicate to be executed within the synchronized block
-
- Returns: a Throwables.Predicate that synchronizes on the mutex before executing the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or predicate is null
-
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Predicate<T, E> sp(final Object mutex, final A a, final Throwables.BiPredicate<A, T, E> biPredicate) throws IllegalArgumentException - Summary: Returns a synchronized Predicate that partially applies the first argument to a BiPredicate and executes it within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
a(A) — the first argument to be partially applied to the BiPredicate -
biPredicate(Throwables.BiPredicate<A, T, E>) — the BiPredicate to be partially applied and executed within the synchronized block
-
- Returns: a Throwables.Predicate that synchronizes on the mutex before executing the partially applied BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biPredicate is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiPredicate<T, U, E> sp(final Object mutex, final Throwables.BiPredicate<T, U, E> biPredicate) throws IllegalArgumentException - Summary: Returns a synchronized BiPredicate that executes the provided BiPredicate within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
biPredicate(Throwables.BiPredicate<T, U, E>) — the BiPredicate to be executed within the synchronized block
-
- Returns: a Throwables.BiPredicate that synchronizes on the mutex before executing the BiPredicate
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biPredicate is null
-
sc(...) -> Throwables.Consumer<T, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Consumer<T, E> sc(final Object mutex, final Throwables.Consumer<T, E> consumer) throws IllegalArgumentException - Summary: Returns a synchronized Consumer that executes the provided consumer within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
consumer(Throwables.Consumer<T, E>) — the consumer to be executed within the synchronized block
-
- Returns: a Throwables.Consumer that synchronizes on the mutex before executing the consumer
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or consumer is null
-
-
Signature:
@Beta public static <A, T, E extends Throwable> Throwables.Consumer<T, E> sc(final Object mutex, final A a, final Throwables.BiConsumer<A, T, E> biConsumer) throws IllegalArgumentException - Summary: Returns a synchronized Consumer that partially applies the first argument to a BiConsumer and executes it within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
a(A) — the first argument to be partially applied to the BiConsumer -
biConsumer(Throwables.BiConsumer<A, T, E>) — the BiConsumer to be partially applied and executed within the synchronized block
-
- Returns: a Throwables.Consumer that synchronizes on the mutex before executing the partially applied BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biConsumer is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiConsumer<T, U, E> sc(final Object mutex, final Throwables.BiConsumer<T, U, E> biConsumer) throws IllegalArgumentException - Summary: Returns a synchronized BiConsumer that executes the provided BiConsumer within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
biConsumer(Throwables.BiConsumer<T, U, E>) — the BiConsumer to be executed within the synchronized block
-
- Returns: a Throwables.BiConsumer that synchronizes on the mutex before executing the BiConsumer
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biConsumer is null
-
sf(...) -> Throwables.Function<T, R, E>
-
Signature:
@Beta public static <T, R, E extends Throwable> Throwables.Function<T, R, E> sf(final Object mutex, final Throwables.Function<T, ? extends R, E> function) throws IllegalArgumentException - Summary: Returns a synchronized Function that executes the provided function within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
function(Throwables.Function<T, ? extends R, E>) — the function to be executed within the synchronized block
-
- Returns: a Throwables.Function that synchronizes on the mutex before executing the function
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or function is null
-
-
Signature:
@Beta public static <A, T, R, E extends Throwable> Throwables.Function<T, R, E> sf(final Object mutex, final A a, final Throwables.BiFunction<A, T, R, E> biFunction) throws IllegalArgumentException - Summary: Returns a synchronized Function that partially applies the first argument to a BiFunction and executes it within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
a(A) — the first argument to be partially applied to the BiFunction -
biFunction(Throwables.BiFunction<A, T, R, E>) — the BiFunction to be partially applied and executed within the synchronized block
-
- Returns: a Throwables.Function that synchronizes on the mutex before executing the partially applied BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biFunction is null
-
-
Signature:
@Beta public static <T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> sf(final Object mutex, final Throwables.BiFunction<T, U, R, E> biFunction) throws IllegalArgumentException - Summary: Returns a synchronized BiFunction that executes the provided BiFunction within a synchronized block.
-
Parameters:
-
mutex(Object) — the object to synchronize on -
biFunction(Throwables.BiFunction<T, U, R, E>) — the BiFunction to be executed within the synchronized block
-
- Returns: a Throwables.BiFunction that synchronizes on the mutex before executing the BiFunction
-
Throws:
-
java.lang.IllegalArgumentException— if mutex or biFunction is null
-
c2f(...) -> Throwables.Function<T, Void, E>
-
Signature:
@Beta public static <T, E extends Throwable> Throwables.Function<T, Void, E> c2f(final Throwables.Consumer<T, E> consumer) throws IllegalArgumentException - Summary: Converts a Consumer to a Function that returns {@code null} after executing the consumer.
-
Contract:
- This is useful when you need a function interface but only have side effects.
-
Parameters:
-
consumer(Throwables.Consumer<T, E>) — the consumer to convert to a function
-
- Returns: a Throwables.Function that executes the consumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
-
Signature:
@Beta public static <T, R, E extends Throwable> Throwables.Function<T, R, E> c2f(final Throwables.Consumer<T, E> consumer, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a Consumer to a Function that returns a specified value after executing the consumer.
-
Parameters:
-
consumer(Throwables.Consumer<T, E>) — the consumer to convert to a function -
valueToReturn(R) — the value to return after executing the consumer
-
- Returns: a Throwables.Function that executes the consumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null
-
-
Signature:
@Beta public static <T, U, E extends Throwable> Throwables.BiFunction<T, U, Void, E> c2f(final Throwables.BiConsumer<T, U, E> biConsumer) throws IllegalArgumentException - Summary: Converts a BiConsumer to a BiFunction that returns {@code null} after executing the consumer.
-
Parameters:
-
biConsumer(Throwables.BiConsumer<T, U, E>) — the BiConsumer to convert to a BiFunction
-
- Returns: a Throwables.BiFunction that executes the BiConsumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if biConsumer is null
-
-
Signature:
@Beta public static <T, U, R, E extends Throwable> Throwables.BiFunction<T, U, R, E> c2f(final Throwables.BiConsumer<T, U, E> biConsumer, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a BiConsumer to a BiFunction that returns a specified value after executing the consumer.
-
Parameters:
-
biConsumer(Throwables.BiConsumer<T, U, E>) — the BiConsumer to convert to a BiFunction -
valueToReturn(R) — the value to return after executing the BiConsumer
-
- Returns: a Throwables.BiFunction that executes the BiConsumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if biConsumer is null
-
-
Signature:
@Beta public static <A, B, C, E extends Throwable> Throwables.TriFunction<A, B, C, Void, E> c2f(final Throwables.TriConsumer<A, B, C, E> triConsumer) throws IllegalArgumentException - Summary: Converts a TriConsumer to a TriFunction that returns {@code null} after executing the consumer.
-
Parameters:
-
triConsumer(Throwables.TriConsumer<A, B, C, E>) — the TriConsumer to convert to a TriFunction
-
- Returns: a Throwables.TriFunction that executes the TriConsumer and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
-
Signature:
@Beta public static <A, B, C, R, E extends Throwable> Throwables.TriFunction<A, B, C, R, E> c2f(final Throwables.TriConsumer<A, B, C, E> triConsumer, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a TriConsumer to a TriFunction that returns a specified value after executing the consumer.
-
Parameters:
-
triConsumer(Throwables.TriConsumer<A, B, C, E>) — the TriConsumer to convert to a TriFunction -
valueToReturn(R) — the value to return after executing the TriConsumer
-
- Returns: a Throwables.TriFunction that executes the TriConsumer and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if triConsumer is null
-
f2c(...) -> Throwables.Consumer<T, E>
-
Signature:
@Beta public static <T, R, E extends Throwable> Throwables.Consumer<T, E> f2c(final Throwables.Function<T, ? extends R, E> func) throws IllegalArgumentException - Summary: Converts a Function to a Consumer that ignores the function's return value.
-
Contract:
- This is useful when you need a consumer interface but have a function.
-
Parameters:
-
func(Throwables.Function<T, ? extends R, E>) — the function to convert to a consumer
-
- Returns: a Throwables.Consumer that executes the function and ignores its result
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
-
Signature:
@Beta public static <T, U, R, E extends Throwable> Throwables.BiConsumer<T, U, E> f2c(final Throwables.BiFunction<T, U, ? extends R, E> func) throws IllegalArgumentException - Summary: Converts a BiFunction to a BiConsumer that ignores the function's return value.
-
Parameters:
-
func(Throwables.BiFunction<T, U, ? extends R, E>) — the BiFunction to convert to a BiConsumer
-
- Returns: a Throwables.BiConsumer that executes the BiFunction and ignores its result
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
-
Signature:
@Beta public static <A, B, C, R, E extends Throwable> Throwables.TriConsumer<A, B, C, E> f2c(final Throwables.TriFunction<A, B, C, ? extends R, E> func) throws IllegalArgumentException - Summary: Converts a TriFunction to a TriConsumer that ignores the function's return value.
-
Parameters:
-
func(Throwables.TriFunction<A, B, C, ? extends R, E>) — the TriFunction to convert to a TriConsumer
-
- Returns: a Throwables.TriConsumer that executes the TriFunction and ignores its result
-
Throws:
-
java.lang.IllegalArgumentException— if func is null
-
r(...) -> Throwables.Runnable<E>
-
Signature:
public static <E extends Throwable> Throwables.Runnable<E> r(final Throwables.Runnable<E> runnable) throws IllegalArgumentException - Summary: Returns the provided Runnable as a Throwables.Runnable.
-
Contract:
- This helps with type inference when passing runnables to generic methods.
-
Parameters:
-
runnable(Throwables.Runnable<E>) — the runnable to return
-
- Returns: the same Throwables.Runnable that was provided
-
Throws:
-
java.lang.IllegalArgumentException— if runnable is null
-
r2c(...) -> Throwables.Callable<Void, E>
-
Signature:
public static <E extends Throwable> Throwables.Callable<Void, E> r2c(final Throwables.Runnable<E> runnable) throws IllegalArgumentException - Summary: Converts a Runnable to a Callable that returns {@code null} after executing the runnable.
-
Parameters:
-
runnable(Throwables.Runnable<E>) — the runnable to convert to a callable
-
- Returns: a Throwables.Callable that executes the runnable and returns null
-
Throws:
-
java.lang.IllegalArgumentException— if runnable is null
-
-
Signature:
public static <R, E extends Throwable> Throwables.Callable<R, E> r2c(final Throwables.Runnable<E> runnable, final R valueToReturn) throws IllegalArgumentException - Summary: Converts a Runnable to a Callable that returns a specified value after executing the runnable.
-
Contract:
- This is useful for adapting runnables to callables when you need a specific return value.
-
Parameters:
-
runnable(Throwables.Runnable<E>) — the runnable to convert to a callable -
valueToReturn(R) — the value to return after executing the runnable
-
- Returns: a Throwables.Callable that executes the runnable and returns the specified value
-
Throws:
-
java.lang.IllegalArgumentException— if runnable is null
-
c2r(...) -> Throwables.Runnable<E>
-
Signature:
public static <R, E extends Throwable> Throwables.Runnable<E> c2r(final Throwables.Callable<R, E> callable) throws IllegalArgumentException - Summary: Converts a Callable to a Runnable that ignores the callable's return value.
-
Contract:
- This is useful for adapting callables to runnable interfaces when you don't need the return value.
-
Parameters:
-
callable(Throwables.Callable<R, E>) — the callable to convert to a runnable
-
- Returns: a Throwables.Runnable that executes the callable and ignores its result
-
Throws:
-
java.lang.IllegalArgumentException— if callable is null
-
rr(...) -> Throwables.Runnable<E>
-
Signature:
public static <E extends Throwable> Throwables.Runnable<E> rr(final Runnable runnable) - Summary: Casts a standard java.lang.Runnable to a Throwables.Runnable that can throw checked exceptions.
-
Contract:
- This method performs an unchecked cast and should be used with caution.
-
Parameters:
-
runnable(Runnable) — the standard Runnable to cast
-
- Returns: a Throwables.Runnable that wraps the provided Runnable
jr2r(...) -> Throwables.Runnable<E>
-
Signature:
public static <E extends Throwable> Throwables.Runnable<E> jr2r(final java.lang.Runnable runnable) throws IllegalArgumentException - Summary: Converts a standard java.lang.Runnable to a Throwables.Runnable that can throw checked exceptions.
-
Contract:
- If the input is already a Throwables.Runnable, it is returned as-is.
-
Parameters:
-
runnable(java.lang.Runnable) — the standard Runnable to convert
-
- Returns: a Throwables.Runnable that wraps the provided Runnable
-
Throws:
-
java.lang.IllegalArgumentException— if runnable is null
-
r2jr(...) -> java.lang.Runnable
-
Signature:
public static <E extends Throwable> java.lang.Runnable r2jr(final Throwables.Runnable<E> runnable) throws IllegalArgumentException - Summary: Converts a Throwables.Runnable to a standard java.lang.Runnable.
-
Contract:
- If the input is already a java.lang.Runnable, it is returned as-is.
-
Parameters:
-
runnable(Throwables.Runnable<E>) — the Throwables.Runnable to convert
-
- Returns: a standard java.lang.Runnable that wraps the provided Throwables.Runnable
-
Throws:
-
java.lang.IllegalArgumentException— if runnable is null
-
jc2c(...) -> Throwables.Callable<R, Exception>
-
Signature:
public static <R> Throwables.Callable<R, Exception> jc2c(final java.util.concurrent.Callable<R> callable) throws IllegalArgumentException - Summary: Converts a standard java.util.concurrent.Callable to a Throwables.Callable that can throw checked exceptions.
-
Contract:
- If the input is already a Throwables.Callable, it is returned as-is.
-
Parameters:
-
callable(java.util.concurrent.Callable<R>) — the standard Callable to convert
-
- Returns: a Throwables.Callable that wraps the provided Callable
-
Throws:
-
java.lang.IllegalArgumentException— if callable is null
-
c2jc(...) -> java.util.concurrent.Callable<R>
-
Signature:
public static <R> java.util.concurrent.Callable<R> c2jc(final Throwables.Callable<R, ? extends Exception> callable) throws IllegalArgumentException - Summary: Converts a Throwables.Callable to a standard java.util.concurrent.Callable.
-
Contract:
- If the input is already a java.util.concurrent.Callable, it is returned as-is.
-
Parameters:
-
callable(Throwables.Callable<R, ? extends Exception>) — the Throwables.Callable to convert
-
- Returns: a standard java.util.concurrent.Callable that wraps the provided Throwables.Callable
-
Throws:
-
java.lang.IllegalArgumentException— if callable is null
-
Public Instance Methods
- (none)
Class Fraction (com.landawn.abacus.util.Fraction)
An immutable, high-precision representation of rational numbers stored as integer fractions, providing exact arithmetic operations without the precision loss inherent in floating-point representations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Fraction
-
Signature:
public static Fraction of(final int numerator, final int denominator) - Summary: Creates a {@code Fraction} instance with the specified numerator and denominator.
-
Parameters:
-
numerator(int) — the numerator of the fraction -
denominator(int) — the denominator of the fraction
-
- Returns: a new fraction instance
- See also: #of(int, int, boolean)
-
Signature:
public static Fraction of(int numerator, int denominator, final boolean reduce) - Summary: Creates a {@code Fraction} instance with the specified numerator and denominator, with an option to reduce the fraction to its simplest form.
-
Contract:
- </p> <p> When {@code reduce} is {@code true} , the fraction is simplified to its lowest terms by dividing both numerator and denominator by their greatest common divisor.
-
Parameters:
-
numerator(int) — the numerator of the fraction -
denominator(int) — the denominator of the fraction -
reduce(boolean) — if {@code true} , reduces the fraction to its simplest form
-
- Returns: a new fraction instance
-
Signature:
public static Fraction of(final int whole, final int numerator, final int denominator) - Summary: Creates a {@code Fraction} instance representing a mixed fraction (whole and fractional parts).
-
Parameters:
-
whole(int) — the whole number part -
numerator(int) — the numerator of the fractional part -
denominator(int) — the denominator of the fractional part
-
- Returns: a new fraction instance
- See also: #of(int, int, int, boolean)
-
Signature:
public static Fraction of(final int whole, final int numerator, final int denominator, final boolean reduce) - Summary: Creates a {@code Fraction} instance representing a mixed fraction with optional reduction.
-
Contract:
- The negative sign must be on the whole number part if the fraction is negative.
- <p> The calculation is performed as follows: </p> <ul> <li> If whole is positive: result = whole × denominator + numerator </li> <li> If whole is negative: result = whole × denominator - numerator </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Fraction f1 = Fraction.of(1, 2, 4, false); // Creates 6/4 Fraction f2 = Fraction.of(1, 2, 4, true); // Creates 3/2 (reduced) Fraction f3 = Fraction.of(-1, 1, 2, true); // Creates -3/2 } </pre>
-
Parameters:
-
whole(int) — the whole number part (negative sign goes here for negative fractions) -
numerator(int) — the numerator of the fractional part (must be non-negative) -
denominator(int) — the denominator of the fractional part (must be positive) -
reduce(boolean) — if {@code true} , reduces the resulting fraction to its simplest form
-
- Returns: a new fraction instance
-
Signature:
public static Fraction of(double value) - Summary: Creates a {@code Fraction} instance from a {@code double} value using the continued fraction algorithm.
-
Parameters:
-
value(double) — the double value to convert to a fraction
-
- Returns: a new fraction instance that approximates the given value
-
Signature:
public static Fraction of(String str) - Summary: Creates a {@code Fraction} from a string representation.
-
Parameters:
-
str(String) — the string to parse
-
- Returns: a new fraction instance
Public Instance Methods
getNumerator(...) -> int
-
Signature:
@Deprecated public int getNumerator() - Summary: Gets the numerator part of the fraction.
-
Parameters:
- (none)
- Returns: the numerator of the fraction
numerator(...) -> int
-
Signature:
public int numerator() - Summary: Gets the numerator part of the fraction.
-
Parameters:
- (none)
- Returns: the numerator of the fraction
getDenominator(...) -> int
-
Signature:
@Deprecated public int getDenominator() - Summary: Gets the denominator part of the fraction.
-
Parameters:
- (none)
- Returns: the denominator of the fraction
denominator(...) -> int
-
Signature:
public int denominator() - Summary: Gets the denominator part of the fraction.
-
Parameters:
- (none)
- Returns: the denominator of the fraction
getProperNumerator(...) -> int
-
Signature:
@Deprecated public int getProperNumerator() - Summary: Gets the proper numerator of the fraction, always positive.
-
Parameters:
- (none)
- Returns: the positive proper numerator
properNumerator(...) -> int
-
Signature:
public int properNumerator() - Summary: Gets the proper numerator of the fraction, always positive.
-
Parameters:
- (none)
- Returns: the positive proper numerator
getProperWhole(...) -> int
-
Signature:
@Deprecated public int getProperWhole() - Summary: Gets the whole number part of the fraction.
-
Parameters:
- (none)
- Returns: the whole number part of the fraction
properWhole(...) -> int
-
Signature:
public int properWhole() - Summary: Gets the whole number part of the fraction.
-
Parameters:
- (none)
- Returns: the whole number part of the fraction
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Gets the fraction as an {@code int} value by performing integer division.
-
Parameters:
- (none)
- Returns: the whole number part of the fraction as an int
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Gets the fraction as a {@code long} value by performing integer division.
-
Parameters:
- (none)
- Returns: the whole number part of the fraction as a long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Gets the fraction as a {@code float} value by performing floating-point division.
-
Parameters:
- (none)
- Returns: the fraction as a float value
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Gets the fraction as a {@code double} value by performing floating-point division.
-
Parameters:
- (none)
- Returns: the fraction as a double value
reduce(...) -> Fraction
-
Signature:
public Fraction reduce() - Summary: Reduces this fraction to its simplest form by dividing both numerator and denominator by their greatest common divisor (GCD).
-
Contract:
- Returns a new fraction instance if reduction is possible, otherwise returns this instance.
-
Parameters:
- (none)
- Returns: a new reduced fraction instance, or this instance if already in simplest form
invert(...) -> Fraction
-
Signature:
public Fraction invert() - Summary: Returns the multiplicative inverse (reciprocal) of this fraction.
-
Parameters:
- (none)
- Returns: a new fraction that is the inverse of this fraction
negate(...) -> Fraction
-
Signature:
public Fraction negate() - Summary: Returns the additive inverse (negative) of this fraction.
-
Parameters:
- (none)
- Returns: a new fraction with the opposite sign
abs(...) -> Fraction
-
Signature:
public Fraction abs() - Summary: Returns the absolute value of this fraction.
-
Contract:
- If the fraction is already positive or zero, returns this instance.
- If negative, returns a new fraction with the positive value.
-
Parameters:
- (none)
- Returns: this instance if positive or zero, otherwise a new positive fraction
pow(...) -> Fraction
-
Signature:
public Fraction pow(final int power) - Summary: Raises this fraction to the specified integer power.
-
Parameters:
-
power(int) — the power to raise the fraction to
-
- Returns: the fraction raised to the given power
add(...) -> Fraction
-
Signature:
public Fraction add(final Fraction fraction) - Summary: Adds this fraction to another fraction and returns the result in reduced form.
-
Parameters:
-
fraction(Fraction) — the fraction to add to this fraction (must not be null)
-
- Returns: a new {@code Fraction} instance with the sum in reduced form
subtract(...) -> Fraction
-
Signature:
public Fraction subtract(final Fraction fraction) - Summary: Subtracts another fraction from this fraction and returns the result in reduced form.
-
Parameters:
-
fraction(Fraction) — the fraction to subtract from this fraction (must not be null)
-
- Returns: a new {@code Fraction} instance with the difference in reduced form
multipliedBy(...) -> Fraction
-
Signature:
public Fraction multipliedBy(final Fraction fraction) - Summary: Multiplies this fraction by another fraction and returns the result in reduced form.
-
Parameters:
-
fraction(Fraction) — the fraction to multiply by (must not be null)
-
- Returns: a new {@code Fraction} instance with the product in reduced form
dividedBy(...) -> Fraction
-
Signature:
public Fraction dividedBy(final Fraction fraction) - Summary: Divides this fraction by another fraction and returns the result.
-
Parameters:
-
fraction(Fraction) — the fraction to divide by (must not be {@code null} or zero)
-
- Returns: a new {@code Fraction} instance with the quotient
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final Fraction other) - Summary: Compares this fraction to another fraction based on their numeric values.
-
Contract:
- The compareTo method treats fractions as equal if they have the same numeric value (e.g., 1/2 and 2/4 are considered equal), while the equals method requires both numerator and denominator to be identical.
-
Parameters:
-
other(Fraction) — the fraction to compare to
-
- Returns: -1 if this fraction is less than the other, 0 if equal in value, +1 if this fraction is greater than the other
toProperString(...) -> String
-
Signature:
public String toProperString() - Summary: Formats this fraction as a proper fraction string in the format "X Y/Z".
-
Contract:
- <p> The format rules are: </p> <ul> <li> If the numerator is zero, returns "0" </li> <li> If the fraction equals 1, returns "1" </li> <li> If the fraction equals -1, returns "-1" </li> <li> If the fraction is proper (numerator < denominator), returns "numerator/denominator" </li> <li> If the fraction is improper, returns "whole numerator/denominator" format </li> <li> If the fraction has no fractional part, returns just the whole number </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Fraction.of(0, 1).toProperString(); // Returns "0" Fraction.of(3, 4).toProperString(); // Returns "3/4" Fraction.of(7, 4).toProperString(); // Returns "1 3/4" Fraction.of(8, 4).toProperString(); // Returns "2" Fraction.of(-7, 4).toProperString(); // Returns "-1 3/4" } </pre>
-
Parameters:
- (none)
- Returns: a string representation in proper fraction format
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Tests whether this fraction is equal to another object.
-
Contract:
- Two fractions are considered equal if and only if they have the same numerator and the same denominator.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this fraction.
-
Parameters:
- (none)
- Returns: a hash code value for this fraction
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this fraction in the format "numerator/denominator".
-
Parameters:
- (none)
- Returns: a string in the format "numerator/denominator"
Class Futures (com.landawn.abacus.util.Futures)
A comprehensive utility class providing powerful methods for composing, combining, and managing multiple {@link Future} objects in concurrent programming scenarios.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
compose(...) -> ContinuableFuture<R>
-
Signature:
public static <T1, T2, R> ContinuableFuture<R> compose(final Future<T1> cf1, final Future<T2> cf2, final Throwables.BiFunction<? super Future<T1>, ? super Future<T2>, ? extends R, ? extends Exception> zipFunctionForGet) - Summary: Composes two futures into a new ContinuableFuture by applying a zip function to the Future objects themselves.
-
Contract:
- The function is executed when get() or get(timeout, unit) is called on the returned future, allowing lazy evaluation of the composition logic.
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Lazy Execution: </b> The zip function is not executed until get() is called on the returned future </li> <li> <b> Custom Coordination: </b> Full control over how and when to retrieve values from input futures </li> <li> <b> Exception Handling: </b> InterruptedException and ExecutionException are propagated directly </li> <li> <b> Unified Behavior: </b> Same logic applies to both timed and untimed get operations </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic arithmetic combination Future<Integer> future1 = CompletableFuture.completedFuture(5); Future<Integer> future2 = CompletableFuture.completedFuture(10); ContinuableFuture<Integer> sum = Futures.compose(future1, future2, (f1, f2) -> f1.get() + f2.get()); System.out.println(sum.get()); // Prints: 15 // Custom error handling Future<String> mayFail1 = riskyOperation1(); Future<String> mayFail2 = riskyOperation2(); ContinuableFuture<String> combined = Futures.compose(mayFail1, mayFail2, (f1, f2) -> { try { return f1.get() + " " + f2.get(); } catch (Exception e) { return "Fallback value"; } }); // Conditional retrieval based on one future's result Future<Boolean> condition = checkCondition(); Future<Data> expensiveData = loadExpensiveData(); ContinuableFuture<Data> result = Futures.compose(condition, expensiveData, (condFuture, dataFuture) -> { if (condFuture.get()) { return dataFuture.get(); } else { return Data.DEFAULT; // Skip expensive retrieval } }); } </pre>
-
Parameters:
-
cf1(Future<T1>) — the first future to compose, must not be {@code null} . -
cf2(Future<T2>) — the second future to compose, must not be {@code null} . -
zipFunctionForGet(Throwables.BiFunction<? super Future<T1>, ? super Future<T2>, ? extends R, ? extends Exception>) — the function that combines the futures' results. Receives both Future objects as parameters and returns the composed result. Must not be {@code null} .
-
- Returns: a ContinuableFuture that completes when both input futures complete, with a result computed by the provided zip function.
- See also: #compose(Future, Future, Throwables.BiFunction, Throwables.Function), #combine(Future, Future, Throwables.BiFunction), ContinuableFuture
-
Signature:
public static <T1, T2, R> ContinuableFuture<R> compose(final Future<T1> cf1, final Future<T2> cf2, final Throwables.BiFunction<? super Future<T1>, ? super Future<T2>, ? extends R, ? extends Exception> zipFunctionForGet, final Throwables.Function<? super Tuple4<Future<T1>, Future<T2>, Long, TimeUnit>, R, ? extends Exception> zipFunctionTimeoutGet) - Summary: Composes two futures into a new ContinuableFuture with separate functions for regular and timeout-based operations.
-
Contract:
- <p> This is useful when you need different behavior for time-constrained operations, such as returning a default value or using a different computation strategy when under time pressure.
- This enables sophisticated patterns like graceful degradation, partial results, or fallback strategies when operating under strict time constraints.
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Dual Strategies: </b> Different execution paths for time-unlimited and time-limited scenarios </li> <li> <b> Timeout Awareness: </b> Timeout function receives exact timeout parameters for precise control </li> <li> <b> Graceful Degradation: </b> Supports returning partial or cached results when time is limited </li> <li> <b> Performance Optimization: </b> Allows skipping expensive operations when under time pressure </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic timeout handling with fallback Future<String> slowFuture = CompletableFuture.supplyAsync(() -> { Thread.sleep(5000); return "Slow Result"; }); Future<String> fastFuture = CompletableFuture.completedFuture("Fast Result"); ContinuableFuture<String> composed = Futures.compose(slowFuture, fastFuture, (f1, f2) -> f1.get() + " + " + f2.get(), tuple -> { // For timeout, just use the fast future return "Timeout: " + tuple._2.get(tuple._3, tuple._4); }); // Will return quickly with timeout logic String result = composed.get(100, TimeUnit.MILLISECONDS); // Sophisticated timeout handling with partial results Future<List<Data>> primaryData = fetchPrimaryData(); Future<List<Data>> cachedData = fetchCachedData(); ContinuableFuture<Report> report = Futures.compose(primaryData, cachedData, // Full computation when time unlimited (primary, cached) -> { List<Data> all = new ArrayList<>(primary.get()); all.addAll(cached.get()); return generateFullReport(all); }, // Quick computation when time limited tuple -> { try { // Try primary first with available time List<Data> data = tuple._1.get(tuple._3, tuple._4); return generateQuickReport(data); } catch (TimeoutException e) { // Fall back to cache if primary times out if (tuple._2.isDone()) { return generateQuickReport(tuple._2.get()); } return Report.EMPTY; } }); // Conditional expensive operation Future<Boolean> shouldProcess = checkProcessingFlag(); Future<ExpensiveData> expensiveOperation = performExpensiveOperation(); ContinuableFuture<Result> result = Futures.compose(shouldProcess, expensiveOperation, (flag, data) -> flag.get() ?
- processData(data.get()) : Result.SKIPPED, tuple -> { // Under timeout, skip expensive operation if flag is false boolean process = tuple._1.get(tuple._3 / 2, tuple._4); if (!process) { return Result.SKIPPED; } return processData(tuple._2.get(tuple._3 / 2, tuple._4)); }); } </pre>
-
Parameters:
-
cf1(Future<T1>) — the first future to compose, must not be {@code null} . -
cf2(Future<T2>) — the second future to compose, must not be {@code null} . -
zipFunctionForGet(Throwables.BiFunction<? super Future<T1>, ? super Future<T2>, ? extends R, ? extends Exception>) — the function that combines the futures' results for regular get() operations. Receives both Future objects. Must not be {@code null} . -
zipFunctionTimeoutGet(Throwables.Function<? super Tuple4<Future<T1>, Future<T2>, Long, TimeUnit>, R, ? extends Exception>) — the function for get(timeout, unit) operations. Receives a Tuple4 containing: (_1: future1, _2: future2, _3: timeout value, _4: TimeUnit) Must not be {@code null} .
-
- Returns: a ContinuableFuture with custom logic for both regular and timeout operations.
- See also: #compose(Future, Future, Throwables.BiFunction), Tuple4, TimeUnit
-
Signature:
public static <T1, T2, T3, R> ContinuableFuture<R> compose(final Future<T1> cf1, final Future<T2> cf2, final Future<T3> cf3, final Throwables.TriFunction<? super Future<T1>, ? super Future<T2>, ? super Future<T3>, ? extends R, ? extends Exception> zipFunctionForGet) - Summary: Composes three futures into a new ContinuableFuture by applying a tri-function to the Future objects.
-
Contract:
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Three-Way Composition: </b> Combines three independent asynchronous operations efficiently </li> <li> <b> Flexible Coordination: </b> Full control over retrieval order and error handling strategy </li> <li> <b> Lazy Evaluation: </b> Function executes only when result is requested </li> <li> <b> Unified Behavior: </b> Same composition logic for timed and untimed operations </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic three-way string combination Future<String> nameFuture = CompletableFuture.completedFuture("John"); Future<Integer> ageFuture = CompletableFuture.completedFuture(30); Future<String> cityFuture = CompletableFuture.completedFuture("New York"); ContinuableFuture<String> profile = Futures.compose(nameFuture, ageFuture, cityFuture, (f1, f2, f3) -> String.format("%s, %d years old, from %s", f1.get(), f2.get(), f3.get())); System.out.println(profile.get()); // "John, 30 years old, from New York" // Complex data aggregation from multiple sources Future<UserData> userData = fetchUserData(userId); Future<Preferences> preferences = fetchPreferences(userId); Future<ActivityLog> activityLog = fetchActivityLog(userId); ContinuableFuture<Dashboard> dashboard = Futures.compose( userData, preferences, activityLog, (user, prefs, activity) -> { UserData u = user.get(); Preferences p = prefs.get(); ActivityLog a = activity.get(); return new Dashboard(u, p, a); }); // Conditional logic based on first future's result Future<Boolean> featureEnabled = checkFeatureFlag("newFeature"); Future<NewData> newFeatureData = fetchNewFeatureData(); Future<LegacyData> legacyData = fetchLegacyData(); ContinuableFuture<Response> response = Futures.compose( featureEnabled, newFeatureData, legacyData, (flag, newData, legacy) -> { if (flag.get()) { return Response.fromNew(newData.get()); } else { return Response.fromLegacy(legacy.get()); } }); } </pre>
-
Parameters:
-
cf1(Future<T1>) — the first future to compose, must not be {@code null} . -
cf2(Future<T2>) — the second future to compose, must not be {@code null} . -
cf3(Future<T3>) — the third future to compose, must not be {@code null} . -
zipFunctionForGet(Throwables.TriFunction<? super Future<T1>, ? super Future<T2>, ? super Future<T3>, ? extends R, ? extends Exception>) — the function that combines the futures' results. Receives all three Future objects and returns the composed result. Must not be {@code null} .
-
- Returns: a ContinuableFuture that completes when all three input futures complete, with a result computed by the provided zip function.
- See also: #compose(Future, Future, Future, Throwables.TriFunction, Throwables.Function), #combine(Future, Future, Future, Throwables.TriFunction)
-
Signature:
public static <T1, T2, T3, R> ContinuableFuture<R> compose(final Future<T1> cf1, final Future<T2> cf2, final Future<T3> cf3, final Throwables.TriFunction<? super Future<T1>, ? super Future<T2>, ? super Future<T3>, ? extends R, ? extends Exception> zipFunctionForGet, final Throwables.Function<? super Tuple5<Future<T1>, Future<T2>, Future<T3>, Long, TimeUnit>, R, ? extends Exception> zipFunctionTimeoutGet) - Summary: Composes three futures with separate functions for regular and timeout-based operations.
-
Contract:
- <p> This is particularly useful for complex operations where you might want to skip expensive computations or use cached/default values when operating under time constraints.
- The method enables patterns like partial data aggregation, priority-based retrieval, or graceful degradation when coordinating three asynchronous operations under time pressure.
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Dual Execution Paths: </b> Separate strategies for unlimited and time-limited scenarios </li> <li> <b> Priority Handling: </b> Can prioritize which futures to retrieve first under time pressure </li> <li> <b> Partial Results: </b> Supports returning results from subset of futures when time constrained </li> <li> <b> Timeout Distribution: </b> Function receives timeout parameters for dynamic time allocation </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic timeout with cache fallback Future<List<String>> dbQuery = queryDatabase(); Future<Map<String, Object>> cache = checkCache(); Future<String> config = loadConfig(); ContinuableFuture<Result> composed = Futures.compose(dbQuery, cache, config, (f1, f2, f3) -> processAllData(f1.get(), f2.get(), f3.get()), tuple -> { // Under time pressure, just use cache try { return processCacheOnly(tuple._2.get(50, TimeUnit.MILLISECONDS)); } catch (TimeoutException e) { return Result.DEFAULT; } }); // Priority-based retrieval with time allocation Future<CriticalData> critical = fetchCriticalData(); Future<ImportantData> important = fetchImportantData(); Future<OptionalData> optional = fetchOptionalData(); ContinuableFuture<AggregatedData> result = Futures.compose( critical, important, optional, // Full aggregation when time unlimited (c, i, o) -> new AggregatedData(c.get(), i.get(), o.get()), // Priority-based retrieval under timeout tuple -> { long timePerFuture = tuple._4 / 3; TimeUnit unit = tuple._5; try { // Critical data first (40% of time) CriticalData c = tuple._1.get(timePerFuture 2, unit); // Important data second (40% of time) ImportantData i = tuple._2.get(timePerFuture 2, unit); // Optional data last (20% of time) OptionalData o = tuple._3.isDone() ?
- tuple._3.get() : OptionalData.EMPTY; return new AggregatedData(c, i, o); } catch (TimeoutException e) { // Return partial results return AggregatedData.partial(e.getMessage()); } }); // Conditional logic with multiple data sources Future<Boolean> shouldUseNewAPI = checkAPIVersion(); Future<NewAPIData> newAPI = callNewAPI(); Future<OldAPIData> oldAPI = callOldAPI(); ContinuableFuture<APIResponse> response = Futures.compose( shouldUseNewAPI, newAPI, oldAPI, (flag, newData, oldData) -> flag.get() ?
- APIResponse.from(newData.get()) : APIResponse.from(oldData.get()), tuple -> { // Quick check with timeout boolean useNew = tuple._1.get(tuple._4 / 4, tuple._5); if (useNew) { return APIResponse.from(tuple._2.get(tuple._4 3 / 4, tuple._5)); } else { return APIResponse.from(tuple._3.get(tuple._4 3 / 4, tuple._5)); } }); } </pre>
-
Parameters:
-
cf1(Future<T1>) — the first future to compose, must not be {@code null} . -
cf2(Future<T2>) — the second future to compose, must not be {@code null} . -
cf3(Future<T3>) — the third future to compose, must not be {@code null} . -
zipFunctionForGet(Throwables.TriFunction<? super Future<T1>, ? super Future<T2>, ? super Future<T3>, ? extends R, ? extends Exception>) — the function that combines the futures' results for regular get() operations. Receives all three Future objects. Must not be {@code null} . -
zipFunctionTimeoutGet(Throwables.Function<? super Tuple5<Future<T1>, Future<T2>, Future<T3>, Long, TimeUnit>, R, ? extends Exception>) — the function for get(timeout, unit) operations. Receives a Tuple5 containing: (_1: future1, _2: future2, _3: future3, _4: timeout value, _5: TimeUnit) Must not be {@code null} .
-
- Returns: a ContinuableFuture with custom logic for both regular and timeout operations.
- See also: #compose(Future, Future, Future, Throwables.TriFunction), Tuple5, TimeUnit
-
Signature:
public static <T, FC extends Collection<? extends Future<? extends T>>, R> ContinuableFuture<R> compose(final FC cfs, final Throwables.Function<? super FC, ? extends R, ? extends Exception> zipFunctionForGet) - Summary: Composes a collection of futures into a single ContinuableFuture using a custom function.
-
Contract:
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Dynamic Size: </b> Works with any number of futures, determined at runtime </li> <li> <b> Collection Type Preservation: </b> Maintains the specific collection type through generics </li> <li> <b> Custom Aggregation: </b> Full control over how futures are combined and results processed </li> <li> <b> Lazy Execution: </b> Zip function executes only when result is requested </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic sum aggregation List<Future<Integer>> futures = Arrays.asList( CompletableFuture.completedFuture(1), CompletableFuture.completedFuture(2), CompletableFuture.completedFuture(3) ); ContinuableFuture<Integer> sum = Futures.compose(futures, list -> { int total = 0; for (Future<Integer> f : list) { total += f.get(); } return total; }); System.out.println(sum.get()); // Prints: 6 // Complex data aggregation with error handling List<Future<DataPoint>> dataFutures = sensors.stream() .map(sensor -> fetchDataAsync(sensor)) .collect(Collectors.toList()); ContinuableFuture<AggregatedReport> report = Futures.compose(dataFutures, futures -> { List<DataPoint> successfulData = new ArrayList<>(); List<Exception> errors = new ArrayList<>(); for (Future<DataPoint> f : futures) { try { successfulData.add(f.get()); } catch (Exception e) { errors.add(e); } } return new AggregatedReport(successfulData, errors); }); // Set-based uniqueness preservation Set<Future<String>> uniqueQueries = new HashSet<>(queryFutures); ContinuableFuture<Set<String>> uniqueResults = Futures.compose(uniqueQueries, futureSet -> { Set<String> results = new HashSet<>(); for (Future<String> f : futureSet) { results.add(f.get()); } return results; }); // Statistical analysis List<Future<Double>> measurements = performMeasurements(); ContinuableFuture<Statistics> stats = Futures.compose(measurements, futures -> { List<Double> values = new ArrayList<>(); for (Future<Double> f : futures) { values.add(f.get()); } double sum = values.stream().mapToDouble(Double::doubleValue).sum(); double avg = sum / values.size(); double max = values.stream().mapToDouble(Double::doubleValue).max().orElse(0); double min = values.stream().mapToDouble(Double::doubleValue).min().orElse(0); return new Statistics(avg, max, min, values.size()); }); } </pre>
-
Parameters:
-
cfs(FC) — the collection of input futures, must not be {@code null} or empty. -
zipFunctionForGet(Throwables.Function<? super FC, ? extends R, ? extends Exception>) — the function that combines the futures' results. Receives the collection of Future objects and returns the composed result. Must not be {@code null} .
-
- Returns: a ContinuableFuture that completes when all input futures complete, with a result computed by the provided zip function.
- See also: #compose(Collection, Throwables.Function, Throwables.Function), #combine(Collection, Throwables.Function)
-
Signature:
public static <T, FC extends Collection<? extends Future<? extends T>>, R> ContinuableFuture<R> compose(final FC cfs, final Throwables.Function<? super FC, ? extends R, ? extends Exception> zipFunctionForGet, final Throwables.Function<? super Tuple3<FC, Long, TimeUnit>, ? extends R, ? extends Exception> zipFunctionTimeoutGet) throws IllegalArgumentException - Summary: Composes a collection of futures with separate functions for regular and timeout operations.
-
Contract:
- <p> This method is ideal for scenarios where you need to aggregate results from many sources but want different behavior when operating under time constraints.
- It supports patterns like partial aggregation, best-effort collection, or graceful degradation when coordinating large numbers of asynchronous operations.
- <p> <b> Key Characteristics: </b> <ul> <li> <b> Maximum Flexibility: </b> Supports any number of futures with custom coordination logic </li> <li> <b> Dual Strategies: </b> Different aggregation approaches for unlimited and time-limited scenarios </li> <li> <b> Partial Results: </b> Can return partial aggregations when some futures haven't completed </li> <li> <b> Collection Type Preservation: </b> Maintains specific collection type through generics </li> <li> <b> Best-Effort Processing: </b> Supports gathering available results within time constraints </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic partial aggregation under timeout Set<Future<DataPoint>> dataFutures = // ...
- multiple data source futures ContinuableFuture<Summary> summary = Futures.compose(dataFutures, futures -> { // Full aggregation when we have time List<DataPoint> allData = new ArrayList<>(); for (Future<DataPoint> f : futures) { allData.add(f.get()); } return computeFullSummary(allData); }, tuple -> { // Quick summary using only completed futures List<DataPoint> available = new ArrayList<>(); for (Future<DataPoint> f : tuple._1) { if (f.isDone()) { try { available.add(f.get()); } catch (Exception e) { // Skip failed futures } } } return computeQuickSummary(available); }); // Time-budgeted distributed query aggregation List<Future<QueryResult>> distributedQueries = servers.stream() .map(server -> queryServer(server, query)) .collect(Collectors.toList()); ContinuableFuture<AggregatedResult> result = Futures.compose( distributedQueries, // Full wait for all servers futures -> { List<QueryResult> results = new ArrayList<>(); for (Future<QueryResult> f : futures) { results.add(f.get()); } return AggregatedResult.complete(results); }, // Time-budgeted collection tuple -> { Collection<Future<QueryResult>> futures = tuple._1; long timeout = tuple._2; TimeUnit unit = tuple._3; long timePerQuery = timeout / futures.size(); List<QueryResult> collected = new ArrayList<>(); for (Future<QueryResult> f : futures) { try { collected.add(f.get(timePerQuery, unit)); } catch (TimeoutException e) { // Skip slow servers } } return AggregatedResult.partial(collected); }); // Priority-based processing with fallback List<Future<CacheEntry>> cacheChecks = checkMultipleCaches(key); ContinuableFuture<CacheEntry> entry = Futures.compose( cacheChecks, futures -> { // Try all caches, return first successful for (Future<CacheEntry> f : futures) { CacheEntry e = f.get(); if (e != null) return e; } return CacheEntry.MISS; }, tuple -> { // Under timeout, check caches sequentially with time limit long remainingTime = unit.toMillis(tuple._2); long startTime = System.currentTimeMillis(); for (Future<CacheEntry> f : tuple._1) { long elapsed = System.currentTimeMillis() - startTime; long timeLeft = remainingTime - elapsed; if (timeLeft <= 0) break; try { CacheEntry e = f.get(timeLeft, TimeUnit.MILLISECONDS); if (e != null) return e; } catch (TimeoutException e) { continue; } } return CacheEntry.MISS; }); } </pre>
-
Parameters:
-
cfs(FC) — the collection of input futures, must not be {@code null} or empty. -
zipFunctionForGet(Throwables.Function<? super FC, ? extends R, ? extends Exception>) — the function that combines the futures' results for regular get() operations. Receives the collection of Future objects. Must not be {@code null} . -
zipFunctionTimeoutGet(Throwables.Function<? super Tuple3<FC, Long, TimeUnit>, ? extends R, ? extends Exception>) — the function for get(timeout, unit) operations. Receives a Tuple3 containing: (_1: futures collection, _2: timeout value, _3: TimeUnit). Must not be {@code null} .
-
- Returns: a ContinuableFuture with custom logic for both regular and timeout operations.
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or empty, or if either function is null.
-
- See also: #compose(Collection, Throwables.Function), Tuple3, TimeUnit
combine(...) -> ContinuableFuture<Tuple2<T1, T2>>
-
Signature:
public static <T1, T2> ContinuableFuture<Tuple2<T1, T2>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2) - Summary: Combines two futures into a Tuple2 containing both results.
-
Contract:
- <p> This method is particularly useful when you need both results but don't want to transform them immediately, or when passing multiple results to another function.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future.
-
- Returns: a ContinuableFuture containing a Tuple2 with both results.
- See also: #combine(Future, Future, Future), #combine(Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, T3> ContinuableFuture<Tuple3<T1, T2, T3>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3) - Summary: Combines three futures into a Tuple3 containing all three results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future.
-
- Returns: a ContinuableFuture containing a Tuple3 with all three results.
- See also: #combine(Future, Future), #combine(Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, T3, T4> ContinuableFuture<Tuple4<T1, T2, T3, T4>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3, final Future<? extends T4> cf4) - Summary: Combines four futures into a Tuple4 containing all four results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future. -
cf4(Future<? extends T4>) — the fourth future.
-
- Returns: a ContinuableFuture containing a Tuple4 with all four results.
- See also: #combine(Future, Future), #combine(Future, Future, Future), #combine(Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, T3, T4, T5> ContinuableFuture<Tuple5<T1, T2, T3, T4, T5>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3, final Future<? extends T4> cf4, final Future<? extends T5> cf5) - Summary: Combines five futures into a Tuple5 containing all five results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future. -
cf4(Future<? extends T4>) — the fourth future. -
cf5(Future<? extends T5>) — the fifth future.
-
- Returns: a ContinuableFuture containing a Tuple5 with all five results.
- See also: #combine(Future, Future), #combine(Future, Future, Future), #combine(Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, T3, T4, T5, T6> ContinuableFuture<Tuple6<T1, T2, T3, T4, T5, T6>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3, final Future<? extends T4> cf4, final Future<? extends T5> cf5, final Future<? extends T6> cf6) - Summary: Combines six futures into a Tuple6 containing all six results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future. -
cf4(Future<? extends T4>) — the fourth future. -
cf5(Future<? extends T5>) — the fifth future. -
cf6(Future<? extends T6>) — the sixth future.
-
- Returns: a ContinuableFuture containing a Tuple6 with all six results.
- See also: #combine(Future, Future), #combine(Future, Future, Future), #combine(Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, T3, T4, T5, T6, T7> ContinuableFuture<Tuple7<T1, T2, T3, T4, T5, T6, T7>> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3, final Future<? extends T4> cf4, final Future<? extends T5> cf5, final Future<? extends T6> cf6, final Future<? extends T7> cf7) - Summary: Combines seven futures into a Tuple7 containing all seven results.
-
Contract:
- The maximum tuple size supported, useful for very complex coordination scenarios where seven independent operations must complete before proceeding.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future. -
cf4(Future<? extends T4>) — the fourth future. -
cf5(Future<? extends T5>) — the fifth future. -
cf6(Future<? extends T6>) — the sixth future. -
cf7(Future<? extends T7>) — the seventh future.
-
- Returns: a ContinuableFuture containing a Tuple7 with all seven results.
- See also: #combine(Future, Future), #combine(Future, Future, Future), #combine(Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future), #combine(Future, Future, Future, Future, Future, Future)
-
Signature:
public static <T1, T2, R> ContinuableFuture<R> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Throwables.BiFunction<? super T1, ? super T2, ? extends R, ? extends Exception> action) - Summary: Combines two futures and applies a bi-function to their results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
action(Throwables.BiFunction<? super T1, ? super T2, ? extends R, ? extends Exception>) — the function to apply to both results. Receives the actual values (not futures).
-
- Returns: a ContinuableFuture containing the result of applying the action to both values.
-
Signature:
public static <T1, T2, T3, R> ContinuableFuture<R> combine(final Future<? extends T1> cf1, final Future<? extends T2> cf2, final Future<? extends T3> cf3, final Throwables.TriFunction<? super T1, ? super T2, ? super T3, ? extends R, ? extends Exception> action) - Summary: Combines three futures and applies a tri-function to their results.
-
Parameters:
-
cf1(Future<? extends T1>) — the first future. -
cf2(Future<? extends T2>) — the second future. -
cf3(Future<? extends T3>) — the third future. -
action(Throwables.TriFunction<? super T1, ? super T2, ? super T3, ? extends R, ? extends Exception>) — the function to apply to all three results.
-
- Returns: a ContinuableFuture containing the result of applying the action.
-
Signature:
public static <T, R> ContinuableFuture<R> combine(final Collection<? extends Future<? extends T>> cfs, final Throwables.Function<List<T>, ? extends R, ? extends Exception> action) - Summary: Combines a collection of futures and applies a function to all their results.
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to combine. -
action(Throwables.Function<List<T>, ? extends R, ? extends Exception>) — the function to apply to the list of results.
-
- Returns: a ContinuableFuture containing the result of the action.
allOf(...) -> ContinuableFuture<List<T>>
-
Signature:
@SafeVarargs public static <T> ContinuableFuture<List<T>> allOf(final Future<? extends T>... cfs) - Summary: Creates a ContinuableFuture that completes when all of the given futures complete.
-
Contract:
- Creates a ContinuableFuture that completes when all of the given futures complete.
- If any future completes exceptionally, the returned future also completes exceptionally with the first exception encountered.
- <p> This method is useful when you have multiple independent operations that all need to complete before proceeding, and you need all their results.
-
Parameters:
-
cfs(Future<? extends T>[]) — the array of futures to wait for.
-
- Returns: a ContinuableFuture that completes with a list of all results when all input futures complete successfully.
-
Signature:
public static <T> ContinuableFuture<List<T>> allOf(final Collection<? extends Future<? extends T>> cfs) - Summary: Creates a ContinuableFuture that completes when all futures in the collection complete.
-
Contract:
- Creates a ContinuableFuture that completes when all futures in the collection complete.
- If any future fails, the returned future fails with the first exception encountered.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Set<Future<ValidationResult>> validations = new HashSet<>(); validations.add(validateEmail(email)); validations.add(validatePhone(phone)); validations.add(validateAddress(address)); ContinuableFuture<List<ValidationResult>> allValidations = Futures.allOf(validations); allValidations.thenAccept(results -> { boolean allValid = results.stream() .allMatch(ValidationResult::isValid); if (allValid) { proceedWithRegistration(); } }); } </pre>
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to wait for.
-
- Returns: a ContinuableFuture that completes with a list of all results.
anyOf(...) -> ContinuableFuture<T>
-
Signature:
@SafeVarargs public static <T> ContinuableFuture<T> anyOf(final Future<? extends T>... cfs) - Summary: Creates a ContinuableFuture that implements the "any of" semantics by returning the result of the first future to complete successfully.
-
Contract:
- If all futures complete exceptionally, the returned future completes exceptionally with a composite exception containing all failures.
-
Parameters:
-
cfs(Future<? extends T>[]) — the array of futures to race.
-
- Returns: a ContinuableFuture that completes with the first successful result.
-
Signature:
public static <T> ContinuableFuture<T> anyOf(final Collection<? extends Future<? extends T>> cfs) - Summary: Creates a ContinuableFuture that implements the "any of" semantics by returning the result of the first future to complete successfully.
-
Contract:
- If all futures complete exceptionally, the returned future completes exceptionally with a composite exception containing all failures.
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to race.
-
- Returns: a ContinuableFuture that completes with the first successful result.
iterate(...) -> ObjIterator<T>
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> iterate(final Future<? extends T>... cfs) - Summary: Creates an iterator that yields results from futures as they complete (first-finished, first-out).
-
Contract:
- Failed futures will throw their exceptions when their result is requested via next().
-
Parameters:
-
cfs(Future<? extends T>[]) — the array of futures to iterate over.
-
- Returns: an iterator that yields results in completion order (first-finished, first-out).
-
Signature:
public static <T> ObjIterator<T> iterate(final Collection<? extends Future<? extends T>> cfs) - Summary: Creates an iterator that yields results from futures in the collection as they complete.
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to iterate over.
-
- Returns: an iterator that yields results in completion order (first-finished, first-out).
-
Signature:
public static <T> ObjIterator<T> iterate(final Collection<? extends Future<? extends T>> cfs, final long totalTimeoutForAll, final TimeUnit unit) - Summary: Creates an iterator with a total timeout for all futures.
-
Contract:
- If the timeout is exceeded, the iterator will throw a TimeoutException wrapped in a RuntimeException on the next() call.
- <p> This is useful when you need to process as many results as possible within a time budget, or when implementing overall operation timeouts.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Collection<Future<SearchResult>> searches = performParallelSearches(); // Process results for up to 5 seconds total ObjIterator<SearchResult> results = Futures.iterate( searches, 5, TimeUnit.SECONDS ); List<SearchResult> collected = new ArrayList<>(); try { while (results.hasNext()) { collected.add(results.next()); } } catch (RuntimeException e) { if (e.getCause() instanceof TimeoutException) { System.out.println("Timeout reached, got " + collected.size() + " results"); } } } </pre>
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to iterate over. -
totalTimeoutForAll(long) — the maximum time to wait for all results. -
unit(TimeUnit) — the time unit of the timeout.
-
- Returns: an iterator that yields results in completion order (first-finished, first-out) with timeout enforcement.
-
Signature:
public static <T, R> ObjIterator<R> iterate(final Collection<? extends Future<? extends T>> cfs, final Function<? super Result<T, Exception>, ? extends R> resultHandler) - Summary: Creates an iterator that yields transformed results from futures as they complete.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Collection<Future<Integer>> calculations = startCalculations(); ObjIterator<String> results = Futures.iterate(calculations, result -> { if (result.isSuccess()) { return "Success: " + result.get(); } else { return "Failed: " + result.getException().getMessage(); } }); while (results.hasNext()) { System.out.println(results.next()); } } </pre>
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to iterate over. -
resultHandler(Function<? super Result<T, Exception>, ? extends R>) — the function to transform Result objects into desired output type.
-
- Returns: an iterator that yields transformed results in completion order (first-finished, first-out).
-
Signature:
public static <T, R> ObjIterator<R> iterate(final Collection<? extends Future<? extends T>> cfs, final long totalTimeoutForAll, final TimeUnit unit, final Function<? super Result<T, Exception>, ? extends R> resultHandler) - Summary: Creates an iterator with custom result handling and a total timeout.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Collection<Future<DataPoint>> dataFutures = collectDataAsync(); ObjIterator<ProcessedData> processed = Futures.iterate( dataFutures, 10, TimeUnit.SECONDS, result -> { if (result.isSuccess()) { return processDataPoint(result.get()); } else if (result.getException() instanceof TimeoutException) { return ProcessedData.timeout(); } else { logError(result.getException()); return ProcessedData.error(); } }); // Process available results within time budget List<ProcessedData> results = new ArrayList<>(); while (processed.hasNext()) { results.add(processed.next()); } } </pre>
-
Parameters:
-
cfs(Collection<? extends Future<? extends T>>) — the collection of futures to iterate over. -
totalTimeoutForAll(long) — the maximum time to wait for all results. -
unit(TimeUnit) — the time unit of the timeout. -
resultHandler(Function<? super Result<T, Exception>, ? extends R>) — the function to transform Result objects, including timeout handling.
-
- Returns: an iterator that yields transformed results in completion order (first-finished, first-out) with timeout enforcement.
Public Instance Methods
- (none)
Enum Gender (com.landawn.abacus.util.Gender)
Represents gender as an enumeration with associated integer values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> Gender
-
Signature:
public static Gender valueOf(final int intValue) - Summary: Returns the Gender enum constant associated with the specified integer value.
-
Parameters:
-
intValue(int) — the integer value to convert to Gender (0, 1, 2 or 3)
-
- Returns: the corresponding Gender enum constant
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this gender.
-
Parameters:
- (none)
- Returns: the integer value of this gender (0 for BLANK, 1 for FEMALE, 2 for MALE, 3 for X)
Class HBaseColumn (com.landawn.abacus.util.HBaseColumn)
Represents a column value in HBase with its associated version (timestamp).
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
emptyOf(...) -> HBaseColumn<T>
-
Signature:
public static <T> HBaseColumn<T> emptyOf(final Class<?> targetClass) - Summary: Returns an empty HBaseColumn instance for the specified target class.
-
Parameters:
-
targetClass(Class<?>) — the class type for which to get an empty column
-
- Returns: an empty HBaseColumn instance
valueOf(...) -> HBaseColumn<T>
-
Signature:
public static <T> HBaseColumn<T> valueOf(final T value) - Summary: Creates an HBaseColumn instance with the specified value and the latest timestamp.
-
Parameters:
-
value(T) — the column value
-
- Returns: a new HBaseColumn instance
-
Signature:
public static <T> HBaseColumn<T> valueOf(final T value, final long version) - Summary: Creates an HBaseColumn instance with the specified value and version.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a new HBaseColumn instance
asList(...) -> List<HBaseColumn<T>>
-
Signature:
public static <T> List<HBaseColumn<T>> asList(final T value) - Summary: Creates a List containing a single HBaseColumn with the specified value and latest timestamp.
-
Parameters:
-
value(T) — the column value
-
- Returns: a List containing the HBaseColumn
-
Signature:
public static <T> List<HBaseColumn<T>> asList(final T value, final long version) - Summary: Creates a List containing a single HBaseColumn with the specified value and version.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a List containing the HBaseColumn
asSet(...) -> Set<HBaseColumn<T>>
-
Signature:
public static <T> Set<HBaseColumn<T>> asSet(final T value) - Summary: Creates a Set containing a single HBaseColumn with the specified value and latest timestamp.
-
Parameters:
-
value(T) — the column value
-
- Returns: a Set containing the HBaseColumn
-
Signature:
public static <T> Set<HBaseColumn<T>> asSet(final T value, final long version) - Summary: Creates a Set containing a single HBaseColumn with the specified value and version.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a Set containing the HBaseColumn
asSortedSet(...) -> SortedSet<HBaseColumn<T>>
-
Signature:
public static <T> SortedSet<HBaseColumn<T>> asSortedSet(final T value) - Summary: Creates a SortedSet containing a single HBaseColumn with the specified value, sorted by version in descending order.
-
Parameters:
-
value(T) — the column value
-
- Returns: a SortedSet containing the HBaseColumn
-
Signature:
public static <T> SortedSet<HBaseColumn<T>> asSortedSet(final T value, final Comparator<HBaseColumn<?>> cmp) - Summary: Creates a SortedSet containing a single HBaseColumn with the specified value, using the provided comparator for sorting.
-
Parameters:
-
value(T) — the column value -
cmp(Comparator<HBaseColumn<?>>) — the comparator to use for sorting, or {@code null} to use DESC_HBASE_COLUMN_COMPARATOR
-
- Returns: a SortedSet containing the HBaseColumn
-
Signature:
public static <T> SortedSet<HBaseColumn<T>> asSortedSet(final T value, final long version) - Summary: Creates a SortedSet containing a single HBaseColumn with the specified value and version, sorted by version in descending order.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a SortedSet containing the HBaseColumn
-
Signature:
public static <T> SortedSet<HBaseColumn<T>> asSortedSet(final T value, final long version, final Comparator<HBaseColumn<?>> cmp) - Summary: Creates a SortedSet containing a single HBaseColumn with the specified value and version, using the provided comparator for sorting.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp -
cmp(Comparator<HBaseColumn<?>>) — the comparator to use for sorting, or {@code null} to use DESC_HBASE_COLUMN_COMPARATOR
-
- Returns: a SortedSet containing the HBaseColumn
asMap(...) -> Map<Long, HBaseColumn<T>>
-
Signature:
public static <T> Map<Long, HBaseColumn<T>> asMap(final T value) - Summary: Creates a Map with a single entry mapping the version to an HBaseColumn containing the specified value with latest timestamp.
-
Parameters:
-
value(T) — the column value
-
- Returns: a Map with version as key and HBaseColumn as value
-
Signature:
public static <T> Map<Long, HBaseColumn<T>> asMap(final T value, final long version) - Summary: Creates a Map with a single entry mapping the version to an HBaseColumn containing the specified value and version.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a Map with version as key and HBaseColumn as value
asSortedMap(...) -> SortedMap<Long, HBaseColumn<T>>
-
Signature:
public static <T> SortedMap<Long, HBaseColumn<T>> asSortedMap(final T value) - Summary: Creates a SortedMap with a single entry mapping the version to an HBaseColumn containing the specified value, sorted by version in descending order.
-
Parameters:
-
value(T) — the column value
-
- Returns: a SortedMap with version as key and HBaseColumn as value
-
Signature:
public static <T> SortedMap<Long, HBaseColumn<T>> asSortedMap(final T value, final Comparator<Long> cmp) - Summary: Creates a SortedMap with a single entry mapping the version to an HBaseColumn containing the specified value, using the provided comparator for sorting versions.
-
Parameters:
-
value(T) — the column value -
cmp(Comparator<Long>) — the comparator for sorting versions, or {@code null} to use DESC_HBASE_VERSION_COMPARATOR
-
- Returns: a SortedMap with version as key and HBaseColumn as value
-
Signature:
public static <T> SortedMap<Long, HBaseColumn<T>> asSortedMap(final T value, final long version) - Summary: Creates a SortedMap with a single entry mapping the version to an HBaseColumn containing the specified value and version, sorted by version in descending order.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
- Returns: a SortedMap with version as key and HBaseColumn as value
-
Signature:
public static <T> SortedMap<Long, HBaseColumn<T>> asSortedMap(final T value, final long version, final Comparator<Long> cmp) - Summary: Creates a SortedMap with a single entry mapping the version to an HBaseColumn containing the specified value and version, using the provided comparator for sorting versions.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp -
cmp(Comparator<Long>) — the comparator for sorting versions, or {@code null} to use DESC_HBASE_VERSION_COMPARATOR
-
- Returns: a SortedMap with version as key and HBaseColumn as value
Public Instance Methods
<init>(...) -> void
-
Signature:
public HBaseColumn(final T value) - Summary: Constructs an HBaseColumn with the specified value and the latest timestamp.
-
Parameters:
-
value(T) — the column value
-
-
Signature:
public HBaseColumn(final T value, final long version) - Summary: Constructs an HBaseColumn with the specified value and version.
-
Parameters:
-
value(T) — the column value -
version(long) — the version timestamp
-
value(...) -> T
-
Signature:
public T value() - Summary: Returns the value of this HBase column.
-
Parameters:
- (none)
- Returns: the column value
version(...) -> long
-
Signature:
public long version() - Summary: Returns the version (timestamp) of this HBase column.
-
Parameters:
- (none)
- Returns: the version timestamp
copy(...) -> HBaseColumn<T>
-
Signature:
public HBaseColumn<T> copy() - Summary: Creates a copy of this HBaseColumn with the same value and version.
-
Parameters:
- (none)
- Returns: a new HBaseColumn instance with the same value and version
isNull(...) -> boolean
-
Signature:
public boolean isNull() - Summary: Checks if this HBaseColumn is {@code null} (empty).
-
Contract:
- Checks if this HBaseColumn is {@code null} (empty).
-
Parameters:
- (none)
- Returns: {@code true} if this column is null/empty, {@code false} otherwise
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final HBaseColumn<T> o) - Summary: Compares this HBaseColumn with another based on their version timestamps.
-
Parameters:
-
o(HBaseColumn<T>) — the HBaseColumn to compare with
-
- Returns: a negative integer, zero, or a positive integer as this column's version is less than, equal to, or greater than the specified column's version
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this HBaseColumn.
-
Parameters:
- (none)
- Returns: the hash code value
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this HBaseColumn.
-
Contract:
- Two HBaseColumns are considered equal if they have the same version and value.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this HBaseColumn.
-
Parameters:
- (none)
- Returns: a string representation of this column
Class Hex (com.landawn.abacus.util.Hex)
Utility class for converting between byte arrays and hexadecimal string representations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
encode(...) -> char\[\]
-
Signature:
public static char[] encode(final byte[] data) - Summary: Converts an array of bytes into an array of lowercase hexadecimal characters.
-
Parameters:
-
data(byte[]) — the byte array to convert to hexadecimal characters.
-
- Returns: a char array containing lowercase hexadecimal characters representing the input bytes.
-
Signature:
public static char[] encode(final byte[] data, final boolean toLowerCase) - Summary: Converts an array of bytes into an array of hexadecimal characters with specified case.
-
Parameters:
-
data(byte[]) — the byte array to convert to hexadecimal characters. -
toLowerCase(boolean) — if {@code true} , returns lowercase hex digits; if {@code false} , returns uppercase.
-
- Returns: a char array containing hexadecimal characters representing the input bytes.
encodeToString(...) -> String
-
Signature:
public static String encodeToString(final byte[] data) - Summary: Converts an array of bytes into a lowercase hexadecimal string.
-
Parameters:
-
data(byte[]) — the byte array to convert to a hexadecimal string.
-
- Returns: a string containing lowercase hexadecimal characters representing the input bytes.
-
Signature:
public static String encodeToString(final byte[] data, final boolean toLowerCase) - Summary: Converts an array of bytes into a hexadecimal string with specified case.
-
Parameters:
-
data(byte[]) — the byte array to convert to a hexadecimal string. -
toLowerCase(boolean) — if {@code true} , returns lowercase hex digits; if {@code false} , returns uppercase.
-
- Returns: a string containing hexadecimal characters representing the input bytes.
decode(...) -> byte\[\]
-
Signature:
public static byte[] decode(final String data) throws IllegalArgumentException - Summary: Converts a hexadecimal string into an array of bytes.
-
Contract:
- <p> The input string must contain an even number of hexadecimal characters.
-
Parameters:
-
data(String) — a string containing hexadecimal digits (0-9, A-F, a-f).
-
- Returns: a byte array containing the binary data decoded from the hexadecimal string.
-
Throws:
-
java.lang.IllegalArgumentException— if data is {@code null} , the string has an odd number of characters, or contains non-hexadecimal characters.
-
- See also: #decode(char\[\])
-
Signature:
public static byte[] decode(final char[] data) throws IllegalArgumentException - Summary: Converts an array of hexadecimal characters into an array of bytes.
-
Contract:
- <p> The input array must contain an even number of hexadecimal characters.
-
Parameters:
-
data(char[]) — an array of characters containing hexadecimal digits.
-
- Returns: a byte array containing the binary data decoded from the hexadecimal characters.
-
Throws:
-
java.lang.IllegalArgumentException— if data is {@code null} , the array has an odd number of elements, or contains non-hexadecimal characters.
-
Public Instance Methods
- (none)
Class Holder (com.landawn.abacus.util.Holder)
This class represents a Holder that can hold a value of type {@code T} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Holder<T>
-
Signature:
public static <T> Holder<T> of(final T value) - Summary: Creates a new Holder instance containing the specified value.
-
Parameters:
-
value(T) — the value to be held by the new Holder, may be {@code null} .
-
- Returns: a new Holder instance containing the specified value.
Public Instance Methods
<init>(...) -> void
-
Signature:
public Holder() - Summary: Constructs a new Holder with a {@code null} value.
-
Parameters:
- (none)
value(...) -> T
-
Signature:
public T value() - Summary: Returns the value held by this Holder.
-
Parameters:
- (none)
- Returns: the value held by this Holder, may be {@code null} .
getValue(...) -> T
-
Signature:
@Deprecated public T getValue() - Summary: Returns the value held by this Holder.
-
Parameters:
- (none)
- Returns: the value held by this Holder, may be {@code null} .
setValue(...) -> void
-
Signature:
public void setValue(final T value) - Summary: Sets the value held by this Holder to the specified value.
-
Contract:
- No value is returned; use {@link #setAndGet(Object)} if you need the value returned.
-
Parameters:
-
value(T) — the new value to be held by this Holder, may be {@code null} .
-
getAndSet(...) -> T
-
Signature:
public T getAndSet(final T value) - Summary: Atomically sets the value to the given updated value and returns the previous value.
-
Parameters:
-
value(T) — the new value to be set, may be {@code null} .
-
- Returns: the previous value held by this Holder before the update, may be {@code null} .
setAndGet(...) -> T
-
Signature:
public T setAndGet(final T value) - Summary: Sets the value to the given updated value and returns the new value.
-
Parameters:
-
value(T) — the new value to be set, may be {@code null} .
-
- Returns: the new value that was just set (same as the parameter), may be {@code null} .
getAndUpdate(...) -> T
-
Signature:
public <E extends Exception> T getAndUpdate(final Throwables.UnaryOperator<T, E> updateFunction) throws E - Summary: Atomically updates the current value with the results of applying the given function, returning the previous value.
-
Contract:
- This is useful when you need to perform transformations while keeping track of the old state.
-
Parameters:
-
updateFunction(Throwables.UnaryOperator<T, E>) — the function that takes the current value and returns a new value, must not be {@code null} .
-
- Returns: the previous value held by this Holder before the update, may be {@code null} .
-
Throws:
-
E— if the update function throws an exception.
-
updateAndGet(...) -> T
-
Signature:
public <E extends Exception> T updateAndGet(final Throwables.UnaryOperator<T, E> updateFunction) throws E - Summary: Atomically updates the current value with the results of applying the given function, returning the updated value.
-
Parameters:
-
updateFunction(Throwables.UnaryOperator<T, E>) — the function that takes the current value and returns a new value, must not be {@code null} .
-
- Returns: the new value held by this Holder after the update, may be {@code null} .
-
Throws:
-
E— if the update function throws an exception.
-
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.Predicate<? super T, E> predicate, final T newValue) throws E - Summary: Sets the value to the specified new value if the given predicate returns {@code true} when tested with the current value.
-
Contract:
- Sets the value to the specified new value if the given predicate returns {@code true} when tested with the current value.
- The predicate is evaluated against the current value, and only if it returns {@code true} will the new value be set.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate that tests the current value, must not be {@code null} . -
newValue(T) — the new value to set if the predicate returns {@code true} , may be {@code null} .
-
- Returns: {@code true} if the value was updated, {@code false} otherwise.
-
Throws:
-
E— if the predicate throws an exception.
-
isNull(...) -> boolean
-
Signature:
public boolean isNull() - Summary: Checks whether the value held by this Holder is {@code null} .
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Holder<String> holder = Holder.of(null); if (holder.isNull()) { holder.setValue("default"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the value is {@code null} , {@code false} otherwise.
isNotNull(...) -> boolean
-
Signature:
public boolean isNotNull() - Summary: Checks whether the value held by this Holder is not {@code null} .
-
Contract:
- It provides a convenient way to check if the Holder contains a {@code non-null} value before performing operations on it.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Holder<String> holder = Holder.of("test"); if (holder.isNotNull()) { System.out.println(holder.value().length()); // safe to use } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the value is not {@code null} , {@code false} otherwise.
ifNotNull(...) -> void
-
Signature:
public <E extends Exception> void ifNotNull(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action with the value if the value is not {@code null} .
-
Contract:
- Performs the given action with the value if the value is not {@code null} .
- The action is only executed if the value is not {@code null} , making it similar to {@code Optional.ifPresent()} .
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed with the {@code non-null} value, must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if the action is {@code null} . -
E— if the action throws an exception.
-
ifNotNullOrElse(...) -> void
-
Signature:
public <E extends Exception, E2 extends Exception> void ifNotNullOrElse(final Throwables.Consumer<? super T, E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: Performs the given action with the value if the value is not {@code null} , otherwise performs the given empty action.
-
Contract:
- Performs the given action with the value if the value is not {@code null} , otherwise performs the given empty action.
- This is similar to {@code Optional.ifPresentOrElse()} and is useful when you need to handle both cases.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed with the {@code non-null} value, must not be {@code null} . -
emptyAction(Throwables.Runnable<E2>) — the action to be performed when the value is {@code null} , must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either action or emptyAction is {@code null} . -
E— if the action throws an exception. -
E2— if the emptyAction throws an exception.
-
accept(...) -> void
-
Signature:
@Deprecated public <E extends Exception> void accept(final Throwables.Consumer<? super T, E> action) throws E - Summary: Performs the given action with the value held by this Holder.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed with the value, must not be {@code null} .
-
-
Throws:
-
E— if the action throws an exception.
-
acceptIfNotNull(...) -> void
-
Signature:
@Deprecated public <E extends Exception> void acceptIfNotNull(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action with the value if the value is not {@code null} .
-
Contract:
- Performs the given action with the value if the value is not {@code null} .
- If the value is {@code null} , no action is performed.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed with the {@code non-null} value, must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if the action is {@code null} . -
E— if the action throws an exception.
-
map(...) -> U
-
Signature:
public <U, E extends Exception> U map(final Throwables.Function<? super T, ? extends U, E> mapper) throws E - Summary: Applies the given mapping function to the value held by this Holder and returns the result.
-
Contract:
- <p> This method unconditionally applies the mapper function to the current value, even if it is {@code null} .
- The mapper is responsible for handling {@code null} inputs if necessary.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value, must not be {@code null} .
-
- Returns: the result of applying the mapping function to the value, may be {@code null} .
-
Throws:
-
E— if the mapping function throws an exception.
-
mapIfNotNull(...) -> Nullable<U>
-
Signature:
public <U, E extends Exception> Nullable<U> mapIfNotNull(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapping function to the value if the value is not {@code null} , and returns a {@code Nullable} containing the mapped value.
-
Contract:
- Applies the given mapping function to the value if the value is not {@code null} , and returns a {@code Nullable} containing the mapped value.
- The mapper is only invoked when the value is not {@code null} , eliminating the need for {@code null} checks within the mapper.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the {@code non-null} value, must not be {@code null} .
-
- Returns: a {@code Nullable} containing the mapped value if the value was not {@code null} , otherwise an empty {@code Nullable} .
-
Throws:
-
java.lang.IllegalArgumentException— if the mapper is {@code null} . -
E— if the mapping function throws an exception.
-
mapToNonNullIfNotNull(...) -> Optional<U>
-
Signature:
public <U, E extends Exception> Optional<U> mapToNonNullIfNotNull(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, NullPointerException, E - Summary: Applies the given mapping function to the value if the value is not {@code null} , and returns an {@code Optional} containing the mapped value.
-
Contract:
- Applies the given mapping function to the value if the value is not {@code null} , and returns an {@code Optional} containing the mapped value.
- The key difference is that the mapper must return a {@code non-null} value, which is then wrapped in an {@code Optional} .
- If the original value is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the {@code non-null} value, must not be {@code null} and must not return {@code null} .
-
- Returns: an {@code Optional} containing the mapped value if the value was not {@code null} , otherwise an empty {@code Optional} .
-
Throws:
-
java.lang.IllegalArgumentException— if the mapper is {@code null} . -
java.lang.NullPointerException -
E— if the mapping function throws an exception.
-
filter(...) -> Nullable<T>
-
Signature:
public <E extends Exception> Nullable<T> filter(final Throwables.Predicate<? super T, E> predicate) throws E - Summary: Tests the value with the given predicate and returns a {@code Nullable} containing the value if the predicate returns {@code true} , otherwise returns an empty {@code Nullable} .
-
Contract:
- Tests the value with the given predicate and returns a {@code Nullable} containing the value if the predicate returns {@code true} , otherwise returns an empty {@code Nullable} .
- <p> This method applies the predicate unconditionally to the current value, even if it is {@code null} .
- The predicate must handle {@code null} inputs appropriately.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to test the value, must not be {@code null} .
-
- Returns: a {@code Nullable} containing the value if the predicate returns {@code true} , otherwise an empty {@code Nullable} .
-
Throws:
-
E— if the predicate throws an exception.
-
filterIfNotNull(...) -> Optional<T>
-
Signature:
public <E extends Exception> Optional<T> filterIfNotNull(final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: Tests the value with the given predicate if the value is not {@code null} and returns an {@code Optional} containing the value if the predicate returns {@code true} .
-
Contract:
- Tests the value with the given predicate if the value is not {@code null} and returns an {@code Optional} containing the value if the predicate returns {@code true} .
- The predicate is only invoked when the value is not {@code null} , eliminating the need for {@code null} checks within the predicate.
- If the value is {@code null} or the predicate returns {@code false} , an empty {@code Optional} is returned.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to test the {@code non-null} value, must not be {@code null} .
-
- Returns: an {@code Optional} containing the value if it is not {@code null} and the predicate returns {@code true} , otherwise an empty {@code Optional} .
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is {@code null} . -
E— if the predicate throws an exception.
-
orElseIfNull(...) -> T
-
Signature:
public T orElseIfNull(final T other) - Summary: Returns the value if it is not {@code null} , otherwise returns the given default value.
-
Contract:
- Returns the value if it is not {@code null} , otherwise returns the given default value.
- <p> This method provides a simple way to supply a default value when the Holder contains {@code null} .
-
Parameters:
-
other(T) — the value to be returned if the held value is {@code null} , may be {@code null} .
-
- Returns: the value if not {@code null} , otherwise {@code other} .
orElseGetIfNull(...) -> T
-
Signature:
public T orElseGetIfNull(final Supplier<? extends T> other) throws IllegalArgumentException - Summary: Returns the value if it is not {@code null} , otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if it is not {@code null} , otherwise returns the result produced by the supplying function.
- The supplier is only invoked when the value is {@code null} , which is useful when computing the default value is expensive or has side effects.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Holder<String> holder = Holder.of(null); String value = holder.orElseGetIfNull(() -> computeExpensiveDefault()); // supplier only called if needed } </pre>
-
Parameters:
-
other(Supplier<? extends T>) — the supplier whose result is returned if the held value is {@code null} , must not be {@code null} .
-
- Returns: the value if not {@code null} , otherwise the result of {@code other.get()} , may be {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is {@code null} .
-
orElseThrowIfNull(...) -> T
-
Signature:
public T orElseThrowIfNull() throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} .
- <p> This method is useful when the absence of a value should be treated as an error condition.
- It enforces that a {@code non-null} value must be present or an exception will be thrown.
-
Parameters:
- (none)
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with the specified error message.
- <p> This method allows you to provide a custom error message that will be included in the exception if the value is {@code null} .
-
Parameters:
-
errorMessage(String) — the detail message to be used in the exception if the value is {@code null} .
-
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and parameter.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and parameter.
-
Parameters:
-
errorMessage(String) — the error message template which may contain a placeholder for the parameter. -
param(Object) — the parameter to be substituted into the error message.
-
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and two parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and two parameters.
-
Parameters:
-
errorMessage(String) — the error message template which may contain placeholders for the parameters. -
param1(Object) — the first parameter to be substituted into the error message. -
param2(Object) — the second parameter to be substituted into the error message.
-
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and three parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and three parameters.
-
Parameters:
-
errorMessage(String) — the error message template which may contain placeholders for the parameters. -
param1(Object) — the first parameter to be substituted into the error message. -
param2(Object) — the second parameter to be substituted into the error message. -
param3(Object) — the third parameter to be substituted into the error message.
-
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} with a formatted error message using the specified message template and parameters.
- Use this when you need to format an error message with four or more parameters.
-
Parameters:
-
errorMessage(String) — the error message template which may contain placeholders for the parameters. -
params(Object[]) — the parameters to be substituted into the error message.
-
- Returns: the value held by this Holder.
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null} .
-
-
Signature:
public <E extends Throwable> T orElseThrowIfNull(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if it is not {@code null} , otherwise throws an exception provided by the given supplier.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws an exception provided by the given supplier.
- The supplier is only invoked when the value is {@code null} .
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplier that will provide the exception to be thrown if the value is {@code null} , must not be {@code null} .
-
- Returns: the value held by this Holder.
-
Throws:
-
java.lang.IllegalArgumentException— if the exception supplier is {@code null} . -
E— if the value is {@code null} .
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value held by this Holder.
-
Contract:
- If the value is {@code null} , this method returns 0.
-
Parameters:
- (none)
- Returns: the hash code of the value, or 0 if the value is {@code null} .
equals(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") @Override public boolean equals(final Object obj) - Summary: Compares this Holder to the specified object for equality.
-
Contract:
- <p> Two Holders are considered equal if and only if: <ul> <li> They are the same instance (identity equality), OR </li> <li> The other object is also a Holder AND both Holders contain equal values (as determined by {@code Objects.equals()} ) </li> </ul> <p> Note that two Holders containing {@code null} are considered equal.
-
Parameters:
-
obj(Object) — the object to compare with this Holder for equality.
-
- Returns: {@code true} if the specified object is equal to this Holder, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Holder.
-
Contract:
- If the value is {@code null} , returns "Holder\[null\]".
-
Parameters:
- (none)
- Returns: a string representation of this Holder in the format "Holder\[value\]".
Class IEEE754rUtil (com.landawn.abacus.util.IEEE754rUtil)
Utility class providing IEEE-754r compliant operations for floating-point numbers.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
min(...) -> float
-
Signature:
public static float min(final float a, final float b) - Summary: Returns the smaller of two float values according to IEEE-754r standard.
-
Contract:
- <p> If one value is NaN and the other is not, the non-NaN value is returned.
- If both values are NaN, NaN is returned.
-
Parameters:
-
a(float) — the first value -
b(float) — the second value
-
- Returns: the smaller of {@code a} and {@code b} according to IEEE-754r
- See also: #min(float, float, float), #min(float...), #min(double, double), #max(float, float)
-
Signature:
public static float min(final float a, final float b, final float c) - Summary: Returns the smallest of three float values according to IEEE-754r standard.
-
Contract:
- <p> If one or more values are NaN and at least one value is not NaN, the non-NaN minimum is returned.
- If all three values are NaN, NaN is returned.
-
Parameters:
-
a(float) — the first value -
b(float) — the second value -
c(float) — the third value
-
- Returns: the smallest of {@code a} , {@code b} , and {@code c} according to IEEE-754r
- See also: #min(float, float), #min(float...), #min(double, double, double), #max(float, float, float)
-
Signature:
public static float min(final float... array) - Summary: Returns the minimum value in a float array according to IEEE-754r standard.
-
Contract:
- The array must not be {@code null} or empty.
-
Parameters:
-
array(float[]) — the array of values, must not be {@code null} or empty
-
- Returns: the minimum value in the array according to IEEE-754r
-
Signature:
public static double min(final double a, final double b) - Summary: Returns the smaller of two double values according to IEEE-754r standard.
-
Contract:
- <p> If one value is NaN and the other is not, the non-NaN value is returned.
- If both values are NaN, NaN is returned.
-
Parameters:
-
a(double) — the first value -
b(double) — the second value
-
- Returns: the smaller of {@code a} and {@code b} according to IEEE-754r
- See also: #min(double, double, double), #min(double...), #min(float, float), #max(double, double)
-
Signature:
public static double min(final double a, final double b, final double c) - Summary: Returns the smallest of three double values according to IEEE-754r standard.
-
Contract:
- <p> If one or more values are NaN and at least one value is not NaN, the non-NaN minimum is returned.
- If all three values are NaN, NaN is returned.
-
Parameters:
-
a(double) — the first value -
b(double) — the second value -
c(double) — the third value
-
- Returns: the smallest of {@code a} , {@code b} , and {@code c} according to IEEE-754r
- See also: #min(double, double), #min(double...), #min(float, float, float), #max(double, double, double)
-
Signature:
public static double min(final double... array) - Summary: Returns the minimum value in a double array according to IEEE-754r standard.
-
Contract:
- The array must not be {@code null} or empty.
-
Parameters:
-
array(double[]) — the array of values, must not be {@code null} or empty
-
- Returns: the minimum value in the array according to IEEE-754r
max(...) -> float
-
Signature:
public static float max(final float a, final float b) - Summary: Returns the larger of two float values according to IEEE-754r standard.
-
Contract:
- <p> If one value is NaN and the other is not, the non-NaN value is returned.
- If both values are NaN, NaN is returned.
-
Parameters:
-
a(float) — the first value -
b(float) — the second value
-
- Returns: the larger of {@code a} and {@code b} according to IEEE-754r
- See also: #max(float, float, float), #max(float...), #max(double, double), #min(float, float)
-
Signature:
public static float max(final float a, final float b, final float c) - Summary: Returns the largest of three float values according to IEEE-754r standard.
-
Contract:
- <p> If one or more values are NaN and at least one value is not NaN, the non-NaN maximum is returned.
- If all three values are NaN, NaN is returned.
-
Parameters:
-
a(float) — the first value -
b(float) — the second value -
c(float) — the third value
-
- Returns: the largest of {@code a} , {@code b} , and {@code c} according to IEEE-754r
- See also: #max(float, float), #max(float...), #max(double, double, double), #min(float, float, float)
-
Signature:
public static float max(final float... array) - Summary: Returns the maximum value in a float array according to IEEE-754r standard.
-
Contract:
- The array must not be {@code null} or empty.
-
Parameters:
-
array(float[]) — the array of values, must not be {@code null} or empty
-
- Returns: the maximum value in the array according to IEEE-754r
-
Signature:
public static double max(final double a, final double b) - Summary: Returns the larger of two double values according to IEEE-754r standard.
-
Contract:
- <p> If one value is NaN and the other is not, the non-NaN value is returned.
- If both values are NaN, NaN is returned.
-
Parameters:
-
a(double) — the first value -
b(double) — the second value
-
- Returns: the larger of {@code a} and {@code b} according to IEEE-754r
- See also: #max(double, double, double), #max(double...), #max(float, float), #min(double, double)
-
Signature:
public static double max(final double a, final double b, final double c) - Summary: Returns the largest of three double values according to IEEE-754r standard.
-
Contract:
- <p> If one or more values are NaN and at least one value is not NaN, the non-NaN maximum is returned.
- If all three values are NaN, NaN is returned.
-
Parameters:
-
a(double) — the first value -
b(double) — the second value -
c(double) — the third value
-
- Returns: the largest of {@code a} , {@code b} , and {@code c} according to IEEE-754r
- See also: #max(double, double), #max(double...), #max(float, float, float), #min(double, double, double)
-
Signature:
public static double max(final double... array) - Summary: Returns the maximum value in a double array according to IEEE-754r standard.
-
Contract:
- The array must not be {@code null} or empty.
-
Parameters:
-
array(double[]) — the array of values, must not be {@code null} or empty
-
- Returns: the maximum value in the array according to IEEE-754r
Public Instance Methods
- (none)
Enum IOCase (com.landawn.abacus.util.IOCase)
Enumeration for controlling case sensitivity in I/O operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
forName(...) -> IOCase
-
Signature:
public static IOCase forName(final String name) - Summary: Factory method to create an IOCase instance from its name.
-
Parameters:
-
name(String) — the name of the IOCase constant ("Sensitive", "Insensitive", or "System")
-
- Returns: the corresponding IOCase enum constant
Public Instance Methods
getName(...) -> String
-
Signature:
public String getName() - Summary: Gets the name of this IOCase constant.
-
Parameters:
- (none)
- Returns: the name of the constant ("Sensitive", "Insensitive", or "System")
isCaseSensitive(...) -> boolean
-
Signature:
public boolean isCaseSensitive() - Summary: Checks whether this IOCase represents case-sensitive comparison.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (IOCase.SENSITIVE.isCaseSensitive()) { // Perform case-sensitive operations } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if case-sensitive, {@code false} if case-insensitive
checkCompareTo(...) -> int
-
Signature:
public int checkCompareTo(final String str1, final String str2) - Summary: Compares two strings using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str1(String) — the first string to compare, not null -
str2(String) — the second string to compare, not null
-
- Returns: negative if str1 < str2, zero if str1 equals str2, positive if str1 > str2
checkEquals(...) -> boolean
-
Signature:
public boolean checkEquals(final String str1, final String str2) - Summary: Compares two strings for equality using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str1(String) — the first string to compare, not null -
str2(String) — the second string to compare, not null
-
- Returns: {@code true} if the strings are equal according to the case rule
checkStartsWith(...) -> boolean
-
Signature:
public boolean checkStartsWith(final String str, final String start) - Summary: Checks if one string starts with another using the case-sensitivity rule of this IOCase.
-
Contract:
- Checks if one string starts with another using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str(String) — the string to check, not null -
start(String) — the prefix to look for, not null
-
- Returns: {@code true} if str starts with the prefix according to the case rule
checkEndsWith(...) -> boolean
-
Signature:
public boolean checkEndsWith(final String str, final String end) - Summary: Checks if one string ends with another using the case-sensitivity rule of this IOCase.
-
Contract:
- Checks if one string ends with another using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str(String) — the string to check, not null -
end(String) — the suffix to look for, not null
-
- Returns: {@code true} if str ends with the suffix according to the case rule
checkIndexOf(...) -> int
-
Signature:
public int checkIndexOf(final String str, final int strStartIndex, final String search) - Summary: Finds the index of a search string within another string starting at a specific index, using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str(String) — the string to search in, not null -
strStartIndex(int) — the index to start searching from -
search(String) — the string to search for, not null
-
- Returns: the index of the first occurrence of search in str, or -1 if not found
checkRegionMatches(...) -> boolean
-
Signature:
public boolean checkRegionMatches(final String str, final int strStartIndex, final String search) - Summary: Checks if a region of one string matches another string at a specific index, using the case-sensitivity rule of this IOCase.
-
Contract:
- Checks if a region of one string matches another string at a specific index, using the case-sensitivity rule of this IOCase.
-
Parameters:
-
str(String) — the string to check, not null -
strStartIndex(int) — the index in str to start matching from -
search(String) — the string to match against, not null
-
- Returns: {@code true} if the region matches according to the case rule
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class IOUtil (com.landawn.abacus.util.IOUtil)
A comprehensive utility class providing high-performance I/O operations, file manipulation, and stream processing capabilities for Java applications.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getHostName(...) -> String
-
Signature:
public static String getHostName() - Summary: Retrieves the host name of the local machine.
-
Contract:
- if the host name cannot be determined, it returns "UNKNOWN_HOST_NAME".
-
Parameters:
- (none)
- Returns: the host name of the local machine, or "UNKNOWN_HOST_NAME" if it cannot be determined.
freeDiskSpaceKB(...) -> long
-
Signature:
public static long freeDiskSpaceKB() throws UncheckedIOException - Summary: Returns the free disk space on the volume where the current working directory resides, in kilobytes (KB).
-
Parameters:
- (none)
- Returns: the amount of free disk space in kilobytes.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while retrieving the free space information.
-
-
Signature:
public static long freeDiskSpaceKB(final long timeout) throws UncheckedIOException - Summary: Returns the free disk space on the volume where the current working directory resides, in kilobytes (KB).
-
Contract:
- The command to retrieve the disk space will be aborted if it exceeds the specified timeout.
-
Parameters:
-
timeout(long) — the maximum time in milliseconds to wait for the command to complete. A value of zero or less means no timeout.
-
- Returns: the amount of free disk space in kilobytes.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the command times out.
-
-
Signature:
public static long freeDiskSpaceKB(final String path) throws UncheckedIOException - Summary: Returns the free disk space on the specified path in kilobytes (KB).
-
Parameters:
-
path(String) — the path to a file or directory on the volume to check. It must not be {@code null} . On Unix, it should not be an empty string.
-
- Returns: the amount of free disk space in kilobytes.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while retrieving the free space information.
-
-
Signature:
public static long freeDiskSpaceKB(final String path, final long timeout) throws UncheckedIOException - Summary: Returns the free disk space on the specified path in kilobytes (KB), with a timeout for the operation.
-
Contract:
- The free space is determined by invoking a command-line utility appropriate for the operating system, and the command will be aborted if it exceeds the specified timeout.
-
Parameters:
-
path(String) — the path to a file or directory on the volume to check. It must not be {@code null} . On Unix, it should not be an empty string. -
timeout(long) — the maximum time in milliseconds to wait for the command to complete. A value of zero or less means no timeout.
-
- Returns: the amount of free disk space in kilobytes.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs or the command times out.
-
charsToBytes(...) -> byte\[\]
-
Signature:
public static byte[] charsToBytes(final char[] chars) - Summary: Converts a character array to a byte array using the default character set of the platform.
-
Parameters:
-
chars(char[]) — the character array to convert. May be {@code null} or empty.
-
- Returns: the resulting byte array, or an empty byte array if the input is {@code null} or empty.
-
Signature:
public static byte[] charsToBytes(final char[] chars, final Charset charset) - Summary: Converts a character array to a byte array using the specified character set.
-
Parameters:
-
chars(char[]) — the character array to convert. May be {@code null} or empty. -
charset(Charset) — the character set to use for encoding. If {@code null} , the platform's default charset is used.
-
- Returns: the resulting byte array, or an empty byte array if the input is {@code null} or empty.
-
Signature:
public static byte[] charsToBytes(final char[] chars, final int offset, final int charCount, Charset charset) - Summary: Converts a sub-array of a character array to a byte array using the specified character set.
-
Parameters:
-
chars(char[]) — the source character array, may be {@code null} or empty. -
offset(int) — the starting position in the character array (0-based), must be > = 0. -
charCount(int) — the number of characters to convert, must be > = 0. -
charset(Charset) — the character set to use for encoding. If {@code null} , the platform's default charset is used.
-
- Returns: the resulting byte array, or an empty byte array if {@code charCount} is zero.
bytesToChars(...) -> char\[\]
-
Signature:
public static char[] bytesToChars(final byte[] bytes) - Summary: Converts a byte array to a character array using the default character set of the platform.
-
Parameters:
-
bytes(byte[]) — the byte array to convert. May be {@code null} or empty.
-
- Returns: the resulting character array, or an empty character array if the input is {@code null} or empty.
-
Signature:
public static char[] bytesToChars(final byte[] bytes, final Charset charset) - Summary: Converts a byte array to a character array using the specified character set.
-
Parameters:
-
bytes(byte[]) — the byte array to convert. May be {@code null} or empty. -
charset(Charset) — the character set to use for decoding. If {@code null} , the platform's default charset is used.
-
- Returns: the resulting character array, or an empty character array if the input is {@code null} or empty.
-
Signature:
public static char[] bytesToChars(final byte[] bytes, final int offset, final int byteCount, Charset charset) - Summary: Converts a sub-array of a byte array to a character array using the specified character set.
-
Parameters:
-
bytes(byte[]) — the source byte array, may be {@code null} or empty. -
offset(int) — the starting position in the byte array (0-based), must be > = 0. -
byteCount(int) — the number of bytes to convert, must be > = 0. -
charset(Charset) — the character set to use for decoding. If {@code null} , the platform's default charset is used.
-
- Returns: the resulting character array, or an empty character array if {@code byteCount} is zero.
stringToInputStream(...) -> InputStream
-
Signature:
public static InputStream stringToInputStream(final String str) - Summary: Converts a {@code String} to an {@code InputStream} using the platform's default character set.
-
Contract:
- if the input string is {@code null} , an empty {@code InputStream} is returned.
-
Parameters:
-
str(String) — the string to convert, must not be {@code null} .
-
- Returns: an {@code InputStream} for the given string, or an empty {@code InputStream} if the input is {@code null} .
-
Signature:
public static InputStream stringToInputStream(final String str, Charset charset) - Summary: Converts a {@code String} to an {@code InputStream} using the specified character set.
-
Contract:
- if the input string is {@code null} , an empty {@code InputStream} is returned.
-
Parameters:
-
str(String) — the string to convert, must not be {@code null} . -
charset(Charset) — the character set to use for encoding. If {@code null} , the platform's default charset is used.
-
- Returns: an {@code InputStream} for the given string, or an empty {@code InputStream} if the input is {@code null} .
stringToReader(...) -> Reader
-
Signature:
public static Reader stringToReader(final String str) - Summary: Converts a {@code String} into a {@code Reader} .
-
Contract:
- if the input string is {@code null} , an empty reader is returned.
-
Parameters:
-
str(String) — the string to convert. May be {@code null} .
-
- Returns: a {@code Reader} for the given string, or an empty reader if the input is {@code null} .
- See also: StringReader
stringBuilderToWriter(...) -> Writer
-
Signature:
public static Writer stringBuilderToWriter(final StringBuilder sb) throws IllegalArgumentException - Summary: Wraps a {@code StringBuilder} in a {@code Writer} .
-
Parameters:
-
sb(StringBuilder) — the {@code StringBuilder} to wrap, must not be {@code null} .
-
- Returns: a {@code Writer} that appends to the specified string builder.
-
Throws:
-
java.lang.IllegalArgumentException— if the input {@code StringBuilder} is {@code null} .
-
readAllBytes(...) -> byte\[\]
-
Signature:
public static byte[] readAllBytes(final File source) throws UncheckedIOException - Summary: Reads all bytes from a file into a byte array.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: a byte array containing all bytes from the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static byte[] readAllBytes(final InputStream source) throws UncheckedIOException - Summary: Reads all remaining bytes from an {@code InputStream} into a byte array.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} .
-
- Returns: a byte array containing all bytes read from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
readBytes(...) -> byte\[\]
-
Signature:
@Beta public static byte[] readBytes(final File source) throws IOException - Summary: Reads all bytes from a file into a byte array.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: a byte array containing all bytes from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllBytes(File)
-
Signature:
public static byte[] readBytes(final File source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of bytes from a file into a byte array, starting from a given offset.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
offset(long) — the starting position in bytes from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of bytes to read, must be > = 0.
-
- Returns: a byte array containing the bytes read from the file. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@Beta public static byte[] readBytes(final InputStream source) throws IOException - Summary: Reads all remaining bytes from an {@code InputStream} into a byte array.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} .
-
- Returns: a byte array containing all bytes read from the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllBytes(InputStream)
-
Signature:
public static byte[] readBytes(final InputStream source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of bytes from an {@code InputStream} into a byte array, starting from a given offset.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
offset(long) — the starting position in bytes from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of bytes to read, must be > = 0.
-
- Returns: a byte array containing the bytes read from the stream. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
readAllChars(...) -> char\[\]
-
Signature:
public static char[] readAllChars(final File source) throws UncheckedIOException - Summary: Reads all characters from a file into a character array using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: a character array containing all characters from the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static char[] readAllChars(final File source, final Charset charset) throws UncheckedIOException - Summary: Reads all characters from a file into a character array using the specified character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a character array containing all characters from the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static char[] readAllChars(final InputStream source) throws UncheckedIOException - Summary: Reads all remaining characters from an {@code InputStream} into a character array using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, may be {@code null} .
-
- Returns: a character array containing all characters read from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static char[] readAllChars(final InputStream source, final Charset charset) throws UncheckedIOException - Summary: Reads all remaining characters from an {@code InputStream} into a character array using the specified character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a character array containing all characters read from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static char[] readAllChars(final Reader source) throws UncheckedIOException - Summary: Reads all remaining characters from a {@code Reader} into a character array.
-
Contract:
- <p> Note: This method should not be used for readers with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, may be {@code null} .
-
- Returns: a character array containing all characters read from the reader.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
readChars(...) -> char\[\]
-
Signature:
@Beta public static char[] readChars(final File source) throws IOException - Summary: Reads all characters from a file into a character array using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: a character array containing all characters from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllChars(File)
-
Signature:
@Beta public static char[] readChars(final File source, final Charset charset) throws IOException - Summary: Reads all characters from a file into a character array using the specified character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a character array containing all characters from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllChars(File, Charset)
-
Signature:
public static char[] readChars(final File source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a file into a character array, starting from a given character offset, using the platform's default charset.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a character array containing the characters read from the file. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static char[] readChars(final File source, final Charset charset, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a file into a character array, starting from a given character offset, using the specified character set.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a character array containing the characters read from the file. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@Beta public static char[] readChars(final InputStream source) throws IOException - Summary: Reads all remaining characters from an {@code InputStream} into a character array using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, may be {@code null} .
-
- Returns: a character array containing all characters read from the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllChars(InputStream), #readChars(InputStream, Charset), #readChars(Reader)
-
Signature:
@Beta public static char[] readChars(final InputStream source, final Charset charset) throws IOException - Summary: Reads all remaining characters from an {@code InputStream} into a character array using the specified character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a character array containing all characters read from the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllChars(InputStream, Charset), #readChars(Reader)
-
Signature:
public static char[] readChars(final InputStream source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from an {@code InputStream} into a character array, starting from a given character offset, using the platform's default charset.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a character array containing the characters read from the stream. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
- See also: #readChars(InputStream, Charset, long, int), #readChars(Reader, long, int)
-
Signature:
public static char[] readChars(final InputStream source, final Charset charset, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from an {@code InputStream} into a character array, starting from a given character offset, using the specified character set.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a character array containing the characters read from the stream. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
- See also: #readChars(Reader, long, int)
-
Signature:
@Beta public static char[] readChars(final Reader source) throws IOException - Summary: Reads all remaining characters from a {@code Reader} into a character array.
-
Contract:
- <p> Note: This method should not be used for readers with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, may be {@code null} .
-
- Returns: a character array containing all characters read from the reader.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readAllChars(Reader)
-
Signature:
public static char[] readChars(final Reader source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a {@code Reader} into a character array, starting from a given character offset.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a character array containing the characters read from the reader. The length of the array will be at most {@code maxLen} .
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
readAllToString(...) -> String
-
Signature:
public static String readAllToString(final File source) throws UncheckedIOException - Summary: Reads the entire content of a file into a {@code String} using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry).
-
- Returns: a {@code String} containing the entire content of the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static String readAllToString(final File source, final String encoding) throws UncheckedIOException - Summary: Reads the entire content of a file into a {@code String} using the specified character set name.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
encoding(String) — the name of the character set to use for decoding. If {@code null} , the platform's default charset is used.
-
- Returns: a {@code String} containing the entire content of the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static String readAllToString(final File source, final Charset charset) throws UncheckedIOException - Summary: Reads the entire content of a file into a {@code String} using the specified character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a {@code String} containing the entire content of the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static String readAllToString(final InputStream source) throws UncheckedIOException - Summary: Reads all remaining characters from an {@code InputStream} into a {@code String} using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, may be {@code null} .
-
- Returns: a {@code String} containing all content read from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #readAllToString(InputStream, Charset), #readAllToString(Reader)
-
Signature:
public static String readAllToString(final InputStream source, final Charset charset) throws UncheckedIOException - Summary: Reads all remaining characters from an {@code InputStream} into a {@code String} using the specified character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a {@code String} containing all content read from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #readAllToString(Reader)
-
Signature:
public static String readAllToString(final Reader source) throws UncheckedIOException - Summary: Reads all remaining characters from a {@code Reader} into a {@code String} .
-
Contract:
- <p> Note: This method should not be used for readers with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} .
-
- Returns: a {@code String} containing all content read from the reader.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
readToString(...) -> String
-
Signature:
public static String readToString(final File source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a file into a {@code String} , starting from a given character offset, using the platform's default charset.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a {@code String} containing the characters read from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static String readToString(final File source, final Charset charset, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a file into a {@code String} , starting from a given character offset, using the specified character set.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a {@code String} containing the characters read from the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static String readToString(final InputStream source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from an {@code InputStream} into a {@code String} , starting from a given character offset, using the platform's default charset.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a {@code String} containing the characters read from the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
- See also: #readToString(InputStream, Charset, long, int), #readToString(Reader, long, int)
-
Signature:
public static String readToString(final InputStream source, final Charset charset, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from an {@code InputStream} into a {@code String} , starting from a given character offset, using the specified character set.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a {@code String} containing the characters read from the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
- See also: #readToString(Reader, long, int)
-
Signature:
public static String readToString(final Reader source, final long offset, final int maxLen) throws IOException - Summary: Reads up to a specified number of characters from a {@code Reader} into a {@code String} , starting from a given character offset.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
maxLen(int) — the maximum number of characters to read, must be > = 0.
-
- Returns: a {@code String} containing the characters read from the reader.
-
Throws:
-
java.io.IOException— if an I/O error occurs during reading or skipping.
-
readAllLines(...) -> List<String>
-
Signature:
public static List<String> readAllLines(final File source) throws UncheckedIOException - Summary: Reads all lines from a file into a list of strings, using the platform's default charset.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry).
-
- Returns: a list of strings, each representing a line in the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static List<String> readAllLines(final File source, final String encoding) throws UncheckedIOException - Summary: Reads all lines from a file into a list of strings, using the specified character set name.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
encoding(String) — the name of the character set to use for decoding. If {@code null} , the platform's default charset is used.
-
- Returns: a list of strings, each representing a line in the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static List<String> readAllLines(final File source, final Charset charset) throws UncheckedIOException - Summary: Reads all lines from a file into a list of strings, using the specified character set.
-
Contract:
- <p> Note: This method should not be used for files with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(File) — the file to read from. It can be a regular file, gzipped file (.gz), and zip file (.zip, reading the first entry). -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a list of strings, each representing a line in the file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static List<String> readAllLines(final InputStream source) throws UncheckedIOException - Summary: Reads all lines from an {@code InputStream} into a list of strings, using the platform's default character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, may be {@code null} .
-
- Returns: a list of strings, each representing a line from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #readAllLines(InputStream, Charset), #readAllLines(Reader)
-
Signature:
public static List<String> readAllLines(final InputStream source, final Charset charset) throws UncheckedIOException - Summary: Reads all lines from an {@code InputStream} into a list of strings, using the specified character set.
-
Contract:
- <p> Note: This method should not be used for streams with a size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: a list of strings, each representing a line from the stream.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #readAllLines(Reader)
-
Signature:
public static List<String> readAllLines(final Reader source) throws UncheckedIOException - Summary: Reads all lines from a {@code Reader} into a list of strings.
-
Contract:
- <p> Note: This method should not be used for readers with content size close to {@code Integer.MAX_VALUE} due to memory constraints.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} .
-
- Returns: a list of strings, each representing a line from the reader.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
readLines(...) -> List<String>
-
Signature:
public static List<String> readLines(final File source, final int offset, final int count) throws IOException - Summary: Reads a specified number of lines from a file into a list of strings, starting from a given line offset, using the platform's default charset.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
offset(int) — the 0-based index of the first line to read, must be > = 0. -
count(int) — the number of lines to read, must be > = 0.
-
- Returns: a list of strings, each representing a line from the specified range in the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static List<String> readLines(final File source, final Charset charset, final int offset, final int count) throws IOException - Summary: Reads a specified number of lines from a file into a list of strings, starting from a given line offset, using the specified character set.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(int) — the 0-based index of the first line to read, must be > = 0. -
count(int) — the number of lines to read, must be > = 0.
-
- Returns: a list of strings, each representing a line from the specified range in the file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static List<String> readLines(final InputStream source, final int offset, final int count) throws IOException - Summary: Reads a specified number of lines from an {@code InputStream} into a list of strings, starting from a given line offset, using the platform's default charset.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
offset(int) — the 0-based index of the first line to read, must be > = 0. -
count(int) — the number of lines to read, must be > = 0.
-
- Returns: a list of strings, each representing a line from the specified range in the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readLines(InputStream, Charset, int, int), #readLines(Reader, int, int)
-
Signature:
public static List<String> readLines(final InputStream source, final Charset charset, final int offset, final int count) throws IOException - Summary: Reads a specified number of lines from an {@code InputStream} into a list of strings, starting from a given line offset, using the specified character set.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
offset(int) — the 0-based index of the first line to read, must be > = 0. -
count(int) — the number of lines to read, must be > = 0.
-
- Returns: a list of strings, each representing a line from the specified range in the stream.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #readLines(Reader, int, int)
-
Signature:
@SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static List<String> readLines(final Reader source, int offset, int count) throws IOException - Summary: Reads a specified number of lines from a {@code Reader} into a list of strings, starting from a given line offset.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} . -
offset(int) — the 0-based index of the first line to read, must be > = 0. -
count(int) — the number of lines to read, must be > = 0.
-
- Returns: a list of strings, each representing a line from the specified range in the reader.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
readFirstLine(...) -> String
-
Signature:
@MayReturnNull public static String readFirstLine(final File source) throws IOException - Summary: Reads the first line from a file using the platform's default charset.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text_file.txt"); try { String firstLine = IOUtil.readFirstLine(file); if (firstLine != null) { System.out.println("First line: " + firstLine); } } catch (IOException e) { System.err.println("Error reading file: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: the first line of the file, or {@code null} if the file is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull public static String readFirstLine(final File source, final Charset charset) throws IOException - Summary: Reads the first line from a file using the specified character set.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text_file.txt"); try { String firstLine = IOUtil.readFirstLine(file, StandardCharsets.UTF_8); if (firstLine != null) { System.out.println("First line: " + firstLine); } } catch (IOException e) { System.err.println("Error reading file: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: the first line of the file, or {@code null} if the file is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull public static String readFirstLine(final Reader source) throws IOException - Summary: Reads the first line from a {@code Reader} .
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("text_file.txt")) { String firstLine = IOUtil.readFirstLine(reader); if (firstLine != null) { System.out.println("First line: " + firstLine); } } catch (IOException e) { System.err.println("Error reading from reader: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} .
-
- Returns: the first line from the reader, or {@code null} if the reader is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
readLastLine(...) -> String
-
Signature:
@MayReturnNull public static String readLastLine(final File source) throws IOException - Summary: Reads the last line from a file using the platform's default charset.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text_file.txt"); try { String lastLine = IOUtil.readLastLine(file); if (lastLine != null) { System.out.println("Last line: " + lastLine); } } catch (IOException e) { System.err.println("Error reading file: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} .
-
- Returns: the last line of the file, or {@code null} if the file is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull public static String readLastLine(final File source, final Charset charset) throws IOException - Summary: Reads the last line from a file using the specified character set.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text_file.txt"); try { String lastLine = IOUtil.readLastLine(file, StandardCharsets.UTF_8); if (lastLine != null) { System.out.println("Last line: " + lastLine); } } catch (IOException e) { System.err.println("Error reading file: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used.
-
- Returns: the last line of the file, or {@code null} if the file is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull public static String readLastLine(final Reader source) throws IOException - Summary: Reads the last line from a {@code Reader} and returns it as a {@code String} .
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("text_file.txt")) { String lastLine = IOUtil.readLastLine(reader); if (lastLine != null) { System.out.println("Last line: " + lastLine); } } catch (IOException e) { System.err.println("Error reading from reader: " + e.getMessage()); } } </pre>
-
Parameters:
-
source(Reader) — the {@code Reader} to read the last line from, must not be {@code null} .
-
- Returns: a {@code String} containing the last line from the reader, or {@code null} if the reader is empty.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
readLine(...) -> String
-
Signature:
@MayReturnNull public static String readLine(final File source, final int lineIndex) throws IllegalArgumentException, IOException - Summary: Reads a specific line from a file using the default charset and returns it as a {@code String} .
-
Parameters:
-
source(File) — the file to read the line from, must not be {@code null} . -
lineIndex(int) — the index of the line to read, starting from 0 for the first line.
-
- Returns: a {@code String} containing the specified line from the file, or {@code null} if the file has fewer lines.
-
Throws:
-
java.lang.IllegalArgumentException— if the line index is negative. -
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull public static String readLine(final File source, final Charset charset, final int lineIndex) throws IllegalArgumentException, IOException - Summary: Reads a specific line from a file using the specified character set and returns it as a {@code String} .
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
charset(Charset) — the character set to use for decoding, if {@code null} the platform's default charset is used. -
lineIndex(int) — the index of the line to read, starting from 0 for the first line, must be > = 0.
-
- Returns: a {@code String} containing the specified line, or {@code null} if the file has fewer lines.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code lineIndex} is negative. -
java.io.IOException— if an I/O error occurs.
-
-
Signature:
@MayReturnNull @SuppressFBWarnings("RV_DONT_JUST_NULL_CHECK_READLINE") public static String readLine(final Reader source, int lineIndex) throws IllegalArgumentException, IOException - Summary: Reads a specific line from a {@code Reader} and returns it as a {@code String} .
-
Parameters:
-
source(Reader) — the {@code Reader} to read the line from, must not be {@code null} . -
lineIndex(int) — the index of the line to read, starting from 0 for the first line.
-
- Returns: a {@code String} containing the specified line from the reader, or {@code null} if the reader has fewer lines.
-
Throws:
-
java.lang.IllegalArgumentException— if the line index is negative. -
java.io.IOException— if an I/O error occurs.
-
read(...) -> int
-
Signature:
public static int read(final File source, final byte[] buf) throws IOException - Summary: Reads data from a file into a byte array buffer.
-
Parameters:
-
source(File) — the file to read from, must not be {@code null} . -
buf(byte[]) — the byte array buffer where the data is to be stored, must not be {@code null} .
-
- Returns: the total number of bytes read into the buffer, or {@code -1} if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final File source, final byte[] buf, final int off, final int len) throws IOException - Summary: Reads data from a file into a byte array buffer with specified offset and length.
-
Parameters:
-
source(File) — the file to read data from, must not be {@code null} . -
buf(byte[]) — the byte array buffer where the data is to be stored, must not be {@code null} . -
off(int) — the start offset in the array at which the data is written. -
len(int) — the maximum number of bytes to read.
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final InputStream source, final byte[] buf) throws IOException - Summary: Reads data from an InputStream into a byte array buffer.
-
Parameters:
-
source(InputStream) — the InputStream to read data from, must not be {@code null} . -
buf(byte[]) — the byte array buffer where the data is to be stored, must not be {@code null} .
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final InputStream source, final byte[] buf, final int off, final int len) throws IOException - Summary: Reads data from an InputStream into a byte array buffer with specified offset and length.
-
Parameters:
-
source(InputStream) — the InputStream to read data from, must not be {@code null} . -
buf(byte[]) — the byte array buffer where the data is to be stored, must not be {@code null} . -
off(int) — the start offset in the array at which the data is written. -
len(int) — the maximum number of bytes to read.
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final File source, final char[] buf) throws IOException - Summary: Reads data from a file into a char array buffer using the default charset.
-
Parameters:
-
source(File) — the file to read data from, must not be {@code null} . -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} .
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final File source, final Charset charset, final char[] buf) throws IOException - Summary: Reads data from a file into a char array buffer using the provided charset.
-
Parameters:
-
source(File) — the file to read data from, must not be {@code null} . -
charset(Charset) — the charset to be used to open the specified file for reading. -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} .
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final File source, final char[] buf, final int off, final int len) throws IOException - Summary: Reads data from a file into a char array buffer using the default charset with specified offset and length.
-
Parameters:
-
source(File) — the file to read data from, must not be {@code null} . -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} . -
off(int) — the start offset in the array at which the data is written. -
len(int) — the maximum number of chars to read.
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final File source, final Charset charset, final char[] buf, final int off, final int len) throws IOException - Summary: Reads data from a file into a char array buffer using the provided charset with specified offset and length.
-
Parameters:
-
source(File) — the file to read data from, must not be {@code null} . -
charset(Charset) — the charset to be used to open the specified file for reading. -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} . -
off(int) — the start offset in the array at which the data is written. -
len(int) — the maximum number of chars to read.
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the file has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final Reader source, final char[] buf) throws IOException - Summary: Reads data from a Reader into a char array buffer.
-
Parameters:
-
source(Reader) — the Reader to read data from, must not be {@code null} . -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} .
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static int read(final Reader source, final char[] buf, final int off, final int len) throws IOException - Summary: Reads data from a Reader into a char array buffer with specified offset and length.
-
Parameters:
-
source(Reader) — the Reader to read data from, must not be {@code null} . -
buf(char[]) — the char array buffer where the data is to be stored, must not be {@code null} . -
off(int) — the start offset in the array at which the data is written. -
len(int) — the maximum number of chars to read.
-
- Returns: the total number of chars read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
writeLine(...) -> void
-
Signature:
public static void writeLine(final Object obj, final File output) throws IOException - Summary: Writes the string representation of an Object to a file as a single line using the default charset.
-
Parameters:
-
obj(Object) — the Object to be written. -
output(File) — the file where the object's string representation is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLine(final Object obj, final Writer output) throws IOException - Summary: Writes the string representation of an Object to a Writer as a single line using the default charset.
-
Parameters:
-
obj(Object) — the Object to be written. -
output(Writer) — the Writer where the object's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLine(final Object obj, final Writer output, final boolean flush) throws IOException - Summary: Writes the string representation of an Object to a Writer as a single line.
-
Parameters:
-
obj(Object) — the Object to be written. -
output(Writer) — the Writer where the object's string representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the stream will be flushed after writing the line.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
writeLines(...) -> void
-
Signature:
public static void writeLines(final Iterator<?> lines, final File output) throws IOException - Summary: Writes the string representation of each object in an Iterator to a file.
-
Parameters:
-
lines(Iterator<?>) — the Iterator containing the objects to be written. -
output(File) — the File where the objects' string representations are to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLines(final Iterator<?> lines, final Writer output) throws IOException - Summary: Writes the string representation of each object in an Iterator to a Writer.
-
Parameters:
-
lines(Iterator<?>) — the Iterator containing the objects to be written. -
output(Writer) — the Writer where the objects' string representations are to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLines(final Iterator<?> lines, final Writer output, final boolean flush) throws IOException - Summary: Writes the string representation of each object in an Iterator to a Writer.
-
Parameters:
-
lines(Iterator<?>) — the Iterator containing the objects to be written. -
output(Writer) — the Writer where the objects' string representations are to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the stream will be flushed after writing the lines.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLines(final Iterable<?> lines, final File output) throws IOException - Summary: Writes the string representation of each object in an Iterable to a file.
-
Parameters:
-
lines(Iterable<?>) — the Iterable containing the objects to be written. -
output(File) — the File where the objects' string representations are to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLines(final Iterable<?> lines, final Writer output) throws IOException - Summary: Writes the string representation of each object in an Iterable to a Writer.
-
Parameters:
-
lines(Iterable<?>) — the Iterable containing the objects to be written. -
output(Writer) — the Writer where the objects' string representations are to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void writeLines(final Iterable<?> lines, final Writer output, final boolean flush) throws IOException - Summary: Writes the string representation of each object in an Iterable to a Writer.
-
Parameters:
-
lines(Iterable<?>) — the Iterable containing the objects to be written. -
output(Writer) — the Writer where the objects' string representations are to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the stream will be flushed after writing the lines.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
write(...) -> void
-
Signature:
public static void write(final boolean value, final Writer output) throws IOException - Summary: Writes the string representation of a boolean to a Writer.
-
Parameters:
-
value(boolean) — the boolean value to be written. -
output(Writer) — the Writer where the boolean's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char value, final Writer output) throws IOException - Summary: Writes a single character to a Writer.
-
Parameters:
-
value(char) — the character to be written. -
output(Writer) — the Writer where the character is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte value, final Writer output) throws IOException - Summary: Writes the string representation of a byte to a Writer.
-
Parameters:
-
value(byte) — the byte value to be written. -
output(Writer) — the Writer where the byte's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final short value, final Writer output) throws IOException - Summary: Writes the string representation of a short to a Writer.
-
Parameters:
-
value(short) — the short value to be written. -
output(Writer) — the Writer where the short's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final int value, final Writer output) throws IOException - Summary: Writes the string representation of an integer to a Writer.
-
Parameters:
-
value(int) — the integer value to be written. -
output(Writer) — the Writer where the integer's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final long lng, final Writer output) throws IOException - Summary: Writes the string representation of a long to a Writer.
-
Parameters:
-
lng(long) — the long value to be written. -
output(Writer) — the Writer where the long's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final float value, final Writer output) throws IOException - Summary: Writes the string representation of a float to a Writer.
-
Parameters:
-
value(float) — the float value to be written. -
output(Writer) — the Writer where the float string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final double value, final Writer output) throws IOException - Summary: Writes the string representation of a double to a Writer.
-
Parameters:
-
value(double) — the double value to be written. -
output(Writer) — the Writer where the double string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final Object obj, final Writer output) throws IOException - Summary: Writes the string representation of an object to a Writer.
-
Parameters:
-
obj(Object) — the object whose string representation is to be written. -
output(Writer) — the Writer where the object's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: N#toString(Object)
-
Signature:
public static void write(final CharSequence cs, final File output) throws IOException - Summary: Writes the byte array representation of a CharSequence to a File using the default charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
output(File) — the File where the CharSequence's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes()
-
Signature:
public static void write(final CharSequence cs, Charset charset, final File output) throws IOException - Summary: Writes the byte array representation of a CharSequence to a File using the specified Charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
charset(Charset) — the Charset to be used to encode the CharSequence into a sequence of bytes, if {@code null} the platform's default charset is used. -
output(File) — the File where the CharSequence's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes(Charset)
-
Signature:
public static void write(final CharSequence cs, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a CharSequence to an OutputStream using the default charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
output(OutputStream) — the OutputStream where the CharSequence's byte array representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes()
-
Signature:
public static void write(final CharSequence cs, final Charset charset, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a CharSequence to an OutputStream using the specified Charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
charset(Charset) — the Charset to be used to encode the CharSequence into a sequence of bytes, if {@code null} the platform's default charset is used. -
output(OutputStream) — the OutputStream where the CharSequence's byte array representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes(Charset)
-
Signature:
public static void write(final CharSequence cs, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the byte array representation of a CharSequence to an OutputStream using the default charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
output(OutputStream) — the OutputStream where the CharSequence's byte array representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream is flushed after writing the CharSequence.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes()
-
Signature:
public static void write(final CharSequence cs, Charset charset, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the byte array representation of a CharSequence to an OutputStream using the specified Charset.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose byte array representation is to be written. -
charset(Charset) — the Charset to be used to encode the CharSequence into a sequence of bytes, if {@code null} the platform's default charset is used. -
output(OutputStream) — the OutputStream where the CharSequence's byte array representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream is flushed after writing the CharSequence.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: String#getBytes(Charset)
-
Signature:
public static void write(final CharSequence cs, final Writer output) throws IOException - Summary: Writes the string representation of a CharSequence to a Writer.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose string representation is to be written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (Writer writer = new FileWriter("output.txt")) { IOUtil.write("Hello, World!", writer); } } </pre> -
output(Writer) — the Writer where the CharSequence's string representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final CharSequence cs, final Writer output, final boolean flush) throws IOException - Summary: Writes the string representation of a CharSequence to a Writer.
-
Parameters:
-
cs(CharSequence) — the CharSequence whose string representation is to be written. -
output(Writer) — the Writer where the CharSequence's string representation is to be written, must not be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code try (Writer writer = new FileWriter("output.txt")) { IOUtil.write("Hello, World!", writer); } } </pre> -
flush(boolean) — if {@code true} , the Writer is flushed after writing the CharSequence.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final File output) throws IOException - Summary: Writes the byte array representation of a character array to a File using the default charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
output(File) — the File where the character array's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], Charset)
-
Signature:
public static void write(final char[] chars, final Charset charset, final File output) throws IOException - Summary: Writes the byte array representation of a character array to a File using the specified Charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes, if {@code null} the platform's default charset is used. -
output(File) — the File where the character array's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], Charset)
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final File output) throws IOException - Summary: Writes the byte array representation of a portion of a character array to a File using the default charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
output(File) — the File where the character array's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final Charset charset, final File output) throws IOException - Summary: Writes the byte array representation of a portion of a character array to a File using the specified Charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes, if {@code null} the platform's default charset is used. -
output(File) — the File where the character array's byte array representation is to be written, must not be {@code null} . If the file exists, it will be overwritten. If the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] chars = {'H', 'e', 'l', 'l', 'o'}; try (Writer writer = new FileWriter("output.txt")) { IOUtil.write(chars, writer); } } </pre> -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final Charset charset, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the specified Charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] chars = {'H', 'e', 'l', 'l', 'o'}; try (Writer writer = new FileWriter("output.txt")) { IOUtil.write(chars, writer); } } </pre> -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the default charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final Charset charset, final OutputStream output) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the specified Charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written, must not be {@code null} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the default charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream is flushed after writing the character array.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], Charset)
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the default charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream is flushed after writing the character array.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final Charset charset, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the byte array representation of a character array to an OutputStream using the specified Charset.
-
Parameters:
-
chars(char[]) — the character array whose byte array representation is to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. -
output(OutputStream) — the OutputStream where the character array's byte array representation is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream is flushed after writing the character array.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void write(final char[] chars, final Writer output) throws IOException - Summary: Writes the string representation of a character array to a Writer.
-
Parameters:
-
chars(char[]) — the character array to be written. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] chars = {'H', 'e', 'l', 'l', 'o'}; try (Writer writer = new FileWriter("output.txt")) { IOUtil.write(chars, writer); } } </pre> -
output(Writer) — the Writer where the character array is to be written.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final Writer output) throws IOException - Summary: Writes a portion of a character array to a Writer.
-
Parameters:
-
chars(char[]) — the character array to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
output(Writer) — the Writer where the character array is to be written.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final Writer output, final boolean flush) throws IOException - Summary: Writes an array of characters to a Writer.
-
Parameters:
-
chars(char[]) — the character array to be written. -
output(Writer) — the Writer where the character array is to be written. -
flush(boolean) — if {@code true} , the output writer will be flushed after writing.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final char[] chars, final int offset, final int count, final Writer output, final boolean flush) throws IOException - Summary: Writes a portion of a character array to a Writer.
-
Parameters:
-
chars(char[]) — the character array to be written. -
offset(int) — the starting position in the character array. -
count(int) — the number of characters to be written from the character array. -
output(Writer) — the Writer where the character array is to be written. -
flush(boolean) — if {@code true} , the output writer will be flushed after writing.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final File output) throws IOException - Summary: Writes an array of bytes to a File.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
output(File) — the File where the byte array is to be written. if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final int offset, final int count, final File output) throws IOException - Summary: Writes a portion of a byte array to a File.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
offset(int) — the starting position in the byte array. -
count(int) — the number of bytes to be written from the byte array. -
output(File) — the File where the byte array is to be written. if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final OutputStream output) throws IOException - Summary: Writes an array of bytes to an OutputStream.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
output(OutputStream) — the OutputStream where the byte array is to be written. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = "Hello".getBytes(); try (OutputStream os = new FileOutputStream("output.bin")) { IOUtil.write(data, os); } } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final int offset, final int count, final OutputStream output) throws IOException - Summary: Writes a portion of a byte array to an OutputStream.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
offset(int) — the starting position in the byte array. -
count(int) — the number of bytes to be written from the byte array. -
output(OutputStream) — the OutputStream where the byte array is to be written. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = "Hello, World!".getBytes(); try (OutputStream os = new FileOutputStream("output.bin")) { IOUtil.write(data, 7, 5, os); // Writes "World" } } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final OutputStream output, final boolean flush) throws IOException - Summary: Writes an array of bytes to an OutputStream.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
output(OutputStream) — the OutputStream where the byte array is to be written. -
flush(boolean) — if {@code true} , the output stream is flushed after writing the byte array. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = "Data".getBytes(); try (OutputStream os = new FileOutputStream("output.bin")) { IOUtil.write(data, os, true); // Write and flush } } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void write(final byte[] bytes, final int offset, final int count, final OutputStream output, final boolean flush) throws IOException - Summary: Writes a portion of a byte array to an OutputStream.
-
Parameters:
-
bytes(byte[]) — the byte array to be written. -
offset(int) — the starting position in the byte array. -
count(int) — the number of bytes to be written from the byte array. -
output(OutputStream) — the OutputStream where the byte array is to be written. -
flush(boolean) — if {@code true} , the output stream is flushed after writing the byte array. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = "Hello, World!".getBytes(); try (OutputStream os = new FileOutputStream("output.bin")) { IOUtil.write(data, 0, 5, os, true); // Writes "Hello" and flushes } } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final File output) throws IOException - Summary: Writes the content of the source file to the output file.
-
Parameters:
-
source(File) — the file to read from. -
output(File) — the file to write to. if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of bytes written to the output file. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("source.bin"); File output = new File("output.bin"); long bytesWritten = IOUtil.write(source, output); } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final long offset, final long count, final File output) throws IOException - Summary: Writes a portion of a file to another file.
-
Parameters:
-
source(File) — the source file to be written, must not be {@code null} . -
offset(long) — the starting position in the source file, in bytes. -
count(long) — the number of bytes to be written from the source file. -
output(File) — the output file where the source file is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("large_file.bin"); File output = new File("partial.bin"); long bytesWritten = IOUtil.write(source, 1024, 2048, output); // Copy bytes 1024-3071 } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final OutputStream output) throws IOException - Summary: Writes the content of a source file to an {@code OutputStream} .
-
Parameters:
-
source(File) — the source file to be written, must not be {@code null} . -
output(OutputStream) — the {@code OutputStream} where the source file is to be written, must not be {@code null} .
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("data.bin"); try (OutputStream os = new FileOutputStream("copy.bin")) { long bytesWritten = IOUtil.write(source, os); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final long offset, final long count, final OutputStream output) throws IOException - Summary: Writes the content of the source file to the output stream, starting from the specified offset and writing up to the specified count.
-
Parameters:
-
source(File) — the file to read from. -
offset(long) — the position in the file to start reading from. -
count(long) — the maximum number of bytes to write to the output. -
output(OutputStream) — the output stream to write to.
-
- Returns: the total number of bytes written to the output stream. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("large_file.bin"); try (OutputStream os = new FileOutputStream("partial.bin")) { long bytesWritten = IOUtil.write(source, 1000, 5000, os); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the content of a source file to an {@code OutputStream} .
-
Parameters:
-
source(File) — the source file to be written, must not be {@code null} . -
output(OutputStream) — the {@code OutputStream} where the source file is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream will be flushed after the write operation.
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("data.bin"); try (OutputStream os = new FileOutputStream("copy.bin")) { long bytesWritten = IOUtil.write(source, os, true); // Write and flush } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final File source, final long offset, final long count, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the content of the source file to the output stream, starting from the specified offset and writing up to the specified count.
-
Contract:
- if the flush parameter is {@code true} , the output stream is flushed after the write operation.
-
Parameters:
-
source(File) — the file to read from. -
offset(long) — the position in the file to start reading from. -
count(long) — the maximum number of bytes to write to the output. -
output(OutputStream) — the output stream to write to. -
flush(boolean) — if {@code true} , the output stream is flushed after the write operation.
-
- Returns: the total number of bytes written to the output stream. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("large_file.bin"); try (OutputStream os = new FileOutputStream("partial.bin")) { long bytesWritten = IOUtil.write(source, 100, 500, os, true); // Write 500 bytes from offset 100 } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final File output) throws IOException - Summary: Writes the content of the input stream to the specified output file.
-
Parameters:
-
source(InputStream) — the input stream to read from. -
output(File) — the file to write to. if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of bytes written to the output file. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin")) { File output = new File("output.bin"); long bytesWritten = IOUtil.write(is, output); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final long offset, final long count, final File output) throws IOException - Summary: Writes the content of an {@code InputStream} to a file.
-
Parameters:
-
source(InputStream) — the {@code InputStream} to be written, must not be {@code null} . -
offset(long) — the starting point from where to begin writing bytes from the {@code InputStream} , in bytes. -
count(long) — the maximum number of bytes to write to the file. -
output(File) — the file where the {@code InputStream} is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin")) { File output = new File("partial.bin"); long bytesWritten = IOUtil.write(is, 512, 1024, output); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final OutputStream output) throws IOException - Summary: Writes the content of an {@code InputStream} to an {@code OutputStream} .
-
Parameters:
-
source(InputStream) — the {@code InputStream} to be written, must not be {@code null} . -
output(OutputStream) — the {@code OutputStream} where the {@code InputStream} is to be written, must not be {@code null} .
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin"); OutputStream os = new FileOutputStream("dest.bin")) { long bytesWritten = IOUtil.write(is, os); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final long offset, final long count, final OutputStream output) throws IOException - Summary: Writes the content of an {@code InputStream} to an {@code OutputStream} .
-
Parameters:
-
source(InputStream) — the {@code InputStream} to be written, must not be {@code null} . -
offset(long) — the starting point from where to begin writing bytes from the {@code InputStream} , in bytes. -
count(long) — the maximum number of bytes to write to the {@code OutputStream} . -
output(OutputStream) — the {@code OutputStream} where the {@code InputStream} is to be written, must not be {@code null} .
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin"); OutputStream os = new FileOutputStream("partial.bin")) { long bytesWritten = IOUtil.write(is, 256, 512, os); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final OutputStream output, final boolean flush) throws IOException - Summary: Writes the content of an {@code InputStream} to an {@code OutputStream} .
-
Parameters:
-
source(InputStream) — the {@code InputStream} to be written, must not be {@code null} . -
output(OutputStream) — the {@code OutputStream} where the {@code InputStream} is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output stream will be flushed after writing.
-
- Returns: the total number of bytes written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin"); OutputStream os = new FileOutputStream("dest.bin")) { long bytesWritten = IOUtil.write(is, os, true); // Write and flush } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final InputStream source, final long offset, final long count, final OutputStream output, final boolean flush) throws IllegalArgumentException, IOException - Summary: Writes the content of the input stream to the output stream, starting from the specified offset and writing up to the specified count.
-
Contract:
- if the flush parameter is {@code true} , the output stream is flushed after the write operation.
-
Parameters:
-
source(InputStream) — the input stream to read from. -
offset(long) — the position in the input stream to start reading from. -
count(long) — the maximum number of bytes to write to the output. -
output(OutputStream) — the output stream to write to. -
flush(boolean) — if {@code true} , the output stream is flushed after the write operation.
-
- Returns: the total number of bytes written to the output stream. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("source.bin"); OutputStream os = new FileOutputStream("partial.bin")) { long bytesWritten = IOUtil.write(is, 100, 500, os, true); } } </pre>
-
Throws:
-
java.lang.IllegalArgumentException -
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final File output) throws IOException - Summary: Writes the content of a Reader to a file using the default charset.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
output(File) — the file where the {@code Reader} 's content is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of characters written.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final Charset charset, final File output) throws IOException - Summary: Writes the content of a Reader to a file using the specified Charset.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
charset(Charset) — the {@code Charset} to be used to open the specified file for writing. If {@code null} , the platform's default charset is used. -
output(File) — the file where the {@code Reader} 's content is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of characters written.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final long offset, final long count, final File output) throws IOException - Summary: Writes the content of a Reader to a file starting from a specific offset and up to a certain count using the default charset.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
offset(long) — the position in the {@code Reader} to start writing from, in characters. -
count(long) — the maximum number of characters to be written. -
output(File) — the file where the {@code Reader} 's content is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of characters written.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final long offset, final long count, final Charset charset, final File output) throws IOException - Summary: Writes the content of a Reader to a file starting from a specific offset and up to a certain count using the specified Charset.
-
Contract:
- If the file exists, it will be overwritten.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
offset(long) — the position in the {@code Reader} to start writing from, in characters. -
count(long) — the maximum number of characters to be written. -
charset(Charset) — the {@code Charset} to be used to open the specified file for writing. If {@code null} , the platform's default charset is used. -
output(File) — the file where the {@code Reader} 's content is to be written, must not be {@code null} . if the file exists, it will be overwritten. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the total number of characters written.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final Writer output) throws IOException - Summary: Writes the content from a {@code Reader} to a {@code Writer} .
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
output(Writer) — the {@code Writer} where the {@code Reader} 's content is to be written, must not be {@code null} .
-
- Returns: the total number of characters written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("source.txt"); Writer writer = new FileWriter("dest.txt")) { long charsWritten = IOUtil.write(reader, writer); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final long offset, final long count, final Writer output) throws IOException - Summary: Writes the content of a Reader to a Writer starting from a specific offset and up to a certain count.
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
offset(long) — the position in the {@code Reader} to start writing from, in characters. -
count(long) — the maximum number of characters to be written. -
output(Writer) — the {@code Writer} where the {@code Reader} 's content is to be written, must not be {@code null} .
-
- Returns: the total number of characters written.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final Writer output, final boolean flush) throws IOException - Summary: Writes the content of a {@code Reader} to a {@code Writer} .
-
Parameters:
-
source(Reader) — the {@code Reader} to be written, must not be {@code null} . -
output(Writer) — the {@code Writer} where the {@code Reader} 's content is to be written, must not be {@code null} . -
flush(boolean) — if {@code true} , the output {@code Writer} is flushed after writing.
-
- Returns: the total number of characters written. <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("source.txt"); Writer writer = new FileWriter("dest.txt")) { long charsWritten = IOUtil.write(reader, writer, true); // Write and flush } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long write(final Reader source, final long offset, final long count, final Writer output, final boolean flush) throws IllegalArgumentException, IOException - Summary: Writes a specified number of characters from a Reader to a Writer, starting from a specified offset.
-
Parameters:
-
source(Reader) — the Reader to read from. -
offset(long) — the position in the Reader to start reading from. -
count(long) — the number of characters to read from the Reader and write to the Writer. -
output(Writer) — the Writer to write to. -
flush(boolean) — if {@code true} , the output Writer is flushed after writing.
-
- Returns: the total number of characters written to the Writer.
-
Throws:
-
java.lang.IllegalArgumentException— if the source Reader is {@code null} or if the count is negative. -
java.io.IOException— if an I/O error occurs.
-
append(...) -> void
-
Signature:
public static void append(final byte[] bytes, final File targetFile) throws IOException - Summary: Appends the given byte array to the specified file.
-
Contract:
- If the file exists, data will be appended.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
bytes(byte[]) — the byte array to append to the file. -
targetFile(File) — the file to which the byte array will be appended. if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void append(final byte[] bytes, final int offset, final int count, final File targetFile) throws IOException - Summary: Appends a portion of a byte array to the specified file.
-
Contract:
- If the file exists, data will be appended.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
bytes(byte[]) — the byte array to append to the file. -
offset(int) — the starting index from where to append the bytes. -
count(int) — the number of bytes to append from the byte array. -
targetFile(File) — the file to which the byte array will be appended. if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void append(final char[] chars, final File targetFile) throws IOException - Summary: Appends the given character array to the specified file using the default charset.
-
Contract:
- If the file exists, data will be appended.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
chars(char[]) — the character array to append to the file. -
targetFile(File) — the file to which the character array will be appended. if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], Charset)
-
Signature:
public static void append(final char[] chars, final Charset charset, final File targetFile) throws IOException - Summary: Appends the given character array to the specified file using the specified Charset.
-
Contract:
- If the file exists, data will be appended.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
chars(char[]) — the character array to append to the file. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. -
targetFile(File) — the file to which the character array will be appended. if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], Charset)
-
Signature:
public static void append(final char[] chars, final int offset, final int count, final File targetFile) throws IOException - Summary: Appends the content of the character array to the target file using the default charset.
-
Contract:
- If the file exists, data will be appended.
- If the file's parent directory doesn't exist, it will be created.
-
Parameters:
-
chars(char[]) — the character array to append to the file. -
offset(int) — the initial offset in the character array. -
count(int) — the number of characters to append. -
targetFile(File) — the file to which the character array will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void append(final char[] chars, final int offset, final int count, final Charset charset, final File targetFile) throws IOException - Summary: Appends the content of the character array to the target file.
-
Parameters:
-
chars(char[]) — the character array to append to the file. -
offset(int) — the initial offset in the character array. -
count(int) — the number of characters to append. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. -
targetFile(File) — the file to which the character array will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #charsToBytes(char\[\], int, int, Charset)
-
Signature:
public static void append(final CharSequence cs, final File targetFile) throws IOException - Summary: Appends the content of the CharSequence to the target file.
-
Parameters:
-
cs(CharSequence) — the CharSequence to append to the file. -
targetFile(File) — the file to which the CharSequence will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void append(final CharSequence cs, final Charset charset, final File targetFile) throws IOException - Summary: Appends the content of the CharSequence to the target file.
-
Parameters:
-
cs(CharSequence) — the CharSequence to append to the file. -
charset(Charset) — the Charset to be used to encode the character array into a sequence of bytes. -
targetFile(File) — the file to which the CharSequence will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final File source, final File targetFile) throws IOException - Summary: Appends the content of the source file to the target file.
-
Parameters:
-
source(File) — the source file to read from, must not be {@code null} . -
targetFile(File) — the target file to append to, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of bytes appended. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("log.txt"); IOUtil.append("New log entry\\n", file); // Appends to existing file } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final File source, final long offset, final long count, final File targetFile) throws IOException - Summary: Appends the content of the source file to the target file.
-
Parameters:
-
source(File) — the source file to read from, must not be {@code null} . -
offset(long) — the starting point in bytes from where to read in the source file. -
count(long) — the maximum number of bytes to read from the source file. -
targetFile(File) — the file to which the content will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of bytes appended to the target file. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("log.txt"); IOUtil.append("New log entry\\n", file); // Appends to existing file } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final InputStream source, final File targetFile) throws IOException - Summary: Appends the content of the InputStream to the target file.
-
Parameters:
-
source(InputStream) — the InputStream to read from, must not be {@code null} . -
targetFile(File) — the file to which the InputStream content will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of bytes appended to the target file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final InputStream source, final long offset, final long count, final File targetFile) throws IOException - Summary: Appends the content of the InputStream to the target file.
-
Parameters:
-
source(InputStream) — the InputStream to read from, must not be {@code null} . -
offset(long) — the starting point in bytes from where to read in the InputStream. -
count(long) — the maximum number of bytes to read from the InputStream. -
targetFile(File) — the file to which the InputStream content will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of bytes appended to the target file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final Reader source, final File targetFile) throws IOException - Summary: Appends the content of the Reader to the target file.
-
Parameters:
-
source(Reader) — the Reader to read from, must not be {@code null} . -
targetFile(File) — the file to which the Reader content will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of characters appended to the target file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final Reader source, final Charset charset, final File targetFile) throws IOException - Summary: Appends the content of a {@code Reader} to a file using the specified character set.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} . -
charset(Charset) — the character set to use for encoding, if {@code null} the platform's default charset is used. -
targetFile(File) — the file where the {@code Reader} 's content is to be appended, must not be {@code null} . If the file exists, content will be appended. If the file's parent directory doesn't exist, it will be created
-
- Returns: the total number of characters appended.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final Reader source, final long offset, final long count, final File targetFile) throws IOException - Summary: Appends the content of the Reader to the target file.
-
Parameters:
-
source(Reader) — the Reader to read from, must not be {@code null} . -
offset(long) — the position in the Reader to start reading from. -
count(long) — the maximum number of characters to read from the Reader. -
targetFile(File) — the file to which the Reader content will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
- Returns: the number of characters appended to the target file.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long append(final Reader source, final long offset, final long count, final Charset charset, final File targetFile) throws IOException - Summary: Appends the content of a {@code Reader} to a file using the specified character set, starting from a given offset and up to a specified count.
-
Parameters:
-
source(Reader) — the {@code Reader} to read from, must not be {@code null} . -
offset(long) — the starting position in characters from where to begin reading, must be > = 0. -
count(long) — the maximum number of characters to read, must be > = 0. -
charset(Charset) — the character set to use for encoding, if {@code null} the platform's default charset is used. -
targetFile(File) — the file where the {@code Reader} 's content is to be appended, must not be {@code null} . If the file exists, content will be appended. If the file's parent directory doesn't exist, it will be created
-
- Returns: the total number of characters appended.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
appendLine(...) -> void
-
Signature:
public static void appendLine(final Object obj, final File targetFile) throws IOException - Summary: Appends the string representation of the specified object as a new line to the target file.
-
Parameters:
-
obj(Object) — the object whose string representation is to be appended to the file. -
targetFile(File) — the file to which the object's string representation will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #writeLine(Object, File), N#toString(Object)
-
Signature:
public static void appendLine(final Object obj, final Charset charset, final File targetFile) throws IOException - Summary: Appends the string representation of the specified object as a new line to the target file.
-
Parameters:
-
obj(Object) — the object whose string representation is to be appended to the file. -
charset(Charset) — the Charset to be used to encode string representation of the specified object into a sequence of bytes. -
targetFile(File) — the file to which the object's string representation will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #writeLine(Object, File), N#toString(Object)
appendLines(...) -> void
-
Signature:
public static void appendLines(final Iterable<?> lines, final File targetFile) throws IOException - Summary: Appends the string representation of each object in the provided iterable as a new line to the target file.
-
Parameters:
-
lines(Iterable<?>) — the iterable whose elements' string representations are to be appended to the file. -
targetFile(File) — the file to which the elements' string representations will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #writeLines(Iterable, File), N#toString(Object)
-
Signature:
public static void appendLines(final Iterable<?> lines, final Charset charset, final File targetFile) throws IOException - Summary: Appends the string representation of each object in the provided iterable as a new line to the target file.
-
Parameters:
-
lines(Iterable<?>) — the iterable whose elements' string representations are to be appended to the file. -
charset(Charset) — the Charset to be used to open the specified file for writing. -
targetFile(File) — the file to which the elements' string representations will be appended, must not be {@code null} . if the file exists, it will be appended. if the file's parent directory doesn't exist, it will be created.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: #writeLines(Iterable, File), N#toString(Object)
transfer(...) -> long
-
Signature:
public static long transfer(final ReadableByteChannel src, final WritableByteChannel output) throws IOException - Summary: Transfers bytes from a source channel to a target channel.
-
Parameters:
-
src(ReadableByteChannel) — the source channel from which bytes are to be read. -
output(WritableByteChannel) — the target channel to which bytes are to be written.
-
- Returns: the number of bytes transferred. <p> <b> Usage Examples: </b> </p> <pre> {@code try (ReadableByteChannel src = Channels.newChannel(new FileInputStream("src.dat")); WritableByteChannel dest = Channels.newChannel(new FileOutputStream("dest.dat"))) { long bytesTransferred = IOUtil.transfer(src, dest); } } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs during the transfer.
-
skip(...) -> long
-
Signature:
public static long skip(final InputStream input, final long bytesToSkip) throws IOException - Summary: Skips over and discards a specified number of bytes from the input stream.
-
Parameters:
-
input(InputStream) — the {@code InputStream} from which bytes are to be skipped, must not be {@code null} . -
bytesToSkip(long) — the number of bytes to be skipped.
-
- Returns: the actual number of bytes skipped.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static long skip(final Reader input, final long charsToSkip) throws IOException - Summary: Skips over and discards a specified number of characters from the input reader.
-
Parameters:
-
input(Reader) — the {@code Reader} from which characters are to be skipped, must not be {@code null} . -
charsToSkip(long) — the number of characters to be skipped.
-
- Returns: the actual number of characters skipped.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
skipFully(...) -> void
-
Signature:
public static void skipFully(final InputStream input, final long bytesToSkip) throws IOException - Summary: Skips over and discards a specified number of bytes from the input stream.
-
Parameters:
-
input(InputStream) — the input stream to be skipped, must not be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.bin")) { IOUtil.skipFully(is, 1024); // Skip first 1024 bytes byte\[\] data = IOUtil.readAllBytes(is); } } </pre> -
bytesToSkip(long) — the number of bytes to be skipped.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs, including if the input stream reaches the end before skipping all the bytes.
-
-
Signature:
public static void skipFully(final Reader input, final long charsToSkip) throws IOException - Summary: Skips over and discards a specified number of characters from the input reader.
-
Parameters:
-
input(Reader) — the {@code Reader} from which characters are to be skipped, must not be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("data.txt")) { IOUtil.skipFully(reader, 1024); // Skip first 1024 characters char\[\] data = IOUtil.readAllChars(reader); } } </pre> -
charsToSkip(long) — the number of characters to be skipped.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs, including if the {@code Reader} reaches the end before skipping all the characters.
-
map(...) -> MappedByteBuffer
-
Signature:
public static MappedByteBuffer map(final File file) throws IllegalArgumentException, IOException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
file(File) — the file to be mapped into memory.
-
- Returns: a MappedByteBuffer that represents the content of the file.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided file is {@code null} . -
java.io.IOException— if an I/O error occurs during the operation. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("large_data.bin"); try (MappedByteBuffer buffer = IOUtil.map(file)) { byte data = buffer.get(); } } </pre>
-
- See also: FileChannel#map(MapMode, long, long)
-
Signature:
public static MappedByteBuffer map(final File file, final MapMode mode) throws IllegalArgumentException, IOException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
file(File) — the file to map. -
mode(MapMode) — the mode to use when mapping {@code file} .
-
- Returns: a buffer reflecting {@code file} .
-
Throws:
-
java.lang.IllegalArgumentException— if the file or mode is {@code null} , or if the file does not exist. -
java.io.IOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("data.bin"); try (MappedByteBuffer buffer = IOUtil.map(file, MapMode.READ_ONLY)) { // Read from memory-mapped file } } </pre>
-
- See also: FileChannel#map(MapMode, long, long)
-
Signature:
public static MappedByteBuffer map(final File file, final MapMode mode, final long offset, final long count) throws IllegalArgumentException, IOException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- <p> If the mode is {@link MapMode#READ_WRITE} and the file does not exist, it will be created with the requested {@code size} .
-
Parameters:
-
file(File) — the file to map. -
mode(MapMode) — the mode to use when mapping {@code file} . -
offset(long) — the offset within the file at which the mapped region is to start; must be non-negative. -
count(long) — the size of the region to be mapped; must be non-negative.
-
- Returns: a buffer reflecting {@code file} .
-
Throws:
-
java.lang.IllegalArgumentException— if the preconditions on the parameters do not hold. -
java.io.IOException— if an I/O error occurs.
-
- See also: FileChannel#map(MapMode, long, long)
simplifyPath(...) -> String
-
Signature:
public static String simplifyPath(String pathname) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- <li> fold output ./ <li> fold output ./ when possible <li> collapse multiple slashes <li> delete trailing slashes (unless the path is just "/") </ul> <p> These heuristics do not always match the behavior of the filesystem.
- If {@code a} is a symlink to {@code x} , {@code a/./b} may refer to a sibling of {@code x} , rather than the sibling of {@code a} referred to by {@code b} .
-
Parameters:
-
pathname(String) — the file path to simplify.
-
- Returns: the simplified path string with redundant elements removed.
- See also: java.nio.file.Path#normalize(), FilenameUtil#normalize(String), FilenameUtil#normalize(String, boolean)
getFileExtension(...) -> String
-
Signature:
@MayReturnNull public static String getFileExtension(final File file) - Summary: Returns the file extension of the specified file.
-
Contract:
- Empty string is returned if the file has no extension.
-
Parameters:
-
file(File) — the file whose extension is to be retrieved.
-
- Returns: the file extension, or {@code null} if the file is {@code null} .
- See also: FilenameUtil#getExtension(String)
-
Signature:
@MayReturnNull public static String getFileExtension(final String fileName) - Summary: Returns the file extension of the specified file name.
-
Contract:
- Empty string is returned if the file has no extension.
-
Parameters:
-
fileName(String) — the name of the file whose extension is to be retrieved.
-
- Returns: the file extension, or {@code null} if the specified file name is {@code null} .
- See also: FilenameUtil#getExtension(String)
getNameWithoutExtension(...) -> String
-
Signature:
@MayReturnNull public static String getNameWithoutExtension(final File file) - Summary: Returns the file name without its extension.
-
Parameters:
-
file(File) — the file whose name without extension is to be retrieved.
-
- Returns: the file name without extension, or {@code null} if the file is {@code null} .
- See also: FilenameUtil#removeExtension(String)
-
Signature:
@MayReturnNull public static String getNameWithoutExtension(final String fileName) - Summary: Removes the file extension from a filename.
-
Contract:
- If no extension is found, the original filename is returned unchanged.
-
Parameters:
-
fileName(String) — the filename to query, {@code null} returns null.
-
- Returns: the filename minus the extension, or {@code null} if the input is {@code null} .
- See also: FilenameUtil#removeExtension(String)
newAppendableWriter(...) -> AppendableWriter
-
Signature:
public static AppendableWriter newAppendableWriter(final Appendable appendable) - Summary: Creates a new AppendableWriter instance that wraps the provided Appendable object.
-
Parameters:
-
appendable(Appendable) — the Appendable object to be wrapped by the AppendableWriter, must not be {@code null} .
-
- Returns: a new instance of AppendableWriter that wraps the provided Appendable. <p> <b> Usage Examples: </b> </p> <pre> {@code StringBuilder sb = new StringBuilder(); Writer writer = IOUtil.newAppendableWriter(sb); writer.write("Hello"); // sb now contains "Hello" } </pre>
newStringWriter(...) -> StringWriter
-
Signature:
public static StringWriter newStringWriter() - Summary: Creates a new StringWriter instance.
-
Parameters:
- (none)
- Returns: a new instance of StringWriter.
-
Signature:
public static StringWriter newStringWriter(final int initialSize) - Summary: Creates a new StringWriter instance with the specified initial size.
-
Parameters:
-
initialSize(int) — the initial size of the buffer. <p> <b> Usage Examples: </b> </p> <pre> {@code StringWriter writer = IOUtil.newStringWriter(1024); writer.write("Content"); String result = writer.toString(); } </pre>
-
- Returns: a new instance of StringWriter with the specified initial size.
-
Signature:
public static StringWriter newStringWriter(final StringBuilder sb) - Summary: Creates a new StringWriter instance with the content of the specified StringBuilder.
-
Parameters:
-
sb(StringBuilder) — the StringBuilder whose content is to be used for the StringWriter. <p> <b> Usage Examples: </b> </p> <pre> {@code StringBuilder sb = new StringBuilder("Initial"); StringWriter writer = IOUtil.newStringWriter(sb); writer.write(" content"); // sb now contains "Initial content" } </pre>
-
- Returns: a new instance of StringWriter with the content of the specified StringBuilder.
newByteArrayOutputStream(...) -> ByteArrayOutputStream
-
Signature:
public static ByteArrayOutputStream newByteArrayOutputStream() - Summary: Creates a new ByteArrayOutputStream instance.
-
Parameters:
- (none)
- Returns: a new instance of ByteArrayOutputStream.
-
Signature:
public static ByteArrayOutputStream newByteArrayOutputStream(final int initCapacity) - Summary: Creates a new ByteArrayOutputStream instance with the specified initial capacity.
-
Parameters:
-
initCapacity(int) — the initial capacity of the ByteArrayOutputStream. <p> <b> Usage Examples: </b> </p> <pre> {@code ByteArrayOutputStream baos = IOUtil.newByteArrayOutputStream(1024); baos.write("Hello".getBytes()); byte\[\] result = baos.toByteArray(); } </pre>
-
- Returns: a new instance of ByteArrayOutputStream with the specified initial capacity.
newFileInputStream(...) -> FileInputStream
-
Signature:
public static FileInputStream newFileInputStream(final File file) throws UncheckedIOException - Summary: Creates a new FileInputStream instance for the specified file.
-
Parameters:
-
file(File) — the file to be opened for reading.
-
- Returns: a new FileInputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("data.bin"); try (FileInputStream fis = IOUtil.newFileInputStream(file)) { int data = fis.read(); } } </pre>
-
- See also: FileInputStream#FileInputStream(File)
-
Signature:
public static FileInputStream newFileInputStream(final String name) throws UncheckedIOException - Summary: Creates a new FileInputStream instance for the specified file name.
-
Parameters:
-
name(String) — the name of the file to be opened for reading.
-
- Returns: a new FileInputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileInputStream(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code try (FileInputStream fis = IOUtil.newFileInputStream("data.bin")) { byte\[\] buffer = new byte\[1024\]; int bytesRead = fis.read(buffer); } },</pre>, FileInputStream#FileInputStream(String)
newFileOutputStream(...) -> FileOutputStream
-
Signature:
public static FileOutputStream newFileOutputStream(final File file) throws UncheckedIOException - Summary: Creates a new FileOutputStream instance for the specified file.
-
Parameters:
-
file(File) — the file to be opened for writing.
-
- Returns: a new FileOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.bin"); try (FileOutputStream fos = IOUtil.newFileOutputStream(file)) { fos.write("Hello".getBytes()); } } </pre>
-
- See also: FileOutputStream#FileOutputStream(File)
-
Signature:
public static FileOutputStream newFileOutputStream(final File file, final boolean append) throws UncheckedIOException - Summary: Creates a new FileOutputStream instance for the specified file.
-
Parameters:
-
file(File) — the file to be opened for writing. -
append(boolean) — {@code true} if the file is to be opened for appending.
-
- Returns: a new FileOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.txt"); try (FileOutputStream fos = IOUtil.newFileOutputStream(file, true)) { // Append mode fos.write("Appended content".getBytes()); } } </pre>
-
- See also: FileOutputStream#FileOutputStream(File, boolean)
-
Signature:
public static FileOutputStream newFileOutputStream(final String name) throws UncheckedIOException - Summary: Creates a new FileOutputStream instance for the specified file name.
-
Parameters:
-
name(String) — the name of the file to be opened for writing.
-
- Returns: a new FileOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code try (FileOutputStream fos = IOUtil.newFileOutputStream("output.bin")) { fos.write(new byte\[\]{1, 2, 3}); } } </pre>
-
- See also: FileOutputStream#FileOutputStream(String)
newFileReader(...) -> FileReader
-
Signature:
public static FileReader newFileReader(final File file) throws UncheckedIOException - Summary: Creates a new FileReader instance for the specified file and the default Charset.
-
Parameters:
-
file(File) — the file to be opened for reading.
-
- Returns: a new FileReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text.txt"); try (FileReader reader = IOUtil.newFileReader(file)) { int ch = reader.read(); } } </pre>
-
- See also: FileReader#FileReader(File, Charset)
-
Signature:
public static FileReader newFileReader(final File file, final Charset charset) throws UncheckedIOException - Summary: Creates a new FileReader instance for the specified file and charset.
-
Parameters:
-
file(File) — the file to be opened for reading. -
charset(Charset) — the Charset to be used for creating the FileReader.
-
- Returns: a new FileReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("text.txt"); try (FileReader reader = IOUtil.newFileReader(file, StandardCharsets.UTF_8)) { char\[\] buffer = new char\[1024\]; int charsRead = reader.read(buffer); } } </pre>
-
- See also: FileReader#FileReader(File, Charset)
newFileWriter(...) -> FileWriter
-
Signature:
public static FileWriter newFileWriter(final File file) throws UncheckedIOException - Summary: Creates a new FileWriter instance for the specified file and the default Charset.
-
Parameters:
-
file(File) — the file to be opened for writing.
-
- Returns: a new FileWriter instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.txt"); try (FileWriter writer = IOUtil.newFileWriter(file)) { writer.write("Hello, World!"); } } </pre>
-
- See also: FileWriter#FileWriter(File, Charset)
-
Signature:
public static FileWriter newFileWriter(final File file, final Charset charset) throws UncheckedIOException - Summary: Creates a new FileWriter instance for the specified file and charset.
-
Parameters:
-
file(File) — the file to be opened for writing. -
charset(Charset) — the Charset to be used for creating the FileWriter.
-
- Returns: a new FileWriter instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.txt"); try (FileWriter writer = IOUtil.newFileWriter(file, StandardCharsets.UTF_8)) { writer.write("Hello, UTF-8!"); } } </pre>
-
- See also: FileWriter#FileWriter(File, Charset)
-
Signature:
public static FileWriter newFileWriter(final File file, final Charset charset, final boolean append) throws UncheckedIOException - Summary: Creates a new FileWriter instance for the specified file and charset.
-
Parameters:
-
file(File) — the file to be opened for writing. -
charset(Charset) — the Charset to be used for creating the FileWriter. -
append(boolean) — {@code true} if the file is to be opened for appending.
-
- Returns: a new FileWriter instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("log.txt"); try (FileWriter writer = IOUtil.newFileWriter(file, StandardCharsets.UTF_8, true)) { // Append writer.write("New log entry\\n"); } } </pre>
-
- See also: FileWriter#FileWriter(File, Charset, boolean)
newInputStreamReader(...) -> InputStreamReader
-
Signature:
public static InputStreamReader newInputStreamReader(final InputStream is) - Summary: Creates a new InputStreamReader instance for the specified InputStream and the default Charset.
-
Parameters:
-
is(InputStream) — the InputStream to be read.
-
- Returns: a new InputStreamReader instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.txt"); InputStreamReader reader = IOUtil.newInputStreamReader(is)) { int ch = reader.read(); } } </pre>
- See also: InputStreamReader#InputStreamReader(InputStream, Charset)
-
Signature:
public static InputStreamReader newInputStreamReader(final InputStream is, final Charset charset) - Summary: Creates a new InputStreamReader instance for the specified InputStream and Charset.
-
Parameters:
-
is(InputStream) — the InputStream to be read. -
charset(Charset) — the Charset to be used for creating the InputStreamReader.
-
- Returns: a new InputStreamReader instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.txt"); InputStreamReader reader = IOUtil.newInputStreamReader(is, StandardCharsets.UTF_8)) { char\[\] buffer = new char\[1024\]; reader.read(buffer); } } </pre>
- See also: InputStreamReader#InputStreamReader(InputStream, Charset)
newOutputStreamWriter(...) -> OutputStreamWriter
-
Signature:
public static OutputStreamWriter newOutputStreamWriter(final OutputStream os) - Summary: Creates a new OutputStreamWriter instance for the specified OutputStream and the default Charset.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to.
-
- Returns: a new OutputStreamWriter instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("output.txt"); OutputStreamWriter writer = IOUtil.newOutputStreamWriter(os)) { writer.write("Hello!"); } } </pre>
- See also: OutputStreamWriter#OutputStreamWriter(OutputStream, Charset)
-
Signature:
public static OutputStreamWriter newOutputStreamWriter(final OutputStream os, final Charset charset) - Summary: Creates a new OutputStreamWriter instance for the specified OutputStream and Charset.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. -
charset(Charset) — the Charset to be used for creating the OutputStreamWriter.
-
- Returns: a new OutputStreamWriter instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("output.txt"); OutputStreamWriter writer = IOUtil.newOutputStreamWriter(os, StandardCharsets.UTF_8)) { writer.write("UTF-8 content"); } } </pre>
- See also: OutputStreamWriter#OutputStreamWriter(OutputStream, Charset)
newBufferedInputStream(...) -> BufferedInputStream
-
Signature:
public static BufferedInputStream newBufferedInputStream(final InputStream is) throws UncheckedIOException - Summary: Creates a new BufferedInputStream instance that wraps the specified InputStream.
-
Parameters:
-
is(InputStream) — the InputStream to be wrapped.
-
- Returns: a new BufferedInputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.bin"); BufferedInputStream bis = IOUtil.newBufferedInputStream(is)) { int data = bis.read(); } } </pre>
-
- See also: BufferedInputStream#BufferedInputStream(InputStream)
-
Signature:
public static BufferedInputStream newBufferedInputStream(final File file) throws UncheckedIOException - Summary: Creates a new BufferedInputStream instance for the specified file.
-
Parameters:
-
file(File) — the file to be read.
-
- Returns: a new BufferedInputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileInputStream(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("data.bin"); try (BufferedInputStream bis = IOUtil.newBufferedInputStream(file)) { byte\[\] buffer = new byte\[1024\]; bis.read(buffer); } },</pre>, BufferedInputStream#BufferedInputStream(InputStream)
-
Signature:
public static BufferedInputStream newBufferedInputStream(final File file, final int size) throws UncheckedIOException - Summary: Creates a new BufferedInputStream instance for the specified file with a specified buffer size.
-
Parameters:
-
file(File) — the file to be read. -
size(int) — the size of the buffer to be used.
-
- Returns: a new BufferedInputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileInputStream(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("data.bin"); try (BufferedInputStream bis = IOUtil.newBufferedInputStream(file, 8192)) { byte\[\] buffer = new byte\[1024\]; bis.read(buffer); } },</pre>, BufferedInputStream#BufferedInputStream(InputStream, int)
newBufferedOutputStream(...) -> BufferedOutputStream
-
Signature:
public static BufferedOutputStream newBufferedOutputStream(final OutputStream os) throws UncheckedIOException - Summary: Creates a new BufferedOutputStream instance that wraps the specified OutputStream.
-
Parameters:
-
os(OutputStream) — the OutputStream to be wrapped.
-
- Returns: a new BufferedOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("output.bin"); BufferedOutputStream bos = IOUtil.newBufferedOutputStream(os)) { bos.write("Hello".getBytes()); } } </pre>
-
- See also: BufferedOutputStream#BufferedOutputStream(OutputStream)
-
Signature:
public static BufferedOutputStream newBufferedOutputStream(final File file) throws UncheckedIOException - Summary: Creates a new BufferedOutputStream instance for the specified file.
-
Parameters:
-
file(File) — the file to be written to.
-
- Returns: a new BufferedOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileOutputStream(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("output.bin"); try (BufferedOutputStream bos = IOUtil.newBufferedOutputStream(file)) { bos.write(new byte\[\]{1, 2, 3}); } },</pre>, BufferedOutputStream#BufferedOutputStream(OutputStream)
-
Signature:
public static BufferedOutputStream newBufferedOutputStream(final File file, final int size) throws UncheckedIOException - Summary: Creates a new BufferedOutputStream instance for the specified file with a specified buffer size.
-
Parameters:
-
file(File) — the file to be written to. -
size(int) — the size of the buffer to be used.
-
- Returns: a new BufferedOutputStream instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileOutputStream(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("output.bin"); try (BufferedOutputStream bos = IOUtil.newBufferedOutputStream(file, 8192)) { bos.write("Data".getBytes()); } },</pre>, BufferedOutputStream#BufferedOutputStream(OutputStream, int)
newBufferedReader(...) -> java.io.BufferedReader
-
Signature:
public static java.io.BufferedReader newBufferedReader(final Reader reader) throws UncheckedIOException - Summary: Creates a new BufferedReader instance that wraps the specified Reader.
-
Parameters:
-
reader(Reader) — the Reader to be wrapped.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code try (Reader reader = new FileReader("file.txt"); BufferedReader br = IOUtil.newBufferedReader(reader)) { String line = br.readLine(); } } </pre>
-
- See also: java.io.BufferedReader#BufferedReader(Reader)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final File file) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified file with the default charset.
-
Parameters:
-
file(File) — the file to be read from.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newFileReader(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("file.txt"); try (BufferedReader br = IOUtil.newBufferedReader(file)) { String line = br.readLine(); } },</pre>, java.io.BufferedReader#BufferedReader(Reader)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final File file, final Charset charset) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified file with a specified charset.
-
Parameters:
-
file(File) — the file to be read from. -
charset(Charset) — the charset to be used.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newInputStreamReader(InputStream, Charset),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("file.txt"); try (BufferedReader br = IOUtil.newBufferedReader(file, StandardCharsets.UTF_8)) { String line = br.readLine(); } },</pre>, java.io.BufferedReader#BufferedReader(Reader)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final Path path) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified path with the default charset.
-
Parameters:
-
path(Path) — the path of the file to be read from.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code Path path = Paths.get("file.txt"); try (BufferedReader br = IOUtil.newBufferedReader(path)) { String line = br.readLine(); } } </pre>
-
- See also: java.nio.file.Files#newBufferedReader(Path, Charset)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final Path path, final Charset charset) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified path with a specified charset.
-
Parameters:
-
path(Path) — the path of the file to be read from. -
charset(Charset) — the charset to be used.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code Path path = Paths.get("file.txt"); try (BufferedReader br = IOUtil.newBufferedReader(path)) { String line = br.readLine(); } } </pre>
-
- See also: java.nio.file.Files#newBufferedReader(Path, Charset)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final InputStream is) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified InputStream with the default charset.
-
Parameters:
-
is(InputStream) — the InputStream to be read from.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newInputStreamReader(InputStream),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code try (InputStream is = new FileInputStream("file.txt"); BufferedReader br = IOUtil.newBufferedReader(is)) { String line = br.readLine(); } },</pre>, java.io.BufferedReader#BufferedReader(Reader)
-
Signature:
public static java.io.BufferedReader newBufferedReader(final InputStream is, final Charset charset) throws UncheckedIOException - Summary: Creates a new BufferedReader instance for the specified InputStream with a specified charset.
-
Parameters:
-
is(InputStream) — the InputStream to be read from. -
charset(Charset) — the charset to be used.
-
- Returns: a new BufferedReader instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
- See also: #newInputStreamReader(InputStream, Charset),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code try (InputStream is = new FileInputStream("file.txt"); BufferedReader br = IOUtil.newBufferedReader(is, StandardCharsets.UTF_8)) { String line = br.readLine(); } },</pre>, java.io.BufferedReader#BufferedReader(Reader)
newBufferedWriter(...) -> java.io.BufferedWriter
-
Signature:
public static java.io.BufferedWriter newBufferedWriter(final Writer writer) throws UncheckedIOException - Summary: Creates a new BufferedWriter instance that wraps the specified Writer.
-
Parameters:
-
writer(Writer) — the Writer to be wrapped.
-
- Returns: a new BufferedWriter instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code try (Writer writer = new FileWriter("output.txt"); BufferedWriter bw = IOUtil.newBufferedWriter(writer)) { bw.write("Line 1"); bw.newLine(); } } </pre>
-
- See also: java.io.BufferedWriter#BufferedWriter(Writer)
-
Signature:
public static java.io.BufferedWriter newBufferedWriter(final File file) throws UncheckedIOException - Summary: Creates a new BufferedWriter instance for the specified file and default charset.
-
Parameters:
-
file(File) — the file to be written to.
-
- Returns: a new BufferedWriter instance. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.txt"); try (BufferedWriter bw = IOUtil.newBufferedWriter(file)) { bw.write("Hello"); bw.newLine(); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static java.io.BufferedWriter newBufferedWriter(final File file, final Charset charset) throws UncheckedIOException - Summary: Creates a new BufferedWriter instance for the specified file and charset.
-
Parameters:
-
file(File) — the file to be written to. -
charset(Charset) — the charset to be used for writing to the file.
-
- Returns: a new BufferedWriter instance.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("output.txt"); try (BufferedWriter bw = IOUtil.newBufferedWriter(file, StandardCharsets.UTF_8)) { bw.write("UTF-8 text"); } } </pre>
-
- See also: java.io.BufferedWriter#BufferedWriter(Writer)
-
Signature:
public static java.io.BufferedWriter newBufferedWriter(final OutputStream os) - Summary: Creates a new BufferedWriter instance for the specified OutputStream with default charset.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to.
-
- Returns: a new BufferedWriter instance.
- See also: #newOutputStreamWriter(OutputStream),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code try (OutputStream os = new FileOutputStream("output.txt"); BufferedWriter bw = IOUtil.newBufferedWriter(os)) { bw.write("Content"); } },</pre>, java.io.BufferedWriter#BufferedWriter(Writer)
-
Signature:
public static java.io.BufferedWriter newBufferedWriter(final OutputStream os, final Charset charset) - Summary: Creates a new BufferedWriter instance for the specified OutputStream and Charset.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. -
charset(Charset) — the Charset to be used for writing to the OutputStream.
-
- Returns: a new BufferedWriter instance.
- See also: #newOutputStreamWriter(OutputStream, Charset),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code try (OutputStream os = new FileOutputStream("output.txt"); BufferedWriter bw = IOUtil.newBufferedWriter(os, StandardCharsets.UTF_8)) { bw.write("UTF-8"); } },</pre>, java.io.BufferedWriter#BufferedWriter(Writer)
newLZ4BlockInputStream(...) -> LZ4BlockInputStream
-
Signature:
public static LZ4BlockInputStream newLZ4BlockInputStream(final InputStream is) - Summary: Creates a new LZ4BlockInputStream instance for the specified InputStream.
-
Parameters:
-
is(InputStream) — the InputStream to be read from. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.lz4"); LZ4BlockInputStream lz4Is = IOUtil.newLZ4BlockInputStream(is)) { byte\[\] data = IOUtil.readAllBytes(lz4Is); } } </pre>
-
- Returns: a new LZ4BlockInputStream instance.
newLZ4BlockOutputStream(...) -> LZ4BlockOutputStream
-
Signature:
public static LZ4BlockOutputStream newLZ4BlockOutputStream(final OutputStream os) - Summary: Creates a new LZ4BlockOutputStream instance for the specified OutputStream.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.lz4"); LZ4BlockOutputStream lz4Os = IOUtil.newLZ4BlockOutputStream(os)) { lz4Os.write("Compressed data".getBytes()); } } </pre>
-
- Returns: a new LZ4BlockOutputStream instance.
-
Signature:
public static LZ4BlockOutputStream newLZ4BlockOutputStream(final OutputStream os, final int blockSize) - Summary: Creates a new LZ4BlockOutputStream instance for the specified OutputStream with the given block size.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. -
blockSize(int) — the block size for the LZ4BlockOutputStream. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.lz4"); LZ4BlockOutputStream lz4Os = IOUtil.newLZ4BlockOutputStream(os, 8192)) { lz4Os.write("Compressed with custom block size".getBytes()); } } </pre>
-
- Returns: a new LZ4BlockOutputStream instance.
newSnappyInputStream(...) -> SnappyInputStream
-
Signature:
public static SnappyInputStream newSnappyInputStream(final InputStream is) throws UncheckedIOException - Summary: Creates a new SnappyInputStream instance for the specified InputStream.
-
Parameters:
-
is(InputStream) — the InputStream to be read from.
-
- Returns: a new SnappyInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.snappy"); SnappyInputStream snappyIs = IOUtil.newSnappyInputStream(is)) { byte\[\] data = IOUtil.readAllBytes(snappyIs); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
newSnappyOutputStream(...) -> SnappyOutputStream
-
Signature:
public static SnappyOutputStream newSnappyOutputStream(final OutputStream os) - Summary: Creates a new SnappyOutputStream instance for the specified OutputStream.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.snappy"); SnappyOutputStream snappyOs = IOUtil.newSnappyOutputStream(os)) { snappyOs.write("Snappy compressed".getBytes()); } } </pre>
-
- Returns: a new SnappyOutputStream instance.
-
Signature:
public static SnappyOutputStream newSnappyOutputStream(final OutputStream os, final int bufferSize) - Summary: Creates a new SnappyOutputStream instance with the specified OutputStream and buffer size.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. -
bufferSize(int) — the size of the buffer to be used. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.snappy"); SnappyOutputStream snappyOs = IOUtil.newSnappyOutputStream(os, 8192)) { snappyOs.write("Snappy with buffer".getBytes()); } } </pre>
-
- Returns: a new SnappyOutputStream instance.
newGZIPInputStream(...) -> GZIPInputStream
-
Signature:
public static GZIPInputStream newGZIPInputStream(final InputStream is) throws UncheckedIOException - Summary: Creates a new GZIPInputStream instance for the specified InputStream.
-
Parameters:
-
is(InputStream) — the InputStream to be read from.
-
- Returns: a new GZIPInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.gz"); GZIPInputStream gzipIs = IOUtil.newGZIPInputStream(is)) { byte\[\] data = IOUtil.readAllBytes(gzipIs); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static GZIPInputStream newGZIPInputStream(final InputStream is, final int bufferSize) throws UncheckedIOException - Summary: Creates a new GZIPInputStream instance with the specified InputStream and buffer size.
-
Parameters:
-
is(InputStream) — the InputStream to be read from. -
bufferSize(int) — the size of the buffer to be used.
-
- Returns: a new GZIPInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.gz"); GZIPInputStream gzipIs = IOUtil.newGZIPInputStream(is, 8192)) { byte\[\] data = IOUtil.readAllBytes(gzipIs); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
newGZIPOutputStream(...) -> GZIPOutputStream
-
Signature:
public static GZIPOutputStream newGZIPOutputStream(final OutputStream os) throws UncheckedIOException - Summary: Creates a new GZIPOutputStream instance for the specified OutputStream.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to.
-
- Returns: a new GZIPOutputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.gz"); GZIPOutputStream gzipOs = IOUtil.newGZIPOutputStream(os)) { gzipOs.write("GZIP compressed data".getBytes()); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static GZIPOutputStream newGZIPOutputStream(final OutputStream os, final int bufferSize) throws UncheckedIOException - Summary: Creates a new GZIPOutputStream with the specified OutputStream and buffer size.
-
Parameters:
-
os(OutputStream) — the OutputStream to be written to. -
bufferSize(int) — the size of the buffer to be used.
-
- Returns: a new GZIPOutputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("data.gz"); GZIPOutputStream gzipOs = IOUtil.newGZIPOutputStream(os, 8192)) { gzipOs.write("GZIP with buffer".getBytes()); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
newZipInputStream(...) -> ZipInputStream
-
Signature:
public static ZipInputStream newZipInputStream(final InputStream is) - Summary: Creates a new ZipInputStream with the specified InputStream.
-
Parameters:
-
is(InputStream) — the InputStream to be used for creating the ZipInputStream.
-
- Returns: a new ZipInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("archive.zip"); ZipInputStream zipIs = IOUtil.newZipInputStream(is)) { ZipEntry entry = zipIs.getNextEntry(); byte\[\] data = IOUtil.readAllBytes(zipIs); } } </pre>
- See also: ZipInputStream#ZipInputStream(InputStream)
-
Signature:
public static ZipInputStream newZipInputStream(final InputStream is, final Charset charset) - Summary: Creates a new ZipInputStream with the specified InputStream and Charset.
-
Parameters:
-
is(InputStream) — the InputStream to be used for creating the ZipInputStream. -
charset(Charset) — the Charset to be used for creating the ZipInputStream.
-
- Returns: a new ZipInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("archive.zip"); ZipInputStream zipIs = IOUtil.newZipInputStream(is, StandardCharsets.UTF_8)) { ZipEntry entry = zipIs.getNextEntry(); } } </pre>
- See also: ZipInputStream#ZipInputStream(InputStream, Charset)
newZipOutputStream(...) -> ZipOutputStream
-
Signature:
public static ZipOutputStream newZipOutputStream(final OutputStream os) - Summary: Creates a new ZipOutputStream with the specified OutputStream.
-
Parameters:
-
os(OutputStream) — the OutputStream to be used for creating the ZipOutputStream.
-
- Returns: a new ZipOutputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("archive.zip"); ZipOutputStream zipOs = IOUtil.newZipOutputStream(os)) { zipOs.putNextEntry(new ZipEntry("file.txt")); zipOs.write("Content".getBytes()); } } </pre>
- See also: ZipOutputStream#ZipOutputStream(OutputStream)
-
Signature:
public static ZipOutputStream newZipOutputStream(final OutputStream os, final Charset charset) - Summary: Creates a new ZipOutputStream with the specified OutputStream and Charset.
-
Parameters:
-
os(OutputStream) — the OutputStream to be used for creating the ZipOutputStream. -
charset(Charset) — the Charset to be used for creating the ZipOutputStream.
-
- Returns: a new ZipOutputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (OutputStream os = new FileOutputStream("archive.zip"); ZipOutputStream zipOs = IOUtil.newZipOutputStream(os, StandardCharsets.UTF_8)) { zipOs.putNextEntry(new ZipEntry("file.txt")); zipOs.write("UTF-8 content".getBytes()); } } </pre>
- See also: ZipOutputStream#ZipOutputStream(OutputStream, Charset)
newBrotliInputStream(...) -> BrotliInputStream
-
Signature:
public static BrotliInputStream newBrotliInputStream(final InputStream is) throws UncheckedIOException - Summary: Creates a new BrotliInputStream instance for the specified input stream.
-
Parameters:
-
is(InputStream) — the input stream to be used for creating the BrotliInputStream.
-
- Returns: a new BrotliInputStream instance. <p> <b> Usage Examples: </b> </p> <pre> {@code try (InputStream is = new FileInputStream("data.br"); BrotliInputStream brotliIs = IOUtil.newBrotliInputStream(is)) { byte\[\] data = IOUtil.readAllBytes(brotliIs); } } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
close(...) -> void
-
Signature:
public static void close(final URLConnection conn) - Summary: Closes the provided {@code URLConnection} if it's a {@code HttpURLConnection} by disconnection.
-
Contract:
- Closes the provided {@code URLConnection} if it's a {@code HttpURLConnection} by disconnection.
-
Parameters:
-
conn(URLConnection) — the connection to close.
-
-
Signature:
public static void close(final AutoCloseable closeable) - Summary: Closes the provided AutoCloseable object.
-
Contract:
- if the object is {@code null} , this method does nothing.
-
Parameters:
-
closeable(AutoCloseable) — the AutoCloseable object to be closed. It can be {@code null} .
-
-
Signature:
public static void close(final AutoCloseable closeable, final Consumer<Exception> exceptionHandler) - Summary: Closes the provided AutoCloseable object and handles any exceptions that occur during the closing operation.
-
Parameters:
-
closeable(AutoCloseable) — the AutoCloseable object to be closed, may be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code InputStream is = new FileInputStream("file.txt"); try { // Use the stream } finally { IOUtil.close(is); // Safely closes and handles exceptions } } </pre> -
exceptionHandler(Consumer<Exception>) — the Consumer to handle any exceptions thrown during the close operation, must not be {@code null} .
-
closeAll(...) -> void
-
Signature:
public static void closeAll(final AutoCloseable... closeables) - Summary: Closes all provided AutoCloseable objects.
-
Contract:
- If an AutoCloseable object is {@code null} , it will be ignored.
-
Parameters:
-
closeables(AutoCloseable[]) — the AutoCloseable objects to be closed. It may contain {@code null} elements.
-
-
Signature:
public static void closeAll(final Iterable<? extends AutoCloseable> closeables) - Summary: Closes all provided AutoCloseable objects in the Iterable.
-
Contract:
- If an AutoCloseable object is {@code null} , it will be ignored.
-
Parameters:
-
closeables(Iterable<? extends AutoCloseable>) — the Iterable of AutoCloseable objects to be closed. It may contain {@code null} elements.
-
closeQuietly(...) -> void
-
Signature:
public static void closeQuietly(final AutoCloseable closeable) - Summary: Closes the provided AutoCloseable object quietly.
-
Parameters:
-
closeable(AutoCloseable) — the AutoCloseable object to be closed. It can be {@code null} .
-
closeAllQuietly(...) -> void
-
Signature:
public static void closeAllQuietly(final AutoCloseable... closeables) - Summary: Closes all provided AutoCloseable objects quietly.
-
Parameters:
-
closeables(AutoCloseable[]) — the AutoCloseable objects to be closed. It may contain {@code null} elements.
-
-
Signature:
public static void closeAllQuietly(final Iterable<? extends AutoCloseable> closeables) - Summary: Closes all provided AutoCloseable objects quietly.
-
Parameters:
-
closeables(Iterable<? extends AutoCloseable>) — the Iterable of AutoCloseable objects to be closed. It may contain {@code null} elements.
-
copyToDirectory(...) -> void
-
Signature:
public static void copyToDirectory(final File srcFile, final File destDir) throws IOException - Summary: Copies the specified source file or directory to the specified destination directory.
-
Parameters:
-
srcFile(File) — the source file or directory to be copied. It must not be {@code null} . -
destDir(File) — the destination directory where the source file or directory will be copied to. It must not be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("document.pdf"); File targetDir = new File("backups"); IOUtil.copyToDirectory(sourceFile, targetDir); // Creates backups/document.pdf } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static void copyToDirectory(final File srcFile, final File destDir, final boolean preserveFileDate) throws IOException - Summary: Copies the specified source file or directory to the specified destination directory.
-
Contract:
- if the source is a directory, all its contents will be copied into the destination directory.
-
Parameters:
-
srcFile(File) — the source file or directory to be copied. It must not be {@code null} . -
destDir(File) — the destination directory where the source file or directory will be copied to. It must not be {@code null} . -
preserveFileDate(boolean) — if {@code true} , the last modified date of the file will be preserved in the copied file. <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("document.pdf"); File targetDir = new File("backups"); IOUtil.copyToDirectory(sourceFile, targetDir); // Creates backups/document.pdf } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static <E extends Exception> void copyToDirectory(File srcFile, File destDir, final boolean preserveFileDate, final Throwables.BiPredicate<? super File, ? super File, E> filter) throws IOException, E - Summary: Copies the specified source file or directory to the specified destination directory.
-
Contract:
- if the source is a directory, all its contents will be copied into the destination directory.
-
Parameters:
-
srcFile(File) — the source file or directory to be copied. It must not be {@code null} . -
destDir(File) — the destination directory where the source file or directory will be copied to. It must not be {@code null} . -
preserveFileDate(boolean) — if {@code true} , the last modified date of the file will be preserved in the copied file. -
filter(Throwables.BiPredicate<? super File, ? super File, E>) — a BiPredicate that takes the source and destination files as arguments and returns a boolean. if the predicate returns {@code true} , the file is copied; if it returns {@code false} , the file is not copied.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs. -
E— if the filter throws an exception.
-
copyDirectory(...) -> void
-
Signature:
public static void copyDirectory(final File srcDir, final File destDir) throws IOException - Summary: Copies the contents of a directory to another directory.
-
Contract:
- if the destination directory does not exist, it is created.
-
Parameters:
-
srcDir(File) — the source directory to copy from, must not be {@code null} . -
destDir(File) — the destination directory to copy to, must not be {@code null} . <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceDir = new File("source_directory"); File destDir = new File("destination_directory"); IOUtil.copyDirectory(sourceDir, destDir); } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs or if the source directory does not exist.
-
copyFile(...) -> void
-
Signature:
public static void copyFile(final File srcFile, final File destFile) throws IOException - Summary: Copies a file to a new location preserving the file date.
-
Contract:
- The directory holding the destination file is created if it does not exist.
- if the destination file exists, then this method overwrites it.
- if the modification operation fails, it falls back to {@link File#setLastModified(long)} , and if that fails, the method throws IOException.
-
Parameters:
-
srcFile(File) — an existing file to copy, must not be {@code null} . -
destFile(File) — the new file, must not be {@code null} }.
-
-
Throws:
-
java.io.IOException— if the output file length is not the same as the input file length after the copy completes.
-
- See also: #copyToDirectory(File, File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File source = new File("original.txt"); File dest = new File("copy.txt"); IOUtil.copyFile(source, dest); },</pre>, #copyFile(File, File, boolean)
-
Signature:
public static void copyFile(final File srcFile, final File destFile, final boolean preserveFileDate) throws IOException - Summary: Copies an existing file to a new file location.
-
Contract:
- The directory holding the destination file is created if it does not exist.
- if the destination file exists, then this method overwrites it.
- if the modification operation fails, it falls back to {@link File#setLastModified(long)} , and if that fails, the method throws IOException.
-
Parameters:
-
srcFile(File) — an existing file to copy, must not be {@code null} . -
destFile(File) — the new file, must not be {@code null} . -
preserveFileDate(boolean) — {@code true} if the file date of the copy should be the same as the original.
-
-
Throws:
-
java.io.IOException— if the output file length is not the same as the input file length after the copy completes. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("original.txt"); File dest = new File("copy.txt"); IOUtil.copyFile(source, dest); } </pre>
-
- See also: #copyFile(File, File, boolean, CopyOption...)
-
Signature:
public static void copyFile(final File srcFile, final File destFile, final CopyOption... copyOptions) throws IOException - Summary: Copies a file to a new location.
-
Contract:
- The directory holding the destination file is created if it does not exist.
- if the destination file exists, you can overwrite it if you use {@link StandardCopyOption#REPLACE_EXISTING} .
-
Parameters:
-
srcFile(File) — an existing file to copy, must not be {@code null} . -
destFile(File) — the new file, must not be {@code null} . -
copyOptions(CopyOption[]) — options specifying how the copy should be done, for example {@link StandardCopyOption} .
-
-
Throws:
-
java.io.IOException— if an I/O error occurs. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("original.txt"); File dest = new File("copy.txt"); IOUtil.copyFile(source, dest); } </pre>
-
- See also: StandardCopyOption
-
Signature:
public static void copyFile(final File srcFile, final File destFile, final boolean preserveFileDate, final CopyOption... copyOptions) throws IOException - Summary: Copies the contents of a file to a new location.
-
Contract:
- The directory holding the destination file is created if it does not exist.
- if the destination file exists, you can overwrite it with {@link StandardCopyOption#REPLACE_EXISTING} .
- if the modification operation fails, it falls back to {@link File#setLastModified(long)} , and if that fails, the method throws IOException.
-
Parameters:
-
srcFile(File) — an existing file to copy, must not be {@code null} . -
destFile(File) — the new file, must not be {@code null} . -
preserveFileDate(boolean) — {@code true} if the file date of the copy should be the same as the original. -
copyOptions(CopyOption[]) — options specifying how the copy should be done, for example {@link StandardCopyOption} .
-
-
Throws:
-
java.io.IOException— if the output file length is not the same as the input file length after the copy completes, or if an I/O error occurs, setting the last-modified time didn't succeed or the destination is not writable . <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("original.txt"); File dest = new File("copy.txt"); IOUtil.copyFile(source, dest); } </pre>
-
- See also: #copyToDirectory(File, File, boolean)
-
Signature:
public static long copyFile(final File input, final OutputStream output) throws IOException - Summary: Copies bytes from a {@link File} to an {@link OutputStream} .
-
Parameters:
-
input(File) — the {@link File} to read. -
output(OutputStream) — the {@link OutputStream} to write.
-
- Returns: the number of bytes copied. <p> <b> Usage Examples: </b> </p> <pre> {@code File source = new File("original.txt"); File dest = new File("copy.txt"); IOUtil.copyFile(source, dest); } </pre>
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
copyURLToFile(...) -> void
-
Signature:
public static void copyURLToFile(final URL source, final File destination) throws IOException - Summary: Copies bytes from the URL {@code source} to a file {@code destination} .
-
Contract:
- The directories up to {@code destination} will be created if they don't already exist.
- {@code destination} will be overwritten if it already exists.
-
Parameters:
-
source(URL) — the {@code URL} to copy bytes from, must not be {@code null} . -
destination(File) — the non-directory {@code File} to write bytes to. (possibly overwriting), must not be {@code null} <p> <b> Usage Examples: </b> </p> <pre> {@code URL url = new URL("https://example.com/data.txt"); File dest = new File("downloaded.txt"); IOUtil.copyURLToFile(url, dest); } </pre>
-
-
Throws:
-
java.io.IOException— if an IO error occurs during copying.
-
-
Signature:
public static void copyURLToFile(final URL source, final File destination, final int connectTimeout, final int readTimeout) throws IOException - Summary: Copies bytes from the URL {@code source} to a file {@code destination} .
-
Contract:
- The directories up to {@code destination} will be created if they don't already exist.
- {@code destination} will be overwritten if it already exists.
-
Parameters:
-
source(URL) — the {@code URL} to copy bytes from, must not be {@code null} . -
destination(File) — the non-directory {@code File} to write bytes to. (possibly overwriting), must not be {@code null} -
connectTimeout(int) — the number of milliseconds until this method. will timeout if no connection could be established to the {@code source} -
readTimeout(int) — the number of milliseconds until this method will. timeout if no data could be read from the {@code source} <p> <b> Usage Examples: </b> </p> <pre> {@code URL url = new URL("https://example.com/data.txt"); File dest = new File("downloaded.txt"); IOUtil.copyURLToFile(url, dest); } </pre>
-
-
Throws:
-
java.io.IOException— if an IO error occurs during copying.
-
copy(...) -> Path
-
Signature:
public static Path copy(final Path source, final Path target, final CopyOption... options) throws IOException - Summary: Copies a file or directory from the source path to the target path.
-
Parameters:
-
source(Path) — the source path of the file or directory to be copied. -
target(Path) — the target path where the file or directory will be copied to. -
options(CopyOption[]) — optional arguments that specify how the copy should be done.
-
- Returns: the path to the target file or directory.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: Files#copy(Path, Path, CopyOption...)
-
Signature:
public static long copy(final InputStream in, final Path target, final CopyOption... options) throws IOException - Summary: Copies the content of the given InputStream to the specified target Path.
-
Parameters:
-
in(InputStream) — the InputStream to be copied. -
target(Path) — the target Path where the InputStream content will be copied to. -
options(CopyOption[]) — optional arguments that specify how the copy should be done.
-
- Returns: the number of bytes read or skipped and written to the target Path.
-
Throws:
-
java.io.IOException— if an I/O error occurs during the copy operation.
-
- See also: Files#copy(InputStream, Path, CopyOption...)
-
Signature:
public static long copy(final Path source, final OutputStream output) throws IOException - Summary: Copies the content of the file at the given source Path to the specified OutputStream.
-
Parameters:
-
source(Path) — the source Path of the file to be copied. -
output(OutputStream) — the OutputStream where the file content will be copied to.
-
- Returns: the number of bytes read or skipped and written to the OutputStream.
-
Throws:
-
java.io.IOException— if an I/O error occurs during the copy operation.
-
- See also: Files#copy(Path, OutputStream)
move(...) -> void
-
Signature:
public static void move(final File srcFile, final File destDir) throws IOException - Summary: <p> Moves a file from the source location to the destination directory, creating the destination directory if it doesn't exist.
-
Contract:
- <p> Moves a file from the source location to the destination directory, creating the destination directory if it doesn't exist.
- if the source is a directory, the entire directory and its contents will be moved.
-
Parameters:
-
srcFile(File) — the source file or directory to be moved. -
destDir(File) — the destination directory where the file or directory will be moved to.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the move operation, such as if the source doesn't exist. or the destination cannot be written to
-
- See also: #move(File, File, CopyOption...), java.nio.file.Files#move(Path, Path, CopyOption...)
-
Signature:
public static void move(final File srcFile, final File destDir, final CopyOption... options) throws IOException - Summary: Moves a file from the source file to the target directory.
-
Contract:
- if the destination directory does not exist, it will be created.
-
Parameters:
-
srcFile(File) — the source file to be moved. -
destDir(File) — the target directory where the file will be moved to. -
options(CopyOption[]) — optional arguments that specify how the move should be done.
-
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static Path move(final Path source, final Path target, final CopyOption... options) throws IOException - Summary: Moves a file from the source path to the target path.
-
Parameters:
-
source(Path) — the source Path of the file to be moved. -
target(Path) — the target Path where the file will be moved to. -
options(CopyOption[]) — optional arguments that specify how the move should be done.
-
- Returns: the target path.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
- See also: Files#move(Path, Path, CopyOption...)
renameTo(...) -> boolean
-
Signature:
public static boolean renameTo(final File srcFile, final String newFileName) - Summary: Renames the specified source file to the new file name provided.
-
Parameters:
-
srcFile(File) — the source file to be renamed. -
newFileName(String) — the new name for the file. <p> <b> Usage Examples: </b> </p> <pre> {@code File oldFile = new File("old_name.txt"); boolean success = IOUtil.renameTo(oldFile, "new_name.txt"); } </pre>
-
- Returns: {@code true} if the renaming succeeded, {@code false} otherwise.
deleteQuietly(...) -> boolean
-
Signature:
public static boolean deleteQuietly(final File file) - Summary: Deletes the specified file or directory quietly, suppressing any exceptions that may occur.
-
Contract:
- If any exception occurs during the deletion process, it is caught and logged, and the method returns {@code false} .
- It only deletes the file itself, not its contents if it's a directory with files.
-
Parameters:
-
file(File) — the file or directory to delete. Can be {@code null} .
-
- Returns: {@code true} if the file was deleted successfully; {@code false} if the file. is {@code null} , does not exist, could not be deleted, or if an exception occurred.
- See also: File#delete(), Files#deleteIfExists(Path), #deleteIfExists(File), #deleteRecursivelyIfExists(File)
deleteIfExists(...) -> boolean
-
Signature:
public static boolean deleteIfExists(final File file) - Summary: Deletes the specified file if it exists by calling {@link File#delete()} .
-
Contract:
- Deletes the specified file if it exists by calling {@link File#delete()} .
- if the file is {@code null} or does not exist, the method returns {@code false} without attempting deletion.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("./temp-file.txt"); boolean deleted = IOUtil.deleteIfExists(file); if (deleted) { System.out.println("File deleted successfully."); } else { System.out.println("File does not exist or could not be deleted."); } } </pre>
-
Parameters:
-
file(File) — the file or directory to delete. Can be {@code null} .
-
- Returns: {@code true} if the file was deleted successfully; {@code false} if the file. is {@code null} , does not exist, or could not be deleted.
- See also: File#delete(), Files#delete(Path), Files#deleteIfExists(Path), #deleteRecursivelyIfExists(File), #deleteQuietly(File)
deleteRecursivelyIfExists(...) -> boolean
-
Signature:
public static boolean deleteRecursivelyIfExists(final File file) - Summary: Deletes the specified file and all its subfiles/directories recursively if it's a directory.
-
Contract:
- Deletes the specified file and all its subfiles/directories recursively if it's a directory.
- if the specified file is a directory, it will delete all files and subdirectories within it before deleting the directory itself.
- if the file is a regular file, it will simply delete the file.
- if the file does not exist or is {@code null} , the method returns {@code false} without performing any operations.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("./temp-folder"); boolean deleted = IOUtil.deleteRecursivelyIfExists(directory); if (deleted) { System.out.println("File/directory and all contents deleted successfully."); } else { System.out.println("File/directory does not exist or could not be deleted."); } } </pre>
-
Parameters:
-
file(File) — the file or directory to delete recursively.
-
- Returns: {@code true} if the file/directory and all its contents were deleted successfully;. {@code false} if the file is {@code null} , does not exist, or could not be deleted.
- See also: File#delete(), Files#delete(Path), Files#deleteIfExists(Path), #deleteIfExists(File), #deleteFilesFromDirectory(File)
deleteFilesFromDirectory(...) -> boolean
-
Signature:
public static boolean deleteFilesFromDirectory(final File dir) - Summary: Deletes all subfiles and subdirectories from the specified directory.
-
Contract:
- if the directory does not exist or is actually a file, the method returns {@code false} without performing any operations.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("./temp-folder"); boolean deleted = IOUtil.deleteFilesFromDirectory(directory); if (deleted) { System.out.println("All files and subdirectories deleted successfully."); } else { System.out.println("Failed to delete some files or subdirectories."); } } </pre>
-
Parameters:
-
dir(File) — the directory from which to delete all files and subdirectories.
-
- Returns: {@code true} if all files and directories were deleted successfully;. {@code false} if the directory does not exist or is actually a file, or some files could not be deleted or if the operation failed.
- See also: File#delete(), Files#delete(Path), Files#deleteIfExists(Path), #deleteFilesFromDirectory(File, Throwables.BiPredicate), #deleteRecursivelyIfExists(File)
-
Signature:
public static <E extends Exception> boolean deleteFilesFromDirectory(final File dir, final Throwables.BiPredicate<? super File, ? super File, E> filter) throws E - Summary: Deletes subfiles/directories from the specified directory based on the provided filter.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("./temp-folder"); // Delete only .txt files boolean deleted = IOUtil.deleteFilesFromDirectory(directory, (parentDir, file) -> file.getName().endsWith(".txt")); if (deleted) { System.out.println("Matching files deleted successfully."); } else { System.out.println("Failed to delete some files."); } } </pre>
-
Parameters:
-
dir(File) — the directory from which to delete files and subdirectories. -
filter(Throwables.BiPredicate<? super File, ? super File, E>) — the predicate to determine which files/directories should be deleted. Receives the parent directory and the file/directory being evaluated.
-
- Returns: {@code true} if all matching files and directories were deleted successfully;. {@code false} if the directory does not exist or is actually a file, or some files could not be deleted or if the operation failed.
-
Throws:
-
E— if the filter throws an exception during evaluation.
-
- See also: File#delete(), Files#delete(Path), Files#deleteIfExists(Path), #deleteFilesFromDirectory(File), #deleteRecursivelyIfExists(File)
cleanDirectory(...) -> boolean
-
Signature:
public static boolean cleanDirectory(final File dir) - Summary: Cleans a directory by deleting all subfiles and subdirectories within it.
-
Contract:
- if the directory does not exist or is actually a file, the method returns {@code false} without performing any operations.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("./temp-folder"); boolean cleaned = IOUtil.cleanDirectory(directory); if (cleaned) { System.out.println("Directory cleaned successfully."); } else { System.out.println("Failed to clean some files in the directory."); } } </pre>
-
Parameters:
-
dir(File) — the directory to clean.
-
- Returns: {@code true} if all subfiles and subdirectories were deleted successfully; . {@code false} if the directory does not exist or is actually a file, or some files could not be deleted or if the operation failed.
- See also: #deleteFilesFromDirectory(File), #deleteRecursivelyIfExists(File), File#delete()
createFileIfNotExists(...) -> boolean
-
Signature:
public static boolean createFileIfNotExists(final File file) throws UncheckedIOException - Summary: Creates a new empty file if one doesn't already exist at the specified path.
-
Contract:
- Creates a new empty file if one doesn't already exist at the specified path.
- <p> This method attempts to create a new file at the path specified by the input File object, but only if a file or directory doesn't already exist at that location.
- if the parent directory doesn't exist, the method will attempt to create it before creating the file.
- <p> Example usage: <p> <b> Usage Examples: </b> </p> <pre> {@code File configFile = new File("/path/to/config.json"); boolean created = IOUtil.createFileIfNotExists(configFile); if (created) { System.out.println("Created new config file"); } else { System.out.println("Config file already exists"); } } </pre>
-
Parameters:
-
file(File) — the File object representing the file to create.
-
- Returns: {@code true} if a new file was created successfully; {@code false} if the file already exists.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during file creation.
-
- See also: File#createNewFile(), #mkdirIfNotExists(File), #mkdirsIfNotExists(File)
mkdirIfNotExists(...) -> boolean
-
Signature:
public static boolean mkdirIfNotExists(final File dir) - Summary: Creates a directory if it does not already exist.
-
Contract:
- Creates a directory if it does not already exist.
- If a directory with this name already exists, the method returns {@code false} .
- if the directory does not exist, it is created.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File newDir = new File("./new-directory"); boolean result = IOUtil.mkdirIfNotExists(newDir); if (result) { System.out.println("Directory exists or was created successfully."); } else { System.out.println("Failed to create directory or a file with the same name exists."); } } </pre>
-
Parameters:
-
dir(File) — the directory to create.
-
- Returns: {@code true} if the directory was created successfully; {@code false} if the directory already exists or creation failed.
- See also: File#mkdir(), #mkdirsIfNotExists(File), #createFileIfNotExists(File)
mkdirsIfNotExists(...) -> boolean
-
Signature:
@SuppressWarnings("UnusedReturnValue") public static boolean mkdirsIfNotExists(final File dir) - Summary: Creates new directories if they do not exist.
-
Contract:
- Creates new directories if they do not exist.
- If a directory with this name already exists, the method returns {@code false} .
- if the directory does not exist, it and all necessary parent directories are created.
- <p> <b> Usage Examples: </b> </p> <pre> {@code File deepDir = new File("./parent/child/grandchild"); boolean created = IOUtil.mkdirsIfNotExists(deepDir); if (created) { System.out.println("Directory hierarchy was created successfully."); } else { System.out.println("Directory already exists or creation failed."); } } </pre>
-
Parameters:
-
dir(File) — the directory to create, including any necessary parent directories.
-
- Returns: {@code true} if the directories were created successfully; {@code false} if the directory already exists or creation failed.
- See also: File#mkdirs(), #mkdirIfNotExists(File), #createFileIfNotExists(File)
isBufferedReader(...) -> boolean
-
Signature:
public static boolean isBufferedReader(final Reader reader) - Summary: Checks if the provided Reader is an instance of {@code java.io.BufferedReader} .
-
Contract:
- Checks if the provided Reader is an instance of {@code java.io.BufferedReader} .
-
Parameters:
-
reader(Reader) — the Reader to be checked.
-
- Returns: {@code true} if the Reader is an instance of BufferedReader, {@code false} otherwise.
isBufferedWriter(...) -> boolean
-
Signature:
public static boolean isBufferedWriter(final Writer writer) - Summary: Checks if the provided Writer is an instance of {@code java.io.BufferedWriter} .
-
Contract:
- Checks if the provided Writer is an instance of {@code java.io.BufferedWriter} .
-
Parameters:
-
writer(Writer) — the Writer to be checked.
-
- Returns: {@code true} if the Writer is an instance of BufferedWriter, {@code false} otherwise.
isFileNewer(...) -> boolean
-
Signature:
public static boolean isFileNewer(final File file, final Date date) throws IllegalArgumentException - Summary: Checks if the specified {@code File} is newer than the specified {@code Date} .
-
Contract:
- Checks if the specified {@code File} is newer than the specified {@code Date} .
-
Parameters:
-
file(File) — the {@code File} of which the modification date must be compared. -
date(Date) — the date reference.
-
- Returns: {@code true} if the {@code File} exists and has been modified after the given {@code Date} . <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("document.txt"); Date referenceDate = new Date(System.currentTimeMillis() - 86400000); // 1 day ago boolean isNewer = IOUtil.isFileNewer(file, referenceDate); } </pre>
-
Throws:
-
java.lang.IllegalArgumentException— if the file or date is {@code null} .
-
-
Signature:
public static boolean isFileNewer(final File file, final File reference) throws IllegalArgumentException - Summary: Checks if the specified {@code File} is newer than the reference {@code File} .
-
Contract:
- Checks if the specified {@code File} is newer than the reference {@code File} .
-
Parameters:
-
file(File) — the {@code File} of which the modification date must be compared. -
reference(File) — the {@code File} of which the modification date is used.
-
- Returns: {@code true} if the {@code File} exists and has been modified more recently than the reference {@code File} . <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("document.txt"); Date referenceDate = new Date(System.currentTimeMillis() - 86400000); // 1 day ago boolean isNewer = IOUtil.isFileNewer(file, referenceDate); } </pre>
-
Throws:
-
java.lang.IllegalArgumentException— if the file or reference file is {@code null} or the reference file doesn't exist.
-
isFileOlder(...) -> boolean
-
Signature:
public static boolean isFileOlder(final File file, final Date date) throws IllegalArgumentException - Summary: Checks if the specified {@code File} is older than the specified {@code Date} .
-
Contract:
- Checks if the specified {@code File} is older than the specified {@code Date} .
-
Parameters:
-
file(File) — the {@code File} of which the modification date must be compared. -
date(Date) — the date reference.
-
- Returns: {@code true} if the {@code File} exists and has been modified before the given {@code Date} . <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("document.txt"); Date referenceDate = new Date(); boolean isOlder = IOUtil.isFileOlder(file, referenceDate); } </pre>
-
Throws:
-
java.lang.IllegalArgumentException— if the file or date is {@code null} .
-
-
Signature:
public static boolean isFileOlder(final File file, final File reference) throws IllegalArgumentException - Summary: Checks if the specified {@code File} is older than the reference {@code File} .
-
Contract:
- Checks if the specified {@code File} is older than the reference {@code File} .
-
Parameters:
-
file(File) — the {@code File} of which the modification date must be compared. -
reference(File) — the {@code File} of which the modification date is used.
-
- Returns: {@code true} if the {@code File} exists and has been modified before the reference {@code File} . <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("document.txt"); Date referenceDate = new Date(); boolean isOlder = IOUtil.isFileOlder(file, referenceDate); } </pre>
-
Throws:
-
java.lang.IllegalArgumentException— if the file or reference file is {@code null} or the reference file doesn't exist.
-
isFile(...) -> boolean
-
Signature:
public static boolean isFile(final File file) - Summary: Checks if the specified {@code File} is a file or not.
-
Contract:
- Checks if the specified {@code File} is a file or not.
-
Parameters:
-
file(File) — the {@code File} to check.
-
- Returns: {@code true} if the {@code File} exists and is a file, {@code false} otherwise.
- See also: File#isFile()
isDirectory(...) -> boolean
-
Signature:
public static boolean isDirectory(final File file) - Summary: Checks if the specified {@code File} is a directory or not.
-
Contract:
- Checks if the specified {@code File} is a directory or not.
-
Parameters:
-
file(File) — the {@code File} to check.
-
- Returns: {@code true} if the {@code File} exists and is a directory, {@code false} otherwise. <p> <b> Usage Examples: </b> </p> <pre> {@code File path = new File("some_path"); boolean isDir = IOUtil.isDirectory(path); } </pre>
- See also: File#isDirectory()
-
Signature:
public static boolean isDirectory(final File file, final LinkOption... options) - Summary: Tests whether the specified {@link File} is a directory or not.
-
Parameters:
-
file(File) — the path to the file. -
options(LinkOption[]) — options indicating how symbolic links are handled.
-
- Returns: {@code true} if the file is a directory; {@code false} if. the path is {@code null} , the file does not exist, is not a directory, or it cannot be determined if the file is a directory or not.
- See also: Files#isDirectory(Path, LinkOption...)
isRegularFile(...) -> boolean
-
Signature:
public static boolean isRegularFile(final File file, final LinkOption... options) - Summary: Tests whether the specified {@link File} is a regular file or not.
-
Parameters:
-
file(File) — the path to the file. -
options(LinkOption[]) — options indicating how symbolic links are handled.
-
- Returns: {@code true} if the file is a regular file; {@code false} if. the path is {@code null} , the file does not exist, is not a regular file, or it cannot be determined if the file is a regular file or not.
- See also: Files#isRegularFile(Path, LinkOption...)
isSymbolicLink(...) -> boolean
-
Signature:
public static boolean isSymbolicLink(final File file) - Summary: Checks if the specified file is a Symbolic Link rather than an actual file.
-
Contract:
- Checks if the specified file is a Symbolic Link rather than an actual file.
-
Parameters:
-
file(File) — the file to be checked.
-
- Returns: {@code true} if the file is a Symbolic Link, {@code false} otherwise. <p> <b> Usage Examples: </b> </p> <pre> {@code File path = new File("symlink"); boolean isSymlink = IOUtil.isSymbolicLink(path); } </pre>
- See also: Files#isSymbolicLink(Path)
sizeOf(...) -> long
-
Signature:
public static long sizeOf(final File file) throws FileNotFoundException - Summary: Returns the size of the specified file or directory.
-
Contract:
- if the provided {@link File} is a regular file, then the file's length is returned.
- if the argument is a directory, then the size of the directory is calculated recursively.
- If a directory or subdirectory is security restricted, its size will not be included.
- <p> Note that overflow is not detected, and the return value may be negative if overflow occurs.
-
Parameters:
-
file(File) — the regular file or directory to return the size. of (must not be {@code null} ).
-
- Returns: the length of the file, or recursive size of the directory, provided (in bytes).
-
Throws:
-
java.io.FileNotFoundException— if the file is {@code null} or the file does not exist. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("document.pdf"); long size = IOUtil.sizeOf(file); System.out.println("File size: " + size + " bytes"); } </pre>
-
- See also: #sizeOfAsBigInteger(File)
-
Signature:
public static long sizeOf(final File file, final boolean considerNonExistingFileAsEmpty) throws FileNotFoundException - Summary: Returns the size of the specified file or directory.
-
Parameters:
-
file(File) — the file or directory whose size is to be calculated, must not be {@code null} . -
considerNonExistingFileAsEmpty(boolean) — if {@code true} , the size of non-existing file is considered as 0.
-
- Returns: the total size in bytes. For directories, this is the recursive sum of all files within it.
-
Throws:
-
java.io.FileNotFoundException— if the file does not exist and considerNonExistingFileAsEmpty is {@code false} .
-
sizeOfDirectory(...) -> long
-
Signature:
public static long sizeOfDirectory(final File directory) throws FileNotFoundException - Summary: Counts the size of a directory recursively (sum of the length of all files).
-
Contract:
- <p> Note that overflow is not detected, and the return value may be negative if overflow occurs.
-
Parameters:
-
directory(File) — directory to inspect, must not be {@code null} .
-
- Returns: size of directory in bytes, 0 if directory is security restricted, a negative number when the real total is greater than {@link Long#MAX_VALUE} .
-
Throws:
-
java.io.FileNotFoundException— if the directory is {@code null} or it's not existed directory. <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("data"); long totalSize = IOUtil.sizeOfDirectory(directory); System.out.println("Directory size: " + totalSize + " bytes"); } </pre>
-
- See also: #sizeOfDirectoryAsBigInteger(File)
-
Signature:
public static long sizeOfDirectory(final File directory, final boolean considerNonExistingDirectoryAsEmpty) throws FileNotFoundException - Summary: Counts the size of a directory recursively (sum of the length of all files).
-
Parameters:
-
directory(File) — the directory whose size is to be calculated, must not be {@code null} . -
considerNonExistingDirectoryAsEmpty(boolean) — if {@code true} , the size of non-existing directory is considered as 0.
-
- Returns: the total size in bytes of all files within the directory and its subdirectories. <p> <b> Usage Examples: </b> </p> <pre> {@code File directory = new File("data"); long totalSize = IOUtil.sizeOfDirectory(directory); System.out.println("Directory size: " + totalSize + " bytes"); } </pre>
-
Throws:
-
java.io.FileNotFoundException— if the directory does not exist and considerNonExistingDirectoryAsEmpty is {@code false} .
-
sizeOfAsBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger sizeOfAsBigInteger(final File file) throws FileNotFoundException - Summary: Returns the size of the specified file or directory as a BigInteger.
-
Parameters:
-
file(File) — the file or directory whose size is to be calculated, must not be {@code null} .
-
- Returns: the total size as a BigInteger. For directories, this is the recursive sum of all files within it.
-
Throws:
-
java.io.FileNotFoundException— if the file does not exist.
-
- See also: #sizeOf(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File largeFile = new File("very_large_file.dat"); BigInteger size = IOUtil.sizeOfAsBigInteger(largeFile); },</pre>, #sizeOfDirectoryAsBigInteger(File)
sizeOfDirectoryAsBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger sizeOfDirectoryAsBigInteger(final File directory) - Summary: Returns the size of the specified directory as a BigInteger.
-
Parameters:
-
directory(File) — the directory whose size is to be calculated, must not be {@code null} .
-
- Returns: the total size as a BigInteger of all files within the directory and its subdirectories.
- See also: #sizeOfDirectory(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File largeDir = new File("large_directory"); BigInteger totalSize = IOUtil.sizeOfDirectoryAsBigInteger(largeDir); },</pre>, #sizeOfAsBigInteger(File)
zip(...) -> void
-
Signature:
public static void zip(final File sourceFile, final File targetFile) throws UncheckedIOException - Summary: Compresses the specified source file and writes the compressed data to the target file using the ZIP compression algorithm.
-
Parameters:
-
sourceFile(File) — the file to be compressed. This must be a valid file. -
targetFile(File) — the file to which the compressed data will be written. This must be a valid file. <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceDir = new File("documents"); File zipFile = new File("documents.zip"); IOUtil.zip(sourceDir, zipFile); } </pre>
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static void zip(final Collection<File> sourceFiles, final File targetFile) throws UncheckedIOException - Summary: Compresses the specified source files and writes the compressed data to the target file using the ZIP compression algorithm.
-
Parameters:
-
sourceFiles(Collection<File>) — the collection of files to be compressed. Each must be a valid file. -
targetFile(File) — the file to which the compressed data will be written. This must be a valid file.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
unzip(...) -> void
-
Signature:
public static void unzip(final File srcZipFile, final File targetDir) throws IOException - Summary: Unzips the specified source ZIP file to the target directory.
-
Parameters:
-
srcZipFile(File) — the source ZIP file to be unzipped. This must be a valid ZIP file. -
targetDir(File) — the directory to which the contents of the ZIP file will be extracted. This must be a valid directory. <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceDir = new File("documents"); File zipFile = new File("documents.zip"); IOUtil.zip(sourceDir, zipFile); } </pre>
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during the unzip process.
-
split(...) -> void
-
Signature:
public static void split(final File file, final int countOfParts) throws IOException - Summary: Splits a file into multiple parts based on the specified number of parts and saves them to the same directory as the source file.
-
Contract:
- </li> </ul> <p> Size distribution: </p> <ul> <li> <strong> Regular parts: </strong> Each part (except the last) will be approximately equal in size </li> <li> <strong> Last part: </strong> Contains any remaining bytes, which may be smaller than the other parts </li> <li> <strong> Empty files: </strong> if the source file is empty, one empty part file is created </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("large_document.pdf"); // Split into 5 parts IOUtil.split(sourceFile, 5); // Creates: large_document.pdf_0001, large_document.pdf_0002, etc.
-
Parameters:
-
file(File) — the source file to split; must exist and be readable. -
countOfParts(int) — the number of parts to split the file into; must be greater than 0.
-
-
Throws:
-
java.io.IOException— if there are issues with file validation or writing the parts.
-
- See also: #split(File, int, File), #splitBySize(File, long), #splitBySize(File, long, File)
-
Signature:
public static void split(final File file, final int countOfParts, final File destDir) throws IOException - Summary: Splits a file into multiple parts based on the specified number of parts and saves them to a destination directory.
-
Contract:
- </li> </ul> <p> Size distribution: </p> <ul> <li> <strong> Regular parts: </strong> Each part (except the last) will be approximately equal in size </li> <li> <strong> Last part: </strong> Contains any remaining bytes, which may be smaller than the other parts </li> <li> <strong> Empty files: </strong> if the source file is empty, one empty part file is created </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("large_document.pdf"); File outputDir = new File("split_parts"); // Split into 5 parts IOUtil.split(sourceFile, 5, outputDir); // Creates: large_document.pdf_0001, large_document.pdf_0002, etc.
-
Parameters:
-
file(File) — the source file to split; must exist and be readable. -
countOfParts(int) — the number of parts to split the file into; must be greater than 0. -
destDir(File) — the directory where the split parts will be saved; must exist and be writable.
-
-
Throws:
-
java.io.IOException— if there are issues with file validation or writing the parts.
-
- See also: #split(File, int), #splitBySize(File, long), #splitBySize(File, long, File)
splitBySize(...) -> void
-
Signature:
public static void splitBySize(final File file, final long sizeOfPart) throws IOException - Summary: Splits a file into multiple parts based on the specified size per part.
-
Contract:
- </li> </ul> <p> Size distribution: </p> <ul> <li> <strong> Regular parts: </strong> Each part (except the last) will be exactly {@code sizeOfPart} bytes </li> <li> <strong> Last part: </strong> Contains the remaining bytes, which may be smaller than {@code sizeOfPart} </li> <li> <strong> Empty files: </strong> if the source file is empty, one empty part file is created </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("large_document.pdf"); // Split into 1MB parts IOUtil.splitBySize(sourceFile, 1024 * 1024); // Creates: large_document.pdf_0001, large_document.pdf_0002, etc.
-
Parameters:
-
file(File) — the source file to split; must exist and be readable. -
sizeOfPart(long) — the maximum size in bytes for each part (except possibly the last part).
-
-
Throws:
-
java.io.IOException— if there are issues with file validation.
-
- See also: #splitBySize(File, long, File), #split(File, int, File), #split(File, int)
-
Signature:
public static void splitBySize(final File file, final long sizeOfPart, final File destDir) throws IOException - Summary: Splits a file into multiple parts based on the specified size per part and saves them to a destination directory.
-
Contract:
- </li> </ul> <p> Size distribution: </p> <ul> <li> <strong> Regular parts: </strong> Each part (except the last) will be exactly {@code sizeOfPart} bytes </li> <li> <strong> Last part: </strong> Contains the remaining bytes, which may be smaller than {@code sizeOfPart} </li> <li> <strong> Empty files: </strong> if the source file is empty, one empty part file is created </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code File sourceFile = new File("large_document.pdf"); File outputDir = new File("split_parts"); // Split into 1MB parts IOUtil.splitBySize(sourceFile, 1024 * 1024, outputDir); // Creates: large_document.pdf_0001, large_document.pdf_0002, etc.
-
Parameters:
-
file(File) — the source file to split; must exist and be readable. -
sizeOfPart(long) — the maximum size in bytes for each part (except possibly the last part). -
destDir(File) — the destination directory where split parts will be saved; must exist and be writable.
-
-
Throws:
-
java.io.IOException— if there are issues with file validation or directory access.
-
- See also: #splitBySize(File, long), #split(File, int, File), #split(File, int)
merge(...) -> long
-
Signature:
public static long merge(final File[] sourceFiles, final File destFile) throws UncheckedIOException - Summary: Merges the given source files into the specified destination file.
-
Parameters:
-
sourceFiles(File[]) — an array of files to be merged. These must be valid files. -
destFile(File) — the destination file where the merged content will be written. This must be a valid file.
-
- Returns: the number of bytes written to the destination file. <p> <b> Usage Examples: </b> </p> <pre> {@code List<File> sourceFiles = Arrays.asList(new File("part1.txt"), new File("part2.txt")); File destination = new File("merged.txt"); IOUtil.merge(sourceFiles, destination); } </pre>
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the process.
-
-
Signature:
public static long merge(final Collection<File> sourceFiles, final File destFile) throws UncheckedIOException - Summary: Merges the given source files into the specified destination file.
-
Parameters:
-
sourceFiles(Collection<File>) — a collection of files to be merged. These must be valid files. -
destFile(File) — the destination file where the merged content will be written. This must be a valid file.
-
- Returns: the number of bytes written to the destination file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the process.
-
-
Signature:
public static long merge(final Collection<File> sourceFiles, final byte[] delimiter, final File destFile) throws UncheckedIOException - Summary: Merges the given source files into the specified destination file, separated by the provided delimiter.
-
Parameters:
-
sourceFiles(Collection<File>) — a collection of files to be merged. These must be valid files. -
delimiter(byte[]) — a byte array that will be inserted between each file during the merge. -
destFile(File) — the destination file where the merged content will be written. This must be a valid file.
-
- Returns: the number of bytes written to the destination file.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the process.
-
listFiles(...) -> List<File>
-
Signature:
public static List<File> listFiles(final File parentPath) - Summary: Lists all files in the specified parent directory.
-
Parameters:
-
parentPath(File) — the parent directory from which to list files.
-
- Returns: a list of File objects representing all files in the parent directory.
- See also: Stream#listFiles(File), Fn#isFile(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File directory = new File("data"); List<File> files = IOUtil.listFiles(directory); for (File file : files) { System.out.println(file.getName()); } },</pre>, Fn#isDirectory()
-
Signature:
public static List<File> listFiles(final File parentPath, final boolean recursively, final boolean excludeDirectory) - Summary: Lists all files in the specified parent directory.
-
Contract:
- if the recursive parameter is set to {@code true} , it will list files in all subdirectories as well.
- if the excludeDirectory parameter is set to {@code true} , it will exclude directories from the list.
-
Parameters:
-
parentPath(File) — the parent directory from which to list files. -
recursively(boolean) — a boolean indicating whether to list files in all subdirectories. -
excludeDirectory(boolean) — a boolean indicating whether to exclude directories from the list.
-
- Returns: a list of File objects representing all files in the parent directory.
- See also: Stream#listFiles(File, boolean, boolean), Fn#isFile(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File directory = new File("data"); List<File> files = IOUtil.listFiles(directory); for (File file : files) { System.out.println(file.getName()); } },</pre>, Fn#isDirectory()
-
Signature:
public static <E extends Exception> List<File> listFiles(final File parentPath, final boolean recursively, final Throwables.BiPredicate<? super File, ? super File, E> filter) throws E - Summary: Lists all files in the specified parent directory.
-
Contract:
- if the recursive parameter is set to {@code true} , it will list files in all subdirectories as well.
-
Parameters:
-
parentPath(File) — the parent directory where the listing will start. It must not be {@code null} . -
recursively(boolean) — if {@code true} , files in all subdirectories of the parent directory will be listed. -
filter(Throwables.BiPredicate<? super File, ? super File, E>) — a BiPredicate that takes the parent directory and a file as arguments and returns a boolean. if the predicate returns {@code true} , the file is listed; if it returns {@code false} , the file is not listed.
-
- Returns: a list of files in the specified directory and possibly its subdirectories.
-
Throws:
-
E— if the filter throws an exception.
-
- See also: Stream#listFiles(File, boolean, boolean), Fn#isFile(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File directory = new File("data"); List<File> files = IOUtil.listFiles(directory); for (File file : files) { System.out.println(file.getName()); } },</pre>, Fn#isDirectory()
listDirectories(...) -> List<File>
-
Signature:
public static List<File> listDirectories(final File parentPath) - Summary: Lists all directories in the specified parent directory.
-
Parameters:
-
parentPath(File) — the parent directory from which to list directories.
-
- Returns: a list of File objects representing all directories in the parent directory.
- See also: Stream#listFiles(File),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File parentDir = new File("parent"); List<File> subdirs = IOUtil.listDirectories(parentDir); },</pre>, Fn#isDirectory()
-
Signature:
public static List<File> listDirectories(final File parentPath, final boolean recursively) - Summary: Lists all directories in the specified parent directory.
-
Contract:
- if the recursive parameter is set to {@code true} , it will list directories in all subdirectories as well.
-
Parameters:
-
parentPath(File) — the parent directory from which to list directories. -
recursively(boolean) — a boolean indicating whether to list directories in all subdirectories.
-
- Returns: a list of File objects representing all directories in the parent directory and its subdirectories if recursively is {@code true} .
- See also: Stream#listFiles(File, boolean, boolean),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File parentDir = new File("parent"); List<File> subdirs = IOUtil.listDirectories(parentDir); },</pre>, Fn#isDirectory()
walk(...) -> Stream<File>
-
Signature:
public static Stream<File> walk(final File parentPath) - Summary: Lists the names of all files and directories in the specified parent directory.
-
Parameters:
-
parentPath(File) — the parent directory from which to list files and directories.
-
- Returns: a list of strings representing the names of all files and directories in the parent directory.
- See also: Stream#listFiles(File), Fn#isFile(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File rootDir = new File("root"); Stream<File> fileStream = IOUtil.walk(rootDir); fileStream.forEach(f -> System.out.println(f.getPath())); },</pre>, Fn#isDirectory()
-
Signature:
public static Stream<File> walk(final File parentPath, final boolean recursively, final boolean excludeDirectory) - Summary: Lists the names of all files and directories in the specified parent directory.
-
Contract:
- if the recursive parameter is set to {@code true} , it will list files in all subdirectories as well.
- if the excludeDirectory parameter is set to {@code true} , it will exclude directories from the list.
-
Parameters:
-
parentPath(File) — the parent directory from which to list files and directories. -
recursively(boolean) — a boolean indicating whether to list files in all subdirectories. -
excludeDirectory(boolean) — a boolean indicating whether to exclude directories from the list.
-
- Returns: a list of strings representing the names of all files and directories in the parent directory.
- See also: Stream#listFiles(File, boolean, boolean), Fn#isFile(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File rootDir = new File("root"); Stream<File> fileStream = IOUtil.walk(rootDir); fileStream.forEach(f -> System.out.println(f.getPath())); },</pre>, Fn#isDirectory()
toFile(...) -> File
-
Signature:
public static File toFile(final URL url) - Summary: Convert from a {@code URL} to a {@code File} .
-
Parameters:
-
url(URL) — the file URL to convert, {@code null} returns {@code null} .
-
- Returns: a File object corresponding to the input URL.
toFiles(...) -> File\[\]
-
Signature:
public static File[] toFiles(final URL[] urls) throws UncheckedIOException - Summary: Converts each {@code URL} in the specified array to a {@code File} .
-
Contract:
- if the input is {@code null} , an empty array is returned.
- if the input contains {@code null} , the output array contains {@code null} at the same index.
-
Parameters:
-
urls(URL[]) — the file URLs to convert, {@code null} returns empty array.
-
- Returns: a non- {@code null} array of Files matching the input, with a {@code null} item. if there was a {@code null} at that index in the input array
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs.
-
-
Signature:
public static List<File> toFiles(final Collection<URL> urls) throws UncheckedIOException - Summary: Converts a collection of URLs into a list of corresponding File objects.
-
Parameters:
-
urls(Collection<URL>) — the collection of URLs to be converted.
-
- Returns: a list of File objects corresponding to the input URLs.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the conversion.
-
toURL(...) -> URL
-
Signature:
public static URL toURL(final File file) throws UncheckedIOException - Summary: Converts a File object into a URL.
-
Parameters:
-
file(File) — the File object to be converted.
-
- Returns: a URL object corresponding to the input File object.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the conversion.
-
- See also: File#toURI(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File file = new File("data.txt"); URL url = IOUtil.toURL(file); },</pre>, URI#toURL()
toURLs(...) -> URL\[\]
-
Signature:
public static URL[] toURLs(final File[] files) throws UncheckedIOException - Summary: Converts an array of File objects into an array of corresponding URL objects.
-
Parameters:
-
files(File[]) — the array of File objects to be converted.
-
- Returns: an array of URL objects corresponding to the input File objects.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the conversion.
-
- See also: File#toURI(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code File\[\] files = {new File("file1.txt"), new File("file2.txt")}; URL\[\] urls = IOUtil.toURLs(files); },</pre>, URI#toURL()
-
Signature:
public static List<URL> toURLs(final Collection<File> files) throws UncheckedIOException - Summary: Converts a collection of File objects into a list of corresponding URL objects.
-
Parameters:
-
files(Collection<File>) — the collection of File objects to be converted.
-
- Returns: a list of URL objects corresponding to the input File objects.
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs during the conversion.
-
- See also: File#toURI(),<p>,<b>,Usage Examples:,</b>,</p>, ,<pre>,{@code List<File> files = Arrays.asList(new File("a.txt"), new File("b.txt")); List<URL> urls = IOUtil.toURLs(files); },</pre>, URI#toURL()
touch(...) -> boolean
-
Signature:
public static boolean touch(final File source) - Summary: Update the last modified time of the file to the system current time if the specified file exists.
-
Contract:
- Update the last modified time of the file to the system current time if the specified file exists.
-
Parameters:
-
source(File) — the File to touch. <p> <b> Usage Examples: </b> </p> <pre> {@code File file = new File("marker.txt"); IOUtil.touch(file); // Creates file or updates timestamp } </pre>
-
- Returns: {@code true} if the file exists and last modified time is updated successfully, {@code false} otherwise.
contentEquals(...) -> boolean
-
Signature:
public static boolean contentEquals(final File file1, final File file2) throws IOException - Summary: Tests whether the contents of two files are equal.
-
Contract:
- <p> This method checks to see if the two files are different lengths or if they point to the same file, before resorting to byte-by-byte comparison of the contents.
-
Parameters:
-
file1(File) — the first file. -
file2(File) — the second file.
-
- Returns: {@code true} if the contents of the files are equal or they both don't exist, {@code false} otherwise.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static boolean contentEquals(final InputStream input1, final InputStream input2) throws IOException - Summary: Compares the contents of two Streams to determine if they are equal or not.
-
Contract:
- Compares the contents of two Streams to determine if they are equal or not.
- <p> This method buffers the input internally using {@link BufferedInputStream} if they are not already buffered.
-
Parameters:
-
input1(InputStream) — the first stream. -
input2(InputStream) — the second stream.
-
- Returns: {@code true} if the content of the streams are equal, or they both don't. exist, {@code false} otherwise
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
-
Signature:
public static boolean contentEquals(final Reader input1, final Reader input2) throws IOException - Summary: Compares the contents of two Readers to determine if they are equal or not.
-
Contract:
- Compares the contents of two Readers to determine if they are equal or not.
- <p> This method buffers the input internally using {@link BufferedReader} if they are not already buffered.
-
Parameters:
-
input1(Reader) — the first reader. -
input2(Reader) — the second reader.
-
- Returns: {@code true} if the content of the readers are equal, or they both don't exist, {@code false} otherwise.
-
Throws:
-
java.io.IOException— if an I/O error occurs.
-
contentEqualsIgnoreEOL(...) -> boolean
-
Signature:
public static boolean contentEqualsIgnoreEOL(final File file1, final File file2, final String charsetName) throws IOException - Summary: Compares the contents of two files to determine if they are equal or not.
-
Contract:
- Compares the contents of two files to determine if they are equal or not.
- <p> This method checks to see if the two files point to the same file, before resorting to line-by-line comparison of the contents.
-
Parameters:
-
file1(File) — the first file. -
file2(File) — the second file. -
charsetName(String) — the name of the requested charset. May be {@code null} , in which case the platform default is used
-
- Returns: {@code true} if the content of the files are equal or neither exists,. {@code false} otherwise
-
Throws:
-
java.io.IOException— in case of an I/O error.
-
- See also: IOUtil#contentEqualsIgnoreEOL(Reader, Reader)
-
Signature:
public static boolean contentEqualsIgnoreEOL(final Reader input1, final Reader input2) throws IOException - Summary: Compares the contents of two Readers to determine if they are equal or not, ignoring EOL characters.
-
Contract:
- Compares the contents of two Readers to determine if they are equal or not, ignoring EOL characters.
- <p> This method buffers the input internally using {@link BufferedReader} if they are not already buffered.
-
Parameters:
-
input1(Reader) — the first reader. -
input2(Reader) — the second reader.
-
- Returns: {@code true} if the content of the readers are equal (ignoring EOL differences), {@code false} otherwise.
-
Throws:
-
java.io.IOException— if an I/O error occurs during the comparison.
-
forLines(...) -> void
-
Signature:
public static <E extends Exception> void forLines(final File source, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the source file to be parsed. -
lineAction(Throwables.Consumer<? super String, E>) — a Consumer that takes a line of the file as a String and performs the desired operation.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if the lineAction throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final File source, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. If a directory, all files within it are processed recursively. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final File source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. If a directory, all files within it are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final File source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. If a directory, all files within it are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final File source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified file/directory line by line with optional parallel processing.
-
Parameters:
-
source(File) — the file or directory to process. If a directory, all files within it are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final File source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the source file/directory to be parsed. -
lineOffset(long) — the line number from where to start parsing. -
count(long) — the number of lines to be parsed. -
processThreadNum(int) — the number of threads to be used for parsing. -
queueSize(int) — the size of the queue for holding lines to be parsed. -
lineAction(Throwables.Consumer<? super String, E>) — a Consumer that takes a line of the file as a String and performs the desired operation. -
onComplete(Throwables.Runnable<E2>) — a Runnable that is executed after the parsing is complete.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if the lineAction throws an exception. -
E2— if the onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Collection<File> files, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files to be parsed. -
lineAction(Throwables.Consumer<? super String, E>) — a Consumer that takes a line of the file as a String and performs the desired operation.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if the lineAction throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Collection<File> files, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files to be parsed. -
lineAction(Throwables.Consumer<? super String, E>) — a Consumer that takes a line of the file as a String and performs the desired operation. -
onComplete(Throwables.Runnable<E2>) — a Runnable that is executed after the parsing is complete.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files to be parsed. -
lineOffset(long) — the line number from where to start parsing. -
count(long) — the number of lines to be parsed. -
processThreadNum(int) — the number of threads to use for parallel processing. -
queueSize(int) — the size of the queue for buffering lines during parallel processing. -
lineAction(Throwables.Consumer<? super String, E>) — a Consumer that takes a line of the file as a String and performs the desired operation. -
onComplete(Throwables.Runnable<E2>) — a Runnable that is executed after the parsing is complete.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if the lineAction throws an exception. -
E2— if the onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final File source, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. Directories are processed recursively. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final File source, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. Directories are processed recursively. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final File source, final long lineOffset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. Directories are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final File source, final long lineOffset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified file/directory line by line.
-
Parameters:
-
source(File) — the file or directory to process. All subfiles are processed recursively if this is a directory. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Collection<File> files, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Collection<File> files, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. Directories are processed recursively. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Collection<File> files, final long lineOffset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parses the given collection of file line by line using the provided lineAction.
-
Parameters:
-
files(Collection<File>) — the collection of files/directories to process. All subfiles are processed recursively if an element is a directory. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
readThreadNum(int) — the number of threads for reading files. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final InputStream source, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final InputStream source, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final InputStream source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final InputStream source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final InputStream source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final InputStream source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified InputStream line by line.
-
Parameters:
-
source(InputStream) — the InputStream to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Reader source, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Reader source, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Reader source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Reader source, final long lineOffset, final long count, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forLines(final Reader source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction) throws UncheckedIOException, E - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line.
-
- See also: #forLines(Reader, long, long, int, int, Throwables.Consumer, Throwables.Runnable), Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
-
Signature:
public static <E extends Exception, E2 extends Exception> void forLines(final Reader source, final long lineOffset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super String, E> lineAction, final Throwables.Runnable<E2> onComplete) throws UncheckedIOException, E, E2 - Summary: Parse the specified Reader line by line.
-
Parameters:
-
source(Reader) — the Reader to read lines from. -
lineOffset(long) — the number of lines to skip from the beginning. -
count(long) — the maximum number of lines to process after the offset. -
processThreadNum(int) — the number of worker threads for parallel processing. 0 or negative for sequential processing. -
queueSize(int) — the size of the buffer queue between reader and processor threads. -
lineAction(Throwables.Consumer<? super String, E>) — the action to perform on each line. -
onComplete(Throwables.Runnable<E2>) — the action to perform after all lines have been processed successfully.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs. -
E— if lineAction throws an exception while processing a line. -
E2— if onComplete throws an exception.
-
- See also: Iterators#forEach(Iterator, long, long, int, int, Throwables.Consumer, Throwables.Runnable)
Public Instance Methods
- (none)
Class IdentityHashSet (com.landawn.abacus.util.IdentityHashSet)
A Set implementation that uses reference-equality (==) instead of object-equality (equals()) when comparing elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public IdentityHashSet() - Summary: Constructs a new, empty identity hash set with the default initial capacity (21).
-
Parameters:
- (none)
-
Signature:
public IdentityHashSet(final int initialCapacity) - Summary: Constructs a new, empty identity hash set with the specified initial capacity.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the identity hash set
-
-
Signature:
public IdentityHashSet(final Collection<? extends T> c) - Summary: Constructs a new identity hash set containing the elements in the specified collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection whose elements are to be placed into this set
-
add(...) -> boolean
-
Signature:
@Override public boolean add(final T e) - Summary: Adds the specified element to this set if it is not already present using reference-equality comparison.
-
Contract:
- Adds the specified element to this set if it is not already present using reference-equality comparison.
- More formally, adds the specified element e to this set if the set contains no element e2 such that (e==e2).
-
Parameters:
-
e(T) — element to be added to this set
-
- Returns: {@code true} if this set did not already contain the specified element
remove(...) -> boolean
-
Signature:
@Override public boolean remove(final Object o) - Summary: Removes the specified element from this set if it is present using reference-equality comparison.
-
Contract:
- Removes the specified element from this set if it is present using reference-equality comparison.
- More formally, removes an element e such that (o==e), if this set contains such an element.
-
Parameters:
-
o(Object) — object to be removed from this set, if present
-
- Returns: {@code true} if the set contained the specified element
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final Collection<?> c) - Summary: Returns {@code true} if this set contains all of the elements in the specified collection.
-
Contract:
- Returns {@code true} if this set contains all of the elements in the specified collection.
-
Parameters:
-
c(Collection<?>) — collection to be checked for containment in this set
-
- Returns: {@code true} if this set contains all of the elements in the specified collection
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final Collection<? extends T> c) - Summary: Adds all of the elements in the specified collection to this set using reference-equality comparison.
-
Contract:
- For each element e in the collection, it is added if the set contains no element e2 such that (e==e2).
-
Parameters:
-
c(Collection<? extends T>) — collection containing elements to be added to this set
-
- Returns: {@code true} if this set changed as a result of the call
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final Collection<?> c) - Summary: Removes from this set all of its elements that are contained in the specified collection using reference-equality comparison.
-
Parameters:
-
c(Collection<?>) — collection containing elements to be removed from this set
-
- Returns: {@code true} if this set changed as a result of the call
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final Collection<?> c) - Summary: Retains only the elements in this set that are contained in the specified collection using reference-equality comparison.
-
Parameters:
-
c(Collection<?>) — collection containing elements to be retained in this set
-
- Returns: {@code true} if this set changed as a result of the call
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: Returns {@code true} if this set contains the specified element using reference-equality comparison.
-
Contract:
- Returns {@code true} if this set contains the specified element using reference-equality comparison.
- More formally, returns {@code true} if and only if this set contains an element e such that (valueToFind==e).
-
Parameters:
-
valueToFind(Object) — element whose presence in this set is to be tested
-
- Returns: {@code true} if this set contains the specified element based on reference equality
iterator(...) -> Iterator<T>
-
Signature:
@Override public Iterator<T> iterator() - Summary: Returns an iterator over the elements in this set.
-
Contract:
- The iterator is fail-fast: if the set is modified after the iterator is created, the iterator will throw a {@link java.util.ConcurrentModificationException} .
-
Parameters:
- (none)
- Returns: an iterator over the elements in this set
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Returns an array containing all of the elements in this set.
-
Parameters:
- (none)
- Returns: an array containing all of the elements in this set
-
Signature:
@Override public <A> A[] toArray(final A[] a) - Summary: Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.
-
Contract:
- If the set fits in the specified array, it is returned therein.
-
Parameters:
-
a(A[]) — the array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated
-
- Returns: an array containing all of the elements in this set
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this set (its cardinality).
-
Parameters:
- (none)
- Returns: the number of elements in this set
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this set contains no elements.
-
Contract:
- Returns {@code true} if this set contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this set contains no elements
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all of the elements from this set.
-
Parameters:
- (none)
equals(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") @Override public boolean equals(final Object o) - Summary: Compares the specified object with this set for equality.
-
Contract:
- Returns {@code true} if the specified object is also an IdentityHashSet and the two sets have identical mappings.
- Note that this compares the internal maps for equality, which means it checks if both sets contain the same object references.
-
Parameters:
-
o(Object) — object to be compared for equality with this set
-
- Returns: {@code true} if the specified object is equal to this set
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this set.
-
Parameters:
- (none)
- Returns: the hash code value for this set
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this set.
-
Parameters:
- (none)
- Returns: a string representation of this set
Class If (com.landawn.abacus.util.If)
A functional programming utility class for creating fluent conditional execution chains that provides an alternative to traditional if-else statements through method chaining.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
is(...) -> If
-
Signature:
public static If is(final boolean b) - Summary: Creates an If instance based on the given boolean condition.
-
Contract:
- Creates an If instance based on the given boolean condition.
-
Parameters:
-
b(boolean) — the boolean condition to evaluate.
-
- Returns: an If instance representing the condition.
not(...) -> If
-
Signature:
public static If not(final boolean b) - Summary: Creates an If instance with the negation of the given boolean condition.
-
Contract:
- Creates an If instance with the negation of the given boolean condition.
-
Parameters:
-
b(boolean) — the boolean condition to negate.
-
- Returns: an If instance representing the negated condition.
exists(...) -> If
-
Signature:
public static If exists(final int index) - Summary: Creates an If instance that checks if an index is valid (non-negative).
-
Contract:
- Creates an If instance that checks if an index is valid (non-negative).
-
Parameters:
-
index(int) — the index value to check.
-
- Returns: an If instance that is {@code true} if the index is non-negative.
isNull(...) -> If
-
Signature:
public static If isNull(final Object obj) - Summary: Creates an If instance that checks if the given object is {@code null} .
-
Contract:
- Creates an If instance that checks if the given object is {@code null} .
-
Parameters:
-
obj(Object) — the object to check for null.
-
- Returns: an If instance that is {@code true} if the object is null.
isEmpty(...) -> If
-
Signature:
public static If isEmpty(final CharSequence s) - Summary: Creates an If instance that checks if the given CharSequence is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given CharSequence is {@code null} or empty.
- <p> A CharSequence is considered empty if it is {@code null} or has zero length.
-
Parameters:
-
s(CharSequence) — the CharSequence to check.
-
- Returns: an If instance that is {@code true} if the CharSequence is {@code null} or empty.
-
Signature:
public static If isEmpty(final boolean[] a) - Summary: Creates an If instance that checks if the given boolean array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given boolean array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the boolean array to check.
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length.
-
Signature:
public static If isEmpty(final char[] a) - Summary: Creates an If instance that checks if the given char array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given char array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the char array to check.
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length.
-
Signature:
public static If isEmpty(final byte[] a) - Summary: Creates an If instance that checks if the given byte array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given byte array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the byte array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final short[] a) - Summary: Creates an If instance that checks if the given short array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given short array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the short array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final int[] a) - Summary: Creates an If instance that checks if the given int array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given int array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the int array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final long[] a) - Summary: Creates an If instance that checks if the given long array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given long array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the long array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final float[] a) - Summary: Creates an If instance that checks if the given float array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given float array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the float array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final double[] a) - Summary: Creates an If instance that checks if the given double array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given double array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the double array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final Object[] a) - Summary: Creates an If instance that checks if the given object array is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given object array is {@code null} or empty.
-
Parameters:
-
a(Object[]) — the object array to check
-
- Returns: an If instance that is {@code true} if the array is {@code null} or has zero length
-
Signature:
public static If isEmpty(final Collection<?> c) - Summary: Creates an If instance that checks if the given Collection is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given Collection is {@code null} or empty.
-
Parameters:
-
c(Collection<?>) — the Collection to check
-
- Returns: an If instance that is {@code true} if the Collection is {@code null} or empty
-
Signature:
public static If isEmpty(final Map<?, ?> m) - Summary: Creates an If instance that checks if the given Map is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given Map is {@code null} or empty.
-
Parameters:
-
m(Map<?, ?>) — the Map to check
-
- Returns: an If instance that is {@code true} if the Map is {@code null} or empty
-
Signature:
@SuppressWarnings("rawtypes") public static If isEmpty(final PrimitiveList list) - Summary: Creates an If instance that checks if the given PrimitiveList is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given PrimitiveList is {@code null} or empty.
- <p> A PrimitiveList is considered empty if it is {@code null} or has size of 0.
-
Parameters:
-
list(PrimitiveList) — the PrimitiveList to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the PrimitiveList is {@code null} or empty
-
Signature:
public static If isEmpty(final Multiset<?> s) - Summary: Creates an If instance that checks if the given Multiset is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given Multiset is {@code null} or empty.
- <p> A Multiset is considered empty if it is {@code null} or has no elements.
-
Parameters:
-
s(Multiset<?>) — the Multiset to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the Multiset is {@code null} or empty
-
Signature:
public static If isEmpty(final Multimap<?, ?, ?> m) - Summary: Creates an If instance that checks if the given Multimap is {@code null} or empty.
-
Contract:
- Creates an If instance that checks if the given Multimap is {@code null} or empty.
- <p> A Multimap is considered empty if it is {@code null} or has no key-value mappings.
-
Parameters:
-
m(Multimap<?, ?, ?>) — the Multimap to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the Multimap is {@code null} or empty
isBlank(...) -> If
-
Signature:
public static If isBlank(final CharSequence s) - Summary: Creates an If instance that checks if the given CharSequence is {@code null} , empty, or contains only whitespace.
-
Contract:
- Creates an If instance that checks if the given CharSequence is {@code null} , empty, or contains only whitespace.
- <p> A CharSequence is considered blank if it is {@code null} , has zero length, or contains only whitespace characters as defined by {@link Character#isWhitespace(char)} .
-
Parameters:
-
s(CharSequence) — the CharSequence to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the CharSequence is {@code null} , empty, or contains only whitespace
notNull(...) -> If
-
Signature:
public static If notNull(final Object obj) - Summary: Creates an If instance that checks if the given object is not {@code null} .
-
Contract:
- Creates an If instance that checks if the given object is not {@code null} .
-
Parameters:
-
obj(Object) — the object to check
-
- Returns: an If instance that is {@code true} if the object is not null
notEmpty(...) -> If
-
Signature:
public static If notEmpty(final CharSequence s) - Summary: Creates an If instance that checks if the given CharSequence is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given CharSequence is not {@code null} and not empty.
-
Parameters:
-
s(CharSequence) — the CharSequence to check
-
- Returns: an If instance that is {@code true} if the CharSequence is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final boolean[] a) - Summary: Creates an If instance that checks if the given boolean array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given boolean array is not {@code null} and not empty.
-
Parameters:
-
a(boolean[]) — the boolean array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final char[] a) - Summary: Creates an If instance that checks if the given char array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given char array is not {@code null} and not empty.
-
Parameters:
-
a(char[]) — the char array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final byte[] a) - Summary: Creates an If instance that checks if the given byte array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given byte array is not {@code null} and not empty.
-
Parameters:
-
a(byte[]) — the byte array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final short[] a) - Summary: Creates an If instance that checks if the given short array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given short array is not {@code null} and not empty.
-
Parameters:
-
a(short[]) — the short array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final int[] a) - Summary: Creates an If instance that checks if the given int array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given int array is not {@code null} and not empty.
-
Parameters:
-
a(int[]) — the int array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final long[] a) - Summary: Creates an If instance that checks if the given long array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given long array is not {@code null} and not empty.
-
Parameters:
-
a(long[]) — the long array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final float[] a) - Summary: Creates an If instance that checks if the given float array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given float array is not {@code null} and not empty.
-
Parameters:
-
a(float[]) — the float array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final double[] a) - Summary: Creates an If instance that checks if the given double array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given double array is not {@code null} and not empty.
-
Parameters:
-
a(double[]) — the double array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final Object[] a) - Summary: Creates an If instance that checks if the given object array is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given object array is not {@code null} and not empty.
-
Parameters:
-
a(Object[]) — the object array to check
-
- Returns: an If instance that is {@code true} if the array is not {@code null} and has length > 0
-
Signature:
public static If notEmpty(final Collection<?> c) - Summary: Creates an If instance that checks if the given Collection is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given Collection is not {@code null} and not empty.
-
Parameters:
-
c(Collection<?>) — the Collection to check
-
- Returns: an If instance that is {@code true} if the Collection is not {@code null} and not empty
-
Signature:
public static If notEmpty(final Map<?, ?> m) - Summary: Creates an If instance that checks if the given Map is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given Map is not {@code null} and not empty.
-
Parameters:
-
m(Map<?, ?>) — the Map to check
-
- Returns: an If instance that is {@code true} if the Map is not {@code null} and not empty
-
Signature:
@SuppressWarnings("rawtypes") public static If notEmpty(final PrimitiveList list) - Summary: Creates an If instance that checks if the given PrimitiveList is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given PrimitiveList is not {@code null} and not empty.
- <p> A PrimitiveList is considered not empty if it is not {@code null} and has size greater than 0.
-
Parameters:
-
list(PrimitiveList) — the PrimitiveList to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the PrimitiveList is not {@code null} and not empty
-
Signature:
public static If notEmpty(final Multiset<?> s) - Summary: Creates an If instance that checks if the given Multiset is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given Multiset is not {@code null} and not empty.
- <p> A Multiset is considered not empty if it is not {@code null} and contains at least one element.
-
Parameters:
-
s(Multiset<?>) — the Multiset to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the Multiset is not {@code null} and not empty
-
Signature:
public static If notEmpty(final Multimap<?, ?, ?> m) - Summary: Creates an If instance that checks if the given Multimap is not {@code null} and not empty.
-
Contract:
- Creates an If instance that checks if the given Multimap is not {@code null} and not empty.
- <p> A Multimap is considered not empty if it is not {@code null} and contains at least one key-value mapping.
-
Parameters:
-
m(Multimap<?, ?, ?>) — the Multimap to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the Multimap is not {@code null} and not empty
notBlank(...) -> If
-
Signature:
public static If notBlank(final CharSequence s) - Summary: Creates an If instance that checks if the given CharSequence is not {@code null} , not empty, and not blank.
-
Contract:
- Creates an If instance that checks if the given CharSequence is not {@code null} , not empty, and not blank.
- <p> A CharSequence is considered not blank if it is not {@code null} , has length > 0, and contains at least one non-whitespace character.
-
Parameters:
-
s(CharSequence) — the CharSequence to check (can be {@code null} )
-
- Returns: an If instance that is {@code true} if the CharSequence is not {@code null} , not empty, and contains non-whitespace characters
Public Instance Methods
thenDoNothing(...) -> OrElse
-
Signature:
public OrElse thenDoNothing() - Summary: Executes no action if the condition is {@code true} , but allows chaining to an {@code orElse} clause.
-
Contract:
- Executes no action if the condition is {@code true} , but allows chaining to an {@code orElse} clause.
- <p> This method is useful when you only want to execute an action in the {@code false} case.
- It provides a way to explicitly document the intent that no action should be taken when the condition is {@code true} , while still providing a fluent API for handling the {@code false} case.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Cache check - only load if not cached If.is(cache.contains(key)) .thenDoNothing() .orElse(() -> cache.load(key)); // Example 2: Better alternative using negation If.not(cache.contains(key)) .then(() -> cache.load(key)); // Example 3: Explicit no-op with fallback If.isNull(config) .thenDoNothing() .orElse(() -> loadDefaultConfig()); } </pre>
-
Parameters:
- (none)
- Returns: an OrElse instance for chaining the else clause
then(...) -> OrElse
-
Signature:
public <E extends Throwable> OrElse then(final Throwables.Runnable<E> cmd) throws IllegalArgumentException, E - Summary: Executes the given runnable if the condition is {@code true} .
-
Contract:
- Executes the given runnable if the condition is {@code true} .
- The provided runnable will be executed immediately if the condition evaluates to {@code true} , otherwise it will be skipped.
- The method returns an {@link OrElse} instance that allows you to chain an alternative action to be executed when the condition is {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Simple conditional execution If.is(debugMode) .then(() -> logger.debug("Debug information")) .orElse(() -> logger.info("Normal operation")); // Example 2: Validation and processing If.notEmpty(items) .then(() -> processItems(items)) .orElseThrow(() -> new IllegalStateException("No items to process")); // Example 3: Conditional side effects If.is(shouldCache) .then(() -> cache.put(key, value)); } </pre>
-
Parameters:
-
cmd(Throwables.Runnable<E>) — the runnable to execute if the condition is true (must not be {@code null} ).
-
- Returns: an OrElse instance for optional chaining of an else clause.
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is null. -
E— if the runnable throws an exception during execution.
-
-
Signature:
@Beta public <T, E extends Throwable> OrElse then(final T init, final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Executes the given consumer with the provided input if the condition is {@code true} .
-
Contract:
- Executes the given consumer with the provided input if the condition is {@code true} .
- <p> This method is useful for conditional processing of a value, allowing you to pass an initialization parameter that will be consumed if the condition evaluates to {@code true} .
- This is particularly valuable when you need to perform an action with a specific context or parameter only when certain conditions are met.
-
Parameters:
-
init(T) — the input value to pass to the consumer (can be {@code null} ). -
action(Throwables.Consumer<? super T, E>) — the consumer to execute if the condition is true (must not be {@code null} ).
-
- Returns: an OrElse instance for optional chaining of an else clause.
-
Throws:
-
java.lang.IllegalArgumentException— if action is null. -
E— if the consumer throws an exception during execution.
-
thenThrow(...) -> OrElse
-
Signature:
public <E extends Throwable> OrElse thenThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Throws the exception provided by the supplier if the condition is {@code true} .
-
Contract:
- Throws the exception provided by the supplier if the condition is {@code true} .
- <p> This method is useful for validation scenarios where an exception should be thrown when a certain condition is met.
- </p> <p> The exception supplier is only invoked if the condition is {@code true} , allowing for lazy creation of exception instances with dynamic messages or context.
- </p> <p> <b> Note: </b> While this method returns an {@link OrElse} instance to maintain API consistency, it will never be reached if the condition is {@code true} since an exception will be thrown.
- The {@code orElse()} methods can only be invoked if the condition is {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Validation with custom exception If.isEmpty(requiredField) .thenThrow(() -> new ValidationException("Required field is empty")); // Example 2: Guard clause pattern If.isNull(user) .thenThrow(() -> new IllegalArgumentException("User cannot be null")); // Example 3: Business rule validation with dynamic message If.is(amount < 0) .thenThrow(() -> new IllegalArgumentException("Amount must be positive: " + amount)); // Example 4: With orElse fallback (only executes if condition is false) If.isEmpty(data) .thenThrow(() -> new DataNotFoundException("No data available")) .orElse(() -> processData(data)); } </pre>
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplier that provides the exception to throw (must not be {@code null} ).
-
- Returns: an OrElse instance (though it will never be reached if the condition is true and exception is thrown).
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplier is null. -
E— if the condition is true.
-
Class OrElse (com.landawn.abacus.util.If.OrElse)
Represents the else clause in a conditional chain, allowing actions to be executed when the initial condition is {@code false} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
orElse(...) -> void
-
Signature:
public <E extends Throwable> void orElse(final Throwables.Runnable<E> cmd) throws IllegalArgumentException, E - Summary: Executes the given runnable if the initial condition was {@code false} .
-
Contract:
- Executes the given runnable if the initial condition was {@code false} .
- <p> This method completes the conditional chain by providing an alternative action to be executed when the initial {@code If} condition evaluates to {@code false} .
- </p> <p> The provided runnable will only be executed if the initial condition was {@code false} .
- If the condition was {@code true} , this method does nothing.
-
Parameters:
-
cmd(Throwables.Runnable<E>) — the runnable to execute if the initial condition was false (must not be {@code null} ).
-
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is null. -
E— if the runnable throws an exception during execution.
-
-
Signature:
@Beta public <T, E extends Throwable> void orElse(final T init, final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Executes the given consumer with the provided input if the initial condition was {@code false} .
-
Contract:
- Executes the given consumer with the provided input if the initial condition was {@code false} .
- <p> This method allows you to pass an initialization parameter that will be consumed if the initial condition evaluates to {@code false} .
- This is particularly useful when you need to provide a fallback action with specific context or parameters.
-
Parameters:
-
init(T) — the input value to pass to the consumer (can be {@code null} ). -
action(Throwables.Consumer<? super T, E>) — the consumer to execute if the initial condition was false (must not be {@code null} ).
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null. -
E— if the consumer throws an exception during execution.
-
orElseThrow(...) -> void
-
Signature:
public <E extends Throwable> void orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Throws the exception provided by the supplier if the initial condition was {@code false} .
-
Contract:
- Throws the exception provided by the supplier if the initial condition was {@code false} .
- <p> This method is useful for validation scenarios where an exception should be thrown when a required condition is not met.
- It provides a fluent way to express validation requirements and ensures that execution cannot continue when expected conditions fail.
- </p> <p> The exception supplier is only invoked if the initial condition was {@code false} , allowing for lazy creation of exception instances with dynamic messages or context.
- If the condition was {@code true} , this method does nothing and execution continues normally.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Example 1: Validation after processing If.notEmpty(results) .then(() -> processResults(results)) .orElseThrow(() -> new NoResultsException("No results found")); // Example 2: Required condition check If.notNull(user) .then(() -> authenticateUser(user)) .orElseThrow(() -> new IllegalStateException("User must not be null")); // Example 3: Business rule enforcement If.is(balance >= amount) .then(() -> processWithdrawal(amount)) .orElseThrow(() -> new InsufficientFundsException("Balance: " + balance + ", Required: " + amount)); // Example 4: Data validation If.notBlank(email) .then(() -> sendEmail(email)) .orElseThrow(() -> new ValidationException("Email address is required")); } </pre>
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplier that provides the exception to throw (must not be {@code null} ).
-
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplier is null. -
E— if the initial condition was false.
-
Interface Immutable (com.landawn.abacus.util.Immutable)
A marker interface for immutable data structures in the abacus-common framework.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class ImmutableArray (com.landawn.abacus.util.ImmutableArray)
An immutable wrapper around an array that provides read-only access to its elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ImmutableArray<T>
-
Signature:
public static <T> ImmutableArray<T> of(final T e1) - Summary: Creates an ImmutableArray containing a single element.
-
Parameters:
-
e1(T) — the element to be stored in the array
-
- Returns: an ImmutableArray containing the specified element
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2) - Summary: Creates an ImmutableArray containing two elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3) - Summary: Creates an ImmutableArray containing three elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4) - Summary: Creates an ImmutableArray containing four elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5) - Summary: Creates an ImmutableArray containing five elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5, final T e6) - Summary: Creates an ImmutableArray containing six elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element -
e6(T) — the sixth element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5, final T e6, final T e7) - Summary: Creates an ImmutableArray containing seven elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element -
e6(T) — the sixth element -
e7(T) — the seventh element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5, final T e6, final T e7, final T e8) - Summary: Creates an ImmutableArray containing eight elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element -
e6(T) — the sixth element -
e7(T) — the seventh element -
e8(T) — the eighth element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5, final T e6, final T e7, final T e8, final T e9) - Summary: Creates an ImmutableArray containing nine elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element -
e6(T) — the sixth element -
e7(T) — the seventh element -
e8(T) — the eighth element -
e9(T) — the ninth element
-
- Returns: an ImmutableArray containing the specified elements in order
-
Signature:
public static <T> ImmutableArray<T> of(final T e1, final T e2, final T e3, final T e4, final T e5, final T e6, final T e7, final T e8, final T e9, final T e10) - Summary: Creates an ImmutableArray containing ten elements.
-
Parameters:
-
e1(T) — the first element -
e2(T) — the second element -
e3(T) — the third element -
e4(T) — the fourth element -
e5(T) — the fifth element -
e6(T) — the sixth element -
e7(T) — the seventh element -
e8(T) — the eighth element -
e9(T) — the ninth element -
e10(T) — the tenth element
-
- Returns: an ImmutableArray containing the specified elements in order
copyOf(...) -> ImmutableArray<T>
-
Signature:
public static <T> ImmutableArray<T> copyOf(final T[] elements) - Summary: Creates an ImmutableArray by making a defensive copy of the specified array.
-
Parameters:
-
elements(T[]) — the array whose elements are to be copied
-
- Returns: an ImmutableArray containing a copy of the specified array's elements, or an empty ImmutableArray if the input is null
wrap(...) -> ImmutableArray<T>
-
Signature:
@Deprecated @Beta public static <T> ImmutableArray<T> wrap(final T[] elements) - Summary: Wraps the provided array into an ImmutableArray without copying.
-
Contract:
- <p> <strong> Warning: </strong> This method should be used with extreme caution and only when you can guarantee that the provided array will not be modified after wrapping.
-
Parameters:
-
elements(T[]) — the array to be wrapped
-
- Returns: an ImmutableArray backed by the specified array
Public Instance Methods
length(...) -> int
-
Signature:
public int length() - Summary: Returns the number of elements in this array.
-
Parameters:
- (none)
- Returns: the length of this array
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if this array contains no elements.
-
Contract:
- Returns {@code true} if this array contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this array has length 0, {@code false} otherwise
get(...) -> T
-
Signature:
public T get(final int index) - Summary: Returns the element at the specified position in this array.
-
Parameters:
-
index(int) — the index of the element to return (zero-based)
-
- Returns: the element at the specified position
indexOf(...) -> int
-
Signature:
public int indexOf(final T valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this array, or -1 if this array does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this array, or -1 if this array does not contain the element.
-
Parameters:
-
valueToFind(T) — the element to search for
-
- Returns: the index of the first occurrence of the element, or -1 if not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final T valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this array, or -1 if this array does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this array, or -1 if this array does not contain the element.
-
Parameters:
-
valueToFind(T) — the element to search for
-
- Returns: the index of the last occurrence of the element, or -1 if not found
contains(...) -> boolean
-
Signature:
public boolean contains(final T valueToFind) - Summary: Returns {@code true} if this array contains the specified element.
-
Contract:
- Returns {@code true} if this array contains the specified element.
-
Parameters:
-
valueToFind(T) — the element whose presence is to be tested
-
- Returns: {@code true} if this array contains the specified element
copy(...) -> ImmutableArray<T>
-
Signature:
public ImmutableArray<T> copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new ImmutableArray containing the elements from the specified range of this array.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new ImmutableArray containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > length(), or fromIndex > toIndex
-
asList(...) -> ImmutableList<T>
-
Signature:
public ImmutableList<T> asList() - Summary: Returns an immutable view of this array as a list.
-
Parameters:
- (none)
- Returns: an ImmutableList view of this array
iterator(...) -> ObjIterator<T>
-
Signature:
@Override public ObjIterator<T> iterator() - Summary: Returns an iterator over the elements in this array in proper sequence.
-
Parameters:
- (none)
- Returns: an iterator over the elements in this array
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Returns a sequential Stream with this array as its source.
-
Parameters:
- (none)
- Returns: a Stream over the elements in this array
forEach(...) -> void
-
Signature:
@Override public void forEach(final Consumer<? super T> consumer) throws IllegalArgumentException - Summary: Performs the given action for each element of the array in order.
-
Parameters:
-
consumer(Consumer<? super T>) — the action to be performed for each element
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified consumer is null
-
foreach(...) -> void
-
Signature:
@Beta public <E extends Exception> void foreach(final Throwables.Consumer<? super T, E> consumer) throws IllegalArgumentException, E - Summary: Performs the given action for each element of the array in order.
-
Parameters:
-
consumer(Throwables.Consumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified consumer is null -
E— if the consumer throws an exception
-
foreachIndexed(...) -> void
-
Signature:
@Beta public <E extends Exception> void foreachIndexed(final Throwables.IntObjConsumer<? super T, E> consumer) throws IllegalArgumentException, E - Summary: Performs the given action for each element of the array, providing both the index and the element to the consumer.
-
Contract:
- This is useful when you need to know the position of each element during iteration.
-
Parameters:
-
consumer(Throwables.IntObjConsumer<? super T, E>) — a BiConsumer that accepts the index and the element
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified consumer is null -
E— if the consumer throws an exception
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this array.
-
Parameters:
- (none)
- Returns: a hash code value for this array
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this ImmutableArray with the specified object for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also an ImmutableArray and both arrays contain the same elements in the same order.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this array
-
- Returns: {@code true} if the specified object is equal to this array
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this array.
-
Parameters:
- (none)
- Returns: a string representation of this array
Class ImmutableBiMap (com.landawn.abacus.util.ImmutableBiMap)
An immutable bidirectional map ( {@link BiMap} ) implementation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableBiMap<K, V>
-
Signature:
@SuppressWarnings("unchecked") public static <K, V> ImmutableBiMap<K, V> empty() - Summary: Returns a shared empty {@code ImmutableBiMap} .
-
Parameters:
- (none)
- Returns: a shared empty {@code ImmutableBiMap} instance
of(...) -> ImmutableBiMap<K, V>
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1) - Summary: Returns an {@code ImmutableBiMap} containing a single key-value mapping.
-
Parameters:
-
k1(K) — the key to be included in the map -
v1(V) — the value to be associated with {@code k1}
-
- Returns: an {@code ImmutableBiMap} containing the provided key-value pair
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Returns an {@code ImmutableBiMap} containing exactly two key-value mappings.
-
Contract:
- All keys and values must be unique as required by {@link BiMap} .
-
Parameters:
-
k1(K) — the first key -
v1(V) — the value associated with {@code k1} -
k2(K) — the second key -
v2(V) — the value associated with {@code k2}
-
- Returns: an {@code ImmutableBiMap} containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Returns an {@code ImmutableBiMap} containing exactly three key-value mappings.
-
Contract:
- All keys and values must be unique as required by {@link BiMap} .
-
Parameters:
-
k1(K) — the first key -
v1(V) — the value associated with {@code k1} -
k2(K) — the second key -
v2(V) — the value associated with {@code k2} -
k3(K) — the third key -
v3(V) — the value associated with {@code k3}
-
- Returns: an {@code ImmutableBiMap} containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Returns an ImmutableBiMap containing exactly four key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Returns an ImmutableBiMap containing exactly five key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Returns an ImmutableBiMap containing exactly six key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableBiMap -
v6(V) — the value to be associated with the sixth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Returns an ImmutableBiMap containing exactly seven key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableBiMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableBiMap -
v7(V) — the value to be associated with the seventh key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8) - Summary: Returns an ImmutableBiMap containing exactly eight key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableBiMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableBiMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableBiMap -
v8(V) — the value to be associated with the eighth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9) - Summary: Returns an ImmutableBiMap containing exactly nine key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableBiMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableBiMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableBiMap -
v8(V) — the value to be associated with the eighth key -
k9(K) — the ninth key to be included in the ImmutableBiMap -
v9(V) — the value to be associated with the ninth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
-
Signature:
public static <K, V> ImmutableBiMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9, final K k10, final V v10) - Summary: Returns an ImmutableBiMap containing exactly ten key-value mappings.
-
Contract:
- All keys and values must be unique.
- If duplicate keys or values are provided, an exception will be thrown.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableBiMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableBiMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableBiMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableBiMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableBiMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableBiMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableBiMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableBiMap -
v8(V) — the value to be associated with the eighth key -
k9(K) — the ninth key to be included in the ImmutableBiMap -
v9(V) — the value to be associated with the ninth key -
k10(K) — the tenth key to be included in the ImmutableBiMap -
v10(V) — the value to be associated with the tenth key
-
- Returns: an ImmutableBiMap containing the provided key-value pairs
copyOf(...) -> ImmutableBiMap<K, V>
-
Signature:
public static <K, V> ImmutableBiMap<K, V> copyOf(final BiMap<? extends K, ? extends V> map) - Summary: Returns an {@code ImmutableBiMap} containing the same mappings as the provided {@link BiMap} .
-
Contract:
- <p> If the provided {@code BiMap} is {@code null} or empty, this method returns {@link #empty()} .
-
Parameters:
-
map(BiMap<? extends K, ? extends V>) — the {@code BiMap} whose mappings are to be copied; may be {@code null}
-
- Returns: an {@code ImmutableBiMap} containing the same mappings as {@code map} , or {@link #empty()} if {@code map} is {@code null} or empty
wrap(...) -> ImmutableBiMap<K, V>
-
Signature:
@Beta public static <K, V> ImmutableBiMap<K, V> wrap(final BiMap<? extends K, ? extends V> map) - Summary: Wraps the provided {@link BiMap} in an {@code ImmutableBiMap} without copying its entries.
-
Contract:
- </p> <p> If the provided {@code BiMap} is {@code null} , this method returns {@link #empty()} .
-
Parameters:
-
map(BiMap<? extends K, ? extends V>) — the {@code BiMap} to wrap; may be {@code null}
-
- Returns: an {@code ImmutableBiMap} view backed by {@code map} , or {@link #empty()} if {@code map} is {@code null}
builder(...) -> Builder<K, V>
-
Signature:
public static <K, V> Builder<K, V> builder() - Summary: Creates a new {@link Builder} for constructing an {@code ImmutableBiMap} .
-
Contract:
- This is useful when the number of entries is not known at compile time or when entries are added conditionally.
-
Parameters:
- (none)
- Returns: a new {@code Builder} instance for creating an {@code ImmutableBiMap}
-
Signature:
public static <K, V> Builder<K, V> builder(final BiMap<K, V> backedMap) throws IllegalArgumentException - Summary: Creates a new {@link Builder} for constructing an {@code ImmutableBiMap} using the provided {@link BiMap} as backing storage.
-
Contract:
- <p> The builder will add entries to the provided {@code BiMap} and then create an immutable view of it when {@link Builder#build()} is called.
- The given {@code BiMap} should not be modified outside the builder after this method is invoked.
-
Parameters:
-
backedMap(BiMap<K, V>) — the {@code BiMap} to be used as backing storage for the builder
-
- Returns: a new {@code Builder} instance that uses {@code backedMap} as storage
-
Throws:
-
java.lang.IllegalArgumentException— if {@code backedMap} is {@code null}
-
Public Instance Methods
getByValue(...) -> K
-
Signature:
public K getByValue(final Object value) - Summary: Returns the key to which the specified value is mapped in this {@code BiMap} , or {@code null} if this map contains no mapping for the value.
-
Contract:
- Returns the key to which the specified value is mapped in this {@code BiMap} , or {@code null} if this map contains no mapping for the value.
-
Parameters:
-
value(Object) — the value whose associated key is to be returned; may be {@code null}
-
- Returns: the key to which the specified value is mapped, or {@code null} if this map contains no mapping for the value
inverted(...) -> ImmutableBiMap<V, K>
-
Signature:
public ImmutableBiMap<V, K> inverted() - Summary: Returns an inverted view of this {@code ImmutableBiMap} , in which each value of this map becomes a key, and each key becomes the corresponding value.
-
Parameters:
- (none)
- Returns: an {@code ImmutableBiMap} view where keys and values are swapped
Class Builder (com.landawn.abacus.util.ImmutableBiMap.Builder)
A builder for creating {@link ImmutableBiMap} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> put(final K key, final V value) - Summary: Associates the specified value with the specified key in the map being built.
-
Contract:
- If the map previously contained a mapping for the key, the old value is replaced.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
value(V) — the value to be associated with the specified key
-
- Returns: this builder instance, for method chaining
putAll(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> putAll(final Map<? extends K, ? extends V> m) - Summary: Copies all mappings from the specified map into the map being built.
-
Contract:
- <p> If the provided map is {@code null} or empty, this method has no effect.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the map whose mappings are to be added; may be {@code null} or empty
-
- Returns: this builder instance, for method chaining
build(...) -> ImmutableBiMap<K, V>
-
Signature:
public ImmutableBiMap<K, V> build() - Summary: Builds and returns an {@link ImmutableBiMap} containing all entries added to this builder.
-
Contract:
- <p> After calling this method, the builder should generally not be used further, as the returned {@code ImmutableBiMap} may be backed directly by the builder's internal {@code BiMap} storage.
-
Parameters:
- (none)
- Returns: a new {@code ImmutableBiMap} containing all entries added to this builder
Class ImmutableCollection (com.landawn.abacus.util.ImmutableCollection)
ImmutableCollection is an abstract base class for immutable collection implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> ImmutableCollection<E>
-
Signature:
@Beta public static <E> ImmutableCollection<E> wrap(final Collection<? extends E> c) - Summary: Wraps the given collection into an ImmutableCollection.
-
Contract:
- If the given collection is {@code null} , an empty ImmutableList is returned.
- If the given collection is already an instance of ImmutableCollection, it is directly returned.
-
Parameters:
-
c(Collection<? extends E>) — the collection to be wrapped into an ImmutableCollection
-
- Returns: an ImmutableCollection that contains the elements of the given collection
Public Instance Methods
add(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean add(final E e) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
e(E) — the element to add (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
addAll(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean addAll(final Collection<? extends E> newElements) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
newElements(Collection<? extends E>) — the collection of elements to add (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
remove(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean remove(final Object object) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
object(Object) — the element to remove (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
removeIf(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean removeIf(final Predicate<? super E> filter) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
filter(Predicate<? super E>) — the predicate to use for filtering (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
removeAll(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean removeAll(final Collection<?> oldElements) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
oldElements(Collection<?>) — the collection of elements to remove (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
retainAll(...) -> boolean
-
Signature:
@Deprecated @Override public final boolean retainAll(final Collection<?> elementsToKeep) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
-
elementsToKeep(Collection<?>) — the collection of elements to retain (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
clear(...) -> void
-
Signature:
@Deprecated @Override public final void clear() throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableCollection.
-
Parameters:
- (none)
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: Returns {@code true} if this collection contains the specified element.
-
Contract:
- Returns {@code true} if this collection contains the specified element.
- More formally, returns {@code true} if and only if this collection contains at least one element {@code e} such that {@code (valueToFind==null ?
-
Parameters:
-
valueToFind(Object) — element whose presence in this collection is to be tested
-
- Returns: {@code true} if this collection contains the specified element
iterator(...) -> ObjIterator<E>
-
Signature:
@Override public ObjIterator<E> iterator() - Summary: Returns an iterator over the elements in this collection.
-
Parameters:
- (none)
- Returns: an ObjIterator over the elements in this collection
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this collection.
-
Contract:
- If this collection contains more than {@code Integer.MAX_VALUE} elements, returns {@code Integer.MAX_VALUE} .
-
Parameters:
- (none)
- Returns: the number of elements in this collection
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Returns an array containing all of the elements in this collection.
-
Parameters:
- (none)
- Returns: an array containing all of the elements in this collection
-
Signature:
@Override public <T> T[] toArray(final T[] a) - Summary: Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
-
Contract:
- If the collection fits in the specified array, it is returned therein.
- <p> If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to {@code null} .
-
Parameters:
-
a(T[]) — the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose
-
- Returns: an array containing all of the elements in this collection
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares the specified object with this collection for equality.
-
Contract:
- Returns {@code true} if the specified object is also a collection, the two collections have the same size, and every member of the specified collection is contained in this collection (or equivalently, every member of this collection is contained in the specified collection).
-
Parameters:
-
obj(Object) — the object to be compared for equality with this collection
-
- Returns: {@code true} if the specified object is equal to this collection
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this collection.
-
Parameters:
- (none)
- Returns: the hash code value for this collection
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this collection.
-
Parameters:
- (none)
- Returns: a string representation of this collection
Class ImmutableEntry (com.landawn.abacus.util.ImmutableEntry)
An immutable implementation of {@link Map.Entry} that represents a key-value pair that cannot be modified after creation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ImmutableEntry<K, V>
-
Signature:
public static <K, V> ImmutableEntry<K, V> of(final K key, final V value) - Summary: Creates an ImmutableEntry with the specified key and value.
-
Parameters:
-
key(K) — the key for this entry, may be null -
value(V) — the value for this entry, may be null
-
- Returns: a new ImmutableEntry containing the specified key-value pair
copyOf(...) -> ImmutableEntry<K, V>
-
Signature:
public static <K, V> ImmutableEntry<K, V> copyOf(final Map.Entry<? extends K, ? extends V> entry) - Summary: Creates an ImmutableEntry by copying the key and value from an existing Map.Entry.
-
Contract:
- <p> If the provided entry contains {@code null} key or value, the ImmutableEntry will also contain {@code null} for those fields.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Integer> map = new HashMap<>(); map.put("count", 100); Map.Entry<String, Integer> mutableEntry = map.entrySet().iterator().next(); ImmutableEntry<String, Integer> immutableCopy = ImmutableEntry.copyOf(mutableEntry); // Original entry can be modified (if supported), but copy remains unchanged map.put("count", 200); System.out.println(immutableCopy.getValue()); // still prints: 100 } </pre>
-
Parameters:
-
entry(Map.Entry<? extends K, ? extends V>) — the entry to copy, must not be null
-
- Returns: a new ImmutableEntry with the same key and value as the provided entry
Public Instance Methods
setValue(...) -> V
-
Signature:
@Deprecated @Override public V setValue(final V v) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableEntry.
-
Parameters:
-
v(V) — the new value to be stored (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this entry is immutable
-
Class ImmutableList (com.landawn.abacus.util.ImmutableList)
An immutable, thread-safe implementation of the {@link List} interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableList<E>
-
Signature:
public static <E> ImmutableList<E> empty() - Summary: Returns an empty ImmutableList.
-
Parameters:
- (none)
- Returns: an empty ImmutableList instance.
of(...) -> ImmutableList<E>
-
Signature:
public static <E> ImmutableList<E> of(final E e1) - Summary: Returns an ImmutableList containing a single element.
-
Parameters:
-
e1(E) — the single element to be contained in the ImmutableList.
-
- Returns: an ImmutableList containing only the specified element.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2) - Summary: Returns an ImmutableList containing exactly two elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3) - Summary: Returns an ImmutableList containing exactly three elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4) - Summary: Returns an ImmutableList containing exactly four elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5) - Summary: Returns an ImmutableList containing exactly five elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6) - Summary: Returns an ImmutableList containing exactly six elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7) - Summary: Returns an ImmutableList containing exactly seven elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8) - Summary: Returns an ImmutableList containing exactly eight elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9) - Summary: Returns an ImmutableList containing exactly nine elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element. -
e9(E) — the ninth element.
-
- Returns: an ImmutableList containing the specified elements in order.
-
Signature:
public static <E> ImmutableList<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9, final E e10) - Summary: Returns an ImmutableList containing exactly ten elements in the order provided.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element. -
e9(E) — the ninth element. -
e10(E) — the tenth element.
-
- Returns: an ImmutableList containing the specified elements in order.
copyOf(...) -> ImmutableList<E>
-
Signature:
public static <E> ImmutableList<E> copyOf(E[] elements) - Summary: Returns an {@code ImmutableList} containing the elements of the specified array.
-
Parameters:
-
elements(E[]) — the array whose elements are to be placed into the {@code ImmutableList} ;
-
- Returns: an {@code ImmutableList} containing the elements of {@code elements}
- See also: #copyOf(Collection)
-
Signature:
public static <E> ImmutableList<E> copyOf(final Collection<? extends E> c) - Summary: Returns an ImmutableList containing all elements from the provided collection.
-
Contract:
- If the provided collection is already an ImmutableList, it is returned directly without copying.
- If the collection is {@code null} or empty, an empty ImmutableList is returned.
-
Parameters:
-
c(Collection<? extends E>) — the collection whose elements are to be placed into the ImmutableList.
-
- Returns: an ImmutableList containing all elements from the collection, or the same instance if already an ImmutableList.
wrap(...) -> ImmutableList<E>
-
Signature:
@Beta public static <E> ImmutableList<E> wrap(final List<? extends E> list) - Summary: Wraps the provided list into an ImmutableList without copying the elements.
-
Contract:
- If the provided list is already an ImmutableList, it is returned directly.
- If the list is {@code null} , an empty ImmutableList is returned.
-
Parameters:
-
list(List<? extends E>) — the list to be wrapped into an ImmutableList.
-
- Returns: an ImmutableList view of the provided list, or the same instance if already an ImmutableList.
-
Signature:
@Deprecated public static <E> ImmutableCollection<E> wrap(final Collection<? extends E> c) throws UnsupportedOperationException - Summary: This method is deprecated and will always throw an UnsupportedOperationException.
-
Parameters:
-
c(Collection<? extends E>) — the collection to wrap.
-
- Returns: never returns normally.
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
builder(...) -> Builder<E>
-
Signature:
public static <E> Builder<E> builder() - Summary: Creates a new Builder for constructing an ImmutableList.
-
Contract:
- This is useful when the number of elements is not known at compile time.
-
Parameters:
- (none)
- Returns: a new Builder instance for creating an ImmutableList.
-
Signature:
public static <E> Builder<E> builder(final List<E> holder) - Summary: Creates a new Builder for constructing an ImmutableList using the provided list as storage.
-
Contract:
- Note that the provided list should not be modified outside the builder after this call.
-
Parameters:
-
holder(List<E>) — the list to be used as the backing storage for the Builder.
-
- Returns: a new Builder instance that will use the provided list.
Public Instance Methods
get(...) -> E
-
Signature:
@Override public E get(final int index) - Summary: Returns the element at the specified position in this list.
-
Contract:
- The index must be valid (between 0 inclusive and size() exclusive).
-
Parameters:
-
index(int) — the index of the element to return (0-based).
-
- Returns: the element at the specified position in this list.
- See also: List#get(int)
indexOf(...) -> int
-
Signature:
@Override public int indexOf(final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
- If multiple equal elements exist, the index of the first one is returned.
-
Parameters:
-
valueToFind(Object) — the element to search for, may be null.
-
- Returns: the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
- See also: List#indexOf(Object)
lastIndexOf(...) -> int
-
Signature:
@Override public int lastIndexOf(final Object valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
- If multiple equal elements exist, the index of the last one is returned.
-
Parameters:
-
valueToFind(Object) — the element to search for, may be null.
-
- Returns: the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
- See also: List#lastIndexOf(Object)
listIterator(...) -> ImmutableListIterator<E>
-
Signature:
@Override public ImmutableListIterator<E> listIterator() - Summary: Returns an immutable list iterator over the elements in this list in proper sequence.
-
Contract:
- The returned iterator does not support the remove() operation and will throw UnsupportedOperationException if remove() is called.
-
Parameters:
- (none)
- Returns: an immutable list iterator over the elements in this list in proper sequence.
- See also: List#listIterator()
-
Signature:
@Override public ImmutableListIterator<E> listIterator(final int index) - Summary: Returns an immutable list iterator over the elements in this list in proper sequence, starting at the specified position in the list.
-
Parameters:
-
index(int) — the index of the first element to be returned from the list iterator (by a call to next()).
-
- Returns: an immutable list iterator over the elements in this list starting at the specified position.
- See also: List#listIterator(int)
subList(...) -> ImmutableList<E>
-
Signature:
@Override public ImmutableList<E> subList(final int fromIndex, final int toIndex) - Summary: Returns an immutable view of the portion of this list between the specified fromIndex (inclusive) and toIndex (exclusive).
-
Contract:
- <p> The semantics of the sublist are consistent with List.subList(), including the behavior when fromIndex equals toIndex (returns an empty list).
-
Parameters:
-
fromIndex(int) — the low endpoint (inclusive) of the subList. -
toIndex(int) — the high endpoint (exclusive) of the subList.
-
- Returns: an immutable view of the specified range within this list.
- See also: List#subList(int, int)
addAll(...) -> boolean
-
Signature:
@Deprecated @Override public boolean addAll(final int index, final Collection<? extends E> newElements) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
index(int) — ignored. -
newElements(Collection<? extends E>) — ignored.
-
- Returns: never returns normally.
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
set(...) -> E
-
Signature:
@Deprecated @Override public E set(final int index, final E element) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
index(int) — ignored. -
element(E) — ignored.
-
- Returns: never returns normally.
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
add(...) -> void
-
Signature:
@Deprecated @Override public void add(final int index, final E element) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
index(int) — ignored. -
element(E) — ignored.
-
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
remove(...) -> E
-
Signature:
@Deprecated @Override public E remove(final int index) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
index(int) — ignored.
-
- Returns: never returns normally.
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
replaceAll(...) -> void
-
Signature:
@Deprecated @Override public void replaceAll(final UnaryOperator<E> operator) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
operator(UnaryOperator<E>) — ignored.
-
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
sort(...) -> void
-
Signature:
@Deprecated @Override public void sort(final Comparator<? super E> c) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableList.
-
Parameters:
-
c(Comparator<? super E>) — ignored.
-
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
reversed(...) -> ImmutableList<E>
-
Signature:
public ImmutableList<E> reversed() - Summary: Returns a view of this immutable list in reverse order.
-
Contract:
- <p> If this list has one or zero elements, this same instance is returned.
-
Parameters:
- (none)
- Returns: an immutable view of this list with elements in reverse order.
Class Builder (com.landawn.abacus.util.ImmutableList.Builder)
A builder for creating ImmutableList instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> Builder<E>
-
Signature:
public Builder<E> add(final E element) - Summary: Adds a single element to the list being built.
-
Parameters:
-
element(E) — the element to add, may be null.
-
- Returns: this builder instance for method chaining.
-
Signature:
@SafeVarargs public final Builder<E> add(final E... elements) - Summary: Adds all provided elements to the list being built.
-
Contract:
- If the array is {@code null} or empty, no elements are added.
-
Parameters:
-
elements(E[]) — the elements to add, may be {@code null} or empty.
-
- Returns: this builder instance for method chaining.
addAll(...) -> Builder<E>
-
Signature:
public Builder<E> addAll(final Collection<? extends E> c) - Summary: Adds all elements from the specified collection to the list being built.
-
Contract:
- If the collection is {@code null} or empty, no elements are added.
-
Parameters:
-
c(Collection<? extends E>) — the collection containing elements to add, may be {@code null} or empty.
-
- Returns: this builder instance for method chaining.
-
Signature:
public Builder<E> addAll(final Iterator<? extends E> iter) - Summary: Adds all elements from the specified iterator to the list being built.
-
Contract:
- If the iterator is {@code null} or has no elements, no elements are added.
-
Parameters:
-
iter(Iterator<? extends E>) — the iterator over elements to add, may be null.
-
- Returns: this builder instance for method chaining.
build(...) -> ImmutableList<E>
-
Signature:
public ImmutableList<E> build() - Summary: Builds and returns an ImmutableList containing all elements added to this builder.
-
Contract:
- After calling this method, the builder should not be used further as the created ImmutableList may be backed by the builder's internal storage.
-
Parameters:
- (none)
- Returns: a new ImmutableList containing all added elements in the order they were added.
Class ImmutableListIterator (com.landawn.abacus.util.ImmutableListIterator)
An immutable implementation of {@link ListIterator} that provides read-only iteration over list elements in both forward and backward directions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableListIterator<T>
-
Signature:
public static <T> ImmutableListIterator<T> empty() - Summary: Returns an empty ImmutableListIterator.
-
Parameters:
- (none)
- Returns: an empty ImmutableListIterator instance
of(...) -> ImmutableListIterator<T>
-
Signature:
public static <T> ImmutableListIterator<T> of(final ListIterator<? extends T> iter) - Summary: Creates an ImmutableListIterator that wraps the provided ListIterator.
-
Contract:
- <p> If the provided iterator is {@code null} , an empty ImmutableListIterator is returned.
- If the provided iterator is already an ImmutableListIterator, it is returned as-is.
-
Parameters:
-
iter(ListIterator<? extends T>) — the ListIterator to wrap, may be null
-
- Returns: an ImmutableListIterator wrapping the provided iterator, or empty if iter is null
Public Instance Methods
set(...) -> void
-
Signature:
@Deprecated @Override public void set(final T e) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableListIterator.
-
Contract:
- <p> Use a mutable ListIterator if you need to modify elements during iteration.
-
Parameters:
-
e(T) — the element with which to replace the last element returned by next or previous
-
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this is an immutable iterator
-
add(...) -> void
-
Signature:
@Deprecated @Override public void add(final T e) throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableListIterator.
-
Contract:
- <p> Use a mutable ListIterator if you need to add elements during iteration.
-
Parameters:
-
e(T) — the element to insert
-
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this is an immutable iterator
-
Class ImmutableMap (com.landawn.abacus.util.ImmutableMap)
An immutable, thread-safe implementation of the Map interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableMap<K, V>
-
Signature:
public static <K, V> ImmutableMap<K, V> empty() - Summary: Returns an empty ImmutableMap.
-
Parameters:
- (none)
- Returns: an empty ImmutableMap instance.
of(...) -> ImmutableMap<K, V>
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1) - Summary: Returns an ImmutableMap containing a single key-value mapping.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value.
-
- Returns: an ImmutableMap containing only the specified key-value pair.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Returns an ImmutableMap containing exactly two key-value mappings.
-
Contract:
- If the same key is provided twice, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Returns an ImmutableMap containing exactly three key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Returns an ImmutableMap containing exactly four key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Returns an ImmutableMap containing exactly five key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Returns an ImmutableMap containing exactly six key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value. -
k6(K) — the sixth key. -
v6(V) — the sixth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Returns an ImmutableMap containing exactly seven key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value. -
k6(K) — the sixth key. -
v6(V) — the sixth value. -
k7(K) — the seventh key. -
v7(V) — the seventh value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
@SuppressWarnings("deprecation") public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8) - Summary: Returns an ImmutableMap containing exactly eight key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value. -
k6(K) — the sixth key. -
v6(V) — the sixth value. -
k7(K) — the seventh key. -
v7(V) — the seventh value. -
k8(K) — the eighth key. -
v8(V) — the eighth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
@SuppressWarnings("deprecation") public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9) - Summary: Returns an ImmutableMap containing exactly nine key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value. -
k6(K) — the sixth key. -
v6(V) — the sixth value. -
k7(K) — the seventh key. -
v7(V) — the seventh value. -
k8(K) — the eighth key. -
v8(V) — the eighth value. -
k9(K) — the ninth key. -
v9(V) — the ninth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
-
Signature:
@SuppressWarnings("deprecation") public static <K, V> ImmutableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9, final K k10, final V v10) - Summary: Returns an ImmutableMap containing exactly ten key-value mappings.
-
Contract:
- If duplicate keys are provided, an IllegalArgumentException may be thrown.
-
Parameters:
-
k1(K) — the first key. -
v1(V) — the first value. -
k2(K) — the second key. -
v2(V) — the second value. -
k3(K) — the third key. -
v3(V) — the third value. -
k4(K) — the fourth key. -
v4(V) — the fourth value. -
k5(K) — the fifth key. -
v5(V) — the fifth value. -
k6(K) — the sixth key. -
v6(V) — the sixth value. -
k7(K) — the seventh key. -
v7(V) — the seventh value. -
k8(K) — the eighth key. -
v8(V) — the eighth value. -
k9(K) — the ninth key. -
v9(V) — the ninth value. -
k10(K) — the tenth key. -
v10(V) — the tenth value.
-
- Returns: an ImmutableMap containing the specified key-value pairs.
copyOf(...) -> ImmutableMap<K, V>
-
Signature:
public static <K, V> ImmutableMap<K, V> copyOf(final Map<? extends K, ? extends V> map) - Summary: Returns an ImmutableMap containing all mappings from the provided map.
-
Contract:
- If the provided map is already an ImmutableMap, it is returned directly without copying.
- If the map is {@code null} or empty, an empty ImmutableMap is returned.
- The iteration order is preserved if the source map is a LinkedHashMap or SortedMap.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose mappings are to be placed in the ImmutableMap.
-
- Returns: an ImmutableMap containing all mappings from the source map, or the same instance if already an ImmutableMap.
wrap(...) -> ImmutableMap<K, V>
-
Signature:
@Beta public static <K, V> ImmutableMap<K, V> wrap(final Map<? extends K, ? extends V> map) - Summary: Wraps the provided map into an ImmutableMap without copying the entries.
-
Contract:
- If the provided map is already an ImmutableMap, it is returned directly.
- If the map is {@code null} , an empty ImmutableMap is returned.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map to be wrapped into an ImmutableMap.
-
- Returns: an ImmutableMap view of the provided map, or the same instance if already an ImmutableMap.
builder(...) -> Builder<K, V>
-
Signature:
public static <K, V> Builder<K, V> builder() - Summary: Creates a new Builder for constructing an ImmutableMap.
-
Contract:
- This is useful when the number of entries is not known at compile time.
-
Parameters:
- (none)
- Returns: a new Builder instance for creating an ImmutableMap.
-
Signature:
public static <K, V> Builder<K, V> builder(final Map<K, V> backedMap) throws IllegalArgumentException - Summary: Creates a new Builder for constructing an ImmutableMap using the provided map as storage.
-
Contract:
- Note that the provided map should not be modified outside the builder after this call.
-
Parameters:
-
backedMap(Map<K, V>) — the map to be used as the backing storage for the Builder.
-
- Returns: a new Builder instance that will use the provided map.
-
Throws:
-
java.lang.IllegalArgumentException— if backedMap is null.
-
Public Instance Methods
- (none)
Class Builder (com.landawn.abacus.util.ImmutableMap.Builder)
A builder for creating ImmutableMap instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> put(final K key, final V value) - Summary: Associates the specified value with the specified key in the map being built.
-
Contract:
- If the map previously contained a mapping for the key, the old value is replaced.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated. -
value(V) — the value to be associated with the specified key.
-
- Returns: this builder instance for method chaining.
putAll(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> putAll(final Map<? extends K, ? extends V> m) - Summary: Copies all of the mappings from the specified map to the map being built.
-
Contract:
- The behavior is undefined if the specified map is modified while this operation is in progress.
- If the map is {@code null} or empty, no entries are added.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the map whose mappings are to be added, may be {@code null} or empty.
-
- Returns: this builder instance for method chaining.
build(...) -> ImmutableMap<K, V>
-
Signature:
public ImmutableMap<K, V> build() - Summary: Builds and returns an ImmutableMap containing all entries added to this builder.
-
Contract:
- After calling this method, the builder should not be used further as the created ImmutableMap may be backed by the builder's internal storage.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ImmutableMap<String, Integer> map = builder.build(); // builder should not be used after this point } </pre>
-
Parameters:
- (none)
- Returns: a new ImmutableMap containing all added entries.
Class ImmutableNavigableMap (com.landawn.abacus.util.ImmutableNavigableMap)
An immutable, thread-safe implementation of the NavigableMap interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableNavigableMap<K, V>
-
Signature:
public static <K, V> ImmutableNavigableMap<K, V> empty() - Summary: Returns an empty ImmutableNavigableMap.
-
Parameters:
- (none)
- Returns: an empty ImmutableNavigableMap
of(...) -> ImmutableNavigableMap<K, V>
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pair.
-
Contract:
- The key must implement Comparable to determine its natural ordering.
-
Parameters:
-
k1(K) — the key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pair
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableNavigableMap -
v6(V) — the value to be associated with the sixth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableNavigableMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableNavigableMap -
v7(V) — the value to be associated with the seventh key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableNavigableMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableNavigableMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableNavigableMap -
v8(V) — the value to be associated with the eighth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableNavigableMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableNavigableMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableNavigableMap -
v8(V) — the value to be associated with the eighth key -
k9(K) — the ninth key to be included in the ImmutableNavigableMap -
v9(V) — the value to be associated with the ninth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9, final K k10, final V v10) - Summary: Returns an ImmutableNavigableMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableNavigableMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableNavigableMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableNavigableMap -
v3(V) — the value to be associated with the third key -
k4(K) — the fourth key to be included in the ImmutableNavigableMap -
v4(V) — the value to be associated with the fourth key -
k5(K) — the fifth key to be included in the ImmutableNavigableMap -
v5(V) — the value to be associated with the fifth key -
k6(K) — the sixth key to be included in the ImmutableNavigableMap -
v6(V) — the value to be associated with the sixth key -
k7(K) — the seventh key to be included in the ImmutableNavigableMap -
v7(V) — the value to be associated with the seventh key -
k8(K) — the eighth key to be included in the ImmutableNavigableMap -
v8(V) — the value to be associated with the eighth key -
k9(K) — the ninth key to be included in the ImmutableNavigableMap -
v9(V) — the value to be associated with the ninth key -
k10(K) — the tenth key to be included in the ImmutableNavigableMap -
v10(V) — the value to be associated with the tenth key
-
- Returns: an ImmutableNavigableMap containing the provided key-value pairs
copyOf(...) -> ImmutableNavigableMap<K, V>
-
Signature:
public static <K, V> ImmutableNavigableMap<K, V> copyOf(final Map<? extends K, ? extends V> map) throws UnsupportedOperationException - Summary: Returns an ImmutableNavigableMap containing the same mappings as the provided Map.
-
Contract:
- If the provided Map is already an instance of ImmutableNavigableMap, it is directly returned.
- If the provided Map is {@code null} or empty, an empty ImmutableNavigableMap is returned.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the Map whose mappings are to be placed in the ImmutableNavigableMap
-
- Returns: an ImmutableNavigableMap containing the same mappings as the provided Map, or the same instance if already an ImmutableNavigableMap
-
Throws:
-
java.lang.UnsupportedOperationException
-
wrap(...) -> ImmutableNavigableMap<K, V>
-
Signature:
@Beta public static <K, V> ImmutableNavigableMap<K, V> wrap(final NavigableMap<? extends K, ? extends V> navigableMap) - Summary: Returns an ImmutableNavigableMap that is backed by the provided NavigableMap.
-
Contract:
- If the provided NavigableMap is already an instance of ImmutableNavigableMap, it is directly returned.
- If the NavigableMap is {@code null} , an empty ImmutableNavigableMap is returned.
-
Parameters:
-
navigableMap(NavigableMap<? extends K, ? extends V>) — the NavigableMap to be used as the base for the ImmutableNavigableMap
-
- Returns: an ImmutableNavigableMap that is backed by the provided NavigableMap
-
Signature:
@Deprecated public static <K, V> ImmutableSortedMap<K, V> wrap(final SortedMap<? extends K, ? extends V> sortedMap) throws UnsupportedOperationException - Summary: This method is deprecated and will throw an UnsupportedOperationException if used.
-
Contract:
- This method is deprecated and will throw an UnsupportedOperationException if used.
-
Parameters:
-
sortedMap(SortedMap<? extends K, ? extends V>) — ignored
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
Public Instance Methods
lowerEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> lowerEntry(final K key) - Summary: Returns a key-value mapping associated with the greatest key strictly less than the given key, or {@code null} if there is no such key.
-
Contract:
- Returns a key-value mapping associated with the greatest key strictly less than the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: an entry with the greatest key less than {@code key} , or {@code null} if there is no such key
lowerKey(...) -> K
-
Signature:
@Override public K lowerKey(final K key) - Summary: Returns the greatest key strictly less than the given key, or {@code null} if there is no such key.
-
Contract:
- Returns the greatest key strictly less than the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: the greatest key less than {@code key} , or {@code null} if there is no such key
floorEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> floorEntry(final K key) - Summary: Returns a key-value mapping associated with the greatest key less than or equal to the given key, or {@code null} if there is no such key.
-
Contract:
- Returns a key-value mapping associated with the greatest key less than or equal to the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: an entry with the greatest key less than or equal to {@code key} , or {@code null} if there is no such key
floorKey(...) -> K
-
Signature:
@Override public K floorKey(final K key) - Summary: Returns the greatest key less than or equal to the given key, or {@code null} if there is no such key.
-
Contract:
- Returns the greatest key less than or equal to the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: the greatest key less than or equal to {@code key} , or {@code null} if there is no such key
ceilingEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> ceilingEntry(final K key) - Summary: Returns a key-value mapping associated with the least key greater than or equal to the given key, or {@code null} if there is no such key.
-
Contract:
- Returns a key-value mapping associated with the least key greater than or equal to the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: an entry with the least key greater than or equal to {@code key} , or {@code null} if there is no such key
ceilingKey(...) -> K
-
Signature:
@Override public K ceilingKey(final K key) - Summary: Returns the least key greater than or equal to the given key, or {@code null} if there is no such key.
-
Contract:
- Returns the least key greater than or equal to the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: the least key greater than or equal to {@code key} , or {@code null} if there is no such key
higherEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> higherEntry(final K key) - Summary: Returns a key-value mapping associated with the least key strictly greater than the given key, or {@code null} if there is no such key.
-
Contract:
- Returns a key-value mapping associated with the least key strictly greater than the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: an entry with the least key greater than {@code key} , or {@code null} if there is no such key
higherKey(...) -> K
-
Signature:
@Override public K higherKey(final K key) - Summary: Returns the least key strictly greater than the given key, or {@code null} if there is no such key.
-
Contract:
- Returns the least key strictly greater than the given key, or {@code null} if there is no such key.
-
Parameters:
-
key(K) — the key
-
- Returns: the least key greater than {@code key} , or {@code null} if there is no such key
firstEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> firstEntry() - Summary: Returns a key-value mapping associated with the least key in this map, or {@code null} if the map is empty.
-
Contract:
- Returns a key-value mapping associated with the least key in this map, or {@code null} if the map is empty.
-
Parameters:
- (none)
- Returns: an entry with the least key, or {@code null} if this map is empty
lastEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Override public ImmutableEntry<K, V> lastEntry() - Summary: Returns a key-value mapping associated with the greatest key in this map, or {@code null} if the map is empty.
-
Contract:
- Returns a key-value mapping associated with the greatest key in this map, or {@code null} if the map is empty.
-
Parameters:
- (none)
- Returns: an entry with the greatest key, or {@code null} if this map is empty
pollFirstEntry(...) -> Map.Entry<K, V>
-
Signature:
@Deprecated @Override public Map.Entry<K, V> pollFirstEntry() throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableNavigableMap.
-
Parameters:
- (none)
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
pollLastEntry(...) -> Map.Entry<K, V>
-
Signature:
@Deprecated @Override public Map.Entry<K, V> pollLastEntry() throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableNavigableMap.
-
Parameters:
- (none)
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
descendingMap(...) -> ImmutableNavigableMap<K, V>
-
Signature:
@Override public ImmutableNavigableMap<K, V> descendingMap() - Summary: Returns a reverse order view of the mappings contained in this map.
-
Parameters:
- (none)
- Returns: a reverse order view of this map
navigableKeySet(...) -> ImmutableNavigableSet<K>
-
Signature:
@Override public ImmutableNavigableSet<K> navigableKeySet() - Summary: Returns an immutable navigable set view of the keys contained in this map.
-
Parameters:
- (none)
- Returns: an immutable navigable set view of the keys in this map
descendingKeySet(...) -> ImmutableNavigableSet<K>
-
Signature:
@Override public ImmutableNavigableSet<K> descendingKeySet() - Summary: Returns an immutable navigable set view of the keys contained in this map in descending order.
-
Parameters:
- (none)
- Returns: an immutable navigable set view of the keys in this map in descending order
subMap(...) -> ImmutableNavigableMap<K, V>
-
Signature:
@Override public ImmutableNavigableMap<K, V> subMap(final K fromKey, final boolean fromInclusive, final K toKey, final boolean toInclusive) - Summary: Returns a view of the portion of this map whose keys range from {@code fromKey} to {@code toKey} .
-
Contract:
- If {@code fromKey} and {@code toKey} are equal, the returned map is empty unless {@code fromInclusive} and {@code toInclusive} are both {@code true} .
- <p> The returned map will throw an {@code IllegalArgumentException} if the starting key is greater than the ending key considering the order of this map's comparator.
-
Parameters:
-
fromKey(K) — low endpoint of the keys in the returned map -
fromInclusive(boolean) — {@code true} if the low endpoint is to be included in the returned view -
toKey(K) — high endpoint of the keys in the returned map -
toInclusive(boolean) — {@code true} if the high endpoint is to be included in the returned view
-
- Returns: a view of the portion of this map whose keys range from {@code fromKey} to {@code toKey}
headMap(...) -> ImmutableNavigableMap<K, V>
-
Signature:
@Override public ImmutableNavigableMap<K, V> headMap(final K toKey, final boolean inclusive) - Summary: Returns a view of the portion of this map whose keys are less than (or equal to, if {@code inclusive} is true) {@code toKey} .
-
Contract:
- Returns a view of the portion of this map whose keys are less than (or equal to, if {@code inclusive} is true) {@code toKey} .
-
Parameters:
-
toKey(K) — high endpoint of the keys in the returned map -
inclusive(boolean) — {@code true} if the high endpoint is to be included in the returned view
-
- Returns: a view of the portion of this map whose keys are less than (or equal to, if {@code inclusive} is true) {@code toKey}
tailMap(...) -> ImmutableNavigableMap<K, V>
-
Signature:
@Override public ImmutableNavigableMap<K, V> tailMap(final K fromKey, final boolean inclusive) - Summary: Returns a view of the portion of this map whose keys are greater than (or equal to, if {@code inclusive} is true) {@code fromKey} .
-
Contract:
- Returns a view of the portion of this map whose keys are greater than (or equal to, if {@code inclusive} is true) {@code fromKey} .
-
Parameters:
-
fromKey(K) — low endpoint of the keys in the returned map -
inclusive(boolean) — {@code true} if the low endpoint is to be included in the returned view
-
- Returns: a view of the portion of this map whose keys are greater than (or equal to, if {@code inclusive} is true) {@code fromKey}
Class ImmutableNavigableSet (com.landawn.abacus.util.ImmutableNavigableSet)
An immutable, thread-safe implementation of the NavigableSet interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableNavigableSet<E>
-
Signature:
public static <E> ImmutableNavigableSet<E> empty() - Summary: Returns an empty ImmutableNavigableSet.
-
Parameters:
- (none)
- Returns: an empty ImmutableNavigableSet instance
of(...) -> ImmutableNavigableSet<E>
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1) - Summary: Returns an ImmutableNavigableSet containing a single element.
-
Parameters:
-
e1(E) — the element to be contained in the set
-
- Returns: an ImmutableNavigableSet containing only the specified element
- See also: #of(Comparable, Comparable)
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2) - Summary: Returns an ImmutableNavigableSet containing exactly two elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3) - Summary: Returns an ImmutableNavigableSet containing exactly three elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4) - Summary: Returns an ImmutableNavigableSet containing exactly four elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5) - Summary: Returns an ImmutableNavigableSet containing exactly five elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6) - Summary: Returns an ImmutableNavigableSet containing exactly six elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7) - Summary: Returns an ImmutableNavigableSet containing exactly seven elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8) - Summary: Returns an ImmutableNavigableSet containing exactly eight elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9) - Summary: Returns an ImmutableNavigableSet containing exactly nine elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element -
e9(E) — the ninth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableNavigableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9, final E e10) - Summary: Returns an ImmutableNavigableSet containing exactly ten elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element -
e9(E) — the ninth element -
e10(E) — the tenth element
-
- Returns: an ImmutableNavigableSet containing the specified elements in sorted order
copyOf(...) -> ImmutableNavigableSet<E>
-
Signature:
public static <E> ImmutableNavigableSet<E> copyOf(final Collection<? extends E> c) - Summary: Returns an ImmutableNavigableSet containing the elements of the specified collection.
-
Contract:
- If the provided collection is already an instance of ImmutableNavigableSet, it is directly returned.
- If the provided collection is {@code null} or empty, an empty ImmutableNavigableSet is returned.
- <p> The elements are sorted according to their natural ordering if they implement Comparable, or a ClassCastException will be thrown if they don't.
-
Parameters:
-
c(Collection<? extends E>) — the collection whose elements are to be placed into this set
-
- Returns: an ImmutableNavigableSet containing the elements of the specified collection
wrap(...) -> ImmutableNavigableSet<E>
-
Signature:
@Beta public static <E> ImmutableNavigableSet<E> wrap(final NavigableSet<? extends E> navigableSet) - Summary: Wraps the provided NavigableSet into an ImmutableNavigableSet.
-
Contract:
- If the provided NavigableSet is already an instance of ImmutableNavigableSet, it is directly returned.
- If the provided NavigableSet is {@code null} , an empty ImmutableNavigableSet is returned.
-
Parameters:
-
navigableSet(NavigableSet<? extends E>) — the NavigableSet to be wrapped into an ImmutableNavigableSet
-
- Returns: an ImmutableNavigableSet backed by the provided NavigableSet
-
Signature:
@Deprecated public static <E> ImmutableSortedSet<E> wrap(final SortedSet<? extends E> sortedSet) throws UnsupportedOperationException - Summary: This method is deprecated and will throw an UnsupportedOperationException if used.
-
Contract:
- This method is deprecated and will throw an UnsupportedOperationException if used.
-
Parameters:
-
sortedSet(SortedSet<? extends E>) — ignored
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
Public Instance Methods
lower(...) -> E
-
Signature:
@Override public E lower(final E e) - Summary: Returns the greatest element in this set strictly less than the given element, or {@code null} if there is no such element.
-
Contract:
- Returns the greatest element in this set strictly less than the given element, or {@code null} if there is no such element.
-
Parameters:
-
e(E) — the value to match
-
- Returns: the greatest element less than {@code e} , or {@code null} if there is no such element
floor(...) -> E
-
Signature:
@Override public E floor(final E e) - Summary: Returns the greatest element in this set less than or equal to the given element, or {@code null} if there is no such element.
-
Contract:
- Returns the greatest element in this set less than or equal to the given element, or {@code null} if there is no such element.
-
Parameters:
-
e(E) — the value to match
-
- Returns: the greatest element less than or equal to {@code e} , or {@code null} if there is no such element
ceiling(...) -> E
-
Signature:
@Override public E ceiling(final E e) - Summary: Returns the least element in this set greater than or equal to the given element, or {@code null} if there is no such element.
-
Contract:
- Returns the least element in this set greater than or equal to the given element, or {@code null} if there is no such element.
-
Parameters:
-
e(E) — the value to match
-
- Returns: the least element greater than or equal to {@code e} , or {@code null} if there is no such element
higher(...) -> E
-
Signature:
@Override public E higher(final E e) - Summary: Returns the least element in this set strictly greater than the given element, or {@code null} if there is no such element.
-
Contract:
- Returns the least element in this set strictly greater than the given element, or {@code null} if there is no such element.
-
Parameters:
-
e(E) — the value to match
-
- Returns: the least element greater than {@code e} , or {@code null} if there is no such element
pollFirst(...) -> E
-
Signature:
@Deprecated @Override public E pollFirst() throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableNavigableSet.
-
Parameters:
- (none)
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
pollLast(...) -> E
-
Signature:
@Deprecated @Override public E pollLast() throws UnsupportedOperationException - Summary: This operation is not supported by ImmutableNavigableSet.
-
Parameters:
- (none)
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
descendingSet(...) -> ImmutableNavigableSet<E>
-
Signature:
@Override public ImmutableNavigableSet<E> descendingSet() - Summary: Returns a reverse order view of the elements contained in this set.
-
Parameters:
- (none)
- Returns: a reverse order view of this set
descendingIterator(...) -> ObjIterator<E>
-
Signature:
@Override public ObjIterator<E> descendingIterator() - Summary: Returns an iterator over the elements in this set, in descending order.
-
Parameters:
- (none)
- Returns: an iterator over the elements in this set, in descending order
subSet(...) -> ImmutableNavigableSet<E>
-
Signature:
@Override public ImmutableNavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) - Summary: Returns a view of the portion of this set whose elements range from {@code fromElement} to {@code toElement} .
-
Contract:
- If {@code fromInclusive} is {@code true} , the returned set includes {@code fromElement} if present.
- If {@code toInclusive} is {@code true} , the returned set includes {@code toElement} if present.
-
Parameters:
-
fromElement(E) — low endpoint of the elements in the returned set -
fromInclusive(boolean) — {@code true} if the low endpoint is to be included in the returned view -
toElement(E) — high endpoint of the elements in the returned set -
toInclusive(boolean) — {@code true} if the high endpoint is to be included in the returned view
-
- Returns: a view of the portion of this set whose elements range from {@code fromElement} to {@code toElement}
headSet(...) -> ImmutableNavigableSet<E>
-
Signature:
@Override public ImmutableNavigableSet<E> headSet(final E toElement, final boolean inclusive) - Summary: Returns a view of the portion of this set whose elements are less than (or equal to, if {@code inclusive} is true) {@code toElement} .
-
Contract:
- Returns a view of the portion of this set whose elements are less than (or equal to, if {@code inclusive} is true) {@code toElement} .
-
Parameters:
-
toElement(E) — high endpoint of the elements in the returned set -
inclusive(boolean) — {@code true} if the high endpoint is to be included in the returned view
-
- Returns: a view of the portion of this set whose elements are less than (or equal to, if {@code inclusive} is true) {@code toElement}
tailSet(...) -> ImmutableNavigableSet<E>
-
Signature:
@Override public ImmutableNavigableSet<E> tailSet(final E fromElement, final boolean inclusive) - Summary: Returns a view of the portion of this set whose elements are greater than (or equal to, if {@code inclusive} is true) {@code fromElement} .
-
Contract:
- Returns a view of the portion of this set whose elements are greater than (or equal to, if {@code inclusive} is true) {@code fromElement} .
-
Parameters:
-
fromElement(E) — low endpoint of the elements in the returned set -
inclusive(boolean) — {@code true} if the low endpoint is to be included in the returned view
-
- Returns: a view of the portion of this set whose elements are greater than (or equal to, if {@code inclusive} is true) {@code fromElement}
Class ImmutableSet (com.landawn.abacus.util.ImmutableSet)
An immutable, thread-safe implementation of the {@link Set} interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableSet<E>
-
Signature:
public static <E> ImmutableSet<E> empty() - Summary: Returns an empty ImmutableSet.
-
Parameters:
- (none)
- Returns: an empty ImmutableSet instance.
of(...) -> ImmutableSet<E>
-
Signature:
public static <E> ImmutableSet<E> of(final E e1) - Summary: Returns an ImmutableSet containing a single element.
-
Parameters:
-
e1(E) — the single element to be contained in the ImmutableSet.
-
- Returns: an ImmutableSet containing only the specified element.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2) - Summary: Returns an ImmutableSet containing up to two distinct elements.
-
Contract:
- If the two elements are equal according to their equals() method, the resulting set will contain only one element.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3) - Summary: Returns an ImmutableSet containing up to three distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4) - Summary: Returns an ImmutableSet containing up to four distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5) - Summary: Returns an ImmutableSet containing up to five distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6) - Summary: Returns an ImmutableSet containing up to six distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7) - Summary: Returns an ImmutableSet containing up to seven distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8) - Summary: Returns an ImmutableSet containing up to eight distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9) - Summary: Returns an ImmutableSet containing up to nine distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element. -
e9(E) — the ninth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
-
Signature:
public static <E> ImmutableSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9, final E e10) - Summary: Returns an ImmutableSet containing up to ten distinct elements.
-
Parameters:
-
e1(E) — the first element. -
e2(E) — the second element. -
e3(E) — the third element. -
e4(E) — the fourth element. -
e5(E) — the fifth element. -
e6(E) — the sixth element. -
e7(E) — the seventh element. -
e8(E) — the eighth element. -
e9(E) — the ninth element. -
e10(E) — the tenth element.
-
- Returns: an ImmutableSet containing the specified distinct elements.
copyOf(...) -> ImmutableSet<E>
-
Signature:
public static <E> ImmutableSet<E> copyOf(E[] elements) - Summary: Returns an {@code ImmutableSet} containing the elements of the specified array.
-
Parameters:
-
elements(E[]) — the array whose elements are to be placed into the {@code ImmutableSet} ;
-
- Returns: an {@code ImmutableSet} containing the unique elements of {@code elements}
- See also: #copyOf(Collection)
-
Signature:
public static <E> ImmutableSet<E> copyOf(final Collection<? extends E> c) - Summary: Returns an ImmutableSet containing all distinct elements from the provided collection.
-
Contract:
- If the provided collection is already an ImmutableSet, it is returned directly without copying.
- If the collection is {@code null} or empty, an empty ImmutableSet is returned.
- The iteration order is preserved if the source collection is a List, LinkedHashSet, or SortedSet.
-
Parameters:
-
c(Collection<? extends E>) — the collection whose distinct elements are to be placed into the ImmutableSet.
-
- Returns: an ImmutableSet containing all distinct elements from the collection, or the same instance if already an ImmutableSet.
wrap(...) -> ImmutableSet<E>
-
Signature:
@Beta public static <E> ImmutableSet<E> wrap(final Set<? extends E> set) - Summary: Wraps the provided set into an ImmutableSet without copying the elements.
-
Contract:
- If the provided set is already an ImmutableSet, it is returned directly.
- If the set is {@code null} , an empty ImmutableSet is returned.
-
Parameters:
-
set(Set<? extends E>) — the set to be wrapped into an ImmutableSet.
-
- Returns: an ImmutableSet view of the provided set, or the same instance if already an ImmutableSet.
-
Signature:
@Deprecated public static <E> ImmutableCollection<E> wrap(final Collection<? extends E> c) throws UnsupportedOperationException - Summary: This method is deprecated and will always throw an UnsupportedOperationException.
-
Parameters:
-
c(Collection<? extends E>) — the collection to wrap.
-
- Returns: never returns normally.
-
Throws:
-
java.lang.UnsupportedOperationException— always.
-
builder(...) -> Builder<E>
-
Signature:
public static <E> Builder<E> builder() - Summary: Creates a new Builder for constructing an ImmutableSet.
-
Contract:
- This is useful when the number of elements is not known at compile time.
-
Parameters:
- (none)
- Returns: a new Builder instance for creating an ImmutableSet.
-
Signature:
public static <E> Builder<E> builder(final Set<E> holder) - Summary: Creates a new Builder for constructing an ImmutableSet using the provided set as storage.
-
Contract:
- Note that the provided set should not be modified outside the builder after this call.
-
Parameters:
-
holder(Set<E>) — the set to be used as the backing storage for the Builder.
-
- Returns: a new Builder instance that will use the provided set.
Public Instance Methods
- (none)
Class Builder (com.landawn.abacus.util.ImmutableSet.Builder)
A builder for creating ImmutableSet instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> Builder<E>
-
Signature:
public Builder<E> add(final E element) - Summary: Adds a single element to the set being built.
-
Contract:
- If the element is already present in the set (as determined by equals()), it is not added again.
-
Parameters:
-
element(E) — the element to add, may be null.
-
- Returns: this builder instance for method chaining.
-
Signature:
@SafeVarargs public final Builder<E> add(final E... elements) - Summary: Adds all provided elements to the set being built.
-
Contract:
- If the array is {@code null} or empty, no elements are added.
-
Parameters:
-
elements(E[]) — the elements to add, may be {@code null} or empty.
-
- Returns: this builder instance for method chaining.
addAll(...) -> Builder<E>
-
Signature:
public Builder<E> addAll(final Collection<? extends E> c) - Summary: Adds all elements from the specified collection to the set being built.
-
Contract:
- If the collection is {@code null} or empty, no elements are added.
-
Parameters:
-
c(Collection<? extends E>) — the collection containing elements to add, may be {@code null} or empty.
-
- Returns: this builder instance for method chaining.
-
Signature:
public Builder<E> addAll(final Iterator<? extends E> iter) - Summary: Adds all elements from the specified iterator to the set being built.
-
Contract:
- If the iterator is {@code null} or has no elements, no elements are added.
-
Parameters:
-
iter(Iterator<? extends E>) — the iterator over elements to add, may be null.
-
- Returns: this builder instance for method chaining.
build(...) -> ImmutableSet<E>
-
Signature:
public ImmutableSet<E> build() - Summary: Builds and returns an ImmutableSet containing all distinct elements added to this builder.
-
Contract:
- After calling this method, the builder should not be used further as the created ImmutableSet may be backed by the builder's internal storage.
-
Parameters:
- (none)
- Returns: a new ImmutableSet containing all distinct elements added to the builder.
Class ImmutableSortedMap (com.landawn.abacus.util.ImmutableSortedMap)
An immutable, thread-safe implementation of the SortedMap interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableSortedMap<K, V>
-
Signature:
public static <K, V> ImmutableSortedMap<K, V> empty() - Summary: Returns an empty ImmutableSortedMap.
-
Parameters:
- (none)
- Returns: an empty ImmutableSortedMap
of(...) -> ImmutableSortedMap<K, V>
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1) - Summary: Returns an ImmutableSortedMap containing the provided key-value pair.
-
Contract:
- The key must implement Comparable to determine its natural ordering.
-
Parameters:
-
k1(K) — the key to be included in the ImmutableSortedMap -
v1(V) — the value to be associated with the key
-
- Returns: an ImmutableSortedMap containing the provided key-value pair
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableSortedMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableSortedMap -
v2(V) — the value to be associated with the second key
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key to be included in the ImmutableSortedMap -
v1(V) — the value to be associated with the first key -
k2(K) — the second key to be included in the ImmutableSortedMap -
v2(V) — the value to be associated with the second key -
k3(K) — the third key to be included in the ImmutableSortedMap -
v3(V) — the value to be associated with the third key
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value -
k6(K) — the sixth key -
v6(V) — the sixth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value -
k6(K) — the sixth key -
v6(V) — the sixth value -
k7(K) — the seventh key -
v7(V) — the seventh value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value -
k6(K) — the sixth key -
v6(V) — the sixth value -
k7(K) — the seventh key -
v7(V) — the seventh value -
k8(K) — the eighth key -
v8(V) — the eighth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value -
k6(K) — the sixth key -
v6(V) — the sixth value -
k7(K) — the seventh key -
v7(V) — the seventh value -
k8(K) — the eighth key -
v8(V) — the eighth value -
k9(K) — the ninth key -
v9(V) — the ninth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
-
Signature:
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7, final K k8, final V v8, final K k9, final V v9, final K k10, final V v10) - Summary: Returns an ImmutableSortedMap containing the provided key-value pairs.
-
Contract:
- The keys must implement Comparable to determine their natural ordering.
- If duplicate keys are provided, the last value for a key wins.
-
Parameters:
-
k1(K) — the first key -
v1(V) — the first value -
k2(K) — the second key -
v2(V) — the second value -
k3(K) — the third key -
v3(V) — the third value -
k4(K) — the fourth key -
v4(V) — the fourth value -
k5(K) — the fifth key -
v5(V) — the fifth value -
k6(K) — the sixth key -
v6(V) — the sixth value -
k7(K) — the seventh key -
v7(V) — the seventh value -
k8(K) — the eighth key -
v8(V) — the eighth value -
k9(K) — the ninth key -
v9(V) — the ninth value -
k10(K) — the tenth key -
v10(V) — the tenth value
-
- Returns: an ImmutableSortedMap containing the provided key-value pairs
copyOf(...) -> ImmutableSortedMap<K, V>
-
Signature:
public static <K, V> ImmutableSortedMap<K, V> copyOf(final Map<? extends K, ? extends V> map) throws UnsupportedOperationException - Summary: Returns an ImmutableSortedMap containing the same mappings as the provided Map.
-
Contract:
- If the provided Map is already an instance of ImmutableSortedMap, it is directly returned.
- If the provided Map is {@code null} or empty, an empty ImmutableSortedMap is returned.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the Map whose mappings are to be placed in the ImmutableSortedMap
-
- Returns: an ImmutableSortedMap containing the same mappings as the provided Map, or the same instance if already an ImmutableSortedMap
-
Throws:
-
java.lang.UnsupportedOperationException
-
wrap(...) -> ImmutableSortedMap<K, V>
-
Signature:
@Beta public static <K, V> ImmutableSortedMap<K, V> wrap(final SortedMap<? extends K, ? extends V> sortedMap) - Summary: Wraps the provided SortedMap into an ImmutableSortedMap.
-
Contract:
- If the provided SortedMap is already an instance of ImmutableSortedMap, it is directly returned.
- If the SortedMap is {@code null} , an empty ImmutableSortedMap is returned.
-
Parameters:
-
sortedMap(SortedMap<? extends K, ? extends V>) — the SortedMap to be wrapped into an ImmutableSortedMap
-
- Returns: an ImmutableSortedMap backed by the provided SortedMap
-
Signature:
@Deprecated public static <K, V> ImmutableMap<K, V> wrap(final Map<? extends K, ? extends V> map) throws UnsupportedOperationException - Summary: This method is deprecated and will throw an UnsupportedOperationException if used.
-
Contract:
- This method is deprecated and will throw an UnsupportedOperationException if used.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — ignored
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
Public Instance Methods
comparator(...) -> Comparator<? super K>
-
Signature:
@Override public Comparator<? super K> comparator() - Summary: Returns the comparator used to order the keys in this map, or {@code null} if this map uses the natural ordering of its keys.
-
Contract:
- Returns the comparator used to order the keys in this map, or {@code null} if this map uses the natural ordering of its keys.
-
Parameters:
- (none)
- Returns: the comparator used to order the keys in this map, or {@code null} if this map uses the natural ordering of its keys
subMap(...) -> ImmutableSortedMap<K, V>
-
Signature:
@Override public ImmutableSortedMap<K, V> subMap(final K fromKey, final K toKey) - Summary: Returns a view of the portion of this map whose keys range from {@code fromKey} , inclusive, to {@code toKey} , exclusive.
-
Parameters:
-
fromKey(K) — low endpoint (inclusive) of the keys in the returned map -
toKey(K) — high endpoint (exclusive) of the keys in the returned map
-
- Returns: a view of the portion of this map whose keys range from {@code fromKey} , inclusive, to {@code toKey} , exclusive
headMap(...) -> ImmutableSortedMap<K, V>
-
Signature:
@Override public ImmutableSortedMap<K, V> headMap(final K toKey) - Summary: Returns a view of the portion of this map whose keys are strictly less than {@code toKey} .
-
Parameters:
-
toKey(K) — high endpoint (exclusive) of the keys in the returned map
-
- Returns: a view of the portion of this map whose keys are strictly less than {@code toKey}
tailMap(...) -> ImmutableSortedMap<K, V>
-
Signature:
@Override public ImmutableSortedMap<K, V> tailMap(final K fromKey) - Summary: Returns a view of the portion of this map whose keys are greater than or equal to {@code fromKey} .
-
Parameters:
-
fromKey(K) — low endpoint (inclusive) of the keys in the returned map
-
- Returns: a view of the portion of this map whose keys are greater than or equal to {@code fromKey}
firstKey(...) -> K
-
Signature:
@Override public K firstKey() - Summary: Returns the first (lowest) key currently in this map.
-
Parameters:
- (none)
- Returns: the first (lowest) key currently in this map
lastKey(...) -> K
-
Signature:
@Override public K lastKey() - Summary: Returns the last (highest) key currently in this map.
-
Parameters:
- (none)
- Returns: the last (highest) key currently in this map
Class ImmutableSortedSet (com.landawn.abacus.util.ImmutableSortedSet)
An immutable, thread-safe implementation of the SortedSet interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ImmutableSortedSet<E>
-
Signature:
public static <E> ImmutableSortedSet<E> empty() - Summary: Returns an empty ImmutableSortedSet.
-
Parameters:
- (none)
- Returns: an empty ImmutableSortedSet instance
of(...) -> ImmutableSortedSet<E>
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1) - Summary: Returns an ImmutableSortedSet containing a single element.
-
Parameters:
-
e1(E) — the element to be contained in the set
-
- Returns: an ImmutableSortedSet containing only the specified element
- See also: #of(Comparable, Comparable)
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2) - Summary: Returns an ImmutableSortedSet containing exactly two elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3) - Summary: Returns an ImmutableSortedSet containing exactly three elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4) - Summary: Returns an ImmutableSortedSet containing exactly four elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5) - Summary: Returns an ImmutableSortedSet containing exactly five elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6) - Summary: Returns an ImmutableSortedSet containing exactly six elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7) - Summary: Returns an ImmutableSortedSet containing exactly seven elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8) - Summary: Returns an ImmutableSortedSet containing exactly eight elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9) - Summary: Returns an ImmutableSortedSet containing exactly nine elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element -
e9(E) — the ninth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
-
Signature:
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(final E e1, final E e2, final E e3, final E e4, final E e5, final E e6, final E e7, final E e8, final E e9, final E e10) - Summary: Returns an ImmutableSortedSet containing exactly ten elements in sorted order.
-
Contract:
- The elements must implement Comparable to determine their natural ordering.
-
Parameters:
-
e1(E) — the first element -
e2(E) — the second element -
e3(E) — the third element -
e4(E) — the fourth element -
e5(E) — the fifth element -
e6(E) — the sixth element -
e7(E) — the seventh element -
e8(E) — the eighth element -
e9(E) — the ninth element -
e10(E) — the tenth element
-
- Returns: an ImmutableSortedSet containing the specified elements in sorted order
copyOf(...) -> ImmutableSortedSet<E>
-
Signature:
public static <E> ImmutableSortedSet<E> copyOf(final Collection<? extends E> c) - Summary: Returns an ImmutableSortedSet containing the elements of the specified collection.
-
Contract:
- If the provided collection is already an instance of ImmutableSortedSet, it is directly returned.
- If the provided collection is {@code null} or empty, an empty ImmutableSortedSet is returned.
- <p> The elements are sorted according to their natural ordering if they implement Comparable, or a ClassCastException will be thrown if they don't.
-
Parameters:
-
c(Collection<? extends E>) — the collection whose elements are to be placed into this set
-
- Returns: an ImmutableSortedSet containing the elements of the specified collection
wrap(...) -> ImmutableSortedSet<E>
-
Signature:
@Beta public static <E> ImmutableSortedSet<E> wrap(final SortedSet<? extends E> sortedSet) - Summary: Wraps the provided SortedSet into an ImmutableSortedSet.
-
Contract:
- If the provided SortedSet is already an instance of ImmutableSortedSet, it is directly returned.
- If the provided SortedSet is {@code null} , an empty ImmutableSortedSet is returned.
-
Parameters:
-
sortedSet(SortedSet<? extends E>) — the sorted set to wrap
-
- Returns: an {@code ImmutableSortedSet} backed by the specified {@code sortedSet}
-
Signature:
@Deprecated public static <E> ImmutableSet<E> wrap(final Set<? extends E> set) throws UnsupportedOperationException - Summary: This method is deprecated and will throw an UnsupportedOperationException if used.
-
Contract:
- This method is deprecated and will throw an UnsupportedOperationException if used.
-
Parameters:
-
set(Set<? extends E>) — the set parameter (ignored)
-
- Returns: never returns normally
-
Throws:
-
java.lang.UnsupportedOperationException— always
-
Public Instance Methods
comparator(...) -> Comparator<? super E>
-
Signature:
@Override public Comparator<? super E> comparator() - Summary: Returns the comparator used to order the elements in this set, or {@code null} if this set uses the natural ordering of its elements.
-
Contract:
- Returns the comparator used to order the elements in this set, or {@code null} if this set uses the natural ordering of its elements.
-
Parameters:
- (none)
- Returns: the comparator used to order the elements in this set, or {@code null} if natural ordering is used
subSet(...) -> ImmutableSortedSet<E>
-
Signature:
@Override public ImmutableSortedSet<E> subSet(final E fromElement, final E toElement) - Summary: Returns a view of the portion of this set whose elements range from {@code fromElement} , inclusive, to {@code toElement} , exclusive.
-
Parameters:
-
fromElement(E) — low endpoint (inclusive) of the returned set -
toElement(E) — high endpoint (exclusive) of the returned set
-
- Returns: a view of the portion of this set whose elements range from {@code fromElement} , inclusive, to {@code toElement} , exclusive
headSet(...) -> ImmutableSortedSet<E>
-
Signature:
@Override public ImmutableSortedSet<E> headSet(final E toElement) - Summary: Returns a view of the portion of this set whose elements are strictly less than {@code toElement} .
-
Parameters:
-
toElement(E) — high endpoint (exclusive) of the returned set
-
- Returns: a view of the portion of this set whose elements are strictly less than {@code toElement}
tailSet(...) -> ImmutableSortedSet<E>
-
Signature:
@Override public ImmutableSortedSet<E> tailSet(final E fromElement) - Summary: Returns a view of the portion of this set whose elements are greater than or equal to {@code fromElement} .
-
Parameters:
-
fromElement(E) — low endpoint (inclusive) of the returned set
-
- Returns: a view of the portion of this set whose elements are greater than or equal to {@code fromElement}
first(...) -> E
-
Signature:
@Override public E first() - Summary: Returns the first (lowest) element currently in this set.
-
Parameters:
- (none)
- Returns: the first (lowest) element currently in this set
last(...) -> E
-
Signature:
@Override public E last() - Summary: Returns the last (highest) element currently in this set.
-
Parameters:
- (none)
- Returns: the last (highest) element currently in this set
Class Index (com.landawn.abacus.util.Index)
A comprehensive utility class providing index-finding operations for arrays, collections, and strings with a fluent API design.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> OptionalInt
-
Signature:
public static OptionalInt of(final boolean[] source, final boolean valueToFind) - Summary: Returns the index of the first occurrence of the specified boolean value in the array.
-
Contract:
- If the array is {@code null} or empty, an empty OptionalInt is returned.
-
Parameters:
-
source(boolean[]) — the boolean array to be searched, may be {@code null} -
valueToFind(boolean) — the boolean value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null}
- See also: #of(boolean\[\], boolean, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final boolean[] source, final boolean valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified boolean value in the array, starting from the specified index.
-
Parameters:
-
source(boolean[]) — the boolean array to be searched, may be {@code null} -
valueToFind(boolean) — the boolean value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} , or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final char[] source, final char valueToFind) - Summary: Returns the index of the first occurrence of the specified char value in the array.
-
Contract:
- If the array is {@code null} or empty, an empty OptionalInt is returned.
-
Parameters:
-
source(char[]) — the char array to be searched, may be {@code null} -
valueToFind(char) — the char value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null}
- See also: #of(char\[\], char, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final char[] source, final char valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified char value in the array, starting from the specified index.
-
Parameters:
-
source(char[]) — the char array to be searched, may be {@code null} -
valueToFind(char) — the char value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} , or {@code fromIndex >= array.length}
- See also: #of(char\[\], char), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final byte[] source, final byte valueToFind) - Summary: Returns the index of the first occurrence of the specified byte value in the array.
-
Parameters:
-
source(byte[]) — the byte array to be searched, may be {@code null} -
valueToFind(byte) — the byte value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(byte\[\], byte, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final byte[] source, final byte valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified byte value in the array, starting from the specified index.
-
Parameters:
-
source(byte[]) — the byte array to be searched, may be {@code null} -
valueToFind(byte) — the byte value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(byte\[\], byte), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final short[] source, final short valueToFind) - Summary: Returns the index of the first occurrence of the specified short value in the array.
-
Parameters:
-
source(short[]) — the short array to be searched, may be {@code null} -
valueToFind(short) — the short value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(short\[\], short, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final short[] source, final short valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified short value in the array, starting from the specified index.
-
Parameters:
-
source(short[]) — the short array to be searched, may be {@code null} -
valueToFind(short) — the short value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(short\[\], short), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final int[] source, final int valueToFind) - Summary: Returns the index of the first occurrence of the specified int value in the array.
-
Parameters:
-
source(int[]) — the int array to be searched, may be {@code null} -
valueToFind(int) — the int value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(int\[\], int, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final int[] source, final int valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified int value in the array, starting from the specified index.
-
Parameters:
-
source(int[]) — the int array to be searched, may be {@code null} -
valueToFind(int) — the int value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(int\[\], int), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final long[] source, final long valueToFind) - Summary: Returns the index of the first occurrence of the specified long value in the array.
-
Parameters:
-
source(long[]) — the long array to be searched, may be {@code null} -
valueToFind(long) — the long value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(long\[\], long, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final long[] source, final long valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified long value in the array, starting from the specified index.
-
Parameters:
-
source(long[]) — the long array to be searched, may be {@code null} -
valueToFind(long) — the long value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(long\[\], long), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final float[] source, final float valueToFind) - Summary: Returns the index of the first occurrence of the specified float value in the array.
-
Parameters:
-
source(float[]) — the float array to be searched, may be {@code null} -
valueToFind(float) — the float value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(float\[\], float, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final float[] source, final float valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified float value in the array, starting from the specified index.
-
Parameters:
-
source(float[]) — the float array to be searched, may be {@code null} -
valueToFind(float) — the float value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(float\[\], float), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final double[] source, final double valueToFind) - Summary: Returns the index of the first occurrence of the specified double value in the array.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #of(boolean\[\], boolean), #of(double\[\], double, int), #of(double\[\], double, double), #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final double[] source, final double valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified double value in the array, starting from the specified index.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} or empty, or {@code fromIndex >= array.length}
- See also: #of(boolean\[\], boolean, int), #of(double\[\], double), #of(double\[\], double, double, int), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final double[] source, final double valueToFind, final double tolerance) - Summary: Returns the index of the first occurrence of the specified double value in the array, within a given tolerance.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
tolerance(double) — the tolerance for matching; must be non-negative. A value matches if it's within {@code valueToFind ± tolerance}
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of a value within tolerance, or an empty OptionalInt if no value is found within tolerance or the array is {@code null}
- See also: #of(double\[\], double, double, int), #of(double\[\], double), N#indexOf(double\[\], double, double)
-
Signature:
public static OptionalInt of(final double[] source, final double valueToFind, final double tolerance, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified double value in the array, within a given tolerance and starting from the specified index.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
tolerance(double) — the tolerance for matching; must be non-negative. A value matches if it's within {@code valueToFind ± tolerance} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of a value within tolerance at or after {@code fromIndex} , or an empty OptionalInt if no value is found within tolerance, the array is {@code null} , or {@code fromIndex >= array.length}
- See also: #of(double\[\], double, double), #of(double\[\], double, int), N#indexOf(double\[\], double, double, int)
-
Signature:
public static OptionalInt of(final Object[] source, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified object in the array.
-
Parameters:
-
source(Object[]) — the object array to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null}
- See also: #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt of(final Object[] source, final Object valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified object in the array, starting from the specified index.
-
Parameters:
-
source(Object[]) — the object array to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the array is {@code null} , or {@code fromIndex >= array.length}
- See also: #of(Object\[\], Object)
-
Signature:
public static OptionalInt of(final Collection<?> source, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified object in the collection.
-
Parameters:
-
source(Collection<?>) — the collection to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index (in iteration order) of the first occurrence of the value, or an empty OptionalInt if the value is not found or the collection is {@code null}
- See also: #of(Collection, Object, int)
-
Signature:
public static OptionalInt of(final Collection<?> source, final Object valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified object in the collection, starting from the specified index.
-
Parameters:
-
source(Collection<?>) — the collection to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index (in iteration order) of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found, the collection is {@code null} , or {@code fromIndex >= collection.size()}
- See also: #of(Collection, Object)
-
Signature:
public static OptionalInt of(final Iterator<?> source, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified object in the iterator.
-
Parameters:
-
source(Iterator<?>) — the iterator to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index (in iteration order) of the first occurrence of the value, or an empty OptionalInt if the value is not found or the iterator is {@code null}
- See also: #of(Iterator, Object, int)
-
Signature:
public static OptionalInt of(final Iterator<?> source, final Object valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified object in the iterator, starting from the specified index.
-
Contract:
- The iterator will be consumed up to and including the matching element (or exhausted if not found).
-
Parameters:
-
source(Iterator<?>) — the iterator to be searched, may be {@code null} -
valueToFind(Object) — the object to search for, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index (in iteration order) of the first occurrence of the value at or after {@code fromIndex} , or an empty OptionalInt if the value is not found or the iterator is {@code null}
- See also: #of(Iterator, Object)
-
Signature:
public static OptionalInt of(final String source, final int charValueToFind) - Summary: Returns the index of the first occurrence of the specified character in the string.
-
Contract:
- If the string is {@code null} or empty, an empty OptionalInt is returned.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
charValueToFind(int) — the character value (Unicode code point) to search for
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the character, or an empty OptionalInt if the character is not found or the string is {@code null}
- See also: #of(String, int, int), Strings#indexOf(String, int), String#indexOf(int)
-
Signature:
public static OptionalInt of(final String source, final int charValueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified character in the string, starting from the specified index.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
charValueToFind(int) — the character value (Unicode code point) to search for -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the character at or after {@code fromIndex} , or an empty OptionalInt if the character is not found, the string is {@code null} , or {@code fromIndex >= str.length()}
- See also: #of(String, int), Strings#indexOf(String, int, int), String#indexOf(int, int)
-
Signature:
public static OptionalInt of(final String source, final String valueToFind) - Summary: Returns the index of the first occurrence of the specified substring in the given string.
-
Contract:
- If the string is {@code null} or empty, an empty OptionalInt is returned.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the substring, or an empty OptionalInt if the substring is not found or either parameter is {@code null}
- See also: #of(String, String, int), #ofIgnoreCase(String, String), Strings#indexOf(String, String), String#indexOf(String)
-
Signature:
public static OptionalInt of(final String source, final String valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified substring in the given string, starting from the specified index.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the substring at or after {@code fromIndex} , or an empty OptionalInt if the substring is not found, either parameter is {@code null} , or {@code fromIndex >= str.length()}
- See also: #of(String, String), #ofIgnoreCase(String, String, int), Strings#indexOf(String, String, int), String#indexOf(String, int)
ofIgnoreCase(...) -> OptionalInt
-
Signature:
public static OptionalInt ofIgnoreCase(final String source, final String valueToFind) - Summary: Returns the index of the first occurrence of the specified substring in the given string, ignoring case.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for (case-insensitive), may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the substring (ignoring case), or an empty OptionalInt if the substring is not found or either parameter is {@code null}
- See also: #ofIgnoreCase(String, String, int), Strings#indexOfIgnoreCase(String, String)
-
Signature:
public static OptionalInt ofIgnoreCase(final String source, final String valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified substring in the given string, ignoring case and starting from the specified index.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for (case-insensitive), may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: an OptionalInt containing the zero-based index of the first occurrence of the substring (ignoring case) at or after {@code fromIndex} , or an empty OptionalInt if the substring is not found, either parameter is {@code null} , or {@code fromIndex >= str.length()}
- See also: #ofIgnoreCase(String, String), Strings#indexOfIgnoreCase(String, String, int)
ofSubArray(...) -> OptionalInt
-
Signature:
public static OptionalInt ofSubArray(final boolean[] source, final boolean[] subArrayToFind) - Summary: Returns the index of the first occurrence of the specified subarray in the given source array.
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts, or an empty OptionalInt if the subarray is not found or either array is {@code null}
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final boolean[] source, final int fromIndex, final boolean[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts at or after {@code fromIndex} , or an empty OptionalInt if the subarray is not found, either array is {@code null} , or {@code fromIndex >= source.length}
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(boolean\[\], int, boolean\[\], int, int), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final boolean[] source, final int fromIndex, final boolean[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of the specified subarray in the given source array.
-
Contract:
- <p> Special cases: <ul> <li> If {@code sizeToMatch} is 0 and both arrays are {@code non-null} , returns {@code fromIndex} (clamped to valid range) </li> <li> If either array is {@code null} , returns empty OptionalInt </li> <li> If {@code fromIndex} is negative, it's treated as 0 </li> <li> If {@code fromIndex >= source.length} , returns empty OptionalInt </li> </ul>
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the subarray is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final char[] source, final char[] subArrayToFind) - Summary: Returns the index of the first occurrence of the specified subarray in the given source array.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
subArrayToFind(char[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts, or an empty OptionalInt if the subarray is not found or either array is {@code null}
- See also: #ofSubArray(char\[\], int, char\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final char[] source, final int fromIndex, final char[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(char[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts at or after {@code fromIndex} , or an empty OptionalInt if the subarray is not found, either array is {@code null} , or {@code fromIndex >= source.length}
- See also: #ofSubArray(char\[\], char\[\]), #ofSubArray(char\[\], int, char\[\], int, int), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final char[] source, final int fromIndex, final char[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of a portion of the specified subarray in the given source array.
-
Contract:
- <p> Special cases: <ul> <li> If {@code sizeToMatch} is 0 and both arrays are {@code non-null} , returns {@code fromIndex} (clamped to valid range) </li> <li> If either array is {@code null} , returns empty OptionalInt </li> <li> If {@code fromIndex} is negative, it's treated as 0 </li> <li> If {@code fromIndex >= source.length} , returns empty OptionalInt </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] source = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; char\[\] sub = {'w', 'o', 'r', 'l', 'd'}; // Match entire subarray starting from index 6 Index.ofSubArray(source, 0, sub, 0, 5).get(); // returns 6 // Match only "wor" (first 3 elements) from sub Index.ofSubArray(source, 0, sub, 0, 3).get(); // returns 6 // Match only "orl" (elements at indices 1-3 of sub) Index.ofSubArray(source, 0, sub, 1, 3).get(); // returns 7 // Start search from index 8 Index.ofSubArray(source, 8, sub, 1, 3).get(); // returns 8 } </pre>
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(char[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the subarray portion is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #ofSubArray(char\[\], char\[\]), #ofSubArray(char\[\], int, char\[\]), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final byte[] source, final byte[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #ofSubArray(Object\[\], Object\[\]), String#indexOf(String), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final byte[] source, final int fromIndex, final byte[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts at or after {@code fromIndex} , or an empty OptionalInt if the subarray is not found, either array is {@code null} , or {@code fromIndex >= source.length}
- See also: #ofSubArray(byte\[\], byte\[\]), #ofSubArray(byte\[\], int, byte\[\], int, int), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final byte[] source, final int fromIndex, final byte[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of a portion of the specified subarray in the given source array.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the subarray portion is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #ofSubArray(byte\[\], byte\[\]), #ofSubArray(byte\[\], int, byte\[\]), #ofSubArray(boolean\[\], int, boolean\[\], int, int), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final short[] source, final short[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
subArrayToFind(short[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(short\[\], int, short\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final short[] source, final int fromIndex, final short[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(short[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts at or after {@code fromIndex} , or an empty OptionalInt if the subarray is not found, either array is {@code null} , or {@code fromIndex >= source.length}
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(short\[\], short\[\]), #ofSubArray(short\[\], int, short\[\], int, int), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final short[] source, final int fromIndex, final short[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of a portion of the specified subarray in the given source array.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(short[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the subarray portion is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #ofSubArray(short\[\], short\[\]), #ofSubArray(short\[\], int, short\[\]), #ofSubArray(boolean\[\], int, boolean\[\], int, int), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final int[] source, final int[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
subArrayToFind(int[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(int\[\], int, int\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final int[] source, final int fromIndex, final int[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from -
subArrayToFind(int[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(int\[\], int\[\]), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final int[] source, final int fromIndex, final int[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from. -
subArrayToFind(int[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final long[] source, final long[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
subArrayToFind(long[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(long\[\], int, long\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final long[] source, final int fromIndex, final long[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from -
subArrayToFind(long[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(long\[\], long\[\]), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final long[] source, final int fromIndex, final long[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from. -
subArrayToFind(long[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final float[] source, final float[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
subArrayToFind(float[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(float\[\], int, float\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final float[] source, final int fromIndex, final float[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from -
subArrayToFind(float[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(float\[\], float\[\]), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final float[] source, final int fromIndex, final float[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from. -
subArrayToFind(float[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final double[] source, final double[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
subArrayToFind(double[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], boolean\[\]), #ofSubArray(double\[\], int, double\[\]), #ofSubArray(Object\[\], Object\[\]), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final double[] source, final int fromIndex, final double[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from -
subArrayToFind(double[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #ofSubArray(boolean\[\], int, boolean\[\]), #ofSubArray(double\[\], double\[\]), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final double[] source, final int fromIndex, final double[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from. -
subArrayToFind(double[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final Object[] source, final Object[] subArrayToFind) - Summary: Returns the index of the first occurrence of the specified subarray in the given source array.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts, or an empty OptionalInt if the subarray is not found or either array is {@code null}
- See also: #ofSubArray(Object\[\], int, Object\[\]), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubArray(final Object[] source, final int fromIndex, final Object[] subArrayToFind) - Summary: Returns the index of the specified subarray in the given source array, starting from the specified index.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the subarray starts at or after {@code fromIndex} , or an empty OptionalInt if the subarray is not found, either array is {@code null} , or {@code fromIndex >= source.length}
- See also: #ofSubArray(Object\[\], Object\[\]), #ofSubArray(Object\[\], int, Object\[\], int, int), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubArray(final Object[] source, final int fromIndex, final Object[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of a portion of the specified subarray in the given source array.
-
Contract:
- <p> Special cases: <ul> <li> If {@code sizeToMatch} is 0 and both arrays are {@code non-null} , returns {@code fromIndex} (clamped to valid range) </li> <li> If either array is {@code null} , returns empty OptionalInt </li> <li> If {@code fromIndex} is negative, it's treated as 0 </li> <li> If {@code fromIndex >= source.length} , returns empty OptionalInt </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] source = {"a", "b", "c", "d", "e", "f", "g"}; String\[\] pattern = {"c", "d", "e", "f"}; // Match entire pattern Index.ofSubArray(source, 0, pattern, 0, 4).get(); // returns 2 // Match only first 2 elements {"c", "d"} Index.ofSubArray(source, 0, pattern, 0, 2).get(); // returns 2 // Match elements at indices 2-3 of pattern {"e", "f"} Index.ofSubArray(source, 0, pattern, 2, 2).get(); // returns 4 // Start search from index 3 Index.ofSubArray(source, 3, pattern, 0, 2).get(); // returns 4 (matches {"d", "e"} at positions 3-4) } </pre>
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the subarray portion is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #ofSubArray(Object\[\], Object\[\]), #ofSubArray(Object\[\], int, Object\[\]), String#indexOf(String, int)
ofSubList(...) -> OptionalInt
-
Signature:
public static OptionalInt ofSubList(final List<?> source, final List<?> subListToFind) - Summary: Returns the index of the first occurrence of the specified sublist in the given source list.
-
Parameters:
-
source(List<?>) — the list to be searched, may be {@code null} -
subListToFind(List<?>) — the sublist to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the sublist starts, or an empty OptionalInt if the sublist is not found or either list is {@code null}
- Performance: The implementation is optimized for {@link RandomAccess} lists to provide O(1) element access.
- See also: #ofSubList(List, int, List), #ofSubList(List, int, List, int, int), #ofSubArray(Object\[\], Object\[\]), Collections#indexOfSubList(List, List), String#indexOf(String)
-
Signature:
public static OptionalInt ofSubList(final List<?> source, final int fromIndex, final List<?> subListToFind) - Summary: Returns the index of the specified sublist in the given source list, starting from the specified index.
-
Parameters:
-
source(List<?>) — the list to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subListToFind(List<?>) — the sublist to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index where the sublist starts at or after {@code fromIndex} , or an empty OptionalInt if the sublist is not found, either list is {@code null} , or {@code fromIndex >= source.size()}
- See also: #ofSubList(List, List), #ofSubList(List, int, List, int, int), #ofSubArray(Object\[\], int, Object\[\]), Collections#indexOfSubList(List, List), String#indexOf(String, int)
-
Signature:
public static OptionalInt ofSubList(final List<?> source, final int fromIndex, final List<?> subListToFind, final int startIndexOfSubList, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the index of the first occurrence of a portion of the specified sublist in the given source list.
-
Contract:
- <p> Special cases: <ul> <li> If {@code sizeToMatch} is 0 and both lists are {@code non-null} , returns {@code fromIndex} (clamped to valid range) </li> <li> If either list is {@code null} , returns empty OptionalInt </li> <li> If {@code fromIndex} is negative, it's treated as 0 </li> <li> If {@code fromIndex >= source.size()} , returns empty OptionalInt </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> source = Arrays.asList("a", "b", "c", "d", "e", "f", "g"); List<String> pattern = Arrays.asList("c", "d", "e", "f"); // Match entire pattern Index.ofSubList(source, 0, pattern, 0, 4).get(); // returns 2 // Match only first 2 elements {"c", "d"} Index.ofSubList(source, 0, pattern, 0, 2).get(); // returns 2 // Match elements at indices 2-3 of pattern {"e", "f"} Index.ofSubList(source, 0, pattern, 2, 2).get(); // returns 4 // Start search from index 3 Index.ofSubList(source, 3, pattern, 0, 2).get(); // returns 4 (matches {"d", "e"} at positions 3-4) } </pre>
-
Parameters:
-
source(List<?>) — the list to be searched, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0 -
subListToFind(List<?>) — the sublist to search for, may be {@code null} -
startIndexOfSubList(int) — the starting index within {@code subListToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subListToFind}
-
- Returns: an OptionalInt containing the zero-based index where the sublist portion is found, or an empty OptionalInt if the sublist is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubList} and {@code sizeToMatch} do not denote a valid range in {@code subListToFind}
-
- See also: #ofSubList(List, List), #ofSubList(List, int, List), #ofSubArray(Object\[\], int, Object\[\], int, int), Collections#indexOfSubList(List, List), String#indexOf(String, int)
last(...) -> OptionalInt
-
Signature:
public static OptionalInt last(final boolean[] source, final boolean valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(boolean[]) — the array to be searched. -
valueToFind(boolean) — the value to find in the array.
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty {@code OptionalInt} if the value is not found.
- See also: #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final boolean[] source, final boolean valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(boolean[]) — the array to be searched. -
valueToFind(boolean) — the value to find in the array. -
startIndexFromBack(int) — the index to start the search from the end of the array.
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty {@code OptionalInt} if the value is not found.
- See also: #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final char[] source, final char valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
valueToFind(char) — the value to find in the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(char\[\], char, int), #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final char[] source, final char valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
valueToFind(char) — the value to find in the array -
startIndexFromBack(int) — the index to start the search from the end of the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(char\[\], char), #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final byte[] source, final byte valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
valueToFind(byte) — the value to find in the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(byte\[\], byte, int), #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final byte[] source, final byte valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
valueToFind(byte) — the value to find in the array -
startIndexFromBack(int) — the index to start the search from the end of the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(byte\[\], byte), #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final short[] source, final short valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
valueToFind(short) — the value to find in the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(short\[\], short, int), #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final short[] source, final short valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
valueToFind(short) — the value to find in the array -
startIndexFromBack(int) — the index to start the search from the end of the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(short\[\], short), #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final int[] source, final int valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
valueToFind(int) — the value to find in the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(int\[\], int, int), #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final int[] source, final int valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
valueToFind(int) — the value to find in the array -
startIndexFromBack(int) — the index to start the search from the end of the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(int\[\], int), #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final long[] source, final long valueToFind) - Summary: Returns the last index of the specified value in the given array.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
valueToFind(long) — the value to find in the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(long\[\], long, int), #last(Object\[\], Object)
-
Signature:
public static OptionalInt last(final long[] source, final long valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array, starting from the specified index from the end.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
valueToFind(long) — the value to find in the array -
startIndexFromBack(int) — the index to start the search from the end of the array
-
- Returns: an OptionalInt containing the last index of the value in the array, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(long\[\], long), #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final float[] source, final float valueToFind) - Summary: Returns the last index of the specified float value in the given array.
-
Parameters:
-
source(float[]) — the float array to be searched, may be {@code null} -
valueToFind(float) — the float value to search for
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(float\[\], float, int), #last(Object\[\], Object), Float#compare(float, float)
-
Signature:
public static OptionalInt last(final float[] source, final float valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified float value in the given array, searching backwards from a specified position.
-
Parameters:
-
source(float[]) — the float array to be searched, may be {@code null} -
valueToFind(float) — the float value to search for -
startIndexFromBack(int) — the position to start the backwards search from (inclusive)
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value at or before {@code startIndexFromBack} , or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(float\[\], float), #last(Object\[\], Object, int), Float#compare(float, float)
-
Signature:
public static OptionalInt last(final double[] source, final double valueToFind) - Summary: Returns the last index of the specified double value in the given array.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean), #last(double\[\], double, int), #last(Object\[\], Object), Double#compare(double, double)
-
Signature:
public static OptionalInt last(final double[] source, final double valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified double value in the given array, searching backwards from a specified position.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
startIndexFromBack(int) — the position to start the backwards search from (inclusive)
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value at or before {@code startIndexFromBack} , or an empty OptionalInt if the value is not found or the array is {@code null} or empty
- See also: #last(boolean\[\], boolean, int), #last(double\[\], double), #last(Object\[\], Object, int), Double#compare(double, double)
-
Signature:
public static OptionalInt last(final double[] source, final double valueToFind, final double tolerance) - Summary: Returns the last index of the specified double value in the given array, within a specified tolerance.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
tolerance(double) — the tolerance for matching; must be non-negative. A value matches if it's within {@code valueToFind ± tolerance}
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of a value within tolerance, or an empty OptionalInt if no value is found within tolerance or the array is {@code null}
- See also: #last(double\[\], double, double, int), #last(double\[\], double), N#lastIndexOf(double\[\], double, double, int)
-
Signature:
public static OptionalInt last(final double[] source, final double valueToFind, final double tolerance, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given array within a specified tolerance, starting from the specified index from the end.
-
Parameters:
-
source(double[]) — the array to be searched. -
valueToFind(double) — the value to find in the array. -
tolerance(double) — the tolerance within which to find the value. -
startIndexFromBack(int) — the index to start the search from the end of the array.
-
- Returns: an OptionalInt containing the last index of the value in the array within the specified tolerance, or an empty {@code OptionalInt} if the value is not found.
- See also: #last(Object\[\], Object, int), N#lastIndexOf(double\[\], double, double, int)
-
Signature:
public static OptionalInt last(final Object[] source, final Object valueToFind) - Summary: Returns the index of the last occurrence of the specified value in the given array.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
valueToFind(Object) — the value to find in the array, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value, or an empty OptionalInt if the value is not found or the array is {@code null}
- See also: #last(Object\[\], Object, int), #of(Object\[\], Object)
-
Signature:
public static OptionalInt last(final Object[] source, final Object valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified value in the given array, searching backwards from the specified index.
-
Contract:
- If {@code startIndexFromBack} is greater than or equal to the array length, the entire array is searched.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
valueToFind(Object) — the value to find in the array, may be {@code null} -
startIndexFromBack(int) — the index to start the search from (inclusive), searching backwards
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the value at or before {@code startIndexFromBack} , or an empty OptionalInt if the value is not found or the array is {@code null}
- See also: #last(Object\[\], Object), #of(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final Collection<?> source, final Object valueToFind) - Summary: Returns the index of the last occurrence of the specified value in the given collection.
-
Parameters:
-
source(Collection<?>) — the collection to be searched, may be {@code null} -
valueToFind(Object) — the value to find in the collection, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index (in iteration order) of the last occurrence of the value, or an empty OptionalInt if the value is not found or the collection is {@code null}
- See also: #last(Collection, Object, int), #of(Collection, Object)
-
Signature:
public static OptionalInt last(final Collection<?> source, final Object valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified value in the given collection, starting from the specified index from the end.
-
Parameters:
-
source(Collection<?>) — the collection to be searched. -
valueToFind(Object) — the value to find in the collection. -
startIndexFromBack(int) — the index to start the search from the end of the collection.
-
- Returns: an OptionalInt containing the last index of the value in the collection, or an empty {@code OptionalInt} if the value is not found.
- See also: #last(Object\[\], Object, int)
-
Signature:
public static OptionalInt last(final String source, final int charValueToFind) - Summary: Returns the last index of the specified character in the given string.
-
Parameters:
-
source(String) — the string to be searched. -
charValueToFind(int) — the character value to find in the string.
-
- Returns: an OptionalInt containing the last index of the character in the string, or an empty {@code OptionalInt} if the character is not found.
- See also: Strings#lastIndexOf(String, int)
-
Signature:
public static OptionalInt last(final String source, final int charValueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified character in the given string, starting from the specified index from the end.
-
Parameters:
-
source(String) — the string to be searched. -
charValueToFind(int) — the character value to find in the string. -
startIndexFromBack(int) — the index to start the search from the end of the string.
-
- Returns: an OptionalInt containing the last index of the character in the string, or an empty {@code OptionalInt} if the character is not found.
- See also: Strings#lastIndexOf(String, int, int)
-
Signature:
public static OptionalInt last(final String source, final String valueToFind) - Summary: Returns the index of the last occurrence of the specified substring in the given string.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for, may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the substring, or an empty OptionalInt if the substring is not found or either parameter is {@code null}
- See also: #last(String, String, int), #lastOfIgnoreCase(String, String), #of(String, String), Strings#lastIndexOf(String, String), String#lastIndexOf(String)
-
Signature:
public static OptionalInt last(final String source, final String valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified string in the given string, starting from the specified index from the end.
-
Parameters:
-
source(String) — the string to be searched. -
valueToFind(String) — the string value to find in the string. -
startIndexFromBack(int) — the index to start the search from the end of the string.
-
- Returns: an OptionalInt containing the last index of the string in the string, or an empty {@code OptionalInt} if the string is not found.
- See also: Strings#lastIndexOf(String, String, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
lastOfIgnoreCase(...) -> OptionalInt
-
Signature:
public static OptionalInt lastOfIgnoreCase(final String source, final String valueToFind) - Summary: Returns the last index of the specified substring in the given string, ignoring case.
-
Parameters:
-
source(String) — the string to be searched, may be {@code null} -
valueToFind(String) — the substring to search for (case-insensitive), may be {@code null}
-
- Returns: an OptionalInt containing the zero-based index of the last occurrence of the substring (ignoring case), or an empty OptionalInt if the substring is not found or either parameter is {@code null}
- See also: #lastOfIgnoreCase(String, String, int), Strings#lastIndexOfIgnoreCase(String, String)
-
Signature:
public static OptionalInt lastOfIgnoreCase(final String source, final String valueToFind, final int startIndexFromBack) - Summary: Returns the last index of the specified string in the given string, ignoring case considerations, starting from the specified index from the end.
-
Parameters:
-
source(String) — the string to be searched. -
valueToFind(String) — the string value to find in the string. -
startIndexFromBack(int) — the index to start the search from the end of the string.
-
- Returns: an OptionalInt containing the last index of the string in the string, or an empty {@code OptionalInt} if the string is not found.
- See also: Strings#lastIndexOfIgnoreCase(String, String, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
lastOfSubArray(...) -> OptionalInt
-
Signature:
public static OptionalInt lastOfSubArray(final boolean[] source, final boolean[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final boolean[] source, final int startIndexFromBack, final boolean[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final boolean[] source, final int startIndexFromBack, final boolean[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, searching backwards from a specified position.
-
Contract:
- <p> Special cases: <ul> <li> If {@code sizeToMatch} is 0, {@code startIndexFromBack >= 0} , and both arrays are {@code non-null} , returns {@code min(startIndexFromBack, source.length)} </li> <li> If either array is {@code null} , returns empty OptionalInt </li> <li> If {@code startIndexFromBack < 0} , returns empty OptionalInt </li> <li> If {@code source.length < sizeToMatch} , returns empty OptionalInt </li> </ul>
-
Parameters:
-
source(boolean[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the position to start the backwards search from; the search includes this position -
subArrayToFind(boolean[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index within {@code subArrayToFind} of the portion to match -
sizeToMatch(int) — the number of elements to match from {@code subArrayToFind}
-
- Returns: an OptionalInt containing the zero-based index where the last occurrence of the subarray is found, or an empty OptionalInt if the subarray is not found or inputs are invalid
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code startIndexOfSubArray} and {@code sizeToMatch} do not denote a valid range in {@code subArrayToFind}
-
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final char[] source, final char[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
subArrayToFind(char[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final char[] source, final int startIndexFromBack, final char[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(char[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final char[] source, final int startIndexFromBack, final char[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(char[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(char[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final byte[] source, final byte[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final byte[] source, final int startIndexFromBack, final byte[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final byte[] source, final int startIndexFromBack, final byte[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(byte[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(byte[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final short[] source, final short[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
subArrayToFind(short[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(short\[\], int, short\[\]), #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String)
-
Signature:
public static OptionalInt lastOfSubArray(final short[] source, final int startIndexFromBack, final short[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array -
subArrayToFind(short[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], int, boolean\[\]), #lastOfSubArray(short\[\], short\[\]), #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final short[] source, final int startIndexFromBack, final short[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(short[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(short[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final int[] source, final int[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
subArrayToFind(int[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(int\[\], int, int\[\]), #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String)
-
Signature:
public static OptionalInt lastOfSubArray(final int[] source, final int startIndexFromBack, final int[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array -
subArrayToFind(int[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], int, boolean\[\]), #lastOfSubArray(int\[\], int\[\]), #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final int[] source, final int startIndexFromBack, final int[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(int[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(int[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final long[] source, final long[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
subArrayToFind(long[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(long\[\], int, long\[\]), #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String)
-
Signature:
public static OptionalInt lastOfSubArray(final long[] source, final int startIndexFromBack, final long[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array -
subArrayToFind(long[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], int, boolean\[\]), #lastOfSubArray(long\[\], long\[\]), #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final long[] source, final int startIndexFromBack, final long[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(long[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(long[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final float[] source, final float[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
subArrayToFind(float[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(float\[\], int, float\[\]), #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String)
-
Signature:
public static OptionalInt lastOfSubArray(final float[] source, final int startIndexFromBack, final float[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array -
subArrayToFind(float[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], int, boolean\[\]), #lastOfSubArray(float\[\], float\[\]), #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final float[] source, final int startIndexFromBack, final float[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(float[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(float[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final double[] source, final double[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
subArrayToFind(double[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], boolean\[\]), #lastOfSubArray(double\[\], int, double\[\]), #lastOfSubArray(Object\[\], Object\[\]), Strings#lastIndexOf(String, String)
-
Signature:
public static OptionalInt lastOfSubArray(final double[] source, final int startIndexFromBack, final double[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array -
subArrayToFind(double[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty OptionalInt if the subarray is not found or either array is {@code null} or empty
- See also: #lastOfSubArray(boolean\[\], int, boolean\[\]), #lastOfSubArray(double\[\], double\[\]), #lastOfSubArray(Object\[\], int, Object\[\]), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final double[] source, final int startIndexFromBack, final double[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(double[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(double[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: #lastOfSubArray(Object\[\], int, Object\[\], int, int), Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final Object[] source, final Object[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final Object[] source, final int startIndexFromBack, final Object[] subArrayToFind) - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null}
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubArray(final Object[] source, final int startIndexFromBack, final Object[] subArrayToFind, final int startIndexOfSubArray, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified subarray in the given source array, starting from the specified index from the end.
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
startIndexFromBack(int) — the index to start the search from the end of the array. -
subArrayToFind(Object[]) — the subarray to search for, may be {@code null} -
startIndexOfSubArray(int) — the starting index of the subarray to be found. -
sizeToMatch(int) — the number of elements to match from the subarray.
-
- Returns: an OptionalInt containing the last index of the subarray in the source array, or an empty {@code OptionalInt} if the subarray is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubArray </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
lastOfSubList(...) -> OptionalInt
-
Signature:
public static OptionalInt lastOfSubList(final List<?> source, final List<?> subListToFind) - Summary: Returns the last index of the specified sub-list in the given source list.
-
Parameters:
-
source(List<?>) — the list to be searched. -
subListToFind(List<?>) — the sub-list to find in the source list.
-
- Returns: an OptionalInt containing the last index of the sub-list in the source list, or an empty {@code OptionalInt} if the sub-list is not found.
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubList(final List<?> source, final int startIndexFromBack, final List<?> subListToFind) - Summary: Returns the last index of the specified sub-list in the given source list, starting from the specified index from the end.
-
Parameters:
-
source(List<?>) — the list to be searched. -
startIndexFromBack(int) — the index to start the search from the end of the list. -
subListToFind(List<?>) — the sub-list to find in the source list.
-
- Returns: an OptionalInt containing the last index of the sub-list in the source list, or an empty {@code OptionalInt} if the sub-list is not found.
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
-
Signature:
public static OptionalInt lastOfSubList(final List<?> source, final int startIndexFromBack, final List<?> subListToFind, final int startIndexOfSubList, final int sizeToMatch) throws IndexOutOfBoundsException - Summary: Returns the last index of the specified sub-list in the given source list, starting from the specified index from the end.
-
Parameters:
-
source(List<?>) — the list to be searched. -
startIndexFromBack(int) — the index to start the search from the end of the list. -
subListToFind(List<?>) — the sub-list to find in the source list. -
startIndexOfSubList(int) — the starting index of the sub-list to be found. -
sizeToMatch(int) — the number of elements to match from the sub-list.
-
- Returns: an OptionalInt containing the last index of the sub-list in the source list, or an empty {@code OptionalInt} if the sub-list is not found.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if <i> startIndexOfSubList </i> and <i> sizeToMatch </i> do not denote a valid range in <i> subArrayToFind </i> .
-
- See also: Strings#lastIndexOf(String, String), Strings#lastIndexOf(String, String, int)
allOf(...) -> BitSet
-
Signature:
public static BitSet allOf(final boolean[] source, final boolean valueToFind) - Summary: Returns the indices of all occurrences of the specified boolean value in the given array.
-
Parameters:
-
source(boolean[]) — the boolean array to be searched, may be {@code null} -
valueToFind(boolean) — the boolean value to search for
-
- Returns: a BitSet containing the zero-based indices of all occurrences of the value in the array; returns an empty BitSet if the value is not found or the array is {@code null} or empty
- See also: #allOf(boolean\[\], boolean, int), #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final boolean[] source, final boolean valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(boolean[]) — the array to be searched. -
valueToFind(boolean) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final byte[] source, final byte valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(byte[]) — the array to be searched. -
valueToFind(byte) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final byte[] source, final byte valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(byte[]) — the array to be searched. -
valueToFind(byte) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final char[] source, final char valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(char[]) — the array to be searched. -
valueToFind(char) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final char[] source, final char valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(char[]) — the array to be searched. -
valueToFind(char) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final short[] source, final short valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(short[]) — the array to be searched. -
valueToFind(short) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final short[] source, final short valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(short[]) — the array to be searched. -
valueToFind(short) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final int[] source, final int valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(int[]) — the array to be searched. -
valueToFind(int) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final int[] source, final int valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(int[]) — the array to be searched. -
valueToFind(int) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final long[] source, final long valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(long[]) — the array to be searched. -
valueToFind(long) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final long[] source, final long valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(long[]) — the array to be searched. -
valueToFind(long) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final float[] source, final float valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(float[]) — the array to be searched. -
valueToFind(float) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final float[] source, final float valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(float[]) — the array to be searched. -
valueToFind(float) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final double[] source, final double valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Parameters:
-
source(double[]) — the array to be searched. -
valueToFind(double) — the value to find in the array.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object)
-
Signature:
public static BitSet allOf(final double[] source, final double valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(double[]) — the array to be searched. -
valueToFind(double) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
- See also: #allOf(Object\[\], Object, int)
-
Signature:
public static BitSet allOf(final double[] source, final double valueToFind, final double tolerance) - Summary: Returns the indices of all occurrences of the specified double value in the given array, within a specified tolerance.
-
Parameters:
-
source(double[]) — the double array to be searched, may be {@code null} -
valueToFind(double) — the double value to search for -
tolerance(double) — the tolerance for matching; must be non-negative. A value matches if it's within {@code valueToFind ± tolerance}
-
- Returns: a BitSet containing the zero-based indices of all occurrences of values within tolerance; returns an empty BitSet if no values are found within tolerance or the array is {@code null} or empty
- See also: #allOf(double\[\], double, double, int), #allOf(double\[\], double)
-
Signature:
public static BitSet allOf(final double[] source, final double valueToFind, final double tolerance, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array within a specified tolerance, starting from the specified index.
-
Parameters:
-
source(double[]) — the array to be searched. -
valueToFind(double) — the value to find in the array. -
tolerance(double) — the tolerance within which matches will be found. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array within the specified tolerance, or an empty BitSet if the value is not found or the input array is {@code null} .
-
Signature:
public static BitSet allOf(final Object[] source, final Object valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given array.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] arr = {"a", "b", "a", "c", "a", "b"}; BitSet indices = Index.allOf(arr, "a"); // indices contains {0, 2, 4} // Convert BitSet to List List<Integer> list = indices.stream().boxed().collect(Collectors.toList()); // list = \[0, 2, 4\] // Count occurrences int count = indices.cardinality(); // returns 3 // Check if value exists boolean hasA = !indices.isEmpty(); // returns true // Handles null elements String\[\] withNulls = {"a", null, "b", null, "a"}; BitSet nullIndices = Index.allOf(withNulls, null); // nullIndices contains {1, 3} } </pre>
-
Parameters:
-
source(Object[]) — the array to be searched, may be {@code null} -
valueToFind(Object) — the value to find in the array, may be {@code null}
-
- Returns: a BitSet containing the zero-based indices of all occurrences of the value; returns an empty BitSet if the value is not found, the array is {@code null} , or empty
- See also: #allOf(Object\[\], Object, int), #of(Object\[\], Object)
-
Signature:
public static BitSet allOf(final Object[] source, final Object valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given array, starting from the specified index.
-
Parameters:
-
source(Object[]) — the array to be searched. -
valueToFind(Object) — the value to find in the array. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the array, or an empty BitSet if the value is not found or the input array is {@code null} .
-
Signature:
public static BitSet allOf(final Collection<?> source, final Object valueToFind) - Summary: Returns the indices of all occurrences of the specified value in the given collection.
-
Parameters:
-
source(Collection<?>) — the collection to be searched, may be {@code null} -
valueToFind(Object) — the value to find in the collection, may be {@code null}
-
- Returns: a BitSet containing the zero-based indices (in iteration order) of all occurrences of the value; returns an empty BitSet if the value is not found, the collection is {@code null} , or empty
- See also: #allOf(Collection, Object, int), #of(Collection, Object)
-
Signature:
public static BitSet allOf(final Collection<?> source, final Object valueToFind, final int fromIndex) - Summary: Returns the indices of all occurrences of the specified value in the given collection, starting from the specified index.
-
Parameters:
-
source(Collection<?>) — the collection to be searched. -
valueToFind(Object) — the value to find in the collection. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all occurrences of the value in the collection starting from the specified index, or an empty BitSet if the value is not found or the input collection is {@code null} .
-
Signature:
public static <T> BitSet allOf(final T[] source, final Predicate<? super T> predicate) - Summary: Returns the indices of all elements in the given array that match the provided predicate.
-
Parameters:
-
source(T[]) — the array to be searched, may be {@code null} -
predicate(Predicate<? super T>) — the predicate to test elements; must not be {@code null}
-
- Returns: a BitSet containing the zero-based indices of all elements matching the predicate; returns an empty BitSet if no elements match or the array is {@code null} or empty
- See also: #allOf(Object\[\], Predicate, int)
-
Signature:
public static <T> BitSet allOf(final T[] source, final Predicate<? super T> predicate, final int fromIndex) - Summary: Returns the indices of all elements in the given array that match the provided predicate, starting from the specified index.
-
Parameters:
-
source(T[]) — the array to be searched, may be {@code null} -
predicate(Predicate<? super T>) — the predicate to test elements; must not be {@code null} -
fromIndex(int) — the index to start the search from (inclusive); negative values are treated as 0
-
- Returns: a BitSet containing the zero-based indices of all elements at or after {@code fromIndex} matching the predicate; returns an empty BitSet if no elements match, the array is {@code null} , or {@code fromIndex >= array.length}
- See also: #allOf(Object\[\], Predicate)
-
Signature:
public static <T> BitSet allOf(final Collection<? extends T> source, final Predicate<? super T> predicate) - Summary: Returns the indices of all elements in the given collection that match the provided predicate.
-
Contract:
- <p> <b> Null Handling: </b> </p> <ul> <li> If {@code source} is {@code null} , returns empty BitSet </li> <li> If {@code predicate} is {@code null} , throws {@code NullPointerException} </li> <li> Null elements in the collection are passed to the predicate </li> </ul> <p> <b> Common Mistakes: </b> </p> <pre> {@code // DON'T: Pass null predicate Index.allOf(collection, null); // NullPointerException!
-
Parameters:
-
source(Collection<? extends T>) — the collection to be searched, may be {@code null} -
predicate(Predicate<? super T>) — the predicate to test elements; must not be {@code null}
-
- Returns: a BitSet containing the zero-based indices (in iteration order) of all elements matching the predicate; returns an empty BitSet if no elements match or the collection is {@code null} or empty
- See also: #allOf(Collection, Predicate, int)
-
Signature:
public static <T> BitSet allOf(final Collection<? extends T> source, final Predicate<? super T> predicate, final int fromIndex) - Summary: Returns the indices of all occurrences in the given collection for which the provided predicate returns {@code true} , starting from the specified index.
-
Parameters:
-
source(Collection<? extends T>) — the collection to be searched. -
predicate(Predicate<? super T>) — the predicate to use to test the elements of the collection. -
fromIndex(int) — the index to start the search from.
-
- Returns: a BitSet containing the indices of all elements in the collection for which the predicate returns {@code true} starting from the specified index, or an empty BitSet if no elements match or the input collection is {@code null} .
Public Instance Methods
- (none)
Class Indexed (com.landawn.abacus.util.Indexed)
An immutable container that pairs a value of type {@code T} with a long index position, providing a type-safe way to associate data with positional information.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Indexed<T>
-
Signature:
public static <T> Indexed<T> of(final T value, final int index) throws IllegalArgumentException - Summary: Creates a new Indexed instance with the specified value and index.
-
Parameters:
-
value(T) — the value to be associated with the index (may be {@code null} ). -
index(int) — the index position (must be non-negative, 0 to Integer.MAX_VALUE).
-
- Returns: a new immutable Indexed instance containing the specified value and index.
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative (index < 0).
-
-
Signature:
public static <T> Indexed<T> of(final T value, final long index) throws IllegalArgumentException - Summary: Creates a new Indexed instance with the specified value and index.
-
Contract:
- This overload accepts a long index for cases where the index might exceed Integer.MAX_VALUE, such as when working with very large datasets, unbounded streams, or distributed systems where indices can grow beyond the int range.
-
Parameters:
-
value(T) — the value to be associated with the index (may be {@code null} ). -
index(long) — the index position (must be non-negative, 0 to Long.MAX_VALUE).
-
- Returns: a new immutable Indexed instance containing the specified value and index.
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative (index < 0).
-
Public Instance Methods
value(...) -> T
-
Signature:
public T value() - Summary: Returns the value stored in this Indexed instance.
-
Contract:
- The returned value may be {@code null} if the Indexed instance was created with a null value.
- However, if the value itself is a mutable object (such as a List or array), modifications to that object will be reflected in subsequent calls to this method.
-
Parameters:
- (none)
- Returns: the value associated with this index, may be {@code null} .
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this Indexed instance.
-
Parameters:
- (none)
- Returns: the hash code value for this Indexed instance.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this Indexed instance to the specified object for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also an Indexed instance, and both instances have the same index and equal values.
- <p> Two Indexed instances are equal if they have the same index (primitive long comparison) and equal values.
- </p> <p> This implementation follows the general contract of {@link Object#equals(Object)} : <ul> <li> Reflexive: {@code x.equals(x)} returns {@code true} </li> <li> Symmetric: {@code x.equals(y)} returns {@code true} if and only if {@code y.equals(x)} returns {@code true} </li> <li> Transitive: If {@code x.equals(y)} and {@code y.equals(z)} , then {@code x.equals(z)} </li> <li> Consistent: Multiple invocations return the same result (assuming no modification) </li> <li> Null comparison: {@code x.equals(null)} returns {@code false} </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic equality Indexed<String> idx1 = Indexed.of("Hello", 5); Indexed<String> idx2 = Indexed.of("Hello", 5); Indexed<String> idx3 = Indexed.of("World", 5); Indexed<String> idx4 = Indexed.of("Hello", 6); idx1.equals(idx2); // true (same index and value) idx1.equals(idx3); // false (different values) idx1.equals(idx4); // false (different indices) // Null value handling Indexed<String> nullIdx1 = Indexed.of(null, 0); Indexed<String> nullIdx2 = Indexed.of(null, 0); Indexed<String> nullIdx3 = Indexed.of(null, 1); nullIdx1.equals(nullIdx2); // true (both have null values and same index) nullIdx1.equals(nullIdx3); // false (different indices) // Different types Indexed<String> strIdx = Indexed.of("Hello", 5); String str = "Hello"; strIdx.equals(str); // false (different types) // Using in collections List<Indexed<String>> list = new ArrayList<>(); Indexed<String> item = Indexed.of("test", 0); list.add(item); list.contains(Indexed.of("test", 0)); // true list.contains(Indexed.of("test", 1)); // false } </pre>
-
Parameters:
-
obj(Object) — the object to be compared for equality with this Indexed instance.
-
- Returns: {@code true} if the specified object is equal to this Indexed instance, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Indexed instance.
-
Parameters:
- (none)
- Returns: a string representation in the format {@code \[index\]=value} .
Class IndexedBoolean (com.landawn.abacus.util.IndexedBoolean)
Represents a primitive boolean value paired with an index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedBoolean
-
Signature:
public static IndexedBoolean of(final boolean value, final int index) throws IllegalArgumentException - Summary: Creates a new IndexedBoolean instance with the specified value and index.
-
Parameters:
-
value(boolean) — the boolean value to be indexed -
index(int) — the index position (must be non-negative)
-
- Returns: a new IndexedBoolean instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
-
Signature:
public static IndexedBoolean of(final boolean value, final long index) throws IllegalArgumentException - Summary: Creates a new IndexedBoolean instance with the specified value and index.
-
Parameters:
-
value(boolean) — the boolean value to be indexed -
index(long) — the index position (must be non-negative)
-
- Returns: a new IndexedBoolean instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
Public Instance Methods
value(...) -> boolean
-
Signature:
public boolean value() - Summary: Returns the boolean value stored in this IndexedBoolean instance.
-
Parameters:
- (none)
- Returns: the boolean value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this IndexedBoolean instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this IndexedBoolean instance is equal to another object.
-
Contract:
- Checks if this IndexedBoolean instance is equal to another object.
- <p> Two IndexedBoolean instances are equal if they have the same index and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this IndexedBoolean instance.
-
Parameters:
- (none)
- Returns: a string representation in the format \[index\]=value
Class IndexedByte (com.landawn.abacus.util.IndexedByte)
An immutable container that pairs a byte value with its index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedByte
-
Signature:
public static IndexedByte of(final byte value, final int index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedByte} instance with the specified value and index.
-
Parameters:
-
value(byte) — the byte value to be stored -
index(int) — the index position, must be non-negative
-
- Returns: a new {@code IndexedByte} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
-
Signature:
public static IndexedByte of(final byte value, final long index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedByte} instance with the specified value and long index.
-
Contract:
- This method is useful when working with large collections or arrays where the index might exceed the range of an int.
-
Parameters:
-
value(byte) — the byte value to be stored -
index(long) — the index position as a long, must be non-negative
-
- Returns: a new {@code IndexedByte} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
Public Instance Methods
value(...) -> byte
-
Signature:
public byte value() - Summary: Returns the byte value stored in this IndexedByte instance.
-
Parameters:
- (none)
- Returns: the byte value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this object.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this one.
-
Contract:
- Two {@code IndexedByte} objects are considered equal if they have the same index and the same value.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code IndexedByte} .
-
Parameters:
- (none)
- Returns: a string representation of this object
Class IndexedChar (com.landawn.abacus.util.IndexedChar)
An immutable container that pairs a char value with its index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedChar
-
Signature:
public static IndexedChar of(final char value, final int index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedChar} instance with the specified value and index.
-
Parameters:
-
value(char) — the char value to be stored -
index(int) — the index position, must be non-negative
-
- Returns: a new {@code IndexedChar} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
-
Signature:
public static IndexedChar of(final char value, final long index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedChar} instance with the specified value and long index.
-
Contract:
- This method is useful when working with large strings or character sequences where the index might exceed the range of an int.
-
Parameters:
-
value(char) — the char value to be stored -
index(long) — the index position as a long, must be non-negative
-
- Returns: a new {@code IndexedChar} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
Public Instance Methods
value(...) -> char
-
Signature:
public char value() - Summary: Returns the char value stored in this IndexedChar instance.
-
Parameters:
- (none)
- Returns: the char value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this object.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this one.
-
Contract:
- Two {@code IndexedChar} objects are considered equal if they have the same index and the same value.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code IndexedChar} .
-
Parameters:
- (none)
- Returns: a string representation of this object
Class IndexedDouble (com.landawn.abacus.util.IndexedDouble)
Represents a primitive double value paired with an index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedDouble
-
Signature:
public static IndexedDouble of(final double value, final int index) throws IllegalArgumentException - Summary: Creates a new IndexedDouble instance with the specified value and index.
-
Parameters:
-
value(double) — the double value to be indexed -
index(int) — the index position (must be non-negative)
-
- Returns: a new IndexedDouble instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
-
Signature:
public static IndexedDouble of(final double value, final long index) throws IllegalArgumentException - Summary: Creates a new IndexedDouble instance with the specified value and index.
-
Parameters:
-
value(double) — the double value to be indexed -
index(long) — the index position (must be non-negative)
-
- Returns: a new IndexedDouble instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
Public Instance Methods
value(...) -> double
-
Signature:
public double value() - Summary: Returns the double value stored in this IndexedDouble instance.
-
Parameters:
- (none)
- Returns: the double value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this IndexedDouble instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this IndexedDouble instance is equal to another object.
-
Contract:
- Checks if this IndexedDouble instance is equal to another object.
- <p> Two IndexedDouble instances are equal if they have the same index and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this IndexedDouble instance.
-
Parameters:
- (none)
- Returns: a string representation in the format \[index\]=value
Class IndexedFloat (com.landawn.abacus.util.IndexedFloat)
An immutable container that pairs a float value with its index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedFloat
-
Signature:
public static IndexedFloat of(final float value, final int index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedFloat} instance with the specified value and index.
-
Parameters:
-
value(float) — the float value to be stored -
index(int) — the index position, must be non-negative
-
- Returns: a new {@code IndexedFloat} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
-
Signature:
public static IndexedFloat of(final float value, final long index) throws IllegalArgumentException - Summary: Creates a new {@code IndexedFloat} instance with the specified value and long index.
-
Contract:
- This method is useful when working with large arrays or collections where the index might exceed the range of an int.
-
Parameters:
-
value(float) — the float value to be stored -
index(long) — the index position as a long, must be non-negative
-
- Returns: a new {@code IndexedFloat} instance
-
Throws:
-
java.lang.IllegalArgumentException— if the index is negative
-
Public Instance Methods
value(...) -> float
-
Signature:
public float value() - Summary: Returns the float value stored in this IndexedFloat instance.
-
Parameters:
- (none)
- Returns: the float value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this object.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this one.
-
Contract:
- Two {@code IndexedFloat} objects are considered equal if they have the same index and the same value.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code IndexedFloat} .
-
Parameters:
- (none)
- Returns: a string representation of this object
Class IndexedInt (com.landawn.abacus.util.IndexedInt)
Represents a primitive int value paired with an index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedInt
-
Signature:
public static IndexedInt of(final int value, final int index) throws IllegalArgumentException - Summary: Creates a new IndexedInt instance with the specified value and index.
-
Parameters:
-
value(int) — the int value to be indexed -
index(int) — the index position (must be non-negative)
-
- Returns: a new IndexedInt instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
-
Signature:
public static IndexedInt of(final int value, final long index) throws IllegalArgumentException - Summary: Creates a new IndexedInt instance with the specified value and index.
-
Parameters:
-
value(int) — the int value to be indexed -
index(long) — the index position (must be non-negative)
-
- Returns: a new IndexedInt instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
Public Instance Methods
value(...) -> int
-
Signature:
public int value() - Summary: Returns the int value stored in this IndexedInt instance.
-
Parameters:
- (none)
- Returns: the int value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this IndexedInt instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this IndexedInt instance is equal to another object.
-
Contract:
- Checks if this IndexedInt instance is equal to another object.
- <p> Two IndexedInt instances are equal if they have the same index and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this IndexedInt instance.
-
Parameters:
- (none)
- Returns: a string representation in the format \[index\]=value
Class IndexedKeyed (com.landawn.abacus.util.IndexedKeyed)
An immutable holder of {@code index} , {@code key} , and {@code value} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedKeyed<K, T>
-
Signature:
public static <K, T> IndexedKeyed<K, T> of(final K key, final T val, final int index) - Summary: Creates an {@code IndexedKeyed} with the specified key, value, and index.
-
Parameters:
-
key(K) — key component (nullable) -
val(T) — value component (nullable) -
index(int) — index component
-
- Returns: a new immutable {@code IndexedKeyed}
Public Instance Methods
index(...) -> int
-
Signature:
public int index() - Summary: Returns the index component.
-
Parameters:
- (none)
- Returns: index value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code based on {@code index} and {@code key} .
-
Parameters:
- (none)
- Returns: hash code for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Returns {@code true} if {@code obj} is an {@code IndexedKeyed} with equal {@code index} and {@code key} .
-
Contract:
- Returns {@code true} if {@code obj} is an {@code IndexedKeyed} with equal {@code index} and {@code key} .
-
Parameters:
-
obj(Object) — object to compare with
-
- Returns: {@code true} if equal by index and key; otherwise {@code false}
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation in the form {@code "{index=..., key=..., val=...}"} .
-
Parameters:
- (none)
- Returns: string form of this object
Class IndexedLong (com.landawn.abacus.util.IndexedLong)
Represents a primitive long value paired with an index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedLong
-
Signature:
public static IndexedLong of(final long value, final int index) throws IllegalArgumentException - Summary: Creates a new IndexedLong instance with the specified value and index.
-
Parameters:
-
value(long) — the long value to be indexed -
index(int) — the index position (must be non-negative)
-
- Returns: a new IndexedLong instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
-
Signature:
public static IndexedLong of(final long value, final long index) throws IllegalArgumentException - Summary: Creates a new IndexedLong instance with the specified value and index.
-
Parameters:
-
value(long) — the long value to be indexed -
index(long) — the index position (must be non-negative)
-
- Returns: a new IndexedLong instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
Public Instance Methods
value(...) -> long
-
Signature:
public long value() - Summary: Returns the long value stored in this IndexedLong instance.
-
Parameters:
- (none)
- Returns: the long value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this IndexedLong instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this IndexedLong instance is equal to another object.
-
Contract:
- Checks if this IndexedLong instance is equal to another object.
- <p> Two IndexedLong instances are equal if they have the same index and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this IndexedLong instance.
-
Parameters:
- (none)
- Returns: a string representation in the format \[index\]=value
Class IndexedShort (com.landawn.abacus.util.IndexedShort)
Represents a primitive short value paired with an index position.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IndexedShort
-
Signature:
public static IndexedShort of(final short value, final int index) throws IllegalArgumentException - Summary: Creates a new IndexedShort instance with the specified value and index.
-
Parameters:
-
value(short) — the short value to be indexed -
index(int) — the index position (must be non-negative)
-
- Returns: a new IndexedShort instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
-
Signature:
public static IndexedShort of(final short value, final long index) throws IllegalArgumentException - Summary: Creates a new IndexedShort instance with the specified value and index.
-
Parameters:
-
value(short) — the short value to be indexed -
index(long) — the index position (must be non-negative)
-
- Returns: a new IndexedShort instance
-
Throws:
-
java.lang.IllegalArgumentException— if index is negative
-
Public Instance Methods
value(...) -> short
-
Signature:
public short value() - Summary: Returns the short value stored in this IndexedShort instance.
-
Parameters:
- (none)
- Returns: the short value
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this IndexedShort instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this IndexedShort instance is equal to another object.
-
Contract:
- Checks if this IndexedShort instance is equal to another object.
- <p> Two IndexedShort instances are equal if they have the same index and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this IndexedShort instance.
-
Parameters:
- (none)
- Returns: a string representation in the format \[index\]=value
Class IntFunctions (com.landawn.abacus.util.IntFunctions)
Utility class providing static methods to create various types of IntFunction instances for collections, maps, arrays, and other commonly used objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntFunction<T>
-
Signature:
public static <T> IntFunction<T> of(IntFunction<T> func) - Summary: Returns the provided IntFunction as is - a shorthand identity method for IntFunction instances.
-
Parameters:
-
func(IntFunction<T>) — the IntFunction to return
-
- Returns: the IntFunction unchanged
ofBooleanArray(...) -> IntFunction<boolean\[\]>
-
Signature:
public static IntFunction<boolean[]> ofBooleanArray() - Summary: Returns an IntFunction that creates boolean arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates boolean arrays
ofCharArray(...) -> IntFunction<char\[\]>
-
Signature:
public static IntFunction<char[]> ofCharArray() - Summary: Returns an IntFunction that creates char arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates char arrays
ofByteArray(...) -> IntFunction<byte\[\]>
-
Signature:
public static IntFunction<byte[]> ofByteArray() - Summary: Returns an IntFunction that creates byte arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates byte arrays
ofShortArray(...) -> IntFunction<short\[\]>
-
Signature:
public static IntFunction<short[]> ofShortArray() - Summary: Returns an IntFunction that creates short arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates short arrays
ofIntArray(...) -> IntFunction<int\[\]>
-
Signature:
public static IntFunction<int[]> ofIntArray() - Summary: Returns an IntFunction that creates int arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates int arrays
ofLongArray(...) -> IntFunction<long\[\]>
-
Signature:
public static IntFunction<long[]> ofLongArray() - Summary: Returns an IntFunction that creates long arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates long arrays
ofFloatArray(...) -> IntFunction<float\[\]>
-
Signature:
public static IntFunction<float[]> ofFloatArray() - Summary: Returns an IntFunction that creates float arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates float arrays
ofDoubleArray(...) -> IntFunction<double\[\]>
-
Signature:
public static IntFunction<double[]> ofDoubleArray() - Summary: Returns an IntFunction that creates double arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates double arrays
ofStringArray(...) -> IntFunction<String\[\]>
-
Signature:
public static IntFunction<String[]> ofStringArray() - Summary: Returns an IntFunction that creates String arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates String arrays
ofObjectArray(...) -> IntFunction<Object\[\]>
-
Signature:
public static IntFunction<Object[]> ofObjectArray() - Summary: Returns an IntFunction that creates Object arrays of the specified size.
-
Parameters:
- (none)
- Returns: an IntFunction that creates Object arrays
ofBooleanList(...) -> IntFunction<BooleanList>
-
Signature:
public static IntFunction<BooleanList> ofBooleanList() - Summary: Returns an IntFunction that creates BooleanList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates BooleanList instances
ofCharList(...) -> IntFunction<CharList>
-
Signature:
public static IntFunction<CharList> ofCharList() - Summary: Returns an IntFunction that creates CharList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates CharList instances
ofByteList(...) -> IntFunction<ByteList>
-
Signature:
public static IntFunction<ByteList> ofByteList() - Summary: Returns an IntFunction that creates ByteList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates ByteList instances
ofShortList(...) -> IntFunction<ShortList>
-
Signature:
public static IntFunction<ShortList> ofShortList() - Summary: Returns an IntFunction that creates ShortList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates ShortList instances
ofIntList(...) -> IntFunction<IntList>
-
Signature:
public static IntFunction<IntList> ofIntList() - Summary: Returns an IntFunction that creates IntList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates IntList instances
ofLongList(...) -> IntFunction<LongList>
-
Signature:
public static IntFunction<LongList> ofLongList() - Summary: Returns an IntFunction that creates LongList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates LongList instances
ofFloatList(...) -> IntFunction<FloatList>
-
Signature:
public static IntFunction<FloatList> ofFloatList() - Summary: Returns an IntFunction that creates FloatList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates FloatList instances
ofDoubleList(...) -> IntFunction<DoubleList>
-
Signature:
public static IntFunction<DoubleList> ofDoubleList() - Summary: Returns an IntFunction that creates DoubleList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates DoubleList instances
ofList(...) -> IntFunction<List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<List<T>> ofList() - Summary: Returns an IntFunction that creates ArrayList instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates ArrayList instances
ofLinkedList(...) -> IntFunction<LinkedList<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<LinkedList<T>> ofLinkedList() - Summary: Returns an IntFunction that creates LinkedList instances.
-
Parameters:
- (none)
- Returns: an IntFunction that creates LinkedList instances
ofSet(...) -> IntFunction<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<Set<T>> ofSet() - Summary: Returns an IntFunction that creates HashSet instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates HashSet instances
ofLinkedHashSet(...) -> IntFunction<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<Set<T>> ofLinkedHashSet() - Summary: Returns an IntFunction that creates LinkedHashSet instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that creates LinkedHashSet instances
ofSortedSet(...) -> IntFunction<SortedSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<SortedSet<T>> ofSortedSet() - Summary: Returns an IntFunction that creates TreeSet instances.
-
Parameters:
- (none)
- Returns: an IntFunction that creates TreeSet instances
ofNavigableSet(...) -> IntFunction<NavigableSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<NavigableSet<T>> ofNavigableSet() - Summary: Returns an IntFunction that creates TreeSet instances as NavigableSet.
-
Parameters:
- (none)
- Returns: an IntFunction that creates TreeSet instances as NavigableSet
ofTreeSet(...) -> IntFunction<TreeSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<TreeSet<T>> ofTreeSet() - Summary: Returns an IntFunction that creates TreeSet instances.
-
Parameters:
- (none)
- Returns: an IntFunction that creates TreeSet instances
ofQueue(...) -> IntFunction<Queue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<Queue<T>> ofQueue() - Summary: Returns an IntFunction that creates LinkedList instances as Queue.
-
Parameters:
- (none)
- Returns: an IntFunction that creates Queue instances (backed by LinkedList)
ofDeque(...) -> IntFunction<Deque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<Deque<T>> ofDeque() - Summary: Returns an IntFunction that creates LinkedList instances as Deque.
-
Parameters:
- (none)
- Returns: an IntFunction that creates Deque instances (backed by LinkedList)
ofArrayDeque(...) -> IntFunction<ArrayDeque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<ArrayDeque<T>> ofArrayDeque() - Summary: Returns an IntFunction that creates ArrayDeque instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new ArrayDeque instance
- See also: ArrayDeque#ArrayDeque(int)
ofLinkedBlockingQueue(...) -> IntFunction<LinkedBlockingQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<LinkedBlockingQueue<T>> ofLinkedBlockingQueue() - Summary: Returns an IntFunction that creates LinkedBlockingQueue instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new LinkedBlockingQueue instance
- See also: LinkedBlockingQueue#LinkedBlockingQueue(int)
ofArrayBlockingQueue(...) -> IntFunction<ArrayBlockingQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<ArrayBlockingQueue<T>> ofArrayBlockingQueue() - Summary: Returns an IntFunction that creates ArrayBlockingQueue instances with the specified capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts a capacity and returns a new ArrayBlockingQueue instance
- See also: ArrayBlockingQueue#ArrayBlockingQueue(int)
ofLinkedBlockingDeque(...) -> IntFunction<LinkedBlockingDeque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<LinkedBlockingDeque<T>> ofLinkedBlockingDeque() - Summary: Returns an IntFunction that creates LinkedBlockingDeque instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new LinkedBlockingDeque instance
- See also: LinkedBlockingDeque#LinkedBlockingDeque(int)
ofConcurrentLinkedQueue(...) -> IntFunction<ConcurrentLinkedQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<ConcurrentLinkedQueue<T>> ofConcurrentLinkedQueue() - Summary: Returns an IntFunction that creates ConcurrentLinkedQueue instances.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts a capacity (ignored) and returns a new ConcurrentLinkedQueue instance
- See also: ConcurrentLinkedQueue#ConcurrentLinkedQueue()
ofPriorityQueue(...) -> IntFunction<PriorityQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<PriorityQueue<T>> ofPriorityQueue() - Summary: Returns an IntFunction that creates PriorityQueue instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new PriorityQueue instance
- See also: PriorityQueue#PriorityQueue(int)
ofMap(...) -> IntFunction<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<Map<K, V>> ofMap() - Summary: Returns an IntFunction that creates HashMap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new HashMap instance
- See also: HashMap#HashMap(int)
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<? extends Map<K, V>> ofMap(final Class<? extends Map> targetType) throws IllegalArgumentException - Summary: Returns an IntFunction that creates Map instances of the specified target type with the given initial capacity.
-
Parameters:
-
targetType(Class<? extends Map>) — the Class object representing the desired Map implementation
-
- Returns: an IntFunction that accepts an initial capacity and returns a new Map instance of the specified type
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is not a Map class or if no suitable constructor/factory can be found
-
ofLinkedHashMap(...) -> IntFunction<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<Map<K, V>> ofLinkedHashMap() - Summary: Returns an IntFunction that creates LinkedHashMap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new LinkedHashMap instance
- See also: LinkedHashMap#LinkedHashMap(int)
ofIdentityHashMap(...) -> IntFunction<IdentityHashMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<IdentityHashMap<K, V>> ofIdentityHashMap() - Summary: Returns an IntFunction that creates IdentityHashMap instances with the specified expected maximum size.
-
Contract:
- The returned function creates maps that use reference-equality instead of object-equality when comparing keys.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an expected maximum size and returns a new IdentityHashMap instance
- See also: IdentityHashMap#IdentityHashMap(int)
ofSortedMap(...) -> IntFunction<SortedMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<SortedMap<K, V>> ofSortedMap() - Summary: Returns an IntFunction that creates TreeMap instances.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts a capacity (ignored) and returns a new TreeMap instance as SortedMap
- See also: TreeMap#TreeMap()
ofNavigableMap(...) -> IntFunction<NavigableMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<NavigableMap<K, V>> ofNavigableMap() - Summary: Returns an IntFunction that creates TreeMap instances.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts a capacity (ignored) and returns a new TreeMap instance as NavigableMap
- See also: TreeMap#TreeMap()
ofTreeMap(...) -> IntFunction<TreeMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<TreeMap<K, V>> ofTreeMap() - Summary: Returns an IntFunction that creates TreeMap instances.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts a capacity (ignored) and returns a new TreeMap instance
- See also: TreeMap#TreeMap()
ofConcurrentMap(...) -> IntFunction<ConcurrentMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<ConcurrentMap<K, V>> ofConcurrentMap() - Summary: Returns an IntFunction that creates ConcurrentHashMap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new ConcurrentHashMap instance as ConcurrentMap
- See also: ConcurrentHashMap#ConcurrentHashMap(int)
ofConcurrentHashMap(...) -> IntFunction<ConcurrentHashMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<ConcurrentHashMap<K, V>> ofConcurrentHashMap() - Summary: Returns an IntFunction that creates ConcurrentHashMap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new ConcurrentHashMap instance
- See also: ConcurrentHashMap#ConcurrentHashMap(int)
ofBiMap(...) -> IntFunction<BiMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> IntFunction<BiMap<K, V>> ofBiMap() - Summary: Returns an IntFunction that creates BiMap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new BiMap instance
ofMultiset(...) -> IntFunction<Multiset<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<Multiset<T>> ofMultiset() - Summary: Returns an IntFunction that creates Multiset instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new Multiset instance
ofListMultimap(...) -> IntFunction<ListMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> IntFunction<ListMultimap<K, E>> ofListMultimap() - Summary: Returns an IntFunction that creates ListMultimap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new ListMultimap instance
ofSetMultimap(...) -> IntFunction<SetMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> IntFunction<SetMultimap<K, E>> ofSetMultimap() - Summary: Returns an IntFunction that creates SetMultimap instances with the specified initial capacity.
-
Parameters:
- (none)
- Returns: an IntFunction that accepts an initial capacity and returns a new SetMultimap instance
ofDisposableArray(...) -> IntFunction<DisposableObjArray>
-
Signature:
@Beta @SequentialOnly @Stateful public static IntFunction<DisposableObjArray> ofDisposableArray() - Summary: Returns a new created stateful IntFunction whose apply method will return the same DisposableObjArray instance.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
- (none)
- Returns: a stateful IntFunction that returns a reusable DisposableObjArray instance
-
Signature:
@Beta @SequentialOnly @Stateful public static <T> IntFunction<DisposableArray<T>> ofDisposableArray(final Class<T> componentType) - Summary: Returns a new created stateful IntFunction whose apply method will return the same DisposableArray instance.
-
Contract:
- This method is marked as Beta, SequentialOnly, and Stateful, indicating it should not be saved, cached for reuse, or used in parallel streams.
-
Parameters:
-
componentType(Class<T>) — the Class object representing the component type of the array
-
- Returns: a stateful IntFunction that returns a reusable DisposableArray instance
ofCollection(...) -> IntFunction<? extends Collection<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> IntFunction<? extends Collection<T>> ofCollection(final Class<? extends Collection> targetType) throws IllegalArgumentException - Summary: Returns an IntFunction that creates Collection instances of the specified target type with the given initial capacity.
-
Parameters:
-
targetType(Class<? extends Collection>) — the Class object representing the desired Collection implementation
-
- Returns: an IntFunction that accepts an initial capacity and returns a new Collection instance of the specified type
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is not a Collection class or if no suitable constructor/factory can be found
-
registerForCollection(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Collection> boolean registerForCollection(final Class<T> targetClass, final java.util.function.IntFunction<T> creator) throws IllegalArgumentException - Summary: Registers a custom IntFunction creator for the specified Collection target class.
-
Parameters:
-
targetClass(Class<T>) — the Class object representing the Collection type to register -
creator(java.util.function.IntFunction<T>) — the IntFunction that creates instances of the target class with specified capacity
-
- Returns: {@code true} if the registration was successful, {@code false} if a creator was already registered for this class
-
Throws:
-
java.lang.IllegalArgumentException— if targetClass or creator is {@code null} , or if targetClass is a built-in class
-
registerForMap(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Map> boolean registerForMap(final Class<T> targetClass, final java.util.function.IntFunction<T> creator) throws IllegalArgumentException - Summary: Registers a custom IntFunction creator for the specified Map target class.
-
Parameters:
-
targetClass(Class<T>) — the Class object representing the Map type to register -
creator(java.util.function.IntFunction<T>) — the IntFunction that creates instances of the target class with specified capacity
-
- Returns: {@code true} if the registration was successful, {@code false} if a creator was already registered for this class
-
Throws:
-
java.lang.IllegalArgumentException— if targetClass or creator is {@code null} , or if targetClass is a built-in class
-
ofImmutableList(...) -> IntFunction<ImmutableList<?>>
-
Signature:
@Deprecated public static IntFunction<ImmutableList<?>> ofImmutableList() - Summary: Returns an IntFunction for creating ImmutableList instances.
-
Parameters:
- (none)
- Returns: never returns normally
ofImmutableSet(...) -> IntFunction<ImmutableSet<?>>
-
Signature:
@Deprecated public static IntFunction<ImmutableSet<?>> ofImmutableSet() - Summary: Returns an IntFunction for creating ImmutableSet instances.
-
Parameters:
- (none)
- Returns: never returns normally
ofImmutableMap(...) -> IntFunction<ImmutableMap<?, ?>>
-
Signature:
@Deprecated public static IntFunction<ImmutableMap<?, ?>> ofImmutableMap() - Summary: Returns an IntFunction for creating ImmutableMap instances.
-
Parameters:
- (none)
- Returns: never returns normally
Public Instance Methods
- (none)
Class IntIterator (com.landawn.abacus.util.IntIterator)
A specialized iterator for primitive int values, providing better performance than Iterator < Integer > by avoiding boxing/unboxing overhead.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> IntIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static IntIterator empty() - Summary: Returns an empty {@code IntIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code IntIterator}
of(...) -> IntIterator
-
Signature:
public static IntIterator of(final int... a) - Summary: Creates an {@code IntIterator} from the specified int array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(int[]) — the int array (may be {@code null} )
-
- Returns: a new {@code IntIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static IntIterator of(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates an {@code IntIterator} from a subsequence of the specified int array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(int[]) — the int array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code IntIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds
-
defer(...) -> IntIterator
-
Signature:
public static IntIterator defer(final Supplier<? extends IntIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Creates a deferred IntIterator that is initialized lazily using the provided Supplier.
-
Contract:
- The Supplier is called only when the first method of the iterator is invoked.
- <p> <b> Usage Examples: </b> </p> <pre> {@code IntIterator iter = IntIterator.defer(() -> IntIterator.of(computeExpensiveArray())); // Array computation happens only when iter is first used if (condition) { iter.hasNext(); // Triggers computation } } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends IntIterator>) — a Supplier that provides the IntIterator when needed
-
- Returns: a lazily initialized IntIterator
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> IntIterator
-
Signature:
public static IntIterator generate(final IntSupplier supplier) throws IllegalArgumentException - Summary: Creates an infinite IntIterator that generates values using the provided IntSupplier.
-
Parameters:
-
supplier(IntSupplier) — the IntSupplier to generate values
-
- Returns: an infinite IntIterator
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
-
Signature:
public static IntIterator generate(final BooleanSupplier hasNext, final IntSupplier supplier) throws IllegalArgumentException - Summary: Creates an IntIterator that generates values while a condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — the BooleanSupplier that determines if more elements exist -
supplier(IntSupplier) — the IntSupplier to generate values
-
- Returns: an IntIterator that generates values conditionally
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
next(...) -> Integer
-
Signature:
@Deprecated @Override public Integer next() - Summary: Returns the next element in the iteration as a boxed Integer.
-
Parameters:
- (none)
- Returns: the next element in the iteration as a boxed Integer
nextInt(...) -> int
-
Signature:
public abstract int nextInt() - Summary: Returns the next int value in the iteration.
-
Parameters:
- (none)
- Returns: the next int value
skip(...) -> IntIterator
-
Signature:
public IntIterator skip(final long n) throws IllegalArgumentException - Summary: Skips the specified number of elements in this iterator.
-
Contract:
- <p> If n is 0, returns this iterator unchanged.
- If n is greater than or equal to the number of remaining elements, all elements will be skipped and the returned iterator will be empty.
-
Parameters:
-
n(long) — the number of elements to skip, must be non-negative
-
- Returns: this iterator if n is 0, otherwise a new IntIterator with n elements skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> IntIterator
-
Signature:
public IntIterator limit(final long count) throws IllegalArgumentException - Summary: Limits this iterator to return at most the specified number of elements.
-
Contract:
- <p> If count is 0, returns an empty iterator.
- If count is greater than or equal to the number of remaining elements, all remaining elements will be included.
-
Parameters:
-
count(long) — the maximum number of elements to return, must be non-negative
-
- Returns: an empty iterator if count is 0, otherwise a new IntIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> IntIterator
-
Signature:
public IntIterator filter(final IntPredicate predicate) throws IllegalArgumentException - Summary: Filters elements based on the given predicate.
-
Parameters:
-
predicate(IntPredicate) — the predicate to test elements
-
- Returns: a new IntIterator containing only elements that match the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalInt
-
Signature:
public OptionalInt first() - Summary: Returns the first element as an OptionalInt, or empty if no elements exist.
-
Contract:
- Returns the first element as an OptionalInt, or empty if no elements exist.
- <p> <b> Note: </b> This method consumes one element from the iterator if it exists.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the first element, or empty
last(...) -> OptionalInt
-
Signature:
public OptionalInt last() - Summary: Returns the last element as an OptionalInt, or empty if no elements exist.
-
Contract:
- Returns the last element as an OptionalInt, or empty if no elements exist.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the last element, or empty
toArray(...) -> int\[\]
-
Signature:
@SuppressWarnings("deprecation") public int[] toArray() - Summary: Converts the remaining elements to an int array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: an int array containing all remaining elements
toList(...) -> IntList
-
Signature:
public IntList toList() - Summary: Converts the remaining elements to an IntList.
-
Contract:
- If the iterator is already empty, returns an empty IntList.
-
Parameters:
- (none)
- Returns: an IntList containing all remaining elements
stream(...) -> IntStream
-
Signature:
public IntStream stream() - Summary: Converts this iterator to an IntStream for further processing.
-
Parameters:
- (none)
- Returns: an IntStream backed by this iterator
indexed(...) -> ObjIterator<IndexedInt>
-
Signature:
@Beta public ObjIterator<IndexedInt> indexed() - Summary: Returns an iterator that provides indexed access to elements.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedInt elements
-
Signature:
@Beta public ObjIterator<IndexedInt> indexed(final long startIndex) - Summary: Returns an iterator that provides indexed access to elements.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an ObjIterator of IndexedInt elements
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Integer> action) - Summary: Performs the given action for each remaining element.
-
Parameters:
-
action(java.util.function.Consumer<? super Integer>) — the action to perform
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.IntConsumer<E> action) throws E - Summary: Performs the given action for each remaining element.
-
Parameters:
-
action(Throwables.IntConsumer<E>) — the action to perform on each element, must not be null
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntIntConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its index.
-
Parameters:
-
action(Throwables.IntIntConsumer<E>) — the action to perform on each index-value pair, must not be null
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class IntList (com.landawn.abacus.util.IntList)
A high-performance, resizable array implementation for primitive int values that provides specialized operations optimized for integer data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntList
-
Signature:
public static IntList of(final int... a) - Summary: Creates a new IntList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(int[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new IntList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static IntList of(final int[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new IntList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(int[]) — the array of int values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new IntList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> IntList
-
Signature:
public static IntList copyOf(final int[] a) - Summary: Creates a new IntList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(int[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new IntList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static IntList copyOf(final int[] a, final int fromIndex, final int toIndex) - Summary: Creates a new IntList that is a copy of the specified range within the given array.
-
Parameters:
-
a(int[]) — the array from which a range is to be copied. Must not be {@code null} . -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new IntList containing a copy of the elements in the specified range
range(...) -> IntList
-
Signature:
public static IntList range(final int startInclusive, final int endExclusive) - Summary: Creates a new IntList containing a sequence of integers from startInclusive (inclusive) to endExclusive (exclusive) with a step of 1.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive)
-
- Returns: a new IntList containing integers from startInclusive to endExclusive-1
-
Signature:
public static IntList range(final int startInclusive, final int endExclusive, final int by) - Summary: Creates a new IntList containing a sequence of integers from startInclusive (inclusive) to endExclusive (exclusive), incremented by the specified step value.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive) -
by(int) — the step value for incrementing. Must not be zero.
-
- Returns: a new IntList containing the sequence of integers
rangeClosed(...) -> IntList
-
Signature:
public static IntList rangeClosed(final int startInclusive, final int endInclusive) - Summary: Creates a new IntList containing a sequence of integers from startInclusive to endInclusive (both inclusive) with a step of 1.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive)
-
- Returns: a new IntList containing integers from startInclusive to endInclusive
-
Signature:
public static IntList rangeClosed(final int startInclusive, final int endInclusive, final int by) - Summary: Creates a new IntList containing a sequence of integers from startInclusive to endInclusive (both inclusive), incremented by the specified step value.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive) -
by(int) — the step value for incrementing. Must not be zero.
-
- Returns: a new IntList containing the sequence of integers
repeat(...) -> IntList
-
Signature:
public static IntList repeat(final int element, final int len) - Summary: Creates a new IntList containing the specified element repeated the given number of times.
-
Parameters:
-
element(int) — the int value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new IntList containing the repeated elements
random(...) -> IntList
-
Signature:
public static IntList random(final int len) - Summary: Creates a new IntList filled with random int values.
-
Parameters:
-
len(int) — the number of random elements to generate. Must be non-negative.
-
- Returns: a new IntList containing random int values
- See also: Random#nextInt(), Array#random(int)
-
Signature:
public static IntList random(final int startInclusive, final int endExclusive, final int len) - Summary: Creates a new IntList filled with random int values within the specified range.
-
Parameters:
-
startInclusive(int) — the lower bound (inclusive) for the random values -
endExclusive(int) — the upper bound (exclusive) for the random values -
len(int) — the number of random elements to generate. Must be non-negative.
-
- Returns: a new IntList containing random values within the specified range
- See also: Random#nextInt(int), Array#random(int, int, int)
Public Instance Methods
<init>(...) -> void
-
Signature:
public IntList() - Summary: Constructs an empty IntList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public IntList(final int initialCapacity) - Summary: Constructs an empty IntList with the specified initial capacity.
-
Contract:
- This constructor is useful when the approximate size of the list is known in advance, as it can help avoid multiple array reallocations during element addition.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public IntList(final int[] a) - Summary: Constructs an IntList containing all elements from the specified array.
-
Parameters:
-
a(int[]) — the array whose elements are to be placed into this list. Must not be {@code null} .
-
-
Signature:
public IntList(final int[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs an IntList using the specified array as the element array for this list without copying.
-
Parameters:
-
a(int[]) — the array to be used as the element array for this list. Must not be {@code null} . -
size(int) — the number of elements in the list. Must be between 0 and a.length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> int\[\]
-
Signature:
@Beta @Deprecated @Override public int[] array() - Summary: Returns the underlying int array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal int array backing this list
get(...) -> int
-
Signature:
public int get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> int
-
Signature:
public int set(final int index, final int e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(int) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final int e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- The list will automatically grow if necessary to accommodate the new element.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(int) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final int e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(int) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final IntList c) - Summary: Appends all elements from the specified IntList to the end of this list, in the order they appear in the specified list.
-
Parameters:
-
c(IntList) — the IntList containing elements to be added to this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final int index, final IntList c) - Summary: Inserts all elements from the specified IntList into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(IntList) — the IntList containing elements to be inserted into this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty)
-
Signature:
@Override public boolean addAll(final int[] a) - Summary: Appends all elements from the specified array to the end of this list, in the order they appear in the array.
-
Parameters:
-
a(int[]) — the array containing elements to be added to this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty)
-
Signature:
@Override public boolean addAll(final int index, final int[] a) - Summary: Inserts all elements from the specified array into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(int[]) — the array containing elements to be inserted into this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty)
remove(...) -> boolean
-
Signature:
public boolean remove(final int e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(int) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final int e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(int) — the element to be removed from this list
-
- Returns: {@code true} if this list was modified (i.e., at least one occurrence was removed); {@code false} otherwise
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final IntList c) - Summary: Removes from this list all of its elements that are contained in the specified IntList.
-
Parameters:
-
c(IntList) — the IntList containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call
-
Signature:
@Override public boolean removeAll(final int[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Parameters:
-
a(int[]) — the array containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final IntPredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(IntPredicate) — the predicate which returns {@code true} for elements to be removed. Must not be {@code null} .
-
- Returns: {@code true} if any elements were removed; {@code false} if the list was unchanged
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only the first occurrence of each value.
-
Contract:
- If the list is sorted, this method uses an optimized algorithm.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed from this list
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final IntList c) - Summary: Retains only the elements in this list that are contained in the specified IntList.
-
Parameters:
-
c(IntList) — the IntList containing elements to be retained in this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call
-
Signature:
@Override public boolean retainAll(final int[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(int[]) — the array containing elements to be retained in this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call
delete(...) -> int
-
Signature:
public int delete(final int index) - Summary: Removes the element at the specified position in this list and returns it.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes the elements at the specified positions from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed. If {@code null} or empty, this list remains unchanged.
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes from this list all elements whose index is between fromIndex (inclusive) and toIndex (exclusive).
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive) -
toIndex(int) — the index after the last element to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final IntList replacement) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with elements from the replacement IntList.
-
Contract:
- <p> If the replacement list has a different size than the range being replaced, the list will grow or shrink accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to replace -
toIndex(int) — the ending index (exclusive) of the range to replace -
replacement(IntList) — the IntList whose elements will replace the specified range. If {@code null} or empty, this list remains unchanged.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final int[] replacement) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with elements from the replacement array.
-
Contract:
- <p> If the replacement array has a different length than the range being replaced, the list will grow or shrink accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to replace -
toIndex(int) — the ending index (exclusive) of the range to replace -
replacement(int[]) — the array whose elements will replace the specified range. If {@code null} or empty, this list remains unchanged.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final int oldVal, final int newVal) - Summary: Replaces all occurrences of the specified value in this list with the new value.
-
Parameters:
-
oldVal(int) — the value to be replaced -
newVal(int) — the value to replace oldVal
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final IntUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the specified operator to that element.
-
Parameters:
-
operator(IntUnaryOperator) — the operator to apply to each element
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final IntPredicate predicate, final int newValue) - Summary: Replaces all elements in this list that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(IntPredicate) — the predicate which returns {@code true} for elements to be replaced -
newValue(int) — the value to replace matching elements with
-
- Returns: {@code true} if at least one element was replaced
fill(...) -> void
-
Signature:
public void fill(final int val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(int) — the value to be stored in all elements of the list
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final int val) throws IndexOutOfBoundsException - Summary: Replaces each element in the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled with the specified value -
toIndex(int) — the index after the last element (exclusive) to be filled with the specified value -
val(int) — the value to be stored in the specified range of the list
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
contains(...) -> boolean
-
Signature:
public boolean contains(final int valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(int) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final IntList c) - Summary: Returns {@code true} if this list contains any element that is also contained in the specified IntList.
-
Contract:
- Returns {@code true} if this list contains any element that is also contained in the specified IntList.
- This method returns {@code true} if the two lists share at least one common element.
-
Parameters:
-
c(IntList) — the IntList to be checked for containment in this list
-
- Returns: {@code true} if this list contains any element from the specified list
-
Signature:
@Override public boolean containsAny(final int[] a) - Summary: Returns {@code true} if this list contains any element that is also contained in the specified array.
-
Contract:
- Returns {@code true} if this list contains any element that is also contained in the specified array.
- This method returns {@code true} if this list and the array share at least one common element.
-
Parameters:
-
a(int[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains any element from the specified array
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final IntList c) - Summary: Returns {@code true} if this list contains all elements in the specified IntList.
-
Contract:
- Returns {@code true} if this list contains all elements in the specified IntList.
- This method returns {@code true} if the specified list is a subset of this list (ignoring element order but considering duplicates).
-
Parameters:
-
c(IntList) — the IntList to be checked for containment in this list
-
- Returns: {@code true} if this list contains all elements in the specified list
-
Signature:
@Override public boolean containsAll(final int[] a) - Summary: Returns {@code true} if this list contains all elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all elements in the specified array.
- This method returns {@code true} if all elements in the array are present in this list (ignoring element order but considering duplicates).
-
Parameters:
-
a(int[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains all elements in the specified array
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final IntList c) - Summary: Returns {@code true} if this list has no elements in common with the specified IntList.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified IntList.
- Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(IntList) — the IntList to check for disjointness with this list
-
- Returns: {@code true} if the two lists have no elements in common
-
Signature:
@Override public boolean disjoint(final int[] b) - Summary: Returns {@code true} if this list has no elements in common with the specified array.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified array.
- This list and the array are disjoint if they share no common elements.
-
Parameters:
-
b(int[]) — the array to check for disjointness with this list
-
- Returns: {@code true} if this list and the array have no elements in common
intersection(...) -> IntList
-
Signature:
@Override public IntList intersection(final IntList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(IntList) — the list to find common elements with this list
-
- Returns: a new IntList containing elements present in both lists, considering the minimum number of occurrences in either list. Returns an empty list if either list is empty.
- See also: #intersection(int\[\]), #difference(IntList), #symmetricDifference(IntList)
-
Signature:
@Override public IntList intersection(final int[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(int[]) — the array to find common elements with this list
-
- Returns: a new IntList containing elements present in both this list and the array, considering the minimum number of occurrences. Returns an empty list if the array is empty.
- See also: #intersection(IntList), #difference(int\[\]), #symmetricDifference(int\[\])
difference(...) -> IntList
-
Signature:
@Override public IntList difference(final IntList b) - Summary: Returns a new list containing elements that are in this list but not in the specified list, considering the number of occurrences of each element.
-
Contract:
- If an element appears multiple times in both lists, the difference will contain the extra occurrences from this list.
-
Parameters:
-
b(IntList) — the list whose elements are to be removed from this list
-
- Returns: a new IntList containing elements present in this list but not in the specified list, considering the number of occurrences
- See also: #difference(int\[\]), #symmetricDifference(IntList), #intersection(IntList)
-
Signature:
@Override public IntList difference(final int[] b) - Summary: Returns a new list containing elements that are in this list but not in the specified array, considering the number of occurrences of each element.
-
Contract:
- If an element appears multiple times in both sources, the difference will contain the extra occurrences from this list.
-
Parameters:
-
b(int[]) — the array whose elements are to be removed from this list
-
- Returns: a new IntList containing elements present in this list but not in the array, considering the number of occurrences. Returns a copy of this list if the array is empty.
- See also: #difference(IntList), #symmetricDifference(int\[\]), #intersection(int\[\])
symmetricDifference(...) -> IntList
-
Signature:
@Override public IntList symmetricDifference(final IntList b) - Summary: Returns a new IntList containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
b(IntList) — the list to compare with this list for symmetric difference
-
- Returns: a new IntList containing elements that are in either list but not in both, considering the number of occurrences
- See also: #symmetricDifference(int\[\]), #difference(IntList), #intersection(IntList)
-
Signature:
@Override public IntList symmetricDifference(final int[] b) - Summary: Returns a new IntList containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
b(int[]) — the array to compare with this list for symmetric difference
-
- Returns: a new IntList containing elements that are in either this list or the array but not in both, considering the number of occurrences
- See also: #symmetricDifference(IntList), #difference(int\[\]), #intersection(int\[\])
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final int valueToFind) - Summary: Returns the number of times the specified value appears in this list.
-
Parameters:
-
valueToFind(int) — the value whose frequency is to be determined
-
- Returns: the number of times the value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final int valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(int) — the element to search for
-
- Returns: the index of the first occurrence of the element, or -1 if not found
-
Signature:
public int indexOf(final int valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(int) — the element to search for -
fromIndex(int) — the index to start searching from (inclusive)
-
- Returns: the index of the first occurrence of the element at or after fromIndex, or -1 if not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final int valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Parameters:
-
valueToFind(int) — the element to search for
-
- Returns: the index of the last occurrence of the element, or -1 if not found
-
Signature:
public int lastIndexOf(final int valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Parameters:
-
valueToFind(int) — the element to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). The search includes this index if it's within bounds.
-
- Returns: the index of the last occurrence of the element at or before startIndexFromBack, or -1 if not found
min(...) -> OptionalInt
-
Signature:
public OptionalInt min() - Summary: Returns the minimum element in this list wrapped in an OptionalInt.
-
Contract:
- If the list is empty, returns an empty OptionalInt.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the minimum element, or an empty OptionalInt if the list is empty
-
Signature:
public OptionalInt min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum element in the specified range of this list wrapped in an OptionalInt.
-
Contract:
- If the range is empty (fromIndex equals toIndex), returns an empty OptionalInt.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) in the range -
toIndex(int) — the index after the last element (exclusive) in the range
-
- Returns: an OptionalInt containing the minimum element in the range, or an empty OptionalInt if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
max(...) -> OptionalInt
-
Signature:
public OptionalInt max() - Summary: Returns the maximum element in this list wrapped in an OptionalInt.
-
Contract:
- If the list is empty, returns an empty OptionalInt.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the maximum element, or an empty OptionalInt if the list is empty
-
Signature:
public OptionalInt max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the maximum element in the specified range of this list wrapped in an OptionalInt.
-
Contract:
- If the range is empty (fromIndex equals toIndex), returns an empty OptionalInt.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) in the range -
toIndex(int) — the index after the last element (exclusive) in the range
-
- Returns: an OptionalInt containing the maximum element in the range, or an empty OptionalInt if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
median(...) -> OptionalInt
-
Signature:
public OptionalInt median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the median value if the list is non-empty, or an empty OptionalInt if the list is empty
-
Signature:
public OptionalInt median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalInt containing the median value if the range is non-empty, or an empty OptionalInt if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
forEach(...) -> void
-
Signature:
public void forEach(final IntConsumer action) - Summary: Performs the given action for each element in this list in sequential order.
-
Parameters:
-
action(IntConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final IntConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element within the specified range of this list.
-
Contract:
- <p> This method supports both forward and backward iteration based on the relative values of fromIndex and toIndex: </p> <ul> <li> If {@code fromIndex <= toIndex} : iterates forward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code fromIndex > toIndex} : iterates backward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code toIndex == -1} : treated as backward iteration from fromIndex to the beginning of the list </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code IntList list = IntList.of(10, 20, 30, 40, 50); list.forEach(0, 3, action); // Forward: processes indices 0,1,2 list.forEach(3, 0, action); // Backward: processes indices 3,2,1 list.forEach(4, -1, action); // Backward: processes indices 4,3,2,1,0 } </pre>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for backward iteration to the start -
action(IntConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code index < 0 || index >= size()} )
-
first(...) -> OptionalInt
-
Signature:
public OptionalInt first() - Summary: Returns the first element in this list wrapped in an OptionalInt.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the first element if the list is not empty, or an empty OptionalInt if the list is empty
last(...) -> OptionalInt
-
Signature:
public OptionalInt last() - Summary: Returns the last element in this list wrapped in an OptionalInt.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the last element if the list is not empty, or an empty OptionalInt if the list is empty
distinct(...) -> IntList
-
Signature:
@Override public IntList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new IntList containing only the distinct elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to process -
toIndex(int) — the ending index (exclusive) of the range to process
-
- Returns: a new IntList containing only distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains any duplicate elements.
-
Contract:
- An element is considered a duplicate if it appears more than once in the list.
-
Parameters:
- (none)
- Returns: {@code true} if the list contains at least one duplicate element, {@code false} otherwise
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if all elements are in ascending order (allowing equal consecutive values), {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts all elements in this list in ascending order.
-
Parameters:
- (none)
- Performance: <p> The sorting algorithm used is typically a dual-pivot quicksort which offers O(n log n) performance on average.
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts all elements in this list in ascending order using a parallel sorting algorithm.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts all elements in this list in descending order.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final int valueToFind) - Summary: Searches for the specified value in this list using binary search algorithm.
-
Contract:
- The list must be sorted in ascending order prior to making this call.
- If the list is not sorted, the results are undefined.
- <p> If the list contains multiple elements equal to the specified value, there is no guarantee which one will be found.
-
Parameters:
-
valueToFind(int) — the value to search for
-
- Returns: the index of the search key if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the list
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final int valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified value in the specified range of this list using binary search algorithm.
-
Contract:
- The range must be sorted in ascending order prior to making this call.
- If the range is not sorted, the results are undefined.
- <p> If the range contains multiple elements equal to the specified value, there is no guarantee which one will be found.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to search -
toIndex(int) — the ending index (exclusive) of the range to search -
valueToFind(int) — the value to search for
-
- Returns: the index of the search key if it is contained in the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to reverse -
toIndex(int) — the ending index (exclusive) of the range to reverse
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles all elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles all elements in this list using the specified source of randomness.
-
Parameters:
-
rnd(Random) — the source of randomness to use for shuffling
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> IntList
-
Signature:
@Override public IntList copy() - Summary: Returns a new IntList containing a copy of all elements in this list.
-
Parameters:
- (none)
- Returns: a new IntList containing all elements from this list
-
Signature:
@Override public IntList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new IntList containing a copy of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy
-
- Returns: a new IntList containing the elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
-
Signature:
@Override public IntList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a new IntList containing a copy of elements from the specified range of this list, selecting only elements at intervals defined by the step parameter.
-
Contract:
- If step is negative and fromIndex > toIndex, elements are selected in reverse order.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy -
step(int) — the interval between selected elements. Must not be zero. Positive values select elements in forward direction, negative values select elements in reverse direction
-
- Returns: a new IntList containing the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<IntList>
-
Signature:
@Override public List<IntList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into consecutive chunks of the specified size and returns them as a List of IntLists.
-
Contract:
- The last chunk may have fewer elements if the range size is not evenly divisible by chunkSize.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to split -
toIndex(int) — the ending index (exclusive) of the range to split -
chunkSize(int) — the desired size of each chunk. Must be greater than 0
-
- Returns: a List containing the IntList chunks
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
trimToSize(...) -> IntList
-
Signature:
@Override public IntList trimToSize() - Summary: Trims the capacity of this IntList instance to be the list's current size.
-
Contract:
- If the capacity is already equal to the size, this method does nothing.
-
Parameters:
- (none)
- Returns: this IntList instance (for method chaining)
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() -
Parameters:
- (none)
- Returns: unspecified
boxed(...) -> List<Integer>
-
Signature:
@Override public List<Integer> boxed() - Summary: Returns a List containing all elements in this list converted to Integer objects.
-
Contract:
- <p> This method is useful when you need to work with APIs that require List < Integer > rather than primitive int arrays.
-
Parameters:
- (none)
- Returns: a new List < Integer > containing all elements from this list
-
Signature:
@Override public List<Integer> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a List containing elements from the specified range of this list converted to Integer objects.
-
Contract:
- <p> This method is useful when you need to work with APIs that require List < Integer > rather than primitive int arrays.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to box -
toIndex(int) — the ending index (exclusive) of the range to box
-
- Returns: a new List < Integer > containing elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
toArray(...) -> int\[\]
-
Signature:
@Override public int[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new int array containing all elements of this list
toLongList(...) -> LongList
-
Signature:
public LongList toLongList() - Summary: Converts this IntList to a LongList.
-
Parameters:
- (none)
- Returns: a new LongList containing all elements from this list converted to long values
toFloatList(...) -> FloatList
-
Signature:
public FloatList toFloatList() - Summary: Converts this IntList to a FloatList.
-
Parameters:
- (none)
- Returns: a new FloatList containing all elements from this list converted to float values
toDoubleList(...) -> DoubleList
-
Signature:
public DoubleList toDoubleList() - Summary: Converts this IntList to a DoubleList.
-
Parameters:
- (none)
- Returns: a new DoubleList containing all elements from this list converted to double values
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Integer>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance with the given initial capacity
-
- Returns: a Collection containing Integer objects from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
toMultiset(...) -> Multiset<Integer>
-
Signature:
@Override public Multiset<Integer> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Integer>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<Multiset<Integer>>) — a function that creates a new Multiset instance with the given initial capacity
-
- Returns: a Multiset containing Integer objects from the specified range with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
iterator(...) -> IntIterator
-
Signature:
@Override public IntIterator iterator() - Summary: Returns an iterator over all elements in this list.
-
Parameters:
- (none)
- Returns: an IntIterator over the elements in this list
stream(...) -> IntStream
-
Signature:
public IntStream stream() - Summary: Returns an IntStream with all elements of this list as its source.
-
Parameters:
- (none)
- Returns: an IntStream of all elements in this list
-
Signature:
public IntStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an IntStream with elements from the specified range of this list as its source.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to stream -
toIndex(int) — the ending index (exclusive) of the range to stream
-
- Returns: an IntStream of elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
getFirst(...) -> int
-
Signature:
public int getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first int value in the list
getLast(...) -> int
-
Signature:
public int getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last int value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final int e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(int) — the element to add at the beginning of the list
-
- Performance: <p> This operation has O(n) time complexity where n is the size of the list.
addLast(...) -> void
-
Signature:
public void addLast(final int e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(int) — the element to add at the end of the list
-
- Performance: This operation has amortized O(1) time complexity.
removeFirst(...) -> int
-
Signature:
public int removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first int value that was removed from the list
- Performance: <p> This operation has O(n) time complexity where n is the size of the list.
removeLast(...) -> int
-
Signature:
public int removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last int value that was removed from the list
- Performance: This operation has O(1) time complexity.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this list for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also an IntList, both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
- <p> Two int values are considered equal if they have the same value.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class InternalUtil (com.landawn.abacus.util.InternalUtil)
Internal utility class for the abacus-common library.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getCharsForReadOnly(...) -> char\[\]
-
Signature:
@Deprecated @Beta public static char[] getCharsForReadOnly(final String str) - Summary: Gets the character array from a string for read-only purposes.
-
Contract:
- The returned array should not be modified as it may be shared with the original string.
-
Parameters:
-
str(String) — the string to get characters from
-
- Returns: a character array (may be shared, do not modify)
Public Instance Methods
- (none)
Class Iterables (com.landawn.abacus.util.Iterables)
A comprehensive utility class providing an extensive collection of static methods for iterable operations, transformations, aggregations, and manipulations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
firstNonNull(...) -> T
-
Signature:
@MayReturnNull @Beta public static <T> T firstNonNull(final T a, final T b) - Summary: Returns the first {@code non-null} element from the provided two elements.
-
Contract:
- If both are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T) — the first element to evaluate. -
b(T) — the second element to evaluate.
-
- Returns: the first {@code non-null} element, or {@code null} if both are {@code null} .
- See also: N#firstNonNull(Object, Object)
-
Signature:
@MayReturnNull @Beta public static <T> T firstNonNull(final T a, final T b, final T c) - Summary: Returns the first {@code non-null} element from the provided three elements.
-
Contract:
- If all are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T) — the first element to evaluate. -
b(T) — the second element to evaluate. -
c(T) — the third element to evaluate.
-
- Returns: the first {@code non-null} element, or {@code null} if all are {@code null} .
- See also: N#firstNonNull(Object, Object, Object)
-
Signature:
@MayReturnNull @Beta @SafeVarargs public static <T> T firstNonNull(final T... a) - Summary: Returns the first {@code non-null} element from the provided array of elements.
-
Contract:
- If the array is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: the first {@code non-null} element, or {@code null} if the array is {@code null} or empty.
- See also: N#firstNonNull(Object\[\])
-
Signature:
@MayReturnNull @Beta public static <T> T firstNonNull(final Iterable<? extends T> c) - Summary: Returns the first {@code non-null} element from the provided iterable.
-
Contract:
- If the iterable is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: the first {@code non-null} element, or {@code null} if the iterable is {@code null} or empty.
- See also: N#firstNonNull(Iterable), CommonUtil#firstNonNullOrDefault(Iterable, Object)
-
Signature:
@MayReturnNull @Beta public static <T> T firstNonNull(final Iterator<? extends T> iter) - Summary: Returns the first {@code non-null} element from the provided iterator.
-
Contract:
- If the iterator is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate.
-
- Returns: the first {@code non-null} element, or {@code null} if the iterator is {@code null} or empty.
- See also: N#firstNonNull(Iterator), CommonUtil#firstNonNullOrDefault(Iterator, Object)
lastNonNull(...) -> T
-
Signature:
@MayReturnNull @Beta public static <T> T lastNonNull(final T a, final T b) - Summary: Returns the last {@code non-null} element from the provided two elements.
-
Contract:
- If both are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T) — the first element to evaluate. -
b(T) — the second element to evaluate.
-
- Returns: the last {@code non-null} element, or {@code null} if both are {@code null} .
- See also: N#lastNonNull(Object, Object)
-
Signature:
@MayReturnNull @Beta public static <T> T lastNonNull(final T a, final T b, final T c) - Summary: Returns the last {@code non-null} element from the provided three elements.
-
Contract:
- If all are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T) — the first element to evaluate. -
b(T) — the second element to evaluate. -
c(T) — the third element to evaluate.
-
- Returns: the last {@code non-null} element, or {@code null} if all are {@code null} .
- See also: N#lastNonNull(Object, Object, Object)
-
Signature:
@MayReturnNull @Beta @SafeVarargs public static <T> T lastNonNull(final T... a) - Summary: Returns the last {@code non-null} element from the provided array of elements.
-
Contract:
- If the array is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: the last {@code non-null} element, or {@code null} if the array is {@code null} or empty.
- See also: N#lastNonNull(Object\[\])
-
Signature:
@MayReturnNull @Beta public static <T> T lastNonNull(final Iterable<? extends T> c) - Summary: Returns the last {@code non-null} element from the provided iterable.
-
Contract:
- If the iterable is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: the last {@code non-null} element, or {@code null} if the iterable is {@code null} or empty.
- See also: N#lastNonNull(Iterable), CommonUtil#lastNonNullOrDefault(Iterable, Object)
-
Signature:
@MayReturnNull @Beta public static <T> T lastNonNull(final Iterator<? extends T> iter) - Summary: Returns the last {@code non-null} element from the provided iterator.
-
Contract:
- If the iterator is {@code null} or empty, or all elements are {@code null} , it returns {@code null} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate.
-
- Returns: the last {@code non-null} element, or {@code null} if the iterator is {@code null} or empty.
- See also: N#lastNonNull(Iterator), CommonUtil#lastNonNullOrDefault(Iterator, Object)
min(...) -> OptionalChar
-
Signature:
public static OptionalChar min(final char... a) - Summary: Returns the minimum value from the provided array of characters.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalChar} .
-
Parameters:
-
a(char[]) — the array of characters to evaluate.
-
- Returns: an {@code OptionalChar} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalChar} .
- See also: N#min(char...)
-
Signature:
public static OptionalByte min(final byte... a) - Summary: Returns the minimum value from the provided array of bytes.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalByte} .
-
Parameters:
-
a(byte[]) — the array of bytes to evaluate.
-
- Returns: an {@code OptionalByte} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalByte} .
- See also: N#min(byte...)
-
Signature:
public static OptionalShort min(final short... a) - Summary: Returns the minimum value from the provided array of shorts.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalShort} .
-
Parameters:
-
a(short[]) — the array of shorts to evaluate.
-
- Returns: an {@code OptionalShort} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalShort} .
- See also: N#min(short...)
-
Signature:
public static OptionalInt min(final int... a) - Summary: Returns the minimum value from the provided array of integers.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(int[]) — the array of integers to evaluate.
-
- Returns: an {@code OptionalInt} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#min(int...)
-
Signature:
public static OptionalLong min(final long... a) - Summary: Returns the minimum value from the provided array of longs.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
a(long[]) — the array of longs to evaluate.
-
- Returns: an {@code OptionalLong} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#min(long...)
-
Signature:
public static OptionalFloat min(final float... a) - Summary: Returns the minimum value from the provided array of floats.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalFloat} .
-
Parameters:
-
a(float[]) — the array of floats to evaluate.
-
- Returns: an {@code OptionalFloat} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalFloat} .
- See also: N#min(float...)
-
Signature:
public static OptionalDouble min(final double... a) - Summary: Returns the minimum value from the provided array of doubles.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(double[]) — the array of doubles to evaluate.
-
- Returns: an {@code OptionalDouble} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#min(double...)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> min(final T[] a) - Summary: Returns the minimum value from the provided array of elements based on their natural ordering.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: a {@code Nullable} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Comparable...)
-
Signature:
public static <T> Nullable<T> min(final T[] a, final Comparator<? super T> cmp) - Summary: Returns the minimum value from the provided array of elements according to the provided comparator.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> min(final Iterable<? extends T> c) - Summary: Returns the minimum value from the provided iterable of elements based on their natural ordering.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: a {@code Nullable} containing the minimum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterable)
-
Signature:
public static <T> Nullable<T> min(final Iterable<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns the minimum value from the provided iterable of elements according to the provided comparator.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the minimum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> min(final Iterator<? extends T> iter) - Summary: Returns the minimum value from the provided iterator of elements based on their natural ordering.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate.
-
- Returns: a {@code Nullable} containing the minimum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterator)
-
Signature:
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE") public static <T> Nullable<T> min(final Iterator<? extends T> iter, Comparator<? super T> cmp) - Summary: Returns the minimum value from the provided iterator of elements according to the provided comparator.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the minimum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterator, Comparator)
minBy(...) -> Nullable<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> minBy(final T[] a, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the minimum value from the provided array of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the minimum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Object\[\], Comparator)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> minBy(final Iterable<? extends T> c, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the minimum value from the provided iterable of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the minimum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterable, Comparator)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> minBy(final Iterator<? extends T> iter, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the minimum value from the provided iterator of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the minimum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#min(Iterator, Comparator)
minInt(...) -> OptionalInt
-
Signature:
@Beta public static <T> OptionalInt minInt(final T[] a, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the minimum integer value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the minimum extracted integer value if the array is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#minIntOrDefaultIfEmpty(Object\[\], ToIntFunction, int)
-
Signature:
@Beta public static <T> OptionalInt minInt(final Iterable<? extends T> c, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the minimum integer value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the minimum extracted integer value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#minIntOrDefaultIfEmpty(Iterable, ToIntFunction, int)
-
Signature:
@Beta public static <T> OptionalInt minInt(final Iterator<? extends T> iter, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the minimum integer value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the minimum extracted integer value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#minIntOrDefaultIfEmpty(Iterator, ToIntFunction, int)
minLong(...) -> OptionalLong
-
Signature:
@Beta public static <T> OptionalLong minLong(final T[] a, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the minimum long value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the minimum extracted long value if the array is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#minLongOrDefaultIfEmpty(Object\[\], ToLongFunction, long)
-
Signature:
@Beta public static <T> OptionalLong minLong(final Iterable<? extends T> c, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the minimum long value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the minimum extracted long value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#minLongOrDefaultIfEmpty(Iterable, ToLongFunction, long)
-
Signature:
@Beta public static <T> OptionalLong minLong(final Iterator<? extends T> iter, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the minimum long value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the minimum extracted long value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#minLongOrDefaultIfEmpty(Iterator, ToLongFunction, long)
minDouble(...) -> OptionalDouble
-
Signature:
@Beta public static <T> OptionalDouble minDouble(final T[] a, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the minimum double value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the minimum extracted double value if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#minDoubleOrDefaultIfEmpty(Object\[\], ToDoubleFunction, double)
-
Signature:
@Beta public static <T> OptionalDouble minDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the minimum double value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the minimum extracted double value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#minDoubleOrDefaultIfEmpty(Iterable, ToDoubleFunction, double)
-
Signature:
@Beta public static <T> OptionalDouble minDouble(final Iterator<? extends T> iter, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the minimum double value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the minimum extracted double value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#minDoubleOrDefaultIfEmpty(Iterator, ToDoubleFunction, double)
max(...) -> OptionalChar
-
Signature:
public static OptionalChar max(final char... a) - Summary: Returns the maximum value from the provided array of characters.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalChar} .
-
Parameters:
-
a(char[]) — the array of characters to evaluate.
-
- Returns: an {@code OptionalChar} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalChar} .
- See also: N#max(char...)
-
Signature:
public static OptionalByte max(final byte... a) - Summary: Returns the maximum value from the provided array of bytes.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalByte} .
-
Parameters:
-
a(byte[]) — the array of bytes to evaluate.
-
- Returns: an {@code OptionalByte} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalByte} .
- See also: N#max(byte...)
-
Signature:
public static OptionalShort max(final short... a) - Summary: Returns the maximum value from the provided array of shorts.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalShort} .
-
Parameters:
-
a(short[]) — the array of shorts to evaluate.
-
- Returns: an {@code OptionalShort} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalShort} .
- See also: N#max(short...)
-
Signature:
public static OptionalInt max(final int... a) - Summary: Returns the maximum value from the provided array of integers.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(int[]) — the array of integers to evaluate.
-
- Returns: an {@code OptionalInt} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#max(int...)
-
Signature:
public static OptionalLong max(final long... a) - Summary: Returns the maximum value from the provided array of longs.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
a(long[]) — the array of longs to evaluate.
-
- Returns: an {@code OptionalLong} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#max(long...)
-
Signature:
public static OptionalFloat max(final float... a) - Summary: Returns the maximum value from the provided array of floats.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalFloat} .
-
Parameters:
-
a(float[]) — the array of floats to evaluate.
-
- Returns: an {@code OptionalFloat} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalFloat} .
- See also: N#max(float...)
-
Signature:
public static OptionalDouble max(final double... a) - Summary: Returns the maximum value from the provided array of doubles.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(double[]) — the array of doubles to evaluate.
-
- Returns: an {@code OptionalDouble} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#max(double...)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> max(final T[] a) - Summary: Returns the maximum value from the provided array of elements based on their natural ordering.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: a {@code Nullable} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Comparable...)
-
Signature:
public static <T> Nullable<T> max(final T[] a, final Comparator<? super T> cmp) - Summary: Returns the maximum value from the provided array of elements according to the provided comparator.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> max(final Iterable<? extends T> c) - Summary: Returns the maximum value from the provided iterable of elements based on their natural ordering.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: a {@code Nullable} containing the maximum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterable)
-
Signature:
public static <T> Nullable<T> max(final Iterable<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns the maximum value from the provided iterable of elements according to the provided comparator.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the maximum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> max(final Iterator<? extends T> iter) - Summary: Returns the maximum value from the provided iterator of elements based on their natural ordering.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate.
-
- Returns: a {@code Nullable} containing the maximum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterator)
-
Signature:
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE") public static <T> Nullable<T> max(final Iterator<? extends T> iter, Comparator<? super T> cmp) - Summary: Returns the maximum value from the provided iterator of elements according to the provided comparator.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the maximum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterator, Comparator)
maxBy(...) -> Nullable<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> maxBy(final T[] a, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the maximum value from the provided array of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the maximum value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Object\[\], Comparator)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> maxBy(final Iterable<? extends T> c, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the maximum value from the provided iterable of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the maximum value if the iterable is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterable, Comparator)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Nullable<T> maxBy(final Iterator<? extends T> iter, final Function<? super T, ? extends Comparable> keyExtractor) - Summary: Returns the maximum value from the provided iterator of elements according to the key extracted by the {@code keyExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code Nullable} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to transform the elements into a comparable type for comparison.
-
- Returns: a {@code Nullable} containing the maximum value if the iterator is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#max(Iterator, Comparator)
maxInt(...) -> OptionalInt
-
Signature:
@Beta public static <T> OptionalInt maxInt(final T[] a, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the maximum integer value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the maximum extracted integer value if the array is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#maxIntOrDefaultIfEmpty(Object\[\], ToIntFunction, int)
-
Signature:
@Beta public static <T> OptionalInt maxInt(final Iterable<? extends T> c, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the maximum integer value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the maximum extracted integer value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#maxIntOrDefaultIfEmpty(Iterable, ToIntFunction, int)
-
Signature:
@Beta public static <T> OptionalInt maxInt(final Iterator<? extends T> iter, final ToIntFunction<? super T> valueExtractor) - Summary: Returns the maximum integer value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the maximum extracted integer value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#maxIntOrDefaultIfEmpty(Iterator, ToIntFunction, int)
maxLong(...) -> OptionalLong
-
Signature:
@Beta public static <T> OptionalLong maxLong(final T[] a, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the maximum long value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the maximum extracted long value if the array is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#maxLongOrDefaultIfEmpty(Object\[\], ToLongFunction, long)
-
Signature:
@Beta public static <T> OptionalLong maxLong(final Iterable<? extends T> c, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the maximum long value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the maximum extracted long value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#maxLongOrDefaultIfEmpty(Iterable, ToLongFunction, long)
-
Signature:
@Beta public static <T> OptionalLong maxLong(final Iterator<? extends T> iter, final ToLongFunction<? super T> valueExtractor) - Summary: Returns the maximum long value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the maximum extracted long value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#maxLongOrDefaultIfEmpty(Iterator, ToLongFunction, long)
maxDouble(...) -> OptionalDouble
-
Signature:
@Beta public static <T> OptionalDouble maxDouble(final T[] a, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the maximum double value extracted from the elements in the provided array by the input {@code valueExtractor} function.
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the maximum extracted double value if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#maxDoubleOrDefaultIfEmpty(Object\[\], ToDoubleFunction, double)
-
Signature:
@Beta public static <T> OptionalDouble maxDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the maximum double value extracted from the elements in the provided iterable by the input {@code valueExtractor} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the maximum extracted double value if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#maxDoubleOrDefaultIfEmpty(Iterable, ToDoubleFunction, double)
-
Signature:
@Beta public static <T> OptionalDouble maxDouble(final Iterator<? extends T> iter, final ToDoubleFunction<? super T> valueExtractor) - Summary: Returns the maximum double value extracted from the elements in the provided iterator by the input {@code valueExtractor} function.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the maximum extracted double value if the iterator is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#maxDoubleOrDefaultIfEmpty(Iterator, ToDoubleFunction, double)
minMax(...) -> Optional<Pair<T, T>>
-
Signature:
public static <T extends Comparable<? super T>> Optional<Pair<T, T>> minMax(final T[] a) - Summary: Returns the minimum and maximum values from the provided array of elements based on their natural ordering.
-
Contract:
- If the array is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the array is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Comparable...)
-
Signature:
public static <T> Optional<Pair<T, T>> minMax(final T[] a, final Comparator<? super T> cmp) - Summary: Returns the minimum and maximum values from the provided array of elements according to the provided comparator.
-
Contract:
- If the array is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the array is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Optional<Pair<T, T>> minMax(final Iterable<? extends T> c) - Summary: Returns the minimum and maximum values from the provided iterable of elements based on their natural ordering.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Iterable)
-
Signature:
public static <T> Optional<Pair<T, T>> minMax(final Iterable<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns the minimum and maximum values from the provided iterable of elements, according to the provided comparator.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Optional<Pair<T, T>> minMax(final Iterator<? extends T> iter) - Summary: Returns the minimum and maximum values from the provided iterator of elements based on their natural ordering.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the iterator is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Iterator)
-
Signature:
public static <T> Optional<Pair<T, T>> minMax(final Iterator<? extends T> iter, final Comparator<? super T> cmp) - Summary: Returns the minimum and maximum values from the provided iterator of elements, according to the provided comparator.
-
Contract:
- If the iterator is {@code null} or empty, it returns an empty Optional.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of elements to evaluate. -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: an {@code Optional} containing a {@code Pair} of the minimum and maximum values if the iterator is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#minMax(Iterator, Comparator)
median(...) -> Nullable<T>
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> median(final T[] a) - Summary: Returns the median value of all elements in the specified array.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
a(T[]) — the array of values to find the median of.
-
- Returns: a {@code Nullable} containing the median value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#median(Comparable...), Median#of(Comparable\[\]), Median#of(Object\[\], Comparator)
-
Signature:
public static <T> Nullable<T> median(final T[] a, final Comparator<? super T> cmp) - Summary: Returns the median value of all elements in the specified array.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
a(T[]) — the array of values to find the median of. -
cmp(Comparator<? super T>) — the comparator to determine the order of the values.
-
- Returns: a {@code Nullable} containing the median value if the array is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#median(Object\[\], Comparator), Median#of(Comparable\[\]), Median#of(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> median(final Collection<? extends T> c) - Summary: Returns the median value of all elements in the specified collection.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of.
-
- Returns: a {@code Nullable} containing the median value if the collection is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#median(Collection), Median#of(Collection), Median#of(Collection, Comparator)
-
Signature:
public static <T> Nullable<T> median(final Collection<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns the median value of all elements in the specified collection.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of. -
cmp(Comparator<? super T>) — the comparator to determine the order of the values.
-
- Returns: a {@code Nullable} containing the median value if the collection is not {@code null} or empty, otherwise an empty {@code Nullable} .
- See also: N#median(Collection, Comparator), Median#of(Collection), Median#of(Collection, Comparator)
kthLargest(...) -> Nullable<T>
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> kthLargest(final T[] a, final int k) - Summary: Returns the <i> k-th </i> largest element from the provided array based on their natural ordering.
-
Contract:
- If the array is {@code null} , empty, or its length is less than {@code k} , it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
k(int) — the position of the largest element to find (1-based index).
-
- Returns: a {@code Nullable} containing the k-th largest value if the array is not {@code null} and has at least k elements, otherwise an empty {@code Nullable} .
- See also: N#kthLargest(Comparable\[\], int)
-
Signature:
public static <T> Nullable<T> kthLargest(final T[] a, final int k, final Comparator<? super T> cmp) - Summary: Returns the <i> k-th </i> largest element from the provided array according to the provided comparator.
-
Contract:
- If the array is {@code null} , empty, or its length is less than {@code k} , it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
k(int) — the position of the largest element to find (1-based index). -
cmp(Comparator<? super T>) — the comparator to determine the order of the elements.
-
- Returns: a {@code Nullable} containing the k-th largest value if the array is not {@code null} and has at least k elements, otherwise an empty {@code Nullable} .
- See also: N#kthLargest(Object\[\], int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Nullable<T> kthLargest(final Collection<? extends T> c, final int k) - Summary: Returns the <i> k-th </i> largest element from the provided collection based on their natural ordering.
-
Contract:
- If the collection is {@code null} , empty, or its size is less than {@code k} , it returns an empty {@code Nullable} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
k(int) — the position of the largest element to find (1-based index).
-
- Returns: a {@code Nullable} containing the k-th largest value if the collection is not {@code null} and has at least k elements, otherwise an empty {@code Nullable} .
- See also: N#kthLargest(Collection, int)
-
Signature:
public static <T> Nullable<T> kthLargest(final Collection<? extends T> c, final int k, final Comparator<? super T> cmp) - Summary: Returns the <i> k-th </i> largest element from the provided collection based on the provided comparator.
-
Contract:
- If the collection is {@code null} , empty, or its size is less than k, a {@code Nullable} .empty() is returned.
-
Parameters:
-
c(Collection<? extends T>) — the collection from which to find the <i> k-th </i> largest element. -
k(int) — the position from the end of a sorted list of the collection's elements (1-based index). -
cmp(Comparator<? super T>) — the comparator used to determine the order of the collection's elements.
-
- Returns: a {@code Nullable} containing the <i> k-th </i> largest element if it exists, otherwise {@code Nullable} .empty().
- See also: N#kthLargest(Collection, int, Comparator)
sumInt(...) -> OptionalInt
-
Signature:
public static <T extends Number> OptionalInt sumInt(final Iterable<? extends T> c) - Summary: Returns the sum of the integer value of provided numbers as an {@code OptionalInt} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalInt} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#sumInt(Iterable)
-
Signature:
public static <T> OptionalInt sumInt(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Returns the sum of the integer values extracted from the elements in the provided iterable by the input {@code func} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalInt} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalInt} .
- See also: N#sumInt(Iterable, ToIntFunction)
sumIntToLong(...) -> OptionalLong
-
Signature:
public static <T extends Number> OptionalLong sumIntToLong(final Iterable<? extends T> c) - Summary: Returns the sum of the integer values of the provided numbers as an {@code OptionalLong} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalLong} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#sumIntToLong(Iterable)
-
Signature:
public static <T> OptionalLong sumIntToLong(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Returns the sum of the integer values extracted from the elements in the provided iterable by the input {@code func} function as an {@code OptionalLong} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalLong} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#sumIntToLong(Iterable, ToIntFunction)
sumLong(...) -> OptionalLong
-
Signature:
public static <T extends Number> OptionalLong sumLong(final Iterable<? extends T> c) - Summary: Returns the sum of the long values of the provided numbers as an {@code OptionalLong} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalLong} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#sumLong(Iterable)
-
Signature:
public static <T> OptionalLong sumLong(final Iterable<? extends T> c, final ToLongFunction<? super T> func) - Summary: Returns the sum of the long values extracted from the elements in the provided iterable by the input {@code func} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalLong} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalLong} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalLong} .
- See also: N#sumLong(Iterable, ToLongFunction)
sumDouble(...) -> OptionalDouble
-
Signature:
public static <T extends Number> OptionalDouble sumDouble(final Iterable<? extends T> c) - Summary: Returns the sum of the double values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#sumDouble(Iterable)
-
Signature:
public static <T> OptionalDouble sumDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> func) - Summary: Returns the sum of the double values extracted from the elements in the provided iterable by the input {@code func} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#sumDouble(Iterable, ToDoubleFunction)
sumBigInteger(...) -> Optional<BigInteger>
-
Signature:
public static Optional<BigInteger> sumBigInteger(final Iterable<? extends BigInteger> c) - Summary: Returns the sum of the BigInteger values in the provided iterable.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigInteger>} .
-
Parameters:
-
c(Iterable<? extends BigInteger>) — the iterable of BigInteger elements to evaluate.
-
- Returns: an {@code Optional<BigInteger>} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#sumBigInteger(Iterable)
-
Signature:
public static <T> Optional<BigInteger> sumBigInteger(final Iterable<? extends T> c, final Function<? super T, BigInteger> func) - Summary: Returns the sum of the BigInteger values extracted from the elements in the provided iterable by the input {@code func} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigInteger>} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(Function<? super T, BigInteger>) — the function to extract a BigInteger value from each element.
-
- Returns: an {@code Optional<BigInteger>} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#sumBigInteger(Iterable, Function)
sumBigDecimal(...) -> Optional<BigDecimal>
-
Signature:
public static Optional<BigDecimal> sumBigDecimal(final Iterable<? extends BigDecimal> c) - Summary: Returns the sum of the BigDecimal values in the provided iterable.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends BigDecimal>) — the iterable of BigDecimal elements to evaluate.
-
- Returns: an {@code Optional<BigDecimal>} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#sumBigDecimal(Iterable)
-
Signature:
public static <T> Optional<BigDecimal> sumBigDecimal(final Iterable<? extends T> c, final Function<? super T, BigDecimal> func) - Summary: Returns the sum of the BigDecimal values extracted from the elements in the provided iterable by the input {@code func} function.
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(Function<? super T, BigDecimal>) — the function to extract a BigDecimal value from each element.
-
- Returns: an {@code Optional<BigDecimal>} containing the sum if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#sumBigDecimal(Iterable, Function)
averageInt(...) -> OptionalDouble
-
Signature:
public static <T extends Number> OptionalDouble averageInt(final T[] a) - Summary: Returns the average of the integer values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: the average of the integer values if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageInt(Number\[\])
-
Signature:
public static <T extends Number> OptionalDouble averageInt(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageInt(Number\[\], int, int)
-
Signature:
public static <T> OptionalDouble averageInt(final T[] a, final ToIntFunction<? super T> func) - Summary: Returns the average of the integer values extracted from the elements in the provided array by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: the average of the integer values if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageInt(Object\[\], ToIntFunction)
-
Signature:
public static <T> OptionalDouble averageInt(final T[] a, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the integer values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageInt(Object\[\], int, int, ToIntFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageInt(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageInt(Collection, int, int)
-
Signature:
public static <T> OptionalDouble averageInt(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the integer values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageInt(Collection, int, int, ToIntFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageInt(final Iterable<? extends T> c) - Summary: Returns the average of the integer values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageInt(Iterable)
-
Signature:
public static <T> OptionalDouble averageInt(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Returns the average of the integer values extracted from the elements in the provided iterable by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToIntFunction<? super T>) — the function to extract an integer value from each element.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageInt(Iterable, ToIntFunction)
averageLong(...) -> OptionalDouble
-
Signature:
public static <T extends Number> OptionalDouble averageLong(final T[] a) - Summary: Returns the average of the long values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the average if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageLong(Number\[\])
-
Signature:
public static <T extends Number> OptionalDouble averageLong(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the long values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageLong(Number\[\], int, int)
-
Signature:
public static <T> OptionalDouble averageLong(final T[] a, final ToLongFunction<? super T> func) - Summary: Returns the average of the long values extracted from the elements in the provided array by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
func(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalDouble} containing the average if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageLong(Object\[\], ToLongFunction)
-
Signature:
public static <T> OptionalDouble averageLong(final T[] a, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the long values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageLong(Object\[\], int, int, ToLongFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageLong(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the long values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageLong(Collection, int, int)
-
Signature:
public static <T> OptionalDouble averageLong(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the long values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageLong(Collection, int, int, ToLongFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageLong(final Iterable<? extends T> c) - Summary: Returns the average of the long values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageLong(Iterable)
-
Signature:
public static <T> OptionalDouble averageLong(final Iterable<? extends T> c, final ToLongFunction<? super T> func) - Summary: Returns the average of the long values extracted from the elements in the provided iterable by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToLongFunction<? super T>) — the function to extract a long value from each element.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageLong(Iterable, ToLongFunction)
averageDouble(...) -> OptionalDouble
-
Signature:
public static <T extends Number> OptionalDouble averageDouble(final T[] a) - Summary: Returns the average of the double values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the average if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageDouble(Number\[\])
-
Signature:
public static <T extends Number> OptionalDouble averageDouble(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the double values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageDouble(Number\[\], int, int)
-
Signature:
public static <T> OptionalDouble averageDouble(final T[] a, final ToDoubleFunction<? super T> func) - Summary: Returns the average of the double values extracted from the elements in the provided array by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the array is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
func(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the average if the array is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageDouble(Object\[\], ToDoubleFunction)
-
Signature:
public static <T> OptionalDouble averageDouble(final T[] a, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the double values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > a.length} ).
-
- See also: N#averageDouble(Object\[\], int, int, ToDoubleFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of the double values of the provided numbers in the specified range as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageDouble(Collection, int, int)
-
Signature:
public static <T> OptionalDouble averageDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Returns the average of the double values extracted from the elements in the specified range by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the specified range is empty ( {@code fromIndex == toIndex} , it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
fromIndex(int) — the start index of the range, inclusive. -
toIndex(int) — the end index of the range, exclusive. -
func(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: the average of the integer values of the provided numbers in the specified range as an {@code OptionalDouble} if the range is not empty, otherwise an empty {@code OptionalDouble} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid: ( {@code fromIndex < 0 || fromIndex > toIndex || toIndex > c.size()} ).
-
- See also: N#averageDouble(Collection, int, int, ToDoubleFunction)
-
Signature:
public static <T extends Number> OptionalDouble averageDouble(final Iterable<? extends T> c) - Summary: Returns the average of the double values of the provided numbers as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageDouble(Iterable)
-
Signature:
public static <T> OptionalDouble averageDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> func) - Summary: Returns the average of the double values extracted from the elements in the provided iterable by the input {@code func} function as an {@code OptionalDouble} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code OptionalDouble} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(ToDoubleFunction<? super T>) — the function to extract a double value from each element.
-
- Returns: an {@code OptionalDouble} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code OptionalDouble} .
- See also: N#averageDouble(Iterable, ToDoubleFunction)
averageBigInteger(...) -> Optional<BigDecimal>
-
Signature:
public static Optional<BigDecimal> averageBigInteger(final Iterable<? extends BigInteger> c) - Summary: Returns the average of the BigInteger values of the provided numbers as an {@code Optional<BigDecimal>} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends BigInteger>) — the iterable of elements to evaluate.
-
- Returns: an {@code Optional<BigDecimal>} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#averageBigInteger(Iterable)
-
Signature:
public static <T> Optional<BigDecimal> averageBigInteger(final Iterable<? extends T> c, final Function<? super T, BigInteger> func) - Summary: Returns the average of the BigInteger values extracted from the elements in the provided iterable by the input {@code func} function as an {@code Optional<BigDecimal>} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(Function<? super T, BigInteger>) — the function to extract a BigInteger value from each element.
-
- Returns: an {@code Optional<BigDecimal>} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#averageBigInteger(Iterable, Function)
averageBigDecimal(...) -> Optional<BigDecimal>
-
Signature:
public static Optional<BigDecimal> averageBigDecimal(final Iterable<? extends BigDecimal> c) - Summary: Returns the average of the BigDecimal values of the provided numbers as an {@code Optional<BigDecimal>} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends BigDecimal>) — the iterable of elements to evaluate.
-
- Returns: an {@code Optional<BigDecimal>} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#averageBigDecimal(Iterable)
-
Signature:
public static <T> Optional<BigDecimal> averageBigDecimal(final Iterable<? extends T> c, final Function<? super T, BigDecimal> func) - Summary: Returns the average of the BigDecimal values extracted from the elements in the provided iterable by the input {@code func} function as an {@code Optional<BigDecimal>} .
-
Contract:
- If the iterable is {@code null} or empty, it returns an empty {@code Optional<BigDecimal>} .
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to evaluate. -
func(Function<? super T, BigDecimal>) — the function to extract a BigDecimal value from each element.
-
- Returns: an {@code Optional<BigDecimal>} containing the average if the iterable is not {@code null} or empty, otherwise an empty {@code Optional} .
- See also: N#averageBigDecimal(Iterable, Function)
indexOf(...) -> OptionalInt
-
Signature:
public static OptionalInt indexOf(final Object[] a, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified value in the provided array as an {@code OptionalInt} .
-
Contract:
- If the array is {@code null} or doesn't contain the specified value, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(Object[]) — the array of elements to evaluate. -
valueToFind(Object) — the value to find in the array.
-
- Returns: an {@code OptionalInt} containing the index of the first occurrence of the specified value if found, otherwise an empty {@code OptionalInt} .
- See also: N#indexOf(Object\[\], Object), Index#of(Object\[\], Object)
-
Signature:
public static OptionalInt indexOf(final Collection<?> c, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified value in the provided collection as an {@code OptionalInt} .
-
Contract:
- If the collection is {@code null} or doesn't contain the specified value, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Collection<?>) — the collection of elements to evaluate. -
valueToFind(Object) — the value to find in the collection.
-
- Returns: an {@code OptionalInt} containing the index of the first occurrence of the specified value if found, otherwise an empty {@code OptionalInt} .
- See also: N#indexOf(Collection, Object), Index#of(Collection, Object)
lastIndexOf(...) -> OptionalInt
-
Signature:
public static OptionalInt lastIndexOf(final Object[] a, final Object valueToFind) - Summary: Returns the index of the last occurrence of the specified value in the provided array as an {@code OptionalInt} .
-
Contract:
- If the array is {@code null} or doesn't contain the specified value, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(Object[]) — the array of elements to evaluate. -
valueToFind(Object) — the value to find in the array.
-
- Returns: an {@code OptionalInt} containing the index of the last occurrence of the specified value if found, otherwise an empty {@code OptionalInt} .
- See also: N#lastIndexOf(Object\[\], Object), Index#last(Object\[\], Object)
-
Signature:
public static OptionalInt lastIndexOf(final Collection<?> c, final Object valueToFind) - Summary: Returns the index of the last occurrence of the specified value in the provided collection as an {@code OptionalInt} .
-
Contract:
- If the collection is {@code null} or doesn't contain the specified value, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Collection<?>) — the collection of elements to evaluate. -
valueToFind(Object) — the value to find in the collection.
-
- Returns: an {@code OptionalInt} containing the index of the last occurrence of the specified value if found, otherwise an empty {@code OptionalInt} .
- See also: N#lastIndexOf(Collection, Object), Index#last(Collection, Object)
findFirstOrLast(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> findFirstOrLast(final T[] a, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns the first element in the provided array that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the last element that satisfies the {@code predicateForLast} .
-
Contract:
- Returns the first element in the provided array that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the last element that satisfies the {@code predicateForLast} .
- If the array is {@code null} or doesn't contain any element that satisfies the predicates, it returns an empty {@code Nullable} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise the last element satisfying {@code predicateForLast} if found, otherwise an empty {@code Nullable} .
- See also: N#findFirst(Object\[\], Predicate), N#findLast(Object\[\], Predicate)
-
Signature:
public static <T> Nullable<T> findFirstOrLast(final Collection<? extends T> c, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns the first element in the provided collection that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the last element that satisfies the {@code predicateForLast} .
-
Contract:
- Returns the first element in the provided collection that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the last element that satisfies the {@code predicateForLast} .
- If the collection is {@code null} or doesn't contain any element that satisfies the predicates, it returns an empty {@code Nullable} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise the last element satisfying {@code predicateForLast} if found, otherwise an empty {@code Nullable} .
- See also: N#findFirst(Iterable, Predicate), N#findLast(Iterable, Predicate)
findFirstOrLastIndex(...) -> OptionalInt
-
Signature:
public static <T> OptionalInt findFirstOrLastIndex(final T[] a, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns the index of the first element in the provided array that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the index of the last element that satisfies the {@code predicateForLast} .
-
Contract:
- Returns the index of the first element in the provided array that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the index of the last element that satisfies the {@code predicateForLast} .
- If the array is {@code null} or doesn't contain any element that satisfies the predicates, it returns an empty {@code OptionalInt} .
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise the index of the last element satisfying {@code predicateForLast} if found, otherwise an empty {@code OptionalInt} .
- See also: N#findFirstIndex(Object\[\], Predicate), N#findLastIndex(Object\[\], Predicate)
-
Signature:
public static <T> OptionalInt findFirstOrLastIndex(final Collection<? extends T> c, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns the index of the first element in the provided collection that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the index of the last element that satisfies the {@code predicateForLast} .
-
Contract:
- Returns the index of the first element in the provided collection that satisfies the given {@code predicateForFirst} , or if no such element is found, returns the index of the last element that satisfies the {@code predicateForLast} .
- If the collection is {@code null} or doesn't contain any element that satisfies the predicates, it returns an empty {@code OptionalInt} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise the index of the last element satisfying {@code predicateForLast} if found, otherwise an empty {@code OptionalInt} .
- See also: N#findFirstIndex(Collection, Predicate), N#findLastIndex(Collection, Predicate)
findFirstAndLast(...) -> Pair<Nullable<T>, Nullable<T>>
-
Signature:
public static <T> Pair<Nullable<T>, Nullable<T>> findFirstAndLast(final T[] a, final Predicate<? super T> predicate) - Summary: Returns a pair of {@code Nullable} objects containing the first and last elements in the provided array that satisfy the given {@code predicate} .
-
Contract:
- If the array is {@code null} or doesn't contain any element that satisfies the predicate, it returns a pair of empty {@code Nullable} objects.
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicate(Predicate<? super T>) — the predicate to test for the first and last elements.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code Nullable} objects.
- See also: #findFirstAndLast(Object\[\], Predicate, Predicate), #findFirstOrLast(Object\[\], Predicate, Predicate), N#findFirst(Object\[\], Predicate), N#findLast(Object\[\], Predicate)
-
Signature:
public static <T> Pair<Nullable<T>, Nullable<T>> findFirstAndLast(final T[] a, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns a pair of {@code Nullable} objects containing the first and last elements in the provided array that satisfy the given predicates.
-
Contract:
- If the array is {@code null} or doesn't contain any element that satisfies the predicates, it returns a pair of empty {@code Nullable} objects.
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code Nullable} objects.
- See also: #findFirstAndLast(Object\[\], Predicate), #findFirstOrLast(Object\[\], Predicate, Predicate), N#findFirst(Object\[\], Predicate), N#findLast(Object\[\], Predicate)
-
Signature:
public static <T> Pair<Nullable<T>, Nullable<T>> findFirstAndLast(final Collection<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns a pair of {@code Nullable} objects containing the first and last elements in the provided collection that satisfy the given {@code predicate} .
-
Contract:
- If the collection is {@code null} or doesn't contain any element that satisfies the predicate, it returns a pair of empty {@code Nullable} objects.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicate(Predicate<? super T>) — the predicate to test for the first and last elements.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code Nullable} objects.
- See also: #findFirstAndLast(Collection, Predicate, Predicate), #findFirstOrLast(Collection, Predicate, Predicate), N#findFirst(Iterable, Predicate), N#findLast(Iterable, Predicate)
-
Signature:
public static <T> Pair<Nullable<T>, Nullable<T>> findFirstAndLast(final Collection<? extends T> c, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns a pair of {@code Nullable} objects containing the first and last elements in the provided collection that satisfy the given predicates.
-
Contract:
- If the collection is {@code null} or doesn't contain any element that satisfies the predicates, it returns a pair of empty {@code Nullable} objects.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code Nullable} objects.
- See also: #findFirstAndLast(Collection, Predicate), #findFirstOrLast(Collection, Predicate, Predicate), N#findFirst(Iterable, Predicate), N#findLast(Iterable, Predicate)
findFirstAndLastIndex(...) -> Pair<OptionalInt, OptionalInt>
-
Signature:
public static <T> Pair<OptionalInt, OptionalInt> findFirstAndLastIndex(final T[] a, final Predicate<? super T> predicate) - Summary: Returns a pair of OptionalInt objects containing the indices of the first and last elements in the provided array that satisfy the given {@code predicate} .
-
Contract:
- If the array is {@code null} or doesn't contain any element that satisfies the predicate, it returns a pair of empty {@code OptionalInt} objects.
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicate(Predicate<? super T>) — the predicate to test for the first and last elements.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code OptionalInt} objects.
- See also: #findFirstAndLastIndex(Object\[\], Predicate, Predicate), #findFirstOrLastIndex(Object\[\], Predicate, Predicate), N#findFirstIndex(Object\[\], Predicate), N#findLastIndex(Object\[\], Predicate)
-
Signature:
public static <T> Pair<OptionalInt, OptionalInt> findFirstAndLastIndex(final T[] a, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns a pair of OptionalInt objects containing the indices of the first and last elements in the provided array that satisfy the given predicates.
-
Contract:
- If the array is {@code null} or doesn't contain any element that satisfies the predicates, it returns a pair of empty {@code OptionalInt} objects.
-
Parameters:
-
a(T[]) — the array of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code OptionalInt} objects.
- See also: #findFirstAndLastIndex(Object\[\], Predicate), #findFirstOrLastIndex(Object\[\], Predicate, Predicate), N#findFirstIndex(Object\[\], Predicate), N#findLastIndex(Object\[\], Predicate)
-
Signature:
public static <T> Pair<OptionalInt, OptionalInt> findFirstAndLastIndex(final Collection<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns a pair of OptionalInt objects containing the indices of the first and last elements in the provided collection that satisfy the given {@code predicate} .
-
Contract:
- If the collection is {@code null} or doesn't contain any element that satisfies the predicate, it returns a pair of empty {@code OptionalInt} objects.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicate(Predicate<? super T>) — the predicate to test for the first and last elements.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code OptionalInt} objects.
- See also: #findFirstAndLastIndex(Collection, Predicate, Predicate), #findFirstOrLastIndex(Collection, Predicate, Predicate), N#findFirstIndex(Collection, Predicate), N#findLastIndex(Collection, Predicate)
-
Signature:
public static <T> Pair<OptionalInt, OptionalInt> findFirstAndLastIndex(final Collection<? extends T> c, final Predicate<? super T> predicateForFirst, final Predicate<? super T> predicateForLast) - Summary: Returns a pair of OptionalInt objects containing the indices of the first and last elements in the provided collection that satisfy the given predicates.
-
Contract:
- If the collection is {@code null} or doesn't contain any element that satisfies the predicates, it returns a pair of empty {@code OptionalInt} objects.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to evaluate. -
predicateForFirst(Predicate<? super T>) — the predicate to test for the first element. -
predicateForLast(Predicate<? super T>) — the predicate to test for the last element.
-
- Returns: the first element satisfying {@code predicateForFirst} if found, otherwise a {@code Pair} of empty {@code OptionalInt} objects.
- See also: #findFirstAndLastIndex(Collection, Predicate), #findFirstOrLastIndex(Collection, Predicate, Predicate), N#findFirstIndex(Collection, Predicate), N#findLastIndex(Collection, Predicate)
fill(...) -> void
-
Signature:
@Beta public static <T> void fill(final T[] a, final Supplier<? extends T> supplier) - Summary: Fills the specified Object array with the values provided by the specified supplier.
-
Parameters:
-
a(T[]) — the Object array to be filled. -
supplier(Supplier<? extends T>) — the provider of the value to fill the array with.
-
- See also: Arrays#fill(Object\[\], Object), N#setAll(Object\[\], IntFunction), N#replaceAll(Object\[\], UnaryOperator), N#fill(Object\[\], Object), N#fill(Object\[\], int, int, Object), Fn#s(com.landawn.abacus.util.function.Supplier), Fn#s(Object, com.landawn.abacus.util.function.Function), Suppliers#of(com.landawn.abacus.util.function.Supplier), Suppliers#of(Object, com.landawn.abacus.util.function.Function)
-
Signature:
@Beta public static <T> void fill(final T[] a, final int fromIndex, final int toIndex, final Supplier<? extends T> supplier) - Summary: Fills the specified Object array with the values provided by the specified supplier from the specified fromIndex (inclusive) to the specified toIndex (exclusive).
-
Parameters:
-
a(T[]) — the Object array to be filled. -
fromIndex(int) — the index to start filling (inclusive). -
toIndex(int) — the index to stop filling (exclusive). -
supplier(Supplier<? extends T>) — the provider of the value to fill the array with.
-
- See also: Arrays#fill(Object\[\], int, int, Object), N#fill(Object\[\], Object), N#fill(Object\[\], int, int, Object), Fn#s(com.landawn.abacus.util.function.Supplier), Fn#s(Object, com.landawn.abacus.util.function.Function), Suppliers#of(com.landawn.abacus.util.function.Supplier), Suppliers#of(Object, com.landawn.abacus.util.function.Function)
-
Signature:
@Beta public static <T> void fill(final List<? super T> list, final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Fills the specified list with values provided by the specified supplier.
-
Parameters:
-
list(List<? super T>) — the list to be filled. -
supplier(Supplier<? extends T>) — the provider of the value to fill the list with.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified list is null.
-
- See also: N#fill(List, Object), N#fill(List, int, int, Object), N#setAll(List, java.util.function.IntFunction), N#replaceAll(List, java.util.function.UnaryOperator), N#padLeft(List, int, Object), N#padRight(Collection, int, Object), Fn#s(com.landawn.abacus.util.function.Supplier), Fn#s(Object, com.landawn.abacus.util.function.Function), Suppliers#of(com.landawn.abacus.util.function.Supplier), Suppliers#of(Object, com.landawn.abacus.util.function.Function)
-
Signature:
@Beta public static <T> void fill(final List<? super T> list, final int fromIndex, final int toIndex, final Supplier<? extends T> supplier) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Fills the specified list with the specified with values provided by the specified supplier from the specified start index to the specified end index.
-
Contract:
- The list will be extended automatically if the size of the list is less than the specified toIndex.
-
Parameters:
-
list(List<? super T>) — the list to be filled. -
fromIndex(int) — the starting index (inclusive) to begin filling. -
toIndex(int) — the ending index (exclusive) to stop filling. -
supplier(Supplier<? extends T>) — the provider of the value to fill the list with.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified list is null. -
java.lang.IndexOutOfBoundsException— if the specified indices are out of range.
-
- See also: N#fill(List, Object), N#fill(List, int, int, Object), N#setAll(List, java.util.function.IntFunction), N#replaceAll(List, java.util.function.UnaryOperator), N#padLeft(List, int, Object), N#padRight(Collection, int, Object), Fn#s(com.landawn.abacus.util.function.Supplier), Fn#s(Object, com.landawn.abacus.util.function.Function), Suppliers#of(com.landawn.abacus.util.function.Supplier), Suppliers#of(Object, com.landawn.abacus.util.function.Function)
copyInto(...) -> void
-
Signature:
public static <T> void copyInto(final List<? extends T> src, final List<? super T> dest) - Summary: Copies all the elements from the source list into the destination list.
-
Contract:
- The destination list must be at least as long as the source list.
- If it is longer, the remaining elements in the destination list are unaffected.
-
Parameters:
-
src(List<? extends T>) — the source list from which elements are to be copied. -
dest(List<? super T>) — the destination list to which elements are to be copied.
-
- See also: #copyRange(List, int, List, int, int), java.util.Collections#copy(List, List), N#copy(Object\[\], int, Object\[\], int, int)
copyRange(...) -> void
-
Signature:
public static <T> void copyRange(final List<? extends T> src, final int srcPos, final List<? super T> dest, final int destPos, final int length) throws IndexOutOfBoundsException - Summary: Copies a portion of one list into another.
-
Parameters:
-
src(List<? extends T>) — the source list from which to copy elements. -
srcPos(int) — the starting position in the source list. -
dest(List<? super T>) — the destination list into which to copy elements. -
destPos(int) — the starting position in the destination list. -
length(int) — the number of elements to be copied.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indexes are out of bounds.
-
- See also: #copyInto(List, List), N#copy(Object\[\], int, Object\[\], int, int), Collections#copy(List, List)
asReversed(...) -> List<T>
-
Signature:
public static <T> List<T> asReversed(final List<T> list) - Summary: <p> Copied from Google Guava under Apache License v2.0 and may be modified.
-
Contract:
- <p> The returned list is random-access if the specified list is random access.
-
Parameters:
-
list(List<T>) — the list to be reversed.
-
- Returns: a reversed view of the specified list.
- See also: N#reverse(List), N#reverse(Collection), N#reverseToList(Collection)
union(...) -> SetView<E>
-
Signature:
public static <E> SetView<E> union(final Set<? extends E> set1, final Set<? extends E> set2) throws IllegalArgumentException - Summary: Returns an unmodifiable <b> view </b> of the union of two sets.
-
Contract:
- <p> Results are undefined if {@code set1} and {@code set2} are sets based on different equivalence relations (as {@link HashSet} , {@link TreeSet} , and the {@link Map#keySet} of an {@code IdentityHashMap} all are).
-
Parameters:
-
set1(Set<? extends E>) — the first set. -
set2(Set<? extends E>) — the second set.
-
- Returns: a SetView containing all elements from both sets.
-
Throws:
-
java.lang.IllegalArgumentException
-
intersection(...) -> SetView<E>
-
Signature:
public static <E> SetView<E> intersection(final Set<E> set1, final Set<?> set2) throws IllegalArgumentException - Summary: Returns an unmodifiable <b> view </b> of the intersection of two sets.
-
Contract:
- <p> Results are undefined if {@code set1} and {@code set2} are sets based on different equivalence relations (as {@code HashSet} , {@code TreeSet} , and the keySet of an {@code IdentityHashMap} all are).
- <p> <b> Note: </b> The returned view performs slightly better when {@code set1} is the smaller of the two sets.
- If you have reason to believe one of your sets will generally be smaller than the other, pass it first.
- // impossible for a non-String to be in the intersection @SuppressWarnings("unchecked") Set<String> badStrings = (Set) Iterables.intersection( aFewBadObjects, manyBadStrings); } </pre> <p> This is unfortunate, but should come up only very rarely.
-
Parameters:
-
set1(Set<E>) — the first set. -
set2(Set<?>) — the second set.
-
- Returns: a SetView containing elements common to both sets.
-
Throws:
-
java.lang.IllegalArgumentException
-
- See also: N#intersection(int\[\], int\[\]), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Collection#retainAll(Collection)
difference(...) -> SetView<E>
-
Signature:
public static <E> SetView<E> difference(final Set<E> set1, final Set<?> set2) - Summary: Returns an unmodifiable <b> view </b> of the difference of two sets.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic set difference Set<String> set1 = new HashSet<>(Arrays.asList("a", "b", "c", "d")); Set<String> set2 = new HashSet<>(Arrays.asList("b", "d", "e")); SetView<String> difference = Iterables.difference(set1, set2); // difference contains: \["a", "c"\] // Finding unique elements in first collection Set<Integer> all = new HashSet<>(Arrays.asList(1, 2, 3, 4, 5)); Set<Integer> toExclude = new HashSet<>(Arrays.asList(2, 4)); SetView<Integer> unique = Iterables.difference(all, toExclude); // unique contains: \[1, 3, 5\] // The view can be copied to a new set if needed Set<String> diffCopy = difference.copyInto(new HashSet<>()); } </pre> <p> The iteration order of the returned set matches that of {@code set1} .
- <p> Results are undefined if {@code set1} and {@code set2} are sets based on different equivalence relations (as {@link HashSet} , {@link TreeSet} , and the keySet of an {@code IdentityHashMap} all are).
-
Parameters:
-
set1(Set<E>) — the base set whose elements may be included in the result. -
set2(Set<?>) — the set containing elements to be excluded from the result.
-
- Returns: a SetView containing elements in set1 but not in set2.
- See also: N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), N#removeAll(Collection, Iterable), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Difference#of(Collection, Collection)
symmetricDifference(...) -> SetView<E>
-
Signature:
public static <E> SetView<E> symmetricDifference(final Set<? extends E> set1, final Set<? extends E> set2) throws IllegalArgumentException - Summary: Returns an unmodifiable <b> view </b> of the symmetric difference of two sets.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Set<String> set1 = new HashSet<>(Arrays.asList("a", "b", "c")); Set<String> set2 = new HashSet<>(Arrays.asList("b", "c", "d")); SetView<String> symDiff = Iterables.symmetricDifference(set1, set2); // symDiff contains: "a", "d" // The view can be copied to a new set if needed Set<String> symDiffCopy = symDiff.copyInto(new HashSet<>()); } </pre> <p> The iteration order of the returned set is undefined.
- <p> Results are undefined if {@code set1} and {@code set2} are sets based on different equivalence relations (as {@link HashSet} , {@link TreeSet} , and the keySet of an {@code IdentityHashMap} all are).
-
Parameters:
-
set1(Set<? extends E>) — the first set to find elements not present in the other set. -
set2(Set<? extends E>) — the second set to find elements not present in the other set.
-
- Returns: a SetView containing elements in either set1 or set2 but not in both.
-
Throws:
-
java.lang.IllegalArgumentException
-
- See also: N#symmetricDifference(Collection, Collection), N#symmetricDifference(int\[\], int\[\]), N#difference(Collection, Collection), #difference(Set, Set), #intersection(Set, Set), #union(Set, Set)
subSet(...) -> NavigableSet<K>
-
Signature:
public static <K extends Comparable<? super K>> NavigableSet<K> subSet(final NavigableSet<K> set, final Range<K> range) throws IllegalArgumentException - Summary: Returns a subset of the provided NavigableSet that falls within the specified range.
-
Parameters:
-
set(NavigableSet<K>) — the original NavigableSet from which to derive the subset. -
range(Range<K>) — the Range object that defines the lower and upper bounds of the subset.
-
- Returns: a NavigableSet view of elements within the specified range.
-
Throws:
-
java.lang.IllegalArgumentException
-
powerSet(...) -> Set<Set<E>>
-
Signature:
public static <E> Set<Set<E>> powerSet(final Set<E> set) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- <p> The returned set and its constituent sets use {@code equals} to decide whether two elements are identical, even if the input set uses a different concept of equivalence.
- When the power set is constructed, the input set is merely copied.
-
Parameters:
-
set(Set<E>) — the set of elements to construct a power set from.
-
- Returns: a Set containing all possible subsets of the input set.
- Performance: <p> <i> Performance notes: </i> while the power set of a set with size {@code n} is of size {@code 2^n} , its memory usage is only {@code O(n)} .
- See also: <a href="http://en.wikipedia.org/wiki/Power_set">,Power set article at Wikipedia,</a>
rollup(...) -> List<List<T>>
-
Signature:
public static <T> List<List<T>> rollup(final Collection<? extends T> c) - Summary: Generates a rollup (a list of cumulative subsets) of the given collection.
-
Parameters:
-
c(Collection<? extends T>) — the original collection from which to generate the rollup.
-
- Returns: a {@code List} of {@code List} s representing the rollup of the collection, starting with an empty list and progressively including more elements.
permutations(...) -> Collection<List<E>>
-
Signature:
public static <E> Collection<List<E>> permutations(final Collection<E> elements) throws IllegalArgumentException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- <p> If the input list contains equal elements, some of the generated permutations will be equal.
-
Parameters:
-
elements(Collection<E>) — the original collection whose elements have to be permuted.
-
- Returns: a Collection of all permutations of the original collection.
-
Throws:
-
java.lang.IllegalArgumentException— if elements is {@code null} .
-
orderedPermutations(...) -> Collection<List<E>>
-
Signature:
public static <E extends Comparable<? super E>> Collection<List<E>> orderedPermutations(final Collection<E> elements) throws IllegalArgumentException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
elements(Collection<E>) — the original collection whose elements have to be permuted.
-
- Returns: a Collection of ordered permutations of the original collection.
-
Throws:
-
java.lang.IllegalArgumentException— if elements is {@code null} .
-
-
Signature:
public static <E> Collection<List<E>> orderedPermutations(final Collection<E> elements, final Comparator<? super E> comparator) throws IllegalArgumentException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
elements(Collection<E>) — the original iterable whose elements have to be permuted. -
comparator(Comparator<? super E>) — the comparator for the iterable's elements.
-
- Returns: an immutable Collection containing all the different permutations of the original iterable.
-
Throws:
-
java.lang.IllegalArgumentException
-
cartesianProduct(...) -> List<List<E>>
-
Signature:
@SafeVarargs public static <E> List<List<E>> cartesianProduct(final Collection<? extends E>... cs) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- ImmutableList<B> tuple = ImmutableList.of(b0, b1, ...); // operate on tuple } } } </pre> <p> Note that if any input list is empty, the Cartesian product will also be empty.
- If no lists at all are provided (an empty list), the resulting Cartesian product has one element, an empty list (counter-intuitive, but mathematically consistent).
- When the cartesian product is constructed, the input lists are merely copied.
-
Parameters:
-
cs(Collection<? extends E>[]) — the lists to choose elements from, in the order that the elements chosen from those lists should appear in the resulting lists
-
- Returns: a list containing every possible list that can be formed by choosing one element from each of the given lists
-
Signature:
public static <E> List<List<E>> cartesianProduct(final Collection<? extends Collection<? extends E>> cs) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- ImmutableList<B> tuple = ImmutableList.of(b0, b1, ...); // operate on tuple } } } </pre> <p> Note that if any input list is empty, the Cartesian product will also be empty.
- If no lists at all are provided (an empty list), the resulting Cartesian product has one element, an empty list (counter-intuitive, but mathematically consistent).
- When the cartesian product is constructed, the input lists are merely copied.
-
Parameters:
-
cs(Collection<? extends Collection<? extends E>>) — the lists to choose elements from, in the order that the elements chosen from those lists should appear in the resulting lists
-
- Returns: a list containing every possible list that can be formed by choosing one element from each of the given lists
Public Instance Methods
- (none)
Class SetView (com.landawn.abacus.util.Iterables.SetView)
An abstract immutable set view that provides additional utility methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
copyInto(...) -> S
-
Signature:
public <S extends Set<? super E>> S copyInto(final S set) - Summary: Copies all elements from this set view into the specified set.
-
Parameters:
-
set(S) — the set to copy elements into.
-
- Returns: the set after copying elements into it.
Class Iterators (com.landawn.abacus.util.Iterators)
A comprehensive utility class providing an extensive collection of static methods for Iterator operations, transformations, aggregations, and manipulations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
elementAt(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> elementAt(final Iterator<? extends T> iter, long index) throws IllegalArgumentException - Summary: Retrieves the element at the specified position in the given iterator.
-
Contract:
- If the index is out of bounds (greater than the number of elements in the iterator), a {@code Nullable} .empty() is returned.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator from which to retrieve the element, or {@code null} to return {@code Nullable.empty()} . -
index(long) — the position in the iterator of the element to be returned. Indexing starts from 0.
-
- Returns: a {@code Nullable} containing the element at the specified position in the iterator, or {@code Nullable.empty()} if the index is out of bounds.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code index} is negative.
-
occurrencesOf(...) -> long
-
Signature:
public static long occurrencesOf(final Iterator<?> iter, final Object valueToFind) - Summary: Counts the occurrences of a specific value in the given iterator.
-
Parameters:
-
iter(Iterator<?>) — the iterator to be searched, or {@code null} to return {@code 0} . -
valueToFind(Object) — the value to count occurrences of, or {@code null} to count {@code null} occurrences.
-
- Returns: the number of occurrences of the value in the iterator, or {@code 0} if {@code iter} is {@code null} .
- See also: N#occurrencesOf(Iterator, Object)
count(...) -> long
-
Signature:
public static long count(final Iterator<?> iter) - Summary: Counts the number of elements in the given iterator.
-
Parameters:
-
iter(Iterator<?>) — the iterator to be counted, or {@code null} to return {@code 0} .
-
- Returns: the number of elements in the iterator, or {@code 0} if {@code iter} is {@code null} .
- See also: N#count(Iterator), #count(Iterator, Predicate)
-
Signature:
public static <T> long count(final Iterator<? extends T> iter, final Predicate<? super T> predicate) throws IllegalArgumentException - Summary: Counts the number of elements in the given iterator that match the provided predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to be searched, or {@code null} to return {@code 0} . -
predicate(Predicate<? super T>) — the predicate to apply to each element in the iterator.
-
- Returns: the number of elements in the iterator that match the provided predicate, or {@code 0} if {@code iter} is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} .
-
- See also: N#count(Iterator, Predicate)
indexOf(...) -> long
-
Signature:
public static long indexOf(final Iterator<?> iter, final Object valueToFind) - Summary: Returns the index of the first occurrence of the specified value in the given iterator.
-
Parameters:
-
iter(Iterator<?>) — the iterator to be searched, or {@code null} to return {@code -1} . -
valueToFind(Object) — the value to find in the iterator, or {@code null} to find {@code null} values.
-
- Returns: the index of the first occurrence of the specified value in the iterator, or {@code -1} if the value is not found or {@code iter} is {@code null} .
-
Signature:
public static long indexOf(final Iterator<?> iter, final Object valueToFind, final long fromIndex) - Summary: Returns the index of the first occurrence of the specified value in the given iterator, starting the search from the specified index.
-
Parameters:
-
iter(Iterator<?>) — the iterator to be searched, or {@code null} to return {@code -1} . -
valueToFind(Object) — the value to find in the iterator, or {@code null} to find {@code null} values. -
fromIndex(long) — the index to start the search from.
-
- Returns: the index of the first occurrence of the specified value in the iterator, or {@code -1} if the value is not found or {@code iter} is {@code null} .
equalsInOrder(...) -> boolean
-
Signature:
public static boolean equalsInOrder(final Iterator<?> iterator1, final Iterator<?> iterator2) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- More specifically, this method returns {@code true} if {@code iterator1} and {@code iterator2} contain the same number of elements and every element of {@code iterator1} is equal to the corresponding element of {@code iterator2} .
-
Parameters:
-
iterator1(Iterator<?>) — the first iterator to compare. -
iterator2(Iterator<?>) — the second iterator to compare.
-
- Returns: {@code true} if the iterators contain equal elements in the same order, {@code false} otherwise.
repeat(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> repeat(final T e, final int n) throws IllegalArgumentException - Summary: Creates an iterator that returns the same element a specified number of times.
-
Parameters:
-
e(T) — the element to repeat (can be {@code null} ). -
n(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: an {@code ObjIterator} that returns the element {@code n} times, or an empty iterator if {@code n} is {@code 0} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
- See also: #repeat(Object, long), #cycle(Object...)
-
Signature:
public static <T> ObjIterator<T> repeat(final T e, final long n) throws IllegalArgumentException - Summary: Creates an iterator that returns the same element a specified number of times (long version).
-
Parameters:
-
e(T) — the element to repeat (can be {@code null} ). -
n(long) — the number of times to repeat the element. Must be non-negative.
-
- Returns: an {@code ObjIterator} that returns the element {@code n} times, or an empty iterator if {@code n} is {@code 0} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
- See also: #repeat(Object, int), #cycle(Object...)
repeatElements(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> repeatElements(final Iterable<? extends T> c, final long n) throws IllegalArgumentException - Summary: Repeats each element in the specified collection {@code n} times.
-
Parameters:
-
c(Iterable<? extends T>) — the collection whose elements are to be repeated; must not be empty if {@code n} > 0. -
n(long) — the number of times the collection's elements are to be repeated.
-
- Returns: an {@code ObjIterator} over the elements in the collection, repeated {@code n} times.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code c} is {@code null} or empty when {@code n} > 0, or if {@code n} is negative.
-
- See also: #cycle(Object...), #cycle(Iterable), #repeatElementsToSize(Collection, long), N#repeatElements(Collection, int)
repeatElementsToSize(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> repeatElementsToSize(final Collection<? extends T> c, final long size) throws IllegalArgumentException - Summary: Repeats each element in the specified Collection a calculated number of times until the specified total size is reached.
-
Parameters:
-
c(Collection<? extends T>) — the collection whose elements are to be repeated. Must not be empty or {@code null} if {@code size > 0} . -
size(long) — the total number of elements the resulting iterator should produce. Must be non-negative.
-
- Returns: an {@code ObjIterator} that repeats each element until {@code size} elements have been produced.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code size} is negative, or if {@code c} is empty or {@code null} when {@code size > 0} .
-
- See also: #repeatElements(Iterable, long), #cycleToSize(Collection, long), N#repeatElementsToSize(Collection, int)
cycle(...) -> ObjIterator<T>
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> cycle(final T... elements) - Summary: Returns an infinite iterator cycling over the provided elements.
-
Contract:
- However, if the provided elements are empty, an empty iterator will be returned.
-
Parameters:
-
elements(T[]) — the array whose elements are to be cycled over.
-
- Returns: an iterator cycling over the elements of the array.
- See also: #repeat(Object, int), #repeat(Object, long)
-
Signature:
public static <T> ObjIterator<T> cycle(final Iterable<? extends T> iterable) - Summary: Returns an infinite iterator cycling over the elements of the provided iterable.
-
Contract:
- However, if the provided elements are empty, an empty iterator will be returned.
-
Parameters:
-
iterable(Iterable<? extends T>) — the iterable whose elements are to be cycled over.
-
- Returns: an iterator cycling over the elements of the iterable.
- See also: #cycle(Object...), #cycle(Iterable, long), #cycleToSize(Collection, long), #repeatElements(Iterable, long), N#cycle(Collection, int)
-
Signature:
public static <T> ObjIterator<T> cycle(final Iterable<? extends T> iterable, final long rounds) - Summary: Returns an iterator that cycles over the elements of the provided iterable for a specified number of rounds.
-
Contract:
- If the provided iterable is empty, an empty iterator will be returned.
- If the number of rounds is zero, an empty iterator will be returned.
-
Parameters:
-
iterable(Iterable<? extends T>) — the iterable whose elements are to be cycled over. -
rounds(long) — the number of times to cycle over the iterable's elements.
-
- Returns: an {@code ObjIterator} cycling over the elements of the iterable for the specified number of rounds.
- See also: #cycle(Object...), #cycle(Iterable), #cycleToSize(Collection, long), N#cycle(Collection, int)
cycleToSize(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> cycleToSize(final Collection<? extends T> c, final long size) throws IllegalArgumentException - Summary: Repeats the entire specified Collection cyclically until the specified total size is reached.
-
Contract:
- The collection is repeated as a whole, cycling through it multiple times if necessary.
-
Parameters:
-
c(Collection<? extends T>) — the collection to be repeated. Must not be empty or {@code null} if {@code size > 0} . -
size(long) — the total number of elements the resulting iterator should produce. Must be non-negative.
-
- Returns: an {@code ObjIterator} that cycles through the collection until {@code size} elements have been produced.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code size} is negative, or if {@code c} is empty or {@code null} when {@code size > 0} .
-
- See also: #cycle(Iterable), #cycle(Iterable, long), #repeatElementsToSize(Collection, long), N#cycleToSize(Collection, int)
concat(...) -> BooleanIterator
-
Signature:
public static BooleanIterator concat(final boolean[]... a) - Summary: Concatenates multiple boolean arrays into a single BooleanIterator.
-
Parameters:
-
a(boolean[][]) — the boolean arrays to be concatenated.
-
- Returns: a BooleanIterator that will iterate over the elements of each provided boolean array in order.
-
Signature:
public static CharIterator concat(final char[]... a) - Summary: Concatenates multiple char arrays into a single CharIterator.
-
Parameters:
-
a(char[][]) — the char arrays to be concatenated.
-
- Returns: a CharIterator that will iterate over the elements of each provided char array in order.
-
Signature:
public static ByteIterator concat(final byte[]... a) - Summary: Concatenates multiple byte arrays into a single ByteIterator.
-
Parameters:
-
a(byte[][]) — the byte arrays to be concatenated.
-
- Returns: a ByteIterator that will iterate over the elements of each provided byte array in order.
-
Signature:
public static ShortIterator concat(final short[]... a) - Summary: Concatenates multiple short arrays into a single ShortIterator.
-
Parameters:
-
a(short[][]) — the short arrays to be concatenated.
-
- Returns: a ShortIterator that will iterate over the elements of each provided short array in order.
-
Signature:
public static IntIterator concat(final int[]... a) - Summary: Concatenates multiple int arrays into a single IntIterator.
-
Parameters:
-
a(int[][]) — the int arrays to be concatenated.
-
- Returns: an IntIterator that will iterate over the elements of each provided int array in order.
-
Signature:
public static LongIterator concat(final long[]... a) - Summary: Concatenates multiple long arrays into a single LongIterator.
-
Parameters:
-
a(long[][]) — the long arrays to be concatenated.
-
- Returns: a LongIterator that will iterate over the elements of each provided long array in order.
-
Signature:
public static FloatIterator concat(final float[]... a) - Summary: Concatenates multiple float arrays into a single FloatIterator.
-
Parameters:
-
a(float[][]) — the float arrays to be concatenated.
-
- Returns: a FloatIterator that will iterate over the elements of each provided float array in order.
-
Signature:
public static DoubleIterator concat(final double[]... a) - Summary: Concatenates multiple double arrays into a single DoubleIterator.
-
Parameters:
-
a(double[][]) — the double arrays to be concatenated.
-
- Returns: a DoubleIterator that will iterate over the elements of each provided double array in order.
-
Signature:
public static BooleanIterator concat(final BooleanIterator... a) - Summary: Concatenates multiple BooleanIterators into a single BooleanIterator.
-
Parameters:
-
a(BooleanIterator[]) — the BooleanIterators to be concatenated.
-
- Returns: a BooleanIterator that will iterate over the elements of each provided BooleanIterator in order.
-
Signature:
public static CharIterator concat(final CharIterator... a) - Summary: Concatenates multiple CharIterators into a single CharIterator.
-
Parameters:
-
a(CharIterator[]) — the CharIterators to be concatenated.
-
- Returns: a CharIterator that will iterate over the elements of each provided CharIterator in order.
-
Signature:
public static ByteIterator concat(final ByteIterator... a) - Summary: Concatenates multiple ByteIterators into a single ByteIterator.
-
Parameters:
-
a(ByteIterator[]) — the ByteIterators to be concatenated.
-
- Returns: a ByteIterator that will iterate over the elements of each provided ByteIterator in order.
-
Signature:
public static ShortIterator concat(final ShortIterator... a) - Summary: Concatenates multiple ShortIterators into a single ShortIterator.
-
Parameters:
-
a(ShortIterator[]) — the ShortIterators to be concatenated.
-
- Returns: a ShortIterator that will iterate over the elements of each provided ShortIterator in order.
-
Signature:
public static IntIterator concat(final IntIterator... a) - Summary: Concatenates multiple IntIterators into a single IntIterator.
-
Parameters:
-
a(IntIterator[]) — the IntIterators to be concatenated.
-
- Returns: an IntIterator that will iterate over the elements of each provided IntIterator in order.
-
Signature:
public static LongIterator concat(final LongIterator... a) - Summary: Concatenates multiple LongIterators into a single LongIterator.
-
Parameters:
-
a(LongIterator[]) — the LongIterators to be concatenated.
-
- Returns: a LongIterator that will iterate over the elements of each provided LongIterator in order.
-
Signature:
public static FloatIterator concat(final FloatIterator... a) - Summary: Concatenates multiple FloatIterators into a single FloatIterator.
-
Parameters:
-
a(FloatIterator[]) — the FloatIterators to be concatenated.
-
- Returns: a FloatIterator that will iterate over the elements of each provided FloatIterator in order.
-
Signature:
public static DoubleIterator concat(final DoubleIterator... a) - Summary: Concatenates multiple DoubleIterators into a single DoubleIterator.
-
Parameters:
-
a(DoubleIterator[]) — the DoubleIterators to be concatenated.
-
- Returns: a DoubleIterator that will iterate over the elements of each provided DoubleIterator in order.
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> concat(final T[]... a) - Summary: Concatenates multiple arrays into a single ObjIterator.
-
Parameters:
-
a(T[][]) — the arrays to be concatenated.
-
- Returns: an ObjIterator that will iterate over the elements of each provided array in order.
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> concat(final Iterator<? extends T>... a) - Summary: Concatenates multiple Iterators into a single ObjIterator.
-
Parameters:
-
a(Iterator<? extends T>[]) — the Iterators to be concatenated.
-
- Returns: an ObjIterator that will iterate over the elements of each provided Iterator in order.
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> concat(final Iterable<? extends T>... a) - Summary: Concatenates multiple Iterable objects into a single ObjIterator.
-
Parameters:
-
a(Iterable<? extends T>[]) — the Iterable objects to be concatenated.
-
- Returns: an ObjIterator that will iterate over the elements of each provided Iterable.
-
Signature:
@SafeVarargs public static <K, V> ObjIterator<Map.Entry<K, V>> concat(final Map<? extends K, ? extends V>... a) - Summary: Concatenates multiple Maps into a single ObjIterator of Map.Entry.
-
Parameters:
-
a(Map<? extends K, ? extends V>[]) — the Maps to be concatenated.
-
- Returns: an ObjIterator of Map.Entry that will iterate over the entries of each provided Map.
-
Signature:
public static <T> ObjIterator<T> concat(final Collection<? extends Iterator<? extends T>> c) - Summary: Concatenates multiple Iterators into a single ObjIterator.
-
Parameters:
-
c(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be concatenated.
-
- Returns: an ObjIterator that will iterate over the elements of each provided Iterator in order.
-
Signature:
@SafeVarargs public static <A, B> BiIterator<A, B> concat(final BiIterator<A, B>... a) - Summary: Concatenates multiple BiIterators into a single BiIterator.
-
Parameters:
-
a(BiIterator<A, B>[]) — the BiIterators to be concatenated.
-
- Returns: a BiIterator that will iterate over the elements of each provided BiIterator in order.
-
Signature:
@SafeVarargs public static <A, B, C> TriIterator<A, B, C> concat(final TriIterator<A, B, C>... a) - Summary: Concatenates multiple TriIterators into a single TriIterator.
-
Parameters:
-
a(TriIterator<A, B, C>[]) — the TriIterators to be concatenated.
-
- Returns: a TriIterator that will iterate over the elements of each provided TriIterator in order.
concatIterables(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> concatIterables(final Collection<? extends Iterable<? extends T>> c) - Summary: Concatenates multiple Iterable objects into a single ObjIterator.
-
Parameters:
-
c(Collection<? extends Iterable<? extends T>>) — the collection of Iterable objects to be concatenated.
-
- Returns: an ObjIterator that will iterate over the elements of each provided Iterable.
- See also: N#concat(Iterable...), N#iterateEach(Collection)
merge(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> merge(final Iterator<? extends T> a, final Iterator<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges two iterators into a single {@code ObjIterator} .
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator to be merged. -
b(Iterator<? extends T>) — the second iterator to be merged. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a {@code BiFunction} that determines the order of elements in the resulting iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided iterators in the order determined by {@code nextSelector} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code nextSelector} is {@code null} .
-
-
Signature:
public static <T> ObjIterator<T> merge(final Collection<? extends Iterator<? extends T>> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges multiple iterators into a single {@code ObjIterator} .
-
Parameters:
-
c(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be merged. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a {@code BiFunction} that determines the order of elements in the resulting iterator. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided iterators in the order determined by {@code nextSelector} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code nextSelector} is {@code null} .
-
-
Signature:
public static <T> ObjIterator<T> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two {@code Iterable} objects into a single {@code ObjIterator} .
-
Parameters:
-
a(Iterable<? extends T>) — the first {@code Iterable} object to be merged. -
b(Iterable<? extends T>) — the second {@code Iterable} object to be merged. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a {@code BiFunction} that determines the order of elements in the resulting iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided {@code Iterable} objects in the order determined by {@code nextSelector} .
mergeIterables(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> mergeIterables(final Collection<? extends Iterable<? extends T>> iterables, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges multiple {@code Iterable} objects into a single {@code ObjIterator} .
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of {@code Iterable} objects to be merged. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a {@code BiFunction} that determines the order of elements in the resulting iterator. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided {@code Iterable} objects in the order determined by {@code nextSelector} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code nextSelector} is {@code null} .
-
mergeSorted(...) -> ObjIterator<T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> ObjIterator<T> mergeSorted(final Iterator<? extends T> sortedA, final Iterator<? extends T> sortedB) - Summary: Merges two sorted Iterators into a single ObjIterator, which will iterate over the elements of each Iterator in a sorted order.
-
Contract:
- The elements in the Iterators should implement Comparable interface.
-
Parameters:
-
sortedA(Iterator<? extends T>) — the first Iterator to be merged. It should be in non-descending order. -
sortedB(Iterator<? extends T>) — the second Iterator to be merged. It should be in non-descending order.
-
- Returns: an ObjIterator that will iterate over the elements of the provided Iterators in a sorted order.
-
Signature:
public static <T> ObjIterator<T> mergeSorted(final Iterator<? extends T> sortedA, final Iterator<? extends T> sortedB, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Merges two sorted iterators into a single {@code ObjIterator} , which will iterate over the elements of each iterator in a sorted order.
-
Parameters:
-
sortedA(Iterator<? extends T>) — the first iterator to be merged. It should be in non-descending order. -
sortedB(Iterator<? extends T>) — the second iterator to be merged. It should be in non-descending order. -
cmp(Comparator<? super T>) — the {@code Comparator} to determine the order of elements in the resulting iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided iterators in a sorted order.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code cmp} is {@code null} .
-
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> ObjIterator<T> mergeSorted(final Iterable<? extends T> sortedA, final Iterable<? extends T> sortedB) - Summary: Merges two sorted Iterable objects into a single ObjIterator, which will iterate over the elements of each Iterable in a sorted order.
-
Contract:
- The elements in the Iterable objects should implement Comparable interface.
-
Parameters:
-
sortedA(Iterable<? extends T>) — the first Iterable object to be merged. It should be in non-descending order. -
sortedB(Iterable<? extends T>) — the second Iterable object to be merged. It should be in non-descending order.
-
- Returns: an ObjIterator that will iterate over the elements of the provided Iterable objects in a sorted order.
-
Signature:
public static <T> ObjIterator<T> mergeSorted(final Iterable<? extends T> sortedA, final Iterable<? extends T> sortedB, final Comparator<? super T> cmp) - Summary: Merges two sorted {@code Iterable} objects into a single {@code ObjIterator} , which will iterate over the elements of each {@code Iterable} in the order determined by the provided {@code Comparator} .
-
Parameters:
-
sortedA(Iterable<? extends T>) — the first {@code Iterable} object to be merged. It should be in non-descending order. -
sortedB(Iterable<? extends T>) — the second {@code Iterable} object to be merged. It should be in non-descending order. -
cmp(Comparator<? super T>) — the {@code Comparator} to determine the order of elements in the resulting iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the provided {@code Iterable} objects in a sorted order.
zip(...) -> ObjIterator<R>
-
Signature:
public static <A, B, R> ObjIterator<R> zip(final Iterator<A> a, final Iterator<B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterators into a single {@code ObjIterator} , which will iterate over the elements of each iterator in parallel.
-
Parameters:
-
a(Iterator<A>) — the first iterator to be zipped. -
b(Iterator<B>) — the second iterator to be zipped. -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a {@code BiFunction} that takes an element from each iterator and returns a new element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements created by {@code zipFunction} .
-
Signature:
public static <A, B, R> ObjIterator<R> zip(final Iterable<A> a, final Iterable<B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two {@code Iterable} objects into a single {@code ObjIterator} , which will iterate over the elements of each {@code Iterable} in parallel.
-
Parameters:
-
a(Iterable<A>) — the first {@code Iterable} to be zipped. -
b(Iterable<B>) — the second {@code Iterable} to be zipped. -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a {@code BiFunction} that takes an element from each {@code Iterable} and returns a new element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements created by {@code zipFunction} .
-
Signature:
public static <A, B, C, R> ObjIterator<R> zip(final Iterator<A> a, final Iterator<B> b, final Iterator<C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterators into a single {@code ObjIterator} , which will iterate over the elements of each iterator in parallel.
-
Parameters:
-
a(Iterator<A>) — the first iterator to be zipped. -
b(Iterator<B>) — the second iterator to be zipped. -
c(Iterator<C>) — the third iterator to be zipped. -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a {@code TriFunction} that takes an element from each iterator and returns a new element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements created by {@code zipFunction} .
-
Signature:
public static <A, B, C, R> ObjIterator<R> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three {@code Iterable} objects into a single {@code ObjIterator} , which will iterate over the elements of each {@code Iterable} in parallel.
-
Parameters:
-
a(Iterable<A>) — the first {@code Iterable} to be zipped. -
b(Iterable<B>) — the second {@code Iterable} to be zipped. -
c(Iterable<C>) — the third {@code Iterable} to be zipped. -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a {@code TriFunction} that takes an element from each {@code Iterable} and returns a new element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements created by {@code zipFunction} .
-
Signature:
public static <A, B, R> ObjIterator<R> zip(final Iterator<A> a, final Iterator<B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two Iterators into a single ObjIterator, using default values when one iterator is exhausted.
-
Contract:
- Zips two Iterators into a single ObjIterator, using default values when one iterator is exhausted.
- When one iterator is exhausted, the provided default values are used.
-
Parameters:
-
a(Iterator<A>) — the first Iterator to be zipped. -
b(Iterator<B>) — the second Iterator to be zipped. -
valueForNoneA(A) — the default value to be used when the first Iterator is exhausted. -
valueForNoneB(B) — the default value to be used when the second Iterator is exhausted. -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a BiFunction that takes an element from each Iterator and returns a new element for the resulting ObjIterator.
-
- Returns: an ObjIterator that will iterate over the elements created by <i> zipFunction </i> .
-
Signature:
public static <A, B, R> ObjIterator<R> zip(final Iterable<A> a, final Iterable<B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two Iterable objects into a single ObjIterator, using default values when one iterator is exhausted.
-
Contract:
- Zips two Iterable objects into a single ObjIterator, using default values when one iterator is exhausted.
- When one iterator is exhausted, the provided default values are used.
-
Parameters:
-
a(Iterable<A>) — the first Iterable to be zipped. -
b(Iterable<B>) — the second Iterable to be zipped. -
valueForNoneA(A) — the default value to be used when the first Iterable is exhausted. -
valueForNoneB(B) — the default value to be used when the second Iterable is exhausted. -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a BiFunction that takes an element from each Iterable and returns a new element for the resulting ObjIterator.
-
- Returns: an ObjIterator that will iterate over the elements created by <i> zipFunction </i> .
-
Signature:
public static <A, B, C, R> ObjIterator<R> zip(final Iterator<A> a, final Iterator<B> b, final Iterator<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three Iterators into a single ObjIterator, using default values when one iterator is exhausted.
-
Contract:
- Zips three Iterators into a single ObjIterator, using default values when one iterator is exhausted.
- When one iterator is exhausted, the provided default values are used.
-
Parameters:
-
a(Iterator<A>) — the first Iterator to be zipped. -
b(Iterator<B>) — the second Iterator to be zipped. -
c(Iterator<C>) — the third Iterator to be zipped. -
valueForNoneA(A) — the default value to be used when the first Iterator is exhausted. -
valueForNoneB(B) — the default value to be used when the second Iterator is exhausted. -
valueForNoneC(C) — the default value to be used when the third Iterator is exhausted. -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a TriFunction that takes an element from each Iterator and returns a new element for the resulting ObjIterator.
-
- Returns: an ObjIterator that will iterate over the elements created by <i> zipFunction </i> .
-
Signature:
public static <A, B, C, R> ObjIterator<R> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three Iterable objects into a single ObjIterator, using default values when one iterator is exhausted.
-
Contract:
- Zips three Iterable objects into a single ObjIterator, using default values when one iterator is exhausted.
- When one iterator is exhausted, the provided default values are used.
-
Parameters:
-
a(Iterable<A>) — the first Iterable to be zipped. -
b(Iterable<B>) — the second Iterable to be zipped. -
c(Iterable<C>) — the third Iterable to be zipped. -
valueForNoneA(A) — the default value to be used when the first Iterable is exhausted. -
valueForNoneB(B) — the default value to be used when the second Iterable is exhausted. -
valueForNoneC(C) — the default value to be used when the third Iterable is exhausted. -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a TriFunction that takes an element from each Iterable and returns a new element for the resulting ObjIterator.
-
- Returns: an ObjIterator that will iterate over the elements created by <i> zipFunction </i> .
unzip(...) -> BiIterator<A, B>
-
Signature:
public static <T, A, B> BiIterator<A, B> unzip(final Iterator<? extends T> iter, final BiConsumer<? super T, Pair<A, B>> unzip) - Summary: Unzips an Iterator into a BiIterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the original Iterator to be unzipped. -
unzip(BiConsumer<? super T, Pair<A, B>>) — a BiConsumer that takes an element from the original Iterator and a Pair to be filled with the resulting elements for the BiIterator.
-
- Returns: a BiIterator that will iterate over the elements created by <i> unzip </i> .
- See also: BiIterator#unzip(Iterator, BiConsumer), TriIterator#unzip(Iterator, BiConsumer)
-
Signature:
public static <T, A, B> BiIterator<A, B> unzip(final Iterable<? extends T> c, final BiConsumer<? super T, Pair<A, B>> unzip) - Summary: Unzips an Iterable into a BiIterator.
-
Parameters:
-
c(Iterable<? extends T>) — the original Iterable to be unzipped. -
unzip(BiConsumer<? super T, Pair<A, B>>) — a BiConsumer that takes an element from the original Iterable and a Pair to be filled with the resulting elements for the BiIterator.
-
- Returns: a BiIterator that will iterate over the elements created by <i> unzip </i> .
- See also: BiIterator#unzip(Iterator, BiConsumer), TriIterator#unzip(Iterator, BiConsumer)
unzip3(...) -> TriIterator<A, B, C>
-
Signature:
@Deprecated @Beta public static <T, A, B, C> TriIterator<A, B, C> unzip3(final Iterator<? extends T> iter, final BiConsumer<? super T, Triple<A, B, C>> unzip) - Summary: Unzips an Iterator into a TriIterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the original Iterator to be unzipped. -
unzip(BiConsumer<? super T, Triple<A, B, C>>) — a BiConsumer that takes an element from the original Iterator and a Triple to be filled with the resulting elements for the TriIterator.
-
- Returns: a TriIterator that will iterate over the elements created by <i> unzip </i> .
- See also: TriIterator#unzip(Iterator, BiConsumer), TriIterator#toMultiList(Supplier), TriIterator#toMultiSet(Supplier)
-
Signature:
@Deprecated @Beta public static <T, A, B, C> TriIterator<A, B, C> unzip3(final Iterable<? extends T> c, final BiConsumer<? super T, Triple<A, B, C>> unzip) - Summary: Unzips an Iterable into a TriIterator.
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be unzipped. -
unzip(BiConsumer<? super T, Triple<A, B, C>>) — a {@code BiConsumer} that takes an element from the original {@code Iterable} and a {@code Triple} to be filled with the resulting elements for the {@code TriIterator} .
-
- Returns: a {@code TriIterator} that will iterate over the elements created by {@code unzip} .
- See also: TriIterator#unzip(Iterable, BiConsumer), TriIterator#toMultiList(Supplier), TriIterator#toMultiSet(Supplier)
advance(...) -> long
-
Signature:
public static long advance(final Iterator<?> iterator, final long numberToAdvance) throws IllegalArgumentException - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Parameters:
-
iterator(Iterator<?>) — the iterator to be advanced, or {@code null} to return {@code 0} . -
numberToAdvance(long) — the number of elements to advance the iterator.
-
- Returns: the actual number of elements the iterator was advanced, or {@code 0} if {@code iterator} is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code numberToAdvance} is negative.
-
skip(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> skip(final Iterator<? extends T> iter, final long n) throws IllegalArgumentException - Summary: Skips the first {@code n} elements of the provided iterator and returns a new {@code ObjIterator} starting from the (n+1)th element.
-
Contract:
- If {@code n} is greater than the size of the iterator, an empty {@code ObjIterator} will be returned.
- The {@code skip} action is only triggered when {@code Iterator.hasNext()} or {@code Iterator.next()} is called.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be skipped, or {@code null} to return an empty iterator. -
n(long) — the number of elements to skip from the beginning of the iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original iterator starting from the (n+1)th element, or an empty iterator if {@code iter} is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
limit(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> limit(final Iterator<? extends T> iter, final long count) throws IllegalArgumentException - Summary: Returns an {@code ObjIterator} that is limited to the specified count of elements from the original iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be limited, or {@code null} to return an empty iterator. -
count(long) — the maximum number of elements to be iterated over from the original iterator.
-
- Returns: an {@code ObjIterator} that will iterate over up to {@code count} elements of the original iterator, or an empty iterator if {@code iter} is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code count} is negative.
-
skipAndLimit(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> skipAndLimit(final Iterator<? extends T> iter, final long offset, final long count) - Summary: Returns a new ObjIterator that starts from the specified offset and is limited to the specified count of elements from the original Iterator.
-
Contract:
- The {@code skip} action is only triggered when {@code Iterator.hasNext()} or {@code Iterator.next()} is called.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to be skipped and limited. -
offset(long) — the number of elements to skip from the beginning. Must be non-negative. -
count(long) — the maximum number of elements to return after skipping. Must be non-negative.
-
- Returns: an {@code ObjIterator} that will iterate over up to {@code count} elements starting from the (offset+1)th element.
- See also: N#slice(Iterator, int, int)
-
Signature:
public static <T> ObjIterator<T> skipAndLimit(final Iterable<? extends T> iterable, final long offset, final long count) - Summary: Returns an {@code ObjIterator} that starts from the specified offset and is limited to the specified count of elements from the original {@code Iterable} .
-
Parameters:
-
iterable(Iterable<? extends T>) — the original {@code Iterable} to be skipped and limited, or {@code null} to return an empty iterator. -
offset(long) — the number of elements to skip from the beginning of the {@code Iterable} . -
count(long) — the maximum number of elements to be iterated over from the {@code Iterable} after skipping.
-
- Returns: an {@code ObjIterator} that will iterate over up to {@code count} elements of the original {@code Iterable} starting from the (offset+1)th element.
skipNulls(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> skipNulls(final Iterable<? extends T> c) - Summary: Returns a new {@code ObjIterator} with {@code null} elements removed from the specified Iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable whose {@code null} elements should be skipped.
-
- Returns: an {@code ObjIterator} that iterates over only the {@code non-null} elements.
-
Signature:
public static <T> ObjIterator<T> skipNulls(final Iterator<? extends T> iter) - Summary: Returns a new {@code ObjIterator} with {@code null} elements removed from the specified Iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator whose {@code null} elements should be skipped.
-
- Returns: an {@code ObjIterator} that iterates over only the {@code non-null} elements.
distinct(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> distinct(final Iterable<? extends T> c) - Summary: Returns a new ObjIterator with distinct elements from the original Iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the original Iterable to be processed for distinct elements.
-
- Returns: a new ObjIterator that will iterate over the distinct elements of the original Iterable.
-
Signature:
public static <T> ObjIterator<T> distinct(final Iterator<? extends T> iter) - Summary: Returns a new ObjIterator with distinct elements from the original Iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the original Iterator to be processed for distinct elements.
-
- Returns: a new ObjIterator that will iterate over the distinct elements of the original Iterator.
distinctBy(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> distinctBy(final Iterable<? extends T> c, final Function<? super T, ?> keyExtractor) throws IllegalArgumentException - Summary: Returns an {@code ObjIterator} with distinct elements from the original {@code Iterable} based on a key derived from each element.
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be processed for distinct elements, or {@code null} to return an empty iterator. -
keyExtractor(Function<? super T, ?>) — a {@code Function} that takes an element from the {@code Iterable} and returns a key. Elements with the same key are considered duplicates.
-
- Returns: an {@code ObjIterator} that will iterate over the distinct elements of the original {@code Iterable} based on the keys derived from {@code keyExtractor} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code keyExtractor} is {@code null} .
-
-
Signature:
public static <T> ObjIterator<T> distinctBy(final Iterator<? extends T> iter, final Function<? super T, ?> keyExtractor) throws IllegalArgumentException - Summary: Returns an {@code ObjIterator} with distinct elements from the original iterator based on a key derived from each element.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed for distinct elements, or {@code null} to return an empty iterator. -
keyExtractor(Function<? super T, ?>) — a {@code Function} that takes an element from the iterator and returns a key. Elements with the same key are considered duplicates.
-
- Returns: an {@code ObjIterator} that will iterate over the distinct elements of the original iterator based on the keys derived from {@code keyExtractor} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code keyExtractor} is {@code null} .
-
filter(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> filter(final Iterable<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that only includes elements from the original {@code Iterable} that satisfy the provided {@code Predicate} .
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be filtered, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the {@code Iterable} . Only elements that return {@code true} are included in the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original {@code Iterable} that satisfy the provided {@code Predicate} .
-
Signature:
public static <T> ObjIterator<T> filter(final Iterator<? extends T> iter, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that only includes elements from the original iterator that satisfy the provided {@code Predicate} .
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be filtered, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the iterator. Only elements that return {@code true} are included in the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original iterator that satisfy the provided {@code Predicate} .
takeWhile(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> takeWhile(final Iterable<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that includes elements from the original {@code Iterable} as long as they satisfy the provided {@code Predicate} .
-
Contract:
- The iteration stops when an element that does not satisfy the {@code Predicate} is encountered.
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the {@code Iterable} . The iteration continues as long as the {@code Predicate} returns {@code true} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original {@code Iterable} as long as they satisfy the provided {@code Predicate} .
-
Signature:
public static <T> ObjIterator<T> takeWhile(final Iterator<? extends T> iter, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that includes elements from the original iterator as long as they satisfy the provided {@code Predicate} .
-
Contract:
- The iteration stops when an element that does not satisfy the {@code Predicate} is encountered.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the iterator. The iteration continues as long as the {@code Predicate} returns {@code true} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original iterator as long as they satisfy the provided {@code Predicate} .
takeWhileInclusive(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> takeWhileInclusive(final Iterable<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that includes elements from the original {@code Iterable} as long as they satisfy the provided {@code Predicate} .
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the {@code Iterable} . The iteration continues as long as the {@code Predicate} returns {@code true} , including the first element that returns {@code false} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original {@code Iterable} as long as they satisfy the provided {@code Predicate} , including the first element that does not satisfy the {@code Predicate} .
-
Signature:
public static <T> ObjIterator<T> takeWhileInclusive(final Iterator<? extends T> iter, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that includes elements from the original iterator as long as they satisfy the provided {@code Predicate} .
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the iterator. The iteration continues as long as the {@code Predicate} returns {@code true} , including the first element that returns {@code false} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original iterator as long as they satisfy the provided {@code Predicate} , including the first element that does not satisfy the {@code Predicate} .
dropWhile(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> dropWhile(final Iterable<? extends T> c, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that skips elements from the original {@code Iterable} as long as they satisfy the provided {@code Predicate} .
-
Contract:
- The iteration begins when an element that does not satisfy the {@code Predicate} is encountered.
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the {@code Iterable} . The iteration skips elements as long as the {@code Predicate} returns {@code true} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original {@code Iterable} starting from the first element that does not satisfy the provided {@code Predicate} .
-
Signature:
public static <T> ObjIterator<T> dropWhile(final Iterator<? extends T> iter, final Predicate<? super T> predicate) - Summary: Returns an {@code ObjIterator} that skips elements from the original iterator as long as they satisfy the provided {@code Predicate} .
-
Contract:
- The iteration begins when an element that does not satisfy the {@code Predicate} is encountered.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests each element from the iterator. The iteration skips elements as long as the {@code Predicate} returns {@code true} .
-
- Returns: an {@code ObjIterator} that will iterate over the elements of the original iterator starting from the first element that does not satisfy the provided {@code Predicate} .
skipUntil(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> skipUntil(final Iterable<? extends T> c, final Predicate<? super T> predicate) - Summary: Skips elements in the provided {@code Iterable} until the provided {@code Predicate} returns {@code true} .
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests elements from the original {@code Iterable} .
-
- Returns: an {@code ObjIterator} that will iterate over the remaining elements after the {@code Predicate} returns {@code true} for the first time.
-
Signature:
@Beta public static <T> ObjIterator<T> skipUntil(final Iterator<? extends T> iter, final Predicate<? super T> predicate) - Summary: Skips elements in the provided iterator until the provided {@code Predicate} returns {@code true} .
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed, or {@code null} to return an empty iterator. -
predicate(Predicate<? super T>) — a {@code Predicate} that tests elements from the original iterator.
-
- Returns: an {@code ObjIterator} that will iterate over the remaining elements after the {@code Predicate} returns {@code true} for the first time.
map(...) -> ObjIterator<U>
-
Signature:
@Beta public static <T, U> ObjIterator<U> map(final Iterable<? extends T> c, final Function<? super T, U> mapper) - Summary: Transforms the elements of the given {@code Iterable} using the provided {@code Function} and returns an {@code ObjIterator} with the transformed elements.
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, U>) — a {@code Function} that takes an element from the {@code Iterable} and returns a transformed element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original {@code Iterable} .
-
Signature:
public static <T, U> ObjIterator<U> map(final Iterator<? extends T> iter, final Function<? super T, U> mapper) - Summary: Transforms the elements of the given iterator using the provided {@code Function} and returns an {@code ObjIterator} with the transformed elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, U>) — a {@code Function} that takes an element from the iterator and returns a transformed element for the resulting {@code ObjIterator} .
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original iterator.
flatMap(...) -> ObjIterator<U>
-
Signature:
@Beta public static <T, U> ObjIterator<U> flatMap(final Iterable<? extends T> c, final Function<? super T, ? extends Iterable<? extends U>> mapper) - Summary: Transforms the elements of the given {@code Iterable} into {@code Iterable} s using the provided {@code Function} and flattens the result into an {@code ObjIterator} .
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, ? extends Iterable<? extends U>>) — a {@code Function} that takes an element from the {@code Iterable} and returns an {@code Iterable} of transformed elements.
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original {@code Iterable} .
-
Signature:
public static <T, U> ObjIterator<U> flatMap(final Iterator<? extends T> iter, final Function<? super T, ? extends Iterable<? extends U>> mapper) - Summary: Transforms the elements of the given iterator into {@code Iterable} s using the provided {@code Function} and flattens the result into an {@code ObjIterator} .
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, ? extends Iterable<? extends U>>) — a {@code Function} that takes an element from the iterator and returns an {@code Iterable} of transformed elements.
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original iterator.
flatmap(...) -> ObjIterator<U>
-
Signature:
@Beta public static <T, U> ObjIterator<U> flatmap(final Iterable<? extends T> c, final Function<? super T, ? extends U[]> mapper) - Summary: Transforms the elements of the given {@code Iterable} into arrays using the provided {@code Function} and flattens the result into an {@code ObjIterator} .
-
Parameters:
-
c(Iterable<? extends T>) — the original {@code Iterable} to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, ? extends U[]>) — a {@code Function} that takes an element from the {@code Iterable} and returns an array of transformed elements.
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original {@code Iterable} .
-
Signature:
public static <T, U> ObjIterator<U> flatmap(final Iterator<? extends T> iter, final Function<? super T, ? extends U[]> mapper) - Summary: Transforms the elements of the given iterator into arrays using the provided {@code Function} and flattens the result into an {@code ObjIterator} .
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be transformed, or {@code null} to return an empty iterator. -
mapper(Function<? super T, ? extends U[]>) — a {@code Function} that takes an element from the iterator and returns an array of transformed elements.
-
- Returns: an {@code ObjIterator} that will iterate over the transformed elements of the original iterator.
forEach(...) -> void
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given iterator and executes a final action upon completion.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be executed after all elements in the iterator have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final long offset, final long count, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given iterator, starting from a specified offset and up to a specified count.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
offset(long) — the starting point in the iterator from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterator. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Iterator<? extends T> iter, final long offset, final long count, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given iterator, starting from a specified offset and up to a specified count.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
offset(long) — the starting point in the iterator from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterator. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be executed after all elements in the iterator have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final long offset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given iterator, starting from a specified offset and up to a specified count.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
offset(long) — the starting point in the iterator from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterator. -
processThreadNum(int) — the number of threads to be used for processing. -
queueSize(int) — the size of the queue for holding elements before processing. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Iterator<? extends T> iter, final long offset, final long count, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given iterator, starting from a specified offset and up to a specified count.
-
Parameters:
-
iter(Iterator<? extends T>) — the original iterator to be processed. -
offset(long) — the starting point in the iterator from where processing should begin. -
count(long) — the maximum number of elements to process. -
processThreadNum(int) — the number of threads to be used for processing. -
queueSize(int) — the size of the queue to hold the processing records. The default size is 1024. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterator. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be performed once all elements have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given collection of iterators.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given collection of iterators.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be executed after all elements in the iterators have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final long offset, final long count, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given collection of iterators, starting from a specified offset and up to a specified count.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
offset(long) — the starting point in the iterators from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterators. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final long offset, final long count, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given collection of iterators, starting from a specified offset and up to a specified count.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
offset(long) — the starting point in the iterators from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterators. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be executed after all elements in the iterators have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given collection of iterators.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
readThreadNum(int) — the number of threads to be used for reading elements from the iterators. -
processThreadNum(int) — the number of threads to be used for processing elements. -
queueSize(int) — the size of the queue for holding elements before processing. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs an action for each element of the given collection of iterators.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
readThreadNum(int) — the number of threads to be used for reading elements from the iterators. -
processThreadNum(int) — the number of threads to be used for processing elements. -
queueSize(int) — the size of the queue for holding elements before processing. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be executed after all elements in the iterators have been processed.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
-
Signature:
public static <T, E extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final long offset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer) throws E - Summary: Performs an action for each element of the given collection of iterators, starting from a specified offset and up to a specified count.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
offset(long) — the starting point in the iterators from where elements will be processed. -
count(long) — the maximum number of elements to be processed from the iterators. -
readThreadNum(int) — the number of threads to be used for reading elements from the iterators. -
processThreadNum(int) — the number of threads to be used for processing elements. -
queueSize(int) — the size of the queue for holding elements before processing. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators.
-
-
Throws:
-
E— if the {@code elementConsumer} encounters an exception.
-
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void forEach(final Collection<? extends Iterator<? extends T>> iterators, final long offset, final long count, final int readThreadNum, final int processThreadNum, final int queueSize, final Throwables.Consumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> onComplete) throws IllegalArgumentException, E, E2 - Summary: Performs an action for each element of the given collection of iterators, starting from a specified offset and up to a specified count.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the original collection of iterators to be processed. -
offset(long) — the starting point in the iterators from where processing should begin. -
count(long) — the maximum number of elements to process. -
readThreadNum(int) — the number of threads to be used for reading. -
processThreadNum(int) — the number of threads to be used for processing. -
queueSize(int) — the size of the queue to hold the processing records. -
elementConsumer(Throwables.Consumer<? super T, E>) — a {@code Consumer} that performs an action on each element in the iterators. -
onComplete(Throwables.Runnable<E2>) — a {@code Runnable} action to be performed once all elements have been processed.
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code offset} or {@code count} is negative. -
E— if the {@code elementConsumer} encounters an exception. -
E2— if the {@code onComplete} action encounters an exception.
-
Public Instance Methods
- (none)
Enum JavaVersion (com.landawn.abacus.util.JavaVersion)
An enumeration representing all versions of the Java specification.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> JavaVersion
-
Signature:
public static JavaVersion of(final String versionStr) - Summary: Parses a version string and returns the corresponding JavaVersion enum constant.
-
Parameters:
-
versionStr(String) — the version string to parse (e.g., "1.8", "11", "17.0.1")
-
- Returns: the corresponding JavaVersion enum constant
Public Instance Methods
atLeast(...) -> boolean
-
Signature:
public boolean atLeast(final JavaVersion requiredVersion) - Summary: Checks whether this Java version is at least as recent as the specified version.
-
Contract:
- <p> This method performs a numerical comparison of version values to determine if this version is equal to or greater than the required version.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code JavaVersion current = JavaVersion.JAVA_11; if (current.atLeast(JavaVersion.JAVA_1_8)) { System.out.println("Java 8+ features available"); } } </pre>
-
Parameters:
-
requiredVersion(JavaVersion) — the minimum version to check against, not null
-
- Returns: {@code true} if this version is equal to or greater than the specified version, {@code false} otherwise
atMost(...) -> boolean
-
Signature:
public boolean atMost(final JavaVersion requiredVersion) - Summary: Checks whether this Java version is at most as recent as the specified version.
-
Contract:
- <p> This method performs a numerical comparison of version values to determine if this version is equal to or less than the specified version.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code JavaVersion current = JavaVersion.JAVA_1_7; if (current.atMost(JavaVersion.JAVA_1_8)) { System.out.println("Not using Java 9+ features"); } } </pre>
-
Parameters:
-
requiredVersion(JavaVersion) — the maximum version to check against, not null
-
- Returns: {@code true} if this version is equal to or less than the specified version, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the standard name of this Java version.
-
Parameters:
- (none)
- Returns: the standard version name, never null
Class Joiner (com.landawn.abacus.util.Joiner)
A fluent string joining utility that concatenates elements into a single string with configurable separators, prefixes, and suffixes.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
defauLt(...) -> Joiner
-
Signature:
@Beta public static Joiner defauLt() - Summary: Returns a default Joiner instance with default delimiter (", ") and default key-value delimiter ("=").
-
Parameters:
- (none)
- Returns: a new Joiner instance with default delimiters.
- See also: #with(CharSequence), #with(CharSequence, CharSequence), Splitter#defauLt(), Splitter.MapSplitter#defauLt()
with(...) -> Joiner
-
Signature:
public static Joiner with(final CharSequence separator) - Summary: Creates a new Joiner instance with the specified separator.
-
Parameters:
-
separator(CharSequence) — the delimiter to use between joined elements, must not be null.
-
- Returns: a new Joiner instance with the specified separator.
-
Signature:
public static Joiner with(final CharSequence separator, final CharSequence keyValueDelimiter) - Summary: Creates a new Joiner instance with the specified separator and key-value delimiter.
-
Parameters:
-
separator(CharSequence) — the delimiter to use between joined elements, must not be null. -
keyValueDelimiter(CharSequence) — the delimiter to use between keys and values, must not be null.
-
- Returns: a new Joiner instance with the specified separators.
-
Signature:
public static Joiner with(final CharSequence separator, final CharSequence prefix, final CharSequence suffix) - Summary: Creates a new Joiner instance with the specified separator, prefix, and suffix.
-
Parameters:
-
separator(CharSequence) — the delimiter to use between joined elements, must not be null. -
prefix(CharSequence) — the string to prepend to the result, must not be null. -
suffix(CharSequence) — the string to append to the result, must not be null.
-
- Returns: a new Joiner instance with the specified separator, prefix, and suffix.
-
Signature:
public static Joiner with(final CharSequence separator, final CharSequence keyValueSeparator, final CharSequence prefix, final CharSequence suffix) - Summary: Creates a new Joiner instance with the specified separator, key-value separator, prefix, and suffix.
-
Parameters:
-
separator(CharSequence) — the delimiter to use between joined elements, must not be null. -
keyValueSeparator(CharSequence) — the delimiter to use between keys and values, must not be null. -
prefix(CharSequence) — the string to prepend to the result, must not be null. -
suffix(CharSequence) — the string to append to the result, must not be null.
-
- Returns: a new Joiner instance with all specified formatting options.
Public Instance Methods
setEmptyValue(...) -> Joiner
-
Signature:
public Joiner setEmptyValue(final CharSequence emptyValue) throws IllegalArgumentException - Summary: Sets the value to be returned when no elements have been added to the joiner.
-
Contract:
- Sets the value to be returned when no elements have been added to the joiner.
- By default, when no elements are added, the joiner returns prefix + suffix.
-
Parameters:
-
emptyValue(CharSequence) — the value to return when no elements have been added, must not be null.
-
- Returns: this Joiner instance for method chaining.
-
Throws:
-
java.lang.IllegalArgumentException— if emptyValue is null.
-
trimBeforeAppend(...) -> Joiner
-
Signature:
public Joiner trimBeforeAppend() - Summary: Configures the joiner to trim whitespace from the beginning and end of each string element before appending.
-
Parameters:
- (none)
- Returns: this Joiner instance for method chaining.
skipNulls(...) -> Joiner
-
Signature:
public Joiner skipNulls() - Summary: Configures the joiner to skip {@code null} elements instead of adding them to the result.
-
Contract:
- When enabled, {@code null} values will be ignored during appending operations.
-
Parameters:
- (none)
- Returns: this Joiner instance for method chaining.
useForNull(...) -> Joiner
-
Signature:
public Joiner useForNull(final String nullText) - Summary: Sets the string representation to use for {@code null} values.
-
Contract:
- This setting is ignored if {@link #skipNulls()} has been called.
-
Parameters:
-
nullText(String) — the string to use for {@code null} values, if {@code null} is passed, "null" will be used.
-
- Returns: this Joiner instance for method chaining.
reuseBuffer(...) -> Joiner
-
Signature:
@Beta public Joiner reuseBuffer() - Summary: Enables the use of a cached StringBuilder from an object pool to improve performance.
-
Contract:
- When enabled, the internal buffer will be obtained from and returned to an object pool.
- <p> <b> Important: </b> When using cached buffer, you must call one of the terminal operations ( {@link #toString()} , {@link #appendTo(Appendable)} , {@link #map(Function)} , {@link #mapIfNotEmpty(Function)} , or {@link #close()} to properly recycle the buffer.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Joiner joiner = Joiner.with(", ").reuseBuffer(); try { String result = joiner.appendAll("a", "b", "c").toString(); } finally { joiner.close(); // Optional if toString() was called } } </pre>
-
Parameters:
- (none)
- Returns: this Joiner instance for method chaining.
append(...) -> Joiner
-
Signature:
public Joiner append(final boolean element) - Summary: Appends a boolean value to the joiner.
-
Parameters:
-
element(boolean) — the boolean value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final char element) - Summary: Appends a char value to the joiner.
-
Parameters:
-
element(char) — the char value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final int element) - Summary: Appends an int value to the joiner.
-
Parameters:
-
element(int) — the int value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final long element) - Summary: Appends a long value to the joiner.
-
Parameters:
-
element(long) — the long value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final float element) - Summary: Appends a float value to the joiner.
-
Parameters:
-
element(float) — the float value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final double element) - Summary: Appends a double value to the joiner.
-
Parameters:
-
element(double) — the double value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final String element) - Summary: Appends a String to the joiner.
-
Contract:
- If the string is {@code null} , it will be handled according to the skipNulls and useForNull settings.
- If trimBeforeAppend is enabled, the string will be trimmed before appending.
-
Parameters:
-
element(String) — the String to append, may be null
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final CharSequence element) - Summary: Appends a CharSequence to the joiner.
-
Contract:
- If the CharSequence is {@code null} , it will be handled according to the skipNulls and useForNull settings.
- If trimBeforeAppend is enabled, the CharSequence will be converted to string and trimmed before appending.
-
Parameters:
-
element(CharSequence) — the CharSequence to append, may be null
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final CharSequence element, final int start, final int end) - Summary: Appends a subsequence of the specified CharSequence to the joiner.
-
Contract:
- If the CharSequence is {@code null} , it will be handled according to the skipNulls and useForNull settings.
-
Parameters:
-
element(CharSequence) — the CharSequence to append from, may be null -
start(int) — the start index (inclusive) -
end(int) — the end index (exclusive)
-
- Returns: this Joiner instance for method chaining
- See also: Appendable#append(CharSequence, int, int)
-
Signature:
public Joiner append(final StringBuilder element) - Summary: Appends a StringBuilder to the joiner.
-
Contract:
- If the StringBuilder is {@code null} , it will be handled according to the skipNulls and useForNull settings.
- Note: The contents of the StringBuilder are appended directly without trimming even if trimBeforeAppend is enabled.
-
Parameters:
-
element(StringBuilder) — the StringBuilder to append, may be null
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner append(final Object element) - Summary: Appends an Object to the joiner.
-
Contract:
- If the object is {@code null} , it will be handled according to the skipNulls and useForNull settings.
- If trimBeforeAppend is enabled, the string representation will be trimmed before appending.
-
Parameters:
-
element(Object) — the Object to append, may be null
-
- Returns: this Joiner instance for method chaining
appendIfNotNull(...) -> Joiner
-
Signature:
public Joiner appendIfNotNull(final Object element) - Summary: Appends an object to the joiner only if it is not {@code null} .
-
Contract:
- Appends an object to the joiner only if it is not {@code null} .
-
Parameters:
-
element(Object) — the object to append if not null
-
- Returns: this Joiner instance for method chaining
appendIf(...) -> Joiner
-
Signature:
public Joiner appendIf(final boolean b, final Supplier<?> supplier) - Summary: Conditionally appends a value provided by a supplier if the specified condition is {@code true} .
-
Contract:
- Conditionally appends a value provided by a supplier if the specified condition is {@code true} .
- The supplier is only invoked if the condition is {@code true} .
-
Parameters:
-
b(boolean) — the condition to check -
supplier(Supplier<?>) — the supplier that provides the value to append when condition is true
-
- Returns: this Joiner instance for method chaining
appendAll(...) -> Joiner
-
Signature:
public Joiner appendAll(final boolean[] a) - Summary: Appends all elements from a boolean array to the joiner.
-
Parameters:
-
a(boolean[]) — the boolean array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a boolean array to the joiner.
-
Parameters:
-
a(boolean[]) — the boolean array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final char[] a) - Summary: Appends all elements from a char array to the joiner.
-
Parameters:
-
a(char[]) — the char array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a char array to the joiner.
-
Parameters:
-
a(char[]) — the char array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final byte[] a) - Summary: Appends all elements from a byte array to the joiner.
-
Parameters:
-
a(byte[]) — the byte array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a byte array to the joiner.
-
Parameters:
-
a(byte[]) — the byte array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final short[] a) - Summary: Appends all elements from a short array to the joiner.
-
Parameters:
-
a(short[]) — the short array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a short array to the joiner.
-
Parameters:
-
a(short[]) — the short array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final int[] a) - Summary: Appends all elements from an int array to the joiner.
-
Parameters:
-
a(int[]) — the int array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from an int array to the joiner.
-
Parameters:
-
a(int[]) — the int array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final long[] a) - Summary: Appends all elements from a long array to the joiner.
-
Parameters:
-
a(long[]) — the long array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a long array to the joiner.
-
Parameters:
-
a(long[]) — the long array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final float[] a) - Summary: Appends all elements from a float array to the joiner.
-
Parameters:
-
a(float[]) — the float array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a float array to the joiner.
-
Parameters:
-
a(float[]) — the float array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final double[] a) - Summary: Appends all elements from a double array to the joiner.
-
Parameters:
-
a(double[]) — the double array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a double array to the joiner.
-
Parameters:
-
a(double[]) — the double array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final Object[] a) - Summary: Appends all elements from an Object array to the joiner.
-
Parameters:
-
a(Object[]) — the Object array to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final Object[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from an Object array to the joiner.
-
Parameters:
-
a(Object[]) — the Object array to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final BooleanList c) - Summary: Appends all elements from a BooleanList to the joiner.
-
Parameters:
-
c(BooleanList) — the BooleanList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final BooleanList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a BooleanList to the joiner.
-
Parameters:
-
c(BooleanList) — the BooleanList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final CharList c) - Summary: Appends all elements from a CharList to the joiner.
-
Parameters:
-
c(CharList) — the CharList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final CharList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a CharList to the joiner.
-
Parameters:
-
c(CharList) — the CharList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final ByteList c) - Summary: Appends all elements from a ByteList to the joiner.
-
Parameters:
-
c(ByteList) — the ByteList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final ByteList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a ByteList to the joiner.
-
Parameters:
-
c(ByteList) — the ByteList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final ShortList c) - Summary: Appends all elements from a ShortList to the joiner.
-
Parameters:
-
c(ShortList) — the ShortList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final ShortList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a ShortList to the joiner.
-
Parameters:
-
c(ShortList) — the ShortList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final IntList c) - Summary: Appends all elements from an IntList to the joiner.
-
Parameters:
-
c(IntList) — the IntList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final IntList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from an IntList to the joiner.
-
Parameters:
-
c(IntList) — the IntList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final LongList c) - Summary: Appends all elements from a LongList to the joiner.
-
Parameters:
-
c(LongList) — the LongList to append, may be {@code null} or empty
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final LongList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a LongList to the joiner.
-
Parameters:
-
c(LongList) — the LongList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final FloatList c) - Summary: Appends all elements from a FloatList to the joiner.
-
Parameters:
-
c(FloatList) — the FloatList to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final FloatList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a FloatList to the joiner.
-
Parameters:
-
c(FloatList) — the FloatList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final DoubleList c) - Summary: Appends all elements from a DoubleList to the joiner.
-
Parameters:
-
c(DoubleList) — the DoubleList to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
@SuppressWarnings("deprecation") public Joiner appendAll(final DoubleList c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a DoubleList to the joiner.
-
Parameters:
-
c(DoubleList) — the DoubleList to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final Collection<?> c) - Summary: Appends all elements from a Collection to the joiner.
-
Parameters:
-
c(Collection<?>) — the Collection to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendAll(final Collection<?> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of elements from a Collection to the joiner.
-
Parameters:
-
c(Collection<?>) — the Collection to append from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public Joiner appendAll(final Iterable<?> c) - Summary: Appends all elements from an Iterable to the joiner.
-
Parameters:
-
c(Iterable<?>) — the Iterable to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public <T> Joiner appendAll(final Iterable<? extends T> c, final Predicate<? super T> filter) throws IllegalArgumentException - Summary: Appends elements from an Iterable that satisfy the given filter predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the Iterable to append from -
filter(Predicate<? super T>) — the predicate to test elements; only elements that pass are appended; must not be {@code null}
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if {@code filter} is {@code null}
-
-
Signature:
public Joiner appendAll(final Iterator<?> iter) - Summary: Appends all elements from an Iterator to the joiner.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to append from
-
- Returns: this Joiner instance for method chaining
-
Signature:
public <T> Joiner appendAll(final Iterator<? extends T> iter, final Predicate<? super T> filter) throws IllegalArgumentException - Summary: Appends elements from an Iterator that satisfy the given filter predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to append from -
filter(Predicate<? super T>) — the predicate to test elements; only elements that pass are appended; must not be {@code null}
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if {@code filter} is {@code null}
-
appendEntry(...) -> Joiner
-
Signature:
public Joiner appendEntry(final String key, final boolean value) - Summary: Appends a key-value pair with a boolean value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(boolean) — the boolean value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final char value) - Summary: Appends a key-value pair with a char value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(char) — the char value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final int value) - Summary: Appends a key-value pair with an int value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(int) — the int value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final long value) - Summary: Appends a key-value pair with a long value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(long) — the long value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final float value) - Summary: Appends a key-value pair with a float value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(float) — the float value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final double value) - Summary: Appends a key-value pair with a double value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(double) — the double value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final String value) - Summary: Appends a key-value pair with a String value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(String) — the String value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final CharSequence value) - Summary: Appends a key-value pair with a CharSequence value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(CharSequence) — the CharSequence value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final StringBuilder value) - Summary: Appends a key-value pair with a StringBuilder value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(StringBuilder) — the StringBuilder value to append (can be null)
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final String key, final Object value) - Summary: Appends a key-value pair with an Object value to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
key(String) — the key to append -
value(Object) — the Object value to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntry(final Map.Entry<?, ?> entry) - Summary: Appends a Map.Entry to the joiner.
-
Contract:
- If multiple entries are appended, they are separated by the configured separator.
-
Parameters:
-
entry(Map.Entry<?, ?>) — the Map.Entry to append
-
- Returns: this Joiner instance for method chaining
appendEntries(...) -> Joiner
-
Signature:
public Joiner appendEntries(final Map<?, ?> m) - Summary: Appends all entries from a given map to the Joiner.
-
Parameters:
-
m(Map<?, ?>) — the map containing the entries to be appended
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendEntries(final Map<?, ?> m, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Appends a range of entries from a Map to the joiner.
-
Parameters:
-
m(Map<?, ?>) — the Map to append entries from -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range
-
-
Signature:
public <K, V> Joiner appendEntries(final Map<K, V> m, final Predicate<? super Map.Entry<K, V>> filter) throws IllegalArgumentException - Summary: Appends entries from a Map that satisfy the given filter predicate.
-
Parameters:
-
m(Map<K, V>) — the Map to append entries from -
filter(Predicate<? super Map.Entry<K, V>>) — the predicate to test entries; only entries that pass are appended; must not be {@code null}
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if {@code filter} is {@code null}
-
-
Signature:
public <K, V> Joiner appendEntries(final Map<K, V> m, final BiPredicate<? super K, ? super V> filter) throws IllegalArgumentException - Summary: Appends entries from a Map that satisfy the given key-value filter predicate.
-
Parameters:
-
m(Map<K, V>) — the Map to append entries from -
filter(BiPredicate<? super K, ? super V>) — the bi-predicate to test keys and values; only entries that pass are appended; must not be {@code null}
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if {@code filter} is {@code null}
-
-
Signature:
public <K, V> Joiner appendEntries(final Map<K, V> m, final Function<? super K, ?> keyExtractor, final Function<? super V, ?> valueExtractor) throws IllegalArgumentException - Summary: Appends entries from a Map with transformed keys and values.
-
Parameters:
-
m(Map<K, V>) — the Map to append entries from -
keyExtractor(Function<? super K, ?>) — the function to transform keys before appending -
valueExtractor(Function<? super V, ?>) — the function to transform values before appending
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or valueExtractor is null
-
appendBean(...) -> Joiner
-
Signature:
public Joiner appendBean(final Object bean) - Summary: Appends all properties of a bean object to the joiner.
-
Contract:
- The bean must have getter/setter methods defined.
-
Parameters:
-
bean(Object) — the bean object whose properties to append
-
- Returns: this Joiner instance for method chaining
-
Signature:
public Joiner appendBean(final Object bean, final Collection<String> selectPropNames) throws IllegalArgumentException - Summary: Appends selected properties of a bean object to the joiner.
-
Contract:
- The bean object must be a valid JavaBean with proper getter/setter methods.
- If {@code selectPropNames} is {@code null} or empty, no properties are appended.
-
Parameters:
-
bean(Object) — the bean object whose selected properties to append; may be {@code null} -
selectPropNames(Collection<String>) — collection of property names to include; if {@code null} or empty, no properties are appended
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if {@code bean} is not {@code null} and its class is not a valid JavaBean (i.e., doesn't have proper getter/setter methods)
-
- See also: #appendBean(Object), #appendBean(Object, boolean, Set)
-
Signature:
public Joiner appendBean(final Object bean, final boolean ignoreNullProperty, final Set<String> ignoredPropNames) throws IllegalArgumentException - Summary: Appends properties of a bean object with control over {@code null} handling and property exclusion.
-
Parameters:
-
bean(Object) — the bean object whose properties to append -
ignoreNullProperty(boolean) — if {@code true} , properties with {@code null} values are skipped -
ignoredPropNames(Set<String>) — set of property names to exclude from appending
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if bean is not a valid bean class with getter/setter methods
-
-
Signature:
public Joiner appendBean(final Object bean, final BiPredicate<? super String, ?> filter) throws IllegalArgumentException - Summary: Appends properties of a bean object that satisfy the given filter predicate.
-
Parameters:
-
bean(Object) — the bean object whose properties to append -
filter(BiPredicate<? super String, ?>) — the bi-predicate to test property names and values; only properties that pass are appended
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if filter is {@code null} , or if bean is not {@code null} and is not a valid bean class with getter/setter methods
-
repeat(...) -> Joiner
-
Signature:
public Joiner repeat(final String str, final int n) throws IllegalArgumentException - Summary: Repeats the specified string n times and appends to the joiner.
-
Contract:
- If n is 0, nothing is appended.
-
Parameters:
-
str(String) — the string to repeat -
n(int) — the number of times to repeat (must be non-negative)
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
-
Signature:
public Joiner repeat(final Object obj, final int n) - Summary: Repeats the specified object n times and appends to the joiner.
-
Parameters:
-
obj(Object) — the object to repeat -
n(int) — the number of times to repeat (must be non-negative)
-
- Returns: this Joiner instance for method chaining
merge(...) -> Joiner
-
Signature:
public Joiner merge(final Joiner other) throws IllegalArgumentException - Summary: Adds the contents from the specified Joiner {@code other} without prefix and suffix as the next element if it is non-empty.
-
Contract:
- Adds the contents from the specified Joiner {@code other} without prefix and suffix as the next element if it is non-empty.
- If the specified {@code Joiner} is empty, the call has no effect.
- <p> Remember to close {@code other} Joiner if {@code reuseBuffer} is set to {@code true} .
-
Parameters:
-
other(Joiner) — the Joiner to merge content from
-
- Returns: this Joiner instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if the specified Joiner {@code other} is {@code null}
-
length(...) -> int
-
Signature:
public int length() - Summary: Returns the current length of the joined content.
-
Contract:
- If no elements have been appended, returns the length of prefix + suffix.
-
Parameters:
- (none)
- Returns: the length of the current joined content
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the current value, consisting of the {@code prefix} , the values added so far separated by the {@code delimiter} , and the {@code suffix} , unless no elements have been added in which case, the {@code prefix + suffix} or the {@code emptyValue} characters are returned.
-
Contract:
- The underlying {@code StringBuilder} will be recycled after this method is called if {@code reuseStringBuilder} is set to {@code true} , and should not continue to be used with this instance.
-
Parameters:
- (none)
- Returns: the joined string with prefix and suffix
appendTo(...) -> A
-
Signature:
public <A extends Appendable> A appendTo(final A appendable) throws IOException - Summary: Appends the joined string to the specified Appendable.
-
Contract:
- If no elements have been appended, nothing is appended to the Appendable.
-
Parameters:
-
appendable(A) — the Appendable to append the joined string to
-
- Returns: the same Appendable instance for method chaining
-
Throws:
-
java.io.IOException— if an I/O error occurs during appending
-
map(...) -> T
-
Signature:
@Beta public <T> T map(final Function<? super String, T> mapper) - Summary: Applies the given mapping function to the joined string and returns the result.
-
Contract:
- The underlying {@code StringBuilder} will be recycled after this method is called if {@code reuseStringBuilder} is set to {@code true} .
-
Parameters:
-
mapper(Function<? super String, T>) — the function to apply to the joined string
-
- Returns: the result of applying the mapper function
mapIfNotEmpty(...) -> Optional<T>
-
Signature:
@Beta public <T> Optional<T> mapIfNotEmpty(final Function<? super String, T> mapper) throws IllegalArgumentException - Summary: Applies the given mapping function to the joined string only if at least one element has been appended.
-
Contract:
- Applies the given mapping function to the joined string only if at least one element has been appended.
- Returns an empty Optional if no elements have been appended.
- The underlying {@code StringBuilder} will be recycled after this method is called if {@code reuseStringBuilder} is set to {@code true} .
-
Parameters:
-
mapper(Function<? super String, T>) — the function to apply to the joined string if not empty
-
- Returns: a Optional containing the result, or empty if no elements were appended
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null
-
close(...) -> void
-
Signature:
@Override public synchronized void close() - Summary: Closes this Joiner and releases any system resources associated with it.
-
Contract:
- If the Joiner is already closed then invoking this method has no effect.
- After closing, the Joiner should not be used for further operations.
-
Parameters:
- (none)
Class JsonMappers (com.landawn.abacus.util.JsonMappers)
A high-performance utility class for JSON serialization and deserialization operations using Jackson's JsonMapper.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toJson(...) -> String
-
Signature:
public static String toJson(final Object obj) - Summary: Serializes the specified object to a JSON string using default configuration.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null")
-
- Returns: a JSON string representation of the object
- See also: #toJson(Object, boolean), #toJson(Object, SerializationFeature, SerializationFeature...)
-
Signature:
public static String toJson(final Object obj, final boolean prettyFormat) - Summary: Serializes the specified object to a JSON string with optional pretty formatting.
-
Contract:
- <p> When pretty format is enabled, the output includes proper indentation and line breaks.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
prettyFormat(boolean) — if {@code true} , the output will be formatted with indentation and line breaks; if {@code false} , output will be compact (single line)
-
- Returns: a JSON string representation of the object
- See also: #toJson(Object)
-
Signature:
public static String toJson(final Object obj, final SerializationFeature first, final SerializationFeature... features) - Summary: Serializes the specified object to a JSON string with custom serialization features.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
first(SerializationFeature) — the first serialization feature to apply (required to ensure at least one feature) -
features(SerializationFeature[]) — additional serialization features to apply (optional)
-
- Returns: a JSON string representation of the object
- See also: SerializationFeature, #toJson(Object, SerializationConfig)
-
Signature:
public static String toJson(final Object obj, final SerializationConfig config) - Summary: Serializes the specified object to a JSON string using a custom serialization configuration.
-
Contract:
- <p> Use this method when you need complex configuration that cannot be achieved with individual features, such as custom serializers, date formats, or visibility settings.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
config(SerializationConfig) — the custom serialization configuration to use; if {@code null} , uses default configuration
-
- Returns: a JSON string representation of the object
- See also: #createSerializationConfig(), SerializationConfig
-
Signature:
public static void toJson(final Object obj, final File output) - Summary: Serializes the specified object to JSON and writes it to a file.
-
Contract:
- The file is created if it doesn't exist, or overwritten if it does.
- <p> This method handles all I/O operations internally, creating parent directories if necessary.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(File) — the file to write the JSON to; parent directories will be created if needed
-
- See also: #toJson(Object, File, SerializationConfig)
-
Signature:
public static void toJson(final Object obj, final File output, final SerializationConfig config) - Summary: Serializes the specified object to JSON and writes it to a file using custom configuration.
-
Contract:
- <p> Use this method when you need to write formatted JSON to a file or apply specific serialization rules for file-based output.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(File) — the file to write the JSON to; parent directories will be created if needed -
config(SerializationConfig) — the custom serialization configuration to use; if {@code null} , uses default configuration
-
- See also: #toJson(Object, File), SerializationConfig
-
Signature:
public static void toJson(final Object obj, final OutputStream output) - Summary: Serializes the specified object to JSON and writes it to an output stream.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(OutputStream) — the output stream to write the JSON to; not closed by this method
-
- See also: #toJson(Object, OutputStream, SerializationConfig)
-
Signature:
public static void toJson(final Object obj, final OutputStream output, final SerializationConfig config) - Summary: Serializes the specified object to JSON and writes it to an output stream using custom configuration.
-
Contract:
- Use this when you need specific serialization behavior for stream-based output, such as custom date formats or pretty printing for HTTP responses.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(OutputStream) — the output stream to write the JSON to; not closed by this method -
config(SerializationConfig) — the custom serialization configuration to use; if {@code null} , uses default configuration
-
- See also: #toJson(Object, OutputStream), SerializationConfig
-
Signature:
public static void toJson(final Object obj, final Writer output) - Summary: Serializes the specified object to JSON and writes it to a Writer.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(Writer) — the writer to write the JSON to; not closed by this method
-
- See also: #toJson(Object, Writer, SerializationConfig)
-
Signature:
public static void toJson(final Object obj, final Writer output, final SerializationConfig config) - Summary: Serializes the specified object to JSON and writes it to a Writer using custom configuration.
-
Contract:
- <p> Use this method when you need specific serialization behavior for character-based output, such as pretty printing to a log file or custom formatting for templates.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(Writer) — the writer to write the JSON to; not closed by this method -
config(SerializationConfig) — the custom serialization configuration to use; if {@code null} , uses default configuration
-
- See also: #toJson(Object, Writer), SerializationConfig
-
Signature:
public static void toJson(final Object obj, final DataOutput output) - Summary: Serializes the specified object to JSON and writes it to a DataOutput.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(DataOutput) — the DataOutput to write the JSON to
-
- See also: #toJson(Object, DataOutput, SerializationConfig), DataOutput
-
Signature:
public static void toJson(final Object obj, final DataOutput output, final SerializationConfig config) - Summary: Serializes the specified object to JSON and writes it to a DataOutput using custom configuration.
-
Contract:
- <p> Use this method when embedding JSON in binary formats with specific serialization requirements, such as compact format without whitespace.
-
Parameters:
-
obj(Object) — the object to serialize; can be {@code null} (produces "null") -
output(DataOutput) — the DataOutput to write the JSON to -
config(SerializationConfig) — the custom serialization configuration to use; if {@code null} , uses default configuration
-
- See also: #toJson(Object, DataOutput), SerializationConfig, DataOutput
fromJson(...) -> T
-
Signature:
public static <T> T fromJson(final byte[] json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a byte array to an object of the specified type.
-
Contract:
- <p> Use this method when working with JSON data from network protocols, file systems, or any binary source.
-
Parameters:
-
json(byte[]) — the JSON content as a UTF-8 encoded byte array -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; never {@code null} unless JSON contains "null"
- See also: #fromJson(byte\[\], int, int, Class), #fromJson(byte\[\], TypeReference)
-
Signature:
public static <T> T fromJson(final byte[] json, final int offset, final int len, final Class<? extends T> targetType) - Summary: Deserializes JSON from a portion of a byte array to an object of the specified type.
-
Contract:
- This method is useful when the JSON data is embedded within a larger byte array.
-
Parameters:
-
json(byte[]) — the byte array containing JSON content -
offset(int) — the offset in the array where JSON data starts -
len(int) — the number of bytes to read from the offset -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; never {@code null} unless JSON contains "null"
- See also: #fromJson(byte\[\], Class)
-
Signature:
public static <T> T fromJson(final String json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a string to an object of the specified type.
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON string is "null"
- See also: #fromJson(String, TypeReference), #fromJson(String, Class, DeserializationFeature, DeserializationFeature...)
-
Signature:
public static <T> T fromJson(final String json, final Class<? extends T> targetType, final DeserializationFeature first, final DeserializationFeature... features) - Summary: Deserializes JSON from a string to an object with custom deserialization features.
-
Contract:
- <p> Common deserialization features include: </p> <ul> <li> FAIL_ON_UNKNOWN_PROPERTIES - Fail if JSON contains unknown properties </li> <li> USE_BIG_DECIMAL_FOR_FLOATS - Use BigDecimal for floating point numbers </li> <li> ACCEPT_SINGLE_VALUE_AS_ARRAY - Accept single values as arrays </li> <li> READ_UNKNOWN_ENUM_VALUES_AS_NULL - Convert unknown enum values to null </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Ignore unknown properties and use BigDecimal for floats String json = "{\\"name\\":\\"John\\",\\"age\\":30,\\"unknown\\":\\"field\\"}"; Person person = JsonMappers.fromJson(json, Person.class, DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); // Accept single value as array String singleValue = "\\"value\\""; List<String> list = JsonMappers.fromJson(singleValue, List.class, DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); } </pre>
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(Class<? extends T>) — the class of the object to deserialize to -
first(DeserializationFeature) — the first deserialization feature to apply (required) -
features(DeserializationFeature[]) — additional deserialization features to apply (optional)
-
- Returns: the deserialized object; {@code null} if JSON string is "null"
- See also: DeserializationFeature, #fromJson(String, Class, DeserializationConfig)
-
Signature:
public static <T> T fromJson(final String json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a string using a custom deserialization configuration.
-
Contract:
- <p> Use this method when you need complex configuration that cannot be achieved with individual features, such as custom deserializers, date formats, or visibility settings.
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON string is "null"
- See also: #createDeserializationConfig(), DeserializationConfig
-
Signature:
public static <T> T fromJson(final File json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a file to an object of the specified type.
-
Parameters:
-
json(File) — the file containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(File, Class, DeserializationConfig), #fromJson(File, TypeReference)
-
Signature:
public static <T> T fromJson(final File json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a file using custom deserialization configuration.
-
Contract:
- <p> Use this method when reading JSON files that require special handling, such as lenient parsing or custom date formats.
-
Parameters:
-
json(File) — the file containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(File, Class), DeserializationConfig
-
Signature:
public static <T> T fromJson(final InputStream json, final Class<? extends T> targetType) - Summary: Deserializes JSON from an input stream to an object of the specified type.
-
Parameters:
-
json(InputStream) — the input stream containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(InputStream, Class, DeserializationConfig), #fromJson(InputStream, TypeReference)
-
Signature:
public static <T> T fromJson(final InputStream json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from an input stream using custom deserialization configuration.
-
Contract:
- Use this when reading JSON from streams that require special handling, such as lenient parsing for external APIs.
-
Parameters:
-
json(InputStream) — the input stream containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(InputStream, Class), DeserializationConfig
-
Signature:
public static <T> T fromJson(final Reader json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a Reader to an object of the specified type.
-
Contract:
- <p> This method is useful when you need to control the character encoding or when working with character-based input sources.
-
Parameters:
-
json(Reader) — the reader containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(Reader, Class, DeserializationConfig), #fromJson(Reader, TypeReference)
-
Signature:
public static <T> T fromJson(final Reader json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a Reader using custom deserialization configuration.
-
Contract:
- Use this when reading JSON from character sources that require special handling.
-
Parameters:
-
json(Reader) — the reader containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(Reader, Class), DeserializationConfig
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromJson(final URL json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a URL to an object of the specified type.
-
Parameters:
-
json(URL) — the URL pointing to JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(URL, Class, DeserializationConfig), #fromJson(URL, TypeReference)
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromJson(final URL json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a URL using custom deserialization configuration.
-
Contract:
- <p> Use this method when fetching JSON from URLs that require special handling, such as APIs that may include unknown properties or use non-standard formats.
-
Parameters:
-
json(URL) — the URL pointing to JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(URL, Class), DeserializationConfig
-
Signature:
public static <T> T fromJson(final DataInput json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a DataInput to an object of the specified type.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(DataInput, Class, DeserializationConfig), #fromJson(DataInput, TypeReference), DataInput
-
Signature:
public static <T> T fromJson(final DataInput json, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a DataInput using custom deserialization configuration.
-
Contract:
- <p> Use this method when reading JSON from binary formats that require special deserialization handling.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON content -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: #fromJson(DataInput, Class), DeserializationConfig, DataInput
-
Signature:
public static <T> T fromJson(final byte[] json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a byte array to an object using TypeReference for generic types.
-
Parameters:
-
json(byte[]) — the JSON content as a UTF-8 encoded byte array -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, #fromJson(byte\[\], Class)
-
Signature:
public static <T> T fromJson(final byte[] json, final int offset, final int len, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a portion of a byte array using TypeReference for generic types.
-
Contract:
- <p> Use this method when working with generic types in byte buffers where the JSON data is embedded within a larger array.
-
Parameters:
-
json(byte[]) — the byte array containing JSON content -
offset(int) — the offset in the array where JSON data starts -
len(int) — the number of bytes to read from the offset -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, #fromJson(byte\[\], int, int, Class)
-
Signature:
public static <T> T fromJson(final String json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a string to an object using TypeReference for generic types.
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, #fromJson(String, Class), #fromJson(String, TypeReference, DeserializationFeature, DeserializationFeature...)
-
Signature:
public static <T> T fromJson(final String json, final TypeReference<? extends T> targetType, final DeserializationFeature first, final DeserializationFeature... features) - Summary: Deserializes JSON from a string using TypeReference with custom deserialization features.
-
Contract:
- <p> Use this method when deserializing generic types that require special handling, such as collections that should accept single values as arrays.
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information -
first(DeserializationFeature) — the first deserialization feature to apply (required) -
features(DeserializationFeature[]) — additional deserialization features to apply (optional)
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, DeserializationFeature, #fromJson(String, TypeReference, DeserializationConfig)
-
Signature:
public static <T> T fromJson(final String json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a string using TypeReference with custom configuration.
-
Contract:
- <p> Use this method when you need complex configuration for generic types, such as custom deserializers for collection elements or special date handling in maps.
-
Parameters:
-
json(String) — the JSON content as a string -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, DeserializationConfig, #createDeserializationConfig()
-
Signature:
public static <T> T fromJson(final File json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a file using TypeReference for generic types.
-
Parameters:
-
json(File) — the file containing JSON content -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, #fromJson(File, Class), #fromJson(File, TypeReference, DeserializationConfig)
-
Signature:
public static <T> T fromJson(final File json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a file using TypeReference with custom configuration.
-
Contract:
- <p> Use this method when reading generic types from files that require special deserialization handling, such as legacy data formats.
-
Parameters:
-
json(File) — the file containing JSON content -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information -
config(DeserializationConfig) — the custom deserialization configuration; if {@code null} , uses default
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, DeserializationConfig, #fromJson(File, TypeReference)
-
Signature:
public static <T> T fromJson(final InputStream json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from an input stream using TypeReference for generic types.
-
Parameters:
-
json(InputStream) — the input stream containing JSON content -
targetType(TypeReference<? extends T>) — TypeReference capturing the generic type information
-
- Returns: the deserialized object; {@code null} if JSON contains "null"
- See also: TypeReference, #fromJson(InputStream, Class), #fromJson(InputStream, TypeReference, DeserializationConfig)
-
Signature:
public static <T> T fromJson(final InputStream json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from an InputStream into a Java object of the specified generic type with custom deserialization configuration.
-
Parameters:
-
json(InputStream) — the InputStream containing JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map types -
config(DeserializationConfig) — custom deserialization configuration, if {@code null} uses default configuration
-
- Returns: the deserialized object of type T
- See also: TypeReference, DeserializationConfig
-
Signature:
public static <T> T fromJson(final Reader json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a Reader into a Java object of the specified generic type using default configuration.
-
Parameters:
-
json(Reader) — the Reader containing JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map types
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public static <T> T fromJson(final Reader json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a Reader into a Java object of the specified generic type with custom deserialization configuration.
-
Parameters:
-
json(Reader) — the Reader containing JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map types -
config(DeserializationConfig) — custom deserialization configuration, if {@code null} uses default configuration
-
- Returns: the deserialized object of type T
- See also: TypeReference, DeserializationConfig
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromJson(final URL json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a URL into a Java object of the specified generic type using default configuration.
-
Parameters:
-
json(URL) — the URL pointing to JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromJson(final URL json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a URL into a Java object of the specified generic type with custom deserialization configuration.
-
Contract:
- This method provides control over the deserialization process when fetching JSON from URLs.
-
Parameters:
-
json(URL) — the URL pointing to JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type -
config(DeserializationConfig) — custom deserialization configuration, if {@code null} uses default configuration
-
- Returns: the deserialized object of type T
- See also: TypeReference, DeserializationConfig
-
Signature:
public static <T> T fromJson(final DataInput json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a DataInput into a Java object of the specified generic type using default configuration.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference, DataInput
-
Signature:
public static <T> T fromJson(final DataInput json, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes JSON from a DataInput into a Java object of the specified generic type with custom deserialization configuration.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON data to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type -
config(DeserializationConfig) — custom deserialization configuration, if {@code null} uses default configuration
-
- Returns: the deserialized object of type T
- See also: TypeReference, DeserializationConfig, DataInput
createSerializationConfig(...) -> SerializationConfig
-
Signature:
public static SerializationConfig createSerializationConfig() - Summary: Creates a new SerializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new SerializationConfig instance with default settings
- See also: SerializationConfig, SerializationFeature
createDeserializationConfig(...) -> DeserializationConfig
-
Signature:
public static DeserializationConfig createDeserializationConfig() - Summary: Creates a new DeserializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new DeserializationConfig instance with default settings
- See also: DeserializationConfig, DeserializationFeature
wrap(...) -> One
-
Signature:
public static One wrap(final ObjectMapper jsonMapper) - Summary: Wraps a Jackson ObjectMapper instance to provide convenient JSON operations through the One wrapper class.
-
Parameters:
-
jsonMapper(ObjectMapper) — the ObjectMapper instance to wrap
-
- Returns: a One instance wrapping the provided ObjectMapper
- See also: One, ObjectMapper
Public Instance Methods
- (none)
Class One (com.landawn.abacus.util.JsonMappers.One)
A wrapper class that provides convenient JSON serialization and deserialization methods using a specific ObjectMapper instance.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
toJson(...) -> String
-
Signature:
public String toJson(final Object obj) - Summary: Serializes a Java object to its JSON string representation using the wrapped ObjectMapper.
-
Parameters:
-
obj(Object) — the object to serialize to JSON
-
- Returns: JSON string representation of the object
-
Signature:
public String toJson(final Object obj, final boolean prettyFormat) - Summary: Serializes a Java object to its JSON string representation with optional pretty formatting.
-
Contract:
- When pretty format is enabled, the output includes indentation and line breaks for readability.
-
Parameters:
-
obj(Object) — the object to serialize to JSON -
prettyFormat(boolean) — if {@code true} , formats the JSON with indentation and line breaks
-
- Returns: JSON string representation of the object, optionally formatted
-
Signature:
public void toJson(final Object obj, final File output) - Summary: Serializes a Java object to JSON and writes it to the specified file.
-
Contract:
- The file is created if it doesn't exist, or overwritten if it does.
-
Parameters:
-
obj(Object) — the object to serialize to JSON -
output(File) — the file to write the JSON to
-
-
Signature:
public void toJson(final Object obj, final OutputStream output) - Summary: Serializes a Java object to JSON and writes it to the specified OutputStream.
-
Parameters:
-
obj(Object) — the object to serialize to JSON -
output(OutputStream) — the OutputStream to write the JSON to
-
-
Signature:
public void toJson(final Object obj, final Writer output) - Summary: Serializes a Java object to JSON and writes it to the specified Writer.
-
Parameters:
-
obj(Object) — the object to serialize to JSON -
output(Writer) — the Writer to write the JSON to
-
-
Signature:
public void toJson(final Object obj, final DataOutput output) - Summary: Serializes a Java object to JSON and writes it to the specified DataOutput.
-
Parameters:
-
obj(Object) — the object to serialize to JSON -
output(DataOutput) — the DataOutput to write the JSON to
-
- See also: DataOutput
fromJson(...) -> T
-
Signature:
public <T> T fromJson(final byte[] json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a byte array into a Java object of the specified type.
-
Parameters:
-
json(byte[]) — byte array containing JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final byte[] json, final int offset, final int len, final Class<? extends T> targetType) - Summary: Deserializes JSON from a portion of a byte array into a Java object of the specified type.
-
Parameters:
-
json(byte[]) — byte array containing JSON data -
offset(int) — the starting position in the array -
len(int) — the number of bytes to read -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final String json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a String into a Java object of the specified type.
-
Parameters:
-
json(String) — JSON string to deserialize -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final File json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a File into a Java object of the specified type.
-
Parameters:
-
json(File) — the file containing JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final InputStream json, final Class<? extends T> targetType) - Summary: Deserializes JSON from an InputStream into a Java object of the specified type.
-
Parameters:
-
json(InputStream) — the InputStream containing JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final Reader json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a Reader into a Java object of the specified type.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
@SuppressWarnings("deprecation") public <T> T fromJson(final URL json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a URL into a Java object of the specified type.
-
Parameters:
-
json(URL) — the URL pointing to JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
-
Signature:
public <T> T fromJson(final DataInput json, final Class<? extends T> targetType) - Summary: Deserializes JSON from a DataInput into a Java object of the specified type.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON data -
targetType(Class<? extends T>) — the class of the target object
-
- Returns: the deserialized object of type T
- See also: DataInput
-
Signature:
public <T> T fromJson(final byte[] json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a byte array into a Java object of the specified generic type.
-
Parameters:
-
json(byte[]) — byte array containing JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final byte[] json, final int offset, final int len, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a portion of a byte array into a Java object of the specified generic type.
-
Parameters:
-
json(byte[]) — byte array containing JSON data -
offset(int) — the starting position in the array -
len(int) — the number of bytes to read -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final String json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a String into a Java object of the specified generic type.
-
Parameters:
-
json(String) — JSON string to deserialize -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final File json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a File into a Java object of the specified generic type.
-
Parameters:
-
json(File) — the file containing JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final InputStream json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from an InputStream into a Java object of the specified generic type.
-
Parameters:
-
json(InputStream) — the InputStream containing JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final Reader json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a Reader into a Java object of the specified generic type.
-
Parameters:
-
json(Reader) — the Reader containing JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type, can be Bean/Array/Collection/Map
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
@SuppressWarnings("deprecation") public <T> T fromJson(final URL json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a URL into a Java object of the specified generic type.
-
Parameters:
-
json(URL) — the URL pointing to JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference
-
Signature:
public <T> T fromJson(final DataInput json, final TypeReference<? extends T> targetType) - Summary: Deserializes JSON from a DataInput into a Java object of the specified generic type.
-
Parameters:
-
json(DataInput) — the DataInput containing JSON data -
targetType(TypeReference<? extends T>) — TypeReference describing the target type
-
- Returns: the deserialized object of type T
- See also: TypeReference, DataInput
Class JsonUtil (com.landawn.abacus.util.JsonUtil)
A comprehensive utility class providing high-performance, thread-safe methods for bidirectional conversion between Java objects and JSON representations using the org.json library.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> JSONObject
-
Signature:
public static JSONObject wrap(final Map<String, ?> map) - Summary: Converts a Map into a JSONObject.
-
Contract:
- The Map's keys must be Strings, and values can be any type supported by JSONObject including primitives, Strings, Collections, Maps, and other JSONObject/JSONArray instances.
-
Parameters:
-
map(Map<String, ?>) — the Map to convert to JSONObject. Keys must be Strings.
-
- Returns: a new JSONObject containing all key-value pairs from the input Map
-
Signature:
@SuppressWarnings("unchecked") public static JSONObject wrap(final Object bean) - Summary: Converts a Java object (Bean or Map) into a JSONObject.
-
Parameters:
-
bean(Object) — the object to convert. Can be a Map or any JavaBean with accessible properties
-
- Returns: a new JSONObject representing the input object
-
Signature:
public static JSONArray wrap(final boolean[] array) throws JSONException - Summary: Converts a boolean array into a JSONArray.
-
Parameters:
-
array(boolean[]) — the boolean array to convert
-
- Returns: a new JSONArray containing all elements from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final char[] array) throws JSONException - Summary: Converts a character array into a JSONArray.
-
Parameters:
-
array(char[]) — the character array to convert
-
- Returns: a new JSONArray containing all characters from the input array as strings
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final byte[] array) throws JSONException - Summary: Converts a byte array into a JSONArray.
-
Parameters:
-
array(byte[]) — the byte array to convert
-
- Returns: a new JSONArray containing all bytes from the input array as numbers
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final short[] array) throws JSONException - Summary: Converts a short array into a JSONArray.
-
Parameters:
-
array(short[]) — the short array to convert
-
- Returns: a new JSONArray containing all shorts from the input array as numbers
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final int[] array) throws JSONException - Summary: Converts an integer array into a JSONArray.
-
Parameters:
-
array(int[]) — the integer array to convert
-
- Returns: a new JSONArray containing all integers from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final long[] array) throws JSONException - Summary: Converts a long array into a JSONArray.
-
Contract:
- Note that very large long values may lose precision when converted to JSON due to JavaScript's number limitations.
-
Parameters:
-
array(long[]) — the long array to convert
-
- Returns: a new JSONArray containing all longs from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final float[] array) throws JSONException - Summary: Converts a float array into a JSONArray.
-
Parameters:
-
array(float[]) — the float array to convert
-
- Returns: a new JSONArray containing all floats from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion or if array contains NaN or Infinity
-
-
Signature:
public static JSONArray wrap(final double[] array) throws JSONException - Summary: Converts a double array into a JSONArray.
-
Parameters:
-
array(double[]) — the double array to convert
-
- Returns: a new JSONArray containing all doubles from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion or if array contains NaN or Infinity
-
-
Signature:
public static JSONArray wrap(final Object[] array) throws JSONException - Summary: Converts an Object array into a JSONArray.
-
Parameters:
-
array(Object[]) — the Object array to convert
-
- Returns: a new JSONArray containing all elements from the input array
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static JSONArray wrap(final Collection<?> coll) - Summary: Converts a Collection into a JSONArray.
-
Parameters:
-
coll(Collection<?>) — the Collection to convert
-
- Returns: a new JSONArray containing all elements from the Collection
unwrap(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> unwrap(final JSONObject jsonObject) throws JSONException - Summary: Converts a JSONObject to a Map < String, Object > .
-
Parameters:
-
jsonObject(JSONObject) — the JSONObject to convert
-
- Returns: a Map containing all key-value pairs from the JSONObject
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static <T> T unwrap(final JSONObject jsonObject, final Class<? extends T> targetType) throws JSONException - Summary: Converts a JSONObject to an instance of the specified class type.
-
Parameters:
-
jsonObject(JSONObject) — the JSONObject to convert -
targetType(Class<? extends T>) — the class of the object to create
-
- Returns: an instance of targetType populated with data from the JSONObject
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
@SuppressWarnings("unchecked") public static <T> T unwrap(final JSONObject jsonObject, Type<? extends T> targetType) throws JSONException - Summary: Converts a JSONObject to an instance of the specified Type.
-
Parameters:
-
jsonObject(JSONObject) — the JSONObject to convert -
targetType(Type<? extends T>) — the Type information for the target object
-
- Returns: an instance of the specified type populated with data from the JSONObject
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
@SuppressWarnings("unchecked") public static <T> List<T> unwrap(final JSONArray jsonArray) throws JSONException - Summary: Converts a JSONArray to a List < T > with inferred element type.
-
Parameters:
-
jsonArray(JSONArray) — the JSONArray to convert
-
- Returns: a List containing all elements from the JSONArray
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static <T> T unwrap(final JSONArray jsonArray, final Class<? extends T> targetType) throws JSONException - Summary: Converts a JSONArray to an instance of the specified class type.
-
Parameters:
-
jsonArray(JSONArray) — the JSONArray to convert -
targetType(Class<? extends T>) — the class of the object to create
-
- Returns: an instance of targetType populated with data from the JSONArray
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
@SuppressWarnings("unchecked") public static <T> T unwrap(final JSONArray jsonArray, Type<? extends T> targetType) throws JSONException - Summary: Converts a JSONArray to an instance of the specified Type.
-
Parameters:
-
jsonArray(JSONArray) — the JSONArray to convert -
targetType(Type<? extends T>) — the Type information for the target object
-
- Returns: an instance of the specified type populated with data from the JSONArray
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
toList(...) -> List<T>
-
Signature:
public static <T> List<T> toList(final JSONArray jsonArray, final Class<? extends T> elementClass) throws JSONException - Summary: Converts a JSONArray to a typed List with specified element class.
-
Parameters:
-
jsonArray(JSONArray) — the JSONArray to convert -
elementClass(Class<? extends T>) — the class of elements in the list
-
- Returns: a List containing elements of the specified type
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
-
Signature:
public static <T> List<T> toList(final JSONArray jsonArray, final Type<T> elementType) throws JSONException - Summary: Converts a JSONArray to a typed List with specified element Type.
-
Parameters:
-
jsonArray(JSONArray) — the JSONArray to convert -
elementType(Type<T>) — the Type of elements in the list
-
- Returns: a List containing elements of the specified type
-
Throws:
-
org.json.JSONException— if there is an error during the conversion
-
Public Instance Methods
- (none)
Class KahanSummation (com.landawn.abacus.util.KahanSummation)
Implementation of Kahan summation algorithm for improved numerical precision.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> KahanSummation
-
Signature:
public static KahanSummation of(final double... a) - Summary: Creates a static KahanSummation instance initialized with the provided values.
-
Parameters:
-
a(double[]) — the array of double values to sum
-
- Returns: a new KahanSummation instance containing the sum of the provided values
Public Instance Methods
<init>(...) -> void
-
Signature:
public KahanSummation() - Summary: Constructs a new KahanSummation with initial values of zero.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final double value) - Summary: Adds a single value to the summation using the Kahan algorithm.
-
Parameters:
-
value(double) — the value to add to the summation
-
addAll(...) -> void
-
Signature:
public void addAll(final double[] values) - Summary: Adds all values from the provided array to the summation.
-
Parameters:
-
values(double[]) — the array of values to add to the summation
-
combine(...) -> void
-
Signature:
public void combine(final long countA, final double sumA) - Summary: Combines this summation with values from simple summation (count and sum).
-
Contract:
- <p> This method is useful when combining pre-computed sums.
-
Parameters:
-
countA(long) — the count of values to combine -
sumA(double) — the sum of values to combine
-
-
Signature:
public void combine(final KahanSummation other) - Summary: Combines this summation with another KahanSummation instance.
-
Parameters:
-
other(KahanSummation) — the other KahanSummation to combine with this one
-
count(...) -> long
-
Signature:
public long count() - Summary: Returns the count of values added to this summation.
-
Parameters:
- (none)
- Returns: the number of values that have been added
sum(...) -> double
-
Signature:
public double sum() - Summary: Returns the compensated sum of all added values.
-
Contract:
- <p> If the result is NaN and the simple sum is infinite, returns the simple sum instead.
-
Parameters:
- (none)
- Returns: the sum with Kahan error compensation applied
average(...) -> OptionalDouble
-
Signature:
public OptionalDouble average() - Summary: Calculates and returns the average of all added values.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average, or empty if no values have been added
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this KahanSummation.
-
Parameters:
- (none)
- Returns: a string representation containing count, sum, and average
Class Keyed (com.landawn.abacus.util.Keyed)
An immutable container that pairs a key with a value, where equality and hashing are based solely on the key.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Keyed<K, T>
-
Signature:
public static <K, T> Keyed<K, T> of(final K key, final T val) - Summary: Creates a new {@code Keyed} instance with the specified key and value.
-
Parameters:
-
key(K) — the key used for hashing and equality comparisons (can be {@code null} ). -
val(T) — the value associated with the key (can be {@code null} ).
-
- Returns: a new {@code Keyed} instance containing the specified key-value pair.
Public Instance Methods
key(...) -> K
-
Signature:
@MayReturnNull public K key() - Summary: Returns the key of this key-value pair.
-
Parameters:
- (none)
- Returns: the key (can be {@code null} ).
val(...) -> T
-
Signature:
@MayReturnNull public T val() - Summary: Returns the value of this key-value pair.
-
Parameters:
- (none)
- Returns: the value (can be {@code null} ).
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this object.
-
Contract:
- This ensures consistent hashing behavior even if the value is mutable.
-
Parameters:
- (none)
- Returns: the hash code of the key, or 0 if the key is {@code null} .
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this one.
-
Contract:
- Two {@code Keyed} objects are considered equal if they have the same key, regardless of their values.
- <p> The equality check follows these rules: </p> <ul> <li> Returns {@code true} if {@code obj} is the same instance as this object </li> <li> Returns {@code false} if {@code obj} is {@code null} </li> <li> Returns {@code false} if {@code obj} is not of the exact same class (subclasses are not considered equal) </li> <li> Otherwise, compares keys using {@link N#equals(Object, Object)} , which handles {@code null} keys properly </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Keyed<String, Integer> k1 = Keyed.of("key", 100); Keyed<String, Integer> k2 = Keyed.of("key", 200); Keyed<String, Integer> k3 = Keyed.of("other", 100); k1.equals(k2); // true - same key, different values k1.equals(k3); // false - different keys } </pre>
-
Parameters:
-
obj(Object) — the reference object with which to compare.
-
- Returns: {@code true} if this object has the same key as the obj argument; {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code Keyed} .
-
Parameters:
- (none)
- Returns: a string representation of this object in the format "{key= < key > , val= < value > }".
Class LZ4BlockInputStream (com.landawn.abacus.util.LZ4BlockInputStream)
An input stream that decompresses data in the LZ4 block format.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public LZ4BlockInputStream(final InputStream is) - Summary: Creates a new LZ4BlockInputStream that will decompress data from the specified input stream.
-
Parameters:
-
is(InputStream) — the input stream to read compressed data from
-
read(...) -> int
-
Signature:
@Override public int read() throws IOException - Summary: Reads the next byte of decompressed data from the input stream.
-
Contract:
- If no byte is available because the end of the stream has been reached, the value -1 is returned.
-
Parameters:
- (none)
- Returns: the next byte of data, or -1 if the end of the stream is reached
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public int read(final byte[] b) throws IOException - Summary: Reads up to b.length bytes of decompressed data from the input stream into an array of bytes.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public int read(final byte[] b, final int off, final int len) throws IOException - Summary: Reads up to len bytes of decompressed data from the input stream into an array of bytes, starting at the specified offset.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read -
off(int) — the start offset in the buffer at which the data is written -
len(int) — the maximum number of bytes to read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
skip(...) -> long
-
Signature:
@Override public long skip(final long n) throws IllegalArgumentException, IOException - Summary: Skips over and discards n bytes of decompressed data from this input stream.
-
Contract:
- The skip method may skip fewer bytes than requested if the end of stream is reached.
-
Parameters:
-
n(long) — the number of bytes to skip
-
- Returns: the actual number of bytes skipped
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.io.IOException— if an I/O error occurs
-
available(...) -> int
-
Signature:
@Override public int available() throws IOException - Summary: Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
-
Parameters:
- (none)
- Returns: an estimate of the number of bytes that can be read without blocking
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
mark(...) -> void
-
Signature:
@Override public synchronized void mark(final int readLimit) - Summary: Marks the current position in this input stream.
-
Parameters:
-
readLimit(int) — the maximum limit of bytes that can be read before the mark position becomes invalid
-
reset(...) -> void
-
Signature:
@Override public synchronized void reset() throws IOException - Summary: Repositions this stream to the position at the time the mark method was last called on this input stream.
-
Contract:
- <p> If the mark method has not been called since the stream was created, or if the number of bytes read from the stream since mark was last called is larger than the argument to mark, then an IOException might be thrown.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if the stream has not been marked or if the mark has been invalidated
-
markSupported(...) -> boolean
-
Signature:
@Override public boolean markSupported() - Summary: Tests if this input stream supports the mark and reset methods.
-
Contract:
- Tests if this input stream supports the mark and reset methods.
-
Parameters:
- (none)
- Returns: {@code true} if this stream instance supports the mark and reset methods; {@code false} otherwise
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes this input stream and releases any system resources associated with the stream.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class LZ4BlockOutputStream (com.landawn.abacus.util.LZ4BlockOutputStream)
An output stream that compresses data using the LZ4 block format.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public LZ4BlockOutputStream(final OutputStream os) - Summary: Creates a new LZ4BlockOutputStream that will compress data and write it to the specified output stream using the default block size.
-
Parameters:
-
os(OutputStream) — the output stream to write compressed data to
-
-
Signature:
public LZ4BlockOutputStream(final OutputStream os, final int blockSize) - Summary: Creates a new LZ4BlockOutputStream with a custom block size.
-
Contract:
- The block size must be a power of 2 and is typically between 64KB and 4MB.
-
Parameters:
-
os(OutputStream) — the output stream to write compressed data to -
blockSize(int) — the size of blocks to use for compression
-
write(...) -> void
-
Signature:
@Override public void write(final int b) throws IOException - Summary: Writes the specified byte to this output stream.
-
Contract:
- The byte is buffered internally and will be compressed when enough data has been accumulated or when the stream is flushed/finished.
-
Parameters:
-
b(int) — the byte to write (the 8 low-order bits are written)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public void write(final byte[] b) throws IOException - Summary: Writes all bytes from the specified byte array to this output stream.
-
Parameters:
-
b(byte[]) — the byte array to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public void write(final byte[] b, final int off, final int len) throws IOException - Summary: Writes len bytes from the specified byte array starting at offset off to this output stream.
-
Parameters:
-
b(byte[]) — the byte array containing the data to write -
off(int) — the start offset in the data -
len(int) — the number of bytes to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
flush(...) -> void
-
Signature:
@Override public void flush() throws IOException - Summary: Flushes this output stream and forces any buffered output bytes to be written out.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
finish(...) -> void
-
Signature:
public void finish() throws IOException - Summary: Finishes writing compressed data to the output stream without closing the underlying stream.
-
Contract:
- This method must be called before closing the stream to ensure all buffered data is properly compressed and written.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes this output stream and releases any system resources associated with it.
-
Contract:
- This method automatically calls {@link #finish()} if it hasn't been called already, then closes the underlying output stream.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class LineIterator (com.landawn.abacus.util.LineIterator)
An Iterator over the lines in a {@code Reader} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> LineIterator
-
Signature:
public static LineIterator of(final File file) - Summary: Returns an Iterator for the lines in a {@code File} using the default encoding for the VM.
-
Contract:
- When you have finished with the iterator, you should close it to free internal resources.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (LineIterator it = LineIterator.of(new File("data.txt"))) { while (it.hasNext()) { String line = it.next(); // do something with line } } } </pre> <p> If an exception occurs during the creation of the iterator, the underlying stream is automatically closed.
-
Parameters:
-
file(File) — the file to open for input, must not be {@code null}
-
- Returns: an Iterator of the lines in the file, never {@code null}
- See also: #of(File, Charset)
-
Signature:
public static LineIterator of(final File file, final Charset encoding) - Summary: Returns an Iterator for the lines in a {@code File} using the specified character encoding.
-
Contract:
- When you have finished with the iterator, you should close it to free internal resources.
- <p> <b> Usage Examples: </b> </p> <pre> {@code try (LineIterator it = LineIterator.of(new File("data.txt"), StandardCharsets.UTF_8)) { it.forEachRemaining(line -> processLine(line)); } } </pre> <p> If an exception occurs during the creation of the iterator, the underlying stream is automatically closed to prevent resource leaks.
-
Parameters:
-
file(File) — the file to open for input; must not be {@code null} -
encoding(Charset) — the character encoding to use; if {@code null} , the platform default encoding is used
-
- Returns: an Iterator of the lines in the file, never {@code null}
- See also: #of(File)
-
Signature:
public static LineIterator of(final InputStream input) - Summary: Returns an Iterator for the lines in an {@code InputStream} , using the platform's default character encoding.
-
Contract:
- When you have finished with the iterator, you should close it to free internal resources.
-
Parameters:
-
input(InputStream) — the {@code InputStream} to read from, must not be null
-
- Returns: an Iterator of the lines in the input stream, never null
- See also: #of(InputStream, Charset)
-
Signature:
public static LineIterator of(final InputStream input, final Charset encoding) throws UncheckedIOException - Summary: Returns an Iterator for the lines in an {@code InputStream} , using the specified character encoding.
-
Contract:
- When you have finished with the iterator, you should close it to free internal resources.
-
Parameters:
-
input(InputStream) — the {@code InputStream} to read from; must not be {@code null} -
encoding(Charset) — the character encoding to use; if {@code null} , the platform default encoding is used
-
- Returns: an Iterator of the lines in the input stream, never {@code null}
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while reading from the input stream
-
- See also: #of(InputStream)
-
Signature:
public static LineIterator of(final Reader reader) - Summary: Returns an Iterator for the lines in a {@code Reader} .
-
Contract:
- When you have finished with the iterator, you should close it to free internal resources.
-
Parameters:
-
reader(Reader) — the {@code Reader} to read from, must not be null
-
- Returns: an Iterator of the lines in the reader, never null
- See also: #LineIterator(Reader)
Public Instance Methods
<init>(...) -> void
-
Signature:
public LineIterator(final Reader reader) throws IllegalArgumentException - Summary: Constructs an iterator of the lines for a {@code Reader} .
-
Contract:
- <p> The reader will be wrapped in a {@link BufferedReader} if it's not already one.
-
Parameters:
-
reader(Reader) — the {@code Reader} to read from, must not be null
-
-
Throws:
-
java.lang.IllegalArgumentException— if the reader is null
-
hasNext(...) -> boolean
-
Signature:
@Override public boolean hasNext() - Summary: Indicates whether the {@code Reader} has more lines available to read.
-
Contract:
- <p> This method checks if there are more lines in the underlying reader by attempting to read the next line and caching it.
- If an {@code IOException} occurs during this operation, {@link #close()} will be automatically called on this instance to release resources, and the exception will be wrapped in an {@link UncheckedIOException} .
-
Parameters:
- (none)
- Returns: {@code true} if the reader has more lines, {@code false} if end of stream is reached
next(...) -> String
-
Signature:
@Override public String next() - Summary: Returns the next line in the wrapped {@code Reader} .
-
Contract:
- It returns the line that was previously cached by {@link #hasNext()} , or attempts to read a new line if {@code hasNext()} hasn't been called.
- <p> You must call {@link #hasNext()} before calling this method to check if a line is available, or ensure you handle the {@link NoSuchElementException} that will be thrown if no more lines are available.
-
Parameters:
- (none)
- Returns: the next line from the input, never {@code null} (empty lines are returned as empty strings)
close(...) -> void
-
Signature:
@Override public synchronized void close() - Summary: Closes the underlying {@code Reader} and releases all associated resources.
-
Contract:
- <p> This method is useful if you only want to process the first few lines of a larger file and want to release resources early.
- If you do not close the iterator explicitly, the {@code Reader} remains open, potentially causing resource leaks.
-
Parameters:
- (none)
Class ListMultimap (com.landawn.abacus.util.ListMultimap)
A specialized {@link Multimap} implementation that uses {@link List} collections to store multiple values for each key, preserving insertion order and allowing duplicate values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ListMultimap<K, E>
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1) - Summary: Creates a new instance of ListMultimap with one key-value pair.
-
Parameters:
-
k1(K) — the key of the key-value pair -
v1(E) — the value of the key-value pair
-
- Returns: a new instance of ListMultimap with the specified key-value pair
- See also: #of(Object, Object, Object, Object), #of(Object, Object, Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2) - Summary: Creates a new instance of ListMultimap with two key-value pairs.
-
Contract:
- If both keys are the same, both values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object), #of(Object, Object, Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3) - Summary: Creates a new instance of ListMultimap with three key-value pairs.
-
Contract:
- If multiple keys are the same, all corresponding values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object), #of(Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4) - Summary: Creates a new instance of ListMultimap with four key-value pairs.
-
Contract:
- If multiple keys are the same, all corresponding values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object, Object, Object, Object, Object), #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5) - Summary: Creates a new instance of ListMultimap with five key-value pairs.
-
Contract:
- If multiple keys are the same, all corresponding values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object, Object, Object, Object, Object, Object, Object), #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5, final K k6, final E v6) - Summary: Creates a new instance of ListMultimap with six key-value pairs.
-
Contract:
- If multiple keys are the same, all corresponding values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs -
k6(K) — the sixth key of the key-value pairs -
v6(E) — the sixth value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> ListMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5, final K k6, final E v6, final K k7, final E v7) - Summary: Creates a new instance of ListMultimap with seven key-value pairs.
-
Contract:
- If multiple keys are the same, all corresponding values will be added to the list associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs -
k6(K) — the sixth key of the key-value pairs -
v6(E) — the sixth value of the key-value pairs -
k7(K) — the seventh key of the key-value pairs -
v7(E) — the seventh value of the key-value pairs
-
- Returns: a new instance of ListMultimap with the specified key-value pairs
- See also: #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), #fromMap(Map)
fromMap(...) -> ListMultimap<K, E>
-
Signature:
public static <K, E> ListMultimap<K, E> fromMap(final Map<? extends K, ? extends E> map) - Summary: Creates a new instance of ListMultimap with the key-value pairs from the specified map.
-
Contract:
- The returned ListMultimap uses the same backing map implementation as the source map (e.g., if the source is a LinkedHashMap, the returned ListMultimap will maintain insertion order).
-
Parameters:
-
map(Map<? extends K, ? extends E>) — The map containing the key-value pairs to be added to the new ListMultimap, may be {@code null} or empty
-
- Returns: a new instance of ListMultimap with the key-value pairs from the specified map (or an empty multimap if the map is {@code null} or empty)
- See also: #of(Object, Object), #fromCollection(Collection, Function)
fromCollection(...) -> ListMultimap<K, T>
-
Signature:
public static <T, K> ListMultimap<K, T> fromCollection(final Collection<? extends T> c, final Function<? super T, ? extends K> keyExtractor) throws IllegalArgumentException - Summary: Creates a new instance of ListMultimap from a given collection and a key mapper function.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be added to the ListMultimap, may be {@code null} or empty -
keyExtractor(Function<? super T, ? extends K>) — the function to generate keys for the ListMultimap
-
- Returns: a new instance of ListMultimap with keys and values from the specified collection
-
Throws:
-
java.lang.IllegalArgumentException— if the keyExtractor is null
-
- See also: #fromCollection(Collection, Function, Function), #fromMap(Map)
-
Signature:
public static <T, K, E> ListMultimap<K, E> fromCollection(final Collection<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends E> valueExtractor) throws IllegalArgumentException - Summary: Creates a new instance of ListMultimap from a given collection, a key mapper function, and a value extractor function.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be added to the ListMultimap, may be {@code null} or empty -
keyExtractor(Function<? super T, ? extends K>) — the function to generate keys for the ListMultimap -
valueExtractor(Function<? super T, ? extends E>) — the function to extract values for the ListMultimap
-
- Returns: a new instance of ListMultimap with keys and values from the specified collection
-
Throws:
-
java.lang.IllegalArgumentException— if the keyExtractor is {@code null} or if the valueExtractor is null
-
- See also: #fromCollection(Collection, Function), #fromMap(Map)
merge(...) -> ListMultimap<K, E>
-
Signature:
public static <K, E> ListMultimap<K, E> merge(final Map<? extends K, ? extends E> a, final Map<? extends K, ? extends E> b) - Summary: Creates a new instance of ListMultimap by merging the key-value pairs from two specified maps.
-
Contract:
- If the same key appears in both maps, both values will be added to the list associated with that key in the order they appear (first from map a, then from map b).
-
Parameters:
-
a(Map<? extends K, ? extends E>) — the first map containing the key-value pairs to be added to the new ListMultimap, may be {@code null} -
b(Map<? extends K, ? extends E>) — the second map containing the key-value pairs to be added to the new ListMultimap, may be {@code null}
-
- Returns: a new instance of ListMultimap with the key-value pairs from the specified maps, or an empty ListMultimap if both maps are {@code null}
- See also: #merge(Map, Map, Map), #merge(Collection)
-
Signature:
public static <K, E> ListMultimap<K, E> merge(final Map<? extends K, ? extends E> a, final Map<? extends K, ? extends E> b, final Map<? extends K, ? extends E> c) - Summary: Creates a new instance of ListMultimap by merging the key-value pairs from three specified maps.
-
Contract:
- If the same key appears in multiple maps, all corresponding values will be added to the list associated with that key in the order they appear (first from map a, then b, then c).
-
Parameters:
-
a(Map<? extends K, ? extends E>) — the first map containing the key-value pairs to be added to the new ListMultimap, may be {@code null} -
b(Map<? extends K, ? extends E>) — the second map containing the key-value pairs to be added to the new ListMultimap, may be {@code null} -
c(Map<? extends K, ? extends E>) — the third map containing the key-value pairs to be added to the new ListMultimap, may be {@code null}
-
- Returns: a new instance of ListMultimap with the key-value pairs from the specified maps, or an empty ListMultimap if all maps are {@code null}
- See also: #merge(Map, Map), #merge(Collection)
-
Signature:
public static <K, E> ListMultimap<K, E> merge(final Collection<? extends Map<? extends K, ? extends E>> c) - Summary: Creates a new instance of ListMultimap by merging the key-value pairs from a collection of maps.
-
Contract:
- If the same key appears in multiple maps, all corresponding values will be added to the list associated with that key in the order they are encountered.
-
Parameters:
-
c(Collection<? extends Map<? extends K, ? extends E>>) — the collection of maps containing the key-value pairs to be added to the new ListMultimap
-
- Returns: a new instance of ListMultimap with the key-value pairs from the specified collection of maps, or an empty ListMultimap if the collection is {@code null} or empty
- See also: #merge(Map, Map), #merge(Map, Map, Map)
wrap(...) -> ListMultimap<K, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta public static <K, E, V extends List<E>> ListMultimap<K, E> wrap(final Map<K, V> map) throws IllegalArgumentException - Summary: Wraps the provided map into a ListMultimap.
-
Contract:
- The map must contain {@code non-null} , non-empty list values.
- The value type is automatically detected from the first list in the map, or defaults to ArrayList if the map is empty.
-
Parameters:
-
map(Map<K, V>) — The map to be wrapped into a ListMultimap, must not be {@code null}
-
- Returns: a new instance of ListMultimap backed by the provided map
-
Throws:
-
java.lang.IllegalArgumentException— if the provided map is {@code null} or contains {@code null} or empty list values
-
- See also: #wrap(Map, Supplier)
-
Signature:
@Beta public static <K, E, V extends List<E>> ListMultimap<K, E> wrap(final Map<K, V> map, final Supplier<? extends V> valueSupplier) throws IllegalArgumentException - Summary: Wraps the provided map into a ListMultimap with a custom list supplier.
-
Contract:
- The value supplier is used to create new list instances when adding entries to new keys.
-
Parameters:
-
map(Map<K, V>) — The map to be wrapped into a ListMultimap, must not be {@code null} -
valueSupplier(Supplier<? extends V>) — The supplier that provides the list to be used as the value collection, must not be {@code null}
-
- Returns: a new instance of ListMultimap backed by the provided map
-
Throws:
-
java.lang.IllegalArgumentException— if the provided map or valueSupplier is {@code null}
-
- See also: #wrap(Map)
Public Instance Methods
invert(...) -> ListMultimap<E, K>
-
Signature:
public ListMultimap<E, K> invert() - Summary: Inverts the ListMultimap, swapping keys with values.
-
Contract:
- If multiple keys in the original multimap share the same value, that value will be associated with multiple keys in the inverted multimap.
-
Parameters:
- (none)
- Returns: a new instance of ListMultimap where the original keys are now values and the original values are now keys
- See also: #copy(), #toImmutableMap()
copy(...) -> ListMultimap<K, E>
-
Signature:
@Override public ListMultimap<K, E> copy() - Summary: Returns a new ListMultimap and copies all key-value pairs from this ListMultimap to the new one.
-
Parameters:
- (none)
- Returns: a new ListMultimap containing all the key-value pairs of this ListMultimap
- See also: #invert(), #toImmutableMap()
toImmutableMap(...) -> ImmutableMap<K, ImmutableList<E>>
-
Signature:
public ImmutableMap<K, ImmutableList<E>> toImmutableMap() - Summary: Converts the current ListMultimap into an ImmutableMap.
-
Parameters:
- (none)
- Returns: an ImmutableMap where each key is associated with an ImmutableList of values from the original ListMultimap
- See also: #toImmutableMap(IntFunction), #copy()
-
Signature:
public ImmutableMap<K, ImmutableList<E>> toImmutableMap(final IntFunction<? extends Map<K, ImmutableList<E>>> mapSupplier) - Summary: Converts the current ListMultimap into an ImmutableMap using a provided map supplier.
-
Parameters:
-
mapSupplier(IntFunction<? extends Map<K, ImmutableList<E>>>) — The supplier function that provides a Map instance. The function takes an integer argument which is the initial size of the map
-
- Returns: an ImmutableMap where each key is associated with an ImmutableList of values from the original ListMultimap
- See also: #toImmutableMap()
Enum LockMode (com.landawn.abacus.util.LockMode)
Represents different lock modes for database operations, where each mode controls what operations are permitted or restricted.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> LockMode
-
Signature:
public static LockMode valueOf(final int intValue) - Summary: Returns the LockMode corresponding to the specified integer value.
-
Contract:
- The value should be a valid combination of the lock mode bits (R=1, A=2, U=4, D=8).
-
Parameters:
-
intValue(int) — the integer value to convert to a LockMode
-
- Returns: the corresponding LockMode
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value of this lock mode.
-
Parameters:
- (none)
- Returns: the integer value of this lock mode
isXLockOf(...) -> boolean
-
Signature:
public boolean isXLockOf(final LockMode lockMode) - Summary: Checks if this LockMode is locked by (is a subset of) the specified LockMode.
-
Contract:
- Checks if this LockMode is locked by (is a subset of) the specified LockMode.
- This method uses bitwise AND operation to determine if all lock types in this mode are also present in the specified mode.
-
Parameters:
-
lockMode(LockMode) — the LockMode to check against
-
- Returns: {@code true} if this LockMode's operations are locked by the specified lockMode, {@code false} otherwise
Class LongIterator (com.landawn.abacus.util.LongIterator)
A specialized iterator for primitive long values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> LongIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static LongIterator empty() - Summary: Returns an empty {@code LongIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code LongIterator}
of(...) -> LongIterator
-
Signature:
public static LongIterator of(final long... a) - Summary: Creates a {@code LongIterator} from the specified long array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(long[]) — the long array (may be {@code null} )
-
- Returns: a new {@code LongIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static LongIterator of(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code LongIterator} from a subsequence of the specified long array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(long[]) — the long array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code LongIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex is negative, toIndex is greater than the array length, or fromIndex is greater than toIndex
-
defer(...) -> LongIterator
-
Signature:
public static LongIterator defer(final Supplier<? extends LongIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Creates a LongIterator that is initialized lazily using the provided Supplier.
-
Parameters:
-
iteratorSupplier(Supplier<? extends LongIterator>) — a Supplier that provides the LongIterator when needed
-
- Returns: a LongIterator that delegates to the iterator provided by the supplier
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> LongIterator
-
Signature:
public static LongIterator generate(final LongSupplier supplier) throws IllegalArgumentException - Summary: Creates an infinite LongIterator that generates values using the provided LongSupplier.
-
Parameters:
-
supplier(LongSupplier) — the LongSupplier used to generate values
-
- Returns: an infinite LongIterator that generates values using the supplier
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
-
Signature:
public static LongIterator generate(final BooleanSupplier hasNext, final LongSupplier supplier) throws IllegalArgumentException - Summary: Creates a LongIterator that generates values using the provided LongSupplier while the BooleanSupplier returns {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that determines if more elements are available -
supplier(LongSupplier) — the LongSupplier used to generate values
-
- Returns: a LongIterator that generates values while hasNext returns true
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
next(...) -> Long
-
Signature:
@Deprecated @Override public Long next() - Summary: Returns the next element as a boxed Long.
-
Contract:
- This method is provided for compatibility with the Iterator interface but should be avoided in favor of nextLong() for better performance.
-
Parameters:
- (none)
- Returns: the next long value as a boxed Long
nextLong(...) -> long
-
Signature:
public abstract long nextLong() - Summary: Returns the next long value in the iteration.
-
Parameters:
- (none)
- Returns: the next long value
skip(...) -> LongIterator
-
Signature:
public LongIterator skip(final long n) throws IllegalArgumentException - Summary: Returns a new LongIterator that skips the first n elements.
-
Contract:
- If n is greater than the number of remaining elements, all elements are skipped.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new LongIterator that skips the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> LongIterator
-
Signature:
public LongIterator limit(final long count) throws IllegalArgumentException - Summary: Returns a new LongIterator that will iterate over at most count elements.
-
Contract:
- If count is 0, an empty iterator is returned.
- If count is greater than the number of remaining elements, all remaining elements are included.
-
Parameters:
-
count(long) — the maximum number of elements to iterate over
-
- Returns: a new LongIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> LongIterator
-
Signature:
public LongIterator filter(final LongPredicate predicate) throws IllegalArgumentException - Summary: Returns a new LongIterator that only includes elements matching the given predicate.
-
Parameters:
-
predicate(LongPredicate) — the predicate used to test elements
-
- Returns: a new LongIterator containing only elements that match the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalLong
-
Signature:
public OptionalLong first() - Summary: Returns an OptionalLong containing the first element, or an empty OptionalLong if this iterator is empty.
-
Contract:
- Returns an OptionalLong containing the first element, or an empty OptionalLong if this iterator is empty.
- This method consumes the first element if present.
-
Parameters:
- (none)
- Returns: an OptionalLong containing the first element, or empty if no elements exist
last(...) -> OptionalLong
-
Signature:
public OptionalLong last() - Summary: Returns an OptionalLong containing the last element, or an empty OptionalLong if this iterator is empty.
-
Contract:
- Returns an OptionalLong containing the last element, or an empty OptionalLong if this iterator is empty.
-
Parameters:
- (none)
- Returns: an OptionalLong containing the last element, or empty if no elements exist
toArray(...) -> long\[\]
-
Signature:
@SuppressWarnings("deprecation") public long[] toArray() - Summary: Converts the remaining elements to a long array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a long array containing all remaining elements
toList(...) -> LongList
-
Signature:
public LongList toList() - Summary: Converts the remaining elements to a LongList.
-
Contract:
- If the iterator is already empty, returns an empty LongList.
-
Parameters:
- (none)
- Returns: a LongList containing all remaining elements
stream(...) -> LongStream
-
Signature:
public LongStream stream() - Summary: Converts this iterator to a LongStream.
-
Parameters:
- (none)
- Returns: a LongStream backed by this iterator
indexed(...) -> ObjIterator<IndexedLong>
-
Signature:
@Beta public ObjIterator<IndexedLong> indexed() - Summary: Returns an iterator of IndexedLong objects, where each element is paired with its index starting from 0.
-
Contract:
- This is useful when you need both the value and its position.
-
Parameters:
- (none)
- Returns: an ObjIterator of IndexedLong objects
-
Signature:
@Beta public ObjIterator<IndexedLong> indexed(final long startIndex) - Summary: Returns an iterator of IndexedLong objects, where each element is paired with its index starting from the specified startIndex.
-
Contract:
- This is useful when you need both the value and its position with a custom starting index.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an ObjIterator of IndexedLong objects with indices starting from startIndex
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Long> action) - Summary: Performs the given action for each remaining element.
-
Contract:
- This method is provided for compatibility with the Iterator interface but should be avoided in favor of foreachRemaining(LongConsumer) for better performance.
-
Parameters:
-
action(java.util.function.Consumer<? super Long>) — the action to be performed for each element
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.LongConsumer<E> action) throws E - Summary: Performs the given action for each remaining element.
-
Contract:
- The action is performed in the order of iteration, if that order is specified.
-
Parameters:
-
action(Throwables.LongConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntLongConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element, providing both the element's index and value.
-
Parameters:
-
action(Throwables.IntLongConsumer<E>) — the action to be performed for each element, accepting index and value
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class LongList (com.landawn.abacus.util.LongList)
A high-performance, resizable array implementation for primitive long values that provides specialized operations optimized for 64-bit integer data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> LongList
-
Signature:
public static LongList of(final long... a) - Summary: Creates a new LongList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(long[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new LongList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static LongList of(final long[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new LongList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(long[]) — the array of long values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new LongList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> LongList
-
Signature:
public static LongList copyOf(final long[] a) - Summary: Creates a new LongList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(long[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new LongList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static LongList copyOf(final long[] a, final int fromIndex, final int toIndex) - Summary: Creates a new LongList that is a copy of the specified range within the given array.
-
Parameters:
-
a(long[]) — the array from which a range is to be copied. Must not be {@code null} . -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new LongList containing a copy of the elements in the specified range
range(...) -> LongList
-
Signature:
public static LongList range(final long startInclusive, final long endExclusive) - Summary: Creates a LongList containing a sequence of long values in the specified range.
-
Contract:
- If startInclusive equals endExclusive, an empty list is returned.
- If startInclusive is greater than endExclusive, the sequence decrements by 1.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive)
-
- Returns: a new LongList containing the sequence of values
-
Signature:
public static LongList range(final long startInclusive, final long endExclusive, final long by) - Summary: Creates a LongList containing a sequence of long values in the specified range with the given step.
-
Contract:
- <p> The sequence starts at startInclusive and increments by the step value until the value would exceed endExclusive (or fall below it if step is negative).
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive) -
by(long) — the step value for incrementing. Must not be zero.
-
- Returns: a new LongList containing the sequence of values
rangeClosed(...) -> LongList
-
Signature:
public static LongList rangeClosed(final long startInclusive, final long endInclusive) - Summary: Creates a LongList containing a sequence of long values in the specified closed range.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive)
-
- Returns: a new LongList containing the sequence of values
-
Signature:
public static LongList rangeClosed(final long startInclusive, final long endInclusive, final long by) - Summary: Creates a LongList containing a sequence of long values in the specified closed range with the given step.
-
Contract:
- <p> The sequence starts at startInclusive and increments by the step value until the value would exceed endInclusive (or fall below it if step is negative).
- The end value is included if it's exactly reachable by the step increments.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive) -
by(long) — the step value for incrementing. Must not be zero.
-
- Returns: a new LongList containing the sequence of values
repeat(...) -> LongList
-
Signature:
public static LongList repeat(final long element, final int len) - Summary: Creates a LongList containing the specified element repeated the given number of times.
-
Parameters:
-
element(long) — the long value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new LongList containing the repeated elements
random(...) -> LongList
-
Signature:
public static LongList random(final int len) - Summary: Creates a LongList filled with random long values.
-
Parameters:
-
len(int) — the number of random elements to generate. Must be non-negative.
-
- Returns: a new LongList containing random long values
Public Instance Methods
<init>(...) -> void
-
Signature:
public LongList() - Summary: Constructs an empty LongList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public LongList(final int initialCapacity) - Summary: Constructs an empty LongList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public LongList(final long[] a) - Summary: Constructs a LongList containing the elements of the specified array.
-
Parameters:
-
a(long[]) — the array whose elements are to be placed into this list. Must not be {@code null} .
-
- Performance: The list will use the provided array as its internal storage without copying, making this operation O(1) in time complexity.
-
Signature:
public LongList(final long[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a LongList using the specified array as the internal storage with the specified size.
-
Contract:
- The size parameter must not exceed the array length.
-
Parameters:
-
a(long[]) — the array to be used as the internal storage for this list. Must not be {@code null} . -
size(int) — the number of elements in the list, must be between 0 and a.length (inclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> long\[\]
-
Signature:
@Beta @Deprecated @Override public long[] array() - Summary: Returns the underlying long array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal long array backing this list
get(...) -> long
-
Signature:
public long get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> long
-
Signature:
public long set(final int index, final long e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(long) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final long e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- <p> The list will automatically grow if necessary to accommodate the new element.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(long) — the long value to be appended to this list
-
-
Signature:
public void add(final int index, final long e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- <p> The list will automatically grow if necessary to accommodate the new element.
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(long) — the long value to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final LongList c) - Summary: Appends all elements from the specified LongList to the end of this list.
-
Parameters:
-
c(LongList) — the LongList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} if the specified list is empty)
-
Signature:
@Override public boolean addAll(final int index, final LongList c) - Summary: Inserts all elements from the specified LongList into this list at the specified position.
-
Contract:
- <p> Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(LongList) — the LongList containing elements to be inserted into this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} if the specified list is empty)
-
Signature:
@Override public boolean addAll(final long[] a) - Summary: Appends all elements from the specified array to the end of this list.
-
Parameters:
-
a(long[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} if the specified array is {@code null} or empty)
-
Signature:
@Override public boolean addAll(final int index, final long[] a) - Summary: Inserts all elements from the specified array into this list at the specified position.
-
Contract:
- <p> Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(long[]) — the array containing elements to be inserted into this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} if the specified array is {@code null} or empty)
remove(...) -> boolean
-
Signature:
public boolean remove(final long e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- <p> If this list contains multiple occurrences of the specified element, only the first occurrence is removed.
-
Parameters:
-
e(long) — the element to be removed from this list
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final long e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(long) — the element to be removed from this list
-
- Returns: {@code true} if this list was modified (at least one element was removed)
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final LongList c) - Summary: Removes from this list all of its elements that are contained in the specified LongList.
-
Contract:
- For each element in the specified list, it removes one matching occurrence from this list (if present).
- If the specified list contains duplicates, multiple occurrences may be removed from this list.
-
Parameters:
-
c(LongList) — the LongList containing elements to be removed from this list
-
- Returns: {@code true} if this list was modified as a result of the call
-
Signature:
@Override public boolean removeAll(final long[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Contract:
- For each element in the specified array, it removes one matching occurrence from this list (if present).
- If the specified array contains duplicates, multiple occurrences may be removed from this list.
-
Parameters:
-
a(long[]) — the array containing elements to be removed from this list
-
- Returns: {@code true} if this list was modified as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final LongPredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(LongPredicate) — the predicate which returns {@code true} for elements to be removed
-
- Returns: {@code true} if any elements were removed from this list
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes all duplicate elements from this list, keeping only the first occurrence of each value.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed from this list
- Performance: Otherwise, it uses a LinkedHashSet internally to track seen elements, resulting in O(n) time complexity with O(n) space.
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final LongList c) - Summary: Retains only the elements in this list that are contained in the specified LongList.
-
Parameters:
-
c(LongList) — the LongList containing elements to be retained in this list
-
- Returns: {@code true} if this list was modified as a result of the call
-
Signature:
@Override public boolean retainAll(final long[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(long[]) — the array containing elements to be retained in this list
-
- Returns: {@code true} if this list was modified as a result of the call
delete(...) -> long
-
Signature:
public long delete(final int index) - Summary: Removes the element at the specified position in this list and returns it.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes all elements at the specified indices from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes all elements in the specified range from this list.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive) -
toIndex(int) — the index after the last element to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final LongList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified LongList.
-
Contract:
- The size of this list may change if the replacement contains a different number of elements than the replaced range.
-
Parameters:
-
fromIndex(int) — the index of the first element to replace (inclusive) -
toIndex(int) — the index after the last element to replace (exclusive) -
replacement(LongList) — the LongList whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final long[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified array.
-
Contract:
- The size of this list may change if the replacement contains a different number of elements than the replaced range.
-
Parameters:
-
fromIndex(int) — the index of the first element to replace (inclusive) -
toIndex(int) — the index after the last element to replace (exclusive) -
replacement(long[]) — the array whose elements will replace the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final long oldVal, final long newVal) - Summary: Replaces all occurrences of the specified value with a new value in this list.
-
Parameters:
-
oldVal(long) — the value to be replaced -
newVal(long) — the value to replace oldVal with
-
- Returns: the number of elements that were replaced
-
Signature:
public void replaceAll(final LongUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the given operator to that element.
-
Parameters:
-
operator(LongUnaryOperator) — the operator to apply to each element
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final LongPredicate predicate, final long newValue) - Summary: Replaces all elements in this list that satisfy the given predicate with the specified value.
-
Parameters:
-
predicate(LongPredicate) — the predicate to test each element -
newValue(long) — the value to replace matching elements with
-
- Returns: {@code true} if any elements were replaced
fill(...) -> void
-
Signature:
public void fill(final long val) - Summary: Fills the entire list with the specified value.
-
Parameters:
-
val(long) — the value to fill the list with
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final long val) throws IndexOutOfBoundsException - Summary: Fills the specified range of this list with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element to fill (inclusive) -
toIndex(int) — the index after the last element to fill (exclusive) -
val(long) — the value to fill the range with
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} or {@code toIndex} is out of range ( {@code fromIndex < 0 || toIndex > size() || fromIndex > toIndex} )
-
contains(...) -> boolean
-
Signature:
public boolean contains(final long valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(long) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final LongList c) - Summary: Tests if this list contains any of the elements in the specified LongList.
-
Contract:
- Tests if this list contains any of the elements in the specified LongList.
- <p> Returns {@code true} if this list contains at least one element that is also present in the specified list.
-
Parameters:
-
c(LongList) — the LongList to check for common elements
-
- Returns: {@code true} if this list contains any element from the specified list
-
Signature:
@Override public boolean containsAny(final long[] a) - Summary: Tests if this list contains any of the elements in the specified array.
-
Contract:
- Tests if this list contains any of the elements in the specified array.
- <p> Returns {@code true} if this list contains at least one element that is also present in the specified array.
-
Parameters:
-
a(long[]) — the array to check for common elements
-
- Returns: {@code true} if this list contains any element from the specified array
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final LongList c) - Summary: Tests if this list contains all elements in the specified LongList.
-
Contract:
- Tests if this list contains all elements in the specified LongList.
- <p> Returns {@code true} only if every distinct element in the specified list is also present in this list.
-
Parameters:
-
c(LongList) — the LongList to check for containment
-
- Returns: {@code true} if this list contains all distinct elements from the specified list
-
Signature:
@Override public boolean containsAll(final long[] a) - Summary: Tests if this list contains all elements in the specified array.
-
Contract:
- Tests if this list contains all elements in the specified array.
- <p> Returns {@code true} only if every distinct element in the specified array is also present in this list.
-
Parameters:
-
a(long[]) — the array to check for containment
-
- Returns: {@code true} if this list contains all distinct elements from the specified array
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final LongList c) - Summary: Tests if this list and the specified LongList have no elements in common.
-
Contract:
- Tests if this list and the specified LongList have no elements in common.
- <p> Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(LongList) — the LongList to check for common elements
-
- Returns: {@code true} if this list and the specified list have no elements in common
-
Signature:
@Override public boolean disjoint(final long[] b) - Summary: Tests if this list and the specified array have no elements in common.
-
Contract:
- Tests if this list and the specified array have no elements in common.
- <p> This list and the array are disjoint if they share no common elements.
-
Parameters:
-
b(long[]) — the array to check for common elements
-
- Returns: {@code true} if this list and the specified array have no elements in common
intersection(...) -> LongList
-
Signature:
@Override public LongList intersection(final LongList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(LongList) — the list to find common elements with this list
-
- Returns: a new LongList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list. Returns an empty list if either list is {@code null} or empty.
- See also: #intersection(long\[\]), #difference(LongList), #symmetricDifference(LongList), N#intersection(long\[\], long\[\]), N#intersection(int\[\], int\[\])
-
Signature:
@Override public LongList intersection(final long[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(long[]) — the array to find common elements with this list
-
- Returns: a new LongList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source. Returns an empty list if the array is {@code null} or empty.
- See also: #intersection(LongList), #difference(long\[\]), #symmetricDifference(long\[\]), N#intersection(long\[\], long\[\]), N#intersection(int\[\], int\[\])
difference(...) -> LongList
-
Signature:
@Override public LongList difference(final LongList b) - Summary: Returns a new list with the elements in this list but not in the specified list {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(LongList) — the list to compare against this list
-
- Returns: a new LongList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: #difference(long\[\]), #symmetricDifference(LongList), #intersection(LongList), N#difference(long\[\], long\[\]), N#difference(int\[\], int\[\])
-
Signature:
@Override public LongList difference(final long[] b) - Summary: Returns a new list with the elements in this list but not in the specified array {@code b} , considering the number of occurrences of each element.
-
Parameters:
-
b(long[]) — the array to compare against this list
-
- Returns: a new LongList containing the elements that are present in this list but not in the specified array, considering the number of occurrences. Returns a copy of this list if {@code b} is {@code null} or empty.
- See also: #difference(LongList), #symmetricDifference(long\[\]), #intersection(long\[\]), N#difference(long\[\], long\[\]), N#difference(int\[\], int\[\])
symmetricDifference(...) -> LongList
-
Signature:
@Override public LongList symmetricDifference(final LongList b) - Summary: Returns a new LongList containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
b(LongList) — the list to compare with this list for symmetric difference
-
- Returns: a new LongList containing elements that are present in either this list or the specified list, but not in both, considering the number of occurrences
- See also: #symmetricDifference(long\[\]), #difference(LongList), #intersection(LongList), N#symmetricDifference(long\[\], long\[\]), N#symmetricDifference(Collection, Collection)
-
Signature:
@Override public LongList symmetricDifference(final long[] b) - Summary: Returns a new LongList containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
b(long[]) — the array to compare with this list for symmetric difference
-
- Returns: a new LongList containing elements that are present in either this list or the specified array, but not in both, considering the number of occurrences
- See also: #symmetricDifference(LongList), #difference(long\[\]), #intersection(long\[\]), N#symmetricDifference(long\[\], long\[\]), N#symmetricDifference(Collection, Collection)
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final long valueToFind) - Summary: Counts the number of occurrences of the specified value in this list.
-
Parameters:
-
valueToFind(long) — the value to count occurrences of
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final long valueToFind) - Summary: Returns the index of the first occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the value.
-
Contract:
- Returns the index of the first occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the value.
-
Parameters:
-
valueToFind(long) — the long value to search for
-
- Returns: the index of the first occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found
-
Signature:
public int indexOf(final long valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified value in this list, starting the search at the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found.
-
Contract:
- Returns the index of the first occurrence of the specified value in this list, starting the search at the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found.
- If {@code fromIndex} is negative, the search starts from index 0.
- If {@code fromIndex} is greater than or equal to the list size, {@code N.INDEX_NOT_FOUND} is returned.
-
Parameters:
-
valueToFind(long) — the long value to search for -
fromIndex(int) — the index to start the search from (inclusive)
-
- Returns: the index of the first occurrence of the specified value in this list starting from {@code fromIndex} , or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final long valueToFind) - Summary: Returns the index of the last occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the value.
-
Contract:
- Returns the index of the last occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if this list does not contain the value.
-
Parameters:
-
valueToFind(long) — the long value to search for
-
- Returns: the index of the last occurrence of the specified value in this list, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found
-
Signature:
public int lastIndexOf(final long valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified value in this list, searching backwards from the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found.
-
Contract:
- Returns the index of the last occurrence of the specified value in this list, searching backwards from the specified index, or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found.
- If {@code startIndexFromBack} is greater than or equal to the list size, the search starts from the last element.
- If {@code startIndexFromBack} is negative or the list is empty, {@code N.INDEX_NOT_FOUND} is returned.
-
Parameters:
-
valueToFind(long) — the long value to search for -
startIndexFromBack(int) — the index to start the backwards search from (inclusive)
-
- Returns: the index of the last occurrence of the specified value, searching backwards from {@code startIndexFromBack} , or {@code N.INDEX_NOT_FOUND} (-1) if the value is not found
min(...) -> OptionalLong
-
Signature:
public OptionalLong min() - Summary: Returns an {@code OptionalLong} containing the minimum element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the minimum element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the minimum element of this list, or an empty {@code OptionalLong} if this list is empty
-
Signature:
public OptionalLong min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an {@code OptionalLong} containing the minimum element in the specified range of this list, or an empty {@code OptionalLong} if the range is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the minimum element in the specified range of this list, or an empty {@code OptionalLong} if the range is empty.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: an {@code OptionalLong} containing the minimum element in the specified range, or an empty {@code OptionalLong} if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
max(...) -> OptionalLong
-
Signature:
public OptionalLong max() - Summary: Returns an {@code OptionalLong} containing the maximum element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the maximum element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the maximum element of this list, or an empty {@code OptionalLong} if this list is empty
-
Signature:
public OptionalLong max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an {@code OptionalLong} containing the maximum element in the specified range of this list, or an empty {@code OptionalLong} if the range is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the maximum element in the specified range of this list, or an empty {@code OptionalLong} if the range is empty.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: an {@code OptionalLong} containing the maximum element in the specified range, or an empty {@code OptionalLong} if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
median(...) -> OptionalLong
-
Signature:
public OptionalLong median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalLong containing the median value if the list is non-empty, or an empty OptionalLong if the list is empty
-
Signature:
public OptionalLong median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalLong containing the median value if the range is non-empty, or an empty OptionalLong if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final LongConsumer action) - Summary: Performs the given action for each element of this list.
-
Parameters:
-
action(LongConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final LongConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element in the specified range of this list.
-
Contract:
- If {@code fromIndex} is less than {@code toIndex} , the action is performed on elements in ascending order.
- If {@code fromIndex} is greater than {@code toIndex} , the action is performed on elements in descending order.
- If {@code fromIndex} equals {@code toIndex} , no action is performed.
- </p> <p> Special case: if {@code toIndex} is -1 and {@code fromIndex} is greater than -1, the iteration starts from {@code fromIndex} and goes backwards to index 0.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for reverse iteration to index 0 -
action(LongConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
first(...) -> OptionalLong
-
Signature:
public OptionalLong first() - Summary: Returns an {@code OptionalLong} containing the first element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the first element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the first element of this list, or an empty {@code OptionalLong} if this list is empty
last(...) -> OptionalLong
-
Signature:
public OptionalLong last() - Summary: Returns an {@code OptionalLong} containing the last element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Contract:
- Returns an {@code OptionalLong} containing the last element of this list, or an empty {@code OptionalLong} if this list is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the last element of this list, or an empty {@code OptionalLong} if this list is empty
distinct(...) -> LongList
-
Signature:
@Override public LongList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new {@code LongList} containing only the distinct elements from the specified range of this list, in the order they first appear.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: a new {@code LongList} containing only the distinct elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Returns {@code true} if this list contains duplicate elements.
-
Contract:
- Returns {@code true} if this list contains duplicate elements.
- <p> This method checks if any element appears more than once in the list.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains at least one duplicate element, {@code false} otherwise
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Returns {@code true} if the elements in this list are sorted in ascending order.
-
Contract:
- Returns {@code true} if the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if this list is sorted in ascending order, {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts the elements of this list in ascending order.
-
Parameters:
- (none)
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts the elements of this list in ascending order using a parallel sort algorithm.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts the elements of this list in descending order.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final long valueToFind) - Summary: Searches for the specified value using the binary search algorithm.
-
Contract:
- <p> The list must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
- If the list contains multiple elements equal to the specified value, there is no guarantee which one will be found.
-
Parameters:
-
valueToFind(long) — the value to search for
-
- Returns: the index of the search key if it is contained in the list; otherwise, {@code (-insertion point - 1)} . The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or {@code size()} if all elements in the list are less than the specified key
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final long valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified value in the specified range using the binary search algorithm.
-
Contract:
- <p> The range must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
- If the range contains multiple elements equal to the specified value, there is no guarantee which one will be found.
-
Parameters:
-
fromIndex(int) — the starting index of the range to search (inclusive) -
toIndex(int) — the ending index of the range to search (exclusive) -
valueToFind(long) — the value to search for
-
- Returns: the index of the search key if it is contained in the specified range; otherwise, {@code (-insertion point - 1)} . The insertion point is defined as the point at which the key would be inserted into the range: the index of the first element in the range greater than the key, or {@code toIndex} if all elements in the range are less than the specified key
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index of the range to reverse (inclusive) -
toIndex(int) — the ending index of the range to reverse (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles the elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles the elements in this list using the specified source of randomness.
-
Parameters:
-
rnd(Random) — the source of randomness to use for shuffling
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> LongList
-
Signature:
@Override public LongList copy() - Summary: Returns a copy of this list.
-
Parameters:
- (none)
- Returns: a new {@code LongList} containing a copy of all elements from this list
-
Signature:
@Override public LongList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a copy of the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index of the range to copy (inclusive) -
toIndex(int) — the ending index of the range to copy (exclusive)
-
- Returns: a new {@code LongList} containing a copy of the elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
-
Signature:
@Override public LongList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Returns a copy of the specified range of this list with the specified step.
-
Contract:
- </p> <p> If {@code fromIndex} is greater than {@code toIndex} , elements are copied in reverse order.
- The step value must be positive.
-
Parameters:
-
fromIndex(int) — the starting index of the range to copy (inclusive) -
toIndex(int) — the ending index of the range to copy (exclusive) -
step(int) — the step size for selecting elements (must be positive)
-
- Returns: a new {@code LongList} containing elements from the specified range at the specified intervals
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<LongList>
-
Signature:
@Override public List<LongList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Returns a list of {@code LongList} instances, each containing a consecutive subsequence of elements from the specified range of this list.
-
Contract:
- The last subsequence may have fewer elements if the range size is not evenly divisible by {@code chunkSize} .
-
Parameters:
-
fromIndex(int) — the starting index of the range to split (inclusive) -
toIndex(int) — the ending index of the range to split (exclusive) -
chunkSize(int) — the desired size of each subsequence (must be positive)
-
- Returns: a list of {@code LongList} instances, each containing a subsequence of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
trimToSize(...) -> LongList
-
Signature:
@Override public LongList trimToSize() - Summary: Trims the capacity of this list to its current size.
-
Contract:
- <p> If the capacity of this list is larger than its current size, this method reduces the capacity to match the size, minimizing memory usage.
-
Parameters:
- (none)
- Returns: this list instance (for method chaining)
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Long>
-
Signature:
@Override public List<Long> boxed() - Summary: Returns a {@code List<Long>} containing all elements of this list.
-
Parameters:
- (none)
- Returns: a new {@code List<Long>} containing all elements from this list as boxed values
-
Signature:
@Override public List<Long> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code List<Long>} containing the elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: a new {@code List<Long>} containing the elements in the specified range as boxed values
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
toArray(...) -> long\[\]
-
Signature:
@Override public long[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new long array containing all elements of this list
toFloatList(...) -> FloatList
-
Signature:
public FloatList toFloatList() - Summary: Returns a new {@code FloatList} containing all elements of this list converted to float values.
-
Parameters:
- (none)
- Returns: a new {@code FloatList} containing all elements from this list as float values
toDoubleList(...) -> DoubleList
-
Signature:
public DoubleList toDoubleList() - Summary: Returns a new {@code DoubleList} containing all elements of this list converted to double values.
-
Parameters:
- (none)
- Returns: a new {@code DoubleList} containing all elements from this list as double values
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Long>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive) -
supplier(IntFunction<? extends C>) — a function which produces a new collection of the desired type, given the size of the range
-
- Returns: a collection containing the elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
toMultiset(...) -> Multiset<Long>
-
Signature:
@Override public Multiset<Long> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Long>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive) -
supplier(IntFunction<Multiset<Long>>) — a function which produces a new {@code Multiset} instance, given the size of the range
-
- Returns: a {@code Multiset} containing the elements in the specified range with their counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
iterator(...) -> LongIterator
-
Signature:
@Override public LongIterator iterator() - Summary: Returns an iterator over the elements in this list in proper sequence.
-
Contract:
- <p> The returned iterator is fail-fast: if the list is structurally modified at any time after the iterator is created, the iterator may throw a {@code ConcurrentModificationException} .
- This behavior is not guaranteed and should not be relied upon for correctness.
-
Parameters:
- (none)
- Returns: a {@code LongIterator} over the elements in this list
stream(...) -> LongStream
-
Signature:
public LongStream stream() - Summary: Returns a {@code LongStream} with this list as its source.
-
Parameters:
- (none)
- Returns: a sequential {@code LongStream} over the elements in this list
-
Signature:
public LongStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a {@code LongStream} with the specified range of this list as its source.
-
Parameters:
-
fromIndex(int) — the starting index of the range (inclusive) -
toIndex(int) — the ending index of the range (exclusive)
-
- Returns: a sequential {@code LongStream} over the elements in the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size} or {@code fromIndex > toIndex}
-
getFirst(...) -> long
-
Signature:
public long getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first long value in this list
getLast(...) -> long
-
Signature:
public long getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last long value in this list
addFirst(...) -> void
-
Signature:
public void addFirst(final long e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(long) — the element to add at the beginning of this list
-
- Performance: This operation has O(n) time complexity where n is the size of the list.
addLast(...) -> void
-
Signature:
public void addLast(final long e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(long) — the element to add at the end of this list
-
- Performance: <p> This operation has O(1) amortized time complexity.
removeFirst(...) -> long
-
Signature:
public long removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first element that was removed from this list
- Performance: This operation has O(n) time complexity where n is the size of the list.
removeLast(...) -> long
-
Signature:
public long removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last element that was removed from this list
- Performance: <p> This operation has O(1) time complexity.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this list with the specified object for equality.
-
Contract:
- <p> Returns {@code true} if and only if the specified object is also a {@code LongList} , both lists have the same size, and all corresponding pairs of elements in the two lists are equal.
- Two long values are considered equal if they have the same value (using ==).
-
Parameters:
-
obj(Object) — the object to be compared for equality with this list
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Contract:
- If the list is empty, returns "\[\]".
-
Parameters:
- (none)
- Returns: a string representation of this list
Class MapEntity (com.landawn.abacus.util.MapEntity)
A map-based entity implementation that stores property values in a HashMap.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
builder(...) -> MapEntityBuilder
-
Signature:
public static MapEntityBuilder builder(final String entityName) - Summary: Creates a builder for constructing MapEntity instances.
-
Parameters:
-
entityName(String) — the name of the entity
-
- Returns: a new MapEntityBuilder instance
Public Instance Methods
<init>(...) -> void
-
Signature:
public MapEntity(final String entityName) - Summary: Constructs a new MapEntity with the specified entity name.
-
Parameters:
-
entityName(String) — the name of the entity
-
-
Signature:
public MapEntity(final String entityName, final Map<String, Object> props) - Summary: Constructs a new MapEntity with the specified entity name and initial properties.
-
Parameters:
-
entityName(String) — the name of the entity -
props(Map<String, Object>) — the initial properties to set
-
entityName(...) -> String
-
Signature:
public String entityName() - Summary: Returns the entity name.
-
Parameters:
- (none)
- Returns: the entity name
get(...) -> T
-
Signature:
@MayReturnNull @SuppressWarnings("unchecked") public <T> T get(final String propName) - Summary: Gets the value of the specified property.
-
Parameters:
-
propName(String) — the property name (can be simple or canonical)
-
- Returns: the property value, or {@code null} if not found
-
Signature:
public <T> T get(final String propName, final Class<? extends T> targetType) - Summary: Gets the value of the specified property and converts it to the target type.
-
Contract:
- If the property value is {@code null} , returns the default value for the target type.
-
Parameters:
-
propName(String) — the property name (can be simple or canonical) -
targetType(Class<? extends T>) — the class of the target type to convert to
-
- Returns: the property value converted to the target type, or the default value if null
set(...) -> MapEntity
-
Signature:
public MapEntity set(String propName, final Object propValue) - Summary: Sets the value of the specified property.
-
Parameters:
-
propName(String) — the property name (can be simple or canonical) -
propValue(Object) — the property value to set
-
- Returns: this MapEntity instance for method chaining
-
Signature:
public void set(final Map<String, Object> nameValues) - Summary: Sets multiple properties from the provided map.
-
Parameters:
-
nameValues(Map<String, Object>) — a map of property names to values
-
remove(...) -> Object
-
Signature:
@SuppressWarnings("UnusedReturnValue") @MayReturnNull public Object remove(String propName) - Summary: Removes the specified property from this entity.
-
Parameters:
-
propName(String) — the property name to remove (can be simple or canonical)
-
- Returns: the previous value associated with the property, or {@code null} if there was no mapping
removeAll(...) -> void
-
Signature:
public void removeAll(final Collection<String> propNames) - Summary: Removes all specified properties from this entity.
-
Parameters:
-
propNames(Collection<String>) — a collection of property names to remove
-
containsKey(...) -> boolean
-
Signature:
public boolean containsKey(final String propName) - Summary: Checks if this entity contains a property with the specified name.
-
Contract:
- Checks if this entity contains a property with the specified name.
-
Parameters:
-
propName(String) — the property name to check (can be simple or canonical)
-
- Returns: {@code true} if this entity contains the specified property, {@code false} otherwise
keySet(...) -> Set<String>
-
Signature:
public Set<String> keySet() - Summary: Returns a set of all property names that have been set in this entity.
-
Parameters:
- (none)
- Returns: a set of property names
- See also: com.landawn.abacus.util.MapEntity#keySet()
entrySet(...) -> Set<Map.Entry<String, Object>>
-
Signature:
public Set<Map.Entry<String, Object>> entrySet() - Summary: Returns a set view of all property entries in this entity.
-
Parameters:
- (none)
- Returns: a set view of the property entries
props(...) -> Map<String, Object>
-
Signature:
public Map<String, Object> props() - Summary: Returns the underlying map containing all properties.
-
Parameters:
- (none)
- Returns: the internal map of properties
size(...) -> int
-
Signature:
public int size() - Summary: Returns the number of properties in this entity.
-
Parameters:
- (none)
- Returns: the number of properties
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Checks if this entity has no properties.
-
Contract:
- Checks if this entity has no properties.
-
Parameters:
- (none)
- Returns: {@code true} if this entity has no properties, {@code false} otherwise
copy(...) -> MapEntity
-
Signature:
public MapEntity copy() - Summary: Creates a copy of this MapEntity with the same entity name and properties.
-
Parameters:
- (none)
- Returns: a new MapEntity instance with the same entity name and properties
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this MapEntity.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this MapEntity to the specified object for equality.
-
Contract:
- Two MapEntity objects are equal if they have the same entity name and contain the same properties with equal values.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if this object is equal to the specified object, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this MapEntity.
-
Parameters:
- (none)
- Returns: a string representation of this object
Class MapEntityBuilder (com.landawn.abacus.util.MapEntity.MapEntityBuilder)
A builder class for constructing MapEntity instances with a fluent API.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
put(...) -> MapEntityBuilder
-
Signature:
public MapEntityBuilder put(final String idPropName, final Object idPropVal) - Summary: Adds a property to the entity being built.
-
Parameters:
-
idPropName(String) — the property name -
idPropVal(Object) — the property value
-
- Returns: this builder instance for method chaining
build(...) -> MapEntity
-
Signature:
public MapEntity build() - Summary: Builds and returns the MapEntity instance.
-
Parameters:
- (none)
- Returns: the constructed MapEntity instance
Class Maps (com.landawn.abacus.util.Maps)
A comprehensive utility class providing an extensive collection of static methods for Map operations, transformations, manipulations, and analysis.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
zip(...) -> Map<K, V>
-
Signature:
public static <K, V> Map<K, V> zip(final Iterable<? extends K> keys, final Iterable<? extends V> values) - Summary: Creates a Map by zipping together two Iterables, one containing keys and the other containing values.
-
Contract:
- The Iterables should be of the same length.
- If they are not, the resulting Map will have the size of the smaller Iterable.
-
Parameters:
-
keys(Iterable<? extends K>) — an Iterable of keys for the resulting Map. -
values(Iterable<? extends V>) — an Iterable of values for the resulting Map.
-
- Returns: a Map where each key from the keys Iterable is associated with the corresponding value from the values Iterable.
-
Signature:
public static <K, V, M extends Map<K, V>> M zip(final Iterable<? extends K> keys, final Iterable<? extends V> values, final IntFunction<? extends M> mapSupplier) - Summary: Creates a Map by zipping together two Iterables with a custom map supplier.
-
Contract:
- The Iterables should be of the same length.
- If they are not, the resulting Map will have the size of the smaller Iterable.
-
Parameters:
-
keys(Iterable<? extends K>) — an Iterable of keys for the resulting Map. -
values(Iterable<? extends V>) — an Iterable of values for the resulting Map. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new Map instance based on expected size.
-
- Returns: a Map where each key from the keys Iterable is associated with the corresponding value from the values Iterable.
-
Signature:
public static <K, V, M extends Map<K, V>> M zip(final Iterable<? extends K> keys, final Iterable<? extends V> values, final BiFunction<? super V, ? super V, ? extends V> mergeFunction, final IntFunction<? extends M> mapSupplier) - Summary: Creates a Map by zipping together two Iterables with a merge function to handle duplicate keys.
-
Contract:
- The Iterables should be of the same length.
- If they are not, the resulting Map will have the size of the smaller Iterable.
- If duplicate keys are encountered, the merge function is used to resolve the conflict.
-
Parameters:
-
keys(Iterable<? extends K>) — an Iterable of keys for the resulting Map. -
values(Iterable<? extends V>) — an Iterable of values for the resulting Map. -
mergeFunction(BiFunction<? super V, ? super V, ? extends V>) — a function used to resolve conflicts when duplicate keys are encountered. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new Map instance based on expected size.
-
- Returns: a Map where each key from the keys Iterable is associated with the corresponding value from the values Iterable.
-
Signature:
public static <K, V> Map<K, V> zip(final Iterable<? extends K> keys, final Iterable<? extends V> values, final K defaultForKey, final V defaultForValue) - Summary: Creates a Map by zipping together two Iterables with default values for missing elements.
-
Contract:
- If one Iterable is shorter, the default value is used for the missing elements.
- Returns an empty map if either Iterable is {@code null} or empty.
- <p> <b> Important: </b> When using default keys, if multiple values map to the same default key, the merge function {@code Fn.selectFirst()} is applied, which keeps the first value and discards subsequent values for duplicate keys.
- This means if {@code values} has more elements than {@code keys} , only the first extra value will be mapped to {@code defaultForKey} .
-
Parameters:
-
keys(Iterable<? extends K>) — an Iterable of keys for the resulting Map. -
values(Iterable<? extends V>) — an Iterable of values for the resulting Map. -
defaultForKey(K) — the default key to use when keys Iterable is shorter than values. -
defaultForValue(V) — the default value to use when values Iterable is shorter than keys.
-
- Returns: a Map where each key is associated with the corresponding value, using defaults for missing elements.
-
Signature:
public static <K, V, M extends Map<K, V>> M zip(final Iterable<? extends K> keys, final Iterable<? extends V> values, final K defaultForKey, final V defaultForValue, final BiFunction<? super V, ? super V, ? extends V> mergeFunction, final IntFunction<? extends M> mapSupplier) - Summary: Creates a Map by zipping together two Iterables with default values and custom merge function.
-
Contract:
- If one Iterable is shorter, default values are used.
- Returns an empty map if either Iterable is {@code null} or empty.
-
Parameters:
-
keys(Iterable<? extends K>) — an Iterable of keys for the resulting Map. -
values(Iterable<? extends V>) — an Iterable of values for the resulting Map. -
defaultForKey(K) — the default key to use when keys Iterable is shorter than values. -
defaultForValue(V) — the default value to use when values Iterable is shorter than keys. -
mergeFunction(BiFunction<? super V, ? super V, ? extends V>) — a function used to resolve conflicts when duplicate keys are encountered. -
mapSupplier(IntFunction<? extends M>) — a function that generates a new Map instance.
-
- Returns: a Map where each key is associated with the corresponding value.
newEntry(...) -> Map.Entry<K, V>
-
Signature:
@Deprecated public static <K, V> Map.Entry<K, V> newEntry(final K key, final V value) - Summary: Creates a new entry (key-value pair) with the provided key and value.
-
Parameters:
-
key(K) — the key of the new entry. -
value(V) — the value of the new entry.
-
- Returns: a new Entry with the provided key and value.
newImmutableEntry(...) -> ImmutableEntry<K, V>
-
Signature:
@Deprecated public static <K, V> ImmutableEntry<K, V> newImmutableEntry(final K key, final V value) - Summary: Creates a new immutable entry with the provided key and value.
-
Parameters:
-
key(K) — the key of the new entry. -
value(V) — the value of the new entry.
-
- Returns: a new ImmutableEntry with the provided key and value.
keySet(...) -> Set<K>
-
Signature:
@Beta public static <K> Set<K> keySet(final Map<? extends K, ?> map) - Summary: Returns the key set of the specified map if it is not {@code null} or empty.
-
Contract:
- Returns the key set of the specified map if it is not {@code null} or empty.
-
Parameters:
-
map(Map<? extends K, ?>) — the map whose keys are to be returned, may be null.
-
- Returns: the key set of the map if non-empty, otherwise an empty immutable set.
- See also: N#nullToEmpty(Map)
values(...) -> Collection<V>
-
Signature:
@Beta public static <V> Collection<V> values(final Map<?, ? extends V> map) - Summary: Returns the collection of values from the specified map if it is not {@code null} or empty.
-
Contract:
- Returns the collection of values from the specified map if it is not {@code null} or empty.
-
Parameters:
-
map(Map<?, ? extends V>) — the map whose values are to be returned, may be null.
-
- Returns: the collection of values from the map if non-empty, otherwise an empty immutable list.
- See also: N#nullToEmpty(Map)
entrySet(...) -> Set<Map.Entry<K, V>>
-
Signature:
@Beta @SuppressWarnings({ "rawtypes" }) public static <K, V> Set<Map.Entry<K, V>> entrySet(final Map<? extends K, ? extends V> map) - Summary: Returns the entry set of the specified map if it is not {@code null} or empty.
-
Contract:
- Returns the entry set of the specified map if it is not {@code null} or empty.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose entry set is to be returned, may be null.
-
- Returns: the entry set of the map if non-empty, otherwise an empty immutable set.
- See also: N#nullToEmpty(Map)
getIfExists(...) -> Nullable<V>
-
Signature:
public static <K, V> Nullable<V> getIfExists(final Map<K, ? extends V> map, final K key) - Summary: Retrieves the value associated with the specified key, wrapped in a {@link Nullable} .
-
Contract:
- <p> This method distinguishes between a key that maps to {@code null} and a key that is missing: <ul> <li> If the key exists and maps to a value, returns {@code Nullable.of(value)} .
- </li> <li> If the key exists and maps to {@code null} , returns {@code Nullable.of(null)} .
- </li> <li> If the key does not exist or the map is {@code null} , returns {@code Nullable.empty()} .
-
Parameters:
-
map(Map<K, ? extends V>) — the map from which to retrieve the value -
key(K) — the key whose associated value is to be returned
-
- Returns: a {@code Nullable} wrapping the value if the key exists, otherwise an empty {@code Nullable}
- See also: #getOrDefaultIfAbsent(Map, Object, Object), #getIfExists(Map, Object, Object, Object)
-
Signature:
public static <K, K2, V2> Nullable<V2> getIfExists(final Map<K, ? extends Map<? extends K2, ? extends V2>> map, final K key, final K2 k2) - Summary: Retrieves a value from a double-nested map structure (Map-in-Map) using two keys.
-
Contract:
- It returns {@code Nullable.empty()} if any of the following conditions are met: </p> <ul> <li> The outer map is {@code null} , empty, or does not contain {@code key} .
- If both keys exist in their respective maps, the result is {@code Nullable.of(value)} , even when the value is {@code null} .
-
Parameters:
-
map(Map<K, ? extends Map<? extends K2, ? extends V2>>) — the outer map containing nested inner maps, may be {@code null} -
key(K) — the key used to retrieve the inner map from the outer map -
k2(K2) — the key used to retrieve the value from the inner map
-
- Returns: a {@code Nullable<V2>} containing the value if both keys are present (even if the value is {@code null} ); otherwise {@code Nullable.empty()}
- See also: #getIfExists(Map, Object), #getIfExists(Map, Object, Object, Object)
-
Signature:
public static <K, K2, K3, V3> Nullable<V3> getIfExists(final Map<K, ? extends Map<? extends K2, ? extends Map<? extends K3, ? extends V3>>> map, final K key, final K2 k2, final K3 k3) - Summary: Retrieves a value from a triple-nested map structure (Map-in-Map-in-Map) using three keys.
-
Contract:
- It returns {@code Nullable.empty()} if any of the following conditions are met: </p> <ul> <li> The outermost map is {@code null} , empty, or does not contain {@code key} .
- If all three keys exist in their respective maps, the result is {@code Nullable.of(value)} , even when the value is {@code null} .
-
Parameters:
-
map(Map<K, ? extends Map<? extends K2, ? extends Map<? extends K3, ? extends V3>>>) — the outermost map containing nested maps, may be {@code null} -
key(K) — the key used to retrieve the middle map from the outermost map -
k2(K2) — the key used to retrieve the innermost map from the middle map -
k3(K3) — the key used to retrieve the value from the innermost map
-
- Returns: a {@code Nullable<V3>} containing the value if all three keys are present (even if the value is {@code null} ); otherwise {@code Nullable.empty()}
- See also: #getIfExists(Map, Object), #getIfExists(Map, Object, Object)
getByPath(...) -> T
-
Signature:
@MayReturnNull public static <T> T getByPath(final Map<String, ?> map, final String path) - Summary: Resolves a value from a nested map/collection structure using a dot-separated path.
-
Contract:
- If the path cannot be resolved (missing key, index out of bounds, or root map is {@code null} /empty), this method returns {@code null} .
-
Parameters:
-
map(Map<String, ?>) — the map to query, may be {@code null} -
path(String) — the dot-separated path to the value
-
- Returns: the value at the specified path, or {@code null} if the path cannot be resolved
- See also: #getByPathOrDefault(Map, String, Object)
getByPathOrDefault(...) -> T
-
Signature:
public static <T> T getByPathOrDefault(final Map<String, ?> map, final String path, final T defaultValue) - Summary: Resolves a value from a nested map/collection structure using a dot-separated path, returning {@code defaultValue} if the path cannot be resolved.
-
Contract:
- Resolves a value from a nested map/collection structure using a dot-separated path, returning {@code defaultValue} if the path cannot be resolved.
- <p> If the path resolves to a non- {@code null} value that is not assignable to the {@code defaultValue} type, the value is converted using {@link N#convert(Object, Class)} .
- If the path exists but the resolved value is {@code null} , this method returns {@code null} (the default is not applied).
- </p> <p> <b> Note: </b> {@code defaultValue} must be non- {@code null} because its class is used to determine the conversion target.
-
Parameters:
-
map(Map<String, ?>) — the map to query, may be {@code null} -
path(String) — the dot-separated path to the value -
defaultValue(T) — the default value to return if the path cannot be resolved
-
- Returns: the value at the specified path, or {@code defaultValue} if the path cannot be resolved
- See also: #getByPath(Map, String)
getByPathAs(...) -> T
-
Signature:
@MayReturnNull public static <T> T getByPathAs(final Map<String, ?> map, final String path, final Class<? extends T> targetType) - Summary: Retrieves a value from a nested map/collection structure using a dot-separated path and converts it to the specified target type if necessary.
-
Contract:
- Retrieves a value from a nested map/collection structure using a dot-separated path and converts it to the specified target type if necessary.
- If the path can be resolved, the resulting value is either: </p> <ul> <li> returned as-is if it is {@code null} or already assignable to {@code targetType} , or </li> <li> converted to {@code targetType} using {@link N#convert(Object, Class)} .
- </li> </ul> <p> If the path cannot be resolved (for example a key is missing, an index is out of bounds, or the root map is {@code null} /empty), this method returns {@code null} .
-
Parameters:
-
map(Map<String, ?>) — the root map to traverse, may be {@code null} -
path(String) — the dot-separated path with optional {@code \[index\]} segments -
targetType(Class<? extends T>) — the target type to convert the value to
-
- Returns: the resolved and possibly converted value, or {@code null} if the path cannot be resolved
- See also: #getByPath(Map, String)
getByPathIfExists(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> getByPathIfExists(final Map<String, ?> map, final String path) - Summary: Retrieves a value from a nested map/collection structure using a dot-separated path and returns it wrapped in a {@link Nullable} if the path exists.
-
Contract:
- Retrieves a value from a nested map/collection structure using a dot-separated path and returns it wrapped in a {@link Nullable} if the path exists.
- If the path can be resolved, the resulting value (which may be {@code null} ) is wrapped in {@code Nullable.of(...)} .
- If the path cannot be resolved (for example a key is missing, an index is out of bounds, or the root map is {@code null} /empty), {@code Nullable.empty()} is returned.
- missing path: </b> <br> This method distinguishes between "path exists but value is {@code null} " and "path does not exist": </p> <ul> <li> Path exists \\u2192 {@code Nullable.of(value)} (even when {@code value == null} ) </li> <li> Path missing \\u2192 {@code Nullable.empty()} </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Object> map = new HashMap<>(); map.put("user", N.asMap("name", "John", "age", null)); Nullable<String> name = Maps.getByPathIfExists(map, "user.name"); // name.isPresent() = true, name.get() = "John" Nullable<Integer> age = Maps.getByPathIfExists(map, "user.age"); // age.isPresent() = true, age.get() = null Nullable<String> email = Maps.getByPathIfExists(map, "user.email"); // email.isPresent() = false } </pre>
-
Parameters:
-
map(Map<String, ?>) — the root map to traverse, may be {@code null} -
path(String) — the dot-separated path with optional {@code \[index\]} segments
-
- Returns: a {@code Nullable<T>} containing the value if the path exists (even if the value is {@code null} ); otherwise {@code Nullable.empty()}
- See also: #getByPath(Map, String)
getByPathAsIfExists(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> getByPathAsIfExists(final Map<String, ?> map, final String path, final Class<? extends T> targetType) - Summary: Retrieves a value from a nested map/collection structure using a dot-separated path, converts it to the specified target type if necessary, and returns the result wrapped in a {@link Nullable} if the path exists.
-
Contract:
- Retrieves a value from a nested map/collection structure using a dot-separated path, converts it to the specified target type if necessary, and returns the result wrapped in a {@link Nullable} if the path exists.
- If the path can be resolved, the resulting value is either: </p> <ul> <li> wrapped as {@code Nullable.of(value)} if it is {@code null} or already assignable to {@code targetType} , or </li> <li> converted to {@code targetType} using {@link N#convert(Object, Class)} and wrapped as {@code Nullable.of(convertedValue)} .
- </li> </ul> <p> If the path cannot be resolved (for example a key is missing, an index is out of bounds, or the root map is {@code null} /empty), this method returns {@code Nullable.empty()} .
-
Parameters:
-
map(Map<String, ?>) — the root map to traverse, may be {@code null} -
path(String) — the dot-separated path with optional {@code \[index\]} segments -
targetType(Class<? extends T>) — the target type to convert the value to
-
- Returns: a {@code Nullable<T>} containing the resolved (and possibly converted) value if the path exists; otherwise {@code Nullable.empty()}
- See also: #getByPath(Map, String)
getOrDefaultIfAbsent(...) -> V
-
Signature:
public static <K, V> V getOrDefaultIfAbsent(final Map<K, ? extends V> map, final K key, final V defaultValue) - Summary: Returns the value associated with the specified key, or {@code defaultValue} if the key is considered <em> absent </em> .
-
Contract:
- Returns the value associated with the specified key, or {@code defaultValue} if the key is considered <em> absent </em> .
-
Parameters:
-
map(Map<K, ? extends V>) — the map from which to retrieve the value; may be {@code null} or empty -
key(K) — the key whose associated value is to be returned -
defaultValue(V) — the value to return if the key is absent; must not be {@code null}
-
- Returns: the value mapped to {@code key} , or {@code defaultValue} if the key is absent
- See also: #getIfExists(Map, Object), #getAsOrDefault(Map, Object, Object)
-
Signature:
public static <K, K2, V2> V2 getOrDefaultIfAbsent(final Map<K, ? extends Map<K2, V2>> map, final K key, final K2 k2, final V2 defaultValue) - Summary: Returns the value from a two-level nested map structure, or {@code defaultValue} if the value is considered <em> absent </em> .
-
Contract:
- Returns the value from a two-level nested map structure, or {@code defaultValue} if the value is considered <em> absent </em> .
-
Parameters:
-
map(Map<K, ? extends Map<K2, V2>>) — the outer map; may be {@code null} or empty -
key(K) — the key used to retrieve the inner map -
k2(K2) — the key used to retrieve the value from the inner map -
defaultValue(V2) — the value to return if the lookup result is absent; must not be {@code null}
-
- Returns: the resolved value, or {@code defaultValue} if absent
- See also: #getIfExists(Map, Object, Object)
-
Signature:
public static <K, V> V getOrDefaultIfAbsent(final Map<K, ? extends V> map, final K key, final Supplier<? extends V> defaultValueSupplier) - Summary: Returns the value associated with the specified key, or a value supplied by {@code defaultValueSupplier} if the key is considered <em> absent </em> .
-
Contract:
- Returns the value associated with the specified key, or a value supplied by {@code defaultValueSupplier} if the key is considered <em> absent </em> .
- <p> A key is treated as absent if the map is {@code null} or empty, the key is not present, or the associated value is {@code null} .
- </p> <p> The supplier is invoked <strong> only </strong> when the key is absent and its result must not be {@code null} .
-
Parameters:
-
map(Map<K, ? extends V>) — the map from which to retrieve the value; may be {@code null} or empty -
key(K) — the key whose associated value is to be returned -
defaultValueSupplier(Supplier<? extends V>) — supplies the value to return if the key is absent
-
- Returns: the mapped value, or the value supplied by {@code defaultValueSupplier} if absent
getOrEmptyListIfAbsent(...) -> List<E>
-
Signature:
public static <K, E, V extends List<E>> List<E> getOrEmptyListIfAbsent(final Map<K, V> map, final K key) - Summary: Returns the List value to which the specified key is found, or an empty immutable List if the key is absent.
-
Contract:
- Returns the List value to which the specified key is found, or an empty immutable List if the key is absent.
- A key is considered absent if the map is empty, contains no mapping for the key, or the mapped value is {@code null} .
-
Parameters:
-
map(Map<K, V>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: the List value mapped by the key, or an empty immutable List if the key is absent.
- See also: N#emptyList()
getOrEmptySetIfAbsent(...) -> Set<E>
-
Signature:
public static <K, E, V extends Set<E>> Set<E> getOrEmptySetIfAbsent(final Map<K, V> map, final K key) - Summary: Returns the Set value to which the specified key is found, or an empty immutable Set if the key is absent.
-
Contract:
- Returns the Set value to which the specified key is found, or an empty immutable Set if the key is absent.
- A key is considered absent if the map is empty, contains no mapping for the key, or the mapped value is {@code null} .
-
Parameters:
-
map(Map<K, V>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: the Set value mapped by the key, or an empty immutable Set if the key is absent.
- See also: N#emptySet()
getOrEmptyMapIfAbsent(...) -> Map<KK, VV>
-
Signature:
public static <K, KK, VV, V extends Map<KK, VV>> Map<KK, VV> getOrEmptyMapIfAbsent(final Map<K, V> map, final K key) - Summary: Returns the Map value to which the specified key is found, or an empty immutable Map if the key is absent.
-
Contract:
- Returns the Map value to which the specified key is found, or an empty immutable Map if the key is absent.
- A key is considered absent if the map is empty, contains no mapping for the key, or the mapped value is {@code null} .
-
Parameters:
-
map(Map<K, V>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: the Map value mapped by the key, or an empty immutable Map if the key is absent.
- See also: N#emptyMap()
getOrPutIfAbsent(...) -> V
-
Signature:
public static <K, V> V getOrPutIfAbsent(final Map<K, V> map, final K key, final Supplier<? extends V> defaultValueSupplier) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new value obtained from {@code defaultValueSupplier} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new value obtained from {@code defaultValueSupplier} and returns it.
-
Parameters:
-
map(Map<K, V>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} . -
defaultValueSupplier(Supplier<? extends V>) — the supplier to provide a default value if the key is absent; must not be {@code null} .
-
- Returns: the value associated with the specified key, or a new value from {@code defaultValueSupplier} if the key is absent.
getOrPutListIfAbsent(...) -> List<E>
-
Signature:
public static <K, E> List<E> getOrPutListIfAbsent(final Map<K, List<E>> map, final K key) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code List} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code List} and returns it.
-
Parameters:
-
map(Map<K, List<E>>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} .
-
- Returns: the value associated with the specified key, or a new {@code List} if the key is absent.
getOrPutSetIfAbsent(...) -> Set<E>
-
Signature:
public static <K, E> Set<E> getOrPutSetIfAbsent(final Map<K, Set<E>> map, final K key) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code Set} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code Set} and returns it.
-
Parameters:
-
map(Map<K, Set<E>>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} .
-
- Returns: the value associated with the specified key, or a new {@code Set} if the key is absent.
getOrPutLinkedHashSetIfAbsent(...) -> Set<E>
-
Signature:
public static <K, E> Set<E> getOrPutLinkedHashSetIfAbsent(final Map<K, Set<E>> map, final K key) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code LinkedHashSet} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code LinkedHashSet} and returns it.
-
Parameters:
-
map(Map<K, Set<E>>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} .
-
- Returns: the value associated with the specified key, or a new {@code LinkedHashSet} if the key is absent.
getOrPutMapIfAbsent(...) -> Map<KK, VV>
-
Signature:
public static <K, KK, VV> Map<KK, VV> getOrPutMapIfAbsent(final Map<K, Map<KK, VV>> map, final K key) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code Map} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code Map} and returns it.
-
Parameters:
-
map(Map<K, Map<KK, VV>>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} .
-
- Returns: the value associated with the specified key, or a new {@code Map} if the key is absent.
getOrPutLinkedHashMapIfAbsent(...) -> Map<KK, VV>
-
Signature:
public static <K, KK, VV> Map<KK, VV> getOrPutLinkedHashMapIfAbsent(final Map<K, Map<KK, VV>> map, final K key) - Summary: Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code LinkedHashMap} and returns it.
-
Contract:
- Returns the value associated with the specified {@code key} if it exists and is not {@code null} in the specified {@code map} , otherwise puts a new {@code LinkedHashMap} and returns it.
-
Parameters:
-
map(Map<K, Map<KK, VV>>) — the map to check and possibly update. -
key(K) — the key to check for, may be {@code null} .
-
- Returns: the value associated with the specified key, or a new {@code LinkedHashMap} if the key is absent.
getAsBoolean(...) -> OptionalBoolean
-
Signature:
public static <K> OptionalBoolean getAsBoolean(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalBoolean} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalBoolean} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Boolean type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an OptionalBoolean containing the boolean value, or empty if not found.
getAsBooleanOrDefault(...) -> boolean
-
Signature:
public static <K> boolean getAsBooleanOrDefault(final Map<? super K, ?> map, final K key, final boolean defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Boolean type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(boolean) — the default value to return if the key is not found or value is null.
-
- Returns: the boolean value mapped to the key, or defaultValue if not found.
getAsChar(...) -> OptionalChar
-
Signature:
public static <K> OptionalChar getAsChar(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalChar} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalChar} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Character type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an OptionalChar containing the character value, or empty if not found.
getAsCharOrDefault(...) -> char
-
Signature:
public static <K> char getAsCharOrDefault(final Map<? super K, ?> map, final K key, final char defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Character type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(char) — the default value to return if the key is not found or value is null.
-
- Returns: the character value mapped to the key, or defaultValue if not found.
getAsByte(...) -> OptionalByte
-
Signature:
public static <K> OptionalByte getAsByte(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalByte} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalByte} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Byte/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an OptionalByte containing the byte value, or empty if not found.
getAsByteOrDefault(...) -> byte
-
Signature:
public static <K> byte getAsByteOrDefault(final Map<? super K, ?> map, final K key, final byte defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Byte/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(byte) — the default value to return if the key is not found or value is null.
-
- Returns: the byte value mapped to the key, or defaultValue if not found.
getAsShort(...) -> OptionalShort
-
Signature:
public static <K> OptionalShort getAsShort(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalShort} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalShort} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Short/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an OptionalShort containing the short value, or empty if not found.
getAsShortOrDefault(...) -> short
-
Signature:
public static <K> short getAsShortOrDefault(final Map<? super K, ?> map, final K key, final short defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Short/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(short) — the default value to return if the key is not found or value is null.
-
- Returns: the short value mapped to the key, or defaultValue if not found.
getAsInt(...) -> OptionalInt
-
Signature:
public static <K> OptionalInt getAsInt(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalInt} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalInt} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Integer/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an OptionalInt containing the integer value, or empty if not found.
getAsIntOrDefault(...) -> int
-
Signature:
public static <K> int getAsIntOrDefault(final Map<? super K, ?> map, final K key, final int defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Integer/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(int) — the default value to return if the key is not found or value is null.
-
- Returns: the integer value mapped to the key, or defaultValue if not found.
getAsLong(...) -> OptionalLong
-
Signature:
public static <K> OptionalLong getAsLong(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalLong} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalLong} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Long/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an {@code OptionalLong} containing the value if present, otherwise empty.
getAsLongOrDefault(...) -> long
-
Signature:
public static <K> long getAsLongOrDefault(final Map<? super K, ?> map, final K key, final long defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Long/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(long) — the default value to return if the value is {@code null} or not found.
-
- Returns: the long value associated with the key, or defaultValue if not found.
getAsFloat(...) -> OptionalFloat
-
Signature:
public static <K> OptionalFloat getAsFloat(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalFloat} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalFloat} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Float/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an {@code OptionalFloat} containing the value if present, otherwise empty.
getAsFloatOrDefault(...) -> float
-
Signature:
public static <K> float getAsFloatOrDefault(final Map<? super K, ?> map, final K key, final float defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Float/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(float) — the default value to return if the value is {@code null} or not found.
-
- Returns: the float value associated with the key, or defaultValue if not found.
getAsDouble(...) -> OptionalDouble
-
Signature:
public static <K> OptionalDouble getAsDouble(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code OptionalDouble} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code OptionalDouble} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Double/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an {@code OptionalDouble} containing the value if present, otherwise empty.
getAsDoubleOrDefault(...) -> double
-
Signature:
public static <K> double getAsDoubleOrDefault(final Map<? super K, ?> map, final K key, final double defaultValue) - Summary: Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns the specified {@code defaultValue} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not Double/Number type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(double) — the default value to return if the value is {@code null} or not found.
-
- Returns: the double value associated with the key, or defaultValue if not found.
getAsString(...) -> Optional<String>
-
Signature:
public static <K> Optional<String> getAsString(final Map<? super K, ?> map, final K key) - Summary: Returns an empty {@code Optional<String>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code Optional<String>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not String type, underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned.
-
- Returns: an {@code Optional<String>} with the value mapped by the specified key, or an empty {@code Optional<String>} if the map is empty, contains no value for the key, or the value is null.
getAsStringOrDefault(...) -> String
-
Signature:
public static <K> String getAsStringOrDefault(final Map<? super K, ?> map, final K key, final String defaultValue) throws IllegalArgumentException - Summary: Returns the value to which the specified key is found if the value is not {@code null} , or {@code defaultValue} if the specified map is empty or contains no value for the key or the mapping value is {@code null} .
-
Contract:
- Returns the value to which the specified key is found if the value is not {@code null} , or {@code defaultValue} if the specified map is empty or contains no value for the key or the mapping value is {@code null} .
- If the mapped value is not of String type, underlying conversion will be executed by {@code N.stringOf(value)} .
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(String) — the default value to return if the map is empty, contains no value for the key, or the value is {@code null} , must not be null.
-
- Returns: the value mapped by the specified key, or {@code defaultValue} if the map is empty, contains no value for the key, or the value is null.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code defaultValue} is {@code null} .
-
getAs(...) -> Optional<T>
-
Signature:
public static <K, T> Optional<T> getAs(final Map<? super K, ?> map, final K key, final Class<? extends T> targetType) - Summary: Returns an empty {@code Optional<T>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code Optional<T>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not {@code T} type, underlying conversion will be executed by {@code N.convert(val, targetType)} .
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
targetType(Class<? extends T>) — the target type to which the value should be converted.
-
- Returns: an {@code Optional<T>} with the value mapped by the specified key, or an empty {@code Optional<T>} if the map is empty, contains no value for the key, or the value is null.
- See also: #getOrDefaultIfAbsent(Map, Object, Object), N#convert(Object, Class), N#convert(Object, Type)
-
Signature:
public static <K, T> Optional<T> getAs(final Map<? super K, ?> map, final K key, final Type<? extends T> targetType) - Summary: Returns an empty {@code Optional<T>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
-
Contract:
- Returns an empty {@code Optional<T>} if the specified {@code map} is empty, or no value found by the specified {@code key} , or the mapping value is {@code null} .
- If the mapped value is not {@code T} type, underlying conversion will be executed by {@code N.convert(val, targetType)} .
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
targetType(Type<? extends T>) — the target type to which the value should be converted.
-
- Returns: an {@code Optional<T>} with the value mapped by the specified key, or an empty {@code Optional<T>} if the map is empty, contains no value for the key, or the value is null.
- See also: #getOrDefaultIfAbsent(Map, Object, Object), N#convert(Object, Class), N#convert(Object, Type)
getAsOrDefault(...) -> T
-
Signature:
public static <K, T> T getAsOrDefault(final Map<? super K, ?> map, final K key, final T defaultValue) throws IllegalArgumentException - Summary: Returns the value to which the specified {@code key} is mapped if the value is not {@code null} , or {@code defaultValue} if the specified map is empty or contains no value for the key or the mapping value is {@code null} .
-
Contract:
- Returns the value to which the specified {@code key} is mapped if the value is not {@code null} , or {@code defaultValue} if the specified map is empty or contains no value for the key or the mapping value is {@code null} .
- If the mapped value is not of type {@code T} , an underlying conversion will be executed.
-
Parameters:
-
map(Map<? super K, ?>) — the map from which to retrieve the value. -
key(K) — the key whose associated value is to be returned. -
defaultValue(T) — the default value to return if the map is empty, contains no value for the key, or the value is {@code null} , must not be null.
-
- Returns: the value to which the specified key is found, or {@code defaultValue} if the map is empty, contains no value for the key, or the value is null.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code defaultValue} is null.
-
- See also: #getOrDefaultIfAbsent(Map, Object, Object), N#convert(Object, Class), N#convert(Object, Type)
getValuesIfPresent(...) -> List<V>
-
Signature:
public static <K, V> List<V> getValuesIfPresent(final Map<K, ? extends V> map, final Collection<?> keys) throws IllegalArgumentException - Summary: Returns a list of values of the keys which exist in the specified {@code Map} .
-
Contract:
- If the key doesn't exist in the {@code Map} or associated value is {@code null} , no value will be added into the returned list.
-
Parameters:
-
map(Map<K, ? extends V>) — the map to check for keys. -
keys(Collection<?>) — the collection of keys to check in the map.
-
- Returns: a list of values corresponding to the keys found in the map. Returns an empty list if {@code map} or {@code keys} is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException
-
getValuesOrDefault(...) -> List<V>
-
Signature:
public static <K, V> List<V> getValuesOrDefault(final Map<K, V> map, final Collection<?> keys, final V defaultValue) throws IllegalArgumentException - Summary: Returns a list of values mapped by the keys which exist in the specified {@code Map} , or default value if the key doesn't exist in the {@code Map} or associated value is {@code null} .
-
Contract:
- Returns a list of values mapped by the keys which exist in the specified {@code Map} , or default value if the key doesn't exist in the {@code Map} or associated value is {@code null} .
-
Parameters:
-
map(Map<K, V>) — the map to check for keys. -
keys(Collection<?>) — the collection of keys to check in the map. -
defaultValue(V) — the default value to use when key is absent.
-
- Returns: a list of values corresponding to the keys, using defaultValue when absent. Returns an empty list if {@code keys} is {@code null} or empty. If {@code map} is {@code null} or empty, the returned list contains {@code defaultValue} repeated {@code keys.size()} times.
-
Throws:
-
java.lang.IllegalArgumentException
-
intersection(...) -> Map<K, V>
-
Signature:
public static <K, V> Map<K, V> intersection(final Map<K, V> map, final Map<?, ?> map2) - Summary: Returns a new map containing entries that are present in both input maps.
-
Parameters:
-
map(Map<K, V>) — the first input map. -
map2(Map<?, ?>) — the second input map to find common entries with.
-
- Returns: a new map containing entries present in both maps with equal values. If the first map is {@code null} , returns an empty map.
- See also: N#intersection(int\[\], int\[\]), N#intersection(Collection, Collection), N#commonSet(Collection, Collection)
difference(...) -> Map<K, Pair<V, Nullable<V>>>
-
Signature:
public static <K, V> Map<K, Pair<V, Nullable<V>>> difference(final Map<K, V> map, final Map<K, V> map2) - Summary: Calculates the difference between two maps.
-
Contract:
- If a key exists in the first map but not in the second, the value from the second map in the pair is an empty {@code Nullable} .
- If you need to identify keys that are unique to each map, use {@link #symmetricDifference(Map, Map)} instead.
- <p> If the first map is {@code null} , an empty map is returned.
- If the second map is {@code null} , all values from the first map will be paired with empty {@code Nullable} objects.
-
Parameters:
-
map(Map<K, V>) — the first map to compare. -
map2(Map<K, V>) — the second map to compare.
-
- Returns: a map representing the difference between the two input maps.
- See also: #symmetricDifference(Map, Map), Difference.MapDifference#of(Map, Map), N#difference(Collection, Collection), #intersection(Map, Map)
symmetricDifference(...) -> Map<K, Pair<Nullable<V>, Nullable<V>>>
-
Signature:
public static <K, V> Map<K, Pair<Nullable<V>, Nullable<V>>> symmetricDifference(final Map<K, V> map, final Map<K, V> map2) - Summary: Returns a new map containing the symmetric difference between two maps.
-
Contract:
- <p> For each key in the result map, the value is a pair where: <ul> <li> If the key exists only in the first map, the pair contains the value from the first map and an empty Nullable </li> <li> If the key exists only in the second map, the pair contains an empty {@code Nullable} and the value from the second map </li> <li> If the key exists in both maps with different values, the pair contains both values </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Integer> map1 = Maps.of("a", 1, "b", 2, "c", 3); Map<String, Integer> map2 = Maps.of("b", 2, "c", 4, "d", 5); Map<String, Pair<Nullable<Integer>, Nullable<Integer>>> result = Maps.symmetricDifference(map1, map2); // result contains: // "a" -> Pair.of(Nullable.of(1), Nullable.empty()) // key only in map1 // "c" -> Pair.of(Nullable.of(3), Nullable.of(4)) // different values // "d" -> Pair.of(Nullable.empty(), Nullable.of(5)) // key only in map2 // Note: "b" is not included because it has identical values in both maps } </pre> <p> If either input map is {@code null} , it is treated as an empty map.
-
Parameters:
-
map(Map<K, V>) — the first input map. -
map2(Map<K, V>) — the second input map.
-
- Returns: a new map containing the symmetric difference between the two input maps.
- See also: #difference(Map, Map), N#symmetricDifference(int\[\], int\[\]), N#symmetricDifference(Collection, Collection), Iterables#symmetricDifference(Set, Set), #intersection(Map, Map)
containsEntry(...) -> boolean
-
Signature:
public static boolean containsEntry(final Map<?, ?> map, final Map.Entry<?, ?> entry) - Summary: Checks if the specified map contains the specified entry.
-
Contract:
- Checks if the specified map contains the specified entry.
-
Parameters:
-
map(Map<?, ?>) — the map to check, may be {@code null} . -
entry(Map.Entry<?, ?>) — the entry to check for, may be {@code null} .
-
- Returns: {@code true} if the map contains the specified entry, {@code false} otherwise.
-
Signature:
public static boolean containsEntry(final Map<?, ?> map, final Object key, final Object value) - Summary: Checks if the specified map contains the specified key-value pair.
-
Contract:
- Checks if the specified map contains the specified key-value pair.
-
Parameters:
-
map(Map<?, ?>) — the map to be checked. -
key(Object) — the key whose presence in the map is to be tested. -
value(Object) — the value whose presence in the map is to be tested.
-
- Returns: {@code true} if the map contains the specified key-value pair, {@code false} otherwise.
putIfAbsent(...) -> V
-
Signature:
public static <K, V> V putIfAbsent(final Map<K, V> map, final K key, final V value) - Summary: Puts if the specified key is not already associated with a value (or is mapped to {@code null} ).
-
Contract:
- Puts if the specified key is not already associated with a value (or is mapped to {@code null} ).
-
Parameters:
-
map(Map<K, V>) — the map to put the value in. -
key(K) — the key to associate the value with. -
value(V) — the value to put if the key is absent.
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key or if the key was mapped to {@code null} .
- See also: Map#putIfAbsent(Object, Object)
-
Signature:
public static <K, V> V putIfAbsent(final Map<K, V> map, final K key, final Supplier<V> supplier) - Summary: Puts if the specified key is not already associated with a value (or is mapped to {@code null} ).
-
Contract:
- Puts if the specified key is not already associated with a value (or is mapped to {@code null} ).
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, List<String>> map = new HashMap<>(); map.put("key1", Arrays.asList("a", "b")); // Supplier is only called when the key is absent List<String> result1 = Maps.putIfAbsent(map, "key1", () -> new ArrayList<>()); // result1 = null (key1 already has a value, supplier not called) // map = {key1=\[a, b\]} List<String> result2 = Maps.putIfAbsent(map, "key2", () -> new ArrayList<>()); // result2 = null (key2 was absent, supplier called and value set) // map = {key1=\[a, b\], key2=\[\]} } </pre>
-
Parameters:
-
map(Map<K, V>) — the map to put the value in. -
key(K) — the key to associate the value with. -
supplier(Supplier<V>) — the supplier to get the value from if the key is absent.
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key or if the key was mapped to {@code null} .
- See also: Map#putIfAbsent(Object, Object)
putAllIf(...) -> boolean
-
Signature:
@Beta public static <K, V> boolean putAllIf(final Map<K, V> targetMap, final Map<? extends K, ? extends V> sourceMap, Predicate<? super K> keyFilter) - Summary: Puts all entries from the source map into the target map, but only if the key passes the specified filter predicate.
-
Contract:
- Puts all entries from the source map into the target map, but only if the key passes the specified filter predicate.
- This method iterates through all entries in the source map and adds them to the target map if the key satisfies the filter condition.
-
Parameters:
-
targetMap(Map<K, V>) — the target map to which entries will be added. -
sourceMap(Map<? extends K, ? extends V>) — the source map from which entries will be taken. -
keyFilter(Predicate<? super K>) — a predicate that filters keys to be added to the target map.
-
- Returns: {@code true} if any entries were added, {@code false} otherwise.
-
Signature:
@Beta public static <K, V> boolean putAllIf(final Map<K, V> targetMap, final Map<? extends K, ? extends V> sourceMap, BiPredicate<? super K, ? super V> entryFilter) - Summary: Puts all entries from the source map into the target map, but only if the key and value pass the specified filter predicate.
-
Contract:
- Puts all entries from the source map into the target map, but only if the key and value pass the specified filter predicate.
- This method iterates through all entries in the source map and adds them to the target map if both the key and value satisfy the filter condition.
-
Parameters:
-
targetMap(Map<K, V>) — the target map to which entries will be added. -
sourceMap(Map<? extends K, ? extends V>) — the source map from which entries will be taken. -
entryFilter(BiPredicate<? super K, ? super V>) — a predicate that filters keys and values to be added to the target map.
-
- Returns: {@code true} if any entries were added, {@code false} otherwise.
removeEntry(...) -> boolean
-
Signature:
public static <K, V> boolean removeEntry(final Map<K, V> map, final Map.Entry<?, ?> entry) - Summary: Removes the specified entry from the map.
-
Parameters:
-
map(Map<K, V>) — the map from which the entry is to be removed. -
entry(Map.Entry<?, ?>) — the entry to be removed from the map.
-
- Returns: {@code true} if the entry was removed, {@code false} otherwise.
- See also: Map#remove(Object, Object)
-
Signature:
public static <K, V> boolean removeEntry(final Map<K, V> map, final Object key, final Object value) - Summary: Removes the specified key-value pair from the map.
-
Contract:
- This method removes an entry from the map only if the key is mapped to the specified value.
- If the key is not present in the map or is mapped to a different value, the map remains unchanged.
-
Parameters:
-
map(Map<K, V>) — the map from which the entry is to be removed. -
key(Object) — the key whose associated value is to be removed. -
value(Object) — the value to be removed.
-
- Returns: {@code true} if the entry was removed, {@code false} otherwise.
- See also: Map#remove(Object, Object)
removeEntries(...) -> boolean
-
Signature:
public static boolean removeEntries(final Map<?, ?> map, final Map<?, ?> entriesToRemove) - Summary: Removes the specified entries from the map.
-
Contract:
- An entry is removed only if both the key and value match exactly.
-
Parameters:
-
map(Map<?, ?>) — the map from which the entries are to be removed. -
entriesToRemove(Map<?, ?>) — the map containing the entries to be removed.
-
- Returns: {@code true} if any entries were removed, {@code false} otherwise.
removeKeys(...) -> boolean
-
Signature:
public static boolean removeKeys(final Map<?, ?> map, final Collection<?> keysToRemove) - Summary: Removes the specified keys from the map.
-
Contract:
- If any of the keys in the collection are not present in the map, they are ignored.
-
Parameters:
-
map(Map<?, ?>) — the map from which the keys are to be removed. -
keysToRemove(Collection<?>) — the collection of keys to be removed from the map.
-
- Returns: {@code true} if any keys were removed, {@code false} otherwise.
removeIf(...) -> boolean
-
Signature:
public static <K, V> boolean removeIf(final Map<K, V> map, final Predicate<? super Map.Entry<K, V>> filter) throws IllegalArgumentException - Summary: Removes entries from the specified map that match the given filter predicate.
-
Parameters:
-
map(Map<K, V>) — the map from which entries are to be removed. -
filter(Predicate<? super Map.Entry<K, V>>) — the predicate used to determine which entries to remove.
-
- Returns: {@code true} if one or more entries were removed, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the filter is null.
-
-
Signature:
public static <K, V> boolean removeIf(final Map<K, V> map, final BiPredicate<? super K, ? super V> filter) throws IllegalArgumentException - Summary: Removes entries from the specified map that match the given filter predicate based on key and value.
-
Parameters:
-
map(Map<K, V>) — the map from which entries are to be removed. -
filter(BiPredicate<? super K, ? super V>) — the predicate used to determine which entries to remove.
-
- Returns: {@code true} if one or more entries were removed, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the filter is null.
-
removeIfKey(...) -> boolean
-
Signature:
public static <K, V> boolean removeIfKey(final Map<K, V> map, final Predicate<? super K> filter) throws IllegalArgumentException - Summary: Removes entries from the specified map that match the given key filter predicate.
-
Parameters:
-
map(Map<K, V>) — the map from which entries are to be removed. -
filter(Predicate<? super K>) — the predicate used to determine which keys to remove.
-
- Returns: {@code true} if one or more entries were removed, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the filter is null.
-
removeIfValue(...) -> boolean
-
Signature:
public static <K, V> boolean removeIfValue(final Map<K, V> map, final Predicate<? super V> filter) throws IllegalArgumentException - Summary: Removes entries from the specified map that match the given value filter predicate.
-
Parameters:
-
map(Map<K, V>) — the map from which entries are to be removed. -
filter(Predicate<? super V>) — the predicate used to determine which values to remove.
-
- Returns: {@code true} if one or more entries were removed, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the filter is null.
-
replace(...) -> V
-
Signature:
@MayReturnNull public static <K, V> V replace(final Map<K, V> map, final K key, final V newValue) throws IllegalArgumentException - Summary: Replaces the entry for the specified key with the new value if the key is present in the map.
-
Contract:
- Replaces the entry for the specified key with the new value if the key is present in the map.
- This method updates the value for a key only if the key exists in the map.
- If the key is not present, the map remains unchanged.
-
Parameters:
-
map(Map<K, V>) — the map in which the entry is to be replaced. -
key(K) — the key with which the specified value is associated. -
newValue(V) — the new value to be associated with the specified key.
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key.
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
public static <K, V> boolean replace(final Map<K, V> map, final K key, final V oldValue, final V newValue) - Summary: Replaces the entry for the specified key only if currently mapped to the specified value.
-
Contract:
- Replaces the entry for the specified key only if currently mapped to the specified value.
- This method updates the value for a key only if the current value matches the oldValue parameter.
- If the key is not present or the current value doesn't match oldValue, the map remains unchanged.
-
Parameters:
-
map(Map<K, V>) — the map in which the entry is to be replaced. -
key(K) — the key with which the specified value is associated. -
oldValue(V) — the expected current value associated with the specified key. -
newValue(V) — the new value to be associated with the specified key.
-
- Returns: {@code true} if the value was replaced, {@code false} otherwise.
- See also: Map#replace(Object, Object, Object)
replaceAll(...) -> void
-
Signature:
public static <K, V> void replaceAll(final Map<K, V> map, final BiFunction<? super K, ? super V, ? extends V> function) throws IllegalArgumentException - Summary: Replaces each entry's value with the result of applying the given function to that entry.
-
Parameters:
-
map(Map<K, V>) — the map in which the entries are to be replaced. -
function(BiFunction<? super K, ? super V, ? extends V>) — the function to apply to each entry to compute a new value.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the function is null.
-
filter(...) -> Map<K, V>
-
Signature:
public static <K, V> Map<K, V> filter(final Map<K, V> map, final Predicate<? super Map.Entry<K, V>> predicate) throws IllegalArgumentException - Summary: Filters the entries of the specified map based on the given predicate.
-
Contract:
- The returned map is of the same type as the input map if possible.
-
Parameters:
-
map(Map<K, V>) — the map to be filtered. -
predicate(Predicate<? super Map.Entry<K, V>>) — the predicate used to filter the entries.
-
- Returns: a new map containing only the entries that match the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
-
Signature:
public static <K, V> Map<K, V> filter(final Map<K, V> map, final BiPredicate<? super K, ? super V> predicate) throws IllegalArgumentException - Summary: Filters the entries of the specified map based on the given predicate applied to key-value pairs.
-
Contract:
- The returned map is of the same type as the input map if possible.
-
Parameters:
-
map(Map<K, V>) — the map to be filtered. -
predicate(BiPredicate<? super K, ? super V>) — the predicate used to filter the entries.
-
- Returns: a new map containing only the entries that match the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
filterByKey(...) -> Map<K, V>
-
Signature:
public static <K, V> Map<K, V> filterByKey(final Map<K, V> map, final Predicate<? super K> predicate) throws IllegalArgumentException - Summary: Filters the entries of the specified map based on the given key predicate.
-
Contract:
- The returned map is of the same type as the input map if possible.
-
Parameters:
-
map(Map<K, V>) — the map to be filtered. -
predicate(Predicate<? super K>) — the predicate used to filter the keys.
-
- Returns: a new map containing only the entries with keys that match the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
filterByValue(...) -> Map<K, V>
-
Signature:
public static <K, V> Map<K, V> filterByValue(final Map<K, V> map, final Predicate<? super V> predicate) throws IllegalArgumentException - Summary: Filters the entries of the specified map based on the given value predicate.
-
Contract:
- The returned map is of the same type as the input map if possible.
-
Parameters:
-
map(Map<K, V>) — the map to be filtered. -
predicate(Predicate<? super V>) — the predicate used to filter the values.
-
- Returns: a new map containing only the entries with values that match the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
invert(...) -> Map<V, K>
-
Signature:
public static <K, V> Map<V, K> invert(final Map<K, V> map) - Summary: Inverts the given map by swapping its keys with its values.
-
Contract:
- If there are duplicate values, some information may be lost in the inversion process as each value in the resulting map must be unique.
-
Parameters:
-
map(Map<K, V>) — the map to be inverted.
-
- Returns: a new map which is the inverted version of the input map.
-
Signature:
public static <K, V> Map<V, K> invert(final Map<K, V> map, final BiFunction<? super K, ? super K, ? extends K> mergeOp) throws IllegalArgumentException - Summary: Inverts the given map by swapping its keys with its values.
-
Contract:
- If there are duplicate values in the input map, the merging operation specified by mergeOp is applied.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, String> map = new HashMap<>(); map.put("key1", "valueA"); map.put("key2", "valueA"); map.put("key3", "valueB"); // Use the first key when there are duplicates Map<String, String> inverted1 = Maps.invert(map, (oldKey, newKey) -> oldKey); // inverted1 = {valueA=key1, valueB=key3} // Use the last key when there are duplicates Map<String, String> inverted2 = Maps.invert(map, (oldKey, newKey) -> newKey); // inverted2 = {valueA=key2, valueB=key3} // Concatenate keys when there are duplicates Map<String, String> inverted3 = Maps.invert(map, (oldKey, newKey) -> oldKey + "," + newKey); // inverted3 = {valueA=key1,key2, valueB=key3} } </pre>
-
Parameters:
-
map(Map<K, V>) — the map to be inverted. -
mergeOp(BiFunction<? super K, ? super K, ? extends K>) — the merging operation to be applied if there are duplicate values in the input map.
-
- Returns: a new map which is the inverted version of the input map.
-
Throws:
-
java.lang.IllegalArgumentException— if mergeOp is {@code null} .
-
flatInvert(...) -> Map<V, List<K>>
-
Signature:
public static <K, V> Map<V, List<K>> flatInvert(final Map<K, ? extends Collection<? extends V>> map) - Summary: Inverts the given map by mapping each value in the Collection to the corresponding key.
-
Parameters:
-
map(Map<K, ? extends Collection<? extends V>>) — the map to be inverted.
-
- Returns: a new map which is the inverted version of the input map.
flatToMap(...) -> List<Map<K, V>>
-
Signature:
public static <K, V> List<Map<K, V>> flatToMap(final Map<K, ? extends Collection<? extends V>> map) - Summary: Transforms a map of collections into a list of maps.
-
Contract:
- If the collections in the original map are of different sizes, the resulting list's size is equal to the size of the largest collection.
-
Parameters:
-
map(Map<K, ? extends Collection<? extends V>>) — the input map, where each key is associated with a collection of values.
-
- Returns: a list of maps, where each map represents a "flat" version of the original map's entries.
flatten(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> flatten(final Map<String, Object> map) - Summary: Flattens the given map.
-
Parameters:
-
map(Map<String, Object>) — the map to be flattened.
-
- Returns: a new map which is the flattened version of the input map.
-
Signature:
public static <M extends Map<String, Object>> M flatten(final Map<String, Object> map, final Supplier<? extends M> mapSupplier) - Summary: Flattens the given map using a provided map supplier.
-
Parameters:
-
map(Map<String, Object>) — the map to be flattened. -
mapSupplier(Supplier<? extends M>) — a supplier function that provides a new instance of the map to be returned.
-
- Returns: a new map which is the flattened version of the input map.
-
Signature:
public static <M extends Map<String, Object>> M flatten(final Map<String, Object> map, final String delimiter, final Supplier<? extends M> mapSupplier) - Summary: Flattens the given map using a provided map supplier and a delimiter.
-
Parameters:
-
map(Map<String, Object>) — the map to be flattened. -
delimiter(String) — the delimiter to be used when concatenating keys. -
mapSupplier(Supplier<? extends M>) — a supplier function that provides a new instance of the map to be returned.
-
- Returns: a new map which is the flattened version of the input map.
unflatten(...) -> Map<String, Object>
-
Signature:
public static Map<String, Object> unflatten(final Map<String, Object> map) - Summary: Unflattens the given map.
-
Parameters:
-
map(Map<String, Object>) — the flattened map to be unflattened.
-
- Returns: a new map which is the unflattened version of the input map.
-
Signature:
public static <M extends Map<String, Object>> M unflatten(final Map<String, Object> map, final Supplier<? extends M> mapSupplier) - Summary: Unflattens the given map using a provided map supplier.
-
Parameters:
-
map(Map<String, Object>) — the flattened map to be unflattened. -
mapSupplier(Supplier<? extends M>) — a supplier function that provides a new instance of the map to be returned.
-
- Returns: a new map which is the unflattened version of the input map.
-
Signature:
public static <M extends Map<String, Object>> M unflatten(final Map<String, Object> map, final String delimiter, final Supplier<? extends M> mapSupplier) throws IllegalArgumentException - Summary: Unflattens the given map using a provided map supplier and a delimiter.
-
Parameters:
-
map(Map<String, Object>) — the flattened map to be unflattened. -
delimiter(String) — the delimiter that was used in the flattening process to concatenate keys. -
mapSupplier(Supplier<? extends M>) — a supplier function that provides a new instance of the map to be returned.
-
- Returns: a new map which is the unflattened version of the input map. Keys without the delimiter are copied as-is; no error is raised when the delimiter is absent.
-
Throws:
-
java.lang.IllegalArgumentException
-
replaceKeys(...) -> void
-
Signature:
public static <K> void replaceKeys(final Map<K, ?> map, final Function<? super K, ? extends K> keyConverter) throws IllegalStateException - Summary: Replaces (renames) the keys in the specified map by applying the given converter to each existing key.
-
Contract:
- If duplicates are detected, throws {@link IllegalStateException} before modifying the map.
- </li> </ol> <p> <b> Notes: </b> </p> <ul> <li> If a key converts to itself (i.e., {@code keyConverter.apply(key).equals(key)} ), the entry is still removed and reinserted, which may affect iteration order in some map implementations.
- </li> <li> If {@code keyConverter} returns {@code null} , it is treated as a valid key.
- However, if {@code null} is returned for multiple keys, an {@link IllegalStateException} is thrown due to duplicate keys.
- </li> <li> If the map is empty or {@code null} , this method returns immediately without any action.
-
Parameters:
-
map(Map<K, ?>) — the map whose keys are to be replaced; modified in-place. If {@code null} or empty, no action is taken. -
keyConverter(Function<? super K, ? extends K>) — the function applied to each existing key to produce the new key; must not be {@code null}
-
-
Throws:
-
java.lang.IllegalStateException— if the converted keys contain duplicates (including multiple {@code null} values)
-
-
Signature:
public static <K, V> void replaceKeys(final Map<K, V> map, final Function<? super K, ? extends K> keyConverter, final BiFunction<? super V, ? super V, ? extends V> merger) - Summary: Replaces (renames) keys in the specified map by applying the given converter, merging values when multiple original keys map to the same converted key.
-
Contract:
- Replaces (renames) keys in the specified map by applying the given converter, merging values when multiple original keys map to the same converted key.
- If the new key is equal to the original key (via {@link N#equals(Object, Object)} ), the entry is left unchanged.
- If the new key is not already present, the value is simply moved; if it is present, {@code merger} is used to combine the existing value (first argument) and the moved value (second argument).
- When multiple keys convert to the same new key, merges occur in that iteration order.
- </li> <li> If {@code keyConverter} returns {@code null} for any key, behavior depends on the map implementation.
- </li> <li> If {@code merger} returns {@code null} , {@link Map#merge(Object, Object, BiFunction)} removes the entry for that key (per the {@code Map.merge} contract).
- </li> <li> If the map is empty or {@code null} , this method returns immediately without any action.
- </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Merge values when keys collide (sum integers) Map<String, Integer> map = new HashMap<>(); map.put("a1", 10); map.put("a2", 20); map.put("b1", 30); Maps.replaceKeys(map, k -> k.substring(0, 1), Integer::sum); // map now contains: {a=30, b=30} // Explanation: "a1" (10) and "a2" (20) both map to "a", merged via sum -> 30 // Concatenate strings on collision Map<String, String> data = new LinkedHashMap<>(); data.put("user_1", "John"); data.put("user_2", "Jane"); data.put("admin_1", "Bob"); Maps.replaceKeys(data, k -> k.split("_")\[0\], (v1, v2) -> v1 + ", " + v2); // data now contains: {user="John, Jane", admin="Bob"} // Keep only the first value on collision Maps.replaceKeys(someMap, keyConverter, (existing, incoming) -> existing); // Keep only the last value on collision Maps.replaceKeys(someMap, keyConverter, (existing, incoming) -> incoming); // Remove entries that would collide (merger returns null) Maps.replaceKeys(someMap, keyConverter, (existing, incoming) -> null); } </pre>
-
Parameters:
-
map(Map<K, V>) — the map whose keys are to be replaced; modified in-place. If {@code null} or empty, no action is taken. -
keyConverter(Function<? super K, ? extends K>) — converts each existing key to its replacement key; must not be {@code null} -
merger(BiFunction<? super V, ? super V, ? extends V>) — merges values when multiple entries map to the same converted key. The function receives {@code (existingValue, incomingValue)} and returns the merged value. If it returns {@code null} , the entry is removed. Must not be {@code null} .
-
- See also: #replaceKeys(Map, Function),for a version that throws on duplicate keys instead of merging
Public Instance Methods
- (none)
Enum MediaType (com.landawn.abacus.util.MediaType)
An enumeration representing different media types or content categories.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> MediaType
-
Signature:
public static MediaType valueOf(final int intValue) - Summary: Returns the MediaType enum constant corresponding to the specified numeric value.
-
Contract:
- This is particularly useful when deserializing data, reading from databases, or working with external systems that use numeric codes.
- </p> <p> The method performs a fast lookup using a switch statement, ensuring optimal performance even when called frequently.
-
Parameters:
-
intValue(int) — the numeric value of the media type (must be between 0 and 5 inclusive)
-
- Returns: the MediaType enum constant corresponding to the specified value
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the numeric value associated with this media type.
-
Contract:
- <p> This method is useful for serialization, database storage, or when interfacing with systems that use numeric codes for media types.
-
Parameters:
- (none)
- Returns: the numeric value of this media type (0-5)
Class Median (com.landawn.abacus.util.Median)
A high-performance utility class providing efficient median calculation methods for arrays and collections without requiring full sorting operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Pair<Character, OptionalChar>
-
Signature:
public static Pair<Character, OptionalChar> of(final char... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of characters using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(char[]) — the array of characters to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(char\[\], int, int), Pair, OptionalChar, N#median(char\[\])
-
Signature:
public static Pair<Character, OptionalChar> of(final char[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of characters defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(char[]) — the array of characters to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(char...), N#median(char\[\], int, int)
-
Signature:
public static Pair<Byte, OptionalByte> of(final byte... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of bytes using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(byte[]) — the array of bytes to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(byte\[\], int, int), Pair, OptionalByte
-
Signature:
public static Pair<Byte, OptionalByte> of(final byte[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of bytes defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(byte[]) — the array of bytes to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(byte...)
-
Signature:
public static Pair<Short, OptionalShort> of(final short... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of short integers using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(short[]) — the array of short integers to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(short\[\], int, int), Pair, OptionalShort
-
Signature:
public static Pair<Short, OptionalShort> of(final short[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of short integers defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(short[]) — the array of short integers to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(short...)
-
Signature:
public static Pair<Integer, OptionalInt> of(final int... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of integers using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(int[]) — the array of integers to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(int\[\], int, int), Pair, OptionalInt
-
Signature:
public static Pair<Integer, OptionalInt> of(final int[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of integers defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(int[]) — the array of integers to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(int...)
-
Signature:
public static Pair<Long, OptionalLong> of(final long... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of long integers using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(long[]) — the array of long integers to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(long\[\], int, int), Pair, OptionalLong
-
Signature:
public static Pair<Long, OptionalLong> of(final long[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of long integers defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(long[]) — the array of long integers to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(long...)
-
Signature:
public static Pair<Float, OptionalFloat> of(final float... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of float values using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(float[]) — the array of float values to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(float\[\], int, int), Pair, OptionalFloat
-
Signature:
public static Pair<Float, OptionalFloat> of(final float[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of float values defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(float[]) — the array of float values to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(float...)
-
Signature:
public static Pair<Double, OptionalDouble> of(final double... source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of double values using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order.
-
Parameters:
-
source(double[]) — the array of double values to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- Performance: This method uses an efficient priority queue-based algorithm that processes the array in O(n) time complexity by maintaining a bounded heap of size (length/2 + 1).
- See also: #of(double\[\], int, int), Pair, OptionalDouble
-
Signature:
public static Pair<Double, OptionalDouble> of(final double[] source, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of double values defined by the specified range using natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order.
-
Parameters:
-
source(double[]) — the array of double values to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(double...)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, Optional<T>> of(final T[] source) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of Comparable objects using their natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order according to their natural comparison method (compareTo).
-
Parameters:
-
source(T[]) — the array of Comparable objects to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- See also: #of(Comparable\[\], int, int), #of(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, Optional<T>> of(final T[] source, final int fromIndex, final int toIndex) - Summary: Finds the median value(s) from a subarray of Comparable objects defined by the specified range using their natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order according to their natural comparison method (compareTo).
-
Parameters:
-
source(T[]) — the array of Comparable objects to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
- See also: #of(Comparable\[\]), #of(Object\[\], int, int, Comparator)
-
Signature:
public static <T> Pair<T, Optional<T>> of(final T[] source, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Finds the median value(s) from an array of objects using a custom comparator for ordering.
-
Contract:
- <p> The median represents the middle value(s) when the array elements are arranged in sorted order according to the provided comparator.
- This method uses an efficient priority queue-based algorithm that works with any custom comparison logic, allowing for flexible median calculation on objects that may not implement Comparable or when a different ordering than natural order is desired.
- If using natural ordering (null comparator) or a comparator that does not handle nulls, a {@code NullPointerException} may be thrown during comparison.
-
Parameters:
-
source(T[]) — the array of objects to find the median from. Must not be {@code null} or empty. -
cmp(Comparator<? super T>) — the comparator to use for ordering the elements. If {@code null} , natural ordering is used. The comparator must be consistent with equals for predictable results.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length arrays, the {@code left} contains the median and {@code right} is empty. For even-length arrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array is {@code null} or empty.
-
- See also: #of(Object\[\], int, int, Comparator), #of(Comparable\[\])
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Pair<T, Optional<T>> of(final T[] source, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException - Summary: Finds the median value(s) from a subarray of objects defined by the specified range using a custom comparator for ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subarray elements are arranged in sorted order according to the provided comparator.
- If using natural ordering (null comparator) or a comparator that does not handle nulls, a {@code NullPointerException} may be thrown during comparison.
-
Parameters:
-
source(T[]) — the array of objects to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the array to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the array to consider. Must be greater than fromIndex and not exceed array length. -
cmp(Comparator<? super T>) — the comparator to use for ordering the elements. If {@code null} , natural ordering is used. The comparator must be consistent with equals for predictable results.
-
- Returns: a {@code Pair} containing the median value(s). For odd-length subarrays, the {@code left} contains the median and {@code right} is empty. For even-length subarrays, the {@code left} contains the smaller median and {@code right} contains the larger median.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the length of the array, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(Object\[\], Comparator), #of(Comparable\[\], int, int)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, Optional<T>> of(final Collection<? extends T> source) - Summary: Finds the median value(s) from a collection of Comparable objects using their natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the collection elements are arranged in sorted order according to their natural comparison method (compareTo).
-
Parameters:
-
source(Collection<? extends T>) — the collection of Comparable objects to find the median from. Must not be {@code null} or empty.
-
- Returns: a {@code Pair} containing the median value(s). For odd-size collections, the {@code left} contains the median and {@code right} is empty. For even-size collections, the {@code left} contains the smaller median and {@code right} contains the larger median.
- See also: #of(Collection, Comparator), #of(Collection, int, int)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Pair<T, Optional<T>> of(final Collection<? extends T> source, Comparator<? super T> cmp) - Summary: Finds the median value(s) from a collection of objects using a custom comparator for ordering.
-
Contract:
- <p> The median represents the middle value(s) when the collection elements are arranged in sorted order according to the provided comparator.
- This method uses an efficient priority queue-based algorithm that works with any custom comparison logic, providing flexibility for objects that may not implement Comparable or when a different ordering than natural order is desired.
- If using natural ordering (null comparator) or a comparator that does not handle nulls, a {@code NullPointerException} may be thrown during comparison.
-
Parameters:
-
source(Collection<? extends T>) — the collection of objects to find the median from. Must not be {@code null} or empty. -
cmp(Comparator<? super T>) — the comparator to use for ordering the elements. If {@code null} , natural ordering is used. The comparator must be consistent with equals for predictable results.
-
- Returns: a {@code Pair} containing the median value(s). For odd-size collections, the {@code left} contains the median and {@code right} is empty. For even-size collections, the {@code left} contains the smaller median and {@code right} contains the larger median.
- See also: #of(Collection), #of(Collection, int, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, Optional<T>> of(final Collection<? extends T> source, final int fromIndex, final int toIndex) - Summary: Finds the median value(s) from a subcollection of Comparable objects defined by the specified range using their natural ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subcollection elements are arranged in sorted order according to their natural comparison method (compareTo).
-
Parameters:
-
source(Collection<? extends T>) — the collection of Comparable objects to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the collection to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the collection to consider. Must be greater than fromIndex and not exceed collection size.
-
- Returns: a {@code Pair} containing the median value(s). For odd-size subcollections, the {@code left} contains the median and {@code right} is empty. For even-size subcollections, the {@code left} contains the smaller median and {@code right} contains the larger median.
- See also: #of(Collection), #of(Collection, int, int, Comparator)
-
Signature:
public static <T> Pair<T, Optional<T>> of(final Collection<? extends T> source, final int fromIndex, final int toIndex, final Comparator<? super T> cmp) - Summary: Finds the median value(s) from a subcollection of objects defined by the specified range using a custom comparator for ordering.
-
Contract:
- <p> The median represents the middle value(s) when the subcollection elements are arranged in sorted order according to the provided comparator.
- If using natural ordering (null comparator) or a comparator that does not handle nulls, a {@code NullPointerException} may be thrown during comparison.
-
Parameters:
-
source(Collection<? extends T>) — the collection of objects to find the median from. Must not be {@code null} . -
fromIndex(int) — the starting index (inclusive) of the range within the collection to consider. Must be non-negative and less than or equal to toIndex. -
toIndex(int) — the ending index (exclusive) of the range within the collection to consider. Must be greater than fromIndex and not exceed collection size. -
cmp(Comparator<? super T>) — the comparator to use for ordering the elements. If {@code null} , natural ordering is used. The comparator must be consistent with equals for predictable results.
-
- Returns: a {@code Pair} containing the median value(s). For odd-size subcollections, the {@code left} contains the median and {@code right} is empty. For even-size subcollections, the {@code left} contains the smaller median and {@code right} contains the larger median.
- See also: #of(Collection, Comparator), #of(Collection, int, int)
Public Instance Methods
- (none)
Enum MergeResult (com.landawn.abacus.util.MergeResult)
An enumeration representing the result of a merge operation between two values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
minFirst(...) -> MergeResult
-
Signature:
public static <T extends Comparable<? super T>> MergeResult minFirst(final T a, final T b) - Summary: Compares two comparable values and returns a MergeResult indicating which value is smaller (or equal).
-
Contract:
- If the first value is less than or equal to the second, {@link #TAKE_FIRST} is returned; otherwise, {@link #TAKE_SECOND} is returned.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare
-
- Returns: {@link #TAKE_FIRST} if a is less than or equal to b, {@link #TAKE_SECOND} otherwise
-
Signature:
public static <T> MergeResult minFirst(final T a, final T b, final Comparator<? super T> cmp) - Summary: Compares two values using the provided comparator and returns a MergeResult indicating which value is smaller (or equal).
-
Contract:
- <p> If the comparator determines that the first value is less than or equal to the second, {@link #TAKE_FIRST} is returned; otherwise, {@link #TAKE_SECOND} is returned.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare -
cmp(Comparator<? super T>) — the comparator to use for comparison
-
- Returns: {@link #TAKE_FIRST} if a is less than or equal to b, {@link #TAKE_SECOND} otherwise
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> BiFunction<T, T, MergeResult> minFirst() - Summary: Returns a BiFunction that compares two comparable values and returns the MergeResult indicating which is smaller.
-
Contract:
- This is useful when you need to pass a merge strategy to methods that accept BiFunctions.
-
Parameters:
- (none)
- Returns: a BiFunction that returns {@link #TAKE_FIRST} if first is less than or equal to second, {@link #TAKE_SECOND} otherwise
-
Signature:
public static <T> BiFunction<T, T, MergeResult> minFirst(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a BiFunction that compares two values using the provided comparator and returns the MergeResult indicating which is smaller.
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparison (must not be null)
-
- Returns: a BiFunction that uses the comparator to determine merge results
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
maxFirst(...) -> MergeResult
-
Signature:
public static <T extends Comparable<? super T>> MergeResult maxFirst(final T a, final T b) - Summary: Compares two comparable values and returns a MergeResult indicating which value is larger (or equal).
-
Contract:
- If the first value is greater than or equal to the second, {@link #TAKE_FIRST} is returned; otherwise, {@link #TAKE_SECOND} is returned.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare
-
- Returns: {@link #TAKE_FIRST} if a is less than or equal to b, {@link #TAKE_SECOND} otherwise
-
Signature:
public static <T> MergeResult maxFirst(final T a, final T b, final Comparator<? super T> cmp) - Summary: Compares two values using the provided comparator and returns a MergeResult indicating which value is larger (or equal).
-
Contract:
- <p> If the comparator determines that the first value is greater than or equal to the second, {@link #TAKE_FIRST} is returned; otherwise, {@link #TAKE_SECOND} is returned.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare -
cmp(Comparator<? super T>) — the comparator to use for comparison
-
- Returns: {@link #TAKE_FIRST} if a is less than or equal to b, {@link #TAKE_SECOND} otherwise
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> BiFunction<T, T, MergeResult> maxFirst() - Summary: Returns a BiFunction that compares two comparable values and returns the MergeResult indicating which is larger.
-
Contract:
- This is useful when you need to pass a merge strategy to methods that accept BiFunctions.
-
Parameters:
- (none)
- Returns: a BiFunction that returns {@link #TAKE_FIRST} if first is greater than or equal to second, {@link #TAKE_SECOND} otherwise
-
Signature:
public static <T> BiFunction<T, T, MergeResult> maxFirst(final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a BiFunction that compares two values using the provided comparator and returns the MergeResult indicating which is larger.
-
Parameters:
-
cmp(Comparator<? super T>) — the comparator to use for comparison (must not be null)
-
- Returns: a BiFunction that uses the comparator to determine merge results
-
Throws:
-
java.lang.IllegalArgumentException— if cmp is null
-
alternate(...) -> BiFunction<T, T, MergeResult>
-
Signature:
@Deprecated @Beta @SequentialOnly @Stateful public static <T> BiFunction<T, T, MergeResult> alternate() - Summary: Returns a stateful BiFunction that alternates between returning TAKE_FIRST and TAKE_SECOND on successive calls.
-
Contract:
- It should not be: </p> <ul> <li> Cached or reused across different operations </li> <li> Used in parallel streams </li> <li> Shared between threads </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code BiFunction<String, String, MergeResult> alternator = MergeResult.alternate(); alternator.apply("a", "b"); // returns TAKE_FIRST alternator.apply("c", "d"); // returns TAKE_SECOND alternator.apply("e", "f"); // returns TAKE_FIRST } </pre>
-
Parameters:
- (none)
- Returns: a stateful BiFunction that alternates between merge results
- See also: Fn#alternate()
Public Instance Methods
- (none)
Enum Month (com.landawn.abacus.util.Month)
An enumeration representing the twelve months of the Gregorian calendar.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> Month
-
Signature:
public static Month valueOf(final int intValue) - Summary: Returns the Month enum constant corresponding to the specified numeric value.
-
Contract:
- This is useful when working with legacy code or external systems that use numeric month representations.
-
Parameters:
-
intValue(int) — the numeric value of the month (must be between 1 and 12 inclusive)
-
- Returns: the Month enum constant corresponding to the specified value
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the numeric value of this month.
-
Parameters:
- (none)
- Returns: the numeric value of this month (1-12)
Class MoreExecutors (com.landawn.abacus.util.MoreExecutors)
Factory and utility methods for {@link java.util.concurrent.Executor} , {@link ExecutorService} , and {@link ThreadFactory} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getExitingExecutorService(...) -> ExecutorService
-
Signature:
public static ExecutorService getExitingExecutorService(final ThreadPoolExecutor executor) - Summary: Converts the given ThreadPoolExecutor into an ExecutorService that exits when the JVM exits.
-
Contract:
- Converts the given ThreadPoolExecutor into an ExecutorService that exits when the JVM exits.
-
Parameters:
-
executor(ThreadPoolExecutor) — the executor to modify
-
- Returns: an unconfigurable ExecutorService that will shut down on JVM exit
- See also: #getExitingExecutorService(ThreadPoolExecutor, long, TimeUnit)
-
Signature:
public static ExecutorService getExitingExecutorService(final ThreadPoolExecutor executor, final long terminationTimeout, final TimeUnit timeUnit) - Summary: Converts the given ThreadPoolExecutor into an ExecutorService that exits when the JVM exits, with a custom termination timeout.
-
Contract:
- Converts the given ThreadPoolExecutor into an ExecutorService that exits when the JVM exits, with a custom termination timeout.
- If the executor doesn't terminate within the timeout, the shutdown hook will exit anyway.
-
Parameters:
-
executor(ThreadPoolExecutor) — the executor to modify -
terminationTimeout(long) — the maximum time to wait for the executor to terminate -
timeUnit(TimeUnit) — the time unit for the termination timeout
-
- Returns: an unconfigurable ExecutorService that will shut down on JVM exit
getExitingScheduledExecutorService(...) -> ScheduledExecutorService
-
Signature:
public static ScheduledExecutorService getExitingScheduledExecutorService(final ScheduledThreadPoolExecutor executor) - Summary: Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the JVM exits.
-
Contract:
- Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the JVM exits.
-
Parameters:
-
executor(ScheduledThreadPoolExecutor) — the scheduled executor to modify
-
- Returns: an unconfigurable ScheduledExecutorService that will shut down on JVM exit
- See also: #getExitingScheduledExecutorService(ScheduledThreadPoolExecutor, long, TimeUnit)
-
Signature:
public static ScheduledExecutorService getExitingScheduledExecutorService(final ScheduledThreadPoolExecutor executor, final long terminationTimeout, final TimeUnit timeUnit) - Summary: Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the JVM exits, with a custom termination timeout.
-
Contract:
- Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the JVM exits, with a custom termination timeout.
- If the executor doesn't terminate within the timeout, the shutdown hook will exit anyway.
-
Parameters:
-
executor(ScheduledThreadPoolExecutor) — the scheduled executor to modify -
terminationTimeout(long) — the maximum time to wait for the executor to terminate -
timeUnit(TimeUnit) — the time unit for the termination timeout
-
- Returns: an unconfigurable ScheduledExecutorService that will shut down on JVM exit
addDelayedShutdownHook(...) -> void
-
Signature:
public static void addDelayedShutdownHook(final ExecutorService service, final long terminationTimeout, final TimeUnit timeUnit) throws IllegalArgumentException - Summary: Adds a shutdown hook that will attempt to shut down the given ExecutorService when the JVM exits.
-
Contract:
- Adds a shutdown hook that will attempt to shut down the given ExecutorService when the JVM exits.
-
Parameters:
-
service(ExecutorService) — the executor service to shut down on JVM exit -
terminationTimeout(long) — the maximum time to wait for the executor to terminate -
timeUnit(TimeUnit) — the time unit for the termination timeout
-
-
Throws:
-
java.lang.IllegalArgumentException— if service or timeUnit is null
-
Public Instance Methods
- (none)
Class Multimap (com.landawn.abacus.util.Multimap)
A collection that maps keys to multiple values, similar to {@link Map} but allowing each key to be associated with a collection of values rather than a single value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> V
-
Signature:
public V get(final Object key) - Summary: Returns the collection of values associated with the specified key.
-
Contract:
- <p> <b> IMPORTANT - Null vs Empty Behavior: </b> </p> <ul> <li> If the key has never been added: returns {@code null} </li> <li> If all values for the key have been removed: returns {@code null} (key is removed from map) </li> <li> If the key exists with values: returns mutable collection </li> </ul> <p> <b> This is DIFFERENT from Guava's Multimap </b> which returns an empty collection for absent keys.
- Usually, the returned collection should not be modified outside this Multimap directly, because it may cause unexpected behavior.
-
Parameters:
-
key(Object) — the key whose associated values are to be returned
-
- Returns: the mutable collection of values for the key, or {@code null} if the key is not present
- See also: #containsKey(Object), #getOrDefault(Object, Collection)
getOrDefault(...) -> V
-
Signature:
public V getOrDefault(final Object key, final V defaultValue) - Summary: Returns the value collection associated with the specified key in the Multimap, or the provided default value if no value is found.
-
Contract:
- Returns the value collection associated with the specified key in the Multimap, or the provided default value if no value is found.
- Usually, the returned collection should not be modified outside this Multimap directly, because it may cause unexpected behavior.
-
Parameters:
-
key(Object) — the key whose associated value collection is to be returned -
defaultValue(V) — the default value to return if no value is associated with the key
-
- Returns: the value collection associated with the specified key, or the default value if the key is not present in the Multimap
- See also: #get(Object)
put(...) -> boolean
-
Signature:
public boolean put(final K key, final E e) - Summary: Associates the specified value with the specified key in this Multimap.
-
Contract:
- <p> If the key is not already present in the Multimap, a new collection is created for the key using the configured value supplier, and the value is added to it.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
e(E) — the value to be associated with the specified key
-
- Returns: {@code true} if the value was successfully added to the collection, {@code false} if the collection does not permit duplicates and already contains the value
- See also: #putIfValueAbsent(Object, Object), #putValues(Object, Collection)
putAll(...) -> boolean
-
Signature:
public boolean putAll(final Map<? extends K, ? extends E> m) - Summary: Associates all the specified keys and values from the provided map to this Multimap.
-
Contract:
- If the Multimap previously contained mappings for a key, the new value is added to the collection of values associated with this key.
-
Parameters:
-
m(Map<? extends K, ? extends E>) — the map whose keys and values are to be added to this Multimap
-
- Returns: {@code true} if the operation modifies the Multimap, {@code false} otherwise
- See also: #put(Object, Object), #putValues(Object, Collection)
putIfValueAbsent(...) -> boolean
-
Signature:
public boolean putIfValueAbsent(final K key, final E e) - Summary: Associates the specified value with the specified key only if the value is not already present.
-
Contract:
- Associates the specified value with the specified key only if the value is not already present.
- <p> The method behaves as follows: </p> <ul> <li> If the key is not present, creates a new collection and adds the value </li> <li> If the key is present but the value is not in its collection, adds the value </li> <li> If the key is present and the value already exists in its collection, does nothing </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code SetMultimap<String, Integer> multimap = N.newSetMultimap(); multimap.putIfValueAbsent("numbers", 1); // Returns true, adds 1 multimap.putIfValueAbsent("numbers", 1); // Returns false, 1 already exists multimap.putIfValueAbsent("numbers", 2); // Returns true, adds 2 } </pre>
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
e(E) — the value to be associated with the specified key if not already present
-
- Returns: {@code true} if the value was added (either to a new or existing collection), {@code false} if the value already existed in the key's collection
- See also: #putIfKeyAbsent(Object, Object), #put(Object, Object)
putIfKeyAbsent(...) -> boolean
-
Signature:
public boolean putIfKeyAbsent(final K key, final E e) - Summary: Associates the specified value with the specified key only if the key is not already present.
-
Contract:
- Associates the specified value with the specified key only if the key is not already present.
- This method is useful when you want to ensure a key is only initialized once, regardless of how many values might be added to it later.
-
Parameters:
-
key(K) — the key with which the specified value is to be associated -
e(E) — the value to be associated with the specified key
-
- Returns: {@code true} if the key was not present and a new mapping was created, {@code false} if the key was already present (value is not added)
- See also: #putIfValueAbsent(Object, Object), #put(Object, Object)
putValues(...) -> boolean
-
Signature:
public boolean putValues(final K key, final Collection<? extends E> c) - Summary: Associates all values from the provided collection with the specified key in this Multimap.
-
Contract:
- <p> If the key already exists, the values are added to its existing collection.
- If the key doesn't exist, a new collection is created and populated with the values.
-
Parameters:
-
key(K) — the key with which the specified values are to be associated -
c(Collection<? extends E>) — the collection of values to be associated with the specified key
-
- Returns: {@code true} if any values were added to the Multimap, {@code false} if the collection was empty or no values were added
- See also: #put(Object, Object), #putValuesIfKeyAbsent(Object, Collection), Collection#addAll(Collection)
-
Signature:
public boolean putValues(final Map<? extends K, ? extends Collection<? extends E>> m) - Summary: Associates all the specified keys and their corresponding collections of values from the provided map to this Multimap.
-
Contract:
- If the Multimap previously contained mappings for a key, the new values are added to the collection of values associated with this key.
-
Parameters:
-
m(Map<? extends K, ? extends Collection<? extends E>>) — the map whose keys and collections of values are to be added to this Multimap
-
- Returns: {@code true} if the operation modifies the Multimap, {@code false} otherwise
- See also: #putAll(Map), #putValues(Object, Collection)
-
Signature:
public boolean putValues(final Multimap<? extends K, ? extends E, ? extends Collection<? extends E>> m) - Summary: Associates all the specified keys and their corresponding collections of values from the provided Multimap to this Multimap.
-
Contract:
- If this Multimap previously contained mappings for a key, the new values are added to the collection of values associated with this key.
-
Parameters:
-
m(Multimap<? extends K, ? extends E, ? extends Collection<? extends E>>) — the Multimap whose keys and collections of values are to be added to this Multimap
-
- Returns: {@code true} if the operation modifies the Multimap, {@code false} otherwise
- See also: #putAll(Map), #putValues(Map)
putValuesIfKeyAbsent(...) -> boolean
-
Signature:
public boolean putValuesIfKeyAbsent(final K key, final Collection<? extends E> c) - Summary: Associates all the specified values from the provided collection with the specified key in this Multimap if the key is not already present.
-
Contract:
- Associates all the specified values from the provided collection with the specified key in this Multimap if the key is not already present.
- If the key is already present, this method does nothing.
-
Parameters:
-
key(K) — the key with which the specified values are to be associated -
c(Collection<? extends E>) — the collection of values to be associated with the specified key
-
- Returns: {@code true} if the key was not already present and the association was successfully added, {@code false} otherwise if the key is already present or the specified value collection is empty
- See also: #putIfKeyAbsent(Object, Object), #putValues(Object, Collection)
removeEntry(...) -> boolean
-
Signature:
public boolean removeEntry(final Object key, final Object e) - Summary: Removes a single occurrence of the specified value from the collection associated with the given key.
-
Contract:
- <p> If the removal leaves the key with an empty collection, the key itself is removed from the Multimap to maintain consistency.
-
Parameters:
-
key(Object) — the key whose associated collection is to be modified -
e(Object) — the element to be removed from the collection
-
- Returns: {@code true} if the element was found and removed, {@code false} if the key was not found or the element was not in the collection
- See also: #removeAll(Object), #removeValues(Object, Collection)
removeEntries(...) -> boolean
-
Signature:
public boolean removeEntries(final Map<? extends K, ? extends E> m) - Summary: Removes a single occurrence of each specified key-value pair from this Multimap.
-
Contract:
- If the key-value pair is successfully removed and the collection of values associated with the key becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
m(Map<? extends K, ? extends E>) — the map whose key-value pairs are to be removed from this Multimap
-
- Returns: {@code true} if at least one key-value pair was successfully removed from the Multimap, {@code false} otherwise
- See also: #removeEntry(Object, Object), #removeValues(Object, Collection)
removeAll(...) -> V
-
Signature:
public V removeAll(final Object key) - Summary: Removes all values associated with the specified key from this Multimap.
-
Parameters:
-
key(Object) — the key whose entire mapping is to be removed
-
- Returns: the collection of values that were associated with the key, or {@code null} if the key was not present in the Multimap
- See also: #removeEntry(Object, Object), #clear()
removeValues(...) -> boolean
-
Signature:
public boolean removeValues(final Object key, final Collection<?> valuesToRemove) - Summary: Removes all occurrences of the specified elements from the collection of values associated with the specified key in this Multimap.
-
Contract:
- If the elements are successfully removed and the collection becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
key(Object) — the key whose associated collection of values is to be processed -
valuesToRemove(Collection<?>) — the collection of elements to be removed from the collection of values associated with the specified key
-
- Returns: {@code true} if at least one element was successfully removed from the collection of values associated with the specified key, {@code false} otherwise
- See also: #removeValues(Map), #removeValues(Multimap)
-
Signature:
public boolean removeValues(final Map<?, ? extends Collection<?>> m) - Summary: Removes all occurrences of the specified elements from the collections of values associated with their respective keys in this Multimap.
-
Contract:
- If the elements are successfully removed and the collection becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
m(Map<?, ? extends Collection<?>>) — the map whose keys and collections of elements are to be removed from this Multimap
-
- Returns: {@code true} if at least one element was successfully removed from the collections of values associated with the specified keys, {@code false} otherwise
- See also: #removeValues(Object, Collection), #removeValues(Multimap)
-
Signature:
public boolean removeValues(final Multimap<?, ?, ?> m) - Summary: Removes all occurrences of the specified elements from the collections of values associated with their respective keys in this Multimap.
-
Contract:
- If the elements are successfully removed and the collection becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
m(Multimap<?, ?, ?>) — the Multimap whose keys and collections of elements are to be removed from this Multimap
-
- Returns: {@code true} if at least one element was successfully removed from the collections of values associated with the specified keys, {@code false} otherwise
- See also: #removeValues(Object, Collection), #removeValues(Map)
removeEntriesIf(...) -> boolean
-
Signature:
public boolean removeEntriesIf(final Predicate<? super K> keyPredicate, final E value) - Summary: Removes a single occurrence of the specified value from all collections where the key satisfies the given predicate.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — the predicate that determines which keys to process -
value(E) — the value to be removed from matching collections
-
- Returns: {@code true} if at least one value was removed from any collection, {@code false} if no values were removed (either no keys matched or value not found)
- See also: #removeEntry(Object, Object), #removeValuesIf(Predicate, Collection)
-
Signature:
public boolean removeEntriesIf(final BiPredicate<? super K, ? super V> entryPredicate, final E value) - Summary: Removes a single occurrence of the specified value from the collections of values associated with keys that satisfy the specified predicate.
-
Contract:
- If the predicate returns {@code true} , it retrieves the collection of values associated with the key and attempts to remove a single occurrence of the specified value from it.
- If the value is successfully removed and the collection becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
entryPredicate(BiPredicate<? super K, ? super V>) — The predicate to be applied to each key-value pair in the Multimap. -
value(E) — The value to be removed from the collections of values associated with the keys that satisfy the predicate.
-
- Returns: {@code true} if at least one value was successfully removed from the collections of values associated with the keys that satisfy the predicate, {@code false} otherwise.
- See also: Collection#remove(Object)
removeValuesIf(...) -> boolean
-
Signature:
public boolean removeValuesIf(final Predicate<? super K> keyPredicate, final Collection<?> valuesToRemove) - Summary: Removes all occurrences of the specified values from collections where the key satisfies the given predicate.
-
Contract:
- If all values are removed from a key's collection, the key is removed from the Multimap.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — the predicate that determines which keys to process -
valuesToRemove(Collection<?>) — the collection of values to remove from matching collections
-
- Returns: {@code true} if any values were removed from any collection, {@code false} if no changes were made (no keys matched, values not found, or values collection empty)
- See also: #removeValues(Object, Collection), #removeKeysIf(Predicate)
-
Signature:
public boolean removeValuesIf(final BiPredicate<? super K, ? super V> entryPredicate, final Collection<?> valuesToRemove) - Summary: Removes all occurrences of the specified elements from the collections of values associated with keys that satisfy the specified predicate.
-
Contract:
- If the predicate returns {@code true} , it retrieves the collection of values associated with the key and attempts to remove all occurrences of the elements from it.
- If the elements are successfully removed and the collection becomes empty as a result, the key is also removed from the Multimap.
-
Parameters:
-
entryPredicate(BiPredicate<? super K, ? super V>) — The predicate to be applied to each key-value pair in the Multimap. -
valuesToRemove(Collection<?>) — The collection of elements to be removed from the collections of values associated with the keys that satisfy the predicate.
-
- Returns: {@code true} if at least one element was successfully removed from the collections of values associated with the keys that satisfy the predicate, {@code false} otherwise.
- See also: Collection#removeAll(Collection)
removeKeysIf(...) -> boolean
-
Signature:
public boolean removeKeysIf(final Predicate<? super K> keyPredicate) - Summary: Removes all entries (keys and their associated value collections) where the key satisfies the given predicate.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — the predicate that determines which entries to remove
-
- Returns: {@code true} if any entries were removed from the Multimap, {@code false} if no entries matched the predicate
- See also: #removeAll(Object), #removeKeysIf(BiPredicate)
-
Signature:
public boolean removeKeysIf(final BiPredicate<? super K, ? super V> entryPredicate) - Summary: Removes all entries where both the key and its value collection satisfy the given predicate.
-
Parameters:
-
entryPredicate(BiPredicate<? super K, ? super V>) — the bi-predicate that accepts a key and its value collection
-
- Returns: {@code true} if any entries were removed, {@code false} if no entries matched
- See also: #removeKeysIf(Predicate)
replaceEntry(...) -> boolean
-
Signature:
public boolean replaceEntry(final K key, final E oldValue, final E newValue) throws IllegalStateException - Summary: Replaces the first occurrence of an old value with a new value in the collection associated with the given key.
-
Parameters:
-
key(K) — the key whose value collection should be modified -
oldValue(E) — the value to be replaced (can be null) -
newValue(E) — the value to replace with (can be null)
-
- Returns: {@code true} if the old value was found and replaced, {@code false} if the key doesn't exist or old value not found
-
Throws:
-
java.lang.IllegalStateException— if the collection rejects the new value (e.g., Set-based multimap where newValue already exists)
-
- See also: #replaceValues(Object, Collection), #replaceEntriesIf(Predicate, Object, Object)
replaceEntriesIf(...) -> boolean
-
Signature:
public boolean replaceEntriesIf(final Predicate<? super K> keyPredicate, final E oldValue, final E newValue) throws IllegalStateException - Summary: Replaces one occurrence of an old value with a new value in all collections where the key matches the predicate.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — the predicate to test each key -
oldValue(E) — the value to be replaced in matching collections -
newValue(E) — the replacement value
-
- Returns: {@code true} if at least one replacement was made, {@code false} if no keys matched or old value was not found
-
Throws:
-
java.lang.IllegalStateException— if the new value cannot be added to any collection
-
- See also: #replaceEntry(Object, Object, Object), #replaceValuesIf(Predicate, Collection)
-
Signature:
public boolean replaceEntriesIf(final BiPredicate<? super K, ? super V> entryPredicate, final E oldValue, final E newValue) throws IllegalStateException - Summary: Replaces a single occurrence of the specified old value with the new value for keys that satisfy the specified predicate in this Multimap.
-
Contract:
- If the predicate returns {@code true} , it retrieves the collection of values associated with the key and attempts to replace a single occurrence of the old value with the new value.
- If the old value is successfully replaced, the method returns {@code true} .
- If the old value is not found in the collection of values associated with the key, the method returns {@code false} .
-
Parameters:
-
entryPredicate(BiPredicate<? super K, ? super V>) — The predicate to be applied to each key-value pair in the Multimap. -
oldValue(E) — The old value to be replaced in the collections of values associated with the keys that satisfy the predicate. -
newValue(E) — The new value to replace the old value in the collections of values associated with the keys that satisfy the predicate.
-
- Returns: {@code true} if at least one old value was successfully replaced in the collections of values associated with the keys that satisfy the predicate, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalStateException— if the new value cannot be added to the collection associated with the specified key that satisfy the predicate.
-
replaceValues(...) -> boolean
-
Signature:
public boolean replaceValues(final K key, final Collection<? extends E> newValues) throws IllegalStateException - Summary: Replaces all values associated with the specified key with a collection of new values.
-
Contract:
- <p> If {@code newValues} is {@code null} or empty, the specified key removed from this Multimap.
-
Parameters:
-
key(K) — the key whose entire value collection should be replaced -
newValues(Collection<? extends E>) — the new values that will replace all existing values
-
- Returns: {@code true} if the key existed and replacement was performed, {@code false} if the key was not present in the Multimap
-
Throws:
-
java.lang.IllegalStateException— if the new value cannot be added to the collection (this is rare but could happen with custom collection implementations)
-
- See also: #replaceEntry(Object, Object, Object), #put(Object, Object)
replaceValuesIf(...) -> boolean
-
Signature:
public boolean replaceValuesIf(final Predicate<? super K> keyPredicate, final Collection<? extends E> newValues) throws IllegalStateException - Summary: Replaces the entire value collection for keys that satisfy the specified predicate.
-
Contract:
- <p> If {@code newValues} is {@code null} or empty, matching keys are removed from this Multimap.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — the predicate to be applied to each key in the Multimap -
newValues(Collection<? extends E>) — the replacement values; if empty, matching keys are removed
-
- Returns: {@code true} if at least one key was updated or removed, {@code false} otherwise
-
Throws:
-
java.lang.IllegalStateException— if the new values cannot be added to the collection for a matching key
-
-
Signature:
public boolean replaceValuesIf(final BiPredicate<? super K, ? super V> entryPredicate, final Collection<? extends E> newValues) throws IllegalStateException - Summary: Replaces the entire value collection for keys whose key-value collections satisfy the specified predicate.
-
Contract:
- <p> If {@code newValues} is {@code null} or empty, matching keys are removed from this Multimap.
-
Parameters:
-
entryPredicate(BiPredicate<? super K, ? super V>) — the predicate to be applied to each key-value collection in the Multimap -
newValues(Collection<? extends E>) — the replacement values; if empty, matching keys are removed
-
- Returns: {@code true} if at least one key was updated or removed, {@code false} otherwise
-
Throws:
-
java.lang.IllegalStateException— if the new values cannot be added to the collection for a matching key
-
replaceAll(...) -> void
-
Signature:
public void replaceAll(final BiFunction<? super K, ? super V, ? extends V> function) throws IllegalStateException - Summary: Replaces all values associated with each key in this Multimap according to the provided function.
-
Contract:
- The function should return a new collection of values that will replace the old collection associated with the key.
- If the function returns {@code null} or an empty collection, the key is removed from the Multimap.
-
Parameters:
-
function(BiFunction<? super K, ? super V, ? extends V>) — The function to be applied to each key-value pair in the Multimap. It should return a new collection of values.
-
-
Throws:
-
java.lang.IllegalStateException— if the new collection of values cannot be added to the Multimap.
-
computeIfAbsent(...) -> V
-
Signature:
public V computeIfAbsent(final K key, final Function<? super K, ? extends V> mappingFunction) throws IllegalArgumentException - Summary: Computes and associates a value collection for the specified key if it's not already present.
-
Contract:
- Computes and associates a value collection for the specified key if it's not already present.
- This method implements lazy initialization for Multimap entries, computing values only when needed.
- <p> If the key already has an associated value collection, that existing collection is returned without calling the mapping function.
- </p> <p> If the mapping function returns {@code null} or an empty collection, no entry is created, and the method returns {@code null} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, String> multimap = N.newListMultimap(); // Initialize default permissions for new users multimap.computeIfAbsent("user123", key -> new ArrayList<>(Arrays.asList("read", "write"))); // Won't overwrite existing values multimap.put("admin", "super"); multimap.computeIfAbsent("admin", key -> Arrays.asList("basic")); // Returns existing \["super"\] // Compute based on key properties multimap.computeIfAbsent("guest_temp", key -> { if (key.startsWith("guest_")) { return Arrays.asList("read-only"); } return Arrays.asList("read", "write"); }); } </pre> <p> <b> Thread Safety: </b> This operation is not atomic.
-
Parameters:
-
key(K) — the key for which to compute an initial value collection -
mappingFunction(Function<? super K, ? extends V>) — the function to compute the initial collection, called only if key is absent
-
- Returns: the existing collection if key was present, or the newly computed and stored collection, or {@code null} if the mapping function returned null/empty
-
Throws:
-
java.lang.IllegalArgumentException— if the mappingFunction is null
-
- See also: #computeIfPresent(Object, BiFunction), #compute(Object, BiFunction)
computeIfPresent(...) -> V
-
Signature:
public V computeIfPresent(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) throws IllegalArgumentException - Summary: Updates the value collection for the specified key using a remapping function, but only if the key is present.
-
Contract:
- Updates the value collection for the specified key using a remapping function, but only if the key is present.
- <p> If the key is not present, this method does nothing and returns {@code null} .
- </p> <p> If the remapping function returns {@code null} or an empty collection, the entire mapping (key and its collection) is removed from the Multimap.
-
Parameters:
-
key(K) — the key whose value collection should be remapped -
remappingFunction(BiFunction<? super K, ? super V, ? extends V>) — the function that computes a new collection based on key and current collection
-
- Returns: the updated collection, or {@code null} if the key was not present or the function returned null/empty
-
Throws:
-
java.lang.IllegalArgumentException— if the remappingFunction is null
-
- See also: #computeIfAbsent(Object, Function), #compute(Object, BiFunction)
compute(...) -> V
-
Signature:
public V compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) throws IllegalArgumentException - Summary: Computes the value for the specified key using the given remapping function.
-
Contract:
- If the remapping function returns {@code null} or an empty collection, the key is removed from the Multimap.
- If the key is not already associated with a value in the Multimap, this method associates the key with the new value returned by the remapping function.
- If the remapping function returns {@code null} or an empty collection, the key is removed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("numbers", Arrays.asList(1, 2, 3)); // Add 10 to all values or create new list with 10 multimap.compute("numbers", (key, values) -> { if (values == null) { return Arrays.asList(10); } List<Integer> result = new ArrayList<>(); for (Integer v : values) { result.add(v + 10); } return result; }); // multimap now contains: {numbers=\[11, 12, 13\]} } </pre>
-
Parameters:
-
key(K) — The key whose associated value is to be computed. -
remappingFunction(BiFunction<? super K, ? super V, ? extends V>) — The function to compute a value.
-
- Returns: The new value associated with the specified key, or {@code null} if the remapping function returns {@code null} or an empty collection.
-
Throws:
-
java.lang.IllegalArgumentException— if the remappingFunction is {@code null} .
-
merge(...) -> V
-
Signature:
public <C extends Collection<? extends E>> V merge(final K key, final C elements, final BiFunction<? super V, ? super C, ? extends V> remappingFunction) throws IllegalArgumentException - Summary: Merges a collection of elements with the existing values for a key using a custom merging function.
-
Contract:
- <p> The merge operation works as follows: </p> <ul> <li> If the key doesn't exist, the elements are added directly and the resulting collection is returned </li> <li> If the key exists, the remapping function receives the current collection and the new elements, allowing you to define custom merge logic (e.g., union, intersection, custom filtering) </li> <li> If the function returns {@code null} or an empty collection, the key is removed from the Multimap </li> <li> If the function returns the same collection instance (oldValue == newValue), no update occurs </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("numbers", Arrays.asList(1, 2, 3)); // Union: add all new elements to existing ones multimap.merge("numbers", Arrays.asList(4, 5), (oldVals, newVals) -> { List<Integer> result = new ArrayList<>(oldVals); result.addAll(newVals); return result; }); // "numbers" -> \[1, 2, 3, 4, 5\] // Custom logic: only keep values > 10 multimap.merge("scores", Arrays.asList(15, 8, 22), (oldVals, newVals) -> { List<Integer> combined = new ArrayList<>(oldVals); combined.addAll(newVals); return combined.stream().filter(v -> v > 10).collect(java.util.stream.Collectors.toList()); }); // Remove key if function returns empty multimap.merge("temp", Arrays.asList(1, 2), (old, neu) -> Collections.emptyList()); // "temp" key is removed } </pre>
-
Parameters:
-
key(K) — the key whose value should be merged with the elements -
elements(C) — the collection of elements to merge with existing values -
remappingFunction(BiFunction<? super V, ? super C, ? extends V>) — the function that defines how to merge old and new collections
-
- Returns: the updated collection associated with the key, or {@code null} if the key was removed
-
Throws:
-
java.lang.IllegalArgumentException— if remappingFunction or elements is null
-
- See also: #merge(Object, Object, BiFunction), #compute(Object, BiFunction)
-
Signature:
public V merge(final K key, final E e, final BiFunction<? super V, ? super E, ? extends V> remappingFunction) throws IllegalArgumentException - Summary: Merges a single element with the existing values for a key using a custom merging function.
-
Contract:
- <p> The merge operation works as follows: </p> <ul> <li> If the key doesn't exist, the element is added directly and the resulting collection is returned </li> <li> If the key exists, the remapping function receives the current collection and the new element, allowing custom logic to determine the final collection state </li> <li> If the function returns {@code null} or an empty collection, the key is removed </li> <li> If the function returns the same collection instance, no update occurs (optimization) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("scores", Arrays.asList(85, 92, 78)); // Add element if it improves the average multimap.merge("scores", 95, (oldVals, newVal) -> { double currentAvg = oldVals.stream().mapToInt(Integer::intValue).average().orElse(0); if (newVal > currentAvg) { List<Integer> updated = new ArrayList<>(oldVals); updated.add(newVal); return updated; } return oldVals; // Don't add if below average }); // Replace all if new value meets condition multimap.merge("threshold", 100, (oldVals, newVal) -> { if (newVal > 50) { return Arrays.asList(newVal); // Replace all } return oldVals; // Keep existing }); } </pre>
-
Parameters:
-
key(K) — the key whose value should be merged with the element -
e(E) — the element to merge with existing values -
remappingFunction(BiFunction<? super V, ? super E, ? extends V>) — the function that defines how to merge the collection with the new element
-
- Returns: the updated collection associated with the key, or {@code null} if the key was removed
-
Throws:
-
java.lang.IllegalArgumentException— if remappingFunction or e is null
-
- See also: #merge(Object, Collection, BiFunction), #compute(Object, BiFunction)
invert(...) -> M
-
Signature:
public <VV extends Collection<K>, M extends Multimap<E, K, VV>> M invert(final IntFunction<? extends M> multimapSupplier) - Summary: Creates an inverted Multimap where keys and values are swapped.
-
Parameters:
-
multimapSupplier(IntFunction<? extends M>) — factory function that creates the target Multimap type, receives the size of this Multimap as a hint
-
- Returns: a new inverted Multimap with keys and values swapped
- Performance: <p> In the resulting Multimap: </p> <ul> <li> Each value from the original collections becomes a key </li> <li> Each original key becomes a value in the new collections </li> <li> If multiple keys had the same value, they all appear in that value's collection </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> original = N.newListMultimap(); original.putValues("group1", Arrays.asList(1, 2, 3)); original.putValues("group2", Arrays.asList(2, 4)); original.put("group3", 1); // Invert: numbers become keys, groups become values ListMultimap<Integer, String> inverted = original.invert(N::newListMultimap); // Result: // 1 -> \["group1", "group3"\] // 2 -> \["group1", "group2"\] // 3 -> \["group1"\] // 4 -> \["group2"\] // Different Multimap types SetMultimap<Integer, String> invertedSet = original.invert(N::newSetMultimap); } </pre> <p> <b> Performance: </b> This operation has O(n) complexity where n is the total number of key-value pairs across all collections.
- See also: #copy()
copy(...) -> Multimap<K, E, V>
-
Signature:
public Multimap<K, E, V> copy() - Summary: Creates a shallow copy of this Multimap with the same structure and contents.
-
Parameters:
- (none)
- Returns: a new Multimap containing the same key-value mappings as this one
- See also: #invert(IntFunction)
containsEntry(...) -> boolean
-
Signature:
public boolean containsEntry(final Object key, final Object e) - Summary: Tests whether this Multimap contains the specified key-value pair.
-
Parameters:
-
key(Object) — the key to check for -
e(Object) — the value to check for in the key's collection
-
- Returns: {@code true} if the key exists and its collection contains the specified value, {@code false} otherwise
- See also: #containsKey(Object), #containsValue(Object)
containsKey(...) -> boolean
-
Signature:
public boolean containsKey(final Object key) - Summary: Tests whether this Multimap contains the specified key.
-
Contract:
- Returns {@code true} even if the key is associated with an empty collection.
-
Parameters:
-
key(Object) — the key to check for
-
- Returns: {@code true} if this Multimap contains the specified key, {@code false} otherwise
- See also: #containsValue(Object), #containsEntry(Object, Object)
containsValue(...) -> boolean
-
Signature:
public boolean containsValue(final Object e) - Summary: Tests whether this Multimap contains the specified value in any of its collections.
-
Parameters:
-
e(Object) — the value to search for across all collections
-
- Returns: {@code true} if any collection in this Multimap contains the specified value, {@code false} if not found or Multimap is empty
- Performance: <p> <b> Performance: </b> This operation is O(n) where n is the total number of values across all collections, as it must check each collection.
- See also: #containsKey(Object), #containsEntry(Object, Object)
forEach(...) -> void
-
Signature:
@Beta public void forEach(final BiConsumer<? super K, ? super E> action) throws IllegalArgumentException - Summary: Performs the given action for each individual key-element pair in this Multimap.
-
Parameters:
-
action(BiConsumer<? super K, ? super E>) — the action to be performed for each key-element pair
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null
-
- Performance: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("group1", Arrays.asList(1, 2, 3)); multimap.putValues("group2", Arrays.asList(4, 5)); // Process each key-element pair individually multimap.forEach((key, element) -> { System.out.println(key + " contains " + element); }); // Output: // group1 contains 1 // group1 contains 2 // group1 contains 3 // group2 contains 4 // group2 contains 5 // Collect all values with their keys Map<String, List<Integer>> collected = new HashMap<>(); multimap.forEach((key, element) -> collected.computeIfAbsent(key, k -> new ArrayList<>()).add(element)); } </pre> <p> <b> Performance: </b> This method processes every individual element, so the time complexity is O(n) where n is the total number of elements across all collections.
- See also: #allValues()
keySet(...) -> Set<K>
-
Signature:
public Set<K> keySet() - Summary: Returns a Set view of the keys contained in this Multimap.
-
Parameters:
- (none)
- Returns: a Set view of the keys contained in this Multimap
- See also: #allValues(), #totalValueCount()
valueCollections(...) -> Collection<V>
-
Signature:
public Collection<V> valueCollections() - Summary: Returns a Collection view of all value collections in this Multimap.
-
Contract:
- <p> <b> Live View: </b> The returned collection is backed by the Multimap and reflects changes, but should not be modified directly as it may cause unexpected behavior.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("evens", Arrays.asList(2, 4, 6)); multimap.putValues("odds", Arrays.asList(1, 3, 5)); Collection<List<Integer>> valueCollections = multimap.valueCollections(); for (List<Integer> collection : valueCollections) { System.out.println("Collection size: " + collection.size()); } } </pre> <p> <b> Note: </b> If you need all individual elements rather than collections, use {@link #allValues()} instead.
-
Parameters:
- (none)
- Returns: a Collection view of the value collections contained in this Multimap
- See also: #keySet(), #allValues()
allValues(...) -> Collection<E>
-
Signature:
public Collection<E> allValues() - Summary: Returns a read-only view collection containing the <i> value </i> from each key-element pair contained in this multimap, without collapsing duplicates (so {@code allValues().size() == totalValueCount()} ).
-
Parameters:
- (none)
- Returns: an unmodifiable collection view of all individual values in this Multimap
- See also: #flatValues(IntFunction), #totalValueCount(), #stream()
flatValues(...) -> C
-
Signature:
@Beta public <C extends Collection<E>> C flatValues(final IntFunction<C> supplier) - Summary: Returns all individual values from all collections in this Multimap in a collection of a specific type.
-
Parameters:
-
supplier(IntFunction<C>) — function that creates the collection, receives total value count as parameter
-
- Returns: a new collection of the specified type containing all values from this Multimap
- See also: #allValues()
entryStream(...) -> EntryStream<K, E>
-
Signature:
public EntryStream<K, E> entryStream() - Summary: Returns an {@link EntryStream} of individual key-element pairs in this Multimap.
-
Parameters:
- (none)
- Returns: an EntryStream of flattened key-element pairs
- See also: #stream(), #forEach(BiConsumer)
stream(...) -> Stream<Map.Entry<K, V>>
-
Signature:
public Stream<Map.Entry<K, V>> stream() - Summary: Returns a Stream of key-collection entries for functional-style operations on this Multimap.
-
Parameters:
- (none)
- Returns: a Stream of key-collection entries from this Multimap
- See also: #entryStream(), #iterator()
iterator(...) -> Iterator<Entry<K, V>>
-
Signature:
@Override public Iterator<Entry<K, V>> iterator() - Summary: Returns an iterator over the key-collection entries in this Multimap.
-
Parameters:
- (none)
- Returns: an iterator over the key-collection entries in this Multimap
- See also: #stream(), #entryStream()
toMultiset(...) -> Multiset<K>
-
Signature:
public Multiset<K> toMultiset() - Summary: Converts this Multimap to a Multiset where each key's count equals the size of its value collection.
-
Contract:
- <p> The conversion works as follows: </p> <ul> <li> Each key from the Multimap becomes an element in the Multiset </li> <li> The count for each key equals the number of values associated with that key </li> <li> If a key has an empty collection, it won't appear in the Multiset (count = 0) </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, String> multimap = N.newListMultimap(); multimap.putValues("user1", Arrays.asList("action1", "action2", "action3")); multimap.putValues("user2", Arrays.asList("action1")); multimap.putValues("user3", Arrays.asList("action1", "action2")); Multiset<String> activityCount = multimap.toMultiset(); // Result: {"user1"=3, "user2"=1, "user3"=2} // Find most active user String mostActive = activityCount.entrySet().stream() .max(Comparator.comparingInt(Multiset.Entry::count)) .map(Multiset.Entry::element) .orElse(null); // Returns "user1" } </pre>
-
Parameters:
- (none)
- Returns: a new Multiset where each key's count equals its value collection size
- See also: #toMap(), Multiset
toMap(...) -> Map<K, V>
-
Signature:
public Map<K, V> toMap() - Summary: Converts this Multimap to a standard Map with independent collection copies.
-
Contract:
- <p> The returned Map: </p> <ul> <li> Has the same type as the backing map (e.g., HashMap if backed by HashMap) </li> <li> Contains copies of all value collections (not references to original collections) </li> <li> Is completely independent - changes to either the Map or Multimap don't affect each other </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("group1", Arrays.asList(1, 2, 3)); multimap.putValues("group2", Arrays.asList(4, 5)); Map<String, List<Integer>> map = multimap.toMap(); map.get("group1").add(99); // Only affects the map, not the multimap multimap.put("group1", 100); // Only affects the multimap, not the map } </pre>
-
Parameters:
- (none)
- Returns: a new independent Map containing all key-collection pairs from this Multimap
- See also: #toMap(IntFunction), #toMultiset()
-
Signature:
public <M extends Map<K, V>> M toMap(final IntFunction<? extends M> supplier) - Summary: Converts this Multimap to a Map of a specific type with independent collection copies.
-
Parameters:
-
supplier(IntFunction<? extends M>) — function that creates a new Map instance, receives Multimap size as parameter
-
- Returns: a new Map of the specified type containing all key-collection pairs
- See also: #toMap()
clear(...) -> void
-
Signature:
public void clear() - Summary: Removes all key-value pairs from this Multimap, leaving it empty.
-
Parameters:
- (none)
size(...) -> int
-
Signature:
@Deprecated public int size() - Summary: Returns the number of distinct keys in this Multimap.
-
Parameters:
- (none)
- Returns: the number of distinct keys in this Multimap
- See also: #keyCount()
keyCount(...) -> int
-
Signature:
public int keyCount() - Summary: Returns the number of distinct keys in this Multimap.
-
Parameters:
- (none)
- Returns: the number of distinct keys in this Multimap
- See also: #keySet(), #totalValueCount(), #isEmpty()
totalValueCount(...) -> int
-
Signature:
public int totalValueCount() - Summary: Returns the total count of all individual values across all value collections in this Multimap.
-
Contract:
- For example, if you have 3 keys with 2, 5, and 3 values respectively, this method returns 10 (2+5+3), while {@link #keyCount()} returns 3.
-
Parameters:
- (none)
- Returns: the total count of all individual values in all value collections
- See also: #keyCount(), #isEmpty()
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Checks if this Multimap contains no keys.
-
Contract:
- Checks if this Multimap contains no keys.
- Returns {@code true} if there are no keys in the Multimap, {@code false} otherwise.
- It returns {@code true} only when {@link #totalValueCount()} would return 0.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); // Initially empty multimap.isEmpty(); // Returns true // After adding values multimap.put("key1", 1); multimap.isEmpty(); // Returns false // After removing all keys multimap.removeAll("key1"); multimap.isEmpty(); // Returns true // Conditional processing if (!multimap.isEmpty()) { multimap.forEach((key, value) -> { System.out.println(key + ": " + value); }); } // With acceptIfNotEmpty multimap.acceptIfNotEmpty(mm -> { mm.forEach((k, v) -> System.out.println(k + ": " + v)); }).orElse(() -> { System.out.println("No data available"); }); } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the Multimap contains no keys, {@code false} otherwise
- See also: #totalValueCount(), #acceptIfNotEmpty(Throwables.Consumer)
apply(...) -> R
-
Signature:
public <R, X extends Exception> R apply(final Throwables.Function<? super Multimap<K, E, V>, R, X> func) throws X - Summary: Applies a function to this Multimap and returns the result.
-
Parameters:
-
func(Throwables.Function<? super Multimap<K, E, V>, R, X>) — the function to apply to this Multimap
-
- Returns: the result of applying the function
-
Throws:
-
X— if the function throws an exception
-
- See also: #applyIfNotEmpty(Throwables.Function), #accept(Throwables.Consumer)
applyIfNotEmpty(...) -> Optional<R>
-
Signature:
public <R, X extends Exception> Optional<R> applyIfNotEmpty(final Throwables.Function<? super Multimap<K, E, V>, R, X> func) throws X - Summary: Applies a function to this Multimap only if it's not empty, returning the result wrapped in an Optional.
-
Contract:
- Applies a function to this Multimap only if it's not empty, returning the result wrapped in an Optional.
- <p> If the Multimap is empty, returns {@link Optional#empty()} without calling the function.
- If the Multimap is not empty, applies the function and wraps the result in an Optional.
-
Parameters:
-
func(Throwables.Function<? super Multimap<K, E, V>, R, X>) — the function to apply if the Multimap is not empty
-
- Returns: an Optional containing the result if Multimap is not empty, otherwise empty Optional
-
Throws:
-
X— if the function throws an exception
-
- See also: #apply(Throwables.Function), #acceptIfNotEmpty(Throwables.Consumer)
accept(...) -> void
-
Signature:
public <X extends Exception> void accept(final Throwables.Consumer<? super Multimap<K, E, V>, X> action) throws X - Summary: Performs an action on this Multimap, useful for side effects and method chaining.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ListMultimap<String, Integer> multimap = N.newListMultimap(); multimap.putValues("scores", Arrays.asList(85, 92, 78)); // Perform logging multimap.accept(mm -> { System.out.println("Key count: " + mm.keyCount()); System.out.println("Total values: " + mm.totalValueCount()); }); // Perform validation multimap.accept(mm -> { if (mm.totalValueCount() > 1000) { throw new IllegalStateException("Too many values"); } }); // Method chaining with side effects multimap.accept(mm -> System.out.println("Processing " + mm.keyCount() + " keys")); Map<String, List<Integer>> snapshot = multimap.apply(mm -> mm.toMap()); } </pre>
-
Parameters:
-
action(Throwables.Consumer<? super Multimap<K, E, V>, X>) — the consumer action to perform on this Multimap
-
-
Throws:
-
X— if the action throws an exception
-
- See also: #acceptIfNotEmpty(Throwables.Consumer), #apply(Throwables.Function)
acceptIfNotEmpty(...) -> OrElse
-
Signature:
public <X extends Exception> OrElse acceptIfNotEmpty(final Throwables.Consumer<? super Multimap<K, E, V>, X> action) throws X - Summary: Performs an action on this Multimap only if it's not empty, with support for else clause.
-
Contract:
- Performs an action on this Multimap only if it's not empty, with support for else clause.
- <p> The action is only executed if {@link #totalValueCount()} is greater than 0.
-
Parameters:
-
action(Throwables.Consumer<? super Multimap<K, E, V>, X>) — the consumer action to perform if the Multimap is not empty
-
- Returns: an OrElse instance for chaining an alternative action for the empty case
-
Throws:
-
X— if the action throws an exception
-
- See also: #accept(Throwables.Consumer), #applyIfNotEmpty(Throwables.Function)
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this Multimap.
-
Contract:
- <p> Two Multimaps are guaranteed to have the same hash code if they are equal according to the {@link #equals(Object)} method.
-
Parameters:
- (none)
- Returns: the hash code value for this Multimap
- See also: #equals(Object)
equals(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @Override public boolean equals(final Object obj) - Summary: Compares the specified object with this Multimap for equality.
-
Contract:
- Returns {@code true} if the specified object is also a Multimap and both have identical key-value collection mappings.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this Multimap
-
- Returns: {@code true} if the specified object is equal to this Multimap, {@code false} otherwise
- See also: #hashCode()
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Multimap in standard Map format.
-
Parameters:
- (none)
- Returns: a string representation of this Multimap
Class Multiset (com.landawn.abacus.util.Multiset)
A collection that supports order-independent equality, like {@link Set} , but allows duplicate elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Multiset<T>
-
Signature:
@SafeVarargs public static <T> Multiset<T> of(final T... a) - Summary: Creates a new multiset containing the specified elements.
-
Parameters:
-
a(T[]) — the elements to be placed into the multiset.
-
- Returns: a new multiset containing the specified elements.
create(...) -> Multiset<T>
-
Signature:
public static <T> Multiset<T> create(final Iterable<? extends T> coll) - Summary: Creates a new multiset containing the elements of the specified collection.
-
Parameters:
-
coll(Iterable<? extends T>) — the collection whose elements are to be placed into the multiset.
-
- Returns: a new multiset containing the elements of the specified collection.
-
Signature:
public static <T> Multiset<T> create(final Iterator<? extends T> iter) - Summary: Creates a new multiset containing the elements from the specified iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator whose elements are to be placed into the multiset.
-
- Returns: a new multiset containing the elements from the iterator.
Public Instance Methods
<init>(...) -> void
-
Signature:
public Multiset() - Summary: Constructs an empty multiset with a default {@link HashMap} as the backing map.
-
Parameters:
- (none)
-
Signature:
public Multiset(final int initialCapacity) - Summary: Constructs an empty multiset with the specified initial capacity.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the backing map.
-
-
Signature:
public Multiset(final Iterable<? extends E> iterable) - Summary: Constructs a multiset containing the elements of the specified collection.
-
Contract:
- <p> If the input collection is a {@link Set} , the initial capacity is set to its size.
-
Parameters:
-
iterable(Iterable<? extends E>) — the collection whose elements are to be placed into this multiset.
-
-
Signature:
@SuppressWarnings("rawtypes") public Multiset(final Class<? extends Map> valueMapType) - Summary: Constructs an empty multiset with a backing map of the specified type.
-
Parameters:
-
valueMapType(Class<? extends Map>) — the class of the map to be used as the backing map.
-
-
Signature:
@SuppressWarnings("rawtypes") public Multiset(final Supplier<? extends Map<? extends E, ?>> mapSupplier) - Summary: Constructs an empty multiset with a backing map supplied by the provided supplier.
-
Parameters:
-
mapSupplier(Supplier<? extends Map<? extends E, ?>>) — the supplier that provides the map to be used as the backing map.
-
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final Object element) - Summary: Returns the number of occurrences of the specified element in this multiset.
-
Parameters:
-
element(Object) — the element to count occurrences of.
-
- Returns: the number of occurrences of the element; zero if not present.
- See also: #getCount(Object)
minOccurrences(...) -> Optional<Pair<Integer, E>>
-
Signature:
public Optional<Pair<Integer, E>> minOccurrences() - Summary: Finds the element with the minimum number of occurrences in this multiset.
-
Contract:
- If multiple elements have the same minimum count, one is arbitrarily chosen.
-
Parameters:
- (none)
- Returns: an Optional containing a Pair of (count, element) with minimum occurrences, or empty Optional if the multiset is empty.
maxOccurrences(...) -> Optional<Pair<Integer, E>>
-
Signature:
public Optional<Pair<Integer, E>> maxOccurrences() - Summary: Finds the element with the maximum number of occurrences in this multiset.
-
Contract:
- If multiple elements have the same maximum count, one is arbitrarily chosen.
-
Parameters:
- (none)
- Returns: an Optional containing a Pair of (count, element) with maximum occurrences, or empty Optional if the multiset is empty.
allMinOccurrences(...) -> Optional<Pair<Integer, List<E>>>
-
Signature:
public Optional<Pair<Integer, List<E>>> allMinOccurrences() - Summary: Finds all elements with the minimum number of occurrences in this multiset.
-
Parameters:
- (none)
- Returns: an Optional containing a Pair of (count, list of elements) with minimum occurrences, or empty Optional if the multiset is empty.
allMaxOccurrences(...) -> Optional<Pair<Integer, List<E>>>
-
Signature:
public Optional<Pair<Integer, List<E>>> allMaxOccurrences() - Summary: Finds all elements with the maximum number of occurrences in this multiset.
-
Parameters:
- (none)
- Returns: an Optional containing a Pair of (count, list of elements) with maximum occurrences, or empty Optional if the multiset is empty.
sumOfOccurrences(...) -> long
-
Signature:
public long sumOfOccurrences() - Summary: Calculates the sum of all occurrences of all elements in this multiset.
-
Parameters:
- (none)
- Returns: the total count of all elements.
- See also: #size()
averageOfOccurrences(...) -> OptionalDouble
-
Signature:
public OptionalDouble averageOfOccurrences() - Summary: Calculates the average number of occurrences per distinct element in this multiset.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average occurrences per distinct element, or empty if the multiset is empty.
count(...) -> int
-
Signature:
@Deprecated public int count(final Object element) - Summary: Returns the number of occurrences of the specified element in this multiset.
-
Parameters:
-
element(Object) — the element to count occurrences of.
-
- Returns: the number of occurrences of the element; zero if not present.
- See also: #getCount(Object)
get(...) -> int
-
Signature:
@Deprecated public int get(final Object element) - Summary: Returns the number of occurrences of the specified element in this multiset.
-
Parameters:
-
element(Object) — the element to count occurrences of.
-
- Returns: the number of occurrences of the element; zero if not present.
- See also: #getCount(Object)
getCount(...) -> int
-
Signature:
public int getCount(final Object element) - Summary: Returns the number of occurrences of the specified element in this multiset.
-
Parameters:
-
element(Object) — the element to count occurrences of.
-
- Returns: the number of occurrences of the element; zero if not present.
- See also: #occurrencesOf(Object)
setCount(...) -> int
-
Signature:
public int setCount(final E element, final int occurrences) - Summary: Sets the count of the specified element to a specific value.
-
Contract:
- If the new count is zero, the element is removed from the multiset.
-
Parameters:
-
element(E) — the element to set the count of. -
occurrences(int) — the desired count; must be non-negative.
-
- Returns: the count of the element before the operation.
- See also: #setCount(Object, int, int), #add(Object, int)
-
Signature:
public boolean setCount(final E element, final int oldOccurrences, final int newOccurrences) - Summary: Conditionally sets the count of the specified element to a new value if it currently has the expected count.
-
Contract:
- Conditionally sets the count of the specified element to a new value if it currently has the expected count.
-
Parameters:
-
element(E) — the element to set the count of. -
oldOccurrences(int) — the expected current count; must be non-negative. -
newOccurrences(int) — the desired new count; must be non-negative.
-
- Returns: {@code true} if the count was updated, {@code false} if the current count didn't match oldOccurrences.
- See also: #setCount(Object, int)
add(...) -> boolean
-
Signature:
@Override public boolean add(final E element) - Summary: Adds a single occurrence of the specified element to this multiset.
-
Parameters:
-
element(E) — the element to add one occurrence of.
-
- Returns: {@code true} (as specified by {@link Collection#add} ).
-
Signature:
public int add(final E element, final int occurrencesToAdd) - Summary: Adds the specified number of occurrences of an element to this multiset.
-
Parameters:
-
element(E) — the element to add occurrences of. -
occurrencesToAdd(int) — the number of occurrences to add; must be non-negative.
-
- Returns: the count of the element before the operation.
- See also: #addAndGetCount(Object, int), #setCount(Object, int)
addAndGetCount(...) -> int
-
Signature:
@Beta public int addAndGetCount(final E element, final int occurrences) - Summary: Adds the specified number of occurrences of an element to this multiset and returns the new count.
-
Parameters:
-
element(E) — the element to add occurrences of. -
occurrences(int) — the number of occurrences to add; must be non-negative.
-
- Returns: the count of the element after the operation.
- See also: #add(Object, int)
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final Collection<? extends E> c) - Summary: Adds all elements from the specified collection to this multiset.
-
Parameters:
-
c(Collection<? extends E>) — the collection containing elements to be added.
-
- Returns: {@code true} if this multiset changed as a result of the call.
-
Signature:
@Beta public boolean addAll(final Collection<? extends E> c, final int occurrencesToAdd) - Summary: Adds all elements from the specified collection to this multiset with the given number of occurrences.
-
Parameters:
-
c(Collection<? extends E>) — the collection containing elements to be added. -
occurrencesToAdd(int) — the number of occurrences to add for each element.
-
- Returns: {@code true} if this multiset changed as a result of the call.
remove(...) -> boolean
-
Signature:
@Override public boolean remove(final Object element) - Summary: Removes a single occurrence of the specified element from this multiset, if present.
-
Contract:
- Removes a single occurrence of the specified element from this multiset, if present.
- <p> If the element has multiple occurrences, only one is removed.
- If the element has only one occurrence, it is removed completely from the multiset.
-
Parameters:
-
element(Object) — the element to remove one occurrence of.
-
- Returns: {@code true} if an occurrence was found and removed.
-
Signature:
public int remove(final Object element, final int occurrencesToRemove) - Summary: Removes the specified number of occurrences of an element from this multiset.
-
Contract:
- If the multiset contains fewer occurrences than specified, all occurrences are removed.
-
Parameters:
-
element(Object) — the element to remove occurrences of. -
occurrencesToRemove(int) — the number of occurrences to remove; must be non-negative.
-
- Returns: the count of the element before the operation.
- See also: #removeAndGetCount(Object, int), #removeAllOccurrences(Object)
removeAndGetCount(...) -> int
-
Signature:
@Beta public int removeAndGetCount(final Object element, final int occurrences) - Summary: Removes the specified number of occurrences of an element and returns the new count.
-
Contract:
- If the multiset contains fewer occurrences than specified, all occurrences are removed.
-
Parameters:
-
element(Object) — the element to remove occurrences of. -
occurrences(int) — the number of occurrences to remove; must be non-negative.
-
- Returns: the count of the element after the operation.
- See also: #remove(Object, int)
removeAll(...) -> boolean
-
Signature:
@Deprecated @Override public boolean removeAll(final Collection<?> c) - Summary: Removes all occurrences of all elements in the specified collection from this multiset.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be removed.
-
- Returns: {@code true} if this multiset changed as a result of the call.
-
Signature:
public boolean removeAll(final Collection<?> c, final int occurrencesToRemove) - Summary: Removes the specified number of occurrences of each element in the collection from this multiset.
-
Contract:
- If an element has fewer occurrences than specified, all its occurrences are removed.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be removed. -
occurrencesToRemove(int) — the number of occurrences to remove for each element.
-
- Returns: {@code true} if this multiset changed as a result of the call.
removeAllOccurrences(...) -> int
-
Signature:
public int removeAllOccurrences(final Object e) - Summary: Removes all occurrences of a specific element from this multiset.
-
Parameters:
-
e(Object) — the element whose all occurrences are to be removed.
-
- Returns: the count of the element before removal, or 0 if not present.
-
Signature:
@SuppressWarnings("deprecation") public boolean removeAllOccurrences(final Collection<?> c) - Summary: Removes all occurrences of all elements in the specified collection from this multiset.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be removed.
-
- Returns: {@code true} if this multiset changed as a result of the call.
removeAllOccurrencesIf(...) -> boolean
-
Signature:
public boolean removeAllOccurrencesIf(final Predicate<? super E> predicate) throws IllegalArgumentException - Summary: Removes all occurrences of elements that satisfy the given predicate.
-
Parameters:
-
predicate(Predicate<? super E>) — the predicate which returns {@code true} for elements to be removed.
-
- Returns: {@code true} if any elements were removed.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
-
Signature:
public boolean removeAllOccurrencesIf(final ObjIntPredicate<? super E> predicate) throws IllegalArgumentException - Summary: Removes all occurrences of elements that satisfy the given predicate.
-
Parameters:
-
predicate(ObjIntPredicate<? super E>) — the predicate which returns {@code true} for elements to be removed.
-
- Returns: {@code true} if any elements were removed.
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate is null.
-
updateAllOccurrences(...) -> void
-
Signature:
public void updateAllOccurrences(final ObjIntFunction<? super E, Integer> function) throws IllegalArgumentException - Summary: Updates the count of each element in this multiset based on the provided function.
-
Contract:
- If the function returns zero or negative, the element is removed.
-
Parameters:
-
function(ObjIntFunction<? super E, Integer>) — the function to compute new counts.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the function is null
-
computeIfAbsent(...) -> int
-
Signature:
public int computeIfAbsent(final E e, final ToIntFunction<? super E> mappingFunction) throws IllegalArgumentException - Summary: Computes the count of the specified element if it is not already present.
-
Contract:
- Computes the count of the specified element if it is not already present.
- If the element is present, returns its current count without modification.
-
Parameters:
-
e(E) — the element whose count is to be computed. -
mappingFunction(ToIntFunction<? super E>) — the function to compute a count.
-
- Returns: the current (existing or computed) count of the element
-
Throws:
-
java.lang.IllegalArgumentException— if the mapping function is null
-
computeIfPresent(...) -> int
-
Signature:
public int computeIfPresent(final E e, final ObjIntFunction<? super E, Integer> remappingFunction) throws IllegalArgumentException - Summary: Computes a new count for the specified element if it is already present.
-
Contract:
- Computes a new count for the specified element if it is already present.
- If the element is not present, returns 0 without modification.
-
Parameters:
-
e(E) — the element whose count is to be computed. -
remappingFunction(ObjIntFunction<? super E, Integer>) — the function to compute a new count.
-
- Returns: the new count of the element, or 0 if not present
-
Throws:
-
java.lang.IllegalArgumentException— if the remapping function is null
-
compute(...) -> int
-
Signature:
public int compute(final E key, final ObjIntFunction<? super E, Integer> remappingFunction) throws IllegalArgumentException - Summary: Computes a new count for the specified element, whether present or not.
-
Contract:
- The remapping function receives the element and its current count (0 if not present).
-
Parameters:
-
key(E) — the element whose count is to be computed. -
remappingFunction(ObjIntFunction<? super E, Integer>) — the function to compute a new count.
-
- Returns: the new count of the element
-
Throws:
-
java.lang.IllegalArgumentException— if the remapping function is null
-
merge(...) -> int
-
Signature:
public int merge(final E key, final int value, final IntBiFunction<Integer> remappingFunction) throws IllegalArgumentException - Summary: Merges the specified value with the current count of the element using the remapping function.
-
Contract:
- If the element is not present, the value is used as the new count.
-
Parameters:
-
key(E) — the element whose count is to be merged. -
value(int) — the value to merge with the existing count. -
remappingFunction(IntBiFunction<Integer>) — the function to merge the old count and value.
-
- Returns: the new count of the element
-
Throws:
-
java.lang.IllegalArgumentException— if the remapping function is null
-
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final Collection<?> c) - Summary: Retains only the elements in this multiset that are contained in the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection containing elements to be retained.
-
- Returns: {@code true} if this multiset changed as a result of the call.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object element) - Summary: Returns {@code true} if this multiset contains at least one occurrence of the specified element.
-
Contract:
- Returns {@code true} if this multiset contains at least one occurrence of the specified element.
-
Parameters:
-
element(Object) — the element whose presence is to be tested.
-
- Returns: {@code true} if this multiset contains at least one occurrence of the element
- See also: #containsAll(Collection), #getCount(Object)
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final Collection<?> c) - Summary: Returns {@code true} if this multiset contains at least one occurrence of each element in the specified collection.
-
Contract:
- Returns {@code true} if this multiset contains at least one occurrence of each element in the specified collection.
- It returns {@code true} even if the collection contains multiple occurrences of an element and this multiset contains only one.
-
Parameters:
-
c(Collection<?>) — the collection to be checked for containment.
-
- Returns: {@code true} if this multiset contains all elements in the specified collection
- See also: #contains(Object)
elementSet(...) -> Set<E>
-
Signature:
public Set<E> elementSet() - Summary: Returns an unmodifiable view of the distinct elements contained in this multiset.
-
Parameters:
- (none)
- Returns: a view of the distinct elements in this multiset
entrySet(...) -> Set<Multiset.Entry<E>>
-
Signature:
public Set<Multiset.Entry<E>> entrySet() - Summary: Returns a view of the contents of this multiset, grouped into {@link Entry} instances, each providing an element and its count.
-
Parameters:
- (none)
- Returns: a set of entries representing the data of this multiset
iterator(...) -> ObjIterator<E>
-
Signature:
@Override public ObjIterator<E> iterator() - Summary: Returns an iterator over the elements in this multiset.
-
Parameters:
- (none)
- Returns: an iterator over all element occurrences in this multiset
size(...) -> int
-
Signature:
@Override public int size() throws ArithmeticException - Summary: Returns the total number of all occurrences of all elements in this multiset.
-
Parameters:
- (none)
- Returns: the total number of element occurrences
-
Throws:
-
java.lang.ArithmeticException— if the total count exceeds {@link Integer#MAX_VALUE}
-
- See also: #countOfDistinctElements(), #sumOfOccurrences()
countOfDistinctElements(...) -> int
-
Signature:
@Beta public int countOfDistinctElements() - Summary: Returns the number of distinct elements in this multiset.
-
Parameters:
- (none)
- Returns: the number of distinct elements
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Checks if this multiset is empty.
-
Contract:
- Checks if this multiset is empty.
-
Parameters:
- (none)
- Returns: {@code true} if this multiset contains no elements, {@code false} otherwise
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Clears all elements from this multiset.
-
Parameters:
- (none)
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Converts the multiset to an array.
-
Parameters:
- (none)
- Returns: an array containing all the elements in this multiset
-
Signature:
@Override public <T> T[] toArray(final T[] a) throws IllegalArgumentException - Summary: Converts the multiset to an array of a specific type.
-
Parameters:
-
a(T[]) — the array into which the elements of this multiset are to be stored, if it is big enough;. otherwise, a new array of the same runtime type is allocated for this purpose
-
- Returns: an array containing all the elements in this multiset
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null}
-
toMap(...) -> Map<E, Integer>
-
Signature:
public Map<E, Integer> toMap() - Summary: Converts the multiset to a map where keys are elements and values are their counts.
-
Parameters:
- (none)
- Returns: a map with the elements of this multiset as keys and their counts as values
-
Signature:
public <M extends Map<E, Integer>> M toMap(final IntFunction<? extends M> supplier) - Summary: Converts the multiset to a map created by the provided supplier function.
-
Parameters:
-
supplier(IntFunction<? extends M>) — a function that generates a new instance of the desired map type.
-
- Returns: a map with the elements of this multiset as keys and their counts as values
toMapSortedByOccurrences(...) -> Map<E, Integer>
-
Signature:
@SuppressWarnings("rawtypes") public Map<E, Integer> toMapSortedByOccurrences() - Summary: Converts the multiset to a map sorted by occurrences in ascending order.
-
Parameters:
- (none)
- Returns: a map with the elements of this multiset as keys and their counts as values, sorted by the counts
-
Signature:
public Map<E, Integer> toMapSortedByOccurrences(final Comparator<? super Integer> cmp) - Summary: Converts the multiset to a map sorted by occurrences using a custom comparator.
-
Parameters:
-
cmp(Comparator<? super Integer>) — the comparator to be used for sorting the counts of the elements.
-
- Returns: a map with the elements of this multiset as keys and their counts as values, sorted by the counts using the provided comparator
toMapSortedByKey(...) -> Map<E, Integer>
-
Signature:
public Map<E, Integer> toMapSortedByKey(final Comparator<? super E> cmp) - Summary: Converts the multiset to a map sorted by keys.
-
Parameters:
-
cmp(Comparator<? super E>) — the comparator to be used for sorting the keys of the elements.
-
- Returns: a map with the elements of this multiset as keys and their counts as values, sorted by the keys using the provided comparator
toImmutableMap(...) -> ImmutableMap<E, Integer>
-
Signature:
public ImmutableMap<E, Integer> toImmutableMap() - Summary: Returns an unmodifiable map where the keys are the elements in this multiset and the values are their corresponding counts.
-
Parameters:
- (none)
- Returns: an immutable map with the elements of this multiset as keys and their counts as values
-
Signature:
public ImmutableMap<E, Integer> toImmutableMap(final IntFunction<? extends Map<E, Integer>> mapSupplier) - Summary: Returns an unmodifiable map where the keys are the elements in this multiset and the values are their corresponding counts.
-
Parameters:
-
mapSupplier(IntFunction<? extends Map<E, Integer>>) — a function that generates a new instance of the desired map type.
-
- Returns: an immutable map with the elements of this multiset as keys and their counts as values
forEach(...) -> void
-
Signature:
@Override public void forEach(final Consumer<? super E> action) throws IllegalArgumentException - Summary: Performs the given action for each element of the multiset until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(Consumer<? super E>) — The action to be performed for each element.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided action is {@code null}
-
-
Signature:
public void forEach(final ObjIntConsumer<? super E> action) throws IllegalArgumentException - Summary: Runs the specified action for each distinct element in this multiset, and the number of occurrences of that element.
-
Parameters:
-
action(ObjIntConsumer<? super E>) — The action to be performed for each distinct element in the multiset and its count. This can be any instance of ObjIntConsumer.
-
-
Throws:
-
java.lang.IllegalArgumentException— if the provided action is {@code null} .
-
elements(...) -> Stream<E>
-
Signature:
@Beta public Stream<E> elements() - Summary: Returns an (unmodifiable) {@code Stream} with elements from the {@code Multiset} .
-
Parameters:
- (none)
- Returns: a Stream containing all element occurrences in this multiset
- See also: #iterator()
entries(...) -> Stream<Multiset.Entry<E>>
-
Signature:
@Beta public Stream<Multiset.Entry<E>> entries() - Summary: Returns an (unmodifiable) Stream of entries in this multiset.
-
Parameters:
- (none)
- Returns: a Stream of entries representing the data of this multiset
apply(...) -> R
-
Signature:
public <R, X extends Exception> R apply(final Throwables.Function<? super Multiset<E>, ? extends R, X> func) throws X - Summary: Applies the provided function to this multiset and returns the result.
-
Parameters:
-
func(Throwables.Function<? super Multiset<E>, ? extends R, X>) — the function to be applied to this multiset.
-
- Returns: the result of applying the provided function to this multiset
-
Throws:
-
X— if the provided function throws an exception of type X
-
applyIfNotEmpty(...) -> Optional<R>
-
Signature:
public <R, X extends Exception> Optional<R> applyIfNotEmpty(final Throwables.Function<? super Multiset<E>, ? extends R, X> func) throws X - Summary: Applies the provided function to this multiset and returns the result, if the multiset is not empty.
-
Contract:
- Applies the provided function to this multiset and returns the result, if the multiset is not empty.
- If the multiset is empty, it returns an empty Optional.
-
Parameters:
-
func(Throwables.Function<? super Multiset<E>, ? extends R, X>) — the function to be applied to this multiset.
-
- Returns: an Optional containing the result of applying the provided function to this multiset, or an empty Optional if the multiset is empty
-
Throws:
-
X— if the provided function throws an exception of type X
-
accept(...) -> void
-
Signature:
public <X extends Exception> void accept(final Throwables.Consumer<? super Multiset<E>, X> action) throws X - Summary: Applies the provided consumer function to this multiset.
-
Parameters:
-
action(Throwables.Consumer<? super Multiset<E>, X>) — the consumer function to be applied to this multiset.
-
-
Throws:
-
X— if the provided consumer function throws an exception of type X
-
acceptIfNotEmpty(...) -> OrElse
-
Signature:
public <X extends Exception> OrElse acceptIfNotEmpty(final Throwables.Consumer<? super Multiset<E>, X> action) throws X - Summary: Applies the provided consumer function to this multiset if it is not empty.
-
Contract:
- Applies the provided consumer function to this multiset if it is not empty.
-
Parameters:
-
action(Throwables.Consumer<? super Multiset<E>, X>) — the consumer function to be applied to this multiset.
-
- Returns: an instance of OrElse which can be used to perform some other operation if the Multiset is empty
-
Throws:
-
X— if the provided consumer function throws an exception of type X
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this multiset.
-
Parameters:
- (none)
- Returns: the hash code value for this multiset
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this Multiset is equal to the specified object.
-
Contract:
- Checks if this Multiset is equal to the specified object.
- The method returns {@code true} if the specified object is also a Multiset and has the same keys and occurrences pair.
-
Parameters:
-
obj(Object) — The object to be compared with this Multiset for equality.
-
- Returns: {@code true} if the specified object is equal to this Multiset, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Multiset.
-
Parameters:
- (none)
- Returns: a string representation of this Multiset.
Interface Entry (com.landawn.abacus.util.Multiset.Entry)
An unmodifiable element-count pair for a multiset.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
element(...) -> E
-
Signature:
E element() - Summary: Returns the multiset element corresponding to this entry.
-
Parameters:
- (none)
- Returns: the element corresponding to this entry
count(...) -> int
-
Signature:
int count() - Summary: Returns the count of the associated element in the underlying multiset.
-
Contract:
- Note that in the former case, this method can never return zero, while in the latter, it will return zero if all occurrences of the element were since removed from the multiset.
-
Parameters:
- (none)
- Returns: the count of the element; never negative
equals(...) -> boolean
-
Signature:
@Override // TODO(kevinb): check this wrt TreeMultiset? boolean equals(Object o) - Summary: Compares the specified object with this entry for equality.
-
Contract:
- <p> Returns {@code true} if the given object is also a multiset entry and the two entries represent the same element and count.
-
Parameters:
-
o(Object) — object to be compared for equality with this multiset entry.
-
- Returns: {@code true} if the specified object is equal to this entry
hashCode(...) -> int
-
Signature:
@Override int hashCode() - Summary: Returns the hash code value for this multiset entry.
-
Parameters:
- (none)
- Returns: the hash code value for this multiset entry
toString(...) -> String
-
Signature:
@Override String toString() - Summary: Returns the canonical string representation of this entry, defined as follows.
-
Contract:
- If the count for this entry is one, this is simply the string representation of the corresponding element.
-
Parameters:
- (none)
- Returns: a string representation of this entry
Interface Mutable (com.landawn.abacus.util.Mutable)
A marker interface that provides mutable access to a value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class MutableBoolean (com.landawn.abacus.util.MutableBoolean)
A mutable wrapper for a {@code boolean} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableBoolean
-
Signature:
public static MutableBoolean of(final boolean value) - Summary: Creates a new MutableBoolean instance with the specified value.
-
Parameters:
-
value(boolean) — the initial value
-
- Returns: a new MutableBoolean instance containing the specified value
Public Instance Methods
value(...) -> boolean
-
Signature:
public boolean value() - Summary: Returns the current boolean value.
-
Parameters:
- (none)
- Returns: the current boolean value
getValue(...) -> boolean
-
Signature:
@Deprecated public boolean getValue() - Summary: Gets the value as a boolean primitive.
-
Parameters:
- (none)
- Returns: the current boolean value
setValue(...) -> void
-
Signature:
public void setValue(final boolean newValue) - Summary: Sets the value to the specified boolean.
-
Parameters:
-
newValue(boolean) — the value to set
-
getAndSet(...) -> boolean
-
Signature:
public boolean getAndSet(final boolean newValue) - Summary: Returns the current value and then sets the new value.
-
Parameters:
-
newValue(boolean) — the new value to set
-
- Returns: the value before it was updated
setAndGet(...) -> boolean
-
Signature:
public boolean setAndGet(final boolean newValue) - Summary: Sets the value and then returns it.
-
Contract:
- This is useful when you want to update and immediately use the new value.
-
Parameters:
-
newValue(boolean) — the new value to set
-
- Returns: the new value after it has been set
getAndNegate(...) -> boolean
-
Signature:
public boolean getAndNegate() - Summary: Returns the current value and then inverts it ( {@code true} becomes {@code false} , {@code false} becomes {@code true} ).
-
Parameters:
- (none)
- Returns: the value before negating
negateAndGet(...) -> boolean
-
Signature:
public boolean negateAndGet() - Summary: Inverts the current value and then returns it ( {@code true} becomes {@code false} , {@code false} becomes {@code true} ).
-
Parameters:
- (none)
- Returns: the value after negating
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.BooleanPredicate<E> predicate, final boolean newValue) throws E - Summary: Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
-
Contract:
- Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.BooleanPredicate<E>) — the predicate to test the current value -
newValue(boolean) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setFalse(...) -> void
-
Signature:
public void setFalse() - Summary: Sets the value to {@code false} .
-
Parameters:
- (none)
setTrue(...) -> void
-
Signature:
public void setTrue() - Summary: Sets the value to {@code true} .
-
Parameters:
- (none)
isTrue(...) -> boolean
-
Signature:
public boolean isTrue() - Summary: Checks if the current value is {@code true} .
-
Contract:
- Checks if the current value is {@code true} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code MutableBoolean flag = MutableBoolean.of(true); if (flag.isTrue()) { // execute when true } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the current value is {@code true}
isFalse(...) -> boolean
-
Signature:
public boolean isFalse() - Summary: Checks if the current value is {@code false} .
-
Contract:
- Checks if the current value is {@code false} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code MutableBoolean flag = MutableBoolean.of(false); if (flag.isFalse()) { // execute when false } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the current value is {@code false}
negate(...) -> void
-
Signature:
public void negate() - Summary: Inverts the current value (true becomes {@code false} , {@code false} becomes true).
-
Parameters:
- (none)
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableBoolean other) - Summary: Compares this MutableBoolean to another MutableBoolean in ascending order.
-
Parameters:
-
other(MutableBoolean) — the other MutableBoolean to compare to, not null
-
- Returns: negative if this is less (false < true), zero if equal, positive if greater
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} and is a {@code MutableBoolean} object that contains the same {@code boolean} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects are the same; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableBoolean.
-
Parameters:
- (none)
- Returns: a suitable hash code
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of this MutableBoolean's value.
-
Parameters:
- (none)
- Returns: the String representation of the current value ("true" or "false")
Class MutableByte (com.landawn.abacus.util.MutableByte)
A mutable wrapper for a {@code byte} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableByte
-
Signature:
public static MutableByte of(final byte value) - Summary: Creates a new MutableByte instance with the specified value.
-
Parameters:
-
value(byte) — the initial value
-
- Returns: a new MutableByte instance containing the specified value
Public Instance Methods
value(...) -> byte
-
Signature:
public byte value() - Summary: Returns the current byte value.
-
Parameters:
- (none)
- Returns: the current byte value
getValue(...) -> byte
-
Signature:
@Deprecated public byte getValue() - Summary: Gets the value as a byte primitive.
-
Parameters:
- (none)
- Returns: the current byte value
setValue(...) -> void
-
Signature:
public void setValue(final byte newValue) - Summary: Sets the value to the specified byte.
-
Parameters:
-
newValue(byte) — the value to set
-
getAndSet(...) -> byte
-
Signature:
public byte getAndSet(final byte newValue) - Summary: Returns the current value and then sets it to the specified new value.
-
Parameters:
-
newValue(byte) — the new value to set
-
- Returns: the previous value before it was updated
setAndGet(...) -> byte
-
Signature:
public byte setAndGet(final byte newValue) - Summary: Sets the value to the specified new value and then returns it.
-
Contract:
- This is an atomic-like set-then-get operation for single-threaded use, useful when you want to update and immediately use the new value.
-
Parameters:
-
newValue(byte) — the new value to set
-
- Returns: the new value that was just set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.BytePredicate<E> predicate, final byte newValue) throws E - Summary: Sets the value to the specified new value if the predicate evaluates to {@code true} when testing the current value.
-
Contract:
- Sets the value to the specified new value if the predicate evaluates to {@code true} when testing the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — the predicate to test the current value; receives current value as parameter -
newValue(byte) — the new value to set if the condition is met
-
- Returns: {@code true} if the predicate returned {@code true} and the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final byte delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(byte) — the value to add to the current value
-
subtract(...) -> void
-
Signature:
public void subtract(final byte delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(byte) — the value to subtract from the current value
-
getAndIncrement(...) -> byte
-
Signature:
public byte getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before it was incremented
getAndDecrement(...) -> byte
-
Signature:
public byte getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before it was decremented
incrementAndGet(...) -> byte
-
Signature:
public byte incrementAndGet() - Summary: Increments the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after it was incremented
decrementAndGet(...) -> byte
-
Signature:
public byte decrementAndGet() - Summary: Decrements the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after it was decremented
getAndAdd(...) -> byte
-
Signature:
public byte getAndAdd(final byte delta) - Summary: Returns the current value and then adds the specified delta to it.
-
Parameters:
-
delta(byte) — the value to add to the current value
-
- Returns: the value before it was modified
addAndGet(...) -> byte
-
Signature:
public byte addAndGet(final byte delta) - Summary: Adds the specified delta to the current value and then returns it.
-
Parameters:
-
delta(byte) — the value to add to the current value
-
- Returns: the value after it was modified
byteValue(...) -> byte
-
Signature:
@Override public byte byteValue() - Summary: Returns the value of this MutableByte as a byte.
-
Parameters:
- (none)
- Returns: the byte value represented by this object
shortValue(...) -> short
-
Signature:
@Override public short shortValue() - Summary: Returns the value of this MutableByte as a short after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type short
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableByte as an int after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type int
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableByte as a long after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableByte as a float after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableByte as a double after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type double
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableByte other) - Summary: Compares this MutableByte with another MutableByte for order.
-
Parameters:
-
other(MutableByte) — the MutableByte to compare to, must not be null
-
- Returns: a negative integer, zero, or a positive integer as this object's value is less than, equal to, or greater than the specified object's value
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object for equality.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} , is a {@code MutableByte} object, and contains the same {@code byte} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, may be {@code null}
-
- Returns: {@code true} if the objects represent the same byte value; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableByte consistent with the {@link #equals(Object)} method.
-
Parameters:
- (none)
- Returns: a hash code value for this object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of the byte value held by this MutableByte.
-
Parameters:
- (none)
- Returns: the String representation of the byte value
Class MutableChar (com.landawn.abacus.util.MutableChar)
A mutable wrapper for a {@code char} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableChar
-
Signature:
public static MutableChar of(final char value) - Summary: Creates a new MutableChar instance with the specified value.
-
Parameters:
-
value(char) — the initial char value
-
- Returns: a new MutableChar instance containing the specified value
Public Instance Methods
value(...) -> char
-
Signature:
public char value() - Summary: Returns the current char value.
-
Parameters:
- (none)
- Returns: the current char value
getValue(...) -> char
-
Signature:
@Deprecated public char getValue() - Summary: Gets the value as a char.
-
Parameters:
- (none)
- Returns: the current char value
setValue(...) -> void
-
Signature:
public void setValue(final char newValue) - Summary: Sets the value to the specified char.
-
Parameters:
-
newValue(char) — the value to set
-
getAndSet(...) -> char
-
Signature:
public char getAndSet(final char newValue) - Summary: Returns the current value and then atomically sets it to the new value.
-
Parameters:
-
newValue(char) — the new value to set
-
- Returns: the previous value before the update
setAndGet(...) -> char
-
Signature:
public char setAndGet(final char newValue) - Summary: Sets the value to the new value and then returns it.
-
Contract:
- This is useful when you want to update the value and immediately use the new value in the same expression.
-
Parameters:
-
newValue(char) — the new value to set
-
- Returns: the new value after it has been set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.CharPredicate<E> predicate, final char newValue) throws E - Summary: Conditionally sets the value to newValue if the predicate evaluates to {@code true} for the current value.
-
Contract:
- Conditionally sets the value to newValue if the predicate evaluates to {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code MutableChar ch = MutableChar.of('A'); // Update only if current value is less than 'M' boolean updated = ch.setIf(c -> c < 'M', 'Z'); // returns true, value is now 'Z' // This update will fail because 'Z' is not < 'M' updated = ch.setIf(c -> c < 'M', 'A'); // returns false, value remains 'Z' } </pre>
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — the predicate to test against the current value -
newValue(char) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated (predicate returned true), {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception during evaluation
-
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one, moving to the next character in Unicode order.
-
Contract:
- <p> Note: This operation wraps around if incrementing causes overflow (e.g., incrementing '\\uffff' results in ' ').
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one, moving to the previous character in Unicode order.
-
Contract:
- <p> Note: This operation wraps around if decrementing causes underflow (e.g., decrementing ' ' results in '\\uffff').
-
Parameters:
- (none)
getAndIncrement(...) -> char
-
Signature:
public char getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> char
-
Signature:
public char getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> char
-
Signature:
public char incrementAndGet() - Summary: Increments the value by one and then returns the new value.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> char
-
Signature:
public char decrementAndGet() - Summary: Decrements the value by one and then returns the new value.
-
Parameters:
- (none)
- Returns: the value after decrementing
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableChar other) - Summary: Compares this MutableChar to another MutableChar.
-
Contract:
- <p> Returns a negative integer if this value is less than the other, zero if they are equal, or a positive integer if this value is greater.
-
Parameters:
-
other(MutableChar) — the other MutableChar to compare to
-
- Returns: a negative integer, zero, or a positive integer as this value is less than, equal to, or greater than the specified value
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object for equality.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} , is a {@code MutableChar} object, and contains the same {@code char} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, may be {@code null}
-
- Returns: {@code true} if the objects are the same; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableChar.
-
Parameters:
- (none)
- Returns: a hash code value for this object, equal to the char value
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of this MutableChar's value.
-
Parameters:
- (none)
- Returns: the String representation of the current char value
Class MutableDouble (com.landawn.abacus.util.MutableDouble)
A mutable wrapper for a {@code double} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableDouble
-
Signature:
public static MutableDouble of(final double value) - Summary: Creates a new MutableDouble instance with the specified value.
-
Parameters:
-
value(double) — the initial value
-
- Returns: a new MutableDouble instance containing the specified value
Public Instance Methods
value(...) -> double
-
Signature:
public double value() - Summary: Returns the current double value.
-
Parameters:
- (none)
- Returns: the current double value
getValue(...) -> double
-
Signature:
@Deprecated public double getValue() - Summary: Gets the value as a primitive double.
-
Parameters:
- (none)
- Returns: the current double value
setValue(...) -> void
-
Signature:
public void setValue(final double newValue) - Summary: Sets the value to the specified double.
-
Parameters:
-
newValue(double) — the value to set
-
getAndSet(...) -> double
-
Signature:
public double getAndSet(final double newValue) - Summary: Returns the current value and then sets the new value.
-
Parameters:
-
newValue(double) — the new value to set
-
- Returns: the value before it was updated
setAndGet(...) -> double
-
Signature:
public double setAndGet(final double newValue) - Summary: Sets the value and then returns it.
-
Parameters:
-
newValue(double) — the new value to set
-
- Returns: the newly set value
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.DoublePredicate<E> predicate, final double newValue) throws E - Summary: Sets the value to newValue if the predicate returns {@code true} for the current value.
-
Contract:
- Sets the value to newValue if the predicate returns {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — the predicate that tests the current value -
newValue(double) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was set, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
isNaN(...) -> boolean
-
Signature:
public boolean isNaN() - Summary: Checks whether the double value is the special NaN (Not-a-Number) value.
-
Parameters:
- (none)
- Returns: {@code true} if the value is NaN, {@code false} otherwise
isInfinite(...) -> boolean
-
Signature:
public boolean isInfinite() - Summary: Checks whether the double value is infinite (positive or negative infinity).
-
Parameters:
- (none)
- Returns: {@code true} if the value is infinite, {@code false} otherwise
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by 1.0.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by 1.0.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final double delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(double) — the value to add to the current value
-
subtract(...) -> void
-
Signature:
public void subtract(final double delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(double) — the value to subtract from the current value
-
getAndIncrement(...) -> double
-
Signature:
public double getAndIncrement() - Summary: Returns the current value and then increments it by 1.0.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> double
-
Signature:
public double getAndDecrement() - Summary: Returns the current value and then decrements it by 1.0.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> double
-
Signature:
public double incrementAndGet() - Summary: Increments the value by 1.0 and then returns it.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> double
-
Signature:
public double decrementAndGet() - Summary: Decrements the value by 1.0 and then returns it.
-
Parameters:
- (none)
- Returns: the value after decrementing
getAndAdd(...) -> double
-
Signature:
public double getAndAdd(final double delta) - Summary: Returns the current value and then adds the given delta to it.
-
Parameters:
-
delta(double) — the value to add
-
- Returns: the value before adding delta
addAndGet(...) -> double
-
Signature:
public double addAndGet(final double delta) - Summary: Adds the given delta to the current value and then returns it.
-
Parameters:
-
delta(double) — the value to add
-
- Returns: the value after adding delta
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableDouble as an int by casting.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type int
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableDouble as a long by casting.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableDouble as a float by casting.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableDouble as a double.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableDouble other) - Summary: Compares this MutableDouble to another MutableDouble numerically.
-
Parameters:
-
other(MutableDouble) — the other MutableDouble to compare to, not null
-
- Returns: a negative value if this is less than other, zero if equal, or a positive value if greater
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object against the specified object for equality.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} and is a {@code MutableDouble} object that contains the same {@code double} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects are equal; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableDouble.
-
Parameters:
- (none)
- Returns: a hash code value for this object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a String representation of this MutableDouble's value.
-
Parameters:
- (none)
- Returns: the String representation of the current value
Class MutableFloat (com.landawn.abacus.util.MutableFloat)
A mutable wrapper for a {@code float} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableFloat
-
Signature:
public static MutableFloat of(final float value) - Summary: Creates a new MutableFloat instance with the specified value.
-
Parameters:
-
value(float) — the initial value
-
- Returns: a new MutableFloat instance containing the specified value
Public Instance Methods
value(...) -> float
-
Signature:
public float value() - Summary: Returns the current float value.
-
Parameters:
- (none)
- Returns: the current float value
getValue(...) -> float
-
Signature:
@Deprecated public float getValue() - Summary: Gets the value as a Float instance.
-
Parameters:
- (none)
- Returns: the current value
setValue(...) -> void
-
Signature:
public void setValue(final float newValue) - Summary: Sets the value to the specified float.
-
Parameters:
-
newValue(float) — the value to set
-
getAndSet(...) -> float
-
Signature:
public float getAndSet(final float newValue) - Summary: Returns the current value and then sets the new value.
-
Contract:
- <p> This method is useful when you need both the old and new values in a single operation, such as calculating deltas or maintaining state transitions.
-
Parameters:
-
newValue(float) — the new value to set
-
- Returns: the value before it was updated
setAndGet(...) -> float
-
Signature:
public float setAndGet(final float newValue) - Summary: Sets the value and then returns it.
-
Contract:
- This is useful when you want to update and immediately use the new value.
- <p> This method is particularly useful in fluent programming and when you need to both update a value and use it in the same expression.
-
Parameters:
-
newValue(float) — the new value to set
-
- Returns: the new value after it has been set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.FloatPredicate<E> predicate, final float newValue) throws E - Summary: Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
-
Contract:
- Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code MutableFloat num = MutableFloat.of(10.5f); boolean updated = num.setIf(v -> v < 15.0f, 20.5f); // returns true, value is now 20.5f updated = num.setIf(v -> v < 15.0f, 30.5f); // returns false, value remains 20.5f // More complex predicates MutableFloat temperature = MutableFloat.of(98.6f); // Only update if temperature is within normal range temperature.setIf(t -> t >= 97.0f && t <= 100.0f, 99.5f); // With exception handling MutableFloat price = MutableFloat.of(100.0f); price.setIf(p -> { if (p < 0) throw new IllegalStateException("Negative price"); return p < 150.0f; }, 120.0f); } </pre>
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — the predicate to test the current value -
newValue(float) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
isNaN(...) -> boolean
-
Signature:
public boolean isNaN() - Summary: Checks whether the float value is the special NaN (Not a Number) value.
-
Parameters:
- (none)
- Returns: {@code true} if the value is NaN, {@code false} otherwise
isInfinite(...) -> boolean
-
Signature:
public boolean isInfinite() - Summary: Checks whether the float value is infinite (positive or negative infinity).
-
Parameters:
- (none)
- Returns: {@code true} if the value is infinite, {@code false} otherwise
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final float delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(float) — the value to add
-
subtract(...) -> void
-
Signature:
public void subtract(final float delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(float) — the value to subtract
-
getAndIncrement(...) -> float
-
Signature:
public float getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> float
-
Signature:
public float getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> float
-
Signature:
public float incrementAndGet() - Summary: Increments the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> float
-
Signature:
public float decrementAndGet() - Summary: Decrements the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after decrementing
getAndAdd(...) -> float
-
Signature:
public float getAndAdd(final float delta) - Summary: Returns the current value and then adds the specified delta.
-
Contract:
- <p> This method is useful when you need to know the value before modification, commonly used in delta calculations or state tracking.
-
Parameters:
-
delta(float) — the value to add
-
- Returns: the value before adding
addAndGet(...) -> float
-
Signature:
public float addAndGet(final float delta) - Summary: Adds the specified delta to the current value and then returns it.
-
Contract:
- <p> This method is useful when you need the updated value immediately after modification, commonly used in calculations or conditional logic.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code MutableFloat num = MutableFloat.of(10.5f); float newVal = num.addAndGet(5.3f); // returns 15.8f, value is now 15.8f // Using the result directly in calculations MutableFloat score = MutableFloat.of(85.0f); float bonus = score.addAndGet(10.0f) * 0.1f; // Adds 10, then calculates 10% of 95.0f // Conditional logic based on updated value MutableFloat progress = MutableFloat.of(75.0f); if (progress.addAndGet(15.0f) >= 100.0f) { System.out.println("Task complete!"); // Executes if progress reaches 100% } } </pre>
-
Parameters:
-
delta(float) — the value to add
-
- Returns: the value after adding
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableFloat as an int by truncating the fractional part.
-
Parameters:
- (none)
- Returns: the value as an int, with fractional part truncated
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableFloat as a long by truncating the fractional part.
-
Parameters:
- (none)
- Returns: the value as a long, with fractional part truncated
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableFloat as a float.
-
Parameters:
- (none)
- Returns: the value as a float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableFloat as a double.
-
Parameters:
- (none)
- Returns: the value as a double
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableFloat other) - Summary: Compares this MutableFloat to another MutableFloat in ascending order.
-
Parameters:
-
other(MutableFloat) — the other MutableFloat to compare to, not null
-
- Returns: a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} and is a {@code MutableFloat} object that represents a float that has the identical bit pattern to the bit pattern of the float represented by this object.
- <p> For this purpose, two float values are considered to be the same if and only if the method {@link Float#floatToIntBits(float)} returns the same int value when applied to each.
- </p> <p> Note that in most cases, for two instances of class {@code MutableFloat} , {@code f1} and {@code f2} , the value of {@code f1.equals(f2)} is {@code true} if and only if {@code f1.floatValue() == f2.floatValue()} also has the value {@code true} .
- However, there are two exceptions: </p> <ul> <li> If {@code f1} and {@code f2} both represent {@code Float.NaN} , then the {@code equals} method returns {@code true} , even though {@code Float.NaN==Float.NaN} has the value {@code false} .
- </li> <li> If {@code f1} represents {@code +0.0f} while {@code f2} represents {@code -0.0f} , or vice versa, the {@code equal} test has the value {@code false} , even though {@code 0.0f==-0.0f} has the value {@code true} .
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects are the same; {@code false} otherwise
- See also: java.lang.Float#floatToIntBits(float)
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableFloat.
-
Parameters:
- (none)
- Returns: a suitable hash code
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of this MutableFloat's value.
-
Parameters:
- (none)
- Returns: the String representation of the current value
Class MutableInt (com.landawn.abacus.util.MutableInt)
A mutable wrapper for an {@code int} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableInt
-
Signature:
public static MutableInt of(final int value) - Summary: Creates a new MutableInt instance with the specified value.
-
Parameters:
-
value(int) — the initial value
-
- Returns: a new MutableInt instance containing the specified value
Public Instance Methods
value(...) -> int
-
Signature:
public int value() - Summary: Returns the current int value.
-
Parameters:
- (none)
- Returns: the current int value
getValue(...) -> int
-
Signature:
@Deprecated public int getValue() - Summary: Gets the value as a primitive int.
-
Parameters:
- (none)
- Returns: the current int value
setValue(...) -> void
-
Signature:
public void setValue(final int newValue) - Summary: Sets the value to the specified int.
-
Parameters:
-
newValue(int) — the value to set
-
getAndSet(...) -> int
-
Signature:
public int getAndSet(final int newValue) - Summary: Returns the current value and then sets the new value.
-
Parameters:
-
newValue(int) — the new value to set
-
- Returns: the value before it was updated
setAndGet(...) -> int
-
Signature:
public int setAndGet(final int newValue) - Summary: Sets the value and then returns it.
-
Contract:
- This is useful when you want to update and immediately use the new value.
-
Parameters:
-
newValue(int) — the new value to set
-
- Returns: the new value after it has been set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.IntPredicate<E> predicate, final int newValue) throws E - Summary: Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
-
Contract:
- Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — the predicate to test the current value -
newValue(int) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final int delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(int) — the value to add
-
subtract(...) -> void
-
Signature:
public void subtract(final int delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(int) — the value to subtract
-
getAndIncrement(...) -> int
-
Signature:
public int getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> int
-
Signature:
public int getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> int
-
Signature:
public int incrementAndGet() - Summary: Increments the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> int
-
Signature:
public int decrementAndGet() - Summary: Decrements the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after decrementing
getAndAdd(...) -> int
-
Signature:
public int getAndAdd(final int delta) - Summary: Returns the current value and then adds the specified delta.
-
Parameters:
-
delta(int) — the value to add
-
- Returns: the value before adding
addAndGet(...) -> int
-
Signature:
public int addAndGet(final int delta) - Summary: Adds the specified delta to the current value and then returns it.
-
Parameters:
-
delta(int) — the value to add
-
- Returns: the value after adding
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableInt as an int.
-
Parameters:
- (none)
- Returns: the int value represented by this object
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableInt as a long.
-
Parameters:
- (none)
- Returns: the value represented by this object after conversion to type long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableInt as a float.
-
Parameters:
- (none)
- Returns: the value represented by this object after conversion to type float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableInt as a double.
-
Parameters:
- (none)
- Returns: the value represented by this object after conversion to type double
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableInt other) - Summary: Compares this MutableInt to another MutableInt in ascending order.
-
Contract:
- Returns a negative value if this is less than the other, zero if equal, or a positive value if this is greater than the other.
-
Parameters:
-
other(MutableInt) — the other MutableInt to compare to, not null
-
- Returns: negative if this is less, zero if equal, positive if greater
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} and is a {@code MutableInt} object that contains the same {@code int} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects are the same; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableInt.
-
Parameters:
- (none)
- Returns: a hash code value for this object, equal to the primitive int value
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of this MutableInt's value.
-
Parameters:
- (none)
- Returns: the String representation of the current value
Class MutableLong (com.landawn.abacus.util.MutableLong)
A mutable wrapper for a {@code long} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableLong
-
Signature:
public static MutableLong of(final long value) - Summary: Creates a new MutableLong instance with the specified value.
-
Parameters:
-
value(long) — the initial value
-
- Returns: a new MutableLong instance containing the specified value
Public Instance Methods
value(...) -> long
-
Signature:
public long value() - Summary: Returns the current long value.
-
Parameters:
- (none)
- Returns: the current long value
getValue(...) -> long
-
Signature:
@Deprecated public long getValue() - Summary: Gets the value as a long.
-
Parameters:
- (none)
- Returns: the current long value
setValue(...) -> void
-
Signature:
public void setValue(final long newValue) - Summary: Sets the value to the specified long.
-
Parameters:
-
newValue(long) — the value to set
-
getAndSet(...) -> long
-
Signature:
public long getAndSet(final long newValue) - Summary: Returns the current value and then sets it to the new value.
-
Parameters:
-
newValue(long) — the new value to set
-
- Returns: the previous value before it was updated
setAndGet(...) -> long
-
Signature:
public long setAndGet(final long newValue) - Summary: Sets the value to the new value and then returns it.
-
Contract:
- This is useful when you want to update and immediately use the new value.
-
Parameters:
-
newValue(long) — the new value to set
-
- Returns: the new value that was set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.LongPredicate<E> predicate, final long newValue) throws E - Summary: Sets the value to the new value if the predicate evaluates to {@code true} when testing the current value.
-
Contract:
- Sets the value to the new value if the predicate evaluates to {@code true} when testing the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — the predicate to test against the current value -
newValue(long) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final long delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(long) — the value to add to the current value
-
subtract(...) -> void
-
Signature:
public void subtract(final long delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(long) — the value to subtract from the current value
-
getAndIncrement(...) -> long
-
Signature:
public long getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> long
-
Signature:
public long getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> long
-
Signature:
public long incrementAndGet() - Summary: Increments the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> long
-
Signature:
public long decrementAndGet() - Summary: Decrements the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after decrementing
getAndAdd(...) -> long
-
Signature:
public long getAndAdd(final long delta) - Summary: Returns the current value and then adds the specified delta to it.
-
Parameters:
-
delta(long) — the value to add to the current value
-
- Returns: the previous value before adding
addAndGet(...) -> long
-
Signature:
public long addAndGet(final long delta) - Summary: Adds the specified delta to the current value and then returns the new value.
-
Parameters:
-
delta(long) — the value to add to the current value
-
- Returns: the new value after adding
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableLong as an int.
-
Contract:
- This may involve truncation of the high-order bits if the value exceeds the range of an int ( {@link Integer#MIN_VALUE} to {@link Integer#MAX_VALUE} ).
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type int
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableLong as a long.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableLong as a float.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableLong as a double.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type double
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableLong other) - Summary: Compares this MutableLong to another MutableLong numerically.
-
Contract:
- Returns a negative value if this value is less than the other, zero if equal, or a positive value if this value is greater than the other.
-
Parameters:
-
other(MutableLong) — the other MutableLong to compare to, not null
-
- Returns: a negative integer, zero, or a positive integer as this value is less than, equal to, or greater than the specified MutableLong
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object for equality.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} , is a {@code MutableLong} object, and contains the same {@code long} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects represent the same long value; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableLong.
-
Parameters:
- (none)
- Returns: a hash code value for this object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the string representation of this MutableLong's value.
-
Parameters:
- (none)
- Returns: the string representation of the current value
Class MutableShort (com.landawn.abacus.util.MutableShort)
A mutable wrapper for a {@code short} value, providing methods to modify the wrapped value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> MutableShort
-
Signature:
public static MutableShort of(final short value) - Summary: Creates a new MutableShort instance with the specified value.
-
Parameters:
-
value(short) — the initial value
-
- Returns: a new MutableShort instance containing the specified value
Public Instance Methods
value(...) -> short
-
Signature:
public short value() - Summary: Returns the current short value.
-
Parameters:
- (none)
- Returns: the current short value
getValue(...) -> short
-
Signature:
@Deprecated public short getValue() - Summary: Returns the current short value.
-
Parameters:
- (none)
- Returns: the current short value
setValue(...) -> void
-
Signature:
public void setValue(final short newValue) - Summary: Sets the value to the specified short.
-
Parameters:
-
newValue(short) — the value to set
-
getAndSet(...) -> short
-
Signature:
public short getAndSet(final short newValue) - Summary: Returns the current value and then sets the new value.
-
Parameters:
-
newValue(short) — the new value to set
-
- Returns: the value before it was updated
setAndGet(...) -> short
-
Signature:
public short setAndGet(final short newValue) - Summary: Sets the value and then returns it.
-
Contract:
- This is useful when you want to update and immediately use the new value.
-
Parameters:
-
newValue(short) — the new value to set
-
- Returns: the new value after it has been set
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.ShortPredicate<E> predicate, final short newValue) throws E - Summary: Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
-
Contract:
- Sets the value to newValue if the predicate evaluates to {@code true} for the current value.
- If the predicate returns {@code false} , the value remains unchanged.
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — the predicate to test the current value -
newValue(short) — the new value to set if the condition is met
-
- Returns: {@code true} if the value was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
increment(...) -> void
-
Signature:
public void increment() - Summary: Increments the value by one.
-
Parameters:
- (none)
decrement(...) -> void
-
Signature:
public void decrement() - Summary: Decrements the value by one.
-
Parameters:
- (none)
add(...) -> void
-
Signature:
public void add(final short delta) - Summary: Adds the specified delta to the current value.
-
Parameters:
-
delta(short) — the value to add
-
subtract(...) -> void
-
Signature:
public void subtract(final short delta) - Summary: Subtracts the specified delta from the current value.
-
Parameters:
-
delta(short) — the value to subtract
-
getAndIncrement(...) -> short
-
Signature:
public short getAndIncrement() - Summary: Returns the current value and then increments it by one.
-
Parameters:
- (none)
- Returns: the value before incrementing
getAndDecrement(...) -> short
-
Signature:
public short getAndDecrement() - Summary: Returns the current value and then decrements it by one.
-
Parameters:
- (none)
- Returns: the value before decrementing
incrementAndGet(...) -> short
-
Signature:
public short incrementAndGet() - Summary: Increments the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after incrementing
decrementAndGet(...) -> short
-
Signature:
public short decrementAndGet() - Summary: Decrements the value by one and then returns it.
-
Parameters:
- (none)
- Returns: the value after decrementing
getAndAdd(...) -> short
-
Signature:
public short getAndAdd(final short delta) - Summary: Returns the current value and then adds the specified delta.
-
Parameters:
-
delta(short) — the value to add
-
- Returns: the value before adding
addAndGet(...) -> short
-
Signature:
public short addAndGet(final short delta) - Summary: Adds the specified delta to the current value and then returns it.
-
Parameters:
-
delta(short) — the value to add
-
- Returns: the value after adding
shortValue(...) -> short
-
Signature:
@Override public short shortValue() - Summary: Returns the value of this MutableShort as a short.
-
Parameters:
- (none)
- Returns: the short value represented by this object
intValue(...) -> int
-
Signature:
@Override public int intValue() - Summary: Returns the value of this MutableShort as an int after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type int
longValue(...) -> long
-
Signature:
@Override public long longValue() - Summary: Returns the value of this MutableShort as a long after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type long
floatValue(...) -> float
-
Signature:
@Override public float floatValue() - Summary: Returns the value of this MutableShort as a float after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type float
doubleValue(...) -> double
-
Signature:
@Override public double doubleValue() - Summary: Returns the value of this MutableShort as a double after a widening primitive conversion.
-
Parameters:
- (none)
- Returns: the numeric value represented by this object after conversion to type double
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final MutableShort other) - Summary: Compares this MutableShort to another MutableShort in ascending order.
-
Contract:
- Returns a negative value if this is less than the other, zero if equal, or a positive value if this is greater than the other.
-
Parameters:
-
other(MutableShort) — the other MutableShort to compare to, not null
-
- Returns: negative if this is less, zero if equal, positive if greater
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this object to the specified object.
-
Contract:
- The result is {@code true} if and only if the argument is not {@code null} and is a {@code MutableShort} object that contains the same {@code short} value as this object.
-
Parameters:
-
obj(Object) — the object to compare with, {@code null} returns false
-
- Returns: {@code true} if the objects are the same; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code for this MutableShort.
-
Parameters:
- (none)
- Returns: a hash code value for this object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the String representation of this MutableShort's value.
-
Parameters:
- (none)
- Returns: the String representation of the current value
Class N (com.landawn.abacus.util.N)
A comprehensive utility class providing commonly used operations for primitive types, Objects, Strings, Arrays, Collections, Maps, and JavaBeans.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
occurrencesOf(...) -> int
-
Signature:
public static int occurrencesOf(final boolean[] a, final boolean valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(boolean[]) — the boolean array to search in -
valueToFind(boolean) — the boolean value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(char\[\], char)
-
Signature:
public static int occurrencesOf(final char[] a, final char valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(char[]) — the char array to search in -
valueToFind(char) — the char value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(byte\[\], byte)
-
Signature:
public static int occurrencesOf(final byte[] a, final byte valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(byte[]) — the byte array to search in -
valueToFind(byte) — the byte value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(char\[\], char), #occurrencesOf(short\[\], short)
-
Signature:
public static int occurrencesOf(final short[] a, final short valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(short[]) — the short array to search in -
valueToFind(short) — the short value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(int\[\], int)
-
Signature:
public static int occurrencesOf(final int[] a, final int valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(int[]) — the int array to search in -
valueToFind(int) — the int value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(long\[\], long)
-
Signature:
public static int occurrencesOf(final long[] a, final long valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(long[]) — the long array to search in -
valueToFind(long) — the long value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(float\[\], float)
-
Signature:
public static int occurrencesOf(final float[] a, final float valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(float[]) — the float array to search in -
valueToFind(float) — the float value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(double\[\], double)
-
Signature:
public static int occurrencesOf(final double[] a, final double valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(double[]) — the double array to search in -
valueToFind(double) — the double value to count occurrences of
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(Object\[\], Object)
-
Signature:
public static int occurrencesOf(final Object[] a, final Object valueToFind) - Summary: Returns the number of occurrences of the specified value in the array.
-
Parameters:
-
a(Object[]) — the Object array to search in -
valueToFind(Object) — the Object value to count occurrences of (may be {@code null} )
-
- Returns: the number of occurrences (0 if array is {@code null} or empty)
- See also: #occurrencesOf(Iterable, Object)
-
Signature:
public static int occurrencesOf(final Iterable<?> c, final Object valueToFind) - Summary: Returns the number of occurrences of the specified value in the iterable.
-
Parameters:
-
c(Iterable<?>) — the Iterable to search in -
valueToFind(Object) — the Object value to count occurrences of (may be {@code null} )
-
- Returns: the number of occurrences (0 if iterable is {@code null} or empty)
- See also: #occurrencesOf(Iterator, Object)
-
Signature:
public static int occurrencesOf(final Iterator<?> iter, final Object valueToFind) throws ArithmeticException - Summary: Returns the number of occurrences of the specified value in the iterator.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to search in -
valueToFind(Object) — the Object value to count occurrences of (may be {@code null} )
-
- Returns: the number of occurrences (0 if iterator is {@code null} )
-
Throws:
-
java.lang.ArithmeticException— if the number of occurrences exceeds Integer.MAX_VALUE
-
- See also: Iterators#occurrencesOf(Iterator, Object), #occurrencesOf(String, char)
-
Signature:
public static int occurrencesOf(final String str, final char valueToFind) - Summary: Returns the number of occurrences of the specified character in the string.
-
Parameters:
-
str(String) — the String to search in -
valueToFind(char) — the char value to count occurrences of
-
- Returns: the number of occurrences (0 if string is {@code null} or empty)
- See also: Strings#countMatches(String, char), #occurrencesOf(String, String)
-
Signature:
public static int occurrencesOf(final String str, final String valueToFind) - Summary: Returns the number of occurrences of the specified substring in the string.
-
Parameters:
-
str(String) — the String to search in -
valueToFind(String) — the String value to count occurrences of
-
- Returns: the number of occurrences (0 if string is {@code null} or empty)
- See also: Strings#countMatches(String, String)
occurrencesMap(...) -> Map<T, Integer>
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final T[] a) - Summary: Returns a map containing the occurrence count of each distinct element in the array.
-
Parameters:
-
a(T[]) — the array to count occurrences from
-
- Returns: the map with elements as keys and occurrence counts as values (empty if array is {@code null} or empty)
- See also: #occurrencesMap(Object\[\], Supplier)
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final T[] a, final Supplier<Map<T, Integer>> mapSupplier) - Summary: Returns a map containing the occurrence count of each distinct element in the array.
-
Parameters:
-
a(T[]) — the array to count occurrences from -
mapSupplier(Supplier<Map<T, Integer>>) — the supplier for the map to use (e.g., TreeMap::new for sorted keys)
-
- Returns: the map with elements as keys and occurrence counts as values
- See also: #occurrencesMap(Iterable)
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final Iterable<? extends T> c) - Summary: Returns a map containing the occurrence count of each distinct element in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to count occurrences from
-
- Returns: the map with elements as keys and occurrence counts as values (empty if iterable is {@code null} or empty)
- See also: #occurrencesMap(Iterable, Supplier)
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final Iterable<? extends T> c, final Supplier<Map<T, Integer>> mapSupplier) - Summary: Returns a map containing the occurrence count of each distinct element in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to count occurrences from -
mapSupplier(Supplier<Map<T, Integer>>) — the supplier for the map to use (e.g., TreeMap::new for sorted keys)
-
- Returns: the map with elements as keys and occurrence counts as values
- See also: #occurrencesMap(Iterator)
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final Iterator<? extends T> iter) - Summary: Returns a map containing the occurrence count of each distinct element in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to count occurrences from
-
- Returns: the map with elements as keys and occurrence counts as values (empty if iterator is {@code null} )
- See also: #occurrencesMap(Iterator, Supplier)
-
Signature:
public static <T> Map<T, Integer> occurrencesMap(final Iterator<? extends T> iter, final Supplier<Map<T, Integer>> mapSupplier) - Summary: Returns a map containing the occurrence count of each distinct element in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to count occurrences from -
mapSupplier(Supplier<Map<T, Integer>>) — the supplier for the map to use (e.g., TreeMap::new for sorted keys)
-
- Returns: the map with elements as keys and occurrence counts as values
contains(...) -> boolean
-
Signature:
public static boolean contains(final boolean[] a, final boolean valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(boolean[]) — the boolean array -
valueToFind(boolean) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(boolean\[\], boolean)
-
Signature:
public static boolean contains(final char[] a, final char valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(char[]) — the char array -
valueToFind(char) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(char\[\], char)
-
Signature:
public static boolean contains(final byte[] a, final byte valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(byte[]) — the byte array -
valueToFind(byte) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(byte\[\], byte)
-
Signature:
public static boolean contains(final short[] a, final short valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(short[]) — the short array -
valueToFind(short) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(short\[\], short)
-
Signature:
public static boolean contains(final int[] a, final int valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(int[]) — the int array -
valueToFind(int) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(int\[\], int)
-
Signature:
public static boolean contains(final long[] a, final long valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(long[]) — the long array -
valueToFind(long) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(long\[\], long)
-
Signature:
public static boolean contains(final float[] a, final float valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(float[]) — the float array -
valueToFind(float) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(float\[\], float)
-
Signature:
public static boolean contains(final double[] a, final double valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(double[]) — the double array -
valueToFind(double) — the value to search for
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(double\[\], double)
-
Signature:
public static boolean contains(final Object[] a, final Object valueToFind) - Summary: Returns {@code true} if the array contains the specified value.
-
Contract:
- Returns {@code true} if the array contains the specified value.
-
Parameters:
-
a(Object[]) — the Object array -
valueToFind(Object) — the value to search for (may be {@code null} )
-
- Returns: {@code true} if the array contains the value ( {@code false} if array is {@code null} or empty)
- See also: #indexOf(Object\[\], Object)
-
Signature:
public static boolean contains(final Collection<?> c, final Object valueToFind) - Summary: Returns {@code true} if the collection contains the specified value.
-
Contract:
- Returns {@code true} if the collection contains the specified value.
-
Parameters:
-
c(Collection<?>) — the Collection to search in -
valueToFind(Object) — the value to search for (may be {@code null} )
-
- Returns: {@code true} if the collection contains the value ( {@code false} if collection is {@code null} or empty)
- See also: Collection#contains(Object), #contains(Iterable, Object)
-
Signature:
public static boolean contains(final Iterable<?> c, final Object valueToFind) - Summary: Returns {@code true} if the iterable contains the specified value.
-
Contract:
- Returns {@code true} if the iterable contains the specified value.
-
Parameters:
-
c(Iterable<?>) — the Iterable to search in -
valueToFind(Object) — the value to search for (may be {@code null} )
-
- Returns: {@code true} if the iterable contains the value ( {@code false} if iterable is {@code null} or empty)
- See also: #contains(Collection, Object)
-
Signature:
public static boolean contains(final Iterator<?> iter, final Object valueToFind) - Summary: Returns {@code true} if the iterator contains the specified value.
-
Contract:
- Returns {@code true} if the iterator contains the specified value.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to search in -
valueToFind(Object) — the value to search for (may be {@code null} )
-
- Returns: {@code true} if the iterator contains the value ( {@code false} if iterator is {@code null} )
- See also: #contains(Iterable, Object)
containsAll(...) -> boolean
-
Signature:
public static boolean containsAll(final Collection<?> c, final Collection<?> valuesToFind) - Summary: Returns {@code true} if the collection contains all the specified values.
-
Contract:
- Returns {@code true} if the collection contains all the specified values.
-
Parameters:
-
c(Collection<?>) — the Collection to search in -
valuesToFind(Collection<?>) — the values to check for
-
- Returns: {@code true} if collection contains all values ( {@code true} if valuesToFind is {@code null} /empty; {@code false} if collection is {@code null} /empty)
- See also: Collection#containsAll(Collection), #containsAll(Collection, Object...)
-
Signature:
public static boolean containsAll(final Collection<?> c, final Object... valuesToFind) - Summary: Returns {@code true} if the collection contains all the specified values.
-
Contract:
- Returns {@code true} if the collection contains all the specified values.
-
Parameters:
-
c(Collection<?>) — the Collection to search in -
valuesToFind(Object[]) — the values to check for
-
- Returns: {@code true} if collection contains all values ( {@code true} if valuesToFind is {@code null} /empty; {@code false} if collection is {@code null} /empty)
- See also: #containsAll(Collection, Collection)
-
Signature:
public static boolean containsAll(final Iterable<?> c, final Collection<?> valuesToFind) - Summary: Returns {@code true} if the iterable contains all the specified values.
-
Contract:
- Returns {@code true} if the iterable contains all the specified values.
-
Parameters:
-
c(Iterable<?>) — the Iterable to search in -
valuesToFind(Collection<?>) — the values to check for
-
- Returns: {@code true} if iterable contains all values ( {@code true} if valuesToFind is {@code null} /empty; {@code false} if iterable is {@code null} /empty)
- See also: #containsAll(Collection, Collection)
-
Signature:
public static boolean containsAll(final Iterator<?> iter, final Collection<?> valuesToFind) - Summary: Returns {@code true} if the iterator contains all the specified values.
-
Contract:
- Returns {@code true} if the iterator contains all the specified values.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to search in -
valuesToFind(Collection<?>) — the values to check for
-
- Returns: {@code true} if iterator contains all values ( {@code true} if valuesToFind is {@code null} /empty; {@code false} if iterator is {@code null} )
- See also: #containsAll(Iterable, Collection)
containsAny(...) -> boolean
-
Signature:
public static boolean containsAny(final Collection<?> c, final Collection<?> valuesToFind) - Summary: Returns {@code true} if the collection contains any of the specified values.
-
Contract:
- Returns {@code true} if the collection contains any of the specified values.
-
Parameters:
-
c(Collection<?>) — the Collection to search in -
valuesToFind(Collection<?>) — the values to check for
-
- Returns: {@code true} if collection contains any value ( {@code false} if either collection is {@code null} or empty)
- See also: #disjoint(Collection, Collection), #containsAll(Collection, Collection)
-
Signature:
public static boolean containsAny(final Collection<?> c, final Object... valuesToFind) - Summary: Returns {@code true} if the collection contains any of the specified values.
-
Contract:
- Returns {@code true} if the collection contains any of the specified values.
-
Parameters:
-
c(Collection<?>) — the Collection to search in -
valuesToFind(Object[]) — the values to check for
-
- Returns: {@code true} if collection contains any value ( {@code false} if collection is {@code null} /empty or no values provided)
- See also: #containsAny(Collection, Collection)
-
Signature:
public static boolean containsAny(final Iterable<?> c, final Set<?> valuesToFind) - Summary: Returns {@code true} if the iterable contains any of the specified values.
-
Contract:
- Returns {@code true} if the iterable contains any of the specified values.
-
Parameters:
-
c(Iterable<?>) — the Iterable to search in -
valuesToFind(Set<?>) — the Set of values to check for
-
- Returns: {@code true} if iterable contains any value ( {@code false} if either parameter is {@code null} or empty)
- See also: #containsAny(Collection, Collection)
-
Signature:
public static boolean containsAny(final Iterator<?> iter, final Set<?> valuesToFind) - Summary: Returns {@code true} if the iterator contains any of the specified values.
-
Contract:
- Returns {@code true} if the iterator contains any of the specified values.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to search in -
valuesToFind(Set<?>) — the Set of values to check for
-
- Returns: {@code true} if iterator contains any value ( {@code false} if iterator is {@code null} or valuesToFind is {@code null} /empty)
- See also: #containsAny(Iterable, Set)
containsNone(...) -> boolean
-
Signature:
public static boolean containsNone(final Collection<?> c, final Collection<?> valuesToFind) - Summary: Returns {@code true} if the collection contains none of the specified values.
-
Contract:
- Returns {@code true} if the collection contains none of the specified values.
- Returns {@code true} if either collection is {@code null} or empty.
-
Parameters:
-
c(Collection<?>) — the Collection to check -
valuesToFind(Collection<?>) — the values to check for absence
-
- Returns: {@code true} if the collection contains none of the specified values, {@code false} otherwise
- See also: #containsAny(Collection, Collection)
-
Signature:
public static boolean containsNone(final Collection<?> c, final Object... valuesToFind) - Summary: Returns {@code true} if the collection contains none of the specified values.
-
Contract:
- Returns {@code true} if the collection contains none of the specified values.
- Returns {@code true} if the collection is {@code null} or empty, or if no values are provided.
-
Parameters:
-
c(Collection<?>) — the Collection to check -
valuesToFind(Object[]) — the values to check for absence
-
- Returns: {@code true} if the collection contains none of the specified values, {@code false} otherwise
- See also: #containsNone(Collection, Collection)
-
Signature:
public static boolean containsNone(final Iterable<?> c, final Set<?> valuesToFind) - Summary: Returns {@code true} if the iterable contains none of the specified values.
-
Contract:
- Returns {@code true} if the iterable contains none of the specified values.
- Returns {@code true} if either parameter is {@code null} or empty.
-
Parameters:
-
c(Iterable<?>) — the Iterable to check -
valuesToFind(Set<?>) — the Set of values to check for absence
-
- Returns: {@code true} if the iterable contains none of the specified values, {@code false} otherwise
- See also: #containsAny(Iterable, Set)
-
Signature:
public static boolean containsNone(final Iterator<?> iter, final Set<?> valuesToFind) - Summary: Returns {@code true} if the iterator contains none of the specified values.
-
Contract:
- Returns {@code true} if the iterator contains none of the specified values.
- Returns {@code true} if either parameter is {@code null} or empty.
-
Parameters:
-
iter(Iterator<?>) — the Iterator to check -
valuesToFind(Set<?>) — the Set of values to check for absence
-
- Returns: {@code true} if the iterator contains none of the specified values, {@code false} otherwise
- See also: #containsAny(Iterator, Set)
slice(...) -> ImmutableList<T>
-
Signature:
public static <T> ImmutableList<T> slice(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an immutable slice of the array from the specified range \[fromIndex, toIndex).
-
Contract:
- Returns ImmutableList.empty() if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to slice -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: an immutable list containing the slice, or ImmutableList.empty() if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #slice(List, int, int)
-
Signature:
public static <T> ImmutableList<T> slice(final List<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an immutable slice of the list from the specified range \[fromIndex, toIndex).
-
Contract:
- Returns ImmutableList.empty() if the list is {@code null} or empty.
-
Parameters:
-
c(List<? extends T>) — the list to slice -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: an immutable list containing the slice, or ImmutableList.empty() if the list is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- Performance: Uses List.subList() for O(1) view creation without copying elements.
- See also: List#subList(int, int)
-
Signature:
public static <T> ImmutableCollection<T> slice(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an immutable slice of the collection from the specified range \[fromIndex, toIndex).
-
Contract:
- Returns ImmutableList.empty() if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection to slice -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: an immutable collection containing the slice, or ImmutableList.empty() if the collection is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- Performance: For List collections, uses List.subList() for O(1) view creation.
- See also: #slice(List, int, int)
-
Signature:
public static <T> ObjIterator<T> slice(final Iterator<? extends T> iter, final int fromIndex, final int toIndex) - Summary: Returns a slice of the iterator from the specified range \[fromIndex, toIndex).
-
Contract:
- Returns an empty iterator if iter is {@code null} or fromIndex equals toIndex.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to slice -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive)
-
- Returns: an iterator containing the slice, or an empty iterator if iter is {@code null} or fromIndex equals toIndex
- See also: Iterators#skipAndLimit(Iterator, long, long)
split(...) -> List<boolean\[\]>
-
Signature:
public static List<boolean[]> split(final boolean[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(boolean[]) — the boolean array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(boolean\[\], int, int, int)
-
Signature:
public static List<boolean[]> split(final boolean[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(boolean[]) — the boolean array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(boolean\[\], int)
-
Signature:
public static List<char[]> split(final char[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(char[]) — the char array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(char\[\], int, int, int)
-
Signature:
public static List<char[]> split(final char[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(char[]) — the char array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(char\[\], int)
-
Signature:
public static List<byte[]> split(final byte[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(byte[]) — the byte array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(byte\[\], int, int, int)
-
Signature:
public static List<byte[]> split(final byte[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(byte[]) — the byte array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(byte\[\], int)
-
Signature:
public static List<short[]> split(final short[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(short[]) — the short array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(short\[\], int, int, int)
-
Signature:
public static List<short[]> split(final short[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(short[]) — the short array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(short\[\], int)
-
Signature:
public static List<int[]> split(final int[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(int[]) — the int array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(int\[\], int, int, int)
-
Signature:
public static List<int[]> split(final int[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(int[]) — the int array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(int\[\], int)
-
Signature:
public static List<long[]> split(final long[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(long[]) — the long array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(long\[\], int, int, int)
-
Signature:
public static List<long[]> split(final long[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(long[]) — the long array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(long\[\], int)
-
Signature:
public static List<float[]> split(final float[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(float[]) — the float array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(float\[\], int, int, int)
-
Signature:
public static List<float[]> split(final float[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(float[]) — the float array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(float\[\], int)
-
Signature:
public static List<double[]> split(final double[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(double[]) — the double array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(double\[\], int, int, int)
-
Signature:
public static List<double[]> split(final double[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(double[]) — the double array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(double\[\], int)
-
Signature:
public static <T> List<T[]> split(final T[] a, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of subarrays by splitting the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The last chunk may be smaller if the array length is not evenly divisible.
-
Parameters:
-
a(T[]) — the array to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(Object\[\], int, int, int)
-
Signature:
public static <T> List<T[]> split(final T[] a, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of subarrays by splitting a range of the array into chunks of the specified size.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
a(T[]) — the array to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of subarrays, or an empty list if the array is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(Object\[\], int)
-
Signature:
public static <T> List<List<T>> split(final Collection<? extends T> c, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of sub-collections by splitting the collection into chunks of the specified size.
-
Contract:
- Returns an empty list if the collection is {@code null} or empty.
- The last chunk may be smaller if the collection size is not evenly divisible.
-
Parameters:
-
c(Collection<? extends T>) — the collection to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of sub-collections, or an empty list if the collection is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- Performance: For List collections, returns views (subLists) with O(1) per chunk; for other collections, creates new ArrayLists.
- See also: #split(Collection, int, int, int)
-
Signature:
public static <T> List<List<T>> split(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of sub-collections by splitting a range of the collection into chunks of the specified size.
-
Contract:
- Returns an empty list if the collection is {@code null} or empty, or if fromIndex equals toIndex.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
c(Collection<? extends T>) — the collection to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of sub-collections, or an empty list if the collection is {@code null} /empty or fromIndex equals toIndex
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(Collection, int)
-
Signature:
public static <T> List<List<T>> split(final Iterable<? extends T> c, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of sub-collections by splitting the iterable into chunks of the specified size.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
- The last chunk may be smaller if the iterable size is not evenly divisible.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of sub-collections, or an empty list if the iterable is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(Collection, int), #split(Iterator, int)
-
Signature:
public static <T> ObjIterator<List<T>> split(final Iterator<? extends T> iter, final int chunkSize) throws IllegalArgumentException - Summary: Returns a lazy iterator that splits the input iterator into chunks of the specified size.
-
Contract:
- Returns an empty iterator if the input iterator is {@code null} .
- The last chunk may be smaller if the total element count is not evenly divisible.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to split -
chunkSize(int) — the size of each chunk
-
- Returns: a lazy iterator producing lists of elements, or an empty iterator if the input is {@code null}
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(Iterable, int), #toList(Iterator)
-
Signature:
public static List<String> split(final CharSequence str, final int chunkSize) throws IllegalArgumentException - Summary: Returns a list of substrings by splitting the string into chunks of the specified size.
-
Contract:
- Returns an empty list if the string is {@code null} or empty.
- The last chunk may be smaller if the string length is not evenly divisible.
-
Parameters:
-
str(CharSequence) — the string to split -
chunkSize(int) — the size of each chunk
-
- Returns: a list of string chunks, or an empty list if the string is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive
-
- See also: #split(CharSequence, int, int, int)
-
Signature:
public static List<String> split(final CharSequence str, final int fromIndex, final int toIndex, final int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a list of substrings by splitting a range of the string into chunks of the specified size.
-
Contract:
- Returns an empty list if the string is {@code null} or empty.
- The last chunk may be smaller if the range length is not evenly divisible.
-
Parameters:
-
str(CharSequence) — the string to split -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
chunkSize(int) — the size of each chunk
-
- Returns: a list of string chunks, or an empty list if the string is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if chunkSize is not positive -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #split(CharSequence, int)
splitByChunkCount(...) -> List<T>
-
Signature:
public static <T> List<T> splitByChunkCount(final int totalSize, final int maxChunkCount, final IntBiFunction<? extends T> func) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The size of returned List may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
func(IntBiFunction<? extends T>) — the function to apply to each chunk's start and end indices to produce a result
-
- Returns: a Stream of the mapped chunk values
- See also: #splitByChunkCount(int, int, boolean, IntBiFunction)
-
Signature:
public static <T> List<T> splitByChunkCount(final int totalSize, final int maxChunkCount, final boolean sizeSmallerFirst, final IntBiFunction<? extends T> func) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The size of returned List may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
sizeSmallerFirst(boolean) — if {@code true} , smaller chunks will be created first; otherwise, larger chunks will be created first -
func(IntBiFunction<? extends T>) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: a Stream of the mapped chunk values
- See also: #splitByChunkCount(Collection, int, boolean), Stream#splitByChunkCount(int, int, boolean, IntBiFunction), IntStream#splitByChunkCount(int, int, IntBinaryOperator)
-
Signature:
public static <T> List<List<T>> splitByChunkCount(final Collection<? extends T> c, final int maxChunkCount) - Summary: Splits the input collection into sub-lists based on the specified maximum chunk count.
-
Contract:
- <br/> The size of returned List may be less than the specified {@code maxChunkCount} if the input Collection size is less than {@code maxChunkCount} .
-
Parameters:
-
c(Collection<? extends T>) — the input collection to be split -
maxChunkCount(int) — the maximum number of chunks to split into
-
- Returns: a list of sub-lists.
- See also: #splitByChunkCount(Collection, int, boolean)
-
Signature:
public static <T> List<List<T>> splitByChunkCount(final Collection<? extends T> c, final int maxChunkCount, final boolean sizeSmallerFirst) - Summary: Splits the input collection into sub-lists based on the specified maximum chunk count.
-
Contract:
- <br/> The size of returned List may be less than the specified {@code maxChunkCount} if the input Collection size is less than {@code maxChunkCount} .
-
Parameters:
-
c(Collection<? extends T>) — the input collection to be split -
maxChunkCount(int) — the maximum number of chunks to split into -
sizeSmallerFirst(boolean) — if {@code true} , smaller chunks will be created first; otherwise, larger chunks will be created first
-
- Returns: a list of sub-lists.
- See also: #splitByChunkCount(int, int, boolean, IntBiFunction), Stream#splitByChunkCount(int, int, boolean, IntBiFunction), IntStream#splitByChunkCount(int, int, boolean, IntBinaryOperator)
concat(...) -> boolean\[\]
-
Signature:
public static boolean[] concat(final boolean[] a, final boolean[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the first array -
b(boolean[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(boolean\[\]...)
-
Signature:
public static boolean[] concat(final boolean[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(boolean[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(boolean\[\], boolean\[\])
-
Signature:
public static char[] concat(final char[] a, final char[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(char[]) — the first array -
b(char[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(char\[\]...)
-
Signature:
public static char[] concat(final char[]... aa) - Summary: Concatenates multiple char arrays into a single new array.
-
Parameters:
-
aa(char[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(char\[\], char\[\])
-
Signature:
public static byte[] concat(final byte[] a, final byte[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(byte[]) — the first array -
b(byte[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(byte\[\]...)
-
Signature:
public static byte[] concat(final byte[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(byte[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(byte\[\], byte\[\])
-
Signature:
public static short[] concat(final short[] a, final short[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(short[]) — the first array -
b(short[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(short\[\]...)
-
Signature:
public static short[] concat(final short[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(short[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(short\[\], short\[\])
-
Signature:
public static int[] concat(final int[] a, final int[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(int[]) — the first array -
b(int[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(int\[\]...)
-
Signature:
public static int[] concat(final int[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(int[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(int\[\], int\[\])
-
Signature:
public static long[] concat(final long[] a, final long[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(long[]) — the first array -
b(long[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(long\[\]...)
-
Signature:
public static long[] concat(final long[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(long[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(long\[\], long\[\])
-
Signature:
public static float[] concat(final float[] a, final float[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(float[]) — the first array -
b(float[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(float\[\]...)
-
Signature:
public static float[] concat(final float[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(float[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(float\[\], float\[\])
-
Signature:
public static double[] concat(final double[] a, final double[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
-
Parameters:
-
a(double[]) — the first array -
b(double[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(double\[\]...)
-
Signature:
public static double[] concat(final double[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns an empty array if the input is {@code null} or empty.
-
Parameters:
-
aa(double[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(double\[\], double\[\])
-
Signature:
@MayReturnNull public static <T> T[] concat(final T[] a, final T[] b) - Summary: Returns a new array containing all elements from both input arrays.
-
Contract:
- Returns {@code null} if both arrays are {@code null} .
-
Parameters:
-
a(T[]) — the first array -
b(T[]) — the second array
-
- Returns: a new array containing elements from both arrays
- See also: #concat(Object\[\]...), #merge(Object\[\], Object\[\], BiFunction)
-
Signature:
@MayReturnNull @SafeVarargs public static <T> T[] concat(final T[]... aa) - Summary: Returns a new array containing all elements from all input arrays in order.
-
Contract:
- Returns {@code null} if the input is {@code null} .
-
Parameters:
-
aa(T[][]) — the arrays to concatenate
-
- Returns: a new array containing all elements from all input arrays
- See also: #concat(Object\[\], Object\[\]), System#arraycopy(Object, int, Object, int, int)
-
Signature:
public static <T> List<T> concat(final Iterable<? extends T> a, final Iterable<? extends T> b) - Summary: Returns a new list containing all elements from both iterables.
-
Contract:
- Returns an empty list if both iterables are {@code null} or empty.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable -
b(Iterable<? extends T>) — the second iterable
-
- Returns: a new list containing elements from both iterables
- See also: #concat(Iterable\[\]), #merge(Iterable, Iterable, BiFunction)
-
Signature:
@SafeVarargs public static <T> List<T> concat(final Iterable<? extends T>... a) - Summary: Returns a new list containing all elements from all iterables in order.
-
Contract:
- Returns an empty list if the input is {@code null} or empty.
-
Parameters:
-
a(Iterable<? extends T>[]) — the iterables to concatenate
-
- Returns: a new list containing all elements from all iterables
- See also: #concat(Collection), #merge(Collection, BiFunction)
-
Signature:
public static <T> List<T> concat(final Collection<? extends Iterable<? extends T>> c) - Summary: Returns a new list containing all elements from all iterables in the collection in order.
-
Contract:
- Returns an empty list if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends Iterable<? extends T>>) — the collection of iterables to concatenate
-
- Returns: a new list containing all elements from all iterables
- See also: #concat(Collection, IntFunction), #merge(Collection, BiFunction)
-
Signature:
public static <T, C extends Collection<T>> C concat(final Collection<? extends Iterable<? extends T>> c, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing all elements from all iterables in the collection in order.
-
Contract:
- Returns an empty collection if the input is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends Iterable<? extends T>>) — the collection of iterables to concatenate -
supplier(IntFunction<? extends C>) — the function to create the result collection
-
- Returns: a new collection containing all elements from all iterables
- See also: #concat(Collection), #merge(Collection, BiFunction, IntFunction)
-
Signature:
public static <T> ObjIterator<T> concat(final Iterator<? extends T> a, final Iterator<? extends T> b) - Summary: Concatenates two iterators into a new ObjIterator.
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator. -
b(Iterator<? extends T>) — the second iterator.
-
- Returns: a new ObjIterator that contains the elements of <i> a </i> followed by the elements of <i> b </i> .
- See also: Iterators#concat(Iterator...)
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> concat(final Iterator<? extends T>... a) - Summary: Concatenates multiple iterators into a new ObjIterator.
-
Parameters:
-
a(Iterator<? extends T>[]) — the array of iterators to be concatenated.
-
- Returns: a new ObjIterator that contains the elements of each iterator in <i> a </i> in the same order.
- See also: Iterators#concat(Iterator...)
flatten(...) -> boolean\[\]
-
Signature:
public static boolean[] flatten(final boolean[][] a) - Summary: Flattens a two-dimensional boolean array into a one-dimensional boolean array.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(boolean[][]) — the two-dimensional array to flatten
-
- Returns: a one-dimensional array containing all elements from all {@code non-null} rows
- See also: #flatten(char\[\]\[\])
-
Signature:
public static char[] flatten(final char[][] a) - Summary: Flattens a two-dimensional char array into a one-dimensional char array.
-
Parameters:
-
a(char[][]) — the two-dimensional char array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional char array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static byte[] flatten(final byte[][] a) - Summary: Flattens a two-dimensional byte array into a one-dimensional byte array.
-
Parameters:
-
a(byte[][]) — the two-dimensional byte array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional byte array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static short[] flatten(final short[][] a) - Summary: Flattens a two-dimensional short array into a one-dimensional short array.
-
Parameters:
-
a(short[][]) — the two-dimensional short array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional short array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static int[] flatten(final int[][] a) - Summary: Flattens a two-dimensional int array into a one-dimensional int array.
-
Parameters:
-
a(int[][]) — the two-dimensional int array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional int array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static long[] flatten(final long[][] a) - Summary: Flattens a two-dimensional long array into a one-dimensional long array.
-
Parameters:
-
a(long[][]) — the two-dimensional long array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional long array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static float[] flatten(final float[][] a) - Summary: Flattens a two-dimensional float array into a one-dimensional float array.
-
Parameters:
-
a(float[][]) — the two-dimensional float array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional float array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static double[] flatten(final double[][] a) - Summary: Flattens a two-dimensional double array into a one-dimensional double array.
-
Parameters:
-
a(double[][]) — the two-dimensional double array to be flattened, may be {@code null} or empty
-
- Returns: a one-dimensional double array containing all elements from all {@code non-null} rows in the input array. Returns an empty array if the input array is {@code null} or empty, or if all rows are {@code null} .
- See also: #flatten(Object\[\]\[\])
-
Signature:
@MayReturnNull public static <T> T[] flatten(final T[][] a) - Summary: Flattens a two-dimensional array into an one-dimensional array.
-
Parameters:
-
a(T[][]) — the two-dimensional array to be flattened, may be {@code null}
-
- Returns: a one-dimensional array containing all elements in the input array. Returns {@code null} if the input array is {@code null}
- See also: #flatten(Object\[\]\[\], Class)
-
Signature:
public static <T> T[] flatten(final T[][] a, final Class<T> componentType) - Summary: Flattens a two-dimensional array into an one-dimensional array.
-
Parameters:
-
a(T[][]) — the two-dimensional array to be flattened, may be {@code null} or empty -
componentType(Class<T>) — the class object representing the component type of the new array, must not be {@code null}
-
- Returns: a one-dimensional array containing all elements in the input array. Returns an empty array if the input array is {@code null}
- See also: #flatten(Object\[\]\[\])
-
Signature:
public static <T> List<T> flatten(final Iterable<? extends Iterable<? extends T>> c) - Summary: Flattens an {@code Iterable} of {@code Iterable<T>} into an one-dimensional List.
-
Parameters:
-
c(Iterable<? extends Iterable<? extends T>>) — the two-dimensional {@code Iterable} to be flattened.
-
- Returns: a one-dimensional List containing all elements in the input {@code Iterable} . Returns an empty List if the input {@code Iterable} is {@code null} or empty.
-
Signature:
@SuppressWarnings("rawtypes") public static <T, C extends Collection<T>> C flatten(final Iterable<? extends Iterable<? extends T>> c, final IntFunction<? extends C> supplier) - Summary: Flattens an {@code Iterable} of {@code Iterable<T>} into an one-dimensional Collection.
-
Parameters:
-
c(Iterable<? extends Iterable<? extends T>>) — the two-dimensional {@code Iterable} to be flattened. -
supplier(IntFunction<? extends C>) — the function that generates the Collection instance.
-
- Returns: a one-dimensional Collection containing all elements in the input {@code Iterable} . Returns an empty Collection if the input {@code Iterable} is {@code null} or empty.
-
Signature:
public static <T> ObjIterator<T> flatten(final Iterator<? extends Iterator<? extends T>> iters) - Summary: Flattens an {@code Iterator} of {@code Iterator<T>} into an one-dimensional Iterator.
-
Parameters:
-
iters(Iterator<? extends Iterator<? extends T>>) — the two-dimensional Iterator to be flattened.
-
- Returns: a one-dimensional Iterator containing all elements in the input {@code Iterator} . Returns an empty Iterator if the input {@code Iterator} is {@code null} .
flattenEachElement(...) -> List<?>
-
Signature:
@Beta public static List<?> flattenEachElement(final Iterable<?> c) - Summary: Flattens each element of the provided {@code Iterable} if it's an {@code Iterable} itself, otherwise just adds it to the result List.
-
Contract:
- Flattens each element of the provided {@code Iterable} if it's an {@code Iterable} itself, otherwise just adds it to the result List.
-
Parameters:
-
c(Iterable<?>) — the {@code Iterable} to be processed. Each element is checked if it's an {@code Iterable} and flattened if so.
-
- Returns: a List containing the flattened elements of the input {@code Iterable} . If the input {@code Iterable} is {@code null} , an empty List is returned.
-
Signature:
@Beta public static <T, C extends Collection<T>> C flattenEachElement(final Iterable<?> c, final Supplier<? extends C> supplier) - Summary: Flattens each element of the provided {@code Iterable} if it's an {@code Iterable} itself, otherwise just adds it to the result Collection.
-
Contract:
- Flattens each element of the provided {@code Iterable} if it's an {@code Iterable} itself, otherwise just adds it to the result Collection.
-
Parameters:
-
c(Iterable<?>) — the {@code Iterable} to be processed. Each element is checked if it's an {@code Iterable} and flattened if so. -
supplier(Supplier<? extends C>) — the function that generates the Collection instance.
-
- Returns: a Collection containing the flattened elements of the input {@code Iterable} . If the input {@code Iterable} is {@code null} , an empty Collection is returned.
intersection(...) -> boolean\[\]
-
Signature:
@SuppressWarnings("deprecation") public static boolean[] intersection(final boolean[] a, final boolean[] b) - Summary: Returns the elements that are present in both of the specified boolean arrays.
-
Contract:
- Returns an empty array if either input array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the first array -
b(boolean[]) — the second array
-
- Returns: a new array containing elements present in both arrays
- See also: BooleanList#intersection(BooleanList), #intersection(char\[\], char\[\])
-
Signature:
@SuppressWarnings("deprecation") public static char[] intersection(final char[] a, final char[] b) - Summary: Returns the elements that are present in both of the specified char arrays.
-
Parameters:
-
a(char[]) — the first char array -
b(char[]) — the second char array
-
- Returns: a new char array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: CharList#intersection(CharList), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static byte[] intersection(final byte[] a, final byte[] b) - Summary: Returns the elements that are present in both of the specified byte arrays.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array
-
- Returns: a new byte array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: ByteList#intersection(ByteList), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static short[] intersection(final short[] a, final short[] b) - Summary: Returns the elements that are present in both of the specified short arrays.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array
-
- Returns: a new short array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: ShortList#intersection(ShortList), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static int[] intersection(final int[] a, final int[] b) - Summary: Returns the elements that are present in both of the specified int arrays.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array
-
- Returns: a new int array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: IntList#intersection(IntList)
-
Signature:
@SuppressWarnings("deprecation") public static long[] intersection(final long[] a, final long[] b) - Summary: Returns the elements that are present in both of the specified long arrays.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array
-
- Returns: a new long array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: LongList#intersection(LongList), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static float[] intersection(final float[] a, final float[] b) - Summary: Returns the elements that are present in both of the specified float arrays.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array
-
- Returns: a new float array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: FloatList#intersection(FloatList), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static double[] intersection(final double[] a, final double[] b) - Summary: Returns the elements that are present in both of the specified double arrays.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array
-
- Returns: a new double array containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty array if either input array is {@code null} or empty.
- See also: DoubleList#intersection(DoubleList), #intersection(int\[\], int\[\])
-
Signature:
public static <T> List<T> intersection(final T[] a, final Object[] b) - Summary: Returns the elements that are present in both of the specified arrays.
-
Parameters:
-
a(T[]) — the first array -
b(Object[]) — the second array
-
- Returns: a new list containing the elements present in both arrays, considering the minimum number of occurrences in either array. Returns an empty list if either input array is {@code null} or empty.
- See also: #commonSet(Collection, Collection), #intersection(int\[\], int\[\])
-
Signature:
public static <T> List<T> intersection(final Collection<? extends T> a, final Collection<?> b) - Summary: Returns the elements that are present in both of the specified collections.
-
Parameters:
-
a(Collection<? extends T>) — the first collection -
b(Collection<?>) — the second collection
-
- Returns: a new list containing the elements present in both collections, considering the minimum number of occurrences in either collection. Returns an empty list if either input collection is {@code null} or empty.
- See also: #retainAll(Collection, Collection), #commonSet(Collection, Collection), #intersection(Object\[\], Object\[\]), #intersection(int\[\], int\[\])
-
Signature:
public static <T> List<T> intersection(final Collection<? extends Collection<? extends T>> c) - Summary: Returns the elements that are present in all of the specified collections.
-
Parameters:
-
c(Collection<? extends Collection<? extends T>>) — the collection of collections to find the intersection of
-
- Returns: a new list containing the elements present in all collections in c, considering the minimum number of occurrences across all collections. Returns an empty list if c is {@code null} , empty, or any collection in c is empty. If c contains only one collection, returns a list with all elements from that collection.
- See also: #intersection(Collection, Collection), #intersection(Object\[\], Object\[\]), #commonSet(Collection, Collection), #retainAll(Collection, Collection), #intersection(int\[\], int\[\])
-
Signature:
public static Dataset intersection(final Dataset a, final Dataset b) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in both datasets.
-
Parameters:
-
a(Dataset) — the first Dataset to find common rows with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find common rows with. Must not be {@code null} .
-
- Returns: a new Dataset containing rows present in both Datasets, with duplicates handled by minimum occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if the two Datasets have no common columns.
-
- See also: #intersection(Dataset, Dataset, boolean), #intersection(Dataset, Dataset, Collection), #intersection(Dataset, Dataset, Collection, boolean), Dataset#intersect(Dataset), Dataset#intersectAll(Dataset), Dataset#union(Dataset), Dataset#except(Dataset)
-
Signature:
public static Dataset intersection(final Dataset a, final Dataset b, final boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in both datasets.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as they share at least one common column.
-
Parameters:
-
a(Dataset) — the first Dataset to find common rows with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find common rows with. Must not be {@code null} . -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows present in both Datasets, with duplicates handled by minimum occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code requiresSameColumns} is {@code true} and the Datasets do not have the same columns, or if the two Datasets have no common columns when {@code requiresSameColumns} is {@code false} .
-
- See also: #intersection(Dataset, Dataset), #intersection(Dataset, Dataset, Collection), #intersection(Dataset, Dataset, Collection, boolean), Dataset#intersect(Dataset), Dataset#intersectAll(Dataset), Dataset#union(Dataset), Dataset#except(Dataset)
-
Signature:
public static Dataset intersection(final Dataset a, final Dataset b, final Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in both datasets.
-
Parameters:
-
a(Dataset) — the first Dataset to find common rows with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find common rows with. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty.
-
- Returns: a new Dataset containing rows whose key column values appear in both Datasets, with duplicates handled by minimum occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in either Dataset.
-
- See also: #intersection(Dataset, Dataset), #intersection(Dataset, Dataset, boolean), #intersection(Dataset, Dataset, Collection, boolean), Dataset#intersect(Dataset, Collection), Dataset#intersectAll(Dataset, Collection)
-
Signature:
public static Dataset intersection(final Dataset a, final Dataset b, final Collection<String> keyColumnNames, final boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in both datasets.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as the specified key columns exist in both.
-
Parameters:
-
a(Dataset) — the first Dataset to find common rows with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find common rows with. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty. -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows whose key column values appear in both Datasets, with duplicates handled by minimum occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in either Dataset, or if {@code requiresSameColumns} is {@code true} and the Datasets do not have the same columns.
-
- See also: #intersection(Dataset, Dataset), #intersection(Dataset, Dataset, boolean), #intersection(Dataset, Dataset, Collection), Dataset#intersect(Dataset, Collection), Dataset#intersectAll(Dataset, Collection)
difference(...) -> boolean\[\]
-
Signature:
@SuppressWarnings("deprecation") public static boolean[] difference(final boolean[] a, final boolean[] b) - Summary: Returns the elements in the first boolean array that are not present in the second boolean array, considering the number of occurrences of each element.
-
Parameters:
-
a(boolean[]) — the first boolean array, elements from this array will be in the result if they don't appear in b -
b(boolean[]) — the second boolean array, elements from this array will be removed from a
-
- Returns: a new boolean array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(boolean\[\], boolean\[\]), BooleanList#difference(BooleanList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(boolean\[\], boolean\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static char[] difference(final char[] a, final char[] b) - Summary: Returns the elements in the first char array that are not present in the second char array, considering the number of occurrences of each element.
-
Parameters:
-
a(char[]) — the first char array, elements from this array will be in the result if they don't appear in b -
b(char[]) — the second char array, elements from this array will be removed from a
-
- Returns: a new char array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(char\[\], char\[\]), CharList#difference(CharList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(char\[\], char\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static byte[] difference(final byte[] a, final byte[] b) - Summary: Returns the elements in the first byte array that are not present in the second byte array, considering the number of occurrences of each element.
-
Parameters:
-
a(byte[]) — the first byte array, elements from this array will be in the result if they don't appear in b -
b(byte[]) — the second byte array, elements from this array will be removed from a
-
- Returns: a new byte array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(byte\[\], byte\[\]), ByteList#difference(ByteList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(byte\[\], byte\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static short[] difference(final short[] a, final short[] b) - Summary: Returns the elements in the first short array that are not present in the second short array, considering the number of occurrences of each element.
-
Parameters:
-
a(short[]) — the first short array, elements from this array will be in the result if they don't appear in b -
b(short[]) — the second short array, elements from this array will be removed from a
-
- Returns: a new short array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(short\[\], short\[\]), ShortList#difference(ShortList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(short\[\], short\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static int[] difference(final int[] a, final int[] b) - Summary: Returns the elements in the specified int array <i> a </i> but not present in the int array <i> b </i> , considering the number of occurrences of each element.
-
Parameters:
-
a(int[]) — the first int array, elements from this array will be in the result if they don't appear in b -
b(int[]) — the second int array, elements from this array will be removed from a
-
- Returns: a new int array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(int\[\], int\[\]), IntList#difference(IntList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static long[] difference(final long[] a, final long[] b) - Summary: Returns the elements in the first long array that are not present in the second long array, considering the number of occurrences of each element.
-
Parameters:
-
a(long[]) — the first long array, elements from this array will be in the result if they don't appear in b -
b(long[]) — the second long array, elements from this array will be removed from a
-
- Returns: a new long array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(long\[\], long\[\]), LongList#difference(LongList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(long\[\], long\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static float[] difference(final float[] a, final float[] b) - Summary: Returns the elements in the first float array that are not present in the second float array, considering the number of occurrences of each element.
-
Parameters:
-
a(float[]) — the first float array, elements from this array will be in the result if they don't appear in b -
b(float[]) — the second float array, elements from this array will be removed from a
-
- Returns: a new float array containing the elements that are present in <i> a </i> but not in <i> b </i> , considering the number of occurrences. Returns an empty array if <i> a </i> is {@code null} or empty. Returns a clone of <i> a </i> if <i> b </i> is {@code null} or empty.
- See also: #removeAll(float\[\], float\[\]), FloatList#difference(FloatList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(float\[\], float\[\]), #difference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static double[] difference(final double[] a, final double[] b) - Summary: Returns the elements in the first double array that are not present in the second double array, considering the number of occurrences of each element.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array
-
- Returns: elements in <i> a </i> not in <i> b </i> (considering occurrences; empty if <i> a </i> is {@code null} /empty; clone of <i> a </i> if <i> b </i> is {@code null} /empty)
- See also: #removeAll(double\[\], double\[\]), DoubleList#difference(DoubleList), #difference(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(double\[\], double\[\]), #difference(int\[\], int\[\])
-
Signature:
public static <T> List<T> difference(final T[] a, final Object[] b) - Summary: Returns the elements in the first array that are not present in the second array, considering the number of occurrences of each element.
-
Parameters:
-
a(T[]) — the first array -
b(Object[]) — the second array
-
- Returns: elements in <i> a </i> not in <i> b </i> (considering occurrences; empty list if <i> a </i> is {@code null} /empty; list of <i> a </i> if <i> b </i> is {@code null} /empty)
- See also: #removeAll(Object\[\], Object\[\]), #difference(Collection, Collection), #symmetricDifference(Object\[\], Object\[\]), #difference(int\[\], int\[\]), #excludeAll(Collection, Collection), #excludeAllToSet(Collection, Collection), #removeAll(Collection, Iterable), Iterables#difference(Set, Set)
-
Signature:
public static <T> List<T> difference(final Collection<? extends T> a, final Collection<?> b) - Summary: Returns the elements in the first collection that are not present in the second collection, considering the number of occurrences of each element.
-
Parameters:
-
a(Collection<? extends T>) — the first collection -
b(Collection<?>) — the second collection
-
- Returns: elements in <i> a </i> not in <i> b </i> (considering occurrences; empty list if <i> a </i> is {@code null} /empty; list of <i> a </i> if <i> b </i> is {@code null} /empty)
- See also: #difference(Object\[\], Object\[\]), #symmetricDifference(Collection, Collection), #excludeAll(Collection, Collection), #excludeAllToSet(Collection, Collection), #intersection(Collection, Collection), #difference(int\[\], int\[\])
-
Signature:
public static Dataset difference(final Dataset a, final Dataset b) throws IllegalArgumentException - Summary: Returns a new Dataset with rows from {@code a} that do not appear in {@code b} , using multiset semantics.
-
Parameters:
-
a(Dataset) — the first Dataset to compare. Must not be {@code null} . -
b(Dataset) — the second Dataset to compare. Must not be {@code null} .
-
- Returns: a new Dataset containing rows present in {@code a} but not in {@code b} , considering occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if the two Datasets don't have common columns.
-
- See also: #difference(Dataset, Dataset, boolean), #difference(Dataset, Dataset, Collection), #difference(Dataset, Dataset, Collection, boolean), #symmetricDifference(Dataset, Dataset), #intersection(Dataset, Dataset)
-
Signature:
public static Dataset difference(final Dataset a, final Dataset b, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset with rows from {@code a} that do not appear in {@code b} , using multiset semantics.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as they share at least one common column.
-
Parameters:
-
a(Dataset) — the first Dataset to compare. Must not be {@code null} . -
b(Dataset) — the second Dataset to compare. Must not be {@code null} . -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows present in {@code a} but not in {@code b} , considering occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code requiresSameColumns} is {@code true} and the two Datasets don't have the same columns, or if {@code requiresSameColumns} is {@code false} and the two Datasets don't have common columns.
-
- See also: #difference(Dataset, Dataset), #difference(Dataset, Dataset, Collection), #difference(Dataset, Dataset, Collection, boolean), #symmetricDifference(Dataset, Dataset), #intersection(Dataset, Dataset)
-
Signature:
public static Dataset difference(final Dataset a, final Dataset b, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Returns a new Dataset with rows from {@code a} that do not appear in {@code b} , using multiset semantics.
-
Parameters:
-
a(Dataset) — the first Dataset to compare. Must not be {@code null} . -
b(Dataset) — the second Dataset to compare. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty.
-
- Returns: a new Dataset containing rows present in {@code a} but not in {@code b} , based on the specified key columns and considering occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in either Dataset.
-
- See also: #difference(Dataset, Dataset), #difference(Dataset, Dataset, boolean), #difference(Dataset, Dataset, Collection, boolean), #symmetricDifference(Dataset, Dataset), #intersection(Dataset, Dataset, Collection)
-
Signature:
public static Dataset difference(final Dataset a, final Dataset b, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset with rows from {@code a} that do not appear in {@code b} , using multiset semantics.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as the specified key columns exist in both.
-
Parameters:
-
a(Dataset) — the first Dataset to compare. Must not be {@code null} . -
b(Dataset) — the second Dataset to compare. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty. -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows present in {@code a} but not in {@code b} , based on the specified key columns and considering occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in either Dataset, or if {@code requiresSameColumns} is {@code true} and the two Datasets don't have the same columns, or if {@code requiresSameColumns} is {@code false} and the two Datasets don't have common columns.
-
- See also: #difference(Dataset, Dataset), #difference(Dataset, Dataset, boolean), #difference(Dataset, Dataset, Collection), #symmetricDifference(Dataset, Dataset), #intersection(Dataset, Dataset, Collection, boolean)
symmetricDifference(...) -> boolean\[\]
-
Signature:
@SuppressWarnings("deprecation") public static boolean[] symmetricDifference(final boolean[] a, final boolean[] b) - Summary: Returns the elements that are present in either the first or second boolean array but not in both, considering the number of occurrences of each element.
-
Parameters:
-
a(boolean[]) — the first boolean array -
b(boolean[]) — the second boolean array
-
- Returns: a new boolean array containing the elements that are present in either <i> a </i> or <i> b </i> but not in both, considering the number of occurrences. Returns an empty array if both arrays are {@code null} or empty. Returns a clone of the non-empty array if the other is {@code null} or empty.
- See also: #difference(boolean\[\], boolean\[\]), #intersection(boolean\[\], boolean\[\]), #symmetricDifference(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static char[] symmetricDifference(final char[] a, final char[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(char[]) — the first array -
b(char[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(char\[\], char\[\]), #intersection(char\[\], char\[\])
-
Signature:
@SuppressWarnings("deprecation") public static byte[] symmetricDifference(final byte[] a, final byte[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the first array -
b(byte[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(byte\[\], byte\[\]), #intersection(byte\[\], byte\[\])
-
Signature:
@SuppressWarnings("deprecation") public static short[] symmetricDifference(final short[] a, final short[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(short[]) — the first array -
b(short[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(short\[\], short\[\]), #intersection(short\[\], short\[\])
-
Signature:
@SuppressWarnings("deprecation") public static int[] symmetricDifference(final int[] a, final int[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(int[]) — the first array -
b(int[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(int\[\], int\[\]), #intersection(int\[\], int\[\])
-
Signature:
@SuppressWarnings("deprecation") public static long[] symmetricDifference(final long[] a, final long[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(long[]) — the first array -
b(long[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(long\[\], long\[\]), #intersection(long\[\], long\[\])
-
Signature:
@SuppressWarnings("deprecation") public static float[] symmetricDifference(final float[] a, final float[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(float[]) — the first array -
b(float[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(float\[\], float\[\]), #intersection(float\[\], float\[\])
-
Signature:
@SuppressWarnings("deprecation") public static double[] symmetricDifference(final double[] a, final double[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty array if both arrays are {@code null} or empty.
- Returns a clone of the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(double[]) — the first array -
b(double[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #difference(double\[\], double\[\]), #intersection(double\[\], double\[\])
-
Signature:
public static <T> List<T> symmetricDifference(final T[] a, final T[] b) - Summary: Returns the elements present in either array but not in both, considering occurrence counts.
-
Contract:
- Returns an empty list if both arrays are {@code null} or empty.
- Returns a list of all elements from the non-empty array if the other is {@code null} or empty.
-
Parameters:
-
a(T[]) — the first array -
b(T[]) — the second array
-
- Returns: elements present in either array but not in both
- See also: #symmetricDifference(Collection, Collection), #difference(Object\[\], Object\[\]), #intersection(Object\[\], Object\[\])
-
Signature:
public static <T> List<T> symmetricDifference(final Collection<? extends T> a, final Collection<? extends T> b) - Summary: Returns the elements present in either collection but not in both, considering occurrence counts.
-
Contract:
- Returns an empty list if both collections are {@code null} or empty.
- Returns a list of all elements from the non-empty collection if the other is {@code null} or empty.
-
Parameters:
-
a(Collection<? extends T>) — the first collection -
b(Collection<? extends T>) — the second collection
-
- Returns: elements present in either collection but not in both
- See also: #symmetricDifference(Object\[\], Object\[\]), #difference(Collection, Collection), #intersection(Collection, Collection)
-
Signature:
public static Dataset symmetricDifference(final Dataset a, final Dataset b) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in exactly one of the two datasets.
-
Parameters:
-
a(Dataset) — the first Dataset to find symmetric difference with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find symmetric difference with. Must not be {@code null} .
-
- Returns: a new Dataset containing rows that are present in either the first Dataset or the second Dataset, but not in both, considering the number of occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} or if the two Datasets have no common columns.
-
- See also: #symmetricDifference(Dataset, Dataset, boolean), #symmetricDifference(Dataset, Dataset, Collection), #symmetricDifference(Dataset, Dataset, Collection, boolean), #difference(Dataset, Dataset), #intersection(Dataset, Dataset)
-
Signature:
public static Dataset symmetricDifference(final Dataset a, final Dataset b, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in exactly one of the two datasets.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as they share at least one common column.
-
Parameters:
-
a(Dataset) — the first Dataset to find symmetric difference with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find symmetric difference with. Must not be {@code null} . -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows that are present in either the first Dataset or the second Dataset, but not in both, considering the number of occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code requiresSameColumns} is {@code true} and the two Datasets don't have the same columns, or if {@code requiresSameColumns} is {@code false} and the two Datasets don't have common columns.
-
- See also: #symmetricDifference(Dataset, Dataset), #symmetricDifference(Dataset, Dataset, Collection), #symmetricDifference(Dataset, Dataset, Collection, boolean), #difference(Dataset, Dataset, boolean), #intersection(Dataset, Dataset, boolean)
-
Signature:
public static Dataset symmetricDifference(final Dataset a, final Dataset b, Collection<String> keyColumnNames) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in exactly one of the two datasets.
-
Parameters:
-
a(Dataset) — the first Dataset to find symmetric difference with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find symmetric difference with. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty.
-
- Returns: a new Dataset containing rows that are present in either the first Dataset or the second Dataset, but not in both, based on the specified key columns and considering the number of occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in both Datasets.
-
- See also: #symmetricDifference(Dataset, Dataset), #symmetricDifference(Dataset, Dataset, boolean), #symmetricDifference(Dataset, Dataset, Collection, boolean), #difference(Dataset, Dataset, Collection), #intersection(Dataset, Dataset, Collection)
-
Signature:
public static Dataset symmetricDifference(final Dataset a, final Dataset b, Collection<String> keyColumnNames, boolean requiresSameColumns) throws IllegalArgumentException - Summary: Returns a new Dataset containing rows present in exactly one of the two datasets.
-
Contract:
- <br/> If {@code requiresSameColumns} is {@code true} , both Datasets must have identical column names.
- If {@code requiresSameColumns} is {@code false} , the Datasets can differ as long as the specified key columns exist in both.
-
Parameters:
-
a(Dataset) — the first Dataset to find symmetric difference with. Must not be {@code null} . -
b(Dataset) — the second Dataset to find symmetric difference with. Must not be {@code null} . -
keyColumnNames(Collection<String>) — the column names to use for matching rows between Datasets. Must not be {@code null} or empty. -
requiresSameColumns(boolean) — a boolean that indicates whether both Datasets should have the same columns.
-
- Returns: a new Dataset containing rows that are present in either the first Dataset or the second Dataset, but not in both, based on the specified key columns and considering the number of occurrences.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the specified Datasets is {@code null} , or if {@code keyColumnNames} is {@code null} or empty, or if any specified key column doesn't exist in both Datasets, or if {@code requiresSameColumns} is {@code true} and the two Datasets don't have the same columns.
-
- See also: #symmetricDifference(Dataset, Dataset), #symmetricDifference(Dataset, Dataset, boolean), #symmetricDifference(Dataset, Dataset, Collection), #difference(Dataset, Dataset, Collection, boolean), #intersection(Dataset, Dataset, Collection, boolean)
commonSet(...) -> Set<T>
-
Signature:
public static <T> Set<T> commonSet(final Collection<? extends T> a, final Collection<?> b) - Summary: Returns a set containing the common elements between the specified collections <i> a </i> and <i> b </i> .
-
Parameters:
-
a(Collection<? extends T>) — the first collection. -
b(Collection<?>) — the second collection.
-
- Returns: a set containing the elements that are present in both <i> a </i> and <i> b </i> . If either <i> a </i> or <i> b </i> is empty or {@code null} , an empty set is returned.
- See also: #intersection(Collection, Collection), Collection#retainAll(Collection), Iterables#intersection(Set, Set)
-
Signature:
public static <T> Set<T> commonSet(final Collection<? extends Collection<? extends T>> c) - Summary: Returns a set containing the common elements among all the collections within the specified collection of collections.
-
Parameters:
-
c(Collection<? extends Collection<? extends T>>) — the collection of collections to find the common elements of.
-
- Returns: a set containing the elements that are present in all collections within <i> c </i> . If <i> c </i> is empty or {@code null} , an empty set is returned. If <i> c </i> contains only one collection, a set containing the elements of this collection is returned.
- See also: #intersection(Collection, Collection), Collection#retainAll(Collection), Iterables#intersection(Set, Set)
exclude(...) -> List<T>
-
Signature:
public static <T> List<T> exclude(final Collection<? extends T> c, final Object objToExclude) - Summary: Returns a new {@code List} containing all the elements from the specified collection except all occurrences of specified <i> objToExclude </i> .
-
Parameters:
-
c(Collection<? extends T>) — the collection from which to exclude the specified object. -
objToExclude(Object) — the object to exclude from the collection.
-
- Returns: a new {@code List} with the specified object excluded. If the collection <i> c </i> is empty or {@code null} , an empty list is returned.
- See also: #difference(Collection, Collection), #removeAll(Collection, Iterable), Difference#of(Collection, Collection)
excludeToSet(...) -> Set<T>
-
Signature:
public static <T> Set<T> excludeToSet(final Collection<? extends T> c, final Object objToExclude) - Summary: Returns a new {@code Set} containing all the elements from the specified collection except all occurrences of specified <i> objToExclude </i> .
-
Parameters:
-
c(Collection<? extends T>) — the collection from which to exclude the specified object. -
objToExclude(Object) — the object to exclude from the collection.
-
- Returns: a new {@code Set} with the specified object excluded. If the collection <i> c </i> is empty or {@code null} , an empty set is returned.
- See also: #difference(Collection, Collection), #removeAll(Collection, Iterable), Difference#of(Collection, Collection)
excludeAll(...) -> List<T>
-
Signature:
public static <T> List<T> excludeAll(final Collection<? extends T> c, final Collection<?> objsToExclude) - Summary: Returns a new {@code List} containing all the elements from the specified collection except all occurrences of elements in the specified <i> objsToExclude </i> .
-
Parameters:
-
c(Collection<? extends T>) — the collection from which to exclude the specified objects. -
objsToExclude(Collection<?>) — the objects to exclude from the collection.
-
- Returns: a new {@code List} with the specified objects excluded. If the collection <i> c </i> is empty or {@code null} , an empty list is returned.
- See also: #difference(Collection, Collection), #removeAll(Collection, Iterable), Difference#of(Collection, Collection)
excludeAllToSet(...) -> Set<T>
-
Signature:
public static <T> Set<T> excludeAllToSet(final Collection<? extends T> c, final Collection<?> objsToExclude) - Summary: Returns a new {@code Set} containing all the elements from the specified collection except all occurrences of elements in the specified <i> objsToExclude </i> .
-
Parameters:
-
c(Collection<? extends T>) — the collection from which to exclude the specified objects. -
objsToExclude(Collection<?>) — the objects to exclude from the collection.
-
- Returns: a new {@code Set} with the specified objects excluded. If the collection <i> c </i> is empty or {@code null} , an empty set is returned.
- See also: #difference(Collection, Collection), #removeAll(Collection, Iterable), Difference#of(Collection, Collection)
isSubCollection(...) -> boolean
-
Signature:
public static boolean isSubCollection(@NotNull final Collection<?> subColl, @NotNull final Collection<?> coll) throws IllegalArgumentException - Summary: Returns {@code true} if <i> subColl </i> is a sub-collection of <i> coll </i> , that is, if the cardinality of <i> e </i> in <i> subColl </i> is less than or equal to the cardinality of <i> e </i> in <i> coll </i> , for each element <i> e </i> in <i> subColl </i> .
-
Contract:
- Returns {@code true} if <i> subColl </i> is a sub-collection of <i> coll </i> , that is, if the cardinality of <i> e </i> in <i> subColl </i> is less than or equal to the cardinality of <i> e </i> in <i> coll </i> , for each element <i> e </i> in <i> subColl </i> .
-
Parameters:
-
subColl(@NotNull Collection<?>) — the first (sub?) collection, must not be null -
coll(@NotNull Collection<?>) — the second (super?) collection, must not be null
-
- Returns: {@code true} if <i> subColl </i> is a sub-collection of <i> coll </i>
-
Throws:
-
java.lang.IllegalArgumentException— if {@code subColl} or {@code coll} is {@code null}
-
- See also: #isProperSubCollection, Collection#containsAll
isProperSubCollection(...) -> boolean
-
Signature:
public static boolean isProperSubCollection(@NotNull final Collection<?> subColl, final @NotNull Collection<?> coll) throws IllegalArgumentException - Summary: Returns {@code true} if <i> subColl </i> is a <i> proper </i> sub-collection of <i> coll </i> , that is, if the cardinality of <i> e </i> in <i> subColl </i> is less than or equal to the cardinality of <i> e </i> in <i> coll </i> , for each element <i> e </i> in <i> subColl </i> , and there is at least one element <i> f </i> such that the cardinality of <i> f </i> in <i> coll </i> is strictly greater than the cardinality of <i> f </i> in <i> subColl </i> .
-
Contract:
- Returns {@code true} if <i> subColl </i> is a <i> proper </i> sub-collection of <i> coll </i> , that is, if the cardinality of <i> e </i> in <i> subColl </i> is less than or equal to the cardinality of <i> e </i> in <i> coll </i> , for each element <i> e </i> in <i> subColl </i> , and there is at least one element <i> f </i> such that the cardinality of <i> f </i> in <i> coll </i> is strictly greater than the cardinality of <i> f </i> in <i> subColl </i> .
-
Parameters:
-
subColl(@NotNull Collection<?>) — the first (sub?) collection, must not be null -
coll(@NotNull Collection<?>) — the second (super?) collection, must not be null
-
- Returns: {@code true} if <i> subColl </i> is a <i> proper </i> sub-collection of <i> coll </i>
-
Throws:
-
java.lang.IllegalArgumentException— if {@code subColl} or {@code coll} is {@code null}
-
- See also: #isSubCollection, Collection#containsAll
isEqualCollection(...) -> boolean
-
Signature:
public static boolean isEqualCollection(final Collection<?> a, final Collection<?> b) - Summary: Checks whether two collections contain the same elements with the same frequencies, regardless of their order.
-
Parameters:
-
a(Collection<?>) — the first collection to compare, may be {@code null} -
b(Collection<?>) — the second collection to compare, may be {@code null}
-
- Returns: {@code true} if both collections contain the same elements with the same frequencies, {@code false} otherwise
- See also: #containsSameElements(Collection, Collection), #containsSameElements(int\[\], int\[\])
replaceIf(...) -> int
-
Signature:
public static int replaceIf(final boolean[] a, final BooleanPredicate predicate, final boolean newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the array to modify -
predicate(BooleanPredicate) — the predicate to test each element -
newValue(boolean) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(boolean\[\], boolean, boolean)
-
Signature:
public static int replaceIf(final char[] a, final CharPredicate predicate, final char newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array to modify -
predicate(CharPredicate) — the predicate to test each element -
newValue(char) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(char\[\], char, char)
-
Signature:
public static int replaceIf(final byte[] a, final BytePredicate predicate, final byte newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array to modify -
predicate(BytePredicate) — the predicate to test each element -
newValue(byte) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(byte\[\], byte, byte)
-
Signature:
public static int replaceIf(final short[] a, final ShortPredicate predicate, final short newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array to modify -
predicate(ShortPredicate) — the predicate to test each element -
newValue(short) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(short\[\], short, short)
-
Signature:
public static int replaceIf(final int[] a, final IntPredicate predicate, final int newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array to modify -
predicate(IntPredicate) — the predicate to test each element -
newValue(int) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(int\[\], int, int)
-
Signature:
public static int replaceIf(final long[] a, final LongPredicate predicate, final long newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array to modify -
predicate(LongPredicate) — the predicate to test each element -
newValue(long) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(long\[\], long, long)
-
Signature:
public static int replaceIf(final float[] a, final FloatPredicate predicate, final float newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array to modify -
predicate(FloatPredicate) — the predicate to test each element -
newValue(float) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(float\[\], float, float)
-
Signature:
public static int replaceIf(final double[] a, final DoublePredicate predicate, final double newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array to modify -
predicate(DoublePredicate) — the predicate to test each element -
newValue(double) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(double\[\], double, double)
-
Signature:
public static <T> int replaceIf(final T[] a, final Predicate<? super T> predicate, final T newValue) - Summary: Replaces each element in the array that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to modify -
predicate(Predicate<? super T>) — the predicate to test each element -
newValue(T) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(Object\[\], Object, Object)
-
Signature:
public static <T> int replaceIf(final List<T> list, final Predicate<? super T> predicate, final T newValue) - Summary: Replaces each element in the list that satisfies the given predicate with the specified value.
-
Contract:
- Returns 0 if the list is {@code null} or empty.
-
Parameters:
-
list(List<T>) — the list to modify -
predicate(Predicate<? super T>) — the predicate to test each element -
newValue(T) — the value to replace matching elements with
-
- Returns: the number of replacements made.
- See also: #replaceAll(List, Object, Object)
replaceAll(...) -> int
-
Signature:
public static int replaceAll(final boolean[] a, final boolean oldVal, final boolean newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the array to modify -
oldVal(boolean) — the value to be replaced -
newVal(boolean) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(boolean\[\], BooleanUnaryOperator), #replaceIf(boolean\[\], BooleanPredicate, boolean)
-
Signature:
public static int replaceAll(final char[] a, final char oldVal, final char newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array to modify -
oldVal(char) — the value to be replaced -
newVal(char) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(char\[\], CharUnaryOperator), #replaceIf(char\[\], CharPredicate, char)
-
Signature:
public static int replaceAll(final byte[] a, final byte oldVal, final byte newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array to modify -
oldVal(byte) — the value to be replaced -
newVal(byte) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(byte\[\], ByteUnaryOperator), #replaceIf(byte\[\], BytePredicate, byte)
-
Signature:
public static int replaceAll(final short[] a, final short oldVal, final short newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array to modify -
oldVal(short) — the value to be replaced -
newVal(short) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(short\[\], ShortUnaryOperator), #replaceIf(short\[\], ShortPredicate, short)
-
Signature:
public static int replaceAll(final int[] a, final int oldVal, final int newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array to modify -
oldVal(int) — the value to be replaced -
newVal(int) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(int\[\], IntUnaryOperator), #replaceIf(int\[\], IntPredicate, int)
-
Signature:
public static int replaceAll(final long[] a, final long oldVal, final long newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array to modify -
oldVal(long) — the value to be replaced -
newVal(long) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(long\[\], LongUnaryOperator), #replaceIf(long\[\], LongPredicate, long)
-
Signature:
public static int replaceAll(final float[] a, final float oldVal, final float newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array to modify -
oldVal(float) — the value to be replaced -
newVal(float) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(float\[\], FloatUnaryOperator), #replaceIf(float\[\], FloatPredicate, float)
-
Signature:
public static int replaceAll(final double[] a, final double oldVal, final double newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array to modify -
oldVal(double) — the value to be replaced -
newVal(double) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(double\[\], DoubleUnaryOperator), #replaceIf(double\[\], DoublePredicate, double)
-
Signature:
public static <T> int replaceAll(final T[] a, final Object oldVal, final T newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to modify -
oldVal(Object) — the value to be replaced -
newVal(T) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(Object\[\], UnaryOperator), #replaceIf(Object\[\], Predicate, Object)
-
Signature:
public static <T> int replaceAll(final List<T> list, final Object oldVal, final T newVal) - Summary: Replaces all occurrences of the specified old value with the new value in the list.
-
Contract:
- Returns 0 if the list is {@code null} or empty.
-
Parameters:
-
list(List<T>) — the list to modify -
oldVal(Object) — the value to be replaced -
newVal(T) — the value to replace with
-
- Returns: the number of elements that were replaced
- See also: #replaceAll(List, UnaryOperator), #replaceIf(List, Predicate, Object)
-
Signature:
public static void replaceAll(final boolean[] a, final BooleanUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the array to modify -
operator(BooleanUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(boolean\[\], boolean, boolean), #setAll(boolean\[\], IntToBooleanFunction)
-
Signature:
public static void replaceAll(final char[] a, final CharUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array to modify -
operator(CharUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(char\[\], char, char), #setAll(char\[\], IntToCharFunction)
-
Signature:
public static void replaceAll(final byte[] a, final ByteUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array to modify -
operator(ByteUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(byte\[\], byte, byte), #setAll(byte\[\], IntToByteFunction)
-
Signature:
public static void replaceAll(final short[] a, final ShortUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array to modify -
operator(ShortUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(short\[\], short, short), #setAll(short\[\], IntToShortFunction)
-
Signature:
public static void replaceAll(final int[] a, final IntUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array to modify -
operator(IntUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(int\[\], int, int), #setAll(int\[\], IntUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void replaceAll(final long[] a, final LongUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array to modify -
operator(LongUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(long\[\], long, long), #setAll(long\[\], IntToLongFunction), Arrays#setAll(long\[\], IntToLongFunction), Arrays#parallelSetAll(long\[\], IntToLongFunction)
-
Signature:
public static void replaceAll(final float[] a, final FloatUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array to modify -
operator(FloatUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(float\[\], float, float), #setAll(float\[\], IntToFloatFunction)
-
Signature:
public static void replaceAll(final double[] a, final DoubleUnaryOperator operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array to modify -
operator(DoubleUnaryOperator) — the function to apply to each element
-
- See also: #replaceAll(double\[\], double, double), #setAll(double\[\], IntToDoubleFunction), Arrays#setAll(double\[\], IntToDoubleFunction), Arrays#parallelSetAll(double\[\], IntToDoubleFunction)
-
Signature:
public static <T> void replaceAll(final T[] a, final UnaryOperator<T> operator) - Summary: Replaces all elements in the array by applying the operator function to each element.
-
Contract:
- Returns without modification if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to modify -
operator(UnaryOperator<T>) — the function to apply to each element
-
- See also: #replaceAll(Object\[\], Object, Object), #setAll(Object\[\], IntFunction), #setAll(Object\[\], Throwables.IntObjFunction), Arrays#setAll(Object\[\], IntFunction), Arrays#parallelSetAll(Object\[\], IntFunction)
-
Signature:
public static <T> void replaceAll(final List<T> list, final UnaryOperator<T> operator) - Summary: Replaces all elements in the list by applying the operator function to each element.
-
Contract:
- Returns without modification if the list is {@code null} or empty.
-
Parameters:
-
list(List<T>) — the list to modify -
operator(UnaryOperator<T>) — the function to apply to each element
-
- See also: #replaceAll(List, Object, Object), #setAll(List, IntFunction), #setAll(List, Throwables.IntObjFunction)
updateAll(...) -> void
-
Signature:
@Beta public static <T, E extends Exception> void updateAll(final T[] a, final Throwables.UnaryOperator<T, E> operator) throws E - Summary: Replaces all elements in the given array using the specified {@code UnaryOperator} .
-
Contract:
- If the input array is empty or {@code null} , no replacements are made.
-
Parameters:
-
a(T[]) — the array in which to replace values. -
operator(Throwables.UnaryOperator<T, E>) — the UnaryOperator to apply to each element. The operator takes a value of type <i> T </i> and returns a value of type <i> T </i> .
-
-
Throws:
-
E— the exception may be thrown out.
-
- See also: #replaceAll(Object\[\], UnaryOperator), #setAll(Object\[\], IntFunction), #setAll(Object\[\], Throwables.IntObjFunction), Arrays#setAll(Object\[\], IntFunction), Arrays#parallelSetAll(Object\[\], IntFunction)
-
Signature:
@Beta public static <T, E extends Exception> void updateAll(final List<T> list, final Throwables.UnaryOperator<T, E> operator) throws E - Summary: Replaces all elements in the given list using the specified {@code UnaryOperator} .
-
Contract:
- If the input list is empty or {@code null} , no replacements are made.
-
Parameters:
-
list(List<T>) — the list in which to replace values. -
operator(Throwables.UnaryOperator<T, E>) — the UnaryOperator to apply to each element. The operator takes a value of type <i> T </i> and returns a value of type <i> T </i> .
-
-
Throws:
-
E— the exception may be thrown out.
-
- See also: #replaceAll(List, UnaryOperator), #setAll(List, IntFunction), #setAll(List, Throwables.IntObjFunction)
updateAllUsingReplaceAllInstead(...) -> void
-
Signature:
@Deprecated public static void updateAllUsingReplaceAllInstead() throws UnsupportedOperationException - Summary: A fake/unsupported method defined to remind user to use {@code replaceAll} when {@code update/updateAll/updateIf} is searched.
-
Contract:
- A fake/unsupported method defined to remind user to use {@code replaceAll} when {@code update/updateAll/updateIf} is searched.
-
Parameters:
- (none)
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown to indicate this method is not supported
-
- See also: #replaceAll(Object\[\], UnaryOperator), #replaceAll(Object\[\], Object, Object)
updateIfUsingReplaceIfInstead(...) -> void
-
Signature:
@Deprecated public static void updateIfUsingReplaceIfInstead() throws UnsupportedOperationException - Summary: A fake/unsupported method defined to remind user to use {@code replaceIf} when {@code update/updateAll/updateIf} is searched.
-
Contract:
- A fake/unsupported method defined to remind user to use {@code replaceIf} when {@code update/updateAll/updateIf} is searched.
-
Parameters:
- (none)
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown to indicate this method is not supported
-
- See also: #replaceIf(Object\[\], Predicate, Object)
setAll(...) -> void
-
Signature:
public static void setAll(final boolean[] array, final IntToBooleanFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(boolean[]) — the array to be modified -
generator(IntToBooleanFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(boolean\[\], BooleanUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void setAll(final char[] array, final IntToCharFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(char[]) — the array to be modified -
generator(IntToCharFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(char\[\], CharUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void setAll(final byte[] array, final IntToByteFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(byte[]) — the array to be modified -
generator(IntToByteFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(byte\[\], ByteUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void setAll(final short[] array, final IntToShortFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(short[]) — the array to be modified -
generator(IntToShortFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(short\[\], ShortUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void setAll(final int[] array, final IntUnaryOperator generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(int[]) — the array to be modified -
generator(IntUnaryOperator) — the function used to generate new values for the array elements
-
- See also: #replaceAll(int\[\], IntUnaryOperator), Arrays#setAll(int\[\], IntUnaryOperator), Arrays#parallelSetAll(int\[\], IntUnaryOperator)
-
Signature:
public static void setAll(final long[] array, final IntToLongFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(long[]) — the array to be modified -
generator(IntToLongFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(long\[\], LongUnaryOperator), Arrays#setAll(long\[\], IntToLongFunction), Arrays#parallelSetAll(long\[\], IntToLongFunction)
-
Signature:
public static void setAll(final float[] array, final IntToFloatFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(float[]) — the array to be modified -
generator(IntToFloatFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(float\[\], FloatUnaryOperator), Arrays#setAll(double\[\], IntToDoubleFunction), Arrays#parallelSetAll(double\[\], IntToDoubleFunction)
-
Signature:
public static void setAll(final double[] array, final IntToDoubleFunction generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(double[]) — the array to be modified -
generator(IntToDoubleFunction) — the function used to generate new values for the array elements
-
- See also: #replaceAll(double\[\], DoubleUnaryOperator), Arrays#setAll(double\[\], IntToDoubleFunction), Arrays#parallelSetAll(double\[\], IntToDoubleFunction)
-
Signature:
public static <T> void setAll(final T[] array, final IntFunction<? extends T> generator) - Summary: Sets all elements in the given array using the provided generator function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
array(T[]) — the array to be modified -
generator(IntFunction<? extends T>) — the function used to generate new values for the array elements
-
- See also: #replaceAll(Object\[\], UnaryOperator), #setAll(Object\[\], Throwables.IntObjFunction), Arrays#setAll(Object\[\], IntFunction), Arrays#parallelSetAll(Object\[\], IntFunction)
-
Signature:
public static <T> void setAll(final List<T> list, final IntFunction<? extends T> generator) - Summary: Sets all elements in the given list using the provided generator function.
-
Contract:
- If the specified list is {@code null} or empty, does nothing.
-
Parameters:
-
list(List<T>) — the list to be modified -
generator(IntFunction<? extends T>) — the function used to generate new values for the list elements
-
- See also: #replaceAll(List, UnaryOperator), #setAll(List, Throwables.IntObjFunction)
-
Signature:
@Beta public static <T, E extends Exception> void setAll(final T[] a, final Throwables.IntObjFunction<? super T, ? extends T, E> converter) throws E - Summary: Sets all elements in the given array using the provided converter function.
-
Contract:
- If the specified array is {@code null} or empty, does nothing.
-
Parameters:
-
a(T[]) — the array to be modified -
converter(Throwables.IntObjFunction<? super T, ? extends T, E>) — the function used to generate new values for the array elements with the index of the element as the first parameter and the original element as the second parameter
-
-
Throws:
-
E— if the converter function throws an exception
-
- See also: #replaceAll(Object\[\], UnaryOperator), #setAll(Object\[\], IntFunction), Arrays#setAll(Object\[\], IntFunction)
-
Signature:
@Beta public static <T, E extends Exception> void setAll(final List<T> list, final Throwables.IntObjFunction<? super T, ? extends T, E> converter) throws E - Summary: Sets all elements in the given list using the provided converter function.
-
Contract:
- If the specified list is {@code null} or empty, does nothing.
-
Parameters:
-
list(List<T>) — the list to be modified -
converter(Throwables.IntObjFunction<? super T, ? extends T, E>) — the function used to generate new values for the list elements with the index of the element as the first parameter and the original element as the second parameter
-
-
Throws:
-
E— if the converter function throws an exception
-
- See also: #replaceAll(List, UnaryOperator), #setAll(List, IntFunction), Arrays#setAll(Object\[\], IntFunction)
copyThenSetAll(...) -> T\[\]
-
Signature:
@Beta @MayReturnNull public static <T> T[] copyThenSetAll(final T[] a, final IntFunction<? extends T> generator) - Summary: Creates a copy of the given array and sets all elements in the copy using the provided generator function.
-
Contract:
- If the specified array is {@code null} , returns {@code null} .
- If the specified array is empty, returns itself.
-
Parameters:
-
a(T[]) — the array to be copied and modified -
generator(IntFunction<? extends T>) — the function used to generate new values for the array elements
-
- Returns: a new array with elements copied from the specified array and modified by the generator function
- See also: #copyThenSetAll(Object\[\], Throwables.IntObjFunction), #copyThenReplaceAll(Object\[\], UnaryOperator)
-
Signature:
@Beta @MayReturnNull public static <T, E extends Exception> T[] copyThenSetAll(final T[] a, final Throwables.IntObjFunction<? super T, ? extends T, E> converter) throws E - Summary: Creates a copy of the given array and sets all elements in the copy using the provided converter function.
-
Contract:
- If the specified array is {@code null} , returns {@code null} .
- If the specified array is empty, returns itself.
-
Parameters:
-
a(T[]) — the array to be copied and modified -
converter(Throwables.IntObjFunction<? super T, ? extends T, E>) — the function used to generate new values for the array elements with the index of the element as the first parameter and the original element as the second parameter
-
- Returns: a new array with elements copied from the specified array and modified by the converter function
-
Throws:
-
E— if the converter function throws an exception
-
- See also: #copyThenSetAll(Object\[\], IntFunction), #copyThenReplaceAll(Object\[\], UnaryOperator)
copyThenReplaceAll(...) -> T\[\]
-
Signature:
@Beta @MayReturnNull public static <T> T[] copyThenReplaceAll(final T[] a, final UnaryOperator<T> operator) - Summary: Creates a copy of the given array and replaces all elements in the copy using the provided {@code UnaryOperator} .
-
Contract:
- If the specified array is {@code null} , returns {@code null} .
- If the specified array is empty, returns itself.
-
Parameters:
-
a(T[]) — the array to be copied and modified -
operator(UnaryOperator<T>) — the UnaryOperator to apply to each element. The operator takes a value of type <i> T </i> and returns a value of type <i> T </i> .
-
- Returns: a new array with elements copied from the specified array and modified by provided {@code UnaryOperator}
- See also: #copyThenSetAll(Object\[\], IntFunction), #copyThenSetAll(Object\[\], Throwables.IntObjFunction)
copyThenUpdateAll(...) -> T\[\]
-
Signature:
@Beta @MayReturnNull public static <T, E extends Exception> T[] copyThenUpdateAll(final T[] a, final Throwables.UnaryOperator<T, E> operator) throws E - Summary: Creates a copy of the given array and replaces all elements in the copy using the provided {@code UnaryOperator} .
-
Contract:
- If the specified array is {@code null} , returns {@code null} .
- If the specified array is empty, returns itself.
- <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] original = {"alice", "bob", "charlie"}; String\[\] copy = N.copyThenUpdateAll(original, s -> { if (s.length() > 3) throw new IllegalArgumentException("Name too long"); return s.toUpperCase(); }); // original is still \["alice", "bob", "charlie"\] // copy is \["ALICE", "BOB", "CHARLIE"\] or exception thrown } </pre>
-
Parameters:
-
a(T[]) — the array to be copied and modified -
operator(Throwables.UnaryOperator<T, E>) — the UnaryOperator to apply to each element. The operator takes a value of type <i> T </i> and returns a value of type <i> T </i> .
-
- Returns: a new array with elements copied from the specified array and modified by provided {@code UnaryOperator}
-
Throws:
-
E— if the operator function throws an exception
-
- See also: #copyThenSetAll(Object\[\], IntFunction), #copyThenSetAll(Object\[\], Throwables.IntObjFunction)
add(...) -> boolean\[\]
-
Signature:
public static boolean[] add(final boolean[] a, final boolean elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(boolean[]) — the original array -
elementToAdd(boolean) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(boolean\[\], boolean...), #insert(boolean\[\], int, boolean)
-
Signature:
public static char[] add(final char[] a, final char elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the original array -
elementToAdd(char) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(char\[\], char...), #insert(char\[\], int, char)
-
Signature:
public static byte[] add(final byte[] a, final byte elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the original array -
elementToAdd(byte) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(byte\[\], byte...), #insert(byte\[\], int, byte)
-
Signature:
public static short[] add(final short[] a, final short elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the original array -
elementToAdd(short) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(short\[\], short...), #insert(short\[\], int, short)
-
Signature:
public static int[] add(final int[] a, final int elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the original array -
elementToAdd(int) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(int\[\], int...), #insert(int\[\], int, int)
-
Signature:
public static long[] add(final long[] a, final long elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the original array -
elementToAdd(long) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(long\[\], long...), #insert(long\[\], int, long)
-
Signature:
public static float[] add(final float[] a, final float elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the original array -
elementToAdd(float) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(float\[\], float...), #insert(float\[\], int, float)
-
Signature:
public static double[] add(final double[] a, final double elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the original array -
elementToAdd(double) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(double\[\], double...), #insert(double\[\], int, double)
-
Signature:
public static String[] add(final String[] a, final String elementToAdd) - Summary: Returns a new array with the specified element added at the end.
-
Contract:
- Returns a single-element array if the input array is {@code null} or empty.
-
Parameters:
-
a(String[]) — the original array -
elementToAdd(String) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
- See also: #addAll(String\[\], String...), #insert(Object\[\], int, Object)
-
Signature:
public static <T> T[] add(@NotNull final T[] a, final T elementToAdd) throws IllegalArgumentException - Summary: Returns a new array with the specified element added at the end.
-
Parameters:
-
a(@NotNull T[]) — the original array (must not be {@code null} ) -
elementToAdd(T) — the element to add at the end
-
- Returns: a new array containing the original elements and the added element
-
Throws:
-
java.lang.IllegalArgumentException— if the original array is {@code null}
-
- See also: #addAll(Object\[\], Object...), #insert(Object\[\], int, Object)
addAll(...) -> boolean\[\]
-
Signature:
public static boolean[] addAll(final boolean[] a, final boolean... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified element added at the end.
-
Parameters:
-
a(boolean[]) — the first array whose elements are added to the new array. -
elementsToAdd(boolean[]) — the additional elements to be added to the new array.
-
- Returns: a new boolean array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
- See also: #add(boolean\[\], boolean), #insert(boolean\[\], int, boolean)
-
Signature:
public static char[] addAll(final char[] a, final char... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified element added at the end.
-
Parameters:
-
a(char[]) — the first array whose elements are added to the new array. -
elementsToAdd(char[]) — the additional elements to be added to the new array.
-
- Returns: a new char array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
- See also: #add(char\[\], char), #insert(char\[\], int, char)
-
Signature:
public static byte[] addAll(final byte[] a, final byte... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(byte[]) — the first array whose elements are added to the new array. -
elementsToAdd(byte[]) — the additional elements to be added to the new array.
-
- Returns: a new byte array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
-
Signature:
public static short[] addAll(final short[] a, final short... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(short[]) — the first array whose elements are added to the new array. -
elementsToAdd(short[]) — the additional elements to be added to the new array.
-
- Returns: a new short array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
-
Signature:
public static int[] addAll(final int[] a, final int... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(int[]) — the first array whose elements are added to the new array. -
elementsToAdd(int[]) — the additional elements to be added to the new array.
-
- Returns: a new int array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
- See also: #add(int\[\], int), #insert(int\[\], int, int)
-
Signature:
public static long[] addAll(final long[] a, final long... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(long[]) — the first array whose elements are added to the new array. -
elementsToAdd(long[]) — the additional elements to be added to the new array.
-
- Returns: a new long array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
-
Signature:
public static float[] addAll(final float[] a, final float... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(float[]) — the first array whose elements are added to the new array. -
elementsToAdd(float[]) — the additional elements to be added to the new array.
-
- Returns: a new float array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
-
Signature:
public static double[] addAll(final double[] a, final double... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(double[]) — the first array whose elements are added to the new array. -
elementsToAdd(double[]) — the additional elements to be added to the new array.
-
- Returns: a new double array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
-
Signature:
public static String[] addAll(final String[] a, final String... elementsToAdd) - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(String[]) — the first array whose elements are added to the new array. -
elementsToAdd(String[]) — the additional elements to be added to the new array.
-
- Returns: a new String array containing the elements from <i> a </i> and <i> elementsToAdd </i> .
- See also: #add(String\[\], String), #insert(String\[\], int, String)
-
Signature:
@SafeVarargs public static <T> T[] addAll(@NotNull final T[] a, final T... elementsToAdd) throws IllegalArgumentException - Summary: Returns a new array with elements copied from the specified array and the specified elements added at the end.
-
Parameters:
-
a(@NotNull T[]) — the original array. -
elementsToAdd(T[]) — the elements to be added to the array.
-
- Returns: a new array containing the original elements and the added elements.
-
Throws:
-
java.lang.IllegalArgumentException— if the input array <i> a </i> and <i> elementsToAdd </i> both are {@code null} .
-
-
Signature:
@SafeVarargs public static <T> boolean addAll(@NotNull final Collection<T> c, final T... elementsToAdd) throws IllegalArgumentException - Summary: Adds all the elements in <i> elementsToAdd </i> to the given collection.
-
Parameters:
-
c(@NotNull Collection<T>) — the original collection. -
elementsToAdd(T[]) — the elements to be added to the collection.
-
- Returns: a boolean indicating if the collection changed as a result of the call.
-
Throws:
-
java.lang.IllegalArgumentException— if the original collection is {@code null} .
-
-
Signature:
public static <T> boolean addAll(@NotNull final Collection<T> c, final Iterable<? extends T> elementsToAdd) throws IllegalArgumentException - Summary: Adds all the elements in <i> elementsToAdd </i> to the given collection.
-
Parameters:
-
c(@NotNull Collection<T>) — the original collection where elements are to be added. -
elementsToAdd(Iterable<? extends T>) — the collection of elements to be added to the original collection.
-
- Returns: a boolean indicating if the original collection changed as a result of the call.
-
Throws:
-
java.lang.IllegalArgumentException— if the original collection is {@code null} .
-
-
Signature:
public static <T> boolean addAll(@NotNull final Collection<T> c, final Iterator<? extends T> elementsToAdd) throws IllegalArgumentException - Summary: Adds all the elements in <i> elementsToAdd </i> to the given collection.
-
Parameters:
-
c(@NotNull Collection<T>) — the original collection where elements are to be added. -
elementsToAdd(Iterator<? extends T>) — the iterator of elements to be added to the original collection.
-
- Returns: a boolean indicating if the original collection changed as a result of the call.
-
Throws:
-
java.lang.IllegalArgumentException— if the original collection is {@code null} .
-
insert(...) -> boolean\[\]
-
Signature:
public static boolean[] insert(final boolean[] a, final int index, final boolean elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(boolean[]) — the original boolean array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(boolean) — the boolean value to be inserted into the array
-
- Returns: a new boolean array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
- See also: #add(boolean\[\], boolean), #insertAll(boolean\[\], int, boolean...)
-
Signature:
public static char[] insert(final char[] a, final int index, final char elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(char[]) — the original char array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(char) — the char value to be inserted into the array
-
- Returns: a new char array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static byte[] insert(final byte[] a, final int index, final byte elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(byte[]) — the original byte array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(byte) — the byte value to be inserted into the array
-
- Returns: a new byte array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static short[] insert(final short[] a, final int index, final short elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(short[]) — the original short array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(short) — the short value to be inserted into the array
-
- Returns: a new short array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static int[] insert(final int[] a, final int index, final int elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(int[]) — the original int array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(int) — the int value to be inserted into the array
-
- Returns: a new int array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
- See also: #add(int\[\], int), #insertAll(int\[\], int, int...)
-
Signature:
public static long[] insert(final long[] a, final int index, final long elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(long[]) — the original long array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(long) — the long value to be inserted into the array
-
- Returns: a new long array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static float[] insert(final float[] a, final int index, final float elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(float[]) — the original float array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(float) — the float value to be inserted into the array
-
- Returns: a new float array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static double[] insert(final double[] a, final int index, final double elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(double[]) — the original double array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(double) — the double value to be inserted into the array
-
- Returns: a new double array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static String[] insert(final String[] a, final int index, final String elementToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(String[]) — the original String array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(String) — the String value to be inserted into the array
-
- Returns: a new String array with the original elements and the inserted element
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
- See also: #add(String\[\], String), #insertAll(String\[\], int, String...)
-
Signature:
public static <T> T[] insert(@NotNull final T[] a, final int index, final T elementToInsert) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
-
Parameters:
-
a(@NotNull T[]) — the original array -
index(int) — the position in the array where the new element should be inserted -
elementToInsert(T) — the element to be inserted into the array
-
- Returns: a new array with the original elements and the inserted element
-
Throws:
-
java.lang.IllegalArgumentException— if the original array is {@code null} -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static String insert(final String str, final int index, final String strToInsert) throws IndexOutOfBoundsException - Summary: Returns a new String with chars copied from the specified String and the specified String inserted at the specified index.
-
Parameters:
-
str(String) — the original string -
index(int) — the position in the string where the new string should be inserted -
strToInsert(String) — the string to be inserted into the original string
-
- Returns: a new string with the original characters and the inserted string
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the index is out of range (index < 0 || index > str.length())
-
insertAll(...) -> boolean\[\]
-
Signature:
public static boolean[] insertAll(final boolean[] a, final int index, final boolean... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(boolean[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(boolean[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static char[] insertAll(final char[] a, final int index, final char... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(char[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(char[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static byte[] insertAll(final byte[] a, final int index, final byte... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(byte[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(byte[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static short[] insertAll(final short[] a, final int index, final short... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(short[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(short[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static int[] insertAll(final int[] a, final int index, final int... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(int[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(int[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static long[] insertAll(final long[] a, final int index, final long... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(long[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(long[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static float[] insertAll(final float[] a, final int index, final float... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(float[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(float[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static double[] insertAll(final double[] a, final int index, final double... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(double[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(double[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static String[] insertAll(final String[] a, final int index, final String... elementsToInsert) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(String[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(String[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
@SafeVarargs public static <T> T[] insertAll(@NotNull final T[] a, final int index, final T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
-
Parameters:
-
a(@NotNull T[]) — the original array -
index(int) — the position in the array where the new elements should be inserted -
elementsToInsert(T[]) — the elements to be inserted into the array
-
- Returns: a new array with the original elements and the inserted elements
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code Array} is {@code null} . -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
@SafeVarargs public static <T> boolean insertAll(@NotNull final List<T> list, final int index, final T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Inserts the specified elements at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
-
Parameters:
-
list(@NotNull List<T>) — the list to insert into -
index(int) — the position in the list where the new elements should be inserted -
elementsToInsert(T[]) — the elements to be inserted into the list
-
- Returns: {@code true} if the list changed as a result of the call
-
Throws:
-
java.lang.IllegalArgumentException— if the list is {@code null} -
java.lang.IndexOutOfBoundsException— if the index is out of range (index < 0 || index > list.size())
-
-
Signature:
public static <T> boolean insertAll(@NotNull final List<T> list, final int index, final Collection<? extends T> elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Inserts the specified elements at the specified position in the list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
-
Parameters:
-
list(@NotNull List<T>) — the list to insert into -
index(int) — the position in the list where the new elements should be inserted -
elementsToInsert(Collection<? extends T>) — the elements to be inserted into the list
-
- Returns: {@code true} if the list changed as a result of the call
-
Throws:
-
java.lang.IllegalArgumentException— if the list is {@code null} -
java.lang.IndexOutOfBoundsException— if the index is out of range (index < 0 || index > list.size())
-
deleteByIndex(...) -> boolean\[\]
-
Signature:
public static boolean[] deleteByIndex(@NotNull final boolean[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull boolean[]) — the original boolean array -
index(int) — the position of the element to be removed
-
- Returns: a new boolean array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
- See also: #remove(boolean\[\], boolean), #deleteAllByIndices(boolean\[\], int...)
-
Signature:
public static char[] deleteByIndex(@NotNull final char[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull char[]) — the original char array -
index(int) — the position of the element to be removed
-
- Returns: a new char array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static byte[] deleteByIndex(@NotNull final byte[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull byte[]) — the original byte array -
index(int) — the position of the element to be removed
-
- Returns: a new byte array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static short[] deleteByIndex(@NotNull final short[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull short[]) — the original short array -
index(int) — the position of the element to be removed
-
- Returns: a new short array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static int[] deleteByIndex(@NotNull final int[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull int[]) — the original int array -
index(int) — the position of the element to be removed
-
- Returns: a new int array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
- See also: #remove(int\[\], int), #deleteAllByIndices(int\[\], int...)
-
Signature:
public static long[] deleteByIndex(@NotNull final long[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull long[]) — the original long array -
index(int) — the position of the element to be removed
-
- Returns: a new long array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static float[] deleteByIndex(@NotNull final float[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull float[]) — the original float array -
index(int) — the position of the element to be removed
-
- Returns: a new float array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static double[] deleteByIndex(@NotNull final double[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull double[]) — the original double array -
index(int) — the position of the element to be removed
-
- Returns: a new double array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
-
Signature:
public static <T> T[] deleteByIndex(@NotNull final T[] a, final int index) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the element at the specified position.
-
Parameters:
-
a(@NotNull T[]) — the original array -
index(int) — the position of the element to be removed
-
- Returns: a new array containing the existing elements except the element at the specified index
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the specified index is out of range
-
deleteAllByIndices(...) -> boolean\[\]
-
Signature:
public static boolean[] deleteAllByIndices(final boolean[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(boolean[]) — the input boolean array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new boolean array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
- See also: #deleteByIndex(boolean\[\], int), #deleteRange(boolean\[\], int, int)
-
Signature:
public static char[] deleteAllByIndices(final char[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(char[]) — the input char array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new char array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static byte[] deleteAllByIndices(final byte[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(byte[]) — the input byte array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new byte array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static short[] deleteAllByIndices(final short[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(short[]) — the input short array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new short array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static int[] deleteAllByIndices(final int[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(int[]) — the input int array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new int array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
- See also: #deleteByIndex(int\[\], int), #deleteRange(int\[\], int, int)
-
Signature:
public static long[] deleteAllByIndices(final long[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(long[]) — the input long array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new long array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static float[] deleteAllByIndices(final float[] a, int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(float[]) — the input float array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new float array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static double[] deleteAllByIndices(final double[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(double[]) — the input double array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new double array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static String[] deleteAllByIndices(final String[] a, final int... indices) throws IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(String[]) — the input String array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new String array containing the remaining elements after removal
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
public static <T> T[] deleteAllByIndices(@NotNull final T[] a, final int... indices) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with elements copied from the specified array except the elements at the specified positions.
-
Parameters:
-
a(@NotNull T[]) — the input array from which elements are to be removed -
indices(int[]) — the positions of the elements to be removed
-
- Returns: a new array containing the remaining elements after removal
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if any index is out of the array's range
-
-
Signature:
@SuppressWarnings("rawtypes") public static boolean deleteAllByIndices(@NotNull final List<?> list, final int... indices) throws IllegalArgumentException - Summary: Deletes all elements at the specified positions from the given list.
-
Parameters:
-
list(@NotNull List<?>) — the list from which elements are to be removed. -
indices(int[]) — the positions of the elements to be removed.
-
- Returns: {@code true} if the list was modified as a result of the operation, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if the input list is {@code null} .
-
remove(...) -> boolean\[\]
-
Signature:
public static boolean[] remove(final boolean[] a, final boolean valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(boolean[]) — the array from which to remove the value -
valueToRemove(boolean) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(boolean\[\], boolean...), #deleteByIndex(boolean\[\], int)
-
Signature:
public static char[] remove(final char[] a, final char valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(char[]) — the array from which to remove the value -
valueToRemove(char) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(char\[\], char...), #deleteByIndex(char\[\], int)
-
Signature:
public static byte[] remove(final byte[] a, final byte valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(byte[]) — the array from which to remove the value -
valueToRemove(byte) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(byte\[\], byte...), #deleteByIndex(byte\[\], int)
-
Signature:
public static short[] remove(final short[] a, final short valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(short[]) — the array from which to remove the value -
valueToRemove(short) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(short\[\], short...), #deleteByIndex(short\[\], int)
-
Signature:
public static int[] remove(final int[] a, final int valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(int[]) — the array from which to remove the value -
valueToRemove(int) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(int\[\], int...), #deleteByIndex(int\[\], int)
-
Signature:
public static long[] remove(final long[] a, final long valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(long[]) — the array from which to remove the value -
valueToRemove(long) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(long\[\], long...), #deleteByIndex(long\[\], int)
-
Signature:
public static float[] remove(final float[] a, final float valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(float[]) — the array from which to remove the value -
valueToRemove(float) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(float\[\], float...), #deleteByIndex(float\[\], int)
-
Signature:
public static double[] remove(final double[] a, final double valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(double[]) — the array from which to remove the value -
valueToRemove(double) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(double\[\], double...), #deleteByIndex(double\[\], int)
-
Signature:
public static String[] remove(final String[] a, final String valueToRemove) - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(String[]) — the array from which to remove the value -
valueToRemove(String) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
- See also: #removeAll(String\[\], String...), #deleteByIndex(Object\[\], int)
-
Signature:
@MayReturnNull public static <T> T[] remove(final T[] a, final T valueToRemove) throws IllegalArgumentException - Summary: Returns a new array with the first occurrence of the specified value removed.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
- Returns a clone of the array if the value is not found.
-
Parameters:
-
a(T[]) — the array from which to remove the value -
valueToRemove(T) — the value to remove
-
- Returns: a new array with the first occurrence removed, or empty array if input is null/empty
-
Throws:
-
java.lang.IllegalArgumentException— if an illegal argument is provided
-
- See also: #removeAll(Object\[\], Object...), #deleteByIndex(Object\[\], int)
-
Signature:
public static <T> boolean remove(final Collection<T> c, final T valueToRemove) - Summary: Removes the first occurrence of the specified value from the collection.
-
Contract:
- Returns {@code false} if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<T>) — the collection from which to remove the value -
valueToRemove(T) — the value to remove
-
- Returns: {@code true} if the collection changed, {@code false} otherwise
- See also: Collection#remove(Object)
removeAll(...) -> boolean\[\]
-
Signature:
@SuppressWarnings("deprecation") public static boolean[] removeAll(final boolean[] a, final boolean... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(boolean[]) — the array from which the values should be removed. -
valuesToRemove(boolean[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(boolean\[\], boolean), #remove(boolean\[\], boolean)
-
Signature:
@SuppressWarnings("deprecation") public static char[] removeAll(final char[] a, final char... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(char[]) — the array from which the values should be removed. -
valuesToRemove(char[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(char\[\], char), #remove(char\[\], char)
-
Signature:
@SuppressWarnings("deprecation") public static byte[] removeAll(final byte[] a, final byte... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(byte[]) — the array from which the values should be removed. -
valuesToRemove(byte[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(byte\[\], byte), #remove(byte\[\], byte)
-
Signature:
@SuppressWarnings("deprecation") public static short[] removeAll(final short[] a, final short... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(short[]) — the array from which the values should be removed. -
valuesToRemove(short[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(short\[\], short), #remove(short\[\], short)
-
Signature:
@SuppressWarnings("deprecation") public static int[] removeAll(final int[] a, final int... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(int[]) — the array from which the values should be removed. -
valuesToRemove(int[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(int\[\], int), #remove(int\[\], int)
-
Signature:
@SuppressWarnings("deprecation") public static long[] removeAll(final long[] a, final long... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(long[]) — the array from which the values should be removed. -
valuesToRemove(long[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(long\[\], long), #remove(long\[\], long)
-
Signature:
@SuppressWarnings("deprecation") public static float[] removeAll(final float[] a, final float... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(float[]) — the array from which the values should be removed. -
valuesToRemove(float[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(float\[\], float), #remove(float\[\], float)
-
Signature:
@SuppressWarnings("deprecation") public static double[] removeAll(final double[] a, final double... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(double[]) — the array from which the values should be removed. -
valuesToRemove(double[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: N#difference(int\[\], int\[\]), #removeAllOccurrences(double\[\], double), #remove(double\[\], double)
-
Signature:
public static String[] removeAll(final String[] a, final String... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(String[]) — the array from which the values should be removed. -
valuesToRemove(String[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] words = {"apple", "banana", "apple", "cherry", "banana"}; String\[\] result = N.removeAll(words, "apple", "banana"); // Returns {"cherry"} } </pre>
- See also: N#difference(int\[\], int\[\])
-
Signature:
@MayReturnNull @SafeVarargs public static <T> T[] removeAll(final T[] a, final T... valuesToRemove) - Summary: Removes all occurrences of the specified values from the array.
-
Parameters:
-
a(T[]) — the array from which the values should be removed. -
valuesToRemove(T[]) — the values to be removed from the array.
-
- Returns: a new array with all occurrences of the specified values removed. The input array itself is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code Integer\[\] numbers = {1, 2, 3, 2, 4, 1, 5}; Integer\[\] result = N.removeAll(numbers, 1, 2); // Returns {3, 4, 5} } </pre>
- See also: N#difference(int\[\], int\[\])
-
Signature:
@SafeVarargs public static <T> boolean removeAll(final Collection<T> c, final T... valuesToRemove) - Summary: Removes all occurrences of the specified values from the given collection.
-
Parameters:
-
c(Collection<T>) — the collection from which the values should be removed. -
valuesToRemove(T[]) — the values to be removed from the collection. <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> list = new ArrayList<>(Arrays.asList("A", "B", "A", "C")); boolean changed = N.removeAll(list, "A", "B"); // changed = true, list = \["C"\] } </pre>
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
-
Signature:
public static <T> boolean removeAll(final Collection<T> c, final Iterable<?> valuesToRemove) - Summary: Removes all occurrences of the specified values from the given collection.
-
Parameters:
-
c(Collection<T>) — the collection from which the values should be removed. -
valuesToRemove(Iterable<?>) — the collection of values to be removed from the collection. <p> <b> Usage Examples: </b> </p> <pre> {@code List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5)); Set<Integer> toRemove = new HashSet<>(Arrays.asList(2, 4)); boolean changed = N.removeAll(list, toRemove); // changed = true, list = \[1, 3, 5\] } </pre>
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
-
Signature:
public static <T> boolean removeAll(final Collection<T> c, final Iterator<?> valuesToRemove) - Summary: Removes all occurrences of the specified values from the given collection.
-
Parameters:
-
c(Collection<T>) — the collection from which the elements should be removed. -
valuesToRemove(Iterator<?>) — the iterator of values to be removed from the collection. <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> list = new ArrayList<>(Arrays.asList("x", "y", "z")); Iterator<String> toRemove = Arrays.asList("x", "z").iterator(); boolean changed = N.removeAll(list, toRemove); // changed = true, list = \["y"\] } </pre>
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
removeAllOccurrences(...) -> boolean\[\]
-
Signature:
public static boolean[] removeAllOccurrences(final boolean[] a, final boolean valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(boolean[]) — the array from which the value should be removed. -
valueToRemove(boolean) — the value to be removed from the array.
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #removeAll(boolean\[\], boolean...), #remove(boolean\[\], boolean)
-
Signature:
public static char[] removeAllOccurrences(final char[] a, final char valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(char[]) — the array from which the value should be removed. -
valueToRemove(char) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] letters = {'a', 'b', 'a', 'c', 'a'}; char\[\] result = N.removeAllOccurrences(letters, 'a'); // Returns {'b', 'c'} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static byte[] removeAllOccurrences(final byte[] a, final byte valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(byte[]) — the array from which the value should be removed. -
valueToRemove(byte) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = {1, 2, 1, 3, 1, 4}; byte\[\] result = N.removeAllOccurrences(data, (byte) 1); // Returns {2, 3, 4} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static short[] removeAllOccurrences(final short[] a, final short valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(short[]) — the array from which the value should be removed. -
valueToRemove(short) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code short\[\] values = {10, 20, 10, 30, 10}; short\[\] result = N.removeAllOccurrences(values, (short) 10); // Returns {20, 30} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static int[] removeAllOccurrences(final int[] a, final int valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(int[]) — the array from which the value should be removed. -
valueToRemove(int) — the value to be removed from the array.
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #removeAll(int\[\], int...), #remove(int\[\], int)
-
Signature:
public static long[] removeAllOccurrences(final long[] a, final long valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(long[]) — the array from which the value should be removed. -
valueToRemove(long) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code long\[\] ids = {100L, 200L, 100L, 300L}; long\[\] result = N.removeAllOccurrences(ids, 100L); // Returns {200L, 300L} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static float[] removeAllOccurrences(final float[] a, final float valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(float[]) — the array from which the value should be removed. -
valueToRemove(float) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code float\[\] values = {1.5f, 2.5f, 1.5f, 3.5f}; float\[\] result = N.removeAllOccurrences(values, 1.5f); // Returns {2.5f, 3.5f} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static double[] removeAllOccurrences(final double[] a, final double valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(double[]) — the array from which the value should be removed. -
valueToRemove(double) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code double\[\] prices = {10.99, 20.99, 10.99, 30.99}; double\[\] result = N.removeAllOccurrences(prices, 10.99); // Returns {20.99, 30.99} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static String[] removeAllOccurrences(final String[] a, final String valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(String[]) — the array from which the value should be removed. -
valueToRemove(String) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] words = {"apple", "banana", "apple", "cherry"}; String\[\] result = N.removeAllOccurrences(words, "apple"); // Returns {"banana", "cherry"} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static <T> T[] removeAllOccurrences(final T[] a, final T valueToRemove) - Summary: Removes all occurrences of the specified value from the array.
-
Parameters:
-
a(T[]) — the array from which the value should be removed. -
valueToRemove(T) — the value to be removed from the array. <p> <b> Usage Examples: </b> </p> <pre> {@code Integer\[\] numbers = {1, 2, 1, 3, 1, 4}; Integer\[\] result = N.removeAllOccurrences(numbers, 1); // Returns {2, 3, 4} } </pre>
-
- Returns: a new array with all occurrences of the specified value removed. The input array itself is returned if the specified array is {@code null} or empty.
-
Signature:
public static <T> boolean removeAllOccurrences(final Collection<T> c, final T valueToRemove) - Summary: Removes all occurrences of the specified value from the given collection.
-
Parameters:
-
c(Collection<T>) — the collection from which the value should be removed. -
valueToRemove(T) — the value to be removed from the collection. <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> list = new ArrayList<>(Arrays.asList("a", "b", "a", "c")); boolean changed = N.removeAllOccurrences(list, "a"); // changed = true, list = \["b", "c"\] } </pre>
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
removeDuplicates(...) -> boolean\[\]
-
Signature:
@Deprecated public static boolean[] removeDuplicates(final boolean[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(boolean[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
@Deprecated public static char[] removeDuplicates(final char[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(char[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static char[] removeDuplicates(final char[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(char[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #distinct(char\[\]), #removeDuplicates(char\[\], int, int, boolean)
-
Signature:
public static char[] removeDuplicates(final char[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(char[]) — the array from which duplicates should be removed, may be {@code null} or empty -
fromIndex(int) — the initial index of the range to be considered for duplicate removal, inclusive -
toIndex(int) — the final index of the range to be considered for duplicate removal, exclusive -
isSorted(boolean) — {@code true} if the input array within the specified range is sorted (enables faster algorithm), {@code false} otherwise
-
- Returns: a new array with distinct elements within the specified range, preserving order of first occurrence. Returns an empty array if the input is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > a.length} or {@code fromIndex > toIndex}
-
- Performance: <p> <b> Algorithm: </b> </p> <ul> <li> If {@code isSorted} is true: Uses optimized sequential comparison - O(n) time, O(n) space </li> <li> If {@code isSorted} is false: Uses LinkedHashSet to maintain order - O(n) time, O(n) space with additional set overhead </li> </ul> <p> <b> Performance Tip: </b> If your array is sorted (or you can sort it first), pass {@code isSorted=true} for better performance with improved cache locality.
- See also: #distinct(char\[\]), #removeDuplicates(char\[\], boolean)
-
Signature:
@Deprecated public static byte[] removeDuplicates(final byte[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(byte[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static byte[] removeDuplicates(final byte[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(byte[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static byte[] removeDuplicates(final byte[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(byte[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
@Deprecated public static short[] removeDuplicates(final short[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(short[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static short[] removeDuplicates(final short[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(short[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static short[] removeDuplicates(final short[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(short[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
@Deprecated public static int[] removeDuplicates(final int[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(int[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static int[] removeDuplicates(final int[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(int[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #distinct(int\[\]), #removeDuplicates(int\[\], int, int, boolean)
-
Signature:
public static int[] removeDuplicates(final int[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(int[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
@Deprecated public static long[] removeDuplicates(final long[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(long[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static long[] removeDuplicates(final long[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(long[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static long[] removeDuplicates(final long[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(long[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
@Deprecated public static float[] removeDuplicates(final float[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(float[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static float[] removeDuplicates(final float[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(float[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static float[] removeDuplicates(final float[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(float[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
@Deprecated public static double[] removeDuplicates(final double[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(double[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static double[] removeDuplicates(final double[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(double[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
-
Signature:
public static double[] removeDuplicates(final double[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(double[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
public static String[] removeDuplicates(final String[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(String[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #distinct(Object\[\])
-
Signature:
public static String[] removeDuplicates(final String[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(String[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. An empty array is returned if the specified array is {@code null} or empty.
- See also: #distinct(Object\[\]), #removeDuplicates(String\[\], int, int, boolean)
-
Signature:
public static String[] removeDuplicates(final String[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(String[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
public static <T> T[] removeDuplicates(final T[] a) - Summary: Returns a new array with elements from the input array but without any duplicates.
-
Parameters:
-
a(T[]) — the array from which duplicates should be removed.
-
- Returns: a new array with all duplicates removed. The input array itself is returned if the specified array is {@code null} or empty.
- See also: #distinct(Object\[\])
-
Signature:
public static <T> T[] removeDuplicates(final T[] a, final boolean isSorted) - Summary: Removes duplicate elements from the array.
-
Parameters:
-
a(T[]) — the array from which duplicates should be removed. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with all duplicates removed. The input array itself is returned if the specified array is {@code null} or empty.
- See also: #distinct(Object\[\]), #removeDuplicates(Object\[\], int, int, boolean)
-
Signature:
public static <T> T[] removeDuplicates(final T[] a, final int fromIndex, final int toIndex, final boolean isSorted) throws IndexOutOfBoundsException - Summary: Removes duplicate elements from the specified range of the array.
-
Parameters:
-
a(T[]) — the array from which duplicates should be removed. -
fromIndex(int) — the initial index of the range to be considered for duplicate removal. -
toIndex(int) — the final index of the range to be considered for duplicate removal. -
isSorted(boolean) — {@code true} if the array is already sorted, {@code false} otherwise. If true, a more efficient algorithm is used.
-
- Returns: a new array with distinct elements within the specified range.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds.
-
-
Signature:
public static boolean removeDuplicates(final Collection<?> c) - Summary: Removes duplicate elements from the given collection.
-
Parameters:
-
c(Collection<?>) — the collection from which duplicates should be removed.
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
- See also: #distinct(Iterable), #distinctBy(Iterable, Function)
-
Signature:
@SuppressWarnings("rawtypes") public static boolean removeDuplicates(final Collection<?> c, final boolean isSorted) - Summary: Removes duplicate elements from the given collection.
-
Parameters:
-
c(Collection<?>) — the collection from which duplicates should be removed. -
isSorted(boolean) — a boolean flag indicating whether the input array is sorted. If {@code true} , the algorithm will be faster
-
- Returns: {@code true} if the collection changed as a result of this call, {@code false} otherwise.
- See also: #distinct(Iterable), #distinctBy(Iterable, Function)
deleteRange(...) -> boolean\[\]
-
Signature:
public static boolean[] deleteRange(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(boolean[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code boolean\[\] flags = {true, false, true, false, true}; boolean\[\] result = N.deleteRange(flags, 1, 3); // result = {true, false, true} (deleted indices 1-2) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static char[] deleteRange(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(char[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] letters = {'a', 'b', 'c', 'd', 'e'}; char\[\] result = N.deleteRange(letters, 1, 3); // result = {'a', 'd', 'e'} (deleted 'b' and 'c') } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static byte[] deleteRange(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(byte[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = {1, 2, 3, 4, 5}; byte\[\] result = N.deleteRange(data, 1, 3); // result = {1, 4, 5} (deleted elements at indices 1-2) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static short[] deleteRange(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(short[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code short\[\] values = {10, 20, 30, 40, 50}; short\[\] result = N.deleteRange(values, 1, 3); // result = {10, 40, 50} (deleted elements at indices 1-2) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static int[] deleteRange(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(int[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code int\[\] numbers = {1, 2, 3, 4, 5}; int\[\] result = N.deleteRange(numbers, 1, 3); // result = {1, 4, 5} (deleted 2 and 3) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static long[] deleteRange(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(long[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code long\[\] ids = {100L, 200L, 300L, 400L, 500L}; long\[\] result = N.deleteRange(ids, 1, 3); // result = {100L, 400L, 500L} (deleted 200L and 300L) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static float[] deleteRange(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(float[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code float\[\] values = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}; float\[\] result = N.deleteRange(values, 1, 3); // result = {1.0f, 4.0f, 5.0f} (deleted 2.0f and 3.0f) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static double[] deleteRange(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(double[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty. <p> <b> Usage Examples: </b> </p> <pre> {@code double\[\] prices = {10.99, 20.99, 30.99, 40.99, 50.99}; double\[\] result = N.deleteRange(prices, 1, 3); // result = {10.99, 40.99, 50.99} (deleted 20.99 and 30.99) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static String[] deleteRange(final String[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(String[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed. An empty array is returned if the specified array is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds -
java.lang.IllegalArgumentException
-
-
Signature:
public static <T> T[] deleteRange(@NotNull final T[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with the specified range of elements removed <br/> The original array remains unchanged.
-
Parameters:
-
a(@NotNull T[]) — the input array from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new array with the specified range of elements removed
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is invalid -
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
- See also: #skipRange(Object\[\], int, int)
-
Signature:
public static <T> boolean deleteRange(final List<T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Deletes a range of elements from the given list.
-
Parameters:
-
c(List<T>) — the input list from which a range of elements are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: {@code true} if the list is updated; {@code false} otherwise
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the list bounds
-
-
Signature:
public static String deleteRange(final String str, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new String with the specified range of chars removed <br/> The original String remains unchanged.
-
Parameters:
-
str(String) — the input string from which a range of characters are to be deleted -
fromIndex(int) — the initial index of the range to be deleted, inclusive -
toIndex(int) — the final index of the range to be deleted, exclusive
-
- Returns: a new string with the specified range of characters deleted. An empty String is returned if the specified String is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the string bounds
-
- See also: Strings#deleteRange(String, int, int)
replaceRange(...) -> boolean\[\]
-
Signature:
public static boolean[] replaceRange(final boolean[] a, final int fromIndex, final int toIndex, final boolean[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(boolean[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(boolean[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code boolean\[\] flags = {true, false, true, false, true}; boolean\[\] replacement = {false, false}; boolean\[\] result = N.replaceRange(flags, 1, 3, replacement); // result = {true, false, false, false, true} (replaced indices 1-2 with two false values) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static char[] replaceRange(final char[] a, final int fromIndex, final int toIndex, final char[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(char[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(char[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] letters = {'a', 'b', 'c', 'd', 'e'}; char\[\] replacement = {'x', 'y'}; char\[\] result = N.replaceRange(letters, 1, 3, replacement); // result = {'a', 'x', 'y', 'd', 'e'} (replaced 'b' and 'c' with 'x' and 'y') } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static byte[] replaceRange(final byte[] a, final int fromIndex, final int toIndex, final byte[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(byte[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(byte[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data = {1, 2, 3, 4, 5}; byte\[\] replacement = {8, 9}; byte\[\] result = N.replaceRange(data, 1, 3, replacement); // result = {1, 8, 9, 4, 5} (replaced indices 1-2) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static short[] replaceRange(final short[] a, final int fromIndex, final int toIndex, final short[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(short[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(short[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code short\[\] values = {10, 20, 30, 40, 50}; short\[\] replacement = {80, 90}; short\[\] result = N.replaceRange(values, 1, 3, replacement); // result = {10, 80, 90, 40, 50} (replaced 20 and 30 with 80 and 90) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static int[] replaceRange(final int[] a, final int fromIndex, final int toIndex, final int[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(int[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(int[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code int\[\] numbers = {1, 2, 3, 4, 5}; int\[\] replacement = {8, 9}; int\[\] result = N.replaceRange(numbers, 1, 3, replacement); // result = {1, 8, 9, 4, 5} (replaced 2 and 3 with 8 and 9) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static long[] replaceRange(final long[] a, final int fromIndex, final int toIndex, final long[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(long[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(long[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code long\[\] ids = {100L, 200L, 300L, 400L, 500L}; long\[\] replacement = {800L, 900L}; long\[\] result = N.replaceRange(ids, 1, 3, replacement); // result = {100L, 800L, 900L, 400L, 500L} (replaced 200L and 300L) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static float[] replaceRange(final float[] a, final int fromIndex, final int toIndex, final float[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(float[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(float[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code float\[\] values = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}; float\[\] replacement = {8.0f, 9.0f}; float\[\] result = N.replaceRange(values, 1, 3, replacement); // result = {1.0f, 8.0f, 9.0f, 4.0f, 5.0f} (replaced 2.0f and 3.0f) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static double[] replaceRange(final double[] a, final int fromIndex, final int toIndex, final double[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(double[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(double[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code double\[\] prices = {10.99, 20.99, 30.99, 40.99, 50.99}; double\[\] replacement = {80.99, 90.99}; double\[\] result = N.replaceRange(prices, 1, 3, replacement); // result = {10.99, 80.99, 90.99, 40.99, 50.99} (replaced indices 1-2) } </pre>
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static String[] replaceRange(final String[] a, final int fromIndex, final int toIndex, final String[] replacement) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(String[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(String[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static <T> T[] replaceRange(@NotNull final T[] a, final int fromIndex, final int toIndex, final T[] replacement) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns a new array with the specified range replaced with the replacement array.
-
Parameters:
-
a(@NotNull T[]) — the original array -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(T[]) — the array to replace the specified range in the original array
-
- Returns: a new array with the specified range replaced by the replacement array <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] words = {"apple", "banana", "cherry", "date", "elderberry"}; String\[\] replacement = {"kiwi", "lemon"}; String\[\] result = N.replaceRange(words, 1, 3, replacement); // result = {"apple", "kiwi", "lemon", "date", "elderberry"} } </pre>
-
Throws:
-
java.lang.IllegalArgumentException -
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
-
Signature:
public static <T> boolean replaceRange(@NotNull final List<T> c, final int fromIndex, final int toIndex, final Collection<? extends T> replacement) throws IllegalArgumentException - Summary: Replaces a range of elements in the given list with the elements from the replacement collection.
-
Parameters:
-
c(@NotNull List<T>) — the original list to be modified -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(Collection<? extends T>) — the collection to replace the specified range in the original list
-
- Returns: a boolean indicating whether the list was modified
-
Throws:
-
java.lang.IllegalArgumentException— if the replacement collection is {@code null}
-
-
Signature:
public static String replaceRange(final String str, final int fromIndex, final int toIndex, final String replacement) throws IndexOutOfBoundsException - Summary: Returns a new String with the specified range replaced with the replacement String.
-
Parameters:
-
str(String) — the original string -
fromIndex(int) — the initial index of the range to be replaced, inclusive -
toIndex(int) — the final index of the range to be replaced, exclusive -
replacement(String) — the string to replace the specified range in the original string
-
- Returns: a new string with the specified range replaced by the replacement string
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the string bounds
-
- See also: Strings#replaceRange(String, int, int, String)
moveRange(...) -> void
-
Signature:
public static void moveRange(final boolean[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(boolean[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final char[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(char[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final byte[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(byte[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final short[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(short[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final int[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(int[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final long[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(long[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final float[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(float[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static void moveRange(final double[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(double[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static <T> void moveRange(final T[] a, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given array to a new position within the array.
-
Parameters:
-
a(T[]) — the original array to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfArray - lengthOfRange, inclusive.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the array
-
-
Signature:
public static <T> boolean moveRange(final List<T> c, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a range of elements in the given list to a new position within the list.
-
Parameters:
-
c(List<T>) — the original list to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and sizeOfList - lengthOfRange, inclusive.
-
- Returns: {@code true} if the list was modified (elements were moved), {@code false} otherwise
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the list
-
-
Signature:
public static String moveRange(final String str, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a specified range of characters within a string to a new position.
-
Contract:
- The newPositionAfterMove parameter indicates where the start of the moved range should be positioned in the resulting string.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Moving a range of characters moveRange("ABCDEFGH", 2, 5, 0); // returns "CDEABFGH" (moves "CDE" to position 0) moveRange("ABCDEFGH", 2, 5, 5); // returns "ABFGHCDE" (moves "CDE" to position 5) moveRange("Hello World", 0, 5, 6); // returns " WorldHello" (moves "Hello" to position 6) // Edge cases moveRange(null, 0, 0, 0); // returns "" moveRange("", 0, 0, 0); // returns "" moveRange("ABC", 1, 1, 1); // returns "ABC" (no change when fromIndex == toIndex) moveRange("ABC", 0, 2, 0); // returns "ABC" (no change when already at position) } </pre>
-
Parameters:
-
str(String) — the original string to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfString - lengthOfRange, inclusive.
-
- Returns: a new string with the specified range moved to the new position. An empty String is returned if the specified String is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the string
-
- See also: Strings#moveRange(String, int, int, int)
skipRange(...) -> T\[\]
-
Signature:
@MayReturnNull public static <T> T[] skipRange(final T[] a, final int startInclusive, final int endExclusive) throws IndexOutOfBoundsException - Summary: Returns a new array with the specified range skipped, effectively excluding elements from the given start index (inclusive) to the end index (exclusive).
-
Contract:
- If the input array is {@code null} , returns {@code null} .
- If the range is empty (startInclusive == endExclusive), returns a clone of the original array.
-
Parameters:
-
a(T[]) — the original array to be modified; may be {@code null} -
startInclusive(int) — the initial index of the range to be skipped, inclusive -
endExclusive(int) — the final index of the range to be skipped, exclusive
-
- Returns: a new array with the specified range skipped; {@code null} if the input array is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
- See also: #deleteRange(Object\[\], int, int)
-
Signature:
public static <T> List<T> skipRange(final Collection<? extends T> c, final int startInclusive, final int endExclusive) throws IndexOutOfBoundsException - Summary: Returns a new list with the specified range skipped, effectively excluding elements from the given start index (inclusive) to the end index (exclusive).
-
Parameters:
-
c(Collection<? extends T>) — the original collection to be modified -
startInclusive(int) — the initial index of the range to be skipped, inclusive -
endExclusive(int) — the final index of the range to be skipped, exclusive
-
- Returns: a new list with the specified range skipped.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the collection bounds
-
- See also: #skipRange(Collection, int, int, IntFunction)
-
Signature:
public static <T, C extends Collection<T>> C skipRange(final Collection<? extends T> c, final int startInclusive, final int endExclusive, final IntFunction<C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection with the specified range skipped, effectively excluding elements from the given start index (inclusive) to the end index (exclusive).
-
Contract:
- <p> <b> Performance note: </b> If the input collection is a {@link List} , this method uses {@code subList} for efficient range access.
-
Parameters:
-
c(Collection<? extends T>) — the original collection to be modified -
startInclusive(int) — the initial index of the range to be skipped, inclusive -
endExclusive(int) — the final index of the range to be skipped, exclusive -
supplier(IntFunction<C>) — a function that creates a new instance of the desired collection type
-
- Returns: a new collection with the specified range skipped.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the collection bounds
-
- See also: #skipRange(Collection, int, int)
hasDuplicates(...) -> boolean
-
Signature:
public static boolean hasDuplicates(final boolean[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(boolean[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code boolean\[\] flags1 = {true, false, true}; boolean result1 = N.hasDuplicates(flags1); // Returns true (two true values) boolean\[\] flags2 = {true, false}; boolean result2 = N.hasDuplicates(flags2); // Returns false } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final char[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(char[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] letters1 = {'a', 'b', 'c'}; boolean result1 = N.hasDuplicates(letters1); // Returns false char\[\] letters2 = {'a', 'b', 'a'}; boolean result2 = N.hasDuplicates(letters2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final char[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(char[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster. <p> <b> Usage Examples: </b> </p> <pre> {@code char\[\] sorted = {'a', 'b', 'b', 'c'}; boolean result1 = N.hasDuplicates(sorted, true); // Returns true (using optimized sorted check) char\[\] unsorted = {'c', 'a', 'b', 'a'}; boolean result2 = N.hasDuplicates(unsorted, false); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final byte[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(byte[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] data1 = {1, 2, 3}; boolean result1 = N.hasDuplicates(data1); // Returns false byte\[\] data2 = {1, 2, 1}; boolean result2 = N.hasDuplicates(data2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final byte[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(byte[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final short[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(short[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code short\[\] values1 = {10, 20, 30}; boolean result1 = N.hasDuplicates(values1); // Returns false short\[\] values2 = {10, 20, 10}; boolean result2 = N.hasDuplicates(values2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final short[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(short[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final int[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(int[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code int\[\] numbers1 = {1, 2, 3, 4}; boolean result1 = N.hasDuplicates(numbers1); // Returns false int\[\] numbers2 = {1, 2, 3, 2}; boolean result2 = N.hasDuplicates(numbers2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final int[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(int[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final long[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(long[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code long\[\] ids1 = {100L, 200L, 300L}; boolean result1 = N.hasDuplicates(ids1); // Returns false long\[\] ids2 = {100L, 200L, 100L}; boolean result2 = N.hasDuplicates(ids2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final long[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(long[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final float[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(float[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code float\[\] values1 = {1.5f, 2.5f, 3.5f}; boolean result1 = N.hasDuplicates(values1); // Returns false float\[\] values2 = {1.5f, 2.5f, 1.5f}; boolean result2 = N.hasDuplicates(values2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final float[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(float[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final double[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(double[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code double\[\] prices1 = {10.99, 20.99, 30.99}; boolean result1 = N.hasDuplicates(prices1); // Returns false double\[\] prices2 = {10.99, 20.99, 10.99}; boolean result2 = N.hasDuplicates(prices2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final double[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(double[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static <T> boolean hasDuplicates(final T[] a) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(T[]) — the array to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code String\[\] words1 = {"apple", "banana", "cherry"}; boolean result1 = N.hasDuplicates(words1); // Returns false String\[\] words2 = {"apple", "banana", "apple"}; boolean result2 = N.hasDuplicates(words2); // Returns true } </pre>
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static <T> boolean hasDuplicates(final T[] a, final boolean isSorted) - Summary: Checks if the given array has duplicate elements.
-
Contract:
- Checks if the given array has duplicate elements.
-
Parameters:
-
a(T[]) — the array to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the array is sorted. If {@code true} , the algorithm will be faster.
-
- Returns: {@code true} if the array has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final Collection<?> c) - Summary: Checks if the given collection has duplicate elements.
-
Contract:
- Checks if the given collection has duplicate elements.
-
Parameters:
-
c(Collection<?>) — the collection to be checked for duplicates <p> <b> Usage Examples: </b> </p> <pre> {@code List<Integer> list1 = Arrays.asList(1, 2, 3, 4); boolean result1 = N.hasDuplicates(list1); // Returns false List<Integer> list2 = Arrays.asList(1, 2, 3, 2); boolean result2 = N.hasDuplicates(list2); // Returns true Set<String> set = new HashSet<>(Arrays.asList("a", "b", "c")); boolean result3 = N.hasDuplicates(set); // Returns false (Sets can't have duplicates) } </pre>
-
- Returns: {@code true} if the collection has duplicates, {@code false} otherwise
-
Signature:
public static boolean hasDuplicates(final Collection<?> c, final boolean isSorted) - Summary: Checks if the given collection has duplicate elements.
-
Contract:
- Checks if the given collection has duplicate elements.
-
Parameters:
-
c(Collection<?>) — the collection to be checked for duplicates -
isSorted(boolean) — a boolean that indicates if the collection is sorted. If {@code true} , the algorithm will be faster
-
- Returns: {@code true} if the collection has duplicates, {@code false} otherwise
retainAll(...) -> boolean
-
Signature:
public static <T> boolean retainAll(final Collection<T> c, final Collection<? extends T> objsToKeep) - Summary: Retains only the elements in the specified collection that are present in the specified collection of elements to keep.
-
Parameters:
-
c(Collection<T>) — the collection to be modified. -
objsToKeep(Collection<? extends T>) — the collection containing elements to be retained in the first collection.
-
- Returns: {@code true} if the first collection changed as a result of the call
- See also: Collection#retainAll(Collection)
sum(...) -> int
-
Signature:
public static int sum(final char... a) - Summary: Returns the sum of all elements in the specified char array or varargs.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array or varargs of char values
-
- Returns: the sum of all elements, or 0 if the array is {@code null} or empty
- See also: #sum(char\[\], int, int), #average(char...)
-
Signature:
public static int sum(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the char array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array of char values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0 if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(char...), #average(char\[\], int, int)
-
Signature:
public static int sum(final byte... a) - Summary: Returns the sum of all elements in the specified byte array or varargs.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array or varargs of byte values
-
- Returns: the sum of all elements, or 0 if the array is {@code null} or empty
- See also: #sum(byte\[\], int, int), #average(byte...)
-
Signature:
public static int sum(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the byte array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array of byte values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0 if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(byte...), #average(byte\[\], int, int)
-
Signature:
public static int sum(final short... a) - Summary: Returns the sum of all elements in the specified short array or varargs.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array or varargs of short values
-
- Returns: the sum of all elements, or 0 if the array is {@code null} or empty
- See also: #sum(short\[\], int, int), #average(short...)
-
Signature:
public static int sum(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the short array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array of short values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0 if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(short...), #average(short\[\], int, int)
-
Signature:
public static int sum(final int... a) - Summary: Returns the sum of all elements in the array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values
-
- Returns: the sum of all elements, or 0 if the array is {@code null} or empty
- See also: #sum(int\[\], int, int), #sumToLong(int...), #average(int...)
-
Signature:
public static int sum(final int[] a, final int fromIndex, final int toIndex) - Summary: Returns the sum of elements within the specified range of the int array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0 if the array is {@code null} or empty
- See also: #sum(int...), #sumToLong(int\[\], int, int), #average(int\[\], int, int)
-
Signature:
public static long sum(final long... a) - Summary: Returns the sum of all elements in the specified long array or varargs.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array or varargs of long values
-
- Returns: the sum of all elements, or 0 if the array is {@code null} or empty
- See also: #sum(long\[\], int, int), #average(long...)
-
Signature:
public static long sum(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the long array.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array of long values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0 if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(long...), #average(long\[\], int, int)
-
Signature:
public static float sum(final float... a) - Summary: Returns the sum of all elements in the specified float array or varargs.
-
Contract:
- Returns 0.0f if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array or varargs of float values
-
- Returns: the sum of all elements, or 0.0f if the array is {@code null} or empty
- See also: #sum(float\[\], int, int), #sumToDouble(float...), #average(float...)
-
Signature:
public static float sum(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the float array.
-
Contract:
- Returns 0.0f if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array of float values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0.0f if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(float...), #sumToDouble(float\[\], int, int), #average(float\[\], int, int)
-
Signature:
public static double sum(final double... a) - Summary: Returns the sum of all elements in the specified double array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array or varargs of double values
-
- Returns: the sum of all elements, or 0.0d if the array is {@code null} or empty
- See also: #sum(double\[\], int, int), #average(double...)
-
Signature:
public static double sum(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the double array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array of double values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sum(double...), #average(double\[\], int, int)
sumToLong(...) -> long
-
Signature:
public static long sumToLong(final int... a) - Summary: Returns the sum of all elements in the array as a long value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values
-
- Returns: the sum of all elements as a long, or 0 if the array is {@code null} or empty
- See also: #sumToLong(int\[\], int, int), #sum(int...)
-
Signature:
public static long sumToLong(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the sum of elements within the specified range of the array as a long value.
-
Contract:
- Returns 0 if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the sum of elements within the specified range as a long, or 0 if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #sumToLong(int...), #sum(int\[\], int, int)
sumToDouble(...) -> double
-
Signature:
public static double sumToDouble(final float... a) - Summary: Sums all elements in the given array of floats to a double value.
-
Parameters:
-
a(float[]) — the array of floats to be summed.
-
- Returns: the sum of all floats in the array as a double. If the array is {@code null} or empty, {@code 0} is returned.
- See also: #sumToDouble(float\[\], int, int), #sum(float...)
-
Signature:
public static double sumToDouble(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input array of floats to a double value.
-
Parameters:
-
a(float[]) — the array of floats to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the input array as a double. If the array is {@code null} or empty, {@code 0} is returned.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds for the given array.
-
- See also: #sumToDouble(float...), #sum(float\[\], int, int)
average(...) -> double
-
Signature:
public static double average(final char... a) - Summary: Returns the average of all elements in the specified char array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array or varargs of char values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(char\[\], int, int), #sum(char...)
-
Signature:
public static double average(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the char array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the array of char values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(char...), #sum(char\[\], int, int)
-
Signature:
public static double average(final byte... a) - Summary: Returns the average of all elements in the specified byte array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array or varargs of byte values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(byte\[\], int, int), #sum(byte...)
-
Signature:
public static double average(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the byte array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the array of byte values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(byte...), #sum(byte\[\], int, int)
-
Signature:
public static double average(final short... a) - Summary: Returns the average of all elements in the specified short array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array or varargs of short values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(short\[\], int, int), #sum(short...)
-
Signature:
public static double average(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the short array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the array of short values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(short...), #sum(short\[\], int, int)
-
Signature:
public static double average(final int... a) - Summary: Returns the average of all elements in the specified int array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array or varargs of int values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(int\[\], int, int), #sum(int...)
-
Signature:
public static double average(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the int array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(int...), #sum(int\[\], int, int)
-
Signature:
public static double average(final long... a) - Summary: Returns the average of all elements in the specified long array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array or varargs of long values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(long\[\], int, int), #sum(long...)
-
Signature:
public static double average(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the long array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array of long values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(long...), #sum(long\[\], int, int)
-
Signature:
public static double average(final float... a) - Summary: Returns the average of all elements in the specified float array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array or varargs of float values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(float\[\], int, int), #sum(float...)
-
Signature:
public static double average(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the float array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the array of float values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(float...), #sum(float\[\], int, int)
-
Signature:
public static double average(final double... a) - Summary: Returns the average of all elements in the specified double array or varargs.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array or varargs of double values
-
- Returns: the average of all elements, or 0.0d if the array is {@code null} or empty
- See also: #average(double\[\], int, int), #sum(double...)
-
Signature:
public static double average(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the average of elements within the specified range of the double array.
-
Contract:
- Returns 0.0d if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array of double values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the average of elements within the specified range, or 0.0d if the array is {@code null} or empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #average(double...), #sum(double\[\], int, int)
sumInt(...) -> int
-
Signature:
public static <T extends Number> int sumInt(final T[] a) - Summary: Sums all elements in the given array of numbers and returns the result as an integer.
-
Parameters:
-
a(T[]) — the array of numbers to be summed.
-
- Returns: the sum of all elements in the array as an integer.
- See also: Iterables#sumInt(Iterable)
-
Signature:
public static <T extends Number> int sumInt(final T[] a, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input array of numbers and returns the result as an integer.
-
Parameters:
-
a(T[]) — the array of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the array as an integer.
- See also: Iterables#sumInt(Iterable)
-
Signature:
public static <T> int sumInt(final T[] a, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements in the given array using the provided function to convert each element to an integer.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the sum of all elements in the array as an integer.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if an index is out of bounds
-
- See also: Iterables#sumInt(Iterable, ToIntFunction)
-
Signature:
public static <T> int sumInt(final T[] a, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input array using the provided function to convert each element to an integer.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the sum of all elements within the specified range of the array as an integer.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumInt(Iterable, ToIntFunction)
-
Signature:
public static <T extends Number> int sumInt(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input collection of numbers and returns the result as an integer.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the collection as an integer.
- See also: Iterables#sumInt(Iterable)
-
Signature:
public static <T> int sumInt(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input collection using the provided function to convert each element to an integer.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the sum of all elements within the specified range of the collection as an integer.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumInt(Iterable, ToIntFunction)
-
Signature:
public static <T extends Number> int sumInt(final Iterable<? extends T> c) - Summary: Sums all elements in the given iterable of numbers and returns the result as a integer.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed.
-
- Returns: the sum of all elements in the iterable as a integer.
- See also: Iterables#sumInt(Iterable)
-
Signature:
public static <T> int sumInt(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to an integer.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the sum of all elements in the iterable as an integer.
- See also: Iterables#sumInt(Iterable, ToIntFunction)
sumIntToLong(...) -> long
-
Signature:
public static <T extends Number> long sumIntToLong(final Iterable<? extends T> c) - Summary: Sums all elements in the given iterable of numbers and returns the result as a long.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to be summed.
-
- Returns: the sum of all elements in the iterable as a long.
- See also: Iterables#sumLong(Iterable)
-
Signature:
public static <T> long sumIntToLong(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to an integer and returns the result as a long.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the sum of all elements in the iterable as a long.
- See also: Iterables#sumIntToLong(Iterable, ToIntFunction)
sumLong(...) -> long
-
Signature:
public static <T extends Number> long sumLong(final T[] a) - Summary: Sums all elements in the given array of numbers and returns the result as a long.
-
Parameters:
-
a(T[]) — the array of numbers to be summed.
-
- Returns: the sum of all elements in the array as a long.
- See also: Iterables#sumLong(Iterable)
-
Signature:
public static <T extends Number> long sumLong(final T[] a, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input array of numbers and returns the result as a long.
-
Parameters:
-
a(T[]) — the array of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the array as a long.
- See also: Iterables#sumLong(Iterable)
-
Signature:
public static <T> long sumLong(final T[] a, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements in the given array using the provided function to convert each element to a long.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the sum of all elements in the array as a long.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if an index is out of bounds
-
- See also: Iterables#sumLong(Iterable, ToLongFunction)
-
Signature:
public static <T> long sumLong(final T[] a, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input array using the provided function to convert each element to a long.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the sum of all elements within the specified range of the array as a long.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumLong(Iterable, ToLongFunction)
-
Signature:
public static <T extends Number> long sumLong(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input collection of numbers and returns the result as a long.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the collection as a long.
- See also: Iterables#sumLong(Iterable)
-
Signature:
public static <T> long sumLong(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input collection using the provided function to convert each element to a long.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the sum of all elements within the specified range of the collection as a long.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumLong(Iterable, ToLongFunction)
-
Signature:
public static <T extends Number> long sumLong(final Iterable<? extends T> c) - Summary: Sums all elements in the given iterable of numbers and returns the result as a long.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to be summed.
-
- Returns: the sum of all elements in the iterable as a long.
- See also: Iterables#sumLong(Iterable)
-
Signature:
public static <T> long sumLong(final Iterable<? extends T> c, final ToLongFunction<? super T> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to a long.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the sum of all elements in the iterable as a long.
- See also: Iterables#sumLong(Iterable, ToLongFunction)
sumDouble(...) -> double
-
Signature:
public static <T extends Number> double sumDouble(final T[] a) - Summary: Sums all elements in the given array of numbers and returns the result as a double.
-
Parameters:
-
a(T[]) — the array of numbers to be summed.
-
- Returns: the sum of all elements in the array as a double.
- See also: Iterables#sumDouble(Iterable)
-
Signature:
public static <T extends Number> double sumDouble(final T[] a, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input array of numbers and returns the result as a double.
-
Parameters:
-
a(T[]) — the array of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the array as a double.
- See also: Iterables#sumDouble(Iterable)
-
Signature:
public static <T> double sumDouble(final T[] a, final ToDoubleFunction<? super T> func) - Summary: Sums all elements in the given array using the provided function to convert each element to a double.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the sum of all elements in the array as a double.
- See also: Iterables#sumDouble(Iterable, ToDoubleFunction)
-
Signature:
public static <T> double sumDouble(final T[] a, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input array using the provided function to convert each element to a double.
-
Parameters:
-
a(T[]) — the array of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the sum of all elements within the specified range of the array as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumDouble(Iterable, ToDoubleFunction)
-
Signature:
public static <T extends Number> double sumDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Sums all elements within the specified range in the input collection of numbers and returns the result as a double.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed.
-
- Returns: the sum of all elements within the specified range in the collection as a double.
- See also: Iterables#sumDouble(Iterable)
-
Signature:
public static <T> double sumDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Sums all elements within the specified range in the input collection using the provided function to convert each element to a double.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be summed. -
fromIndex(int) — the starting index (inclusive) of the range to be summed. -
toIndex(int) — the ending index (exclusive) of the range to be summed. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the sum of all elements within the specified range of the collection as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#sumDouble(Iterable, ToDoubleFunction)
-
Signature:
public static <T extends Number> double sumDouble(final Iterable<? extends T> c) - Summary: Sums all elements in the given iterable of numbers and returns the result as a double.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to be summed.
-
- Returns: the sum of all elements in the iterable as a double.
- See also: Iterables#sumDouble(Iterable)
-
Signature:
public static <T> double sumDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to a double.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the sum of all elements in the iterable as a double.
- See also: Iterables#sumDouble(Iterable, ToDoubleFunction)
sumBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger sumBigInteger(final Iterable<? extends BigInteger> c) - Summary: Sums all elements in the given iterable of BigInteger and returns the result as a BigInteger.
-
Parameters:
-
c(Iterable<? extends BigInteger>) — the iterable of BigInteger elements to be summed.
-
- Returns: the sum of all elements in the iterable as a BigInteger.
- See also: Iterables#sumBigInteger(Iterable)
-
Signature:
public static <T> BigInteger sumBigInteger(final Iterable<? extends T> c, final Function<? super T, BigInteger> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to a BigInteger.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(Function<? super T, BigInteger>) — the function to convert each element to a BigInteger.
-
- Returns: the sum of all elements in the iterable as a BigInteger.
- See also: Iterables#sumBigInteger(Iterable, Function)
sumBigDecimal(...) -> BigDecimal
-
Signature:
public static BigDecimal sumBigDecimal(final Iterable<? extends BigDecimal> c) - Summary: Sums all elements in the given iterable of BigDecimal and returns the result as a BigDecimal.
-
Parameters:
-
c(Iterable<? extends BigDecimal>) — the iterable of BigDecimal elements to be summed.
-
- Returns: the sum of all elements in the iterable as a BigDecimal.
- See also: Iterables#sumBigDecimal(Iterable)
-
Signature:
public static <T> BigDecimal sumBigDecimal(final Iterable<? extends T> c, final Function<? super T, BigDecimal> func) - Summary: Sums all elements in the given iterable using the provided function to convert each element to a BigDecimal.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to be summed. -
func(Function<? super T, BigDecimal>) — the function to convert each element to a BigDecimal.
-
- Returns: the sum of all elements in the iterable as a BigDecimal.
- See also: Iterables#sumBigDecimal(Iterable, Function)
averageInt(...) -> double
-
Signature:
public static <T extends Number> double averageInt(final T[] a) - Summary: Calculates the average of the elements in the given array of numbers.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageInt(Number\[\])
-
Signature:
public static <T extends Number> double averageInt(final T[] a, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements in the given array of numbers within the specified range.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements within the specified range as a double.
- See also: Iterables#averageInt(Number\[\], int, int)
-
Signature:
public static <T> double averageInt(final T[] a, final ToIntFunction<? super T> func) - Summary: Calculates the average of the elements in the given array using the provided function to convert each element to an integer.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageInt(Object\[\], ToIntFunction)
-
Signature:
public static <T> double averageInt(final T[] a, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to an integer.
-
Parameters:
-
a(T[]) — the array to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageInt(Object\[\], int, int, ToIntFunction)
-
Signature:
public static <T extends Number> double averageInt(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements within the specified range in the input collection of numbers.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements within the specified range as a double.
- See also: Iterables#averageInt(Collection, int, int)
-
Signature:
public static <T> double averageInt(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to an integer.
-
Parameters:
-
c(Collection<? extends T>) — the collection to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageInt(Collection, int, int, ToIntFunction)
-
Signature:
public static <T extends Number> double averageInt(final Iterable<? extends T> c) - Summary: Calculates the average of the elements in the given iterable of numbers.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to calculate the average.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageInt(Iterable)
-
Signature:
public static <T> double averageInt(final Iterable<? extends T> c, final ToIntFunction<? super T> func) - Summary: Calculates the average of the elements in the given iterable using the provided function to convert each element to an integer.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to calculate the average. -
func(ToIntFunction<? super T>) — the function to convert each element to an integer.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageInt(Iterable, ToIntFunction)
averageLong(...) -> double
-
Signature:
public static <T extends Number> double averageLong(final T[] a) - Summary: Calculates the average of the elements in the given array of numbers.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageLong(Number\[\])
-
Signature:
public static <T extends Number> double averageLong(final T[] a, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements within the specified range in the input array of numbers.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements within the specified range as a double.
- See also: Iterables#averageLong(Number\[\], int, int)
-
Signature:
public static <T> double averageLong(final T[] a, final ToLongFunction<? super T> func) - Summary: Calculates the average of the elements in the given array using the provided function to convert each element to a long.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageLong(Object\[\], ToLongFunction)
-
Signature:
public static <T> double averageLong(final T[] a, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a long.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageLong(Object\[\], int, int, ToLongFunction)
-
Signature:
public static <T extends Number> double averageLong(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements in the given collection of numbers.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements in the collection as a double.
- See also: Iterables#averageLong(Collection, int, int)
-
Signature:
public static <T> double averageLong(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a long.
-
Parameters:
-
c(Collection<? extends T>) — the collection to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageLong(Collection, int, int, ToLongFunction)
-
Signature:
public static <T extends Number> double averageLong(final Iterable<? extends T> c) - Summary: Calculates the average of the elements in the given iterable of numbers.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to calculate the average.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageLong(Iterable)
-
Signature:
public static <T> double averageLong(final Iterable<? extends T> c, final ToLongFunction<? super T> func) - Summary: Calculates the average of the elements in the given iterable using the provided function to convert each element to a long.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to calculate the average. -
func(ToLongFunction<? super T>) — the function to convert each element to a long.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageLong(Iterable, ToLongFunction)
averageDouble(...) -> double
-
Signature:
public static <T extends Number> double averageDouble(final T[] a) - Summary: Calculates the average of the elements in the given array of numbers.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageDouble(Number\[\])
-
Signature:
public static <T extends Number> double averageDouble(final T[] a, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements within the specified range in the input array of numbers.
-
Parameters:
-
a(T[]) — the array of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements within the specified range as a double.
- See also: Iterables#averageDouble(Number\[\], int, int)
-
Signature:
public static <T> double averageDouble(final T[] a, final ToDoubleFunction<? super T> func) - Summary: Calculates the average of the elements in the given array using the provided function to convert each element to a double.
-
Parameters:
-
a(T[]) — the array to calculate the average. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the average of the elements in the array as a double.
- See also: Iterables#averageDouble(Object\[\], ToDoubleFunction)
-
Signature:
public static <T> double averageDouble(final T[] a, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a double.
-
Parameters:
-
a(T[]) — the array to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageDouble(Object\[\], int, int, ToDoubleFunction)
-
Signature:
public static <T extends Number> double averageDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex) - Summary: Calculates the average of the elements in the given collection of numbers.
-
Parameters:
-
c(Collection<? extends T>) — the collection of numbers to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range.
-
- Returns: the average of the elements in the collection as a double.
- See also: Iterables#averageDouble(Collection, int, int)
-
Signature:
public static <T> double averageDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Summary: Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a double.
-
Parameters:
-
c(Collection<? extends T>) — the collection to calculate the average. -
fromIndex(int) — the starting index (inclusive) of the range. -
toIndex(int) — the ending index (exclusive) of the range. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the average of the elements within the specified range as a double.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds.
-
- See also: Iterables#averageDouble(Collection, int, int, ToDoubleFunction)
-
Signature:
public static <T extends Number> double averageDouble(final Iterable<? extends T> c) - Summary: Calculates the average of the elements in the given iterable of numbers.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of numbers to calculate the average.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageDouble(Iterable)
-
Signature:
public static <T> double averageDouble(final Iterable<? extends T> c, final ToDoubleFunction<? super T> func) - Summary: Calculates the average of the elements in the given iterable using the provided function to convert each element to a double.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to calculate the average. -
func(ToDoubleFunction<? super T>) — the function to convert each element to a double.
-
- Returns: the average of the elements in the iterable as a double.
- See also: Iterables#averageDouble(Iterable, ToDoubleFunction)
averageBigInteger(...) -> BigDecimal
-
Signature:
public static BigDecimal averageBigInteger(final Iterable<? extends BigInteger> c) - Summary: Calculates the average of the elements in the given iterable of BigInteger.
-
Parameters:
-
c(Iterable<? extends BigInteger>) — the iterable of BigInteger elements to calculate the average.
-
- Returns: the average of the elements in the iterable as a BigDecimal.
- See also: Iterables#averageBigInteger(Iterable)
-
Signature:
public static <T> BigDecimal averageBigInteger(final Iterable<? extends T> c, final Function<? super T, BigInteger> func) - Summary: Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigInteger.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to calculate the average. -
func(Function<? super T, BigInteger>) — the function to convert each element to a BigInteger.
-
- Returns: the average of the elements in the iterable as a BigDecimal.
- See also: Iterables#averageBigInteger(Iterable, Function)
averageBigDecimal(...) -> BigDecimal
-
Signature:
public static BigDecimal averageBigDecimal(final Iterable<? extends BigDecimal> c) - Summary: Calculates the average of the elements in the given iterable of BigDecimal.
-
Parameters:
-
c(Iterable<? extends BigDecimal>) — the iterable of BigDecimal elements to calculate the average.
-
- Returns: the average of the elements in the iterable as a BigDecimal.
- See also: Iterables#averageBigDecimal(Iterable)
-
Signature:
public static <T> BigDecimal averageBigDecimal(final Iterable<? extends T> c, final Function<? super T, BigDecimal> func) - Summary: Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigDecimal.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of elements to calculate the average. -
func(Function<? super T, BigDecimal>) — the function to convert each element to a BigDecimal.
-
- Returns: the average of the elements in the iterable as a BigDecimal.
- See also: Iterables#averageBigDecimal(Iterable, Function)
min(...) -> char
-
Signature:
public static char min(final char a, final char b) - Summary: Returns the smaller of two char values.
-
Parameters:
-
a(char) — the first char value -
b(char) — the second char value
-
- Returns: the smaller of the two input values
- See also: #min(char, char, char), #min(char...), #max(char, char)
-
Signature:
public static byte min(final byte a, final byte b) - Summary: Returns the smaller of two byte values.
-
Parameters:
-
a(byte) — the first byte value -
b(byte) — the second byte value
-
- Returns: the smaller of the two input values
- See also: #min(byte, byte, byte), #min(byte...), #max(byte, byte)
-
Signature:
public static short min(final short a, final short b) - Summary: Returns the smaller of two short values.
-
Parameters:
-
a(short) — the first short value -
b(short) — the second short value
-
- Returns: the smaller of the two input values
- See also: #min(short, short, short), #min(short...), #max(short, short)
-
Signature:
public static int min(final int a, final int b) - Summary: Returns the smaller of two int values.
-
Parameters:
-
a(int) — the first int value -
b(int) — the second int value
-
- Returns: the smaller of the two input values
- See also: #min(int, int, int), #min(int...), #max(int, int), Math#min(int, int)
-
Signature:
public static long min(final long a, final long b) - Summary: Returns the smaller of two long values.
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value
-
- Returns: the smaller of the two input values
- See also: #min(long, long, long), #min(long...), #max(long, long), Math#min(long, long)
-
Signature:
public static float min(final float a, final float b) - Summary: Returns the smaller of two float values.
-
Contract:
- Uses {@link Math#min(float, float)} which handles NaN values according to IEEE 754: if either value is NaN, then NaN is returned.
-
Parameters:
-
a(float) — the first float value -
b(float) — the second float value
-
- Returns: the smaller of the two values; NaN if either value is NaN
- See also: #min(float, float, float), #min(float...), #max(float, float), Math#min(float, float)
-
Signature:
public static double min(final double a, final double b) - Summary: Returns the smaller of two double values.
-
Contract:
- Uses {@link Math#min(double, double)} which handles NaN values according to IEEE 754: if either value is NaN, then NaN is returned.
-
Parameters:
-
a(double) — the first double value -
b(double) — the second double value
-
- Returns: the smaller of the two values; NaN if either value is NaN
- See also: #min(double, double, double), #min(double...), #max(double, double), Math#min(double, double)
-
Signature:
public static <T extends Comparable<? super T>> T min(final T a, final T b) - Summary: Returns the smaller of two comparable values based on their natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
a(T) — the first comparable value -
b(T) — the second comparable value
-
- Returns: the smaller of the two values based on natural ordering; {@code null} if both are {@code null}
- See also: #min(Object, Object, Comparator), #max(Comparable, Comparable)
-
Signature:
public static <T> T min(final T a, final T b, final Comparator<? super T> cmp) - Summary: Returns the smaller of two values based on the specified comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare -
cmp(Comparator<? super T>) — the Comparator to compare the values; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smaller of the two values based on the comparator
- See also: #min(Comparable, Comparable), #max(Object, Object, Comparator)
-
Signature:
public static char min(final char a, final char b, final char c) - Summary: Returns the smallest of three char values.
-
Parameters:
-
a(char) — the first char value -
b(char) — the second char value -
c(char) — the third char value
-
- Returns: the smallest of the three input values.
- See also: #min(char, char), #min(char...), #max(char, char, char)
-
Signature:
public static byte min(final byte a, final byte b, final byte c) - Summary: Returns the smallest of three byte values.
-
Parameters:
-
a(byte) — the first byte value -
b(byte) — the second byte value -
c(byte) — the third byte value
-
- Returns: the smallest of the three input values.
- See also: #min(byte, byte), #min(byte...), #max(byte, byte, byte)
-
Signature:
public static short min(final short a, final short b, final short c) - Summary: Returns the smallest of three short values.
-
Parameters:
-
a(short) — the first short value -
b(short) — the second short value -
c(short) — the third short value
-
- Returns: the smallest of the three input values.
- See also: #min(short, short), #min(short...), #max(short, short, short)
-
Signature:
public static int min(final int a, final int b, final int c) - Summary: Returns the smallest of three int values.
-
Parameters:
-
a(int) — the first int value -
b(int) — the second int value -
c(int) — the third int value
-
- Returns: the smallest of the three input values.
- See also: #min(int, int), #min(int...), #max(int, int, int)
-
Signature:
public static long min(final long a, final long b, final long c) - Summary: Returns the smallest of three long values.
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value -
c(long) — the third long value
-
- Returns: the smallest of the three input values.
- See also: #min(long, long), #min(long...), #max(long, long, long)
-
Signature:
public static float min(final float a, final float b, final float c) - Summary: Returns the smallest of three float values.
-
Contract:
- Uses {@link Math#min(float, float)} which handles NaN values according to IEEE 754: if any value is NaN, then NaN is returned.
-
Parameters:
-
a(float) — the first float value -
b(float) — the second float value -
c(float) — the third float value
-
- Returns: the smallest of the three values; NaN if any value is NaN.
- See also: #min(float, float), #min(float...), #max(float, float, float), Math#min(float, float)
-
Signature:
public static double min(final double a, final double b, final double c) - Summary: Returns the smallest of three double values.
-
Contract:
- Uses {@link Math#min(double, double)} which handles NaN values according to IEEE 754: if any value is NaN, then NaN is returned.
-
Parameters:
-
a(double) — the first double value -
b(double) — the second double value -
c(double) — the third double value
-
- Returns: the smallest of the three values; NaN if any value is NaN.
- See also: #min(double, double), #min(double...), #max(double, double, double), Math#min(double, double)
-
Signature:
public static <T extends Comparable<? super T>> T min(final T a, final T b, final T c) - Summary: Returns the smallest of three comparable values based on their natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
a(T) — the first comparable value -
b(T) — the second comparable value -
c(T) — the third comparable value
-
- Returns: the smallest of the three values based on natural ordering.
- See also: #min(Comparable, Comparable), #min(Object, Object, Object, Comparator), #max(Comparable, Comparable, Comparable)
-
Signature:
public static <T> T min(final T a, final T b, final T c, final Comparator<? super T> cmp) - Summary: Returns the smallest of three values based on the specified comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
a(T) — the first value to compare -
b(T) — the second value to compare -
c(T) — the third value to compare -
cmp(Comparator<? super T>) — the Comparator to compare the values; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest of the three values based on the comparator.
- See also: #min(Object, Object, Comparator), #min(Comparable, Comparable, Comparable), #max(Object, Object, Object, Comparator)
-
Signature:
public static char min(final char... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified char array or varargs.
-
Parameters:
-
a(char[]) — the array or varargs of char values, must not be {@code null} or empty
-
- Returns: the smallest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(char\[\], int, int), #max(char...), #median(char...)
-
Signature:
public static char min(final char[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest char value within the specified range in the array.
-
Parameters:
-
a(char[]) — the array of char values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest char value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(char...), #max(char\[\], int, int)
-
Signature:
public static byte min(final byte... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified byte array or varargs.
-
Parameters:
-
a(byte[]) — the array or varargs of byte values, must not be {@code null} or empty
-
- Returns: the smallest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(byte\[\], int, int), #max(byte...)
-
Signature:
public static byte min(final byte[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest byte value within the specified range in the array.
-
Parameters:
-
a(byte[]) — the array of byte values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest byte value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(byte...), #max(byte\[\], int, int)
-
Signature:
public static short min(final short... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified short array or varargs.
-
Parameters:
-
a(short[]) — the array or varargs of short values, must not be {@code null} or empty
-
- Returns: the smallest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(short\[\], int, int), #max(short...)
-
Signature:
public static short min(final short[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest short value within the specified range in the array.
-
Parameters:
-
a(short[]) — the array of short values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest short value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(short...), #max(short\[\], int, int)
-
Signature:
public static int min(final int... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified int array or varargs.
-
Parameters:
-
a(int[]) — the array or varargs of int values, must not be {@code null} or empty
-
- Returns: the smallest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(int\[\], int, int), #max(int...), #median(int...)
-
Signature:
public static int min(final int[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest int value within the specified range in the array.
-
Parameters:
-
a(int[]) — the array of int values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest int value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(int...), #max(int\[\], int, int)
-
Signature:
public static long min(final long... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified long array or varargs.
-
Parameters:
-
a(long[]) — the array or varargs of long values, must not be {@code null} or empty
-
- Returns: the smallest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(long\[\], int, int), #max(long...)
-
Signature:
public static long min(final long[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest long value within the specified range in the array.
-
Parameters:
-
a(long[]) — the array of long values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest long value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(long...), #max(long\[\], int, int)
-
Signature:
public static float min(final float... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified float array or varargs.
-
Contract:
- NaN values are skipped; if all values are NaN, returns NaN.
-
Parameters:
-
a(float[]) — the array or varargs of float values, must not be {@code null} or empty
-
- Returns: the smallest value in the array; NaN if all values are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(float\[\], int, int), #max(float...), IEEE754rUtil#min(float\[\]),that handles NaN differently
-
Signature:
public static float min(final float[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest float value within the specified range in the array.
-
Contract:
- NaN values are skipped; if all values in the range are NaN, returns NaN.
-
Parameters:
-
a(float[]) — the array of float values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest float value within the specified range; NaN if all values in the range are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(float...), #max(float\[\], int, int), IEEE754rUtil#min(float\[\]),that handles NaN differently
-
Signature:
public static double min(final double... a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified double array or varargs.
-
Contract:
- NaN values are skipped; if all values are NaN, returns NaN.
-
Parameters:
-
a(double[]) — the array or varargs of double values, must not be {@code null} or empty
-
- Returns: the smallest value in the array; NaN if all values are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(double\[\], int, int), #max(double...), IEEE754rUtil#min(double\[\]),that handles NaN differently
-
Signature:
public static double min(final double[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest double value within the specified range in the array.
-
Contract:
- NaN values are skipped; if all values in the range are NaN, returns NaN.
-
Parameters:
-
a(double[]) — the array of double values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest double value within the specified range; NaN if all values in the range are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(double...), #max(double\[\], int, int), IEEE754rUtil#min(double\[\]),that handles NaN differently
-
Signature:
public static <T extends Comparable<? super T>> T min(final T[] a) throws IllegalArgumentException - Summary: Returns the smallest value in the specified array based on their natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty
-
- Returns: the smallest value in the array based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(Comparable\[\], int, int), #min(Object\[\], Comparator), #max(Comparable\[\]), Iterables#min(Comparable\[\])
-
Signature:
public static <T extends Comparable<? super T>> T min(final T[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest value within the specified range in the array based on their natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest value within the specified range based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(Comparable\[\]), #min(Object\[\], int, int, Comparator), #max(Comparable\[\], int, int), Iterables#min(Object\[\], Comparator)
-
Signature:
public static <T> T min(final T[] a, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the smallest value in the specified array according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest value in the array according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(Object\[\], int, int, Comparator), #max(Object\[\], Comparator), Iterables#min(Object\[\], Comparator)
-
Signature:
@MayReturnNull public static <T> T min(final T[] a, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns the smallest value within the specified range of the array according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest value within the specified range according to the comparator
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds -
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #min(Object\[\], Comparator), #max(Object\[\], int, int, Comparator), Iterables#min(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T min(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the smallest value within the specified range of the collection based on natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
c(Collection<? extends T>) — the collection of comparable values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the smallest value within the specified range based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or the range is empty
-
- See also: #min(Collection, int, int, Comparator), #max(Collection, int, int), Iterables#min(Iterable)
-
Signature:
@MayReturnNull public static <T> T min(final Collection<? extends T> c, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the smallest value within the specified range of the collection according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest value within the specified range according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or the range is empty
-
- See also: #min(Collection, int, int), #max(Collection, int, int, Comparator), Iterables#min(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T min(final Iterable<? extends T> c) throws IllegalArgumentException - Summary: Returns the smallest value in the iterable based on natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of comparable values, must not be {@code null} or empty
-
- Returns: the smallest value in the iterable based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #min(Iterable, Comparator), #max(Iterable), Iterables#min(Iterable)
-
Signature:
public static <T> T min(final Iterable<? extends T> c, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the smallest value in the iterable according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest value in the iterable according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #min(Iterable), #max(Iterable, Comparator), Iterables#min(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T min(final Iterator<? extends T> iter) throws IllegalArgumentException - Summary: Returns the smallest value from the iterator based on natural ordering.
-
Contract:
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of comparable values, must not be {@code null} or empty
-
- Returns: the smallest value from the iterator based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #min(Iterator, Comparator), #max(Iterator), Iterables#min(Iterator)
-
Signature:
@MayReturnNull public static <T> T min(final Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the smallest value from the iterator according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered maximum.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls last is used
-
- Returns: the smallest value from the iterator according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #min(Iterator), #max(Iterator, Comparator), Iterables#min(Iterator, Comparator)
minBy(...) -> T
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T minBy(final T[] a, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the minimum element from the array based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple smallest elements, the first one will be returned.
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the minimum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #min(Object\[\], Comparator), #maxBy(Object\[\], Function), Comparators#nullsLastBy(Function), Iterables#minBy(Object\[\], Function)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T minBy(final Iterable<? extends T> c, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the minimum element from the iterable based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple smallest elements, the first one will be returned.
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the minimum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #min(Iterable, Comparator), #maxBy(Iterable, Function), Comparators#nullsLastBy(Function), Iterables#minBy(Iterable, Function)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T minBy(final Iterator<? extends T> iter, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the minimum element from the iterator based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple smallest elements, the first one will be returned.
- Null values are considered to be maximum (placed last when comparing).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the minimum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #min(Iterator, Comparator), #maxBy(Iterator, Function), Comparators#nullsLastBy(Function), Iterables#minBy(Iterator, Function)
minAll(...) -> List<T>
-
Signature:
public static <T extends Comparable<? super T>> List<T> minAll(final T[] a) - Summary: Returns a list containing the smallest elements in the specified array based on their natural ordering.
-
Parameters:
-
a(T[]) — the array to fetch the smallest elements.
-
- Returns: a list containing the smallest elements in the array. If the array is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> minAll(final T[] a, Comparator<? super T> cmp) - Summary: Returns a list containing the smallest elements in the specified array according to the provided comparator.
-
Parameters:
-
a(T[]) — the array to fetch the smallest elements. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing the smallest elements in the array. If the array is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T extends Comparable<? super T>> List<T> minAll(final Iterable<? extends T> c) - Summary: Returns a list containing the smallest elements in the specified iterable based on their natural ordering.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to fetch the smallest elements.
-
- Returns: a list containing the smallest elements in the iterable. If the iterable is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> minAll(final Iterable<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns a list containing the smallest elements in the specified iterable according to the provided comparator.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to fetch the smallest elements. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing the smallest elements in the iterable. If the iterable is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T extends Comparable<? super T>> List<T> minAll(final Iterator<? extends T> iter) - Summary: Returns a list containing the smallest elements in the specified iterator based on their natural ordering.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to fetch the smallest elements.
-
- Returns: a list containing the smallest elements in the iterator. If the iterator is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> minAll(final Iterator<? extends T> iter, Comparator<? super T> cmp) - Summary: Returns a list containing the smallest elements in the specified iterator according to the provided comparator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to fetch the smallest elements. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing the smallest elements in the iterator. If the iterator is {@code null} or empty, an empty list is returned.
minOrDefaultIfEmpty(...) -> R
-
Signature:
@Beta public static <T, R extends Comparable<? super R>> R minOrDefaultIfEmpty(final T[] a, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the minimum value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the minimum value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the minimum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the array elements for comparison. -
defaultValue(R) — the default value to return if the array is {@code null} or empty.
-
- Returns: the minimum extracted value or the default value if the array is {@code null} or empty.
-
Signature:
public static <T, R extends Comparable<? super R>> R minOrDefaultIfEmpty(final Iterable<? extends T> c, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the minimum value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the minimum value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the minimum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the iterable elements for comparison. -
defaultValue(R) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the minimum extracted value or the default value if the iterable is {@code null} or empty.
-
Signature:
public static <T, R extends Comparable<? super R>> R minOrDefaultIfEmpty(final Iterator<? extends T> iter, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the minimum value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the minimum value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the minimum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the iterator elements for comparison. -
defaultValue(R) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the minimum extracted value or the default value if the iterator is {@code null} or empty.
minIntOrDefaultIfEmpty(...) -> int
-
Signature:
@Beta public static <T> int minIntOrDefaultIfEmpty(final T[] a, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the minimum integer value extracted from the array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the minimum integer value extracted from the array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the minimum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the array elements. -
defaultValue(int) — the default value to return if the array is {@code null} or empty.
-
- Returns: the minimum extracted integer value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> int minIntOrDefaultIfEmpty(final Iterable<? extends T> c, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the minimum integer value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the minimum integer value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the minimum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the iterable elements. -
defaultValue(int) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the minimum extracted integer value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> int minIntOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the minimum integer value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the minimum integer value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the minimum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the iterator elements. -
defaultValue(int) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the minimum extracted integer value or the default value if the iterator is {@code null} or empty.
minLongOrDefaultIfEmpty(...) -> long
-
Signature:
@Beta public static <T> long minLongOrDefaultIfEmpty(final T[] a, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the minimum long value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the minimum long value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the minimum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the array elements. -
defaultValue(long) — the default value to return if the array is {@code null} or empty.
-
- Returns: the minimum extracted long value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> long minLongOrDefaultIfEmpty(final Iterable<? extends T> c, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the minimum long value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the minimum long value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the minimum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the iterable elements. -
defaultValue(long) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the minimum extracted long value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> long minLongOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the minimum long value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the minimum long value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the minimum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the iterator elements. -
defaultValue(long) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the minimum extracted long value or the default value if the iterator is {@code null} or empty.
minDoubleOrDefaultIfEmpty(...) -> double
-
Signature:
@Beta public static <T> double minDoubleOrDefaultIfEmpty(final T[] a, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the minimum double value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the minimum double value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the minimum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the array elements. -
defaultValue(double) — the default value to return if the array is {@code null} or empty.
-
- Returns: the minimum extracted double value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> double minDoubleOrDefaultIfEmpty(final Iterable<? extends T> c, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the minimum double value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the minimum double value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the minimum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the iterable elements. -
defaultValue(double) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the minimum extracted double value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> double minDoubleOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the minimum double value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the minimum double value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the minimum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the iterator elements. -
defaultValue(double) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the minimum extracted double value or the default value if the iterator is {@code null} or empty.
minMax(...) -> Pair<T, T>
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, T> minMax(final T[] a) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified array based on their natural ordering.
-
Parameters:
-
a(T[]) — the array to find the minimum and maximum values from.
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array.
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty.
-
- See also: Iterables#minMax(Comparable\[\])
-
Signature:
public static <T> Pair<T, T> minMax(final T[] a, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified array according to the provided comparator.
-
Parameters:
-
a(T[]) — the array to find the minimum and maximum values from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array.
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty.
-
- See also: Iterables#minMax(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, T> minMax(final Iterable<? extends T> c) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified iterable based on their natural ordering.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to find the minimum and maximum values from.
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterable.
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty.
-
- See also: Iterables#minMax(Iterable)
-
Signature:
public static <T> Pair<T, T> minMax(@NotNull final Iterable<? extends T> c, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified iterable according to the provided comparator.
-
Parameters:
-
c(@NotNull Iterable<? extends T>) — the iterable to find the minimum and maximum values from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterable.
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty.
-
- See also: Iterables#minMax(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> Pair<T, T> minMax(final Iterator<? extends T> iter) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified iterator based on their natural ordering.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to find the minimum and maximum values from.
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterator.
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty.
-
- See also: Iterables#minMax(Iterator)
-
Signature:
public static <T> Pair<T, T> minMax(final Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns a Pair object containing the minimum and maximum values in the specified iterator according to the provided comparator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to find the minimum and maximum values from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterator.
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty.
-
- See also: Iterables#minMax(Iterator, Comparator)
max(...) -> char
-
Signature:
public static char max(final char a, final char b) - Summary: Returns the larger of two char values.
-
Parameters:
-
a(char) — the first char value -
b(char) — the second char value
-
- Returns: the larger of the two input values
- See also: #max(char, char, char), #max(char...), #min(char, char)
-
Signature:
public static byte max(final byte a, final byte b) - Summary: Returns the larger of two byte values.
-
Parameters:
-
a(byte) — the first byte value -
b(byte) — the second byte value
-
- Returns: the larger of the two input values
- See also: #max(byte, byte, byte), #max(byte...), #min(byte, byte)
-
Signature:
public static short max(final short a, final short b) - Summary: Returns the larger of two short values.
-
Parameters:
-
a(short) — the first short value -
b(short) — the second short value
-
- Returns: the larger of the two input values
- See also: #max(short, short, short), #max(short...), #min(short, short)
-
Signature:
public static int max(final int a, final int b) - Summary: Returns the larger of two int values.
-
Parameters:
-
a(int) — the first int value -
b(int) — the second int value
-
- Returns: the larger of the two input values
- See also: #max(int, int, int), #max(int...), #min(int, int), Math#max(int, int)
-
Signature:
public static long max(final long a, final long b) - Summary: Returns the larger of two long values.
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value
-
- Returns: the larger of the two input values
- See also: #max(long, long, long), #max(long...), #min(long, long), Math#max(long, long)
-
Signature:
public static float max(final float a, final float b) - Summary: Returns the larger of two float values.
-
Contract:
- Uses {@link Math#max(float, float)} which handles NaN values according to IEEE 754: if either value is NaN, then NaN is returned.
-
Parameters:
-
a(float) — the first float value -
b(float) — the second float value
-
- Returns: the larger of the two values; NaN if either value is NaN
- See also: #max(float, float, float), #max(float...), #min(float, float), Math#max(float, float)
-
Signature:
public static double max(final double a, final double b) - Summary: Returns the larger of two double values.
-
Contract:
- Uses {@link Math#max(double, double)} which handles NaN values according to IEEE 754: if either value is NaN, then NaN is returned.
-
Parameters:
-
a(double) — the first double value -
b(double) — the second double value
-
- Returns: the larger of the two values; NaN if either value is NaN
- See also: #max(double, double, double), #max(double...), #min(double, double), Math#max(double, double)
-
Signature:
public static <T extends Comparable<? super T>> T max(final T a, final T b) - Summary: Returns the larger of two comparable values based on their natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T) — the first comparable value -
b(T) — the second comparable value
-
- Returns: the larger of the two values based on natural ordering; {@code null} if both are {@code null}
- See also: #max(Object, Object, Comparator), #min(Comparable, Comparable)
-
Signature:
public static <T> T max(final T a, final T b, final Comparator<? super T> cmp) - Summary: Returns the larger of two values according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
a(T) — the first value -
b(T) — the second value -
cmp(Comparator<? super T>) — the Comparator to compare values; if {@code null} , natural ordering with nulls first is used
-
- Returns: the larger of the two values according to the comparator; {@code null} if both are {@code null}
- See also: #max(Comparable, Comparable), #min(Object, Object, Comparator)
-
Signature:
public static char max(final char a, final char b, final char c) - Summary: Returns the largest of three char values.
-
Parameters:
-
a(char) — the first char value -
b(char) — the second char value -
c(char) — the third char value
-
- Returns: the largest of the three input values
- See also: #max(char, char), #max(char...), #min(char, char, char)
-
Signature:
public static byte max(final byte a, final byte b, final byte c) - Summary: Returns the largest of three byte values.
-
Parameters:
-
a(byte) — the first byte value -
b(byte) — the second byte value -
c(byte) — the third byte value
-
- Returns: the largest of the three input values
- See also: #max(byte, byte), #max(byte...), #min(byte, byte, byte)
-
Signature:
public static short max(final short a, final short b, final short c) - Summary: Returns the largest of three short values.
-
Parameters:
-
a(short) — the first short value -
b(short) — the second short value -
c(short) — the third short value
-
- Returns: the largest of the three input values
- See also: #max(short, short), #max(short...), #min(short, short, short)
-
Signature:
public static int max(final int a, final int b, final int c) - Summary: Returns the largest of three int values.
-
Parameters:
-
a(int) — the first int value -
b(int) — the second int value -
c(int) — the third int value
-
- Returns: the largest of the three input values
- See also: #max(int, int), #max(int...), #min(int, int, int)
-
Signature:
public static long max(final long a, final long b, final long c) - Summary: Returns the largest of three long values.
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value -
c(long) — the third long value
-
- Returns: the largest of the three input values
- See also: #max(long, long), #max(long...), #min(long, long, long)
-
Signature:
public static float max(final float a, final float b, final float c) - Summary: Returns the largest of three float values.
-
Contract:
- Handles NaN values according to IEEE 754: if any value is NaN, then NaN is returned.
-
Parameters:
-
a(float) — the first float value -
b(float) — the second float value -
c(float) — the third float value
-
- Returns: the largest of the three values; NaN if any value is NaN
- See also: #max(float, float), #max(float...), #min(float, float, float)
-
Signature:
public static double max(final double a, final double b, final double c) - Summary: Returns the largest of three double values.
-
Contract:
- Handles NaN values according to IEEE 754: if any value is NaN, then NaN is returned.
-
Parameters:
-
a(double) — the first double value -
b(double) — the second double value -
c(double) — the third double value
-
- Returns: the largest of the three values; NaN if any value is NaN
- See also: #max(double, double), #max(double...), #min(double, double, double)
-
Signature:
public static <T extends Comparable<? super T>> T max(final T a, final T b, final T c) - Summary: Returns the largest of three comparable values based on their natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T) — the first comparable value -
b(T) — the second comparable value -
c(T) — the third comparable value
-
- Returns: the largest of the three values based on natural ordering
- See also: #max(Comparable, Comparable), #max(Object, Object, Object, Comparator), #min(Comparable, Comparable, Comparable)
-
Signature:
public static <T> T max(final T a, final T b, final T c, final Comparator<? super T> cmp) - Summary: Returns the largest of three values according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
a(T) — the first value -
b(T) — the second value -
c(T) — the third value -
cmp(Comparator<? super T>) — the Comparator to compare values; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest of the three values according to the comparator
- See also: #max(Comparable, Comparable, Comparable), #max(Object, Object, Comparator), #min(Object, Object, Object, Comparator)
-
Signature:
public static char max(final char... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified char array or varargs.
-
Parameters:
-
a(char[]) — the array or varargs of char values, must not be {@code null} or empty
-
- Returns: the largest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(char\[\], int, int), #min(char...), #median(char...)
-
Signature:
public static char max(final char[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value within the specified range of the char array.
-
Parameters:
-
a(char[]) — the array of char values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(char...), #min(char\[\], int, int)
-
Signature:
public static byte max(final byte... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified byte array or varargs.
-
Parameters:
-
a(byte[]) — the array or varargs of byte values, must not be {@code null} or empty
-
- Returns: the largest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(byte\[\], int, int), #min(byte...), #median(byte...)
-
Signature:
public static byte max(final byte[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value within the specified range of the byte array.
-
Parameters:
-
a(byte[]) — the array of byte values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(byte...), #min(byte\[\], int, int)
-
Signature:
public static short max(final short... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified short array or varargs.
-
Parameters:
-
a(short[]) — the array or varargs of short values, must not be {@code null} or empty
-
- Returns: the largest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(short\[\], int, int), #min(short...), #median(short...)
-
Signature:
public static short max(final short[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value within the specified range of the short array.
-
Parameters:
-
a(short[]) — the array of short values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(short...), #min(short\[\], int, int)
-
Signature:
public static int max(final int... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified int array or varargs.
-
Parameters:
-
a(int[]) — the array or varargs of int values, must not be {@code null} or empty
-
- Returns: the largest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(int\[\], int, int), #min(int...), #median(int...)
-
Signature:
public static int max(final int[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value within the specified range of the int array.
-
Parameters:
-
a(int[]) — the array of int values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(int...), #min(int\[\], int, int)
-
Signature:
public static long max(final long... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified long array or varargs.
-
Parameters:
-
a(long[]) — the array or varargs of long values, must not be {@code null} or empty
-
- Returns: the largest value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(long\[\], int, int), #min(long...), #median(long...)
-
Signature:
public static long max(final long[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value within the specified range of the long array.
-
Parameters:
-
a(long[]) — the array of long values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(long...), #min(long\[\], int, int)
-
Signature:
public static float max(final float... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified float array or varargs.
-
Contract:
- NaN values are skipped; if all values are NaN, returns NaN.
-
Parameters:
-
a(float[]) — the array or varargs of float values, must not be {@code null} or empty
-
- Returns: the largest value in the array; NaN if all values are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(float\[\], int, int), #min(float...), #median(float...), IEEE754rUtil#max(float\[\]),that handles NaN differently
-
Signature:
public static float max(final float[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value in the specified range of the float array.
-
Contract:
- NaN values are skipped; if all values in the range are NaN, returns NaN.
-
Parameters:
-
a(float[]) — the array of float values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value in the specified range; NaN if all values in the range are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(float...), #min(float\[\], int, int), IEEE754rUtil#max(float\[\]),that handles NaN differently
-
Signature:
public static double max(final double... a) throws IllegalArgumentException - Summary: Returns the largest value in the specified double array or varargs.
-
Contract:
- NaN values are skipped; if all values are NaN, returns NaN.
-
Parameters:
-
a(double[]) — the array or varargs of double values, must not be {@code null} or empty
-
- Returns: the largest value in the array; NaN if all values are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(double\[\], int, int), #min(double...), #median(double...), IEEE754rUtil#max(double\[\]),that handles NaN differently
-
Signature:
public static double max(final double[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest value in the specified range of the double array.
-
Contract:
- NaN values are skipped; if all values in the range are NaN, returns NaN.
-
Parameters:
-
a(double[]) — the array of double values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest value in the specified range; NaN if all values in the range are NaN
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(double...), #min(double\[\], int, int), IEEE754rUtil#max(double\[\]),that handles NaN differently
-
Signature:
public static <T extends Comparable<? super T>> T max(final T[] a) throws IllegalArgumentException - Summary: Returns the largest element in the array based on natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T[]) — the array of comparable values, must not be {@code null} or empty
-
- Returns: the largest element in the array based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(Comparable\[\], int, int), #max(Object\[\], Comparator), #min(Comparable\[\]), Iterables#max(Comparable\[\])
-
Signature:
public static <T extends Comparable<? super T>> T max(final T[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest element within the specified range of the array based on natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T[]) — the array of comparable values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest element within the specified range based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(Comparable\[\]), #max(Object\[\], int, int, Comparator), #min(Comparable\[\], int, int), Iterables#max(Comparable\[\])
-
Signature:
public static <T> T max(final T[] a, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the largest element in the array according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest element in the array according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(Object\[\], int, int, Comparator), #min(Object\[\], Comparator), Iterables#max(Object\[\], Comparator)
-
Signature:
@MayReturnNull public static <T> T max(final T[] a, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns the largest element within the specified range of the array according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest element within the specified range according to the comparator
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified range is out of bounds -
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty
-
- See also: #max(Object\[\], Comparator), #min(Object\[\], int, int, Comparator), Iterables#max(Object\[\], Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T max(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IllegalArgumentException - Summary: Returns the largest element within the specified range of the collection based on natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
c(Collection<? extends T>) — the collection of comparable values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the largest element within the specified range based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or the range is empty
-
- See also: #max(Collection, int, int, Comparator), #min(Collection, int, int), Iterables#max(Iterable)
-
Signature:
@MayReturnNull public static <T> T max(final Collection<? extends T> c, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the largest element within the specified range of the collection according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest element within the specified range according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or the range is empty
-
- See also: #max(Collection, int, int), #min(Collection, int, int, Comparator), Iterables#max(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T max(final Iterable<? extends T> c) throws IllegalArgumentException - Summary: Returns the largest element in the iterable based on natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of comparable values, must not be {@code null} or empty
-
- Returns: the largest element in the iterable based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #max(Iterable, Comparator), #min(Iterable), Iterables#max(Iterable)
-
Signature:
public static <T> T max(final Iterable<? extends T> c, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the largest element in the iterable according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest element in the iterable according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #max(Iterable), #min(Iterable, Comparator), Iterables#max(Iterable, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T max(final Iterator<? extends T> iter) throws IllegalArgumentException - Summary: Returns the largest element from the iterator based on natural ordering.
-
Contract:
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of comparable values, must not be {@code null} or empty
-
- Returns: the largest element from the iterator based on natural ordering
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #max(Iterator, Comparator), #min(Iterator), Iterables#max(Iterator)
-
Signature:
@MayReturnNull public static <T> T max(final Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the largest element from the iterator according to the provided comparator.
-
Contract:
- If the comparator is {@code null} , {@code null} values are considered minimum.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values, must not be {@code null} or empty -
cmp(Comparator<? super T>) — the Comparator to compare elements; if {@code null} , natural ordering with nulls first is used
-
- Returns: the largest element from the iterator according to the comparator
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #max(Iterator), #min(Iterator, Comparator), Iterables#max(Iterator, Comparator)
maxBy(...) -> T
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T maxBy(final T[] a, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the maximum element from the array based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple largest elements, the first one will be returned.
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T[]) — the array of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the maximum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #max(Object\[\], Comparator), #minBy(Object\[\], Function), Comparators#nullsFirstBy(Function), Iterables#maxBy(Object\[\], Function)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T maxBy(final Iterable<? extends T> c, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the maximum element from the iterable based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple largest elements, the first one will be returned.
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the maximum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the iterable is {@code null} or empty
-
- See also: #max(Iterable, Comparator), #minBy(Iterable, Function), Comparators#nullsFirstBy(Function), Iterables#maxBy(Iterable, Function)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T maxBy(final Iterator<? extends T> iter, final Function<? super T, ? extends Comparable> keyExtractor) throws IllegalArgumentException - Summary: Returns the maximum element from the iterator based on the key extracted by the {@code keyExtractor} function.
-
Contract:
- If there are multiple largest elements, the first one will be returned.
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values, must not be {@code null} or empty -
keyExtractor(Function<? super T, ? extends Comparable>) — the function to extract the comparable key from each element, must not be {@code null}
-
- Returns: the maximum element based on the extracted key
-
Throws:
-
java.lang.IllegalArgumentException— if the iterator is {@code null} or empty
-
- See also: #max(Iterator, Comparator), #minBy(Iterator, Function), Comparators#nullsFirstBy(Function), Iterables#maxBy(Iterator, Function)
maxAll(...) -> List<T>
-
Signature:
public static <T extends Comparable<? super T>> List<T> maxAll(final T[] a) - Summary: Returns a list containing the biggest elements in the specified array based on their natural ordering.
-
Parameters:
-
a(T[]) — the array to fetch the biggest elements.
-
- Returns: a list containing the biggest elements in the array. If the array is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> maxAll(final T[] a, Comparator<? super T> cmp) - Summary: Returns a list containing all biggest elements in the specified array according to the provided comparator.
-
Parameters:
-
a(T[]) — the array to fetch the biggest elements from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing all biggest elements in the array. If the array is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T extends Comparable<? super T>> List<T> maxAll(final Iterable<? extends T> c) - Summary: Returns a list containing the biggest elements in the specified iterable based on their natural ordering.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to fetch the biggest elements.
-
- Returns: a list containing the biggest elements in the iterable. If the iterable is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> maxAll(final Iterable<? extends T> c, final Comparator<? super T> cmp) - Summary: Returns a list containing all biggest elements in the specified iterable according to the provided comparator.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to fetch the biggest elements from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing all biggest elements in the iterable. If the iterable is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T extends Comparable<? super T>> List<T> maxAll(final Iterator<? extends T> iter) - Summary: Returns a list containing the biggest elements in the specified iterator based on their natural ordering.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to fetch the biggest elements.
-
- Returns: a list containing the biggest elements in the iterator. If the iterator is {@code null} or empty, an empty list is returned.
-
Signature:
public static <T> List<T> maxAll(final Iterator<? extends T> iter, Comparator<? super T> cmp) - Summary: Returns a list containing all biggest elements in the specified iterator according to the provided comparator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to fetch the biggest elements from. -
cmp(Comparator<? super T>) — the comparator to be used to compare the elements
-
- Returns: a list containing all biggest elements in the iterator. If the iterator is {@code null} or empty, an empty list is returned.
maxOrDefaultIfEmpty(...) -> R
-
Signature:
@Beta public static <T, R extends Comparable<? super R>> R maxOrDefaultIfEmpty(final T[] a, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the maximum value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the maximum value extracted from the specified array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the maximum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the array elements for comparison. -
defaultValue(R) — the default value to return if the array is {@code null} or empty.
-
- Returns: the maximum extracted value or the default value if the array is {@code null} or empty.
-
Signature:
public static <T, R extends Comparable<? super R>> R maxOrDefaultIfEmpty(final Iterable<? extends T> c, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the maximum value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the maximum value extracted from the specified iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the maximum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the iterable elements for comparison. -
defaultValue(R) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the maximum extracted value or the default value if the iterable is {@code null} or empty.
-
Signature:
public static <T, R extends Comparable<? super R>> R maxOrDefaultIfEmpty(final Iterator<? extends T> iter, final Function<? super T, ? extends R> valueExtractor, final R defaultValue) - Summary: Returns the maximum value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the maximum value extracted from the specified iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the maximum value from. -
valueExtractor(Function<? super T, ? extends R>) — the function to extract values from the iterator elements for comparison. -
defaultValue(R) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the maximum extracted value or the default value if the iterator is {@code null} or empty.
maxIntOrDefaultIfEmpty(...) -> int
-
Signature:
@Beta public static <T> int maxIntOrDefaultIfEmpty(final T[] a, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the maximum integer value extracted from the array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the maximum integer value extracted from the array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the maximum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the array elements. -
defaultValue(int) — the default value to return if the array is {@code null} or empty.
-
- Returns: the maximum extracted integer value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> int maxIntOrDefaultIfEmpty(final Iterable<? extends T> c, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the maximum integer value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the maximum integer value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the maximum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the iterable elements. -
defaultValue(int) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the maximum extracted integer value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> int maxIntOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToIntFunction<? super T> valueExtractor, final int defaultValue) - Summary: Returns the maximum integer value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the maximum integer value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the maximum integer from. -
valueExtractor(ToIntFunction<? super T>) — the function to extract integer values from the iterator elements. -
defaultValue(int) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the maximum extracted integer value or the default value if the iterator is {@code null} or empty.
maxLongOrDefaultIfEmpty(...) -> long
-
Signature:
@Beta public static <T> long maxLongOrDefaultIfEmpty(final T[] a, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the maximum long value extracted from the array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the maximum long value extracted from the array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the maximum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the array elements. -
defaultValue(long) — the default value to return if the array is {@code null} or empty.
-
- Returns: the maximum extracted long value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> long maxLongOrDefaultIfEmpty(final Iterable<? extends T> c, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the maximum long value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the maximum long value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the maximum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the iterable elements. -
defaultValue(long) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the maximum extracted long value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> long maxLongOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToLongFunction<? super T> valueExtractor, final long defaultValue) - Summary: Returns the maximum long value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the maximum long value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the maximum long from. -
valueExtractor(ToLongFunction<? super T>) — the function to extract long values from the iterator elements. -
defaultValue(long) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the maximum extracted long value or the default value if the iterator is {@code null} or empty.
maxDoubleOrDefaultIfEmpty(...) -> double
-
Signature:
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(final T[] a, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the maximum double value extracted from the array or a default value if the array is {@code null} or empty.
-
Contract:
- Returns the maximum double value extracted from the array or a default value if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to extract the maximum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the array elements. -
defaultValue(double) — the default value to return if the array is {@code null} or empty.
-
- Returns: the maximum extracted double value or the default value if the array is {@code null} or empty.
-
Signature:
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(final Iterable<? extends T> c, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the maximum double value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Contract:
- Returns the maximum double value extracted from the iterable or a default value if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to extract the maximum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the iterable elements. -
defaultValue(double) — the default value to return if the iterable is {@code null} or empty.
-
- Returns: the maximum extracted double value or the default value if the iterable is {@code null} or empty.
-
Signature:
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(final Iterator<? extends T> iter, final ToDoubleFunction<? super T> valueExtractor, final double defaultValue) - Summary: Returns the maximum double value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Contract:
- Returns the maximum double value extracted from the iterator or a default value if the iterator is {@code null} or empty.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to extract the maximum double from. -
valueExtractor(ToDoubleFunction<? super T>) — the function to extract double values from the iterator elements. -
defaultValue(double) — the default value to return if the iterator is {@code null} or empty.
-
- Returns: the maximum extracted double value or the default value if the iterator is {@code null} or empty.
median(...) -> char
-
Signature:
public static char median(final char a, final char b, final char c) - Summary: Returns the median of three char values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(char) — the first char value -
b(char) — the second char value -
c(char) — the third char value
-
- Returns: the median of the three values
- See also: #median(char...), #min(char, char, char), #max(char, char, char)
-
Signature:
public static byte median(final byte a, final byte b, final byte c) - Summary: Returns the median of three byte values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(byte) — the first byte value -
b(byte) — the second byte value -
c(byte) — the third byte value
-
- Returns: the median of the three values
- See also: #median(byte...), #min(byte, byte, byte), #max(byte, byte, byte)
-
Signature:
public static short median(final short a, final short b, final short c) - Summary: Returns the median of three short values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(short) — the first short value -
b(short) — the second short value -
c(short) — the third short value
-
- Returns: the median of the three values
- See also: #median(short...), #min(short, short, short), #max(short, short, short)
-
Signature:
public static int median(final int a, final int b, final int c) - Summary: Returns the median of three int values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(int) — the first int value -
b(int) — the second int value -
c(int) — the third int value
-
- Returns: the median of the three values
- See also: #median(int...), #min(int, int, int), #max(int, int, int)
-
Signature:
public static long median(final long a, final long b, final long c) - Summary: Returns the median of three long values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value -
c(long) — the third long value
-
- Returns: the median of the three values
- See also: #median(long...), #min(long, long, long), #max(long, long, long)
-
Signature:
public static float median(final float a, final float b, final float c) - Summary: Returns the median of three float values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(float) — the first float value -
b(float) — the second float value -
c(float) — the third float value
-
- Returns: the median of the three values
- See also: #median(float...), #min(float, float, float), #max(float, float, float)
-
Signature:
public static double median(final double a, final double b, final double c) - Summary: Returns the median of three double values.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(double) — the first double value -
b(double) — the second double value -
c(double) — the third double value
-
- Returns: the median of the three values
- See also: #median(double...), #min(double, double, double), #max(double, double, double)
-
Signature:
public static <T extends Comparable<? super T>> T median(final T a, final T b, final T c) - Summary: Returns the median of three comparable values based on their natural ordering.
-
Contract:
- The median is the middle value when sorted in ascending order.
- Null values are considered to be minimum (placed first when comparing).
-
Parameters:
-
a(T) — the first value -
b(T) — the second value -
c(T) — the third value
-
- Returns: the median of the three values
- See also: #median(Comparable\[\]), #median(Object, Object, Object, Comparator), #min(Comparable, Comparable, Comparable), #max(Comparable, Comparable, Comparable)
-
Signature:
public static <T> T median(final T a, final T b, final T c, Comparator<? super T> cmp) - Summary: Returns the median of three values according to the provided comparator.
-
Contract:
- The median is the middle value when sorted by the comparator.
-
Parameters:
-
a(T) — the first value -
b(T) — the second value -
c(T) — the third value -
cmp(Comparator<? super T>) — the Comparator to compare values; if {@code null} , natural ordering is used
-
- Returns: the median of the three values
- See also: #median(Comparable, Comparable, Comparable), #median(Object\[\], Comparator)
-
Signature:
public static char median(final char... a) throws IllegalArgumentException - Summary: Returns the median value in the specified char array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(char[]) — the array or varargs of char values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(char\[\], int, int), #median(char, char, char), Median#of(char\[\])
-
Signature:
public static char median(final char[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the char array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(char[]) — the array of char values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(char...), Median#of(char\[\], int, int)
-
Signature:
public static byte median(final byte... a) throws IllegalArgumentException - Summary: Returns the median value in the specified byte array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(byte[]) — the array or varargs of byte values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(byte\[\], int, int), #median(byte, byte, byte), Median#of(byte\[\])
-
Signature:
public static byte median(final byte[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the byte array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(byte[]) — the array of byte values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(byte...), Median#of(byte\[\], int, int)
-
Signature:
public static short median(final short... a) throws IllegalArgumentException - Summary: Returns the median value in the specified short array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(short[]) — the array or varargs of short values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(short\[\], int, int), #median(short, short, short), Median#of(short\[\])
-
Signature:
public static short median(final short[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the short array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(short[]) — the array of short values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(short...), Median#of(short\[\], int, int)
-
Signature:
public static int median(final int... a) throws IllegalArgumentException - Summary: Returns the median value in the specified int array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(int[]) — the array or varargs of int values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(int\[\], int, int), #median(int, int, int), Median#of(int\[\])
-
Signature:
public static int median(final int[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the int array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(int[]) — the array of int values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(int...), Median#of(int\[\], int, int)
-
Signature:
public static long median(final long... a) throws IllegalArgumentException - Summary: Returns the median value in the specified long array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(long[]) — the array or varargs of long values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(long\[\], int, int), #median(long, long, long), Median#of(long\[\])
-
Signature:
public static long median(final long[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the long array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(long[]) — the array of long values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(long...), Median#of(long\[\], int, int)
-
Signature:
public static float median(final float... a) throws IllegalArgumentException - Summary: Returns the median value in the specified float array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(float[]) — the array or varargs of float values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(float\[\], int, int), #median(float, float, float), Median#of(float\[\])
-
Signature:
public static float median(final float[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the float array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(float[]) — the array of float values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(float...), Median#of(float\[\], int, int)
-
Signature:
public static double median(final double... a) throws IllegalArgumentException - Summary: Returns the median value in the specified double array or varargs.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(double[]) — the array or varargs of double values, must not be {@code null} or empty
-
- Returns: the median value in the array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(double\[\], int, int), #median(double, double, double), Median#of(double\[\])
-
Signature:
public static double median(final double[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value within the specified range of the double array.
-
Contract:
- The median is the middle value when sorted in ascending order.
-
Parameters:
-
a(double[]) — the array of double values, must not be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: the median value within the specified range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or the range is empty -
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #median(double...), Median#of(double\[\], int, int)
-
Signature:
public static <T extends Comparable<? super T>> T median(final T[] a) throws IllegalArgumentException - Summary: Returns the median value of all elements in the specified array.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
a(T[]) — the array of values to find the median of
-
- Returns: the median in the specified array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(int\[\]), Median#of(Comparable\[\])
-
Signature:
public static <T extends Comparable<? super T>> T median(final T[] a, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of the specified array.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
a(T[]) — the array of values to find the median of -
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: the median within the specified range in the input array
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array or range is {@code null} or empty -
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
- See also: #median(int\[\]), Median#of(Comparable\[\], int, int)
-
Signature:
public static <T> T median(final T[] a, final Comparator<? super T> cmp) throws IllegalArgumentException - Summary: Returns the median value of all elements in the specified array.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
a(T[]) — the array of values to find the median of -
cmp(Comparator<? super T>) — the comparator to determine the order of the values
-
- Returns: the median in the specified array
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} or empty
-
- See also: #median(int\[\]), Iterables#median(Collection, Comparator), Median#of(Comparable\[\]), Median#of(Comparable\[\], int, int), Median#of(Object\[\], Comparator), Median#of(Object\[\], int, int, Comparator)
-
Signature:
public static <T> T median(final T[] a, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of the specified array.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
a(T[]) — the array of values to find the median of -
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for -
cmp(Comparator<? super T>) — the comparator to determine the order of the values
-
- Returns: the median within the specified range in the input array
-
Throws:
-
java.lang.IllegalArgumentException— if the specified array or range is {@code null} or empty -
java.lang.IndexOutOfBoundsException— if the range is out of the array bounds
-
- See also: #median(int\[\]), Median#of(Comparable\[\]), Median#of(Comparable\[\], int, int), Median#of(Object\[\], Comparator), Median#of(Object\[\], int, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T median(final Collection<? extends T> c) throws IllegalArgumentException - Summary: Returns the median value of all elements in the specified collection.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of
-
- Returns: the median in the specified collection
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} or empty
-
- See also: #median(int\[\]), Median#of(Collection), Median#of(Collection, int, int), Median#of(Collection, Comparator), Median#of(Collection, int, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T median(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of the specified collection.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of -
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: the median within the specified range in the input array
-
Throws:
-
java.lang.IllegalArgumentException— if the specified collection or range is {@code null} or empty -
java.lang.IndexOutOfBoundsException— if the range is out of the collection bounds
-
- See also: #median(int\[\]), Median#of(Collection), Median#of(Collection, int, int), Median#of(Collection, Comparator), Median#of(Collection, int, int, Comparator)
-
Signature:
public static <T> T median(final Collection<? extends T> c, final Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException - Summary: Returns the median value of all elements in the specified collection.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of -
cmp(Comparator<? super T>) — the comparator to determine the order of the values
-
- Returns: the median in the specified collection
-
Throws:
-
java.lang.IndexOutOfBoundsException— if an index is out of bounds -
java.lang.IllegalArgumentException— if the collection is {@code null} or empty
-
- See also: #median(int\[\]), Iterables#median(Collection, Comparator), Median#of(Collection), Median#of(Collection, int, int), Median#of(Collection, Comparator), Median#of(Collection, int, int, Comparator)
-
Signature:
public static <T> T median(final Collection<? extends T> c, final int fromIndex, final int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of the specified collection.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values to find the median of -
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for -
cmp(Comparator<? super T>) — the comparator to determine the order of the values
-
- Returns: the median within the specified range in the input array
-
Throws:
-
java.lang.IllegalArgumentException— if the specified collection or range is {@code null} or empty -
java.lang.IndexOutOfBoundsException— if the range is out of the collection bounds
-
- See also: #median(int\[\]), Iterables#median(Collection, Comparator), Median#of(Collection), Median#of(Collection, int, int), Median#of(Collection, Comparator), Median#of(Collection, int, int, Comparator)
kthLargest(...) -> char
-
Signature:
public static char kthLargest(final char[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(char[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(char\[\], int, int, int)
-
Signature:
public static char kthLargest(final char[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(char[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(char\[\], int)
-
Signature:
public static byte kthLargest(final byte[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(byte[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(byte\[\], int, int, int)
-
Signature:
public static byte kthLargest(final byte[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(byte[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(byte\[\], int)
-
Signature:
public static short kthLargest(final short[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(short[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(short\[\], int, int, int)
-
Signature:
public static short kthLargest(final short[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(short\[\], int)
-
Signature:
public static int kthLargest(final int[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(int[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(int\[\], int, int, int)
-
Signature:
public static int kthLargest(final int[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(int\[\], int)
-
Signature:
public static long kthLargest(final long[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(long[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(long\[\], int, int, int)
-
Signature:
public static long kthLargest(final long[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(long\[\], int)
-
Signature:
public static float kthLargest(final float[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(float[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(float\[\], int, int, int)
-
Signature:
public static float kthLargest(final float[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(float\[\], int)
-
Signature:
public static double kthLargest(final double[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(double[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(double\[\], int, int, int)
-
Signature:
public static double kthLargest(final double[] a, final int fromIndex, final int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(double\[\], int)
-
Signature:
public static <T extends Comparable<? super T>> T kthLargest(final T[] a, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the array (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(T[]) — the array -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\]
-
- See also: #kthLargest(Comparable\[\], int, int, int)
-
Signature:
public static <T extends Comparable<? super T>> T kthLargest(final T[] a, final int fromIndex, final int toIndex, final int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(Comparable\[\], int)
-
Signature:
public static <T> T kthLargest(final T[] a, final int k, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element in the array using the provided comparator (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(T[]) — the array -
k(int) — the position (1-based) of the largest element to find -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, array.length\] -
java.lang.IndexOutOfBoundsException
-
- See also: #kthLargest(Object\[\], int, int, int, Comparator)
-
Signature:
public static <T> T kthLargest(final T[] a, final int fromIndex, final int toIndex, int k, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range using the provided comparator (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the array is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(Object\[\], int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> T kthLargest(final Collection<? extends T> c, final int k) throws IllegalArgumentException - Summary: Returns the k-th largest element in the collection (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} /empty or k is out of range \[1, collection.size()\]
-
- See also: #kthLargest(Collection, int, int, int)
-
Signature:
public static <T extends Comparable<? super T>> T kthLargest(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int k) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(Collection, int)
-
Signature:
public static <T> T kthLargest(final Collection<? extends T> c, final int k, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element in the collection using the provided comparator (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
k(int) — the position (1-based) of the largest element to find -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: the k-th largest element
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} /empty or k is out of range \[1, collection.size()\] -
java.lang.IndexOutOfBoundsException
-
- See also: #kthLargest(Collection, int, int, int, Comparator)
-
Signature:
public static <T> T kthLargest(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int k, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the k-th largest element within the specified range using the provided comparator (k=1 returns the largest, k=2 the second largest, etc).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
k(int) — the position (1-based) of the largest element to find -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: the k-th largest element within the range
-
Throws:
-
java.lang.IllegalArgumentException— if the collection is {@code null} /empty or k is out of range \[1, range length\] -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #kthLargest(Collection, int, Comparator)
top(...) -> short\[\]
-
Signature:
public static short[] top(final short[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed).
-
Parameters:
-
a(short[]) — the array -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(short\[\], int, Comparator)
-
Signature:
public static short[] top(final short[] a, final int n, final Comparator<? super Short> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(short[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super Short>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(short\[\], int, int, int, Comparator)
-
Signature:
public static short[] top(final short[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed).
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(short\[\], int, int, int, Comparator)
-
Signature:
public static short[] top(final short[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super Short> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super Short>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(short\[\], int, Comparator)
-
Signature:
public static int[] top(final int[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed).
-
Parameters:
-
a(int[]) — the array -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(int\[\], int, Comparator)
-
Signature:
public static int[] top(final int[] a, final int n, final Comparator<? super Integer> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(int[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super Integer>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(int\[\], int, int, int, Comparator)
-
Signature:
public static int[] top(final int[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed).
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(int\[\], int, int, int, Comparator)
-
Signature:
public static int[] top(final int[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super Integer> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super Integer>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(int\[\], int, Comparator)
-
Signature:
public static long[] top(final long[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed).
-
Parameters:
-
a(long[]) — the array -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(long\[\], int, Comparator)
-
Signature:
public static long[] top(final long[] a, final int n, final Comparator<? super Long> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(long[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super Long>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(long\[\], int, int, int, Comparator)
-
Signature:
public static long[] top(final long[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed).
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(long\[\], int, int, int, Comparator)
-
Signature:
public static long[] top(final long[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super Long> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super Long>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(long\[\], int, Comparator)
-
Signature:
public static float[] top(final float[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed).
-
Parameters:
-
a(float[]) — the array -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(float\[\], int, Comparator)
-
Signature:
public static float[] top(final float[] a, final int n, final Comparator<? super Float> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(float[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super Float>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(float\[\], int, int, int, Comparator)
-
Signature:
public static float[] top(final float[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed).
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(float\[\], int, int, int, Comparator)
-
Signature:
public static float[] top(final float[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super Float> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super Float>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(float\[\], int, Comparator)
-
Signature:
public static double[] top(final double[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed).
-
Parameters:
-
a(double[]) — the array -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(double\[\], int, Comparator)
-
Signature:
public static double[] top(final double[] a, final int n, final Comparator<? super Double> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(double[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super Double>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements (empty if array is {@code null} /empty or n is 0)
- See also: #top(double\[\], int, int, int, Comparator)
-
Signature:
public static double[] top(final double[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed).
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: an array containing the top n largest elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(double\[\], int, int, int, Comparator)
-
Signature:
public static double[] top(final double[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super Double> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super Double>) — the comparator to determine ordering ( {@code null} for natural order)
-
- Returns: an array containing the top n elements from the range (empty if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(double\[\], int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final T[] a, final int n) - Summary: Returns the top n largest elements from the array (order not guaranteed, {@code null} values treated as smallest).
-
Parameters:
-
a(T[]) — the array -
n(int) — the number of top elements to return
-
- Returns: a list containing the top n largest elements (empty list if array is {@code null} /empty or n is 0)
- See also: #top(Object\[\], int, Comparator)
-
Signature:
public static <T> List<T> top(final T[] a, final int n, final Comparator<? super T> cmp) - Summary: Returns the top n largest elements from the array using the provided comparator (order not guaranteed).
-
Parameters:
-
a(T[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: a list containing the top n elements (empty list if array is {@code null} /empty or n is 0)
- See also: #top(Object\[\], int, int, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final T[] a, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed, {@code null} values treated as smallest).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: a list containing the top n elements from the range (empty list if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Comparable\[\], int)
-
Signature:
public static <T> List<T> top(final T[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: a list containing the top n elements from the range (empty list if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Object\[\], int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final Collection<? extends T> c, final int n) - Summary: Returns the top n largest elements from the collection (order not guaranteed, {@code null} values treated as smallest).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
n(int) — the number of top elements to return
-
- Returns: a list containing the top n largest elements (empty list if collection is {@code null} /empty or n is 0)
- See also: #top(Collection, int, Comparator)
-
Signature:
public static <T> List<T> top(final Collection<? extends T> c, final int n, final Comparator<? super T> cmp) - Summary: Returns the top n largest elements from the collection using the provided comparator (order not guaranteed).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: a list containing the top n elements (empty list if collection is {@code null} /empty or n is 0)
- See also: #top(Collection, int, int, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int n) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (order not guaranteed, {@code null} values treated as smallest).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return
-
- Returns: a list containing the top n elements from the range (empty list if collection is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Collection, int)
-
Signature:
@SuppressWarnings("deprecation") public static <T> List<T> top(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int n, final Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (order not guaranteed).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering
-
- Returns: a list containing the top n elements from the range (empty list if collection is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Collection, int, Comparator)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final T[] a, final int n, final boolean keepEncounterOrder) - Summary: Returns the top n largest elements from the array (encounter order optionally preserved, {@code null} values treated as smallest).
-
Parameters:
-
a(T[]) — the array -
n(int) — the number of top elements to return -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n largest elements (empty list if array is {@code null} /empty or n is 0)
- See also: #top(Object\[\], int, Comparator, boolean)
-
Signature:
public static <T> List<T> top(final T[] a, final int n, final Comparator<? super T> cmp, final boolean keepEncounterOrder) - Summary: Returns the top n largest elements from the array using the provided comparator (encounter order optionally preserved).
-
Parameters:
-
a(T[]) — the array -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements (empty list if array is {@code null} /empty or n is 0)
- See also: #top(Object\[\], int, int, int, Comparator, boolean)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final T[] a, final int fromIndex, final int toIndex, final int n, final boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (encounter order optionally preserved, {@code null} values treated as smallest).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements from the range (empty list if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Comparable\[\], int, boolean)
-
Signature:
public static <T> List<T> top(final T[] a, final int fromIndex, final int toIndex, final int n, final Comparator<? super T> cmp, final boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (encounter order optionally preserved).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements from the range (empty list if array is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Object\[\], int, Comparator, boolean)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final Collection<? extends T> c, final int n, final boolean keepEncounterOrder) - Summary: Returns the top n largest elements from the collection (encounter order optionally preserved, {@code null} values treated as smallest).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
n(int) — the number of top elements to return -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n largest elements (empty list if collection is {@code null} /empty or n is 0)
- See also: #top(Collection, int, Comparator, boolean)
-
Signature:
public static <T> List<T> top(final Collection<? extends T> c, final int n, final Comparator<? super T> cmp, final boolean keepEncounterOrder) - Summary: Returns the top n largest elements from the collection using the provided comparator (encounter order optionally preserved).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements (empty list if collection is {@code null} /empty or n is 0)
- See also: #top(Collection, int, int, int, Comparator, boolean)
-
Signature:
public static <T extends Comparable<? super T>> List<T> top(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int n, final boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range (encounter order optionally preserved, {@code null} values treated as smallest).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements from the range (empty list if collection is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Collection, int, boolean)
-
Signature:
public static <T> List<T> top(final Collection<? extends T> c, final int fromIndex, final int toIndex, final int n, final Comparator<? super T> cmp, final boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Returns the top n largest elements from the specified range using the provided comparator (encounter order optionally preserved).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
n(int) — the number of top elements to return -
cmp(Comparator<? super T>) — the comparator to determine ordering -
keepEncounterOrder(boolean) — if {@code true} , preserves encounter order; otherwise order not guaranteed
-
- Returns: a list containing the top n elements from the range (empty list if collection is {@code null} /empty or n is 0)
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative -
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #top(Collection, int, Comparator, boolean)
percentilesOfSorted(...) -> Map<Percentage, Character>
-
Signature:
public static Map<Percentage, Character> percentilesOfSorted(final char[] sortedArray) throws IllegalArgumentException - Summary: Returns a map containing the percentile values from the predefined {@link Percentage} enum (0.0001%, 0.001%, 0.01%, 0.1%, 1%-99%, 99.9%, 99.99%, 99.999%, 99.9999%) calculated from the provided sorted array of characters.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(char\[\])} if needed.
-
Parameters:
-
sortedArray(char[]) — the sorted array of characters for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding characters from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), Percentage
-
Signature:
public static Map<Percentage, Byte> percentilesOfSorted(final byte[] sortedArray) throws IllegalArgumentException - Summary: Returns a map containing the percentile values from the predefined {@link Percentage} enum (0.0001%, 0.001%, 0.01%, 0.1%, 1%-99%, 99.9%, 99.99%, 99.999%, 99.9999%) calculated from the provided sorted array of bytes.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(byte\[\])} if needed.
-
Parameters:
-
sortedArray(byte[]) — the sorted array of bytes for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding bytes from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), Percentage
-
Signature:
public static Map<Percentage, Short> percentilesOfSorted(final short[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array of shorts.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(short\[\])} if needed.
-
Parameters:
-
sortedArray(short[]) — the sorted array of shorts for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding shorts from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), Percentage
-
Signature:
public static Map<Percentage, Integer> percentilesOfSorted(final int[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array of integers.
-
Parameters:
-
sortedArray(int[]) — the sorted array of integers for which to calculate the percentiles.
-
- Returns: a map where the keys are the percentiles and the values are the corresponding integers from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is empty.
-
-
Signature:
public static Map<Percentage, Long> percentilesOfSorted(final long[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array of longs.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(long\[\])} if needed.
-
Parameters:
-
sortedArray(long[]) — the sorted array of longs for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding longs from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), Percentage
-
Signature:
public static Map<Percentage, Float> percentilesOfSorted(final float[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array of floats.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(float\[\])} if needed.
-
Parameters:
-
sortedArray(float[]) — the sorted array of floats for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding floats from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), #percentilesOfSorted(double\[\]), Percentage
-
Signature:
public static Map<Percentage, Double> percentilesOfSorted(final double[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array of doubles.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order for accurate results.
- Use {@link java.util.Arrays#sort(double\[\])} if needed.
-
Parameters:
-
sortedArray(double[]) — the sorted array of doubles for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding doubles from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), #percentilesOfSorted(float\[\]), Percentage
-
Signature:
public static <T> Map<Percentage, T> percentilesOfSorted(final T[] sortedArray) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted array.
-
Contract:
- <p> <b> Important: </b> The input array must be sorted in ascending order according to the natural ordering of its elements (or custom comparator used during sorting).
- Use {@link java.util.Arrays#sort(Object\[\])} if elements implement {@link Comparable} .
-
Parameters:
-
sortedArray(T[]) — the sorted array for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding elements from the array.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided array is {@code null} or empty
-
- See also: #percentilesOfSorted(int\[\]), #percentilesOfSorted(List), Percentage
-
Signature:
public static <T> Map<Percentage, T> percentilesOfSorted(final List<T> sortedList) throws IllegalArgumentException - Summary: Calculates the percentiles of the provided sorted list.
-
Contract:
- <p> <b> Important: </b> The input list must be sorted in ascending order according to the natural ordering of its elements (or custom comparator used during sorting).
- Use {@link java.util.Collections#sort(List)} if elements implement {@link Comparable} .
-
Parameters:
-
sortedList(List<T>) — the sorted list for which to calculate the percentiles
-
- Returns: a map where the keys are the percentiles and the values are the corresponding elements from the list.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided list is {@code null} or empty
-
- Performance: For optimal performance, use list implementations with O(1) random access like {@link java.util.ArrayList} .
- See also: #percentilesOfSorted(int\[\]), #percentilesOfSorted(Object\[\]), Percentage
filter(...) -> boolean\[\]
-
Signature:
public static boolean[] filter(final boolean[] a, final BooleanPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(boolean[]) — the array -
filter(BooleanPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(boolean\[\], int, int, BooleanPredicate)
-
Signature:
public static boolean[] filter(final boolean[] a, final int fromIndex, final int toIndex, final BooleanPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(boolean[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
filter(BooleanPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #filter(boolean\[\], BooleanPredicate)
-
Signature:
public static char[] filter(final char[] a, final CharPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(char[]) — the array -
filter(CharPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(char\[\], int, int, CharPredicate)
-
Signature:
public static char[] filter(final char[] a, final int fromIndex, final int toIndex, final CharPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(char[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
filter(CharPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #filter(char\[\], CharPredicate)
-
Signature:
public static byte[] filter(final byte[] a, final BytePredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(byte[]) — the array -
filter(BytePredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(byte\[\], int, int, BytePredicate)
-
Signature:
public static byte[] filter(final byte[] a, final int fromIndex, final int toIndex, final BytePredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(byte[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
filter(BytePredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #filter(byte\[\], BytePredicate)
-
Signature:
public static short[] filter(final short[] a, final ShortPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(short[]) — the array -
filter(ShortPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(short\[\], int, int, ShortPredicate)
-
Signature:
public static short[] filter(final short[] a, final int fromIndex, final int toIndex, final ShortPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
filter(ShortPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #filter(short\[\], ShortPredicate)
-
Signature:
public static int[] filter(final int[] a, final IntPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(int[]) — the array -
filter(IntPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(int\[\], int, int, IntPredicate)
-
Signature:
public static int[] filter(final int[] a, final int fromIndex, final int toIndex, final IntPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
filter(IntPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #filter(int\[\], IntPredicate)
-
Signature:
public static long[] filter(final long[] a, final LongPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(long[]) — the array -
filter(LongPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(long\[\], int, int, LongPredicate)
-
Signature:
public static long[] filter(final long[] a, final int fromIndex, final int toIndex, final LongPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(LongPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(long\[\], LongPredicate)
-
Signature:
public static float[] filter(final float[] a, final FloatPredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(float[]) — the array -
filter(FloatPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(float\[\], int, int, FloatPredicate)
-
Signature:
public static float[] filter(final float[] a, final int fromIndex, final int toIndex, final FloatPredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(FloatPredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(float\[\], FloatPredicate)
-
Signature:
public static double[] filter(final double[] a, final DoublePredicate filter) - Summary: Returns a new array containing only elements that match the given predicate.
-
Parameters:
-
a(double[]) — the array -
filter(DoublePredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(double\[\], int, int, DoublePredicate)
-
Signature:
public static double[] filter(final double[] a, final int fromIndex, final int toIndex, final DoublePredicate filter) throws IndexOutOfBoundsException - Summary: Returns a new array containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(DoublePredicate) — the predicate to test each element
-
- Returns: a new array containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(double\[\], DoublePredicate)
-
Signature:
public static <T> List<T> filter(final T[] a, final Predicate<? super T> filter) - Summary: Returns a new list containing only elements that match the given predicate.
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing matching elements (empty if array is {@code null} /empty)
- See also: #filter(Object\[\], int, int, Predicate)
-
Signature:
public static <T, C extends Collection<T>> C filter(final T[] a, final Predicate<? super T> filter, final IntFunction<C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing only elements that match the given predicate (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element -
supplier(IntFunction<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing matching elements (empty if array is {@code null} /empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException
-
- See also: #filter(Object\[\], int, int, Predicate, IntFunction)
-
Signature:
public static <T> List<T> filter(final T[] a, final int fromIndex, final int toIndex, final Predicate<? super T> filter) throws IndexOutOfBoundsException - Summary: Returns a new list containing only elements within the specified range that match the given predicate.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(Object\[\], Predicate)
-
Signature:
public static <T, C extends Collection<T>> C filter(final T[] a, final int fromIndex, final int toIndex, final Predicate<? super T> filter, final IntFunction<C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing only elements within the specified range that match the given predicate (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element -
supplier(IntFunction<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(Object\[\], Predicate, IntFunction)
-
Signature:
public static <T> List<T> filter(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Predicate<? super T> filter) throws IndexOutOfBoundsException - Summary: Returns a new list containing only elements within the specified range that match the given predicate.
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(Collection, int, int, Predicate, IntFunction)
-
Signature:
public static <T, C extends Collection<T>> C filter(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Predicate<? super T> filter, final IntFunction<C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing only elements within the specified range that match the given predicate (collection created by the provided supplier).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element -
supplier(IntFunction<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing matching elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #filter(Collection, int, int, Predicate)
-
Signature:
public static <T> List<T> filter(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns a new list containing only elements that match the given predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing matching elements (empty if iterable is {@code null} /empty)
- See also: #filter(Iterable, Predicate, IntFunction)
-
Signature:
public static <T, C extends Collection<T>> C filter(final Iterable<? extends T> c, final Predicate<? super T> filter, final IntFunction<C> supplier) - Summary: Returns a new collection containing only elements that match the given predicate (collection created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element -
supplier(IntFunction<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing matching elements (empty if iterable is {@code null} /empty)
- See also: #filter(Iterable, Predicate)
-
Signature:
public static <T> List<T> filter(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns a new list containing only elements that match the given predicate (the iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing matching elements (empty if iterator is {@code null} or has no elements)
- See also: #filter(Iterator, Predicate, IntFunction)
-
Signature:
public static <T, C extends Collection<T>> C filter(final Iterator<? extends T> iter, final Predicate<? super T> filter, final IntFunction<C> supplier) - Summary: Returns a new collection containing only elements that match the given predicate (collection created by the provided supplier, iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
filter(Predicate<? super T>) — the predicate to test each element -
supplier(IntFunction<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing matching elements (empty if iterator is {@code null} or has no elements)
- See also: #filter(Iterator, Predicate)
mapToBoolean(...) -> boolean\[\]
-
Signature:
public static <T> boolean[] mapToBoolean(final T[] a, final ToBooleanFunction<? super T> mapper) - Summary: Returns a new boolean array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToBooleanFunction<? super T>) — the function to transform each element to a boolean value
-
- Returns: a new boolean array containing the transformed values
- See also: #mapToBoolean(Object\[\], int, int, ToBooleanFunction)
-
Signature:
public static <T> boolean[] mapToBoolean(final T[] a, final int fromIndex, final int toIndex, final ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new boolean array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToBooleanFunction<? super T>) — the function to transform each element to a boolean value
-
- Returns: a new boolean array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToBoolean(Object\[\], ToBooleanFunction)
-
Signature:
public static <T> boolean[] mapToBoolean(final Collection<? extends T> c, final ToBooleanFunction<? super T> mapper) - Summary: Returns a new boolean array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToBooleanFunction<? super T>) — the function to transform each element to a boolean value
-
- Returns: a new boolean array containing the transformed values
- See also: #mapToBoolean(Collection, int, int, ToBooleanFunction)
-
Signature:
public static <T> boolean[] mapToBoolean(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new boolean array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToBooleanFunction<? super T>) — the function to transform each element to a boolean value
-
- Returns: a new boolean array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToBoolean(Collection, ToBooleanFunction)
mapToChar(...) -> char\[\]
-
Signature:
public static <T> char[] mapToChar(final T[] a, final ToCharFunction<? super T> mapper) - Summary: Returns a new char array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToCharFunction<? super T>) — the function to transform each element to a char value
-
- Returns: a new char array containing the transformed values
- See also: #mapToChar(Object\[\], int, int, ToCharFunction)
-
Signature:
public static <T> char[] mapToChar(final T[] a, final int fromIndex, final int toIndex, final ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new char array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToCharFunction<? super T>) — the function to transform each element to a char value
-
- Returns: a new char array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToChar(Object\[\], ToCharFunction)
-
Signature:
public static <T> char[] mapToChar(final Collection<? extends T> c, final ToCharFunction<? super T> mapper) - Summary: Returns a new char array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToCharFunction<? super T>) — the function to transform each element to a char value
-
- Returns: a new char array containing the transformed values
- See also: #mapToChar(Collection, int, int, ToCharFunction)
-
Signature:
public static <T> char[] mapToChar(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new char array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToCharFunction<? super T>) — the function to transform each element to a char value
-
- Returns: a new char array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToChar(Collection, ToCharFunction)
mapToByte(...) -> byte\[\]
-
Signature:
public static <T> byte[] mapToByte(final T[] a, final ToByteFunction<? super T> mapper) - Summary: Returns a new byte array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToByteFunction<? super T>) — the function to transform each element to a byte value
-
- Returns: a new byte array containing the transformed values
- See also: #mapToByte(Object\[\], int, int, ToByteFunction)
-
Signature:
public static <T> byte[] mapToByte(final T[] a, final int fromIndex, final int toIndex, final ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new byte array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToByteFunction<? super T>) — the function to transform each element to a byte value
-
- Returns: a new byte array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToByte(Object\[\], ToByteFunction)
-
Signature:
public static <T> byte[] mapToByte(final Collection<? extends T> c, final ToByteFunction<? super T> mapper) - Summary: Returns a new byte array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToByteFunction<? super T>) — the function to transform each element to a byte value
-
- Returns: a new byte array containing the transformed values
- See also: #mapToByte(Collection, int, int, ToByteFunction)
-
Signature:
public static <T> byte[] mapToByte(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new byte array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToByteFunction<? super T>) — the function to transform each element to a byte value
-
- Returns: a new byte array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToByte(Collection, ToByteFunction)
mapToShort(...) -> short\[\]
-
Signature:
public static <T> short[] mapToShort(final T[] a, final ToShortFunction<? super T> mapper) - Summary: Returns a new short array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToShortFunction<? super T>) — the function to transform each element to a short value
-
- Returns: a new short array containing the transformed values
- See also: #mapToShort(Object\[\], int, int, ToShortFunction)
-
Signature:
public static <T> short[] mapToShort(final T[] a, final int fromIndex, final int toIndex, final ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new short array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToShortFunction<? super T>) — the function to transform each element to a short value
-
- Returns: a new short array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToShort(Object\[\], ToShortFunction)
-
Signature:
public static <T> short[] mapToShort(final Collection<? extends T> c, final ToShortFunction<? super T> mapper) - Summary: Returns a new short array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToShortFunction<? super T>) — the function to transform each element to a short value
-
- Returns: a new short array containing the transformed values
- See also: #mapToShort(Collection, int, int, ToShortFunction)
-
Signature:
public static <T> short[] mapToShort(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new short array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToShortFunction<? super T>) — the function to transform each element to a short value
-
- Returns: a new short array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToShort(Collection, ToShortFunction)
mapToInt(...) -> int\[\]
-
Signature:
public static <T> int[] mapToInt(final T[] a, final ToIntFunction<? super T> mapper) - Summary: Returns a new int array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToIntFunction<? super T>) — the function to transform each element to an int value
-
- Returns: a new int array containing the transformed values
- See also: #mapToInt(Object\[\], int, int, ToIntFunction)
-
Signature:
public static <T> int[] mapToInt(final T[] a, final int fromIndex, final int toIndex, final ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new int array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToIntFunction<? super T>) — the function to transform each element to an int value
-
- Returns: a new int array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToInt(Object\[\], ToIntFunction)
-
Signature:
public static <T> int[] mapToInt(final Collection<? extends T> c, final ToIntFunction<? super T> mapper) - Summary: Returns a new int array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToIntFunction<? super T>) — the function to transform each element to an int value
-
- Returns: a new int array containing the transformed values
- See also: #mapToInt(Collection, int, int, ToIntFunction)
-
Signature:
public static <T> int[] mapToInt(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new int array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToIntFunction<? super T>) — the function to transform each element to an int value
-
- Returns: a new int array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToInt(Collection, ToIntFunction)
-
Signature:
@Beta public static int[] mapToInt(final long[] a, final LongToIntFunction mapper) - Summary: Returns a new int array by transforming each long value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array of long values -
mapper(LongToIntFunction) — the function to transform each long value to an int value
-
- Returns: a new int array containing the transformed values
-
Signature:
@Beta public static int[] mapToInt(final double[] a, final DoubleToIntFunction mapper) - Summary: Returns a new int array by transforming each double value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array of double values -
mapper(DoubleToIntFunction) — the function to transform each double value to an int value
-
- Returns: a new int array containing the transformed values
mapToLong(...) -> long\[\]
-
Signature:
public static <T> long[] mapToLong(final T[] a, final ToLongFunction<? super T> mapper) - Summary: Returns a new long array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToLongFunction<? super T>) — the function to transform each element to a long value
-
- Returns: a new long array containing the transformed values
- See also: #mapToLong(Object\[\], int, int, ToLongFunction)
-
Signature:
public static <T> long[] mapToLong(final T[] a, final int fromIndex, final int toIndex, final ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new long array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToLongFunction<? super T>) — the function to transform each element to a long value
-
- Returns: a new long array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToLong(Object\[\], ToLongFunction)
-
Signature:
public static <T> long[] mapToLong(final Collection<? extends T> c, final ToLongFunction<? super T> mapper) - Summary: Returns a new long array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToLongFunction<? super T>) — the function to transform each element to a long value
-
- Returns: a new long array containing the transformed values
- See also: #mapToLong(Collection, int, int, ToLongFunction)
-
Signature:
public static <T> long[] mapToLong(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new long array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToLongFunction<? super T>) — the function to transform each element to a long value
-
- Returns: a new long array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToLong(Collection, ToLongFunction)
-
Signature:
@Beta public static long[] mapToLong(final int[] a, final IntToLongFunction mapper) - Summary: Returns a new long array by transforming each int value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values -
mapper(IntToLongFunction) — the function to transform each int value to a long value
-
- Returns: a new long array containing the transformed values
-
Signature:
@Beta public static long[] mapToLong(final double[] a, final DoubleToLongFunction mapper) - Summary: Returns a new long array by transforming each double value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the array of double values -
mapper(DoubleToLongFunction) — the function to transform each double value to a long value
-
- Returns: a new long array containing the transformed values
mapToFloat(...) -> float\[\]
-
Signature:
public static <T> float[] mapToFloat(final T[] a, final ToFloatFunction<? super T> mapper) - Summary: Returns a new float array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToFloatFunction<? super T>) — the function to transform each element to a float value
-
- Returns: a new float array containing the transformed values
- See also: #mapToFloat(Object\[\], int, int, ToFloatFunction)
-
Signature:
public static <T> float[] mapToFloat(final T[] a, final int fromIndex, final int toIndex, final ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new float array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToFloatFunction<? super T>) — the function to transform each element to a float value
-
- Returns: a new float array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToFloat(Object\[\], ToFloatFunction)
-
Signature:
public static <T> float[] mapToFloat(final Collection<? extends T> c, final ToFloatFunction<? super T> mapper) - Summary: Returns a new float array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToFloatFunction<? super T>) — the function to transform each element to a float value
-
- Returns: a new float array containing the transformed values
- See also: #mapToFloat(Collection, int, int, ToFloatFunction)
-
Signature:
public static <T> float[] mapToFloat(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new float array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToFloatFunction<? super T>) — the function to transform each element to a float value
-
- Returns: a new float array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToFloat(Collection, ToFloatFunction)
mapToDouble(...) -> double\[\]
-
Signature:
public static <T> double[] mapToDouble(final T[] a, final ToDoubleFunction<? super T> mapper) - Summary: Returns a new double array by transforming each element using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
mapper(ToDoubleFunction<? super T>) — the function to transform each element to a double value
-
- Returns: a new double array containing the transformed values
- See also: #mapToDouble(Object\[\], int, int, ToDoubleFunction)
-
Signature:
public static <T> double[] mapToDouble(final T[] a, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new double array by transforming elements within the specified range using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
a(T[]) — the array of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToDoubleFunction<? super T>) — the function to transform each element to a double value
-
- Returns: a new double array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToDouble(Object\[\], ToDoubleFunction)
-
Signature:
public static <T> double[] mapToDouble(final Collection<? extends T> c, final ToDoubleFunction<? super T> mapper) - Summary: Returns a new double array by transforming each element of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the collection is {@code null} or empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
mapper(ToDoubleFunction<? super T>) — the function to transform each element to a double value
-
- Returns: a new double array containing the transformed values
- See also: #mapToDouble(Collection, int, int, ToDoubleFunction)
-
Signature:
public static <T> double[] mapToDouble(final Collection<? extends T> c, final int fromIndex, final int toIndex, final ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException - Summary: Returns a new double array by transforming elements within the specified range of the collection using the given mapper function.
-
Contract:
- Returns an empty array if the range is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of values -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
mapper(ToDoubleFunction<? super T>) — the function to transform each element to a double value
-
- Returns: a new double array containing the transformed values from the range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #mapToDouble(Collection, ToDoubleFunction)
-
Signature:
@Beta public static double[] mapToDouble(final int[] a, final IntToDoubleFunction mapper) - Summary: Returns a new double array by transforming each int value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the array of int values -
mapper(IntToDoubleFunction) — the function to transform each int value to a double value
-
- Returns: a new double array containing the transformed values
- See also: #mapToDouble(Object\[\], ToDoubleFunction)
-
Signature:
@Beta public static double[] mapToDouble(final long[] a, final LongToDoubleFunction mapper) - Summary: Returns a new double array by transforming each long value using the given mapper function.
-
Contract:
- Returns an empty array if the input array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the array of long values -
mapper(LongToDoubleFunction) — the function to transform each long value to a double value
-
- Returns: a new double array containing the transformed values
- See also: #mapToDouble(Object\[\], ToDoubleFunction)
map(...) -> List<R>
-
Signature:
public static <T, R> List<R> map(final T[] a, final Function<? super T, ? extends R> mapper) - Summary: Returns a new list containing the result of applying the given mapper function to each element.
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends R>) — the function to transform each element
-
- Returns: a new list containing the transformed elements (empty if array is {@code null} /empty)
- See also: #map(Object\[\], int, int, Function)
-
Signature:
public static <T, R, C extends Collection<R>> C map(final T[] a, final Function<? super T, ? extends R> mapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing the result of applying the given mapper function to each element (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing the transformed elements (empty if array is {@code null} /empty)
- See also: #map(Object\[\], int, int, Function, IntFunction)
-
Signature:
public static <T, R> List<R> map(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends R> mapper) throws IndexOutOfBoundsException - Summary: Returns a new list containing the result of applying the given mapper function to each element within the specified range.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends R>) — the function to transform each element
-
- Returns: a new list containing the transformed elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #map(Object\[\], Function)
-
Signature:
public static <T, R, C extends Collection<R>> C map(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends R> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing the result of applying the given mapper function to each element within the specified range (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing the transformed elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #map(Object\[\], Function, IntFunction)
-
Signature:
public static <T, R> List<R> map(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends R> mapper) throws IndexOutOfBoundsException - Summary: Returns a new list containing the result of applying the given mapper function to each element within the specified range of the collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends R>) — the function to transform each element
-
- Returns: a new list containing the transformed elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #map(Collection, int, int, Function, IntFunction)
-
Signature:
public static <T, R, C extends Collection<R>> C map(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends R> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing the result of applying the given mapper function to each element within the specified range of the collection (collection created by the provided supplier).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing the transformed elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #map(Collection, int, int, Function)
-
Signature:
public static <T, R> List<R> map(final Iterable<? extends T> c, final Function<? super T, ? extends R> mapper) - Summary: Returns a new list containing the result of applying the given mapper function to each element of the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends R>) — the function to transform each element
-
- Returns: a new list containing the transformed elements (empty if iterable is {@code null} /empty)
- See also: #map(Iterable, Function, IntFunction)
-
Signature:
public static <T, R, C extends Collection<R>> C map(final Iterable<? extends T> c, final Function<? super T, ? extends R> mapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing the result of applying the given mapper function to each element of the iterable (collection created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing the transformed elements (empty if iterable is {@code null} /empty)
- See also: #map(Iterable, Function)
-
Signature:
public static <T, R> List<R> map(final Iterator<? extends T> iter, final Function<? super T, ? extends R> mapper) - Summary: Returns a new list containing the result of applying the given mapper function to each element of the iterator (the iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends R>) — the function to transform each element
-
- Returns: a new list containing the transformed elements (empty if iterator is {@code null} or has no elements)
- See also: #map(Iterator, Function, IntFunction), Iterators#map(Iterator, Function)
-
Signature:
public static <T, R, C extends Collection<R>> C map(final Iterator<? extends T> iter, final Function<? super T, ? extends R> mapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing the result of applying the given mapper function to each element of the iterator (collection created by the provided supplier, iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing the transformed elements (empty if iterator is {@code null} or has no elements)
- See also: #map(Iterator, Function), Iterators#map(Iterator, Function)
flatMap(...) -> List<R>
-
Signature:
public static <T, R> List<R> flatMap(final T[] a, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Returns a new list containing all elements from the collections produced by applying the mapper function to each element.
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection
-
- Returns: a new list containing all elements from all mapped collections (empty if array is {@code null} /empty)
- See also: #flatMap(Object\[\], int, int, Function)
-
Signature:
public static <T, R, C extends Collection<R>> C flatMap(final T[] a, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing all elements from the collections produced by applying the mapper function to each element (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all mapped collections (empty if array is {@code null} /empty)
- See also: #flatMap(Object\[\], int, int, Function, IntFunction)
-
Signature:
public static <T, R> List<R> flatMap(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Returns a new list containing all elements from the collections produced by applying the mapper function to each element within the specified range.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection
-
- Returns: a new list containing all elements from all mapped collections (empty if range is empty)
- See also: #flatMap(Object\[\], Function)
-
Signature:
public static <T, R, C extends Collection<R>> C flatMap(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing all elements from the collections produced by applying the mapper function to each element within the specified range (collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all mapped collections (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #flatMap(Object\[\], Function, IntFunction)
-
Signature:
public static <T, R> List<R> flatMap(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends Collection<? extends R>> mapper) throws IndexOutOfBoundsException - Summary: Returns a new list containing all elements from the collections produced by applying the mapper function to each element within the specified range of the collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection
-
- Returns: a new list containing all elements from all mapped collections (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #flatMap(Collection, int, int, Function, IntFunction)
-
Signature:
public static <T, R, C extends Collection<R>> C flatMap(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing all elements from the collections produced by applying the mapper function to each element within the specified range of the collection (collection created by the provided supplier).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all mapped collections (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds
-
- See also: #flatMap(Collection, int, int, Function)
-
Signature:
public static <T, R> List<R> flatMap(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Returns a new list containing all elements from the collections produced by applying the mapper function to each element of the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection
-
- Returns: a new list containing all elements from all mapped collections (empty if iterable is {@code null} /empty)
- See also: #flatMap(Iterable, Function, IntFunction)
-
Signature:
public static <T, R, C extends Collection<R>> C flatMap(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing all elements from the collections produced by applying the mapper function to each element of the iterable (collection created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all mapped collections (empty if iterable is {@code null} /empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException
-
- See also: #flatMap(Iterable, Function)
-
Signature:
public static <T, R> List<R> flatMap(final Iterator<? extends T> iter, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Returns a new list containing all elements from the collections produced by applying the mapper function to each element of the iterator (the iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection
-
- Returns: a new list containing all elements from all mapped collections (empty if iterator is {@code null} or has no elements)
- See also: #flatMap(Iterator, Function, IntFunction), Iterators#flatMap(Iterator, Function)
-
Signature:
public static <T, R, C extends Collection<R>> C flatMap(final Iterator<? extends T> iter, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a new collection containing all elements from the collections produced by applying the mapper function to each element of the iterator (collection created by the provided supplier, iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all mapped collections (empty if iterator is {@code null} or has no elements)
-
Throws:
-
java.lang.IndexOutOfBoundsException
-
- See also: #flatMap(Iterator, Function), Iterators#flatMap(Iterator, Function)
-
Signature:
public static <T, U, R> List<R> flatMap(final T[] a, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper) - Summary: Returns a new list containing all elements from applying two levels of flat-mapping (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element).
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type
-
- Returns: a new list containing all elements from all nested mapped collections (empty if array is {@code null} /empty)
- See also: #flatMap(Object\[\], Function, Function, IntFunction)
-
Signature:
public static <T, U, R, C extends Collection<R>> C flatMap(final T[] a, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing all elements from applying two levels of flat-mapping (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element, collection created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all nested mapped collections (empty if array is {@code null} /empty)
- See also: #flatMap(Object\[\], Function, Function)
-
Signature:
public static <T, U, R> List<R> flatMap(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper) - Summary: Returns a new list containing all elements from applying two levels of flat-mapping to the iterable (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type
-
- Returns: a new list containing all elements from all nested mapped collections (empty if iterable is {@code null} /empty)
- See also: #flatMap(Iterable, Function, Function, IntFunction)
-
Signature:
public static <T, U, R, C extends Collection<R>> C flatMap(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing all elements from applying two levels of flat-mapping to the iterable (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element, collection created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all nested mapped collections (empty if iterable is {@code null} /empty)
- See also: #flatMap(Iterable, Function, Function)
-
Signature:
public static <T, U, R> List<R> flatMap(final Iterator<? extends T> iter, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper) - Summary: Returns a new list containing all elements from applying two levels of flat-mapping to the iterator (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element, the iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type
-
- Returns: a new list containing all elements from all nested mapped collections (empty if iterator is {@code null} or has no elements)
- See also: #flatMap(Iterator, Function, Function, IntFunction)
-
Signature:
public static <T, U, R, C extends Collection<R>> C flatMap(final Iterator<? extends T> iter, final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper, final IntFunction<? extends C> supplier) - Summary: Returns a new collection containing all elements from applying two levels of flat-mapping to the iterator (first mapper transforms each element to intermediate collections, second mapper flattens each intermediate element, collection created by the provided supplier, iterator will be consumed).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
mapper(Function<? super T, ? extends Collection<? extends U>>) — the function to transform each element to a collection of intermediate type -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — the function to transform each intermediate element to a collection of final type -
supplier(IntFunction<? extends C>) — the supplier function to create the result collection
-
- Returns: a new collection containing all elements from all nested mapped collections (empty if iterator is {@code null} or has no elements)
- See also: #flatMap(Iterator, Function, Function)
takeWhile(...) -> List<T>
-
Signature:
public static <T> List<T> takeWhile(final T[] a, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the array while the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true}
- See also: #takeWhileInclusive(Object\[\], Predicate), #dropWhile(Object\[\], Predicate)
-
Signature:
public static <T> List<T> takeWhile(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the iterable while the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true}
- See also: #takeWhileInclusive(Iterable, Predicate), #dropWhile(Iterable, Predicate)
-
Signature:
public static <T> List<T> takeWhile(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the iterator while the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true}
- See also: #takeWhileInclusive(Iterator, Predicate), #dropWhile(Iterator, Predicate)
takeWhileInclusive(...) -> List<T>
-
Signature:
public static <T> List<T> takeWhileInclusive(final T[] a, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the array while the predicate returns {@code true} , including the first element that fails.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true} , plus the first failing element
- See also: #takeWhile(Object\[\], Predicate), #dropWhile(Object\[\], Predicate)
-
Signature:
public static <T> List<T> takeWhileInclusive(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the iterable while the predicate returns {@code true} , including the first element that fails.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true} , plus the first failing element
- See also: #takeWhile(Iterable, Predicate), #dropWhile(Iterable, Predicate)
-
Signature:
public static <T> List<T> takeWhileInclusive(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns a new list containing elements from the beginning of the iterator while the predicate returns {@code true} , including the first element that fails.
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements while the predicate returns {@code true} , plus the first failing element
- See also: #takeWhile(Iterator, Predicate), #dropWhile(Iterator, Predicate)
dropWhile(...) -> List<T>
-
Signature:
public static <T> List<T> dropWhile(final T[] a, final Predicate<? super T> filter) - Summary: Returns a new list containing the remaining elements of the array after dropping the longest prefix of elements that satisfy the predicate.
-
Contract:
- Returns an empty list if the array is {@code null} or empty, or if all elements match the predicate.
-
Parameters:
-
a(T[]) — the array of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements after dropping leading elements that match the predicate
- See also: #takeWhile(Object\[\], Predicate), #skipUntil(Object\[\], Predicate)
-
Signature:
public static <T> List<T> dropWhile(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns a new list containing the remaining elements of the iterable after dropping the longest prefix of elements that satisfy the predicate.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty, or if all elements match the predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements after dropping leading elements that match the predicate
- See also: #takeWhile(Iterable, Predicate), #skipUntil(Iterable, Predicate)
-
Signature:
public static <T> List<T> dropWhile(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns a new list containing the remaining elements of the iterator after dropping the longest prefix of elements that satisfy the predicate.
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements, or if all elements match the predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements after dropping leading elements that match the predicate
- See also: #takeWhile(Iterator, Predicate), #skipUntil(Iterator, Predicate)
skipUntil(...) -> List<T>
-
Signature:
@Beta public static <T> List<T> skipUntil(final T[] a, final Predicate<? super T> filter) - Summary: Returns a new list containing elements starting from the first element where the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements starting from the first element that matches the predicate
- See also: #dropWhile(Object\[\], Predicate)
-
Signature:
@Beta public static <T> List<T> skipUntil(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns a new list containing elements starting from the first element where the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements starting from the first element that matches the predicate
- See also: #dropWhile(Iterable, Predicate)
-
Signature:
@Beta public static <T> List<T> skipUntil(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns a new list containing elements starting from the first element where the predicate returns {@code true} .
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator of values -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: a new list containing elements starting from the first element that matches the predicate
- See also: #dropWhile(Iterator, Predicate)
mapAndFilter(...) -> List<R>
-
Signature:
@Beta public static <T, R> List<R> mapAndFilter(final Iterable<? extends T> c, final Function<? super T, ? extends R> mapper, final Predicate<? super R> filter) - Summary: Returns a new list by first transforming each element using the mapper function, then filtering the transformed values using the predicate.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
filter(Predicate<? super R>) — the predicate to test each transformed element
-
- Returns: a new list containing transformed elements that match the filter
- See also: #filterAndMap(Iterable, Predicate, Function), #mapAndFilter(Iterable, Function, Predicate, IntFunction)
-
Signature:
@Beta public static <T, R, C extends Collection<R>> C mapAndFilter(final Iterable<? extends T> c, final Function<? super T, ? extends R> mapper, final Predicate<? super R> filter, final IntFunction<? extends C> supplier) - Summary: Returns a new collection by first transforming each element using the mapper function, then filtering the transformed values using the predicate.
-
Contract:
- Returns an empty collection if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
mapper(Function<? super T, ? extends R>) — the function to transform each element -
filter(Predicate<? super R>) — the predicate to test each transformed element -
supplier(IntFunction<? extends C>) — the supplier function that provides a new collection
-
- Returns: a new collection containing transformed elements that match the filter
- See also: #filterAndMap(Iterable, Predicate, Function, IntFunction), #mapAndFilter(Iterable, Function, Predicate)
filterAndMap(...) -> List<R>
-
Signature:
@Beta public static <T, R> List<R> filterAndMap(final Iterable<? extends T> c, final Predicate<? super T> filter, final Function<? super T, ? extends R> mapper) - Summary: Returns a new list by first filtering elements using the predicate, then transforming the filtered values using the mapper function.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element -
mapper(Function<? super T, ? extends R>) — the function to transform each filtered element
-
- Returns: a new list containing transformed values from filtered elements
- See also: #mapAndFilter(Iterable, Function, Predicate), #filterAndMap(Iterable, Predicate, Function, IntFunction)
-
Signature:
@Beta public static <T, R, C extends Collection<R>> C filterAndMap(final Iterable<? extends T> c, final Predicate<? super T> filter, final Function<? super T, ? extends R> mapper, final IntFunction<C> supplier) - Summary: Returns a new collection by first filtering elements using the predicate, then transforming the filtered values using the mapper function.
-
Contract:
- Returns an empty collection if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element -
mapper(Function<? super T, ? extends R>) — the function to transform each filtered element -
supplier(IntFunction<C>) — the supplier function that provides a new collection
-
- Returns: a new collection containing transformed values from filtered elements
- See also: #mapAndFilter(Iterable, Function, Predicate, IntFunction), #filterAndMap(Iterable, Predicate, Function)
flatMapAndFilter(...) -> List<R>
-
Signature:
@Beta public static <T, R> List<R> flatMapAndFilter(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends R>> mapper, final Predicate<? super R> filter) - Summary: Returns a new list by first flat-mapping each element to a collection, then filtering the flattened values using the predicate.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
filter(Predicate<? super R>) — the predicate to test each flattened element
-
- Returns: a new list containing flattened elements that match the filter
- See also: #filterAndFlatMap(Iterable, Predicate, Function), #flatMapAndFilter(Iterable, Function, Predicate, IntFunction)
-
Signature:
@Beta public static <T, R, C extends Collection<R>> C flatMapAndFilter(final Iterable<? extends T> c, final Function<? super T, ? extends Collection<? extends R>> mapper, final Predicate<? super R> filter, final IntFunction<? extends C> supplier) - Summary: Returns a new collection by first flat-mapping each element to a collection, then filtering the flattened values using the predicate.
-
Contract:
- Returns an empty collection if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each element to a collection -
filter(Predicate<? super R>) — the predicate to test each flattened element -
supplier(IntFunction<? extends C>) — the supplier function that provides a new collection
-
- Returns: a new collection containing flattened elements that match the filter
- See also: #filterAndFlatMap(Iterable, Predicate, Function, IntFunction), #flatMapAndFilter(Iterable, Function, Predicate)
filterAndFlatMap(...) -> List<R>
-
Signature:
@Beta public static <T, R> List<R> filterAndFlatMap(final Iterable<? extends T> c, final Predicate<? super T> filter, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Returns a new list by first filtering elements using the predicate, then flat-mapping the filtered values to collections.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each filtered element to a collection
-
- Returns: a new list containing flattened values from filtered elements
- See also: #flatMapAndFilter(Iterable, Function, Predicate), #filterAndFlatMap(Iterable, Predicate, Function, IntFunction)
-
Signature:
@Beta public static <T, R, C extends Collection<R>> C filterAndFlatMap(final Iterable<? extends T> c, final Predicate<? super T> filter, final Function<? super T, ? extends Collection<? extends R>> mapper, final IntFunction<C> supplier) - Summary: Returns a new collection by first filtering elements using the predicate, then flat-mapping the filtered values to collections.
-
Contract:
- Returns an empty collection if the iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable of values -
filter(Predicate<? super T>) — the predicate to test each element -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to transform each filtered element to a collection -
supplier(IntFunction<C>) — the supplier function that provides a new collection
-
- Returns: a new collection containing flattened values from filtered elements
- See also: #flatMapAndFilter(Iterable, Function, Predicate, IntFunction), #filterAndFlatMap(Iterable, Predicate, Function)
distinct(...) -> boolean\[\]
-
Signature:
public static boolean[] distinct(final boolean[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(boolean[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(boolean\[\], int, int)
-
Signature:
public static boolean[] distinct(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(boolean[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(boolean\[\])
-
Signature:
public static char[] distinct(final char[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(char[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(char\[\], int, int)
-
Signature:
public static char[] distinct(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(char[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(char\[\])
-
Signature:
public static byte[] distinct(final byte[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(byte[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(byte\[\], int, int)
-
Signature:
public static byte[] distinct(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(byte[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(byte\[\])
-
Signature:
public static short[] distinct(final short[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(short[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(short\[\], int, int)
-
Signature:
public static short[] distinct(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(short\[\])
-
Signature:
public static int[] distinct(final int[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(int[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(int\[\], int, int)
-
Signature:
public static int[] distinct(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(int\[\])
-
Signature:
public static long[] distinct(final long[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(long[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(long\[\], int, int)
-
Signature:
public static long[] distinct(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: #distinct(long\[\])
-
Signature:
public static float[] distinct(final float[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(float[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(float\[\], int, int)
-
Signature:
public static float[] distinct(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #distinct(float\[\])
-
Signature:
public static double[] distinct(final double[] a) - Summary: Returns a new array containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(double[]) — the array
-
- Returns: a new array containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(double\[\], int, int)
-
Signature:
public static double[] distinct(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new array containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new array containing only the unique elements from the range (empty if range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #distinct(double\[\])
-
Signature:
public static <T> List<T> distinct(final T[] a) - Summary: Returns a new list containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(T[]) — the array
-
- Returns: a new list containing only the unique elements (empty if array is {@code null} /empty)
- See also: #distinct(Object\[\], int, int), #distinctBy(Object\[\], Function)
-
Signature:
public static <T> List<T> distinct(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new list containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new list containing only the unique elements from the range (empty if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #distinct(Object\[\]), #distinctBy(Object\[\], int, int, Function)
-
Signature:
public static <T> List<T> distinct(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new list containing only unique elements from the specified range, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new list containing only the unique elements from the range (empty if collection is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > c.size() || fromIndex > toIndex}
-
- See also: #distinct(Iterable)
-
Signature:
public static <T> List<T> distinct(final Iterable<? extends T> c) - Summary: Returns a new list containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable
-
- Returns: a new list containing only the unique elements (empty if iterable is {@code null} /empty)
- See also: #distinct(Iterator), #distinctBy(Iterable, Function)
-
Signature:
public static <T> List<T> distinct(final Iterator<? extends T> iter) - Summary: Returns a new list containing only unique elements, removing all duplicates (preserves order of first occurrence).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator
-
- Returns: a new list containing only the unique elements (empty if iterator is {@code null} or has no elements)
- See also: #distinct(Iterable), #distinctBy(Iterator, Function)
distinctBy(...) -> List<T>
-
Signature:
public static <T> List<T> distinctBy(final T[] a, final Function<? super T, ?> keyExtractor) - Summary: Returns a new list containing only elements with unique keys extracted by the given function (preserves order of first occurrence).
-
Parameters:
-
a(T[]) — the array -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element
-
- Returns: a new list containing elements with unique keys (empty if array is {@code null} /empty)
- See also: #distinct(Object\[\]), #distinctBy(Object\[\], int, int, Function)
-
Signature:
public static <T> List<T> distinctBy(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ?> keyExtractor) throws IndexOutOfBoundsException - Summary: Returns a new list containing only elements from the specified range with unique keys extracted by the given function (preserves order of first occurrence).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element
-
- Returns: a new list containing elements with unique keys from the range (empty if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #distinctBy(Object\[\], Function)
-
Signature:
public static <T, C extends Collection<T>> C distinctBy(final T[] a, final Function<? super T, ?> keyExtractor, final Supplier<C> supplier) - Summary: Returns a new collection containing only elements with unique keys extracted by the given function (collection created by the provided supplier, preserves order of first occurrence).
-
Parameters:
-
a(T[]) — the array -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element -
supplier(Supplier<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing elements with unique keys (empty if array is {@code null} /empty)
- See also: #distinctBy(Object\[\], Function)
-
Signature:
public static <T> List<T> distinctBy(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ?> keyExtractor) throws IndexOutOfBoundsException - Summary: Returns a new list containing only elements from the specified range with unique keys extracted by the given function (preserves order of first occurrence).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element
-
- Returns: a new list containing elements with unique keys from the range (empty if collection is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > c.size() || fromIndex > toIndex}
-
- See also: #distinctBy(Iterable, Function)
-
Signature:
public static <T> List<T> distinctBy(final Iterable<? extends T> c, final Function<? super T, ?> keyExtractor) - Summary: Returns a new list containing only elements with unique keys extracted by the given function (preserves order of first occurrence).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element
-
- Returns: a new list containing elements with unique keys (empty if iterable is {@code null} /empty)
- See also: #distinct(Iterable), #distinctBy(Iterable, Function, Supplier)
-
Signature:
public static <T, C extends Collection<T>> C distinctBy(final Iterable<? extends T> c, final Function<? super T, ?> keyExtractor, final Supplier<C> supplier) - Summary: Returns a new collection containing only elements with unique keys extracted by the given function (collection created by the provided supplier, preserves order of first occurrence).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element -
supplier(Supplier<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing elements with unique keys (empty if iterable is {@code null} /empty)
- See also: #distinctBy(Iterable, Function)
-
Signature:
public static <T> List<T> distinctBy(final Iterator<? extends T> iter, final Function<? super T, ?> keyExtractor) - Summary: Returns a new list containing only elements with unique keys extracted by the given function (preserves order of first occurrence).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element
-
- Returns: a new list containing elements with unique keys (empty if iterator is {@code null} or has no elements)
- See also: #distinct(Iterator), #distinctBy(Iterator, Function, Supplier)
-
Signature:
public static <T, C extends Collection<T>> C distinctBy(final Iterator<? extends T> iter, final Function<? super T, ?> keyExtractor, final Supplier<C> supplier) - Summary: Returns a new collection containing only elements with unique keys extracted by the given function (collection created by the provided supplier, preserves order of first occurrence).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
keyExtractor(Function<? super T, ?>) — the function to extract the comparison key from each element -
supplier(Supplier<C>) — the supplier function to create the result collection
-
- Returns: a new collection containing elements with unique keys (empty if iterator is {@code null} or has no elements)
- See also: #distinctBy(Iterator, Function)
allMatch(...) -> boolean
-
Signature:
public static <T> boolean allMatch(final T[] a, final Predicate<? super T> filter) - Summary: Returns {@code true} if all elements match the given predicate.
-
Contract:
- Returns {@code true} if all elements match the given predicate.
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if all elements match the predicate ( {@code true} if array is {@code null} /empty)
- See also: #anyMatch(Object\[\], Predicate), #noneMatch(Object\[\], Predicate)
-
Signature:
public static <T> boolean allMatch(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns {@code true} if all elements match the given predicate.
-
Contract:
- Returns {@code true} if all elements match the given predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if all elements match the predicate ( {@code true} if iterable is {@code null} /empty)
- See also: #anyMatch(Iterable, Predicate), #noneMatch(Iterable, Predicate)
-
Signature:
public static <T> boolean allMatch(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns {@code true} if all elements match the given predicate.
-
Contract:
- Returns {@code true} if all elements match the given predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if all elements match the predicate ( {@code true} if iterator is {@code null} or has no elements)
- See also: #anyMatch(Iterator, Predicate), #noneMatch(Iterator, Predicate)
anyMatch(...) -> boolean
-
Signature:
public static <T> boolean anyMatch(final T[] a, final Predicate<? super T> filter) - Summary: Returns {@code true} if at least one element matches the given predicate.
-
Contract:
- Returns {@code true} if at least one element matches the given predicate.
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if at least one element matches the predicate ( {@code false} if array is {@code null} /empty)
- See also: #allMatch(Object\[\], Predicate), #noneMatch(Object\[\], Predicate)
-
Signature:
public static <T> boolean anyMatch(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns {@code true} if at least one element matches the given predicate.
-
Contract:
- Returns {@code true} if at least one element matches the given predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if at least one element matches the predicate ( {@code false} if iterable is {@code null} /empty)
- See also: #allMatch(Iterable, Predicate), #noneMatch(Iterable, Predicate)
-
Signature:
public static <T> boolean anyMatch(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns {@code true} if at least one element matches the given predicate.
-
Contract:
- Returns {@code true} if at least one element matches the given predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if at least one element matches the predicate ( {@code false} if iterator is {@code null} or has no elements)
- See also: #allMatch(Iterator, Predicate), #noneMatch(Iterator, Predicate)
noneMatch(...) -> boolean
-
Signature:
public static <T> boolean noneMatch(final T[] a, final Predicate<? super T> filter) - Summary: Returns {@code true} if no elements match the given predicate.
-
Contract:
- Returns {@code true} if no elements match the given predicate.
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if no elements match the predicate ( {@code true} if array is {@code null} /empty)
- See also: #allMatch(Object\[\], Predicate), #anyMatch(Object\[\], Predicate)
-
Signature:
public static <T> boolean noneMatch(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns {@code true} if no elements match the given predicate.
-
Contract:
- Returns {@code true} if no elements match the given predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if no elements match the predicate ( {@code true} if iterable is {@code null} /empty)
- See also: #allMatch(Iterable, Predicate), #anyMatch(Iterable, Predicate)
-
Signature:
public static <T> boolean noneMatch(final Iterator<? extends T> iter, final Predicate<? super T> filter) - Summary: Returns {@code true} if no elements match the given predicate.
-
Contract:
- Returns {@code true} if no elements match the given predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if no elements match the predicate ( {@code true} if iterator is {@code null} or has no elements)
- See also: #allMatch(Iterator, Predicate), #anyMatch(Iterator, Predicate)
nMatch(...) -> boolean
-
Signature:
public static <T> boolean nMatch(final T[] a, final int atLeast, final int atMost, final Predicate<? super T> filter) - Summary: Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Contract:
- Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Parameters:
-
a(T[]) — the array -
atLeast(int) — the minimum number of matches required (inclusive) -
atMost(int) — the maximum number of matches allowed (inclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if match count is within the range ( {@code true} if array is empty and {@code atLeast} is 0)
- See also: #allMatch(Object\[\], Predicate), #count(Object\[\], Predicate)
-
Signature:
public static <T> boolean nMatch(final Iterable<? extends T> c, final int atLeast, final int atMost, final Predicate<? super T> filter) - Summary: Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Contract:
- Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
atLeast(int) — the minimum number of matches required (inclusive) -
atMost(int) — the maximum number of matches allowed (inclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if match count is within the range ( {@code true} if iterable is empty and {@code atLeast} is 0)
- See also: #allMatch(Iterable, Predicate), #count(Iterable, Predicate)
-
Signature:
public static <T> boolean nMatch(final Iterator<? extends T> iter, final int atLeast, final int atMost, final Predicate<? super T> filter) - Summary: Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Contract:
- Returns {@code true} if the number of matching elements is between the specified minimum and maximum (inclusive).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator -
atLeast(int) — the minimum number of matches required (inclusive) -
atMost(int) — the maximum number of matches allowed (inclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: {@code true} if match count is within the range ( {@code true} if iterator is empty and {@code atLeast} is 0)
- See also: #allMatch(Iterator, Predicate), #count(Iterator, Predicate)
allTrue(...) -> boolean
-
Signature:
public static boolean allTrue(final boolean[] a) - Summary: Returns {@code true} if all elements are {@code true} .
-
Contract:
- Returns {@code true} if all elements are {@code true} .
-
Parameters:
-
a(boolean[]) — the array
-
- Returns: {@code true} if all elements are {@code true} ( {@code true} if array is {@code null} /empty)
- See also: #allFalse(boolean\[\]), #anyTrue(boolean\[\])
allFalse(...) -> boolean
-
Signature:
public static boolean allFalse(final boolean[] a) - Summary: Returns {@code true} if all elements are {@code false} .
-
Contract:
- Returns {@code true} if all elements are {@code false} .
-
Parameters:
-
a(boolean[]) — the array
-
- Returns: {@code true} if all elements are {@code false} ( {@code true} if array is {@code null} /empty)
- See also: #allTrue(boolean\[\]), #anyFalse(boolean\[\])
anyTrue(...) -> boolean
-
Signature:
public static boolean anyTrue(final boolean[] a) - Summary: Returns {@code true} if at least one element is {@code true} .
-
Contract:
- Returns {@code true} if at least one element is {@code true} .
-
Parameters:
-
a(boolean[]) — the array
-
- Returns: {@code true} if at least one element is {@code true} ( {@code false} if array is {@code null} /empty)
- See also: #anyFalse(boolean\[\]), #allTrue(boolean\[\])
anyFalse(...) -> boolean
-
Signature:
public static boolean anyFalse(final boolean[] a) - Summary: Returns {@code true} if at least one element is {@code false} .
-
Contract:
- Returns {@code true} if at least one element is {@code false} .
-
Parameters:
-
a(boolean[]) — the array
-
- Returns: {@code true} if at least one element is {@code false} ( {@code false} if array is {@code null} /empty)
- See also: #anyTrue(boolean\[\]), #allFalse(boolean\[\])
count(...) -> int
-
Signature:
public static int count(final boolean[] a, final BooleanPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(boolean[]) — the array -
filter(BooleanPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(boolean\[\], int, int, BooleanPredicate)
-
Signature:
public static int count(final boolean[] a, final int fromIndex, final int toIndex, final BooleanPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(boolean[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(BooleanPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(boolean\[\], BooleanPredicate)
-
Signature:
public static int count(final char[] a, final CharPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(char[]) — the array -
filter(CharPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(char\[\], int, int, CharPredicate)
-
Signature:
public static int count(final char[] a, final int fromIndex, final int toIndex, final CharPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(char[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(CharPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(char\[\], CharPredicate)
-
Signature:
public static int count(final byte[] a, final BytePredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(byte[]) — the array -
filter(BytePredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(byte\[\], int, int, BytePredicate)
-
Signature:
public static int count(final byte[] a, final int fromIndex, final int toIndex, final BytePredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(byte[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(BytePredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(byte\[\], BytePredicate)
-
Signature:
public static int count(final short[] a, final ShortPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(short[]) — the array -
filter(ShortPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(short\[\], int, int, ShortPredicate)
-
Signature:
public static int count(final short[] a, final int fromIndex, final int toIndex, final ShortPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(short[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(ShortPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(short\[\], ShortPredicate)
-
Signature:
public static int count(final int[] a, final IntPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(int[]) — the array -
filter(IntPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(int\[\], int, int, IntPredicate)
-
Signature:
public static int count(final int[] a, final int fromIndex, final int toIndex, final IntPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(int[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(IntPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(int\[\], IntPredicate)
-
Signature:
public static int count(final long[] a, final LongPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(long[]) — the array -
filter(LongPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(long\[\], int, int, LongPredicate)
-
Signature:
public static int count(final long[] a, final int fromIndex, final int toIndex, final LongPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(long[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(LongPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(long\[\], LongPredicate)
-
Signature:
public static int count(final float[] a, final FloatPredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(float[]) — the array -
filter(FloatPredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(float\[\], int, int, FloatPredicate)
-
Signature:
public static int count(final float[] a, final int fromIndex, final int toIndex, final FloatPredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(float[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(FloatPredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(float\[\], FloatPredicate)
-
Signature:
public static int count(final double[] a, final DoublePredicate filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(double[]) — the array -
filter(DoublePredicate) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
- See also: #count(double\[\], int, int, DoublePredicate)
-
Signature:
public static int count(final double[] a, final int fromIndex, final int toIndex, final DoublePredicate filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(double[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(DoublePredicate) — the predicate to test each element
-
- Returns: the number of elements in the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #count(double\[\], DoublePredicate)
-
Signature:
public static <T> int count(final T[] a, final Predicate<? super T> filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
a(T[]) — the array -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if array is {@code null} /empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException
-
-
Signature:
public static <T> int count(final T[] a, final int fromIndex, final int toIndex, final Predicate<? super T> filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: the number of elements within the range that match the predicate (0 if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
-
Signature:
public static <T> int count(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Predicate<? super T> filter) throws IndexOutOfBoundsException - Summary: Returns the number of elements within the specified range that match the given predicate.
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: the number of elements within the range that match the predicate (0 if collection is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > c.size() || fromIndex > toIndex}
-
-
Signature:
public static <T> int count(final Iterable<? extends T> c, final Predicate<? super T> filter) - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if iterable is {@code null} /empty)
-
Signature:
public static int count(final Iterator<?> iter) throws ArithmeticException - Summary: Returns the total number of elements.
-
Parameters:
-
iter(Iterator<?>) — the iterator (will be consumed)
-
- Returns: the total number of elements (0 if iterator is {@code null} or has no elements)
-
Throws:
-
java.lang.ArithmeticException— if the count overflows an {@code int}
-
- See also: #count(Iterator, Predicate)
-
Signature:
public static <T> int count(final Iterator<? extends T> iter, final Predicate<? super T> filter) throws ArithmeticException - Summary: Returns the number of elements that match the given predicate.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
filter(Predicate<? super T>) — the predicate to test each element
-
- Returns: the number of elements that match the predicate (0 if iterator is {@code null} or has no elements)
-
Throws:
-
java.lang.ArithmeticException— if the count overflows an {@code int}
-
- See also: #count(Iterator)
merge(...) -> List<T>
-
Signature:
public static <T> List<T> merge(final T[] a, final T[] b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two the input arrays into a list based where the order of the elements is determined by the given selector function.
-
Parameters:
-
a(T[]) — the first array to merge -
b(T[]) — the second array to merge -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines the next element to add to the result list
-
- Returns: a list containing the merged elements from both arrays. An empty list is returned if both arrays are {@code null} or empty.
- See also: #concat(Object\[\], Object\[\])
-
Signature:
public static <T> List<T> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two the input iterables into a list based where the order of the elements is determined by the given selector function.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable to merge -
b(Iterable<? extends T>) — the second iterable to merge -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines the next element to add to the result list
-
- Returns: a list containing the merged elements from both iterables. An empty list is returned if both iterables are {@code null} or empty.
- See also: #concat(Iterable, Iterable)
-
Signature:
public static <T> List<T> merge(final Collection<? extends Iterable<? extends T>> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges multiple iterables into a list based where the order of the elements is determined by the given selector function.
-
Parameters:
-
c(Collection<? extends Iterable<? extends T>>) — the collection of iterable to merge -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines the next element to add to the result list
-
- Returns: a list containing the merged elements from all iterables. An empty list is returned if all iterables are {@code null} or empty.
- See also: #concat(Collection), #concat(Collection, IntFunction)
-
Signature:
public static <T, C extends Collection<T>> C merge(final Collection<? extends Iterable<? extends T>> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector, final IntFunction<? extends C> supplier) - Summary: Merges multiple iterables into a list based where the order of the elements is determined by the given selector function.
-
Parameters:
-
c(Collection<? extends Iterable<? extends T>>) — the collection of iterable to merge -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines the next element to add to the result collection -
supplier(IntFunction<? extends C>) — the supplier used to create the returned collection
-
- Returns: a collection containing the merged elements from all iterables. An empty collection created by the specified {@code supplier} is returned if all iterables are {@code null} or empty.
- See also: #concat(Collection), #concat(Collection, IntFunction)
zip(...) -> List<R>
-
Signature:
public static <A, B, R> List<R> zip(final A[] a, final B[] b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two arrays into a single list using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two arrays
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#pair(), Fn#tuple2()
-
Signature:
public static <A, B, R> List<R> zip(final Iterable<A> a, final Iterable<B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterables into a single list using the provided zip function.
-
Parameters:
-
a(Iterable<A>) — the first iterable to zip -
b(Iterable<B>) — the second iterable to zip -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two iterables
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#pair(), Fn#tuple2()
-
Signature:
public static <A, B, C, R> List<R> zip(final A[] a, final B[] b, final C[] c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three arrays into a single list using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
c(C[]) — the third array to zip -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three arrays
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#triple(), Fn#tuple3()
-
Signature:
public static <A, B, C, R> List<R> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterables into a single list using the provided zip function.
-
Parameters:
-
a(Iterable<A>) — the first iterable to zip -
b(Iterable<B>) — the second iterable to zip -
c(Iterable<C>) — the third iterable to zip -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three iterables
-
- Returns: a list containing the zipped elements (an empty list is returned if any input iterable is {@code null} or empty)
- See also: Fn#triple(), Fn#tuple3()
-
Signature:
public static <A, B, R> List<R> zip(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two arrays into a single list using the provided zip function.
-
Contract:
- If one array is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
valueForNoneA(A) — the default value to use if the first array is shorter -
valueForNoneB(B) — the default value to use if the second array is shorter -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two arrays
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#pair(), Fn#tuple2()
-
Signature:
public static <A, B, R> List<R> zip(final Iterable<A> a, final Iterable<B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterables into a single list using the provided zip function.
-
Contract:
- If one iterable is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(Iterable<A>) — the first iterable to zip -
b(Iterable<B>) — the second iterable to zip -
valueForNoneA(A) — the default value to use if the first iterable is shorter -
valueForNoneB(B) — the default value to use if the second iterable is shorter -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two iterables
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#pair(), Fn#tuple2()
-
Signature:
public static <A, B, C, R> List<R> zip(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three arrays into a single list using the provided zip function.
-
Contract:
- If one array is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
c(C[]) — the third array to zip -
valueForNoneA(A) — the default value to use if the first array is shorter -
valueForNoneB(B) — the default value to use if the second array is shorter -
valueForNoneC(C) — the default value to use if the third array is shorter -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three arrays
-
- Returns: a list containing the zipped elements (an empty list is returned if any input array is {@code null} or empty)
- See also: Fn#triple(), Fn#tuple3()
-
Signature:
public static <A, B, C, R> List<R> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterables into a single list using the provided zip function.
-
Contract:
- If one iterable is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(Iterable<A>) — the first iterable to zip -
b(Iterable<B>) — the second iterable to zip -
c(Iterable<C>) — the third iterable to zip -
valueForNoneA(A) — the default value to use if the first iterable is shorter -
valueForNoneB(B) — the default value to use if the second iterable is shorter -
valueForNoneC(C) — the default value to use if the third iterable is shorter -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three iterables
-
- Returns: a list containing the zipped elements (an empty list is returned if any input iterable is {@code null} or empty)
- See also: Fn#triple(), Fn#tuple3()
-
Signature:
public static <A, B, R> R[] zip(final A[] a, final B[] b, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final Class<R> targetElementType) throws IllegalArgumentException - Summary: Zips two arrays into a single array using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two arrays -
targetElementType(Class<R>) — the class of the resulting array's element type
-
- Returns: an array containing the zipped elements (an empty array is returned if any input array is {@code null} or empty)
-
Throws:
-
java.lang.IllegalArgumentException— if targetElementType is {@code null}
-
-
Signature:
public static <A, B, R> R[] zip(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final Class<R> targetElementType) throws IllegalArgumentException - Summary: Zips two arrays into a single array using the provided zip function.
-
Contract:
- If one array is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
valueForNoneA(A) — the default value to use if the first array is shorter -
valueForNoneB(B) — the default value to use if the second array is shorter -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — a function that combines elements from the two arrays -
targetElementType(Class<R>) — the class of the resulting array's element type
-
- Returns: an array containing the zipped elements
-
Throws:
-
java.lang.IllegalArgumentException— if targetElementType is {@code null}
-
-
Signature:
public static <A, B, C, R> R[] zip(final A[] a, final B[] b, final C[] c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final Class<R> targetElementType) throws IllegalArgumentException - Summary: Zips three arrays into a single array using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
c(C[]) — the third array to zip -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three arrays -
targetElementType(Class<R>) — the class of the resulting array's element type
-
- Returns: an array containing the zipped elements (an empty array is returned if any input array is {@code null} or empty)
-
Throws:
-
java.lang.IllegalArgumentException— if targetElementType is {@code null}
-
-
Signature:
public static <A, B, C, R> R[] zip(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final Class<R> targetElementType) throws IllegalArgumentException - Summary: Zips three arrays into a single array using the provided zip function.
-
Contract:
- If one array is shorter, the provided default values are used for the remaining elements.
-
Parameters:
-
a(A[]) — the first array to zip -
b(B[]) — the second array to zip -
c(C[]) — the third array to zip -
valueForNoneA(A) — the default value to use if the first array is shorter -
valueForNoneB(B) — the default value to use if the second array is shorter -
valueForNoneC(C) — the default value to use if the third array is shorter -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — a function that combines elements from the three arrays -
targetElementType(Class<R>) — the class of the resulting array's element type
-
- Returns: an array containing the zipped elements
-
Throws:
-
java.lang.IllegalArgumentException— if targetElementType is {@code null}
-
unzip(...) -> Pair<List<A>, List<B>>
-
Signature:
public static <T, A, B> Pair<List<A>, List<B>> unzip(final Iterable<? extends T> c, final BiConsumer<? super T, Pair<A, B>> unzip) - Summary: Unzips an iterable into two separate lists using the provided unzip function.
-
Parameters:
-
c(Iterable<? extends T>) — the input iterable to unzip -
unzip(BiConsumer<? super T, Pair<A, B>>) — a function that takes an element from the input iterable and a pair, and populates the pair with the unzipped values
-
- Returns: a pair of lists, where the first list contains the first elements and the second list contains the second elements
-
Signature:
public static <T, A, B, LC extends Collection<A>, RC extends Collection<B>> Pair<LC, RC> unzip(final Iterable<? extends T> c, final BiConsumer<? super T, Pair<A, B>> unzip, final IntFunction<? extends Collection<?>> supplier) - Summary: Unzips an iterable into two separate collections using the provided unzip function.
-
Parameters:
-
c(Iterable<? extends T>) — the input iterable to unzip -
unzip(BiConsumer<? super T, Pair<A, B>>) — a function that takes an element from the input iterable and a pair, and populates the pair with the unzipped values -
supplier(IntFunction<? extends Collection<?>>) — a function that provides new instances of the output collections
-
- Returns: a pair of lists, where the first collection contains the first elements and the second collection contains the second elements
unzip3(...) -> Triple<List<A>, List<B>, List<C>>
-
Signature:
@Deprecated public static <T, A, B, C> Triple<List<A>, List<B>, List<C>> unzip3(final Iterable<? extends T> c, final BiConsumer<? super T, Triple<A, B, C>> unzip) - Summary: Unzips an iterable into three separate lists using the provided unzip function.
-
Parameters:
-
c(Iterable<? extends T>) — the input iterable to unzip -
unzip(BiConsumer<? super T, Triple<A, B, C>>) — a function that takes an element from the input iterable and a triple, and populates the triple with the unzipped values
-
- Returns: a triple of lists, where the first list contains the first elements, the second list contains the second elements and the third list contains the third elements
- See also: TriIterator#unzip(Iterable, BiConsumer), TriIterator#toMultiList(Supplier), TriIterator#toMultiSet(Supplier)
-
Signature:
@Deprecated public static <T, A, B, C, LC extends Collection<A>, MC extends Collection<B>, RC extends Collection<C>> Triple<LC, MC, RC> unzip3( final Iterable<? extends T> c, final BiConsumer<? super T, Triple<A, B, C>> unzip, final IntFunction<? extends Collection<?>> supplier) - Summary: Unzips an iterable into three separate collections using the provided unzip function.
-
Parameters:
-
c(Iterable<? extends T>) — the input iterable to unzip -
unzip(BiConsumer<? super T, Triple<A, B, C>>) — a function that takes an element from the input iterable and a triple, and populates the triple with the unzipped values -
supplier(IntFunction<? extends Collection<?>>) — a function that provides new instances of the output collections
-
- Returns: a triple of collections, where the first collection contains the first elements, the second collection contains the second elements and the third collection contains the third elements
- See also: TriIterator#unzip(Iterable, BiConsumer), TriIterator#toMultiList(Supplier), TriIterator#toMultiSet(Supplier)
groupBy(...) -> Map<K, List<T>>
-
Signature:
@Beta public static <T, K> Map<K, List<T>> groupBy(final T[] a, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map grouping elements by keys extracted from each element.
-
Parameters:
-
a(T[]) — the array -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys
-
- Returns: a map with keys and lists of elements sharing each key (empty if array is {@code null} /empty)
- See also: #groupBy(Object\[\], Function, Supplier)
-
Signature:
@Beta public static <T, K, M extends Map<K, List<T>>> M groupBy(final T[] a, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys extracted from each element (map created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of elements sharing each key (empty if array is {@code null} /empty)
- See also: #groupBy(Object\[\], Function)
-
Signature:
@Beta public static <T, K> Map<K, List<T>> groupBy(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map grouping elements in the specified range by keys extracted from each element.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys
-
- Returns: a map with keys and lists of elements sharing each key (empty if array is {@code null} /empty or range is empty)
- See also: #groupBy(Object\[\], int, int, Function, Supplier)
-
Signature:
@Beta public static <T, K, M extends Map<K, List<T>>> M groupBy(final T[] a, final int fromIndex, final int toIndex, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) throws IndexOutOfBoundsException - Summary: Returns a map grouping elements in the specified range by keys extracted from each element (map created by the provided supplier).
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of elements sharing each key (empty if array is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #groupBy(Object\[\], int, int, Function)
-
Signature:
@Beta public static <T, K> Map<K, List<T>> groupBy(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map grouping elements in the specified range by keys extracted from each element.
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys
-
- Returns: a map with keys and lists of elements sharing each key (empty if collection is {@code null} /empty or range is empty)
- See also: #groupBy(Collection, int, int, Function, Supplier)
-
Signature:
@Beta public static <T, K, M extends Map<K, List<T>>> M groupBy(final Collection<? extends T> c, final int fromIndex, final int toIndex, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) throws IndexOutOfBoundsException - Summary: Returns a map grouping elements in the specified range by keys extracted from each element (map created by the provided supplier).
-
Parameters:
-
c(Collection<? extends T>) — the collection -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of elements sharing each key (empty if collection is {@code null} /empty or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > c.size() || fromIndex > toIndex}
-
- See also: #groupBy(Collection, int, int, Function)
-
Signature:
@Beta public static <T, K> Map<K, List<T>> groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map grouping elements by keys extracted from each element.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys
-
- Returns: a map with keys and lists of elements sharing each key (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function, Supplier)
-
Signature:
@Beta public static <T, K, M extends Map<K, List<T>>> M groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys extracted from each element (map created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of elements sharing each key (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function)
-
Signature:
@Beta public static <T, K> Map<K, List<T>> groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map grouping elements by keys extracted from each element.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys
-
- Returns: a map with keys and lists of elements sharing each key (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function, Supplier)
-
Signature:
@Beta public static <T, K, M extends Map<K, List<T>>> M groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys extracted from each element (map created by the provided supplier).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of elements sharing each key (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function)
-
Signature:
@Beta public static <T, K, V> Map<K, List<V>> groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends V> valueExtractor) - Summary: Returns a map grouping elements by keys, with values transformed by a function.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
valueExtractor(Function<? super T, ? extends V>) — the function to transform values
-
- Returns: a map with keys and lists of transformed values (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function, Function, Supplier)
-
Signature:
@Beta public static <T, K, V, M extends Map<K, List<V>>> M groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends V> valueExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys, with values transformed by a function (map created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
valueExtractor(Function<? super T, ? extends V>) — the function to transform values -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of transformed values (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function, Function)
-
Signature:
@Beta public static <T, K, V> Map<K, List<V>> groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends V> valueExtractor) - Summary: Returns a map grouping elements by keys, with values transformed by a function.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
valueExtractor(Function<? super T, ? extends V>) — the function to transform values
-
- Returns: a map with keys and lists of transformed values (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function, Function, Supplier)
-
Signature:
@Beta public static <T, K, V, M extends Map<K, List<V>>> M groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends V> valueExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys, with values transformed by a function (map created by the provided supplier).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
valueExtractor(Function<? super T, ? extends V>) — the function to transform values -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and lists of transformed values (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function, Function)
-
Signature:
@Beta public static <T, K, R> Map<K, R> groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Collector<? super T, ?, R> collector) - Summary: Returns a map grouping elements by keys, with values aggregated using a collector.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
collector(Collector<? super T, ?, R>) — the collector to aggregate grouped values
-
- Returns: a map with keys and aggregated values (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function, Collector, Supplier), java.util.stream.Collectors
-
Signature:
@Beta public static <T, K, R, M extends Map<K, R>> M groupBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Collector<? super T, ?, R> collector, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys, with values aggregated using a collector (map created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
collector(Collector<? super T, ?, R>) — the collector to aggregate grouped values -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and aggregated values (empty if iterable is {@code null} /empty)
- See also: #groupBy(Iterable, Function, Collector), java.util.stream.Collectors
-
Signature:
@Beta public static <K, T, R> Map<K, R> groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Collector<? super T, ?, R> collector) - Summary: Returns a map grouping elements by keys, with values aggregated using a collector.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
collector(Collector<? super T, ?, R>) — the collector to aggregate grouped values
-
- Returns: a map with keys and aggregated values (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function, Collector, Supplier), java.util.stream.Collectors
-
Signature:
@Beta public static <K, T, R, M extends Map<K, R>> M groupBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Collector<? super T, ?, R> collector, final Supplier<M> mapSupplier) - Summary: Returns a map grouping elements by keys, with values aggregated using a collector (map created by the provided supplier).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract grouping keys -
collector(Collector<? super T, ?, R>) — the collector to aggregate grouped values -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and aggregated values (empty if iterator is {@code null} or has no elements)
- See also: #groupBy(Iterator, Function, Collector), java.util.stream.Collectors
countBy(...) -> Map<K, Integer>
-
Signature:
@Beta public static <T, K> Map<K, Integer> countBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map counting occurrences of each key extracted from elements.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract counting keys
-
- Returns: a map with keys and their occurrence counts (empty if iterable is {@code null} /empty)
- See also: #countBy(Iterable, Function, Supplier), #groupBy(Iterable, Function)
-
Signature:
@Beta public static <T, K, M extends Map<K, Integer>> M countBy(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map counting occurrences of each key extracted from elements (map created by the provided supplier).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable -
keyExtractor(Function<? super T, ? extends K>) — the function to extract counting keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and their occurrence counts (empty if iterable is {@code null} /empty)
- See also: #countBy(Iterable, Function), #groupBy(Iterable, Function, Supplier)
-
Signature:
@Beta public static <T, K> Map<K, Integer> countBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor) - Summary: Returns a map counting occurrences of each key extracted from elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract counting keys
-
- Returns: a map with keys and their occurrence counts (empty if iterator is {@code null} or has no elements)
- See also: #countBy(Iterator, Function, Supplier), #groupBy(Iterator, Function)
-
Signature:
@Beta public static <T, K, M extends Map<K, Integer>> M countBy(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyExtractor, final Supplier<M> mapSupplier) - Summary: Returns a map counting occurrences of each key extracted from elements (map created by the provided supplier).
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator (will be consumed) -
keyExtractor(Function<? super T, ? extends K>) — the function to extract counting keys -
mapSupplier(Supplier<M>) — the supplier to create the result map
-
- Returns: a map with keys and their occurrence counts (empty if iterator is {@code null} or has no elements)
- See also: #countBy(Iterator, Function), #groupBy(Iterator, Function, Supplier)
iterate(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> iterate(final T[] a) - Summary: Returns an iterator over array elements.
-
Parameters:
-
a(T[]) — the array
-
- Returns: an iterator over the array elements (empty if array is {@code null} /empty)
- See also: #iterate(Object\[\], int, int), ObjIterator#of(Object\[\])
-
Signature:
@Beta public static <T> Iterator<T> iterate(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an iterator over elements in the specified range.
-
Parameters:
-
a(T[]) — the array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: an iterator over the specified range (empty if array is {@code null} or range is empty)
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > a.length || fromIndex > toIndex}
-
- See also: #iterate(Object\[\]), ObjIterator#of(Object\[\], int, int)
-
Signature:
@Beta public static <K, V> Iterator<Map.Entry<K, V>> iterate(final Map<K, V> map) - Summary: Returns an iterator over map entries.
-
Parameters:
-
map(Map<K, V>) — the map
-
- Returns: an iterator over the map entries (empty if map is {@code null} /empty)
- See also: Map#entrySet()
-
Signature:
@Beta public static <T> Iterator<T> iterate(final Iterable<? extends T> c) - Summary: Returns an iterator over iterable elements.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable
-
- Returns: an iterator over the iterable elements (empty if iterable is {@code null} )
- See also: Iterable#iterator(), ObjIterator#of(Iterable)
iterateEach(...) -> List<Iterator<T>>
-
Signature:
@Beta public static <T> List<Iterator<T>> iterateEach(final Collection<? extends Iterable<? extends T>> iterables) - Summary: Returns a list of iterators, one for each iterable in the collection.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterables
-
- Returns: a list containing one iterator for each iterable (empty if collection is {@code null} /empty)
- See also: #iterateAll(Collection), #iterate(Iterable)
iterateAll(...) -> ObjIterator<T>
-
Signature:
@Beta public static <T> ObjIterator<T> iterateAll(final Collection<? extends Iterable<? extends T>> iterables) - Summary: Returns a single iterator that sequentially iterates over all elements from all iterables.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterables to concatenate
-
- Returns: a single iterator over all elements (empty if collection is {@code null} /empty)
- See also: #iterateEach(Collection), #concat(Iterable...), Iterators#concatIterables(Collection)
disjoint(...) -> boolean
-
Signature:
public static boolean disjoint(final Object[] a, final Object[] b) - Summary: Returns {@code true} if the two arrays have no elements in common.
-
Contract:
- Returns {@code true} if the two arrays have no elements in common.
-
Parameters:
-
a(Object[]) — the first array -
b(Object[]) — the second array
-
- Returns: {@code true} if the arrays have no common elements ( {@code true} if either array is {@code null} /empty)
- See also: #disjoint(Collection, Collection), Collections#disjoint(Collection, Collection)
-
Signature:
public static boolean disjoint(final Collection<?> c1, final Collection<?> c2) - Summary: Returns {@code true} if the two collections have no elements in common.
-
Contract:
- Returns {@code true} if the two collections have no elements in common.
-
Parameters:
-
c1(Collection<?>) — the first collection -
c2(Collection<?>) — the second collection
-
- Returns: {@code true} if the collections have no common elements ( {@code true} if either collection is {@code null} /empty)
- See also: #disjoint(Object\[\], Object\[\]), Collections#disjoint(Collection, Collection)
toJson(...) -> String
-
Signature:
public static String toJson(final Object obj) - Summary: Returns the JSON string representation of the object.
-
Parameters:
-
obj(Object) — the object to serialize
-
- Returns: the JSON string representation (returns the string {@code "null"} if the object is {@code null} )
- See also: #toJson(Object, boolean), #toJson(Object, JsonSerializationConfig), #fromJson(String, Class)
-
Signature:
public static String toJson(final Object obj, final boolean prettyFormat) - Summary: Returns the JSON string representation of the object with optional pretty formatting.
-
Parameters:
-
obj(Object) — the object to serialize -
prettyFormat(boolean) — {@code true} for formatted output with indentation
-
- Returns: the JSON string representation (returns the string {@code "null"} if the object is {@code null} )
- See also: #toJson(Object), #toJson(Object, JsonSerializationConfig)
-
Signature:
public static String toJson(final Object obj, final JsonSerializationConfig config) - Summary: Returns the JSON string representation of the object using the specified configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(JsonSerializationConfig) — the serialization configuration
-
- Returns: the JSON string representation (returns the string {@code "null"} if the object is {@code null} )
- See also: #toJson(Object), #toJson(Object, boolean)
-
Signature:
public static void toJson(final Object obj, final File output) - Summary: Writes the JSON representation of the object to the specified file.
-
Parameters:
-
obj(Object) — the object to serialize -
output(File) — the file to write to (created if nonexistent, overwritten if exists)
-
- See also: #toJson(Object, JsonSerializationConfig, File), #fromJson(File, Class)
-
Signature:
public static void toJson(final Object obj, final JsonSerializationConfig config, final File output) - Summary: Writes the JSON representation of the object to the specified file using the given configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(JsonSerializationConfig) — the serialization configuration -
output(File) — the file to write to (created if nonexistent, overwritten if exists)
-
- See also: #toJson(Object, File)
-
Signature:
public static void toJson(final Object obj, final OutputStream output) - Summary: Writes the JSON representation of the object to the specified output stream.
-
Parameters:
-
obj(Object) — the object to serialize -
output(OutputStream) — the output stream to write to
-
- See also: #toJson(Object, JsonSerializationConfig, OutputStream)
-
Signature:
public static void toJson(final Object obj, final JsonSerializationConfig config, final OutputStream output) - Summary: Writes the JSON representation of the object to the specified output stream using the given configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(JsonSerializationConfig) — the serialization configuration -
output(OutputStream) — the output stream to write to
-
- See also: #toJson(Object, OutputStream)
-
Signature:
public static void toJson(final Object obj, final Writer output) - Summary: Writes the JSON representation of the object to the specified writer.
-
Parameters:
-
obj(Object) — the object to serialize -
output(Writer) — the writer to write to
-
- See also: #toJson(Object, JsonSerializationConfig, Writer)
-
Signature:
public static void toJson(final Object obj, final JsonSerializationConfig config, final Writer output) - Summary: Writes the JSON representation of the object to the specified writer using the given configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(JsonSerializationConfig) — the serialization configuration -
output(Writer) — the writer to write to
-
- See also: #toJson(Object, Writer)
fromJson(...) -> T
-
Signature:
public static <T> T fromJson(final String json, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string.
-
Parameters:
-
json(String) — the JSON string to deserialize -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromJson(String, Type), #toJson(Object)
-
Signature:
public static <T> T fromJson(final String json, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string using the specified Type.
-
Parameters:
-
json(String) — the JSON string to deserialize -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromJson(String, Class), TypeReference
-
Signature:
public static <T> T fromJson(final String json, final T defaultIfNull, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string, or a default value if the result is {@code null} .
-
Contract:
- Returns an object deserialized from the JSON string, or a default value if the result is {@code null} .
-
Parameters:
-
json(String) — the JSON string to deserialize -
defaultIfNull(T) — the value to return if deserialization produces {@code null} -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object or the default value
- See also: #fromJson(String, Object, Type), #fromJson(String, Class)
-
Signature:
public static <T> T fromJson(final String json, final T defaultIfNull, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string using the specified Type, or a default value if the result is {@code null} .
-
Contract:
- Returns an object deserialized from the JSON string using the specified Type, or a default value if the result is {@code null} .
-
Parameters:
-
json(String) — the JSON string to deserialize -
defaultIfNull(T) — the value to return if deserialization produces {@code null} -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object or the default value
- See also: #fromJson(String, Object, Class), #fromJson(String, Type)
-
Signature:
public static <T> T fromJson(final String json, final JsonDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string using the specified configuration.
-
Parameters:
-
json(String) — the JSON string to deserialize -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromJson(String, JsonDeserializationConfig, Type), #fromJson(String, Class)
-
Signature:
public static <T> T fromJson(final String json, final JsonDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the JSON string using the specified Type and configuration.
-
Parameters:
-
json(String) — the JSON string to deserialize -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromJson(String, JsonDeserializationConfig, Class), #fromJson(String, Type)
-
Signature:
public static <T> T fromJson(final File json, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the file.
-
Parameters:
-
json(File) — the file to read JSON from -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if file contains {@code "null"} )
- See also: #fromJson(File, Type), #toJson(Object, File)
-
Signature:
public static <T> T fromJson(final File json, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the file using the specified Type.
-
Parameters:
-
json(File) — the file to read JSON from -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if file contains {@code "null"} )
- See also: #fromJson(File, Class), TypeReference
-
Signature:
public static <T> T fromJson(final File json, final JsonDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the file using the specified configuration.
-
Parameters:
-
json(File) — the file to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if file contains {@code "null"} )
- See also: #fromJson(File, JsonDeserializationConfig, Type), #fromJson(File, Class)
-
Signature:
public static <T> T fromJson(final File json, final JsonDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the file using the specified Type and configuration.
-
Parameters:
-
json(File) — the file to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if file contains {@code "null"} )
- See also: #fromJson(File, JsonDeserializationConfig, Class), #fromJson(File, Type)
-
Signature:
public static <T> T fromJson(final InputStream json, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the input stream.
-
Parameters:
-
json(InputStream) — the input stream to read JSON from -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if stream contains {@code "null"} )
- See also: #fromJson(InputStream, Type), #toJson(Object, OutputStream)
-
Signature:
public static <T> T fromJson(final InputStream json, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the input stream using the specified Type.
-
Parameters:
-
json(InputStream) — the input stream to read JSON from -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if stream contains {@code "null"} )
- See also: #fromJson(InputStream, Class), TypeReference
-
Signature:
public static <T> T fromJson(final InputStream json, final JsonDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the input stream using the specified configuration.
-
Parameters:
-
json(InputStream) — the input stream to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if stream contains {@code "null"} )
- See also: #fromJson(InputStream, JsonDeserializationConfig, Type), #fromJson(InputStream, Class)
-
Signature:
public static <T> T fromJson(final InputStream json, final JsonDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the input stream using the specified Type and configuration.
-
Parameters:
-
json(InputStream) — the input stream to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if stream contains {@code "null"} )
- See also: #fromJson(InputStream, JsonDeserializationConfig, Class), #fromJson(InputStream, Type)
-
Signature:
public static <T> T fromJson(final Reader json, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the reader.
-
Parameters:
-
json(Reader) — the reader to read JSON from -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if reader contains {@code "null"} )
- See also: #fromJson(Reader, Type), #toJson(Object, Writer)
-
Signature:
public static <T> T fromJson(final Reader json, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the reader using the specified Type.
-
Parameters:
-
json(Reader) — the reader to read JSON from -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if reader contains {@code "null"} )
- See also: #fromJson(Reader, Class), TypeReference
-
Signature:
public static <T> T fromJson(final Reader json, final JsonDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the reader using the specified configuration.
-
Parameters:
-
json(Reader) — the reader to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if reader contains {@code "null"} )
- See also: #fromJson(Reader, JsonDeserializationConfig, Type), #fromJson(Reader, Class)
-
Signature:
public static <T> T fromJson(final Reader json, final JsonDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from JSON content in the reader using the specified Type and configuration.
-
Parameters:
-
json(Reader) — the reader to read JSON from -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if reader contains {@code "null"} )
- See also: #fromJson(Reader, JsonDeserializationConfig, Class), #fromJson(Reader, Type)
-
Signature:
public static <T> T fromJson(final String json, final int fromIndex, final int toIndex, final Class<? extends T> targetType) throws IndexOutOfBoundsException - Summary: Returns an object deserialized from a substring of the JSON string.
-
Parameters:
-
json(String) — the JSON string containing the data -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if substring is {@code "null"} )
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > json.length() || fromIndex > toIndex}
-
- See also: #fromJson(String, int, int, Type), #fromJson(String, Class)
-
Signature:
public static <T> T fromJson(final String json, final int fromIndex, final int toIndex, final Type<? extends T> targetType) throws IndexOutOfBoundsException - Summary: Returns an object deserialized from a substring of the JSON string using the specified Type.
-
Parameters:
-
json(String) — the JSON string containing the data -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if substring is {@code "null"} )
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > json.length() || fromIndex > toIndex}
-
- See also: #fromJson(String, int, int, Class), #fromJson(String, Type)
-
Signature:
public static <T> T fromJson(final String json, final int fromIndex, final int toIndex, final JsonDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from a substring of the JSON string using the specified configuration.
-
Parameters:
-
json(String) — the JSON string containing the data -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if substring is {@code "null"} )
- See also: #fromJson(String, int, int, JsonDeserializationConfig, Type), #fromJson(String, int, int, Class)
-
Signature:
public static <T> T fromJson(final String json, final int fromIndex, final int toIndex, final JsonDeserializationConfig config, final Type<? extends T> targetType) throws IndexOutOfBoundsException - Summary: Returns an object deserialized from a substring of the JSON string using the specified Type and configuration.
-
Parameters:
-
json(String) — the JSON string containing the data -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive) -
config(JsonDeserializationConfig) — the deserialization configuration -
targetType(Type<? extends T>) — the target Type (supports generics like {@code List<String>} )
-
- Returns: the deserialized object ( {@code null} if substring is {@code "null"} )
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0 || toIndex > json.length() || fromIndex > toIndex}
-
- See also: #fromJson(String, int, int, JsonDeserializationConfig, Class), #fromJson(String, int, int, Type)
streamJson(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> streamJson(final String jsonArray, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array string.
-
Parameters:
-
jsonArray(String) — the JSON array string -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if string is {@code null} or represents empty array)
- See also: #streamJson(String, JsonDeserializationConfig, Type), #fromJson(String, Type)
-
Signature:
public static <T> Stream<T> streamJson(final String jsonArray, final JsonDeserializationConfig config, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array string using the specified configuration.
-
Parameters:
-
jsonArray(String) — the JSON array string -
config(JsonDeserializationConfig) — the deserialization configuration -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if string is {@code null} or represents empty array)
- See also: #streamJson(String, Type)
-
Signature:
public static <T> Stream<T> streamJson(final File jsonArray, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the file.
-
Parameters:
-
jsonArray(File) — the JSON array file -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if file is {@code null} /nonexistent or contains empty array)
- See also: #streamJson(File, JsonDeserializationConfig, Type), #fromJson(File, Type)
-
Signature:
public static <T> Stream<T> streamJson(final File jsonArray, final JsonDeserializationConfig config, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the file using the specified configuration.
-
Parameters:
-
jsonArray(File) — the JSON array file -
config(JsonDeserializationConfig) — the deserialization configuration -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if file is {@code null} /nonexistent or contains empty array)
- See also: #streamJson(File, Type)
-
Signature:
public static <T> Stream<T> streamJson(final InputStream jsonArray, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the input stream.
-
Contract:
- <p> Note: The input stream is not closed when the returned stream is closed.
-
Parameters:
-
jsonArray(InputStream) — the JSON array input stream -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if stream is {@code null} or contains empty array)
- See also: #streamJson(InputStream, boolean, Type), #fromJson(InputStream, Type)
-
Signature:
public static <T> Stream<T> streamJson(final InputStream jsonArray, final boolean closeInputStreamWhenStreamIsClosed, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the input stream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code InputStream in = new FileInputStream("people.json"); Stream<Person> result = N.streamJson(in, true, new TypeReference<Person>(){}.type()); // Input stream will be closed when stream is closed } </pre>
-
Parameters:
-
jsonArray(InputStream) — the JSON array input stream -
closeInputStreamWhenStreamIsClosed(boolean) — {@code true} to close input stream with the stream -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if stream is {@code null} or contains empty array)
- See also: #streamJson(InputStream, JsonDeserializationConfig, boolean, Type)
-
Signature:
public static <T> Stream<T> streamJson(final InputStream jsonArray, final JsonDeserializationConfig config, final boolean closeInputStreamWhenStreamIsClosed, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the input stream using the specified configuration.
-
Parameters:
-
jsonArray(InputStream) — the JSON array input stream -
config(JsonDeserializationConfig) — the deserialization configuration -
closeInputStreamWhenStreamIsClosed(boolean) — {@code true} to close input stream with the stream -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if stream is {@code null} or contains empty array)
- See also: #streamJson(InputStream, boolean, Type)
-
Signature:
public static <T> Stream<T> streamJson(final Reader jsonArray, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the reader.
-
Contract:
- <p> Note: The reader is not closed when the returned stream is closed.
-
Parameters:
-
jsonArray(Reader) — the JSON array reader -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if reader is {@code null} or contains empty array)
- See also: #streamJson(Reader, boolean, Type), #fromJson(Reader, Type)
-
Signature:
public static <T> Stream<T> streamJson(final Reader jsonArray, final boolean closeReaderWhenStreamIsClosed, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Reader reader = new FileReader("people.json"); Stream<Person> result = N.streamJson(reader, true, new TypeReference<Person>(){}.type()); // Reader will be closed when stream is closed } </pre>
-
Parameters:
-
jsonArray(Reader) — the JSON array reader -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close reader with the stream -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if reader is {@code null} or contains empty array)
- See also: #streamJson(Reader, JsonDeserializationConfig, boolean, Type)
-
Signature:
public static <T> Stream<T> streamJson(final Reader jsonArray, final JsonDeserializationConfig config, final boolean closeReaderWhenStreamIsClosed, final Type<? extends T> elementType) - Summary: Returns a stream of elements deserialized from the JSON array in the reader using the specified configuration.
-
Parameters:
-
jsonArray(Reader) — the JSON array reader -
config(JsonDeserializationConfig) — the deserialization configuration -
closeReaderWhenStreamIsClosed(boolean) — {@code true} to close reader with the stream -
elementType(Type<? extends T>) — the target element Type
-
- Returns: a stream of deserialized elements (empty if reader is {@code null} or contains empty array)
- See also: #streamJson(Reader, boolean, Type)
formatJson(...) -> String
-
Signature:
public static String formatJson(final String json) - Summary: Returns the JSON string formatted with indentation and line breaks.
-
Parameters:
-
json(String) — the JSON string to format
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, JsonSerializationConfig), #toJson(Object, boolean)
-
Signature:
public static String formatJson(final String json, final Class<?> transferType) - Summary: Returns the JSON string formatted with indentation and line breaks, using type information for proper parsing.
-
Parameters:
-
json(String) — the JSON string to format -
transferType(Class<?>) — the type for deserialization
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, Type), #formatJson(String)
-
Signature:
public static String formatJson(final String json, final Type<?> transferType) - Summary: Returns the JSON string formatted with indentation and line breaks, using Type information for proper parsing.
-
Parameters:
-
json(String) — the JSON string to format -
transferType(Type<?>) — the Type for deserialization (supports generics like {@code List<String>} )
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, Class), TypeReference
-
Signature:
public static String formatJson(final String json, final JsonSerializationConfig config) - Summary: Returns the JSON string formatted using the specified configuration.
-
Parameters:
-
json(String) — the JSON string to format -
config(JsonSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set)
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, JsonSerializationConfig, Class), #formatJson(String)
-
Signature:
public static String formatJson(final String json, final JsonSerializationConfig config, final Type<?> transferType) - Summary: Returns the JSON string formatted using the specified configuration, with Type information for proper parsing.
-
Parameters:
-
json(String) — the JSON string to format -
config(JsonSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set) -
transferType(Type<?>) — the Type for deserialization (supports generics like {@code List<String>} )
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, JsonSerializationConfig, Class), TypeReference
-
Signature:
public static String formatJson(final String json, final JsonSerializationConfig config, final Class<?> transferType) - Summary: Returns the JSON string formatted using the specified configuration, with type information for proper parsing.
-
Parameters:
-
json(String) — the JSON string to format -
config(JsonSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set) -
transferType(Class<?>) — the type for deserialization
-
- Returns: the formatted JSON string ( {@code null} if input is {@code null} )
- See also: #formatJson(String, JsonSerializationConfig, Type), #formatJson(String, Class)
toXml(...) -> String
-
Signature:
public static String toXml(final Object obj) - Summary: Returns the XML string representation of the object.
-
Parameters:
-
obj(Object) — the object to serialize
-
- Returns: the XML string representation ( {@code "null"} if object is {@code null} )
- See also: #toXml(Object, boolean), #toXml(Object, XmlSerializationConfig), #fromXml(String, Class)
-
Signature:
public static String toXml(final Object obj, final boolean prettyFormat) - Summary: Returns the XML string representation of the object with optional pretty formatting.
-
Parameters:
-
obj(Object) — the object to serialize -
prettyFormat(boolean) — {@code true} to format with indentation and line breaks
-
- Returns: the XML string representation ( {@code "null"} if object is {@code null} )
- See also: #toXml(Object), #toXml(Object, XmlSerializationConfig)
-
Signature:
public static String toXml(final Object obj, final XmlSerializationConfig config) - Summary: Returns the XML string representation of the object using the specified configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(XmlSerializationConfig) — the XML serialization configuration
-
- Returns: the XML string representation ( {@code "null"} if object is {@code null} )
- See also: #toXml(Object, boolean), #fromXml(String, XmlDeserializationConfig, Class)
-
Signature:
public static void toXml(final Object obj, final File output) - Summary: Writes the XML representation of the object to the specified file.
-
Parameters:
-
obj(Object) — the object to serialize -
output(File) — the file to write to (created if nonexistent, overwritten if exists)
-
- See also: #toXml(Object, XmlSerializationConfig, File), #fromXml(File, Class)
-
Signature:
public static void toXml(final Object obj, final XmlSerializationConfig config, final File output) - Summary: Writes the XML representation of the object to the specified file using the configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(XmlSerializationConfig) — the XML serialization configuration -
output(File) — the file to write to (created if nonexistent, overwritten if exists)
-
- See also: #toXml(Object, File), #fromXml(File, XmlDeserializationConfig, Class)
-
Signature:
public static void toXml(final Object obj, final OutputStream output) - Summary: Writes the XML representation of the object to the specified output stream.
-
Parameters:
-
obj(Object) — the object to serialize -
output(OutputStream) — the output stream to write to
-
- See also: #toXml(Object, XmlSerializationConfig, OutputStream), #fromXml(InputStream, Class)
-
Signature:
public static void toXml(final Object obj, final XmlSerializationConfig config, final OutputStream output) - Summary: Writes the XML representation of the object to the specified output stream using the configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(XmlSerializationConfig) — the XML serialization configuration -
output(OutputStream) — the output stream to write to
-
- See also: #toXml(Object, OutputStream), #fromXml(InputStream, XmlDeserializationConfig, Class)
-
Signature:
public static void toXml(final Object obj, final Writer output) - Summary: Writes the XML representation of the object to the specified writer.
-
Parameters:
-
obj(Object) — the object to serialize -
output(Writer) — the writer to write to
-
- See also: #toXml(Object, XmlSerializationConfig, Writer), #fromXml(Reader, Class)
-
Signature:
public static void toXml(final Object obj, final XmlSerializationConfig config, final Writer output) - Summary: Writes the XML representation of the object to the specified writer using the configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(XmlSerializationConfig) — the XML serialization configuration -
output(Writer) — the writer to write to
-
- See also: #toXml(Object, Writer), #fromXml(Reader, XmlDeserializationConfig, Class)
fromXml(...) -> T
-
Signature:
public static <T> T fromXml(final String xml, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML string.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(String, Type), #toXml(Object)
-
Signature:
public static <T> T fromXml(final String xml, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML string with generic type support.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(String, Class), TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final XmlDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML string using the specified configuration.
-
Parameters:
-
xml(String) — the XML string to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(String, Class), #toXml(Object, XmlSerializationConfig)
-
Signature:
public static <T> T fromXml(final String xml, final XmlDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML string using the configuration with generic type support.
-
Parameters:
-
xml(String) — the XML string to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(String, Type), TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML file.
-
Parameters:
-
xml(File) — the file containing XML to deserialize -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(File, Type), #toXml(Object, File)
-
Signature:
public static <T> T fromXml(final File xml, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML file with generic type support.
-
Parameters:
-
xml(File) — the file containing XML to deserialize -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(File, Class), TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final XmlDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML file using the specified configuration.
-
Parameters:
-
xml(File) — the file containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(File, Class), #toXml(Object, XmlSerializationConfig, File)
-
Signature:
public static <T> T fromXml(final File xml, final XmlDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML file using the configuration with generic type support.
-
Parameters:
-
xml(File) — the file containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(File, Type), TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML input stream.
-
Parameters:
-
xml(InputStream) — the input stream containing XML to deserialize -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(InputStream, Type), #toXml(Object, OutputStream)
-
Signature:
public static <T> T fromXml(final InputStream xml, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML input stream with generic type support.
-
Parameters:
-
xml(InputStream) — the input stream containing XML to deserialize -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(InputStream, Class), TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final XmlDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML input stream using the specified configuration.
-
Parameters:
-
xml(InputStream) — the input stream containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(InputStream, Class), #toXml(Object, XmlSerializationConfig, OutputStream)
-
Signature:
public static <T> T fromXml(final InputStream xml, final XmlDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML input stream using the configuration with generic type support.
-
Parameters:
-
xml(InputStream) — the input stream containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(InputStream, Type), TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML reader.
-
Parameters:
-
xml(Reader) — the reader containing XML to deserialize -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(Reader, Type), #toXml(Object, Writer)
-
Signature:
public static <T> T fromXml(final Reader xml, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML reader with generic type support.
-
Parameters:
-
xml(Reader) — the reader containing XML to deserialize -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(Reader, Class), TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final XmlDeserializationConfig config, final Class<? extends T> targetType) - Summary: Returns an object deserialized from the XML reader using the specified configuration.
-
Parameters:
-
xml(Reader) — the reader containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Class<? extends T>) — the target class type
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(Reader, Class), #toXml(Object, XmlSerializationConfig, Writer)
-
Signature:
public static <T> T fromXml(final Reader xml, final XmlDeserializationConfig config, final Type<? extends T> targetType) - Summary: Returns an object deserialized from the XML reader using the configuration with generic type support.
-
Parameters:
-
xml(Reader) — the reader containing XML to deserialize -
config(XmlDeserializationConfig) — the XML deserialization configuration -
targetType(Type<? extends T>) — the target Type with generic information
-
- Returns: the deserialized object ( {@code null} if the input represents null)
- See also: #fromXml(Reader, Type), TypeReference
formatXml(...) -> String
-
Signature:
public static String formatXml(final String xml) - Summary: Returns the XML string formatted with indentation and line breaks.
-
Parameters:
-
xml(String) — the XML string to format
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, Class), #toXml(Object, boolean)
-
Signature:
public static String formatXml(final String xml, final Class<?> transferType) - Summary: Returns the XML string formatted with indentation and line breaks, using type information for proper parsing.
-
Parameters:
-
xml(String) — the XML string to format -
transferType(Class<?>) — the type for deserialization during formatting
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, Type), #formatXml(String)
-
Signature:
public static String formatXml(final String xml, final Type<?> transferType) - Summary: Returns the XML string formatted with indentation and line breaks, with generic type support.
-
Parameters:
-
xml(String) — the XML string to format -
transferType(Type<?>) — the Type for deserialization during formatting with generic information
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, Class), TypeReference
-
Signature:
public static String formatXml(final String xml, final XmlSerializationConfig config) - Summary: Returns the XML string formatted using the specified configuration.
-
Parameters:
-
xml(String) — the XML string to format -
config(XmlSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set)
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, XmlSerializationConfig, Class), #formatXml(String)
-
Signature:
public static String formatXml(final String xml, final XmlSerializationConfig config, final Class<?> transferType) - Summary: Returns the XML string formatted using the specified configuration, with type information for proper parsing.
-
Parameters:
-
xml(String) — the XML string to format -
config(XmlSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set) -
transferType(Class<?>) — the type for deserialization during formatting
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, XmlSerializationConfig, Type), #formatXml(String, Class)
-
Signature:
public static String formatXml(final String xml, final XmlSerializationConfig config, final Type<?> transferType) - Summary: Returns the XML string formatted using the specified configuration with generic type support.
-
Parameters:
-
xml(String) — the XML string to format -
config(XmlSerializationConfig) — the serialization configuration (pretty formatting enabled automatically if not set) -
transferType(Type<?>) — the Type for deserialization during formatting with generic information
-
- Returns: the formatted XML string ( {@code null} if the input is {@code null} )
- See also: #formatXml(String, XmlSerializationConfig, Class), TypeReference
xmlToJson(...) -> String
-
Signature:
public static String xmlToJson(final String xml) - Summary: Returns the JSON string representation converted from the XML string.
-
Parameters:
-
xml(String) — the XML string to convert
-
- Returns: the JSON string representation ( {@code null} if the input is {@code null} )
- See also: #xmlToJson(String, Class), #jsonToXml(String)
-
Signature:
public static String xmlToJson(final String xml, final Class<?> transferType) - Summary: Returns the JSON string representation converted from the XML string using an intermediate type.
-
Parameters:
-
xml(String) — the XML string to convert -
transferType(Class<?>) — the intermediate type for parsing during conversion (must be Bean or Map type)
-
- Returns: the JSON string representation ( {@code null} if the input is {@code null} )
- See also: #xmlToJson(String), #jsonToXml(String, Class)
jsonToXml(...) -> String
-
Signature:
public static String jsonToXml(final String json) - Summary: Returns the XML string representation converted from the JSON string.
-
Parameters:
-
json(String) — the JSON string to convert
-
- Returns: the XML string representation ( {@code null} if the input is {@code null} )
- See also: #jsonToXml(String, Class), #xmlToJson(String)
-
Signature:
public static String jsonToXml(final String json, final Class<?> transferType) - Summary: Returns the XML string representation converted from the JSON string using an intermediate type.
-
Parameters:
-
json(String) — the JSON string to convert -
transferType(Class<?>) — the intermediate type for parsing during conversion (must be Bean or Map type)
-
- Returns: the XML string representation ( {@code null} if the input is {@code null} )
- See also: #jsonToXml(String), #xmlToJson(String, Class)
forEach(...) -> void
-
Signature:
public static <E extends Exception> void forEach(final int startInclusive, final int endExclusive, final Throwables.Runnable<E> action) throws E - Summary: Executes the action for each value in the integer range \[startInclusive, endExclusive).
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
action(Throwables.Runnable<E>) — the action to execute for each iteration
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(int, int, int, Throwables.Runnable), #forEach(int, int, Throwables.IntConsumer)
-
Signature:
public static <E extends Exception> void forEach(final int startInclusive, final int endExclusive, final int step, final Throwables.Runnable<E> action) throws IllegalArgumentException, E - Summary: Executes the action for each value in the integer range with the specified step.
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
step(int) — the step increment (positive or negative, but not zero) -
action(Throwables.Runnable<E>) — the action to execute for each iteration
-
-
Throws:
-
java.lang.IllegalArgumentException— if step is zero -
E— if the action throws an exception
-
- See also: #forEach(int, int, Throwables.Runnable), #forEach(int, int, int, Throwables.IntConsumer)
-
Signature:
public static <E extends Exception> void forEach(final int startInclusive, final int endExclusive, final Throwables.IntConsumer<E> action) throws E - Summary: Executes the action for each value in the integer range \[startInclusive, endExclusive).
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
action(Throwables.IntConsumer<E>) — the action to execute, receiving each index value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(int, int, int, Throwables.IntConsumer), #forEach(int, int, Throwables.Runnable)
-
Signature:
public static <E extends Exception> void forEach(final int startInclusive, final int endExclusive, final int step, final Throwables.IntConsumer<E> action) throws E - Summary: Executes the action for each value in the integer range with the specified step.
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
step(int) — the step increment (positive or negative, but not zero) -
action(Throwables.IntConsumer<E>) — the action to execute, receiving each index value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(int, int, Throwables.IntConsumer), #forEach(int, int, int, Throwables.Runnable)
-
Signature:
public static <T, E extends Exception> void forEach(final int startInclusive, final int endExclusive, final T a, final Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Executes the action for each value in the integer range, passing the index and an object.
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
a(T) — the object to pass to the action -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and object
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(int, int, int, Object, Throwables.IntObjConsumer)
-
Signature:
public static <T, E extends Exception> void forEach(final int startInclusive, final int endExclusive, final int step, final T a, final Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Executes the action for each value in the integer range with the specified step, passing the index and an object.
-
Parameters:
-
startInclusive(int) — the start of the range (inclusive) -
endExclusive(int) — the end of the range (exclusive) -
step(int) — the step increment (positive or negative, but not zero) -
a(T) — the object to pass to the action -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and object
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(int, int, Object, Throwables.IntObjConsumer)
-
Signature:
public static <T, E extends Exception> void forEach(final T[] a, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each element in the array.
-
Parameters:
-
a(T[]) — the array to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Object\[\], int, int, Throwables.Consumer), #forEach(Iterable, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEach(final T[] a, final int fromIndex, final int toIndex, final Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, E - Summary: Executes the action for each element in the array within the specified range.
-
Parameters:
-
a(T[]) — the array to iterate -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
action(Throwables.Consumer<? super T, E>) — the action to execute for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds -
E— if the action throws an exception
-
- See also: #forEach(Object\[\], Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterable<? extends T> c, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each element in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterator, Throwables.Consumer), #forEach(Object\[\], Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each element in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEach(final Collection<? extends T> c, int fromIndex, final int toIndex, final Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, E - Summary: Executes the action for each element in the collection within the specified range.
-
Parameters:
-
c(Collection<? extends T>) — the collection to iterate -
fromIndex(int) — the start index (inclusive) -
toIndex(int) — the end index (exclusive) -
action(Throwables.Consumer<? super T, E>) — the action to execute for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds -
E— if the action throws an exception
-
- See also: #forEach(Iterable, Throwables.Consumer)
-
Signature:
public static <K, V, E extends Exception> void forEach(final Map<K, V> map, final Throwables.Consumer<? super Map.Entry<K, V>, E> action) throws E - Summary: Executes the action for each entry in the map.
-
Parameters:
-
map(Map<K, V>) — the map to iterate -
action(Throwables.Consumer<? super Map.Entry<K, V>, E>) — the action to execute for each entry
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Map, Throwables.BiConsumer)
-
Signature:
public static <K, V, E extends Exception> void forEach(final Map<K, V> map, final Throwables.BiConsumer<? super K, ? super V, E> action) throws E - Summary: Executes the action for each key-value pair in the map.
-
Parameters:
-
map(Map<K, V>) — the map to iterate -
action(Throwables.BiConsumer<? super K, ? super V, E>) — the action to execute, receiving key and value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Map, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterable<? extends T> c, final Throwables.Consumer<? super T, E> elementConsumer, final int processThreadNum) - Summary: Executes the action for each element in the iterable using parallel processing.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
elementConsumer(Throwables.Consumer<? super T, E>) — the action to execute for each element -
processThreadNum(int) — the number of threads for parallel processing
-
- See also: #forEach(Iterable, Throwables.Consumer, int, Executor)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterable<? extends T> c, final Throwables.Consumer<? super T, E> elementConsumer, final int processThreadNum, final Executor executor) - Summary: Executes the action for each element in the iterable using parallel processing with a custom executor.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
elementConsumer(Throwables.Consumer<? super T, E>) — the action to execute for each element -
processThreadNum(int) — the number of threads for parallel processing -
executor(Executor) — the executor for thread management
-
- See also: #forEach(Iterable, Throwables.Consumer, int)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> elementConsumer, final int processThreadNum) - Summary: Executes the action for each element in the iterator using parallel processing.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
elementConsumer(Throwables.Consumer<? super T, E>) — the action to execute for each element -
processThreadNum(int) — the number of threads for parallel processing
-
- See also: #forEach(Iterator, Throwables.Consumer, int, Executor)
-
Signature:
public static <T, E extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> elementConsumer, final int processThreadNum, final Executor executor) - Summary: Executes the action for each element in the iterator using parallel processing with a custom executor.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
elementConsumer(Throwables.Consumer<? super T, E>) — the action to execute for each element -
processThreadNum(int) — the number of threads for parallel processing -
executor(Executor) — the executor for thread management
-
- See also: #forEach(Iterator, Throwables.Consumer, int)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEach(final T[] a, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each element in the array paired with elements from a mapped iterable.
-
Parameters:
-
a(T[]) — the array to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each element (skips {@code null} results) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Iterable, Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEach(final Iterable<? extends T> c, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each element in the iterable paired with elements from a mapped iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each element (skips {@code null} results) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Object\[\], Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each element in the iterator paired with elements from a mapped iterable.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each element (skips {@code null} results) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Iterable, Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEach(final T[] a, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the provided {@code action} for each element in the given array after applying the {@code flatMapper} and {@code flatMapper2} functions.
-
Parameters:
-
a(T[]) — the array whose elements are to be processed -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the function to apply to each element in given the array to produce an iterable of elements of type T2 -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3 -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to be performed for each triple of elements from the given array and the resulting iterables
-
-
Throws:
-
E— if the flatMapper throws an exception -
E2— if the flatMapper2 throws an exception -
E3— if the action throws an exception
-
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEach(final Iterable<? extends T> c, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the provided {@code action} for each element in the given iterable after applying the {@code flatMapper} and {@code flatMapper2} functions.
-
Parameters:
-
c(Iterable<? extends T>) — the collection whose elements are to be processed -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the function to apply to each element in the given iterable to produce an iterable of elements of type T2 -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3 -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to be performed for each triple of elements from the given iterable and the resulting iterables
-
-
Throws:
-
E— if the flatMapper throws an exception -
E2— if the flatMapper2 throws an exception -
E3— if the action throws an exception
-
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEach(final Iterator<? extends T> iter, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the provided {@code action} for each element in the given iterator after applying the {@code flatMapper} and {@code flatMapper2} functions.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator whose elements are to be processed -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the function to apply to each element in the given iterator to produce an iterable of elements of type T2 -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3 -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to be performed for each triple of elements from the given iterator and the resulting iterables
-
-
Throws:
-
E— if the flatMapper throws an exception -
E2— if the flatMapper2 throws an exception -
E3— if the action throws an exception
-
-
Signature:
public static <A, B, E extends Exception> void forEach(final A[] a, final B[] b, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given arrays until all elements from the shorter array are processed.
-
Parameters:
-
a(A[]) — the first array whose elements are to be processed -
b(B[]) — the second array whose elements are to be processed -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the arrays
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Iterable, Throwables.BiConsumer), #forEach(Iterator, Iterator, Throwables.BiConsumer)
-
Signature:
public static <A, B, E extends Exception> void forEach(final Iterable<A> a, final Iterable<B> b, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given iterables until all elements from the shorter iterable are processed.
-
Parameters:
-
a(Iterable<A>) — the first iterable whose elements are to be processed -
b(Iterable<B>) — the second iterable whose elements are to be processed -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the iterables
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Object\[\], Object\[\], Throwables.BiConsumer), #forEach(Iterator, Iterator, Throwables.BiConsumer)
-
Signature:
public static <A, B, E extends Exception> void forEach(final Iterator<A> a, final Iterator<B> b, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given iterators until all elements from the shorter iterator are processed.
-
Parameters:
-
a(Iterator<A>) — the first iterator whose elements are to be processed -
b(Iterator<B>) — the second iterator whose elements are to be processed -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the iterators
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Iterable, Throwables.BiConsumer), #forEach(Object\[\], Object\[\], Throwables.BiConsumer)
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final A[] a, final B[] b, final C[] c, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given arrays until all elements from the shortest array are processed.
-
Parameters:
-
a(A[]) — the first array whose elements are to be processed -
b(B[]) — the second array whose elements are to be processed -
c(C[]) — the third array whose elements are to be processed -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the arrays
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Iterable, Iterable, Throwables.TriConsumer), #forEach(Iterator, Iterator, Iterator, Throwables.TriConsumer)
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given iterables until all elements from the shortest iterable are processed.
-
Parameters:
-
a(Iterable<A>) — the first iterable whose elements are to be processed -
b(Iterable<B>) — the second iterable whose elements are to be processed -
c(Iterable<C>) — the third iterable whose elements are to be processed -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the iterables
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Object\[\], Object\[\], Object\[\], Throwables.TriConsumer), #forEach(Iterator, Iterator, Iterator, Throwables.TriConsumer)
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final Iterator<A> a, final Iterator<B> b, final Iterator<C> c, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given iterators until all elements from the shortest iterator are processed.
-
Parameters:
-
a(Iterator<A>) — the first iterator whose elements are to be processed -
b(Iterator<B>) — the second iterator whose elements are to be processed -
c(Iterator<C>) — the third iterator whose elements are to be processed -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the iterators
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Iterable, Iterable, Throwables.TriConsumer), #forEach(Object\[\], Object\[\], Object\[\], Throwables.TriConsumer)
-
Signature:
public static <A, B, E extends Exception> void forEach(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given arrays until all elements from the longer array are processed.
-
Parameters:
-
a(A[]) — the first array whose elements are to be processed -
b(B[]) — the second array whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first array is shorter than the second array -
valueForNoneB(B) — the value to be used if the second array is shorter than the first array -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the arrays
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public static <A, B, E extends Exception> void forEach(final Iterable<A> a, final Iterable<B> b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given iterables until all elements from the longer iterable are processed.
-
Parameters:
-
a(Iterable<A>) — the first iterable whose elements are to be processed -
b(Iterable<B>) — the second iterable whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first iterable is shorter than the second iterable -
valueForNoneB(B) — the value to be used if the second iterable is shorter than the first iterable -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the iterables
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public static <A, B, E extends Exception> void forEach(final Iterator<A> a, final Iterator<B> b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiConsumer<? super A, ? super B, E> action) throws E - Summary: Executes the provided {@code action} for each pair of elements from the given iterators until all elements from the longer iterator are processed.
-
Parameters:
-
a(Iterator<A>) — the first iterator whose elements are to be processed -
b(Iterator<B>) — the second iterator whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first iterator is shorter than the second iterator -
valueForNoneB(B) — the value to be used if the second iterator is shorter than the first iterator -
action(Throwables.BiConsumer<? super A, ? super B, E>) — the action to be performed for each pair of elements from the iterators
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given arrays until all elements from the longest array are processed.
-
Parameters:
-
a(A[]) — the first array whose elements are to be processed -
b(B[]) — the second array whose elements are to be processed -
c(C[]) — the third array whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first array is shorter than the second and third arrays -
valueForNoneB(B) — the value to be used if the second array is shorter than the first and third arrays -
valueForNoneC(C) — the value to be used if the third array is shorter than the first and second arrays -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the arrays
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given iterables until all elements from the longest iterable are processed.
-
Parameters:
-
a(Iterable<A>) — the first iterable whose elements are to be processed -
b(Iterable<B>) — the second iterable whose elements are to be processed -
c(Iterable<C>) — the third iterable whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first iterable is shorter than the second and third iterables -
valueForNoneB(B) — the value to be used if the second iterable is shorter than the first and third iterables -
valueForNoneC(C) — the value to be used if the third iterable is shorter than the first and second iterables -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the iterables
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public static <A, B, C, E extends Exception> void forEach(final Iterator<A> a, final Iterator<B> b, final Iterator<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Executes the provided {@code action} for each triple of elements from the given iterators until all elements from the longest iterator are processed.
-
Parameters:
-
a(Iterator<A>) — the first iterator whose elements are to be processed -
b(Iterator<B>) — the second iterator whose elements are to be processed -
c(Iterator<C>) — the third iterator whose elements are to be processed -
valueForNoneA(A) — the value to be used if the first iterator is shorter than the second and third iterators -
valueForNoneB(B) — the value to be used if the second iterator is shorter than the first and third iterators -
valueForNoneC(C) — the value to be used if the third iterator is shorter than the first and second iterators -
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each triple of elements from the iterators
-
-
Throws:
-
E— if the action throws an exception
-
forEachNonNull(...) -> void
-
Signature:
public static <T, E extends Exception> void forEachNonNull(final T[] a, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each {@code non-null} element in the array.
-
Parameters:
-
a(T[]) — the array to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each {@code non-null} element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Object\[\], Throwables.Consumer), #forEachNonNull(Iterable, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEachNonNull(final Iterable<? extends T> c, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each {@code non-null} element in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each {@code non-null} element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterable, Throwables.Consumer), #forEachNonNull(Object\[\], Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEachNonNull(final Iterator<? extends T> iter, final Throwables.Consumer<? super T, E> action) throws E - Summary: Executes the action for each {@code non-null} element in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
action(Throwables.Consumer<? super T, E>) — the action to execute for each {@code non-null} element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Iterator, Throwables.Consumer), #forEachNonNull(Iterable, Throwables.Consumer)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEachNonNull(final T[] a, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each {@code non-null} element in the array paired with {@code non-null} mapped elements.
-
Parameters:
-
a(T[]) — the array to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each {@code non-null} element (skips {@code null} results and {@code null} elements) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each {@code non-null} (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Object\[\], Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEachNonNull(final Iterable<? extends T> c, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each {@code non-null} element in the iterable paired with {@code non-null} mapped elements.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each {@code non-null} element (skips {@code null} results and {@code null} elements) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each {@code non-null} (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Iterable, Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, U, E extends Exception, E2 extends Exception> void forEachNonNull(final Iterator<? extends T> iter, final Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Executes the action for each {@code non-null} element in the iterator paired with {@code non-null} mapped elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<U>, E>) — the function producing an iterable for each {@code non-null} element (skips {@code null} results and {@code null} elements) -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to execute for each {@code non-null} (element, mapped) pair
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if action throws an exception
-
- See also: #forEach(Iterator, Throwables.Function, Throwables.BiConsumer)
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEachNonNull(final T[] a, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the action for each {@code non-null} element in the array with two levels of {@code non-null} mapped elements.
-
Parameters:
-
a(T[]) — the array to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the first mapping function (T - > Iterable < T2 > , skips {@code null} at all levels) -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the second mapping function (T2 - > Iterable < T3 > , skips {@code null} at all levels) -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to execute for each {@code non-null} triple
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if flatMapper2 throws an exception -
E3— if action throws an exception
-
- See also: #forEachNonNull(Iterable, Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEachNonNull(Iterator, Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEach(Object\[\], Throwables.Function, Throwables.Function, Throwables.TriConsumer)
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEachNonNull(final Iterable<? extends T> c, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the action for each {@code non-null} element in the iterable with two levels of {@code non-null} mapped elements.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the first mapping function (T - > Iterable < T2 > , skips {@code null} at all levels) -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the second mapping function (T2 - > Iterable < T3 > , skips {@code null} at all levels) -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to execute for each {@code non-null} triple
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if flatMapper2 throws an exception -
E3— if action throws an exception
-
- See also: #forEachNonNull(Object\[\], Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEachNonNull(Iterator, Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEach(Iterable, Throwables.Function, Throwables.Function, Throwables.TriConsumer)
-
Signature:
public static <T, T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEachNonNull(final Iterator<? extends T> iter, final Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Executes the action for each {@code non-null} element in the iterator with two levels of {@code non-null} mapped elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the first mapping function (T - > Iterable < T2 > , skips {@code null} at all levels) -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the second mapping function (T2 - > Iterable < T3 > , skips {@code null} at all levels) -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to execute for each {@code non-null} triple
-
-
Throws:
-
E— if flatMapper throws an exception -
E2— if flatMapper2 throws an exception -
E3— if action throws an exception
-
- See also: #forEachNonNull(Object\[\], Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEachNonNull(Iterable, Throwables.Function, Throwables.Function, Throwables.TriConsumer), #forEach(Iterator, Throwables.Function, Throwables.Function, Throwables.TriConsumer)
forEachIndexed(...) -> void
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final T[] a, final Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Executes the action for each element in the array with its index.
-
Parameters:
-
a(T[]) — the array to iterate -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachIndexed(Object\[\], int, int, Throwables.IntObjConsumer), #forEachIndexed(Iterable, Throwables.IntObjConsumer), #forEach(Object\[\], Throwables.Consumer)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final T[] a, final int fromIndex, final int toIndex, final Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, E - Summary: Executes the action for each element in the specified range of the array with its index.
-
Parameters:
-
a(T[]) — the array to iterate -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range (if fromIndex > toIndex, iterates in reverse) -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds -
E— if the action throws an exception
-
- See also: #forEachIndexed(Object\[\], Throwables.IntObjConsumer), #forEachIndexed(Collection, int, int, Throwables.IntObjConsumer)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Collection<? extends T> c, int fromIndex, final int toIndex, final Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, E - Summary: Executes the action for each element in the specified range of the collection with its index.
-
Parameters:
-
c(Collection<? extends T>) — the collection to iterate -
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range (if fromIndex > toIndex, iterates in reverse) -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of bounds -
E— if the action throws an exception
-
- See also: #forEachIndexed(Object\[\], int, int, Throwables.IntObjConsumer), #forEachIndexed(Iterable, Throwables.IntObjConsumer)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterable<? extends T> c, final Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Executes the action for each element in the iterable with its index.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachIndexed(Object\[\], Throwables.IntObjConsumer), #forEachIndexed(Iterator, Throwables.IntObjConsumer), #forEachIndexed(Iterable, Throwables.IntObjConsumer, int)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterator<? extends T> iter, final Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Executes the action for each element in the iterator with its index.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachIndexed(Iterable, Throwables.IntObjConsumer), #forEachIndexed(Iterator, Throwables.IntObjConsumer, int)
-
Signature:
public static <K, V, E extends Exception> void forEachIndexed(final Map<K, V> map, final Throwables.IntObjConsumer<? super Map.Entry<K, V>, E> action) throws E - Summary: Executes the action for each entry in the map with its index.
-
Parameters:
-
map(Map<K, V>) — the map to iterate -
action(Throwables.IntObjConsumer<? super Map.Entry<K, V>, E>) — the action to execute, receiving index and entry
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachIndexed(Map, Throwables.IntBiObjConsumer), #forEach(Map, Throwables.Consumer)
-
Signature:
public static <K, V, E extends Exception> void forEachIndexed(final Map<K, V> map, final Throwables.IntBiObjConsumer<? super K, ? super V, E> action) throws E - Summary: Executes the action for each entry in the map with its index.
-
Parameters:
-
map(Map<K, V>) — the map to iterate -
action(Throwables.IntBiObjConsumer<? super K, ? super V, E>) — the action to execute, receiving index, key, and value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachIndexed(Map, Throwables.IntObjConsumer), #forEach(Map, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterable<? extends T> c, final Throwables.IntObjConsumer<? super T, E> action, final int processThreadNum) - Summary: Executes the action for each element in the iterable with its index using parallel processing.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element -
processThreadNum(int) — the number of threads for parallel processing
-
- See also: #forEachIndexed(Iterable, Throwables.IntObjConsumer, int, Executor), #forEachIndexed(Iterable, Throwables.IntObjConsumer), #forEach(Iterable, Throwables.Consumer, int)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterable<? extends T> c, final Throwables.IntObjConsumer<? super T, E> action, final int processThreadNum, final Executor executor) - Summary: Executes the action for each element in the iterable with its index using parallel processing.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element -
processThreadNum(int) — the number of threads for parallel processing -
executor(Executor) — the executor to use for parallel processing
-
- See also: #forEachIndexed(Iterable, Throwables.IntObjConsumer, int), #forEachIndexed(Iterator, Throwables.IntObjConsumer, int, Executor)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterator<? extends T> iter, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final int processThreadNum) - Summary: Executes the action for each element in the iterator with its index using parallel processing.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element -
processThreadNum(int) — the number of threads for parallel processing
-
- See also: #forEachIndexed(Iterator, Throwables.IntObjConsumer, int, Executor), #forEachIndexed(Iterator, Throwables.IntObjConsumer)
-
Signature:
public static <T, E extends Exception> void forEachIndexed(final Iterator<? extends T> iter, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final int processThreadNum, final Executor executor) throws IllegalArgumentException - Summary: Executes the action for each element in the iterator with its index using parallel processing.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to execute, receiving index and element -
processThreadNum(int) — the number of threads for parallel processing -
executor(Executor) — the executor to use for parallel processing
-
-
Throws:
-
java.lang.IllegalArgumentException— if processThreadNum is invalid
-
- See also: #forEachIndexed(Iterator, Throwables.IntObjConsumer, int), #forEachIndexed(Iterable, Throwables.IntObjConsumer, int, Executor)
forEachPair(...) -> void
-
Signature:
public static <T, E extends Exception> void forEachPair(final T[] a, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of consecutive elements in the array.
-
Parameters:
-
a(T[]) — the array to iterate -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving consecutive element pairs (last element paired with {@code null} if odd length)
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Object\[\], int, Throwables.BiConsumer), #forEachPair(Iterable, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachPair(final T[] a, final int increment, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of elements in the array with the specified increment.
-
Parameters:
-
a(T[]) — the array to iterate -
increment(int) — the increment between starting points of consecutive pairs (must be positive) -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving element pairs
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Object\[\], Throwables.BiConsumer), #forEachPair(Iterable, int, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachPair(final Iterable<? extends T> c, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of consecutive elements in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving consecutive element pairs (last element paired with {@code null} if odd length)
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Iterable, int, Throwables.BiConsumer), #forEachPair(Object\[\], Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachPair(final Iterable<? extends T> c, final int increment, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of elements in the iterable with the specified increment.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
increment(int) — the increment between starting points of consecutive pairs (must be positive) -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving element pairs
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Iterable, Throwables.BiConsumer), #forEachPair(Iterator, int, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachPair(final Iterator<? extends T> iter, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of consecutive elements in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving consecutive element pairs (last element paired with {@code null} if odd length)
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Iterator, int, Throwables.BiConsumer), #forEachPair(Iterable, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachPair(final Iterator<? extends T> iter, final int increment, final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Executes the action for each pair of elements in the iterator with the specified increment.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
increment(int) — the increment between starting points of consecutive pairs (must be positive) -
action(Throwables.BiConsumer<? super T, ? super T, E>) — the action to execute, receiving element pairs
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Iterator, Throwables.BiConsumer), #forEachPair(Iterable, int, Throwables.BiConsumer)
forEachTriple(...) -> void
-
Signature:
public static <T, E extends Exception> void forEachTriple(final T[] a, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of consecutive elements in the array.
-
Parameters:
-
a(T[]) — the array to iterate -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving consecutive element triples (missing elements replaced with {@code null} )
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Object\[\], int, Throwables.TriConsumer), #forEachPair(Object\[\], Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachTriple(final T[] a, final int increment, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of elements in the array with the specified increment.
-
Parameters:
-
a(T[]) — the array to iterate -
increment(int) — the increment between starting points of consecutive triples (must be positive) -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving element triples
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Object\[\], Throwables.TriConsumer), #forEachPair(Object\[\], int, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachTriple(final Iterable<? extends T> c, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of consecutive elements in the iterable.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving consecutive element triples (missing elements replaced with {@code null} )
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Iterable, int, Throwables.TriConsumer), #forEachPair(Iterable, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachTriple(final Iterable<? extends T> c, final int increment, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of elements in the iterable with the specified increment.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable to iterate -
increment(int) — the increment between starting points of consecutive triples (must be positive) -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving element triples
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Iterable, Throwables.TriConsumer), #forEachPair(Iterable, int, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachTriple(final Iterator<? extends T> iter, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of consecutive elements in the iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving consecutive element triples (missing elements replaced with {@code null} )
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Iterator, int, Throwables.TriConsumer), #forEachPair(Iterator, Throwables.BiConsumer)
-
Signature:
public static <T, E extends Exception> void forEachTriple(final Iterator<? extends T> iter, final int increment, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Executes the action for each triple of elements in the iterator with the specified increment.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to iterate -
increment(int) — the increment between starting points of consecutive triples (must be positive) -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — the action to execute, receiving element triples
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Iterator, Throwables.TriConsumer), #forEachPair(Iterator, int, Throwables.BiConsumer)
asyncExecute(...) -> ContinuableFuture<Void>
-
Signature:
public static ContinuableFuture<Void> asyncExecute(final Throwables.Runnable<? extends Exception> command) - Summary: Executes the command asynchronously using the default executor.
-
Contract:
- Returns immediately with a future that completes when the command finishes.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Void> future = N.asyncExecute(() -> processData()); // Command runs asynchronously, can continue with other work future.get(); // Wait for completion if needed } </pre>
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the command to execute asynchronously
-
- Returns: a future representing the pending completion of the task
- See also: #asyncExecute(Throwables.Runnable, Executor), #asyncExecute(Callable), #runWithRetry(Throwables.Runnable, int, long, Predicate)
-
Signature:
public static ContinuableFuture<Void> asyncExecute(final Throwables.Runnable<? extends Exception> command, final Executor executor) - Summary: Executes the command asynchronously using the specified executor.
-
Contract:
- Returns immediately with a future that completes when the command finishes.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the command to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: a future representing the pending completion of the task
- See also: #asyncExecute(Throwables.Runnable), #asyncExecute(Callable, Executor)
-
Signature:
public static ContinuableFuture<Void> asyncExecute(final Throwables.Runnable<? extends Exception> command, final long delayInMillis) - Summary: Executes the command asynchronously after the specified delay.
-
Contract:
- Returns immediately with a future that completes when the command finishes.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the command to execute asynchronously -
delayInMillis(long) — the delay in milliseconds before execution
-
- Returns: a future representing the pending completion of the task
- See also: #asyncExecute(Throwables.Runnable), #asyncExecute(Callable, long)
-
Signature:
public static <R> ContinuableFuture<R> asyncExecute(final Callable<R> command) - Summary: Executes the command asynchronously using the default executor and returns the result.
-
Parameters:
-
command(Callable<R>) — the command to execute asynchronously
-
- Returns: a future representing the pending result
- See also: #asyncExecute(Callable, Executor), #asyncExecute(Throwables.Runnable), #callWithRetry(Callable, int, long, BiPredicate)
-
Signature:
public static <R> ContinuableFuture<R> asyncExecute(final Callable<R> command, final Executor executor) - Summary: Executes the command asynchronously using the specified executor and returns the result.
-
Parameters:
-
command(Callable<R>) — the command to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: a future representing the pending result
- See also: #asyncExecute(Callable), #asyncExecute(Throwables.Runnable, Executor)
-
Signature:
public static <R> ContinuableFuture<R> asyncExecute(final Callable<R> command, final long delayInMillis) - Summary: Executes the command asynchronously after the specified delay and returns the result.
-
Parameters:
-
command(Callable<R>) — the command to execute asynchronously -
delayInMillis(long) — the delay in milliseconds before execution
-
- Returns: a future representing the pending result
- See also: #asyncExecute(Callable), #asyncExecute(Throwables.Runnable, long)
-
Signature:
public static ContinuableFuture<Void> asyncExecute(final Throwables.Runnable<? extends Exception> cmd, final int retryTimes, final long retryIntervalInMillis, final Predicate<? super Exception> retryCondition) - Summary: Executes the command asynchronously with retry logic on failure.
-
Contract:
- Returns immediately with a future that completes when the command succeeds or retries are exhausted.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ContinuableFuture<Void> future = N.asyncExecute( () -> sendRequest(), 3, 1000, e -> e instanceof IOException); // Asynchronously retries up to 3 times with 1 second interval if IOException occurs } </pre>
-
Parameters:
-
cmd(Throwables.Runnable<? extends Exception>) — the command to execute asynchronously -
retryTimes(int) — the number of retry attempts if execution fails -
retryIntervalInMillis(long) — the interval in milliseconds between retries -
retryCondition(Predicate<? super Exception>) — the condition checked after failure to decide whether to retry
-
- Returns: a future representing the pending completion of the task
- See also: #asyncExecute(Throwables.Runnable), #runWithRetry(Throwables.Runnable, int, long, Predicate), #asyncExecute(Callable, int, long, BiPredicate)
-
Signature:
public static <R> ContinuableFuture<R> asyncExecute(final Callable<R> cmd, final int retryTimes, final long retryIntervalInMillis, final BiPredicate<? super R, ? super Exception> retryCondition) - Summary: Executes the command asynchronously with retry logic on failure and returns the result.
-
Contract:
- Returns immediately with a future that completes with the command's result or when retries are exhausted.
-
Parameters:
-
cmd(Callable<R>) — the command to execute asynchronously -
retryTimes(int) — the number of retry attempts if execution fails -
retryIntervalInMillis(long) — the interval in milliseconds between retries -
retryCondition(BiPredicate<? super R, ? super Exception>) — the condition checked after each attempt to decide whether to retry
-
- Returns: a future representing the pending result
- See also: #asyncExecute(Callable), #callWithRetry(Callable, int, long, BiPredicate), #asyncExecute(Throwables.Runnable, int, long, Predicate)
-
Signature:
public static List<ContinuableFuture<Void>> asyncExecute(final List<? extends Throwables.Runnable<? extends Exception>> commands) - Summary: Executes a list of commands asynchronously using the default executor.
-
Parameters:
-
commands(List<? extends Throwables.Runnable<? extends Exception>>) — the list of commands to execute asynchronously
-
- Returns: a list of futures representing the pending completion of each command
- See also: #asyncExecute(List, Executor), #asyncExecute(Throwables.Runnable)
-
Signature:
public static List<ContinuableFuture<Void>> asyncExecute(final List<? extends Throwables.Runnable<? extends Exception>> commands, final Executor executor) - Summary: Executes a list of commands asynchronously using the specified executor.
-
Parameters:
-
commands(List<? extends Throwables.Runnable<? extends Exception>>) — the list of commands to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: a list of futures representing the pending completion of each command
- See also: #asyncExecute(List), #asyncExecute(Throwables.Runnable, Executor)
-
Signature:
public static <R> List<ContinuableFuture<R>> asyncExecute(final Collection<? extends Callable<R>> commands) - Summary: Executes a collection of commands asynchronously using the default executor and returns results.
-
Parameters:
-
commands(Collection<? extends Callable<R>>) — the collection of commands to execute asynchronously
-
- Returns: a list of futures representing the pending results
- See also: #asyncExecute(Collection, Executor), #asyncExecute(Callable)
-
Signature:
public static <R> List<ContinuableFuture<R>> asyncExecute(final Collection<? extends Callable<R>> commands, final Executor executor) - Summary: Executes a collection of commands asynchronously using the specified executor and returns results.
-
Parameters:
-
commands(Collection<? extends Callable<R>>) — the collection of commands to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: a list of futures representing the pending results
- See also: #asyncExecute(Collection), #asyncExecute(Callable, Executor)
asyncRun(...) -> ObjIterator<Void>
-
Signature:
public static ObjIterator<Void> asyncRun(final Collection<? extends Throwables.Runnable<? extends Exception>> commands) - Summary: Executes commands asynchronously using the default executor and returns an iterator for lazy result iteration.
-
Contract:
- If an error occurs in a command, iteration is interrupted and the error is thrown.
-
Parameters:
-
commands(Collection<? extends Throwables.Runnable<? extends Exception>>) — the collection of commands to execute asynchronously
-
- Returns: an iterator yielding results in completion order
- See also: #asyncRun(Collection, Executor), #asyncCall(Collection), #asyncExecute(List)
-
Signature:
public static ObjIterator<Void> asyncRun(final Collection<? extends Throwables.Runnable<? extends Exception>> commands, final Executor executor) - Summary: Executes commands asynchronously using the specified executor and returns an iterator for lazy result iteration.
-
Contract:
- If an error occurs in a command, iteration is interrupted and the error is thrown.
-
Parameters:
-
commands(Collection<? extends Throwables.Runnable<? extends Exception>>) — the collection of commands to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: an iterator yielding results in completion order
- See also: #asyncRun(Collection), #asyncCall(Collection, Executor)
asyncCall(...) -> ObjIterator<R>
-
Signature:
public static <R> ObjIterator<R> asyncCall(final Collection<? extends Callable<? extends R>> commands) - Summary: Executes commands asynchronously using the default executor and returns an iterator for lazy result iteration.
-
Contract:
- If an error occurs in a command, iteration is interrupted and the error is thrown.
-
Parameters:
-
commands(Collection<? extends Callable<? extends R>>) — the collection of commands to execute asynchronously
-
- Returns: an iterator yielding results in completion order
- See also: #asyncCall(Collection, Executor), #asyncRun(Collection), #asyncExecute(Collection)
-
Signature:
public static <R> ObjIterator<R> asyncCall(final Collection<? extends Callable<? extends R>> commands, final Executor executor) throws IllegalArgumentException - Summary: Executes commands asynchronously using the specified executor and returns an iterator for lazy result iteration.
-
Contract:
- If an error occurs in a command, iteration is interrupted and the error is thrown.
-
Parameters:
-
commands(Collection<? extends Callable<? extends R>>) — the collection of commands to execute asynchronously -
executor(Executor) — the executor to use for execution
-
- Returns: an iterator yielding results in completion order
-
Throws:
-
java.lang.IllegalArgumentException— if the executor is invalid
-
- See also: #asyncCall(Collection), #asyncRun(Collection, Executor)
runWithRetry(...) -> void
-
Signature:
public static void runWithRetry(final Throwables.Runnable<? extends Exception> cmd, final int retryTimes, final long retryIntervalInMillis, final Predicate<? super Exception> retryCondition) - Summary: Executes the command with retry logic on failure.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code N.runWithRetry(() -> sendRequest(), 3, 1000, e -> e instanceof IOException); // Retries up to 3 times with 1 second interval if IOException occurs } </pre>
-
Parameters:
-
cmd(Throwables.Runnable<? extends Exception>) — the command to execute -
retryTimes(int) — the number of retry attempts if execution fails -
retryIntervalInMillis(long) — the interval in milliseconds between retries -
retryCondition(Predicate<? super Exception>) — the condition checked after failure to decide whether to retry
-
- See also: #callWithRetry(Callable, int, long, BiPredicate), #asyncExecute(Throwables.Runnable, int, long, Predicate), Retry#withFixedDelay(int, long, Predicate)
callWithRetry(...) -> R
-
Signature:
public static <R> R callWithRetry(final Callable<R> cmd, final int retryTimes, final long retryIntervalInMillis, final BiPredicate<? super R, ? super Exception> retryCondition) - Summary: Executes the command with retry logic on failure and returns the result.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code String result = N.callWithRetry(() -> fetchData(), 3, 1000, (r, e) -> r == null || e instanceof IOException); // Retries up to 3 times with 1 second interval if result is null or IOException occurs } </pre>
-
Parameters:
-
cmd(Callable<R>) — the command to execute -
retryTimes(int) — the number of retry attempts if execution fails -
retryIntervalInMillis(long) — the interval in milliseconds between retries -
retryCondition(BiPredicate<? super R, ? super Exception>) — the condition checked after each attempt to decide whether to retry
-
- Returns: the result returned by the callable task
- See also: #runWithRetry(Throwables.Runnable, int, long, Predicate), #asyncExecute(Callable, int, long, BiPredicate), Retry#withFixedDelay(int, long, BiPredicate)
runInParallel(...) -> void
-
Signature:
public static void runInParallel(final Throwables.Runnable<? extends Exception> command, final Throwables.Runnable<? extends Exception> command2) - Summary: Executes two commands in parallel and waits for both to complete.
-
Contract:
- If an error occurs in either command, cancels any unfinished commands.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the first command to execute in the current thread -
command2(Throwables.Runnable<? extends Exception>) — the second command to execute in another thread
-
- See also: #runInParallel(Throwables.Runnable, Throwables.Runnable, Throwables.Runnable), #runInParallel(Collection), #asyncExecute(List)
-
Signature:
public static void runInParallel(final Throwables.Runnable<? extends Exception> command, final Throwables.Runnable<? extends Exception> command2, final Throwables.Runnable<? extends Exception> command3) - Summary: Executes three commands in parallel and waits for all to complete.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the first command to execute in the current thread -
command2(Throwables.Runnable<? extends Exception>) — the second command to execute in another thread -
command3(Throwables.Runnable<? extends Exception>) — the third command to execute in another thread
-
- See also: #runInParallel(Throwables.Runnable, Throwables.Runnable), #runInParallel(Collection)
-
Signature:
public static void runInParallel(final Throwables.Runnable<? extends Exception> command, final Throwables.Runnable<? extends Exception> command2, final Throwables.Runnable<? extends Exception> command3, final Throwables.Runnable<? extends Exception> command4) - Summary: Executes four commands in parallel and waits for all to complete.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the first command to execute in the current thread -
command2(Throwables.Runnable<? extends Exception>) — the second command to execute in another thread -
command3(Throwables.Runnable<? extends Exception>) — the third command to execute in another thread -
command4(Throwables.Runnable<? extends Exception>) — the fourth command to execute in another thread
-
- See also: #runInParallel(Throwables.Runnable, Throwables.Runnable, Throwables.Runnable), #runInParallel(Collection)
-
Signature:
public static void runInParallel(final Throwables.Runnable<? extends Exception> command, final Throwables.Runnable<? extends Exception> command2, final Throwables.Runnable<? extends Exception> command3, final Throwables.Runnable<? extends Exception> command4, final Throwables.Runnable<? extends Exception> command5) - Summary: Executes five commands in parallel and waits for all to complete.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Throwables.Runnable<? extends Exception>) — the first command to execute in the current thread -
command2(Throwables.Runnable<? extends Exception>) — the second command to execute in another thread -
command3(Throwables.Runnable<? extends Exception>) — the third command to execute in another thread -
command4(Throwables.Runnable<? extends Exception>) — the fourth command to execute in another thread -
command5(Throwables.Runnable<? extends Exception>) — the fifth command to execute in another thread
-
- See also: #runInParallel(Throwables.Runnable, Throwables.Runnable, Throwables.Runnable, Throwables.Runnable), #runInParallel(Collection)
-
Signature:
public static void runInParallel(final Collection<? extends Throwables.Runnable<? extends Exception>> commands) - Summary: Executes a collection of commands in parallel using the default executor and waits for all to complete.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
commands(Collection<? extends Throwables.Runnable<? extends Exception>>) — the collection of commands to execute in parallel
-
- See also: #runInParallel(Collection, Executor), #runInParallel(Throwables.Runnable, Throwables.Runnable)
-
Signature:
public static void runInParallel(final Collection<? extends Throwables.Runnable<? extends Exception>> commands, final Executor executor) - Summary: Executes a collection of commands in parallel using the specified executor and waits for all to complete.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
- Does nothing if the collection is {@code null} or empty.
-
Parameters:
-
commands(Collection<? extends Throwables.Runnable<? extends Exception>>) — the collection of commands to execute in parallel -
executor(Executor) — the executor to use for parallel execution
-
- See also: #runInParallel(Collection), #asyncExecute(List, Executor)
callInParallel(...) -> Tuple2<R, R2>
-
Signature:
public static <R, R2> Tuple2<R, R2> callInParallel(final Callable<R> command, final Callable<R2> command2) - Summary: Executes two commands in parallel, waits for both to complete, and returns their results as a tuple.
-
Contract:
- If an error occurs in either command, cancels any unfinished commands.
-
Parameters:
-
command(Callable<R>) — the first command to execute in the current thread -
command2(Callable<R2>) — the second command to execute in another thread
-
- Returns: a tuple containing the results of both commands in the same order
- See also: #callInParallel(Callable, Callable, Callable), #runInParallel(Throwables.Runnable, Throwables.Runnable)
-
Signature:
public static <R, R2, R3> Tuple3<R, R2, R3> callInParallel(final Callable<R> command, final Callable<R2> command2, final Callable<R3> command3) - Summary: Executes three commands in parallel, waits for all to complete, and returns their results as a tuple.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Callable<R>) — the first command to execute in the current thread -
command2(Callable<R2>) — the second command to execute in another thread -
command3(Callable<R3>) — the third command to execute in another thread
-
- Returns: a tuple containing the results of all three commands in the same order
- See also: #callInParallel(Callable, Callable), #callInParallel(Callable, Callable, Callable, Callable)
-
Signature:
public static <R, R2, R3, R4> Tuple4<R, R2, R3, R4> callInParallel(final Callable<R> command, final Callable<R2> command2, final Callable<R3> command3, final Callable<R4> command4) - Summary: Executes four commands in parallel, waits for all to complete, and returns their results as a tuple.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Callable<R>) — the first command to execute in the current thread -
command2(Callable<R2>) — the second command to execute in another thread -
command3(Callable<R3>) — the third command to execute in another thread -
command4(Callable<R4>) — the fourth command to execute in another thread
-
- Returns: a tuple containing the results of all four commands in the same order
- See also: #callInParallel(Callable, Callable, Callable), #callInParallel(Callable, Callable, Callable, Callable, Callable)
-
Signature:
public static <R, R2, R3, R4, R5> Tuple5<R, R2, R3, R4, R5> callInParallel(final Callable<R> command, final Callable<R2> command2, final Callable<R3> command3, final Callable<R4> command4, final Callable<R5> command5) - Summary: Executes five commands in parallel, waits for all to complete, and returns their results as a tuple.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
-
Parameters:
-
command(Callable<R>) — the first command to execute in the current thread -
command2(Callable<R2>) — the second command to execute in another thread -
command3(Callable<R3>) — the third command to execute in another thread -
command4(Callable<R4>) — the fourth command to execute in another thread -
command5(Callable<R5>) — the fifth command to execute in another thread
-
- Returns: a tuple containing the results of all five commands in the same order
- See also: #callInParallel(Callable, Callable, Callable, Callable), #callInParallel(Collection)
-
Signature:
public static <R> List<R> callInParallel(final Collection<? extends Callable<? extends R>> commands) - Summary: Executes a collection of commands in parallel using the default executor and returns all results as a list.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
- Returns an empty list if the collection is {@code null} or empty.
-
Parameters:
-
commands(Collection<? extends Callable<? extends R>>) — the collection of commands to execute in parallel
-
- Returns: a list containing the results of all commands in the same order
- See also: #callInParallel(Collection, Executor), #callInParallel(Callable, Callable)
-
Signature:
public static <R> List<R> callInParallel(final Collection<? extends Callable<? extends R>> commands, final Executor executor) throws IllegalArgumentException - Summary: Executes a collection of commands in parallel using the specified executor and returns all results as a list.
-
Contract:
- If an error occurs in any command, cancels all unfinished commands.
- Returns an empty list if the collection is {@code null} or empty.
-
Parameters:
-
commands(Collection<? extends Callable<? extends R>>) — the collection of commands to execute in parallel -
executor(Executor) — the executor to use for parallel execution
-
- Returns: a list containing the results of all commands in the same order
-
Throws:
-
java.lang.IllegalArgumentException— if the executor is invalid
-
- See also: #callInParallel(Collection), #runInParallel(Collection, Executor)
runByBatch(...) -> void
-
Signature:
public static <T, E extends Exception> void runByBatch(final T[] a, final int batchSize, final Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, E - Summary: Executes the action on batches of elements from the array.
-
Contract:
- Does nothing if the array is {@code null} or empty.
- The action must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
a(T[]) — the array to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Consumer<? super List<T>, E>) — the action to execute on each batch (must not modify or cache the batch)
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the action throws an exception
-
- See also: #runByBatch(Iterable, int, Throwables.Consumer), #callByBatch(Object\[\], int, Throwables.Function)
-
Signature:
public static <T, E extends Exception> void runByBatch(final Iterable<? extends T> iter, final int batchSize, final Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, E - Summary: Executes the action on batches of elements from the iterable.
-
Contract:
- Does nothing if the iterable is {@code null} or empty.
- The action must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
iter(Iterable<? extends T>) — the iterable to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Consumer<? super List<T>, E>) — the action to execute on each batch (must not modify or cache the batch)
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the action throws an exception
-
- See also: #runByBatch(Object\[\], int, Throwables.Consumer), #callByBatch(Iterable, int, Throwables.Function)
-
Signature:
public static <T, E extends Exception> void runByBatch(final Iterator<? extends T> iter, final int batchSize, final Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, E - Summary: Executes the action on batches of elements from the iterator.
-
Contract:
- Does nothing if the iterator is {@code null} or has no elements.
- The action must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Consumer<? super List<T>, E>) — the action to execute on each batch (must not modify or cache the batch)
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the action throws an exception
-
- See also: #runByBatch(Iterable, int, Throwables.Consumer), #callByBatch(Iterator, int, Throwables.Function)
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void runByBatch(final T[] a, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Executes the element consumer on each element in the array with its index, then runs the batch action after each batch.
-
Contract:
- Does nothing if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Runnable<E2>) — the action to execute after each batch is prepared
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #runByBatch(Iterable, int, Throwables.IntObjConsumer, Throwables.Runnable), #runByBatch(Object\[\], int, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void runByBatch(final Iterable<? extends T> iter, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Executes the element consumer on each element in the iterable with its index, then runs the batch action after each batch.
-
Contract:
- Does nothing if the iterable is {@code null} or empty.
-
Parameters:
-
iter(Iterable<? extends T>) — the iterable to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Runnable<E2>) — the action to execute after each batch is prepared
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #runByBatch(Iterator, int, Throwables.IntObjConsumer, Throwables.Runnable), #runByBatch(Object\[\], int, Throwables.IntObjConsumer, Throwables.Runnable), #runByBatch(Iterable, int, Throwables.Consumer)
-
Signature:
public static <T, E extends Exception, E2 extends Exception> void runByBatch(final Iterator<? extends T> iter, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Executes the element consumer on each element in the iterator with its index, then runs the batch action after each batch.
-
Contract:
- Does nothing if the iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Runnable<E2>) — the action to execute after each batch is prepared
-
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #runByBatch(Iterable, int, Throwables.IntObjConsumer, Throwables.Runnable), #runByBatch(Object\[\], int, Throwables.IntObjConsumer, Throwables.Runnable), #runByBatch(Iterator, int, Throwables.Consumer)
callByBatch(...) -> List<R>
-
Signature:
public static <T, R, E extends Exception> List<R> callByBatch(final T[] a, final int batchSize, final Throwables.Function<? super List<T>, R, E> batchAction) throws IllegalArgumentException, E - Summary: Applies the batch function to batches of elements from the array and returns all results as a list.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
- The function must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
a(T[]) — the array to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Function<? super List<T>, R, E>) — the function to apply to each batch (must not modify or cache the batch)
-
- Returns: a list containing the results from applying the function to each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the batch function throws an exception
-
- See also: #callByBatch(Iterable, int, Throwables.Function), #runByBatch(Object\[\], int, Throwables.Consumer)
-
Signature:
public static <T, R, E extends Exception> List<R> callByBatch(final Iterable<? extends T> iter, final int batchSize, final Throwables.Function<? super List<T>, R, E> batchAction) throws IllegalArgumentException, E - Summary: Applies the batch function to batches of elements from the iterable and returns all results as a list.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
- The function must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
iter(Iterable<? extends T>) — the iterable to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Function<? super List<T>, R, E>) — the function to apply to each batch (must not modify or cache the batch)
-
- Returns: a list containing the results from applying the function to each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the batch function throws an exception
-
- See also: #callByBatch(Iterator, int, Throwables.Function), #callByBatch(Object\[\], int, Throwables.Function), #runByBatch(Iterable, int, Throwables.Consumer)
-
Signature:
public static <T, R, E extends Exception> List<R> callByBatch(final Iterator<? extends T> iter, final int batchSize, final Throwables.Function<? super List<T>, R, E> batchAction) throws IllegalArgumentException, E - Summary: Applies the batch function to batches of elements from the iterator and returns all results as a list.
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements.
- The function must not modify or cache the input batch list, as it may be reused.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
batchAction(Throwables.Function<? super List<T>, R, E>) — the function to apply to each batch (must not modify or cache the batch)
-
- Returns: a list containing the results from applying the function to each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the batch function throws an exception
-
- See also: #callByBatch(Iterable, int, Throwables.Function), #callByBatch(Object\[\], int, Throwables.Function), #runByBatch(Iterator, int, Throwables.Consumer)
-
Signature:
public static <T, R, E extends Exception, E2 extends Exception> List<R> callByBatch(final T[] a, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Callable<? extends R, E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Applies the element consumer to each element in the array with its index, then calls the batch action after each batch and returns all results as a list.
-
Contract:
- Returns an empty list if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Callable<? extends R, E2>) — the action to call after each batch is prepared
-
- Returns: a list containing the results from calling the batch action after each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #callByBatch(Iterable, int, Throwables.IntObjConsumer, Throwables.Callable), #runByBatch(Object\[\], int, Throwables.IntObjConsumer, Throwables.Runnable)
-
Signature:
public static <T, R, E extends Exception, E2 extends Exception> List<R> callByBatch(final Iterable<? extends T> iter, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Callable<? extends R, E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Applies the element consumer to each element in the iterable with its index, then calls the batch action after each batch and returns all results as a list.
-
Contract:
- Returns an empty list if the iterable is {@code null} or empty.
-
Parameters:
-
iter(Iterable<? extends T>) — the iterable to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Callable<? extends R, E2>) — the action to call after each batch is prepared
-
- Returns: a list containing the results from calling the batch action after each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #callByBatch(Iterator, int, Throwables.IntObjConsumer, Throwables.Callable), #callByBatch(Object\[\], int, Throwables.IntObjConsumer, Throwables.Callable), #runByBatch(Iterable, int, Throwables.IntObjConsumer, Throwables.Runnable)
-
Signature:
public static <T, R, E extends Exception, E2 extends Exception> List<R> callByBatch(final Iterator<? extends T> iter, final int batchSize, final Throwables.IntObjConsumer<? super T, E> elementConsumer, final Throwables.Callable<? extends R, E2> batchAction) throws IllegalArgumentException, E, E2 - Summary: Applies the element consumer to each element in the iterator with its index, then calls the batch action after each batch and returns all results as a list.
-
Contract:
- Returns an empty list if the iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator to process in batches -
batchSize(int) — the number of elements in each batch (must be positive) -
elementConsumer(Throwables.IntObjConsumer<? super T, E>) — the action to apply to each element with its index -
batchAction(Throwables.Callable<? extends R, E2>) — the action to call after each batch is prepared
-
- Returns: a list containing the results from calling the batch action after each batch
-
Throws:
-
java.lang.IllegalArgumentException— if batchSize is not positive -
E— if the element consumer throws an exception -
E2— if the batch action throws an exception
-
- See also: #callByBatch(Iterable, int, Throwables.IntObjConsumer, Throwables.Callable), #callByBatch(Object\[\], int, Throwables.IntObjConsumer, Throwables.Callable), #runByBatch(Iterator, int, Throwables.IntObjConsumer, Throwables.Runnable)
runUninterruptibly(...) -> void
-
Signature:
public static void runUninterruptibly(final Throwables.Runnable<InterruptedException> cmd) throws IllegalArgumentException - Summary: Executes the command uninterruptibly, blocking until completion even if the thread is interrupted.
-
Contract:
- Executes the command uninterruptibly, blocking until completion even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes, then restores the interrupted status.
- This is useful for operations that must complete atomically without being interrupted mid-execution.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code N.runUninterruptibly(() -> { Thread.sleep(1); // Must complete even if interrupted }); // Thread interrupted status is restored after completion } </pre>
-
Parameters:
-
cmd(Throwables.Runnable<InterruptedException>) — the command to execute uninterruptibly
-
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is {@code null}
-
- See also: #runUninterruptibly(Throwables.LongConsumer, long)
-
Signature:
public static void runUninterruptibly(final Throwables.LongConsumer<InterruptedException> cmd, final long timeoutInMillis) throws IllegalArgumentException - Summary: Executes the command uninterruptibly with a timeout, blocking until completion or timeout even if the thread is interrupted.
-
Contract:
- Executes the command uninterruptibly with a timeout, blocking until completion or timeout even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes or the timeout elapses, then restores the interrupted status.
- This is useful for timed operations that must complete atomically without being interrupted mid-execution.
-
Parameters:
-
cmd(Throwables.LongConsumer<InterruptedException>) — the command to execute with remaining time in milliseconds -
timeoutInMillis(long) — the maximum time to wait in milliseconds
-
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is {@code null}
-
- See also: #runUninterruptibly(Throwables.BiConsumer, long, TimeUnit), #runUninterruptibly(Throwables.Runnable)
-
Signature:
public static void runUninterruptibly(@NotNull final Throwables.BiConsumer<Long, TimeUnit, InterruptedException> cmd, final long timeout, @NotNull final TimeUnit unit) throws IllegalArgumentException - Summary: Executes the command uninterruptibly with a timeout and time unit, blocking until completion or timeout even if the thread is interrupted.
-
Contract:
- Executes the command uninterruptibly with a timeout and time unit, blocking until completion or timeout even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes or the timeout elapses, then restores the interrupted status.
- This is useful for timed operations that must complete atomically without being interrupted mid-execution.
-
Parameters:
-
cmd(@NotNull Throwables.BiConsumer<Long, TimeUnit, InterruptedException>) — the command to execute with remaining time and unit (nanoseconds) -
timeout(long) — the maximum time to wait -
unit(@NotNull TimeUnit) — the time unit of the timeout argument
-
-
Throws:
-
java.lang.IllegalArgumentException— if cmd or unit is {@code null}
-
- See also: #runUninterruptibly(Throwables.LongConsumer, long), #runUninterruptibly(Throwables.Runnable)
callUninterruptibly(...) -> T
-
Signature:
public static <T> T callUninterruptibly(final Throwables.Callable<T, InterruptedException> cmd) throws IllegalArgumentException - Summary: Calls the command uninterruptibly and returns the result, blocking until completion even if the thread is interrupted.
-
Contract:
- Calls the command uninterruptibly and returns the result, blocking until completion even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes, then restores the interrupted status.
- This is useful for operations that must complete atomically without being interrupted mid-execution.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code String result = N.callUninterruptibly(() -> { Thread.sleep(1); return "completed"; }); // Returns result even if interrupted, interrupted status restored after } </pre>
-
Parameters:
-
cmd(Throwables.Callable<T, InterruptedException>) — the command to call uninterruptibly
-
- Returns: the result of the command
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is {@code null}
-
- See also: #callUninterruptibly(Throwables.LongFunction, long), #runUninterruptibly(Throwables.Runnable)
-
Signature:
public static <T> T callUninterruptibly(final Throwables.LongFunction<? extends T, InterruptedException> cmd, final long timeoutInMillis) throws IllegalArgumentException - Summary: Calls the command uninterruptibly with a timeout and returns the result, blocking until completion or timeout even if the thread is interrupted.
-
Contract:
- Calls the command uninterruptibly with a timeout and returns the result, blocking until completion or timeout even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes or the timeout elapses, then restores the interrupted status.
- This is useful for timed operations that must complete atomically without being interrupted mid-execution.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code String result = N.callUninterruptibly(remainingMillis -> { if (lock.tryLock(remainingMillis, TimeUnit.MILLISECONDS)) { return "acquired"; } return "failed"; }, 5000); // Attempts operation with remaining time on each retry } </pre>
-
Parameters:
-
cmd(Throwables.LongFunction<? extends T, InterruptedException>) — the command to call with remaining time in milliseconds -
timeoutInMillis(long) — the maximum time to wait in milliseconds
-
- Returns: the result of the command
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is {@code null}
-
- See also: #callUninterruptibly(Throwables.BiFunction, long, TimeUnit), #callUninterruptibly(Throwables.Callable)
-
Signature:
public static <T> T callUninterruptibly(@NotNull final Throwables.BiFunction<Long, TimeUnit, T, InterruptedException> cmd, final long timeout, @NotNull final TimeUnit unit) throws IllegalArgumentException - Summary: Calls the command uninterruptibly with a timeout and time unit and returns the result, blocking until completion or timeout even if the thread is interrupted.
-
Contract:
- Calls the command uninterruptibly with a timeout and time unit and returns the result, blocking until completion or timeout even if the thread is interrupted.
- If the thread is interrupted during execution, continues to block until the command completes or the timeout elapses, then restores the interrupted status.
- This is useful for timed operations that must complete atomically without being interrupted mid-execution.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Future<String> future = CompletableFuture.completedFuture("success"); String result = N.callUninterruptibly((remainingTime, timeUnit) -> { if (future.get(remainingTime, timeUnit) != null) { return "success"; } return "timeout"; }, 1, TimeUnit.MILLISECONDS); // Attempts future get with remaining time on each retry } </pre>
-
Parameters:
-
cmd(@NotNull Throwables.BiFunction<Long, TimeUnit, T, InterruptedException>) — the command to call with remaining time and unit (nanoseconds) -
timeout(long) — the maximum time to wait -
unit(@NotNull TimeUnit) — the time unit of the timeout argument
-
- Returns: the result of the command
-
Throws:
-
java.lang.IllegalArgumentException— if cmd or unit is {@code null}
-
- See also: #callUninterruptibly(Throwables.LongFunction, long), #callUninterruptibly(Throwables.Callable)
tryOrEmptyIfExceptionOccurred(...) -> Nullable<R>
-
Signature:
@Beta public static <R> Nullable<R> tryOrEmptyIfExceptionOccurred(final Callable<R> cmd) - Summary: Executes the callable and returns the result wrapped in a {@code Nullable} .
-
Contract:
- Returns an empty {@code Nullable} if an exception occurs during execution.
-
Parameters:
-
cmd(Callable<R>) — the callable to execute
-
- Returns: a {@code Nullable} containing the result, or empty if an exception occurs
- See also: #tryOrEmptyIfExceptionOccurred(Object, Throwables.Function), #tryOrDefaultIfExceptionOccurred(Callable, Supplier), Try#call(Throwables.Function)
-
Signature:
@Beta public static <T, R> Nullable<R> tryOrEmptyIfExceptionOccurred(final T init, final Throwables.Function<? super T, ? extends R, ? extends Exception> func) - Summary: Applies the function to the initial value and returns the result wrapped in a {@code Nullable} .
-
Contract:
- Returns an empty {@code Nullable} if an exception occurs during execution.
-
Parameters:
-
init(T) — the initial value to pass to the function -
func(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to apply
-
- Returns: a {@code Nullable} containing the result, or empty if an exception occurs
- See also: #tryOrEmptyIfExceptionOccurred(Callable), #tryOrDefaultIfExceptionOccurred(Object, Throwables.Function, Supplier), Try#call(Throwables.Function)
tryOrDefaultIfExceptionOccurred(...) -> R
-
Signature:
@Beta public static <R> R tryOrDefaultIfExceptionOccurred(final Callable<R> cmd, final Supplier<R> supplierForDefaultIfExceptionOccurred) - Summary: Executes the callable and returns the result.
-
Contract:
- Returns the result from the supplier if an exception occurs during execution.
-
Parameters:
-
cmd(Callable<R>) — the callable to execute -
supplierForDefaultIfExceptionOccurred(Supplier<R>) — the supplier to provide default value on exception
-
- Returns: the result of the callable, or the result from the supplier on exception
- See also: #tryOrDefaultIfExceptionOccurred(Callable, Comparable), #tryOrEmptyIfExceptionOccurred(Callable), Try#call(Throwables.Function, Supplier)
-
Signature:
@Beta public static <R extends Comparable<? super R>> R tryOrDefaultIfExceptionOccurred(final Callable<R> cmd, final R defaultIfExceptionOccurred) - Summary: Executes the callable and returns the result.
-
Contract:
- Returns the provided default value if an exception occurs during execution.
-
Parameters:
-
cmd(Callable<R>) — the callable to execute -
defaultIfExceptionOccurred(R) — the default value to return on exception
-
- Returns: the result of the callable, or the default value on exception
- See also: #tryOrDefaultIfExceptionOccurred(Callable, Supplier), #tryOrEmptyIfExceptionOccurred(Callable), Try#call(Throwables.Function)
-
Signature:
@Beta public static <T, R> R tryOrDefaultIfExceptionOccurred(final T init, final Throwables.Function<? super T, ? extends R, ? extends Exception> func, final Supplier<R> supplierForDefaultIfExceptionOccurred) - Summary: Applies the function to the initial value and returns the result.
-
Contract:
- Returns the result from the supplier if an exception occurs during execution.
-
Parameters:
-
init(T) — the initial value to pass to the function -
func(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to apply -
supplierForDefaultIfExceptionOccurred(Supplier<R>) — the supplier to provide default value on exception
-
- Returns: the result of the function, or the result from the supplier on exception
- See also: #tryOrDefaultIfExceptionOccurred(Object, Throwables.Function, Comparable), #tryOrEmptyIfExceptionOccurred(Object, Throwables.Function), Try#call(Throwables.Function, Supplier)
-
Signature:
@Beta public static <T, R extends Comparable<? super R>> R tryOrDefaultIfExceptionOccurred(final T init, final Throwables.Function<? super T, ? extends R, ? extends Exception> func, final R defaultIfExceptionOccurred) - Summary: Applies the function to the initial value and returns the result.
-
Contract:
- Returns the provided default value if an exception occurs during execution.
-
Parameters:
-
init(T) — the initial value to pass to the function -
func(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function to apply -
defaultIfExceptionOccurred(R) — the default value to return on exception
-
- Returns: the result of the function, or the default value on exception
- See also: #tryOrDefaultIfExceptionOccurred(Object, Throwables.Function, Supplier), #tryOrEmptyIfExceptionOccurred(Object, Throwables.Function), Try#call(Throwables.Function)
ifOrEmpty(...) -> Nullable<R>
-
Signature:
@Beta public static <R, E extends Exception> Nullable<R> ifOrEmpty(final boolean b, final Throwables.Supplier<R, E> supplier) throws E - Summary: Returns a {@code Nullable} containing the result of the supplier if the condition is {@code true} .
-
Contract:
- Returns a {@code Nullable} containing the result of the supplier if the condition is {@code true} .
- Returns an empty {@code Nullable} if the condition is {@code false} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code boolean hasPermission = checkPermission(user); Nullable<String> data = N.ifOrEmpty(hasPermission, () -> fetchSensitiveData()); // Returns Nullable.of(data) if hasPermission is true, Nullable.empty() otherwise } </pre>
-
Parameters:
-
b(boolean) — the condition to evaluate -
supplier(Throwables.Supplier<R, E>) — the supplier to execute if the condition is true
-
- Returns: a {@code Nullable} containing the result if condition is {@code true} , empty otherwise
-
Throws:
-
E— if the supplier throws an exception
-
- See also: #ifNotNull(Object, Throwables.Consumer)
ifOrElse(...) -> void
-
Signature:
@Deprecated public static <E1 extends Exception, E2 extends Exception> void ifOrElse(final boolean b, final Throwables.Runnable<E1> actionForTrue, final Throwables.Runnable<E2> actionForFalse) throws E1, E2 - Summary: Executes one of two actions based on the boolean condition.
-
Contract:
- Executes actionForTrue if the condition is {@code true} , otherwise executes actionForFalse.
- Skips execution if the corresponding action is {@code null} .
-
Parameters:
-
b(boolean) — the boolean condition to test -
actionForTrue(Throwables.Runnable<E1>) — the action to execute if condition is {@code true} (may be {@code null} ) -
actionForFalse(Throwables.Runnable<E2>) — the action to execute if condition is {@code false} (may be {@code null} )
-
-
Throws:
-
E1— if condition is {@code true} and actionForTrue throws an exception -
E2— if condition is {@code false} and actionForFalse throws an exception
-
ifNotNull(...) -> void
-
Signature:
@Beta public static <T, E extends Exception> void ifNotNull(final T obj, final Throwables.Consumer<? super T, E> cmd) throws E - Summary: Executes the consumer with the object if the object is not {@code null} .
-
Contract:
- Executes the consumer with the object if the object is not {@code null} .
- Does nothing if the object is {@code null} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code User user = findUser(userId); N.ifNotNull(user, u -> { System.out.println("User: " + u.getName()); }); // Executes consumer only if user is not null } </pre>
-
Parameters:
-
obj(T) — the object to check for null -
cmd(Throwables.Consumer<? super T, E>) — the consumer to execute if object is not null
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: #ifNotEmpty(CharSequence, Throwables.Consumer), #ifOrEmpty(boolean, Throwables.Supplier)
ifNotEmpty(...) -> void
-
Signature:
@Beta public static <CS extends CharSequence, E extends Exception> void ifNotEmpty(final CS c, final Throwables.Consumer<? super CS, E> cmd) throws E - Summary: Executes the consumer with the CharSequence if it is not {@code null} or empty.
-
Contract:
- Executes the consumer with the CharSequence if it is not {@code null} or empty.
- Does nothing if the CharSequence is {@code null} or empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code String name = getUserInput(); N.ifNotEmpty(name, n -> { System.out.println("Hello, " + n); }); // Executes consumer only if name is not null and not empty } </pre>
-
Parameters:
-
c(CS) — the CharSequence to check -
cmd(Throwables.Consumer<? super CS, E>) — the consumer to execute if CharSequence is not empty
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: #ifNotEmpty(Collection, Throwables.Consumer), #ifNotNull(Object, Throwables.Consumer)
-
Signature:
@SuppressWarnings("rawtypes") @Beta public static <C extends Collection, E extends Exception> void ifNotEmpty(final C c, final Throwables.Consumer<? super C, E> cmd) throws E - Summary: Executes the consumer with the collection if it is not {@code null} or empty.
-
Contract:
- Executes the consumer with the collection if it is not {@code null} or empty.
- Does nothing if the collection is {@code null} or empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code List<User> users = findActiveUsers(); N.ifNotEmpty(users, list -> { System.out.println("Found " + list.size() + " active users"); }); // Executes consumer only if users is not null and not empty } </pre>
-
Parameters:
-
c(C) — the collection to check -
cmd(Throwables.Consumer<? super C, E>) — the consumer to execute if collection is not empty
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: #ifNotEmpty(Map, Throwables.Consumer), #ifNotEmpty(CharSequence, Throwables.Consumer)
-
Signature:
@SuppressWarnings("rawtypes") @Beta public static <M extends Map, E extends Exception> void ifNotEmpty(final M m, final Throwables.Consumer<? super M, E> cmd) throws E - Summary: Executes the consumer with the map if it is not {@code null} or empty.
-
Contract:
- Executes the consumer with the map if it is not {@code null} or empty.
- Does nothing if the map is {@code null} or empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, String> config = loadConfig(); N.ifNotEmpty(config, map -> { System.out.println("Loaded " + map.size() + " config entries"); }); // Executes consumer only if config is not null and not empty } </pre>
-
Parameters:
-
m(M) — the map to check -
cmd(Throwables.Consumer<? super M, E>) — the consumer to execute if map is not empty
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: #ifNotEmpty(Collection, Throwables.Consumer), #ifNotNull(Object, Throwables.Consumer)
sleep(...) -> void
-
Signature:
public static void sleep(final long timeoutInMillis) - Summary: Pauses the execution of the current thread for the specified time in milliseconds.
-
Contract:
- Does nothing if the timeout is zero or negative.
- If the thread is interrupted during sleep, throws RuntimeException with the interrupted status restored.
- <p> <b> Usage Examples: </b> </p> <pre> {@code N.sleep(1); // Sleeps for 1 millisecond // Throws RuntimeException if interrupted } </pre>
-
Parameters:
-
timeoutInMillis(long) — the time to sleep in milliseconds
-
- See also: #sleep(long, TimeUnit), #sleepUninterruptibly(long)
-
Signature:
public static void sleep(final long timeout, @NotNull final TimeUnit unit) throws IllegalArgumentException - Summary: Pauses the execution of the current thread for the specified time with the given time unit.
-
Contract:
- Does nothing if the timeout is zero or negative.
- If the thread is interrupted during sleep, throws RuntimeException with the interrupted status restored.
- <p> <b> Usage Examples: </b> </p> <pre> {@code N.sleep(5, TimeUnit.MILLISECONDS); // Sleeps for 5 milliseconds N.sleep(500, TimeUnit.MICROSECONDS); // Sleeps for 500 microseconds // Throws RuntimeException if interrupted } </pre>
-
Parameters:
-
timeout(long) — the time to sleep -
unit(@NotNull TimeUnit) — the time unit for the timeout parameter
-
-
Throws:
-
java.lang.IllegalArgumentException— if unit is {@code null}
-
- See also: #sleep(long), #sleepUninterruptibly(long, TimeUnit)
sleepUninterruptibly(...) -> void
-
Signature:
public static void sleepUninterruptibly(final long timeoutInMillis) - Summary: Pauses the execution of the current thread for the specified time in an uninterruptible manner.
-
Contract:
- This method will continue to sleep for the full duration even if the thread is interrupted, re-establishing the interrupt status only after the sleep completes.
- </p> <p> When a thread is interrupted during the sleep call, this method continues to block until the full timeout duration elapses, and only then re-interrupts the thread by calling {@link Thread#interrupt()} to restore the interrupted status.
- </p> <p> This behavior is useful when you need guaranteed sleep duration regardless of interruptions, such as rate limiting, retry delays, or time-based coordination where partial sleep would break the timing contract.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Rate limiting: ensure minimum delay between operations N.sleepUninterruptibly(1); // Always sleeps for 1 millisecond // Retry with fixed delay - won't be shortened by interrupts int maxRetries = 2; long retryDelayMs = 1L; String result = null; for (int attempt = 0; attempt < maxRetries; attempt++) { try { result = "ok"; break; } catch (Exception e) { if (attempt < maxRetries - 1) { N.sleepUninterruptibly(retryDelayMs); } } } } </pre>
-
Parameters:
-
timeoutInMillis(long) — the time to sleep in milliseconds. If zero or negative, the method returns immediately without sleeping
-
- See also: #sleep(long), #sleep(long, TimeUnit), Thread#interrupt(), TimeUnit#sleep(long)
-
Signature:
public static void sleepUninterruptibly(final long timeout, @NotNull final TimeUnit unit) throws IllegalArgumentException - Summary: Pauses the execution of the current thread for the specified time with the given time unit in an uninterruptible manner.
-
Contract:
- This method will continue to sleep for the full duration even if the thread is interrupted, re-establishing the interrupt status only after the sleep completes.
- </p> <p> When a thread is interrupted during the sleep call, this method continues to block until the full timeout duration elapses, and only then re-interrupts the thread by calling {@link Thread#interrupt()} to restore the interrupted status.
- </p> <p> This behavior is useful when you need guaranteed sleep duration regardless of interruptions, such as rate limiting, retry delays, or time-based coordination where partial sleep would break the timing contract.
-
Parameters:
-
timeout(long) — the time to sleep. If zero or negative, the method returns immediately without sleeping -
unit(@NotNull TimeUnit) — the time unit for the timeout parameter. Must not be null
-
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {@code unit} is {@code null}
-
- See also: #sleepUninterruptibly(long),for detailed documentation and usage examples, #sleep(long, TimeUnit), TimeUnit, Thread#interrupt()
lazyInit(...) -> com.landawn.abacus.util.function.Supplier<T>
-
Signature:
@Beta public static <T> com.landawn.abacus.util.function.Supplier<T> lazyInit(final Supplier<T> supplier) - Summary: Creates a lazy-initialized supplier from the provided supplier that defers computation until first access.
-
Contract:
- <p> This is particularly useful for expensive computations or resource initialization that should only happen if and when the value is actually needed, and should be computed only once.
-
Parameters:
-
supplier(Supplier<T>) — the supplier to be lazily initialized, must not be null
-
- Returns: a thread-safe lazy-initialized supplier that caches the result of the first call
- See also: LazyInitializer#of(Supplier), #lazyInitialize(Throwables.Supplier)
lazyInitialize(...) -> Throwables.Supplier<T, E>
-
Signature:
@Beta public static <T, E extends Exception> Throwables.Supplier<T, E> lazyInitialize(final Throwables.Supplier<T, E> supplier) - Summary: Creates a lazy-initialized supplier from the provided exception-throwing supplier that defers computation until first access.
-
Contract:
- <p> This is particularly useful for expensive computations or resource initialization that may throw checked exceptions and should only happen if and when the value is actually needed.
- </p> <p> <strong> Exception behavior: </strong> If the underlying supplier throws an exception on the first call, that exception will be propagated and the supplier will remain uninitialized.
-
Parameters:
-
supplier(Throwables.Supplier<T, E>) — the exception-throwing supplier to be lazily initialized, must not be null
-
- Returns: a thread-safe lazy-initialized supplier that caches the result of the first successful call
- See also: Throwables.LazyInitializer#of(Throwables.Supplier), #lazyInit(Supplier)
toRuntimeException(...) -> RuntimeException
-
Signature:
@Beta public static RuntimeException toRuntimeException(final Exception e) - Summary: Converts the specified {@code Exception} to a {@code RuntimeException} if it's a checked {@code exception} , otherwise returns itself.
-
Contract:
- Converts the specified {@code Exception} to a {@code RuntimeException} if it's a checked {@code exception} , otherwise returns itself.
-
Parameters:
-
e(Exception) — the exception to be converted to a runtime exception.
-
- Returns: a RuntimeException that represents the provided exception.
- See also: ExceptionUtil#toRuntimeException(Exception), ExceptionUtil#toRuntimeException(Exception, boolean), ExceptionUtil#toRuntimeException(Throwable), ExceptionUtil#toRuntimeException(Throwable, boolean), ExceptionUtil#toRuntimeException(Throwable, boolean, boolean), ExceptionUtil#registerRuntimeExceptionMapper(Class, Function)
-
Signature:
@Beta public static RuntimeException toRuntimeException(final Exception e, final boolean callInterrupt) - Summary: Converts the specified Exception to a RuntimeException with option to call Thread.interrupt().
-
Contract:
- Useful when handling InterruptedException to preserve interrupted status.
-
Parameters:
-
e(Exception) — the exception to be converted to a runtime exception. -
callInterrupt(boolean) — whether to call {@code Thread.currentThread().interrupt()} if the exception is an InterruptedException
-
- Returns: a RuntimeException that represents the provided exception.
- See also: ExceptionUtil#toRuntimeException(Exception), ExceptionUtil#toRuntimeException(Exception, boolean), ExceptionUtil#toRuntimeException(Throwable), ExceptionUtil#toRuntimeException(Throwable, boolean), ExceptionUtil#toRuntimeException(Throwable, boolean, boolean), ExceptionUtil#registerRuntimeExceptionMapper(Class, Function)
-
Signature:
@Beta public static RuntimeException toRuntimeException(final Throwable e) - Summary: Converts the specified {@code Throwable} to a {@code RuntimeException} if it's a checked {@code exception} or an {@code Error} , otherwise returns itself.
-
Contract:
- Converts the specified {@code Throwable} to a {@code RuntimeException} if it's a checked {@code exception} or an {@code Error} , otherwise returns itself.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Handling any Throwable in a catch block try { riskyOperation(); } catch (Throwable t) { // Can handle both Exceptions and Errors throw N.toRuntimeException(t); // Wraps errors and checked exceptions } // Use when catching Throwable from reflection or proxies try { Method method = obj.getClass().getMethod("someMethod"); method.invoke(obj); } catch (Throwable t) { // InvocationTargetException, Error, etc.
-
Parameters:
-
e(Throwable) — the throwable to be converted to a runtime exception.
-
- Returns: a RuntimeException that represents the provided throwable.
- See also: ExceptionUtil#toRuntimeException(Throwable), ExceptionUtil#toRuntimeException(Throwable, boolean), ExceptionUtil#toRuntimeException(Throwable, boolean, boolean), ExceptionUtil#registerRuntimeExceptionMapper(Class, Function)
println(...) -> T
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T println(final T obj) - Summary: Prints the given object's string representation to the standard output stream (System.out) and returns the object.
-
Parameters:
-
obj(T) — the object to be printed, may be null
-
- Returns: the same object that was printed, enabling method chaining
- See also: #toString(Object), #fprintln(String, Object...), System#out
fprintln(...) -> void
-
Signature:
public static void fprintln(final String format, final Object... args) - Summary: Prints a formatted string to the standard output stream (System.out) followed by a newline using the specified format string and arguments.
-
Parameters:
-
format(String) — the format string as described in {@link java.util.Formatter} . Must not be null -
args(Object[]) — the arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero
-
- See also: String#format(String, Object...), java.io.PrintStream#printf(String, Object...), #println(Object), java.util.Formatter
Public Instance Methods
- (none)
Class NameUtil (com.landawn.abacus.util.NameUtil)
A utility class for efficient string name management and conversion between simple names and canonical names.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
isCachedName(...) -> boolean
-
Signature:
public static boolean isCachedName(final String str) - Summary: Checks if the specified string is present in the cached name pool.
-
Contract:
- Checks if the specified string is present in the cached name pool.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code if (NameUtil.isCachedName("firstName")) { // Name is already cached } } </pre>
-
Parameters:
-
str(String) — the string to check for presence in the cache
-
- Returns: {@code true} if the string is in the cached name pool, {@code false} otherwise
getCachedName(...) -> String
-
Signature:
public static String getCachedName(final String str) - Summary: Retrieves a cached version of the specified string, caching it if necessary.
-
Contract:
- Retrieves a cached version of the specified string, caching it if necessary.
- <p> If the string is not already in the cache, it will be added (if space permits) and then returned.
-
Parameters:
-
str(String) — the string to retrieve from cache or add to cache
-
- Returns: the cached version of the string
cacheName(...) -> String
-
Signature:
public static String cacheName(String name, final boolean force) - Summary: Caches the specified name string in the internal pool.
-
Contract:
- <p> This method interns the string and adds it to the cache pool if there's available space.
-
Parameters:
-
name(String) — the name string to cache -
force(boolean) — if {@code true} , ignores whether the name is already cached; if {@code false} , skips caching if already present
-
- Returns: the interned version of the name string
isCanonicalName(...) -> boolean
-
Signature:
public static boolean isCanonicalName(final String parentName, final String name) - Summary: Checks if the specified name is a canonical name relative to the given parent name.
-
Contract:
- Checks if the specified name is a canonical name relative to the given parent name.
- <p> A name is considered canonical relative to a parent if it starts with the parent name followed by a period.
-
Parameters:
-
parentName(String) — the parent name to check against -
name(String) — the name to verify as canonical
-
- Returns: {@code true} if the name starts with parentName + ".", {@code false} otherwise
getSimpleName(...) -> String
-
Signature:
public static String getSimpleName(final String name) - Summary: Extracts the simple name from a canonical name.
-
Contract:
- If the name contains no dots, it returns the name as-is.
-
Parameters:
-
name(String) — the canonical name from which to extract the simple name
-
- Returns: the simple name (last component after the final dot)
getParentName(...) -> String
-
Signature:
public static String getParentName(final String name) - Summary: Extracts the parent name from a canonical name.
-
Contract:
- If the name contains no dots or only a leading dot, it returns an empty string.
-
Parameters:
-
name(String) — the canonical name from which to extract the parent name
-
- Returns: the parent name (everything before the last dot), or an empty string if the name is not a canonical property name
Public Instance Methods
- (none)
Enum NamingPolicy (com.landawn.abacus.util.NamingPolicy)
An enumeration representing different naming conventions for string transformation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
convert(...) -> String
-
Signature:
public String convert(final String str) - Summary: Converts the specified string according to this naming policy's transformation rules.
-
Parameters:
-
str(String) — the string to convert; may be {@code null} , empty, or contain various separators (underscores, hyphens, spaces) or be in camelCase/UpperCamelCase format
-
- Returns: the converted string according to this naming policy's rules; returns {@code null} if the input is {@code null} , returns an empty string if the input is empty, otherwise returns the result of applying the policy's transformation function to the input string
- See also: #asFunction()
asFunction(...) -> Function<String, String>
-
Signature:
@Deprecated @Beta public Function<String, String> asFunction() - Summary: Returns the underlying function that performs the string conversion.
-
Contract:
- <p> This method provides access to the raw conversion function, which can be useful when you need to pass the converter to methods that accept functions or when composing multiple transformations.
-
Parameters:
- (none)
- Returns: the function that performs the string transformation for this policy
Interface NoCachingNoUpdating (com.landawn.abacus.util.NoCachingNoUpdating)
Interface marking objects that should not be cached or updated.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class DisposableArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableArray)
A wrapper class for arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableArray<T>
-
Signature:
public static <T> DisposableArray<T> create(final Class<T> componentType, final int len) - Summary: Creates a new DisposableArray with a new array of the specified component type and length.
-
Parameters:
-
componentType(Class<T>) — the class of the array elements -
len(int) — the length of the array
-
- Returns: a new DisposableArray instance
wrap(...) -> DisposableArray<T>
-
Signature:
public static <T> DisposableArray<T> wrap(final T[] a) - Summary: Wraps an existing array in a DisposableArray.
-
Parameters:
-
a(T[]) — the array to wrap
-
- Returns: a new DisposableArray wrapping the given array
Public Instance Methods
get(...) -> T
-
Signature:
public T get(final int index) - Summary: Returns the element at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped array.
-
Parameters:
- (none)
- Returns: the length of the array
toArray(...) -> A\[\]
-
Signature:
@SuppressWarnings("unchecked") public <A> A[] toArray(A[] target) - Summary: Copies the elements to the specified array.
-
Contract:
- If the target array is too small, a new array of the same type is allocated.
-
Parameters:
-
target(A[]) — the array into which the elements are to be stored
-
- Returns: an array containing the elements
copy(...) -> T\[\]
-
Signature:
public T[] copy() - Summary: Creates a copy of the wrapped array.
-
Contract:
- This method should be used when you need to cache or modify the array data.
-
Parameters:
- (none)
- Returns: a new array containing copies of the elements
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Converts the array to a List.
-
Parameters:
- (none)
- Returns: a new List containing the array elements
toSet(...) -> Set<T>
-
Signature:
public Set<T> toSet() - Summary: Converts the array to a Set.
-
Parameters:
- (none)
- Returns: a new Set containing the unique array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<T>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the array elements
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.Consumer<? super T, E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super T[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super T[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super T[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super T[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
iterator(...) -> Iterator<T>
-
Signature:
@Override public Iterator<T> iterator() -
Parameters:
- (none)
- Returns: unspecified
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableObjArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableObjArray)
A specialized DisposableArray for Object arrays.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableObjArray
-
Signature:
public static DisposableObjArray create(final int len) - Summary: Creates a new DisposableObjArray with a new Object array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableObjArray instance
-
Signature:
@Deprecated public static <T> DisposableArray<T> create(final Class<T> componentType, final int len) throws UnsupportedOperationException - Summary: This method is not supported for DisposableObjArray.
-
Parameters:
-
componentType(Class<T>) — the component type (not used) -
len(int) — the length (not used)
-
- Returns: never returns
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown
-
wrap(...) -> DisposableObjArray
-
Signature:
public static DisposableObjArray wrap(final Object[] a) - Summary: Wraps an existing Object array in a DisposableObjArray.
-
Parameters:
-
a(Object[]) — the Object array to wrap
-
- Returns: a new DisposableObjArray wrapping the given array
Public Instance Methods
- (none)
Class DisposableBooleanArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableBooleanArray)
A wrapper class for boolean arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableBooleanArray
-
Signature:
public static DisposableBooleanArray create(final int len) - Summary: Creates a new DisposableBooleanArray with a new boolean array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableBooleanArray instance
wrap(...) -> DisposableBooleanArray
-
Signature:
public static DisposableBooleanArray wrap(final boolean[] a) - Summary: Wraps an existing boolean array in a DisposableBooleanArray.
-
Parameters:
-
a(boolean[]) — the boolean array to wrap
-
- Returns: a new DisposableBooleanArray wrapping the given array
Public Instance Methods
get(...) -> boolean
-
Signature:
public boolean get(final int index) - Summary: Returns the boolean value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the boolean value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped boolean array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> boolean\[\]
-
Signature:
public boolean[] copy() - Summary: Creates a copy of the wrapped boolean array.
-
Parameters:
- (none)
- Returns: a new boolean array containing copies of the elements
box(...) -> Boolean\[\]
-
Signature:
public Boolean[] box() - Summary: Converts the boolean array to a Boolean object array.
-
Contract:
- This is useful when you need to work with the wrapper type.
-
Parameters:
- (none)
- Returns: a new Boolean array containing boxed values
toList(...) -> BooleanList
-
Signature:
public BooleanList toList() - Summary: Converts the array to a BooleanList.
-
Parameters:
- (none)
- Returns: a new BooleanList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Boolean>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.BooleanConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.BooleanConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super boolean[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super boolean[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super boolean[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super boolean[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableCharArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableCharArray)
A wrapper class for char arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableCharArray
-
Signature:
public static DisposableCharArray create(final int len) - Summary: Creates a new DisposableCharArray with a new char array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableCharArray instance
wrap(...) -> DisposableCharArray
-
Signature:
public static DisposableCharArray wrap(final char[] a) - Summary: Wraps an existing char array in a DisposableCharArray.
-
Parameters:
-
a(char[]) — the char array to wrap
-
- Returns: a new DisposableCharArray wrapping the given array
Public Instance Methods
get(...) -> char
-
Signature:
public char get(final int index) - Summary: Returns the char value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the char value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped char array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> char\[\]
-
Signature:
public char[] copy() - Summary: Creates a copy of the wrapped char array.
-
Parameters:
- (none)
- Returns: a new char array containing copies of the elements
box(...) -> Character\[\]
-
Signature:
public Character[] box() - Summary: Converts the char array to a Character object array.
-
Parameters:
- (none)
- Returns: a new Character array containing boxed values
toList(...) -> CharList
-
Signature:
public CharList toList() - Summary: Converts the array to a CharList.
-
Parameters:
- (none)
- Returns: a new CharList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Character>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> int
-
Signature:
public int sum() - Summary: Calculates the sum of all char values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all char values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> char
-
Signature:
public char min() - Summary: Finds the minimum char value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> char
-
Signature:
public char max() - Summary: Finds the maximum char value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.CharConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.CharConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super char[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super char[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super char[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super char[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableByteArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableByteArray)
A wrapper class for byte arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableByteArray
-
Signature:
public static DisposableByteArray create(final int len) - Summary: Creates a new DisposableByteArray with a new byte array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableByteArray instance
wrap(...) -> DisposableByteArray
-
Signature:
public static DisposableByteArray wrap(final byte[] a) - Summary: Wraps an existing byte array in a DisposableByteArray.
-
Parameters:
-
a(byte[]) — the byte array to wrap
-
- Returns: a new DisposableByteArray wrapping the given array
Public Instance Methods
get(...) -> byte
-
Signature:
public byte get(final int index) - Summary: Returns the byte value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the byte value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped byte array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> byte\[\]
-
Signature:
public byte[] copy() - Summary: Creates a copy of the wrapped byte array.
-
Parameters:
- (none)
- Returns: a new byte array containing copies of the elements
box(...) -> Byte\[\]
-
Signature:
public Byte[] box() - Summary: Converts the byte array to a Byte object array.
-
Parameters:
- (none)
- Returns: a new Byte array containing boxed values
toList(...) -> ByteList
-
Signature:
public ByteList toList() - Summary: Converts the array to a ByteList.
-
Parameters:
- (none)
- Returns: a new ByteList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Byte>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> int
-
Signature:
public int sum() - Summary: Calculates the sum of all byte values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all byte values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> byte
-
Signature:
public byte min() - Summary: Finds the minimum byte value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> byte
-
Signature:
public byte max() - Summary: Finds the maximum byte value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.ByteConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.ByteConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super byte[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super byte[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super byte[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super byte[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableShortArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableShortArray)
A wrapper class for short arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableShortArray
-
Signature:
public static DisposableShortArray create(final int len) - Summary: Creates a new DisposableShortArray with a new short array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableShortArray instance
wrap(...) -> DisposableShortArray
-
Signature:
public static DisposableShortArray wrap(final short[] a) - Summary: Wraps an existing short array in a DisposableShortArray.
-
Parameters:
-
a(short[]) — the short array to wrap
-
- Returns: a new DisposableShortArray wrapping the given array
Public Instance Methods
get(...) -> short
-
Signature:
public short get(final int index) - Summary: Returns the short value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the short value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped short array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> short\[\]
-
Signature:
public short[] copy() - Summary: Creates a copy of the wrapped short array.
-
Parameters:
- (none)
- Returns: a new short array containing copies of the elements
box(...) -> Short\[\]
-
Signature:
public Short[] box() - Summary: Converts the short array to a Short object array.
-
Parameters:
- (none)
- Returns: a new Short array containing boxed values
toList(...) -> ShortList
-
Signature:
public ShortList toList() - Summary: Converts the array to a ShortList.
-
Parameters:
- (none)
- Returns: a new ShortList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Short>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> int
-
Signature:
public int sum() - Summary: Calculates the sum of all short values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all short values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> short
-
Signature:
public short min() - Summary: Finds the minimum short value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> short
-
Signature:
public short max() - Summary: Finds the maximum short value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.ShortConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.ShortConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super short[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super short[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super short[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super short[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableIntArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableIntArray)
A wrapper class for int arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableIntArray
-
Signature:
public static DisposableIntArray create(final int len) - Summary: Creates a new DisposableIntArray with a new int array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableIntArray instance
wrap(...) -> DisposableIntArray
-
Signature:
public static DisposableIntArray wrap(final int[] a) - Summary: Wraps an existing int array in a DisposableIntArray.
-
Parameters:
-
a(int[]) — the int array to wrap
-
- Returns: a new DisposableIntArray wrapping the given array
Public Instance Methods
get(...) -> int
-
Signature:
public int get(final int index) - Summary: Returns the int value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the int value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped int array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> int\[\]
-
Signature:
public int[] copy() - Summary: Creates a copy of the wrapped int array.
-
Parameters:
- (none)
- Returns: a new int array containing copies of the elements
box(...) -> Integer\[\]
-
Signature:
public Integer[] box() - Summary: Converts the int array to an Integer object array.
-
Parameters:
- (none)
- Returns: a new Integer array containing boxed values
toList(...) -> IntList
-
Signature:
public IntList toList() - Summary: Converts the array to an IntList.
-
Parameters:
- (none)
- Returns: a new IntList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Integer>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> int
-
Signature:
public int sum() - Summary: Calculates the sum of all int values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all int values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> int
-
Signature:
public int min() - Summary: Finds the minimum int value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> int
-
Signature:
public int max() - Summary: Finds the maximum int value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.IntConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.IntConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super int[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super int[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super int[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super int[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableLongArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableLongArray)
A wrapper class for long arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableLongArray
-
Signature:
public static DisposableLongArray create(final int len) - Summary: Creates a new DisposableLongArray with a new long array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableLongArray instance
wrap(...) -> DisposableLongArray
-
Signature:
public static DisposableLongArray wrap(final long[] a) - Summary: Wraps an existing long array in a DisposableLongArray.
-
Parameters:
-
a(long[]) — the long array to wrap
-
- Returns: a new DisposableLongArray wrapping the given array
Public Instance Methods
get(...) -> long
-
Signature:
public long get(final int index) - Summary: Returns the long value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the long value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped long array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> long\[\]
-
Signature:
public long[] copy() - Summary: Creates a copy of the wrapped long array.
-
Parameters:
- (none)
- Returns: a new long array containing copies of the elements
box(...) -> Long\[\]
-
Signature:
public Long[] box() - Summary: Converts the long array to a Long object array.
-
Parameters:
- (none)
- Returns: a new Long array containing boxed values
toList(...) -> LongList
-
Signature:
public LongList toList() - Summary: Converts the array to a LongList.
-
Parameters:
- (none)
- Returns: a new LongList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Long>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> long
-
Signature:
public long sum() - Summary: Calculates the sum of all long values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all long values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> long
-
Signature:
public long min() - Summary: Finds the minimum long value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> long
-
Signature:
public long max() - Summary: Finds the maximum long value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.LongConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.LongConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super long[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super long[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super long[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super long[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableFloatArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableFloatArray)
A wrapper class for float arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableFloatArray
-
Signature:
public static DisposableFloatArray create(final int len) - Summary: Creates a new DisposableFloatArray with a new float array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableFloatArray instance
wrap(...) -> DisposableFloatArray
-
Signature:
public static DisposableFloatArray wrap(final float[] a) - Summary: Wraps an existing float array in a DisposableFloatArray.
-
Parameters:
-
a(float[]) — the float array to wrap
-
- Returns: a new DisposableFloatArray wrapping the given array
Public Instance Methods
get(...) -> float
-
Signature:
public float get(final int index) - Summary: Returns the float value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the float value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped float array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> float\[\]
-
Signature:
public float[] copy() - Summary: Creates a copy of the wrapped float array.
-
Parameters:
- (none)
- Returns: a new float array containing copies of the elements
box(...) -> Float\[\]
-
Signature:
public Float[] box() - Summary: Converts the float array to a Float object array.
-
Parameters:
- (none)
- Returns: a new Float array containing boxed values
toList(...) -> FloatList
-
Signature:
public FloatList toList() - Summary: Converts the array to a FloatList.
-
Parameters:
- (none)
- Returns: a new FloatList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Float>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> float
-
Signature:
public float sum() - Summary: Calculates the sum of all float values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all float values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> float
-
Signature:
public float min() - Summary: Finds the minimum float value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> float
-
Signature:
public float max() - Summary: Finds the maximum float value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.FloatConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.FloatConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super float[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super float[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super float[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super float[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableDoubleArray (com.landawn.abacus.util.NoCachingNoUpdating.DisposableDoubleArray)
A wrapper class for double arrays that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableDoubleArray
-
Signature:
public static DisposableDoubleArray create(final int len) - Summary: Creates a new DisposableDoubleArray with a new double array of the specified length.
-
Parameters:
-
len(int) — the length of the array
-
- Returns: a new DisposableDoubleArray instance
wrap(...) -> DisposableDoubleArray
-
Signature:
public static DisposableDoubleArray wrap(final double[] a) - Summary: Wraps an existing double array in a DisposableDoubleArray.
-
Parameters:
-
a(double[]) — the double array to wrap
-
- Returns: a new DisposableDoubleArray wrapping the given array
Public Instance Methods
get(...) -> double
-
Signature:
public double get(final int index) - Summary: Returns the double value at the specified index.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the double value at the specified index
length(...) -> int
-
Signature:
public int length() - Summary: Returns the length of the wrapped double array.
-
Parameters:
- (none)
- Returns: the length of the array
copy(...) -> double\[\]
-
Signature:
public double[] copy() - Summary: Creates a copy of the wrapped double array.
-
Parameters:
- (none)
- Returns: a new double array containing copies of the elements
box(...) -> Double\[\]
-
Signature:
public Double[] box() - Summary: Converts the double array to a Double object array.
-
Parameters:
- (none)
- Returns: a new Double array containing boxed values
toList(...) -> DoubleList
-
Signature:
public DoubleList toList() - Summary: Converts the array to a DoubleList.
-
Parameters:
- (none)
- Returns: a new DoubleList containing the array elements
toCollection(...) -> C
-
Signature:
public <C extends Collection<Double>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the array to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing the boxed array elements
sum(...) -> double
-
Signature:
public double sum() - Summary: Calculates the sum of all double values in the array.
-
Parameters:
- (none)
- Returns: the sum of all elements
average(...) -> double
-
Signature:
public double average() - Summary: Calculates the average of all double values in the array.
-
Parameters:
- (none)
- Returns: the average of all elements, or 0 if the array is empty
min(...) -> double
-
Signature:
public double min() - Summary: Finds the minimum double value in the array.
-
Parameters:
- (none)
- Returns: the minimum value
max(...) -> double
-
Signature:
public double max() - Summary: Finds the maximum double value in the array.
-
Parameters:
- (none)
- Returns: the maximum value
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.DoubleConsumer<E> action) throws E - Summary: Performs the given action for each element of the array.
-
Parameters:
-
action(Throwables.DoubleConsumer<E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super double[], ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped array and returns the result.
-
Parameters:
-
func(Throwables.Function<? super double[], ? extends R, E>) — the function to apply to the array
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super double[], E> action) throws E - Summary: Performs the given action with the wrapped array.
-
Parameters:
-
action(Throwables.Consumer<? super double[], E>) — the action to perform with the array
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the array elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the array elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableDeque (com.landawn.abacus.util.NoCachingNoUpdating.DisposableDeque)
A wrapper class for Deque that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> DisposableDeque<T>
-
Signature:
public static <T> DisposableDeque<T> create(final int len) - Summary: Creates a new DisposableDeque with a new ArrayDeque of the specified initial capacity.
-
Parameters:
-
len(int) — the initial capacity of the deque
-
- Returns: a new DisposableDeque instance
wrap(...) -> DisposableDeque<T>
-
Signature:
public static <T> DisposableDeque<T> wrap(final Deque<T> deque) - Summary: Wraps an existing Deque in a DisposableDeque.
-
Parameters:
-
deque(Deque<T>) — the deque to wrap
-
- Returns: a new DisposableDeque wrapping the given deque
Public Instance Methods
size(...) -> int
-
Signature:
public int size() - Summary: Returns the number of elements in the deque.
-
Parameters:
- (none)
- Returns: the size of the deque
getFirst(...) -> T
-
Signature:
public T getFirst() - Summary: Retrieves the first element of the deque.
-
Parameters:
- (none)
- Returns: the first element of the deque
getLast(...) -> T
-
Signature:
public T getLast() - Summary: Retrieves the last element of the deque.
-
Parameters:
- (none)
- Returns: the last element of the deque
toArray(...) -> A\[\]
-
Signature:
public <A> A[] toArray(final A[] a) - Summary: Copies all elements from the deque to the specified array.
-
Contract:
- If the array is too small, a new array of the same type is allocated.
-
Parameters:
-
a(A[]) — the array into which the elements are to be stored
-
- Returns: an array containing all elements from the deque
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Converts the deque to a List.
-
Parameters:
- (none)
- Returns: a new List containing all elements from the deque
toSet(...) -> Set<T>
-
Signature:
public Set<T> toSet() - Summary: Converts the deque to a Set.
-
Parameters:
- (none)
- Returns: a new Set containing the unique elements from the deque
toCollection(...) -> C
-
Signature:
public <C extends Collection<T>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Converts the deque to a Collection of the specified type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new collection instance with the specified capacity
-
- Returns: a new collection containing all elements from the deque
foreach(...) -> void
-
Signature:
public <E extends Exception> void foreach(final Throwables.Consumer<? super T, E> action) throws E - Summary: Performs the given action for each element of the deque.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super Deque<T>, ? extends R, E> func) throws E - Summary: Applies the given function to the wrapped deque and returns the result.
-
Parameters:
-
func(Throwables.Function<? super Deque<T>, ? extends R, E>) — the function to apply to the deque
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super Deque<T>, E> action) throws E - Summary: Performs the given action with the wrapped deque.
-
Parameters:
-
action(Throwables.Consumer<? super Deque<T>, E>) — the action to perform with the deque
-
-
Throws:
-
E— if the action throws an exception
-
join(...) -> String
-
Signature:
public String join(final String delimiter) - Summary: Joins the string representations of the deque elements using the specified delimiter.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements
-
- Returns: a string containing the joined elements
-
Signature:
public String join(final String delimiter, final String prefix, final String suffix) - Summary: Joins the string representations of the deque elements using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(String) — the delimiter to use between elements -
prefix(String) — the prefix to prepend to the result -
suffix(String) — the suffix to append to the result
-
- Returns: a string containing the joined elements with prefix and suffix
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class DisposableEntry (com.landawn.abacus.util.NoCachingNoUpdating.DisposableEntry)
A wrapper class for Map.Entry that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> DisposableEntry<K, V>
-
Signature:
public static <K, V> DisposableEntry<K, V> wrap(final Map.Entry<K, V> entry) throws IllegalArgumentException - Summary: Wraps an existing Map.Entry in a DisposableEntry.
-
Parameters:
-
entry(Map.Entry<K, V>) — the Map.Entry to wrap
-
- Returns: a new DisposableEntry wrapping the given entry
-
Throws:
-
java.lang.IllegalArgumentException— if the entry is null
-
Public Instance Methods
setValue(...) -> V
-
Signature:
@Deprecated @Override public V setValue(final V value) throws UnsupportedOperationException - Summary: This operation is not supported as DisposableEntry is read-only.
-
Parameters:
-
value(V) — the new value (ignored)
-
- Returns: never returns
-
Throws:
-
java.lang.UnsupportedOperationException— always thrown
-
copy(...) -> Map.Entry<K, V>
-
Signature:
public Map.Entry<K, V> copy() - Summary: Creates a mutable copy of this entry.
-
Parameters:
- (none)
- Returns: a new mutable Map.Entry with the same key and value
apply(...) -> R
-
Signature:
public <R, E extends Exception> R apply(final Throwables.Function<? super DisposableEntry<K, V>, ? extends R, E> func) throws E - Summary: Applies the given function to this entry and returns the result.
-
Parameters:
-
func(Throwables.Function<? super DisposableEntry<K, V>, ? extends R, E>) — the function to apply to this entry
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
-
Signature:
public <R, E extends Exception> R apply(final Throwables.BiFunction<? super K, ? super V, ? extends R, E> func) throws E - Summary: Applies the given bi-function to the key and value of this entry and returns the result.
-
Parameters:
-
func(Throwables.BiFunction<? super K, ? super V, ? extends R, E>) — the bi-function to apply to the key and value
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super DisposableEntry<K, V>, E> action) throws E - Summary: Performs the given action with this entry.
-
Parameters:
-
action(Throwables.Consumer<? super DisposableEntry<K, V>, E>) — the action to perform with this entry
-
-
Throws:
-
E— if the action throws an exception
-
-
Signature:
public <E extends Exception> void accept(final Throwables.BiConsumer<? super K, ? super V, E> action) throws E - Summary: Performs the given bi-consumer action with the key and value of this entry.
-
Parameters:
-
action(Throwables.BiConsumer<? super K, ? super V, E>) — the bi-consumer action to perform with the key and value
-
-
Throws:
-
E— if the action throws an exception
-
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this entry in the form "key=value".
-
Parameters:
- (none)
- Returns: a string representation of this entry
Class DisposablePair (com.landawn.abacus.util.NoCachingNoUpdating.DisposablePair)
A wrapper class for Pair that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> DisposablePair<L, R>
-
Signature:
public static <L, R> DisposablePair<L, R> wrap(final Pair<L, R> p) throws IllegalArgumentException - Summary: Wraps an existing Pair in a DisposablePair.
-
Parameters:
-
p(Pair<L, R>) — the Pair to wrap
-
- Returns: a new DisposablePair wrapping the given pair
-
Throws:
-
java.lang.IllegalArgumentException— if the pair is null
-
Public Instance Methods
left(...) -> L
-
Signature:
public abstract L left() - Summary: Returns the left element of the pair.
-
Parameters:
- (none)
- Returns: the left element
right(...) -> R
-
Signature:
public abstract R right() - Summary: Returns the right element of the pair.
-
Parameters:
- (none)
- Returns: the right element
copy(...) -> Pair<L, R>
-
Signature:
public Pair<L, R> copy() - Summary: Creates a mutable copy of this pair.
-
Parameters:
- (none)
- Returns: a new mutable Pair with the same left and right values
apply(...) -> U
-
Signature:
public <U, E extends Exception> U apply(final Throwables.BiFunction<? super L, ? super R, ? extends U, E> func) throws E - Summary: Applies the given bi-function to the left and right elements and returns the result.
-
Parameters:
-
func(Throwables.BiFunction<? super L, ? super R, ? extends U, E>) — the bi-function to apply to the left and right elements
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.BiConsumer<? super L, ? super R, E> action) throws E - Summary: Performs the given bi-consumer action with the left and right elements.
-
Parameters:
-
action(Throwables.BiConsumer<? super L, ? super R, E>) — the bi-consumer action to perform
-
-
Throws:
-
E— if the action throws an exception
-
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this pair in the form "\[left, right\]".
-
Parameters:
- (none)
- Returns: a string representation of this pair
Class DisposableTriple (com.landawn.abacus.util.NoCachingNoUpdating.DisposableTriple)
A wrapper class for Triple that enforces no-caching and no-updating semantics.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
wrap(...) -> DisposableTriple<L, M, R>
-
Signature:
public static <L, M, R> DisposableTriple<L, M, R> wrap(final Triple<L, M, R> p) throws IllegalArgumentException - Summary: Wraps an existing Triple in a DisposableTriple.
-
Parameters:
-
p(Triple<L, M, R>) — the Triple to wrap
-
- Returns: a new DisposableTriple wrapping the given triple
-
Throws:
-
java.lang.IllegalArgumentException— if the triple is null
-
Public Instance Methods
left(...) -> L
-
Signature:
public abstract L left() - Summary: Returns the left element of the triple.
-
Parameters:
- (none)
- Returns: the left element
middle(...) -> M
-
Signature:
public abstract M middle() - Summary: Returns the middle element of the triple.
-
Parameters:
- (none)
- Returns: the middle element
right(...) -> R
-
Signature:
public abstract R right() - Summary: Returns the right element of the triple.
-
Parameters:
- (none)
- Returns: the right element
copy(...) -> Triple<L, M, R>
-
Signature:
public Triple<L, M, R> copy() - Summary: Creates a mutable copy of this triple.
-
Parameters:
- (none)
- Returns: a new mutable Triple with the same left, middle, and right values
apply(...) -> U
-
Signature:
public <U, E extends Exception> U apply(final Throwables.TriFunction<? super L, ? super M, ? super R, ? extends U, E> func) throws E - Summary: Applies the given tri-function to the left, middle, and right elements and returns the result.
-
Parameters:
-
func(Throwables.TriFunction<? super L, ? super M, ? super R, ? extends U, E>) — the tri-function to apply to the elements
-
- Returns: the result of applying the function
-
Throws:
-
E— if the function throws an exception
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.TriConsumer<? super L, ? super M, ? super R, E> action) throws E - Summary: Performs the given tri-consumer action with the left, middle, and right elements.
-
Parameters:
-
action(Throwables.TriConsumer<? super L, ? super M, ? super R, E>) — the tri-consumer action to perform
-
-
Throws:
-
E— if the action throws an exception
-
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this triple in the form "\[left, middle, right\]".
-
Parameters:
- (none)
- Returns: a string representation of this triple
Class Timed (com.landawn.abacus.util.NoCachingNoUpdating.Timed)
A container class that associates a value with a timestamp.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Timed<T>
-
Signature:
public static <T> Timed<T> of(final T value, final long timeInMillis) - Summary: Creates a new Timed instance with the specified value and timestamp.
-
Parameters:
-
value(T) — the value to wrap -
timeInMillis(long) — the timestamp in milliseconds
-
- Returns: a new Timed instance
Public Instance Methods
value(...) -> T
-
Signature:
public T value() - Summary: Returns the wrapped value.
-
Parameters:
- (none)
- Returns: the value
timestamp(...) -> long
-
Signature:
public long timestamp() - Summary: Returns the timestamp associated with the value.
-
Parameters:
- (none)
- Returns: the timestamp in milliseconds
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this Timed instance.
-
Parameters:
- (none)
- Returns: the hash code
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this Timed instance with another object for equality.
-
Contract:
- Two Timed instances are equal if they have the same timestamp and value.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Timed instance in the form "timestamp: value".
-
Parameters:
- (none)
- Returns: a string representation
Class Numbers (com.landawn.abacus.util.Numbers)
A comprehensive utility class providing an extensive collection of static methods for numerical operations, mathematical computations, rounding, comparisons, and number manipulations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
convert(...) -> T
-
Signature:
public static <T extends Number> T convert(final Number value, final Class<? extends T> targetType) throws ArithmeticException - Summary: Converts the given number to the specified target type with overflow checking.
-
Contract:
- If the conversion would result in an overflow, an ArithmeticException is thrown.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert a double to an int (throws ArithmeticException if outside int range) Integer result = Numbers.convert(123.45, Integer.class); // Convert a BigInteger to a long (throws ArithmeticException if too large) Long longValue = Numbers.convert(new BigInteger("9223372036854775807"), Long.class); // Null values return the default value for the target type Byte byteValue = Numbers.convert(null, Byte.class); // Returns null byte primByteValue = Numbers.convert(null, byte.class); // Returns 0 } </pre>
-
Parameters:
-
value(Number) — the number to convert -
targetType(Class<? extends T>) — the class object representing the target type
-
- Returns: the converted number as an instance of the target type, or the default value of the target type if the input value is null
-
Throws:
-
java.lang.ArithmeticException— if the conversion would result in an overflow
-
-
Signature:
public static <T extends Number> T convert(final Number value, final Class<? extends T> targetType, T defaultValue) throws ArithmeticException - Summary: Converts the given number to the specified target type with overflow checking.
-
Contract:
- If the input value is {@code null} , returns the provided default value.
- If the conversion would result in an overflow, an ArithmeticException is thrown.
-
Parameters:
-
value(Number) — the number to convert -
targetType(Class<? extends T>) — the class object representing the target type -
defaultValue(T) — the value to return if the input value is null
-
- Returns: the converted number as an instance of the target type, or the specified default value if the input value is null
-
Throws:
-
java.lang.ArithmeticException— if the conversion would result in an overflow
-
- See also: #convert(Number, Class)
-
Signature:
public static <T extends Number> T convert(final Number value, final Type<? extends T> targetType) throws ArithmeticException - Summary: Converts the given number to the specified target type using the provided Type instance.
-
Contract:
- If the conversion would result in an overflow, an ArithmeticException is thrown.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert a double to an int (throws ArithmeticException if outside int range) Type<Integer> intType = Type.of(Integer.class); Integer result = Numbers.convert(123.45, intType); // Convert a BigInteger to a long (throws ArithmeticException if too large) Type<Long> longType = Type.of(Long.class); Long longValue = Numbers.convert(new BigInteger("9223372036854775807"), longType); // Null values return the default value for the target type Type<Byte> byteType = Type.of(Byte.class); Byte byteValue = Numbers.convert(null, byteType); // Returns null } </pre>
-
Parameters:
-
value(Number) — the number to convert -
targetType(Type<? extends T>) — the Type object representing the target type
-
- Returns: the converted number as an instance of the target type, or the default value of the target type if the input value is null
-
Throws:
-
java.lang.ArithmeticException— if the conversion would result in an overflow
-
- See also: #convert(Number, Class), com.landawn.abacus.type.Type
-
Signature:
public static <T extends Number> T convert(final Number value, final Type<? extends T> targetType, T defaultValue) throws ArithmeticException - Summary: Converts the given number to the specified target type using the provided Type instance, with a custom default value for {@code null} .
-
Contract:
- If the conversion would result in an overflow, an ArithmeticException is thrown.
-
Parameters:
-
value(Number) — the number to convert -
targetType(Type<? extends T>) — the Type object representing the target type -
defaultValue(T) — the value to return if the input value is null
-
- Returns: the converted number as an instance of the target type, or the specified default value if the input value is null
-
Throws:
-
java.lang.ArithmeticException— if the conversion would result in an overflow
-
- See also: #convert(Number, Type), #convert(Number, Class, Number), com.landawn.abacus.type.Type
format(...) -> String
-
Signature:
public static String format(final int x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given int value according to the provided decimal format pattern.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#,###" for thousand separators.
-
Parameters:
-
x(int) — the int value to be formatted -
decimalFormat(String) — the decimal format pattern to be used for formatting (must not be null)
-
- Returns: a string representation of the int value formatted according to the provided decimal format
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null}
-
- See also: #format(double, String), #format(Integer, String), java.text.DecimalFormat#format(long)
-
Signature:
public static String format(final Integer x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given Integer value according to the provided decimal format pattern.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#,###" for thousand separators.
- </p> <p> If the Integer value is {@code null} , it will be treated as 0.
-
Parameters:
-
x(Integer) — the Integer value to be formatted (null will be treated as 0) -
decimalFormat(String) — the decimal format pattern to be used for formatting (must not be null)
-
- Returns: a string representation of the Integer value formatted according to the provided decimal format
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null}
-
- See also: #format(int, String), #format(Double, String), java.text.DecimalFormat#format(long)
-
Signature:
public static String format(final long x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given long value according to the provided decimal format pattern.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#,###" for thousand separators.
-
Parameters:
-
x(long) — the long value to be formatted -
decimalFormat(String) — the decimal format pattern to be used for formatting (must not be null)
-
- Returns: a string representation of the long value formatted according to the provided decimal format
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null}
-
- See also: #format(double, String), #format(Long, String), java.text.DecimalFormat#format(long)
-
Signature:
public static String format(final Long x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given Long value according to the provided decimal format pattern.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#,###" for thousand separators.
- </p> <p> If the Long value is {@code null} , it will be treated as 0.
-
Parameters:
-
x(Long) — the Long value to be formatted (null will be treated as 0) -
decimalFormat(String) — the decimal format pattern to be used for formatting (must not be null)
-
- Returns: a string representation of the Long value formatted according to the provided decimal format
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null}
-
- See also: #format(long, String), #format(Double, String), java.text.DecimalFormat#format(long)
-
Signature:
public static String format(final float x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given float value according to the provided decimal format.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#.##" for up to two decimal places.
-
Parameters:
-
x(float) — the float value to be formatted. -
decimalFormat(String) — the decimal format pattern to be used for formatting.
-
- Returns: a string representation of the float value formatted according to the provided decimal format.
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null} .
-
- See also: #format(Float, String), #format(double, String), java.text.DecimalFormat#format(double)
-
Signature:
public static String format(final Float x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given Float value according to the provided decimal format.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#.##" for up to two decimal places.
- <p> If the Float value is {@code null} , it will be treated as 0f.
-
Parameters:
-
x(Float) — the Float value to be formatted. If {@code null} , it will be treated as 0f. -
decimalFormat(String) — the decimal format pattern to be used for formatting.
-
- Returns: a string representation of the Float value formatted according to the provided decimal format.
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null} .
-
- See also: #format(float, String), #format(Double, String), java.text.DecimalFormat#format(double)
-
Signature:
public static String format(final double x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given double value according to the provided decimal format.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#.##" for up to two decimal places.
-
Parameters:
-
x(double) — the double value to be formatted. -
decimalFormat(String) — the decimal format pattern to be used for formatting.
-
- Returns: a string representation of the double value formatted according to the provided decimal format.
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null} .
-
- See also: #format(Double, String), #format(int, String), #format(long, String), java.text.DecimalFormat#format(double)
-
Signature:
public static String format(final Double x, final String decimalFormat) throws IllegalArgumentException - Summary: Formats the given Double value according to the provided decimal format.
-
Contract:
- The format should be a valid pattern for DecimalFormat, such as "0.00" for two decimal places or "#.##" for up to two decimal places.
- <p> If the Double value is {@code null} , it will be treated as 0d.
-
Parameters:
-
x(Double) — the Double value to be formatted. If {@code null} , it will be treated as 0d. -
decimalFormat(String) — the decimal format pattern to be used for formatting.
-
- Returns: a string representation of the Double value formatted according to the provided decimal format.
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is {@code null} .
-
- See also: #format(double, String), #format(Integer, String), #format(Long, String), java.text.DecimalFormat#format(double)
extractFirstInt(...) -> u.OptionalInt
-
Signature:
public static u.OptionalInt extractFirstInt(final String str) - Summary: Extracts the first integer value found in the given string.
-
Contract:
- If no integer is found in the string, an empty OptionalInt is returned.
-
Parameters:
-
str(String) — the string to extract the int value from (may be {@code null} or empty).
-
- Returns: the extracted int value wrapped in an OptionalInt, or an empty OptionalInt if no int value is found or if the input string is null/empty.
- See also: #extractFirstInt(String, int), #extractFirstLong(String), Strings#extractFirstInteger(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#INTEGER_FINDER
-
Signature:
public static int extractFirstInt(final String str, final int defaultValue) - Summary: Extracts the first integer value found in the given string, or returns a default value if no integer is found.
-
Contract:
- Extracts the first integer value found in the given string, or returns a default value if no integer is found.
- If no integer is found in the string, the specified default value is returned.
-
Parameters:
-
str(String) — the string to extract the int value from (may be {@code null} or empty). -
defaultValue(int) — the value to return if no integer is found in the string
-
- Returns: the first integer found in the string, or the specified default value if no integer is found or if the input string is null/empty
- See also: #extractFirstInt(String), #extractFirstLong(String, long), Strings#extractFirstInteger(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#INTEGER_FINDER
extractFirstLong(...) -> u.OptionalLong
-
Signature:
public static u.OptionalLong extractFirstLong(final String str) - Summary: Extracts the first long value from the given string.
-
Contract:
- If no long value is found in the string, an empty OptionalLong is returned.
-
Parameters:
-
str(String) — the string to extract the long value from.
-
- Returns: the extracted long value wrapped in an OptionalLong, or an empty OptionalLong if no long value is found or if the input string is null/empty.
- See also: #extractFirstLong(String, long), #extractFirstInt(String), Strings#extractFirstInteger(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#INTEGER_FINDER
-
Signature:
public static long extractFirstLong(final String str, final long defaultValue) - Summary: Extracts the first long value from the given string, or returns a default value if no long value is found.
-
Contract:
- Extracts the first long value from the given string, or returns a default value if no long value is found.
- If no long value is found in the string, the specified default value is returned.
-
Parameters:
-
str(String) — the string to extract the long value from. -
defaultValue(long) — the default value to return if no long value is found.
-
- Returns: the extracted long value, or the specified default value if no long value is found or if the input string is null/empty.
- See also: #extractFirstLong(String), #extractFirstInt(String, int), Strings#extractFirstInteger(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#INTEGER_FINDER
extractFirstDouble(...) -> u.OptionalDouble
-
Signature:
public static u.OptionalDouble extractFirstDouble(final String str) - Summary: Extracts the first double value from the given string.
-
Contract:
- If no double value is found in the string, an empty OptionalDouble is returned.
-
Parameters:
-
str(String) — the string to extract the double value from.
-
- Returns: the extracted double value wrapped in an OptionalDouble, or an empty OptionalDouble if no double value is found or if the input string is null/empty.
- See also: #extractFirstDouble(String, boolean), #extractFirstDouble(String, double), #extractFirstDouble(String, double, boolean), Strings#extractFirstDouble(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
-
Signature:
public static u.OptionalDouble extractFirstDouble(final String str, final boolean includingScientificNumber) - Summary: Extracts the first double value from the given string.
-
Contract:
- If {@code includingScientificNumber} is set to {@code true} , it will also consider scientific notation (e.g., 1.23e10) as valid double values.
- If no double value is found in the string, an empty OptionalDouble is returned.
-
Parameters:
-
str(String) — the string to extract the double value from. -
includingScientificNumber(boolean) — whether to include scientific notation in the search for double values.
-
- Returns: the extracted double value wrapped in an OptionalDouble, or an empty OptionalDouble if no double value is found or if the input string is null/empty.
- See also: #extractFirstDouble(String), #extractFirstDouble(String, double), #extractFirstDouble(String, double, boolean), Strings#extractFirstDouble(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
-
Signature:
public static double extractFirstDouble(final String str, final double defaultValue) - Summary: Extracts the first double value from the given string.
-
Contract:
- If no double value is found, it returns the specified default value.
- If no double value is found in the string, the specified default value is returned.
-
Parameters:
-
str(String) — the string to extract the double value from. -
defaultValue(double) — the default value to return if no double value is found.
-
- Returns: the extracted double value, or the specified default value if no double value is found or if the input string is null/empty.
- See also: #extractFirstDouble(String), #extractFirstDouble(String, boolean), #extractFirstDouble(String, double, boolean), Strings#extractFirstDouble(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
-
Signature:
public static double extractFirstDouble(final String str, final double defaultValue, final boolean includingScientificNumber) - Summary: Extracts the first double value from the given string.
-
Contract:
- If no double value is found, it returns the specified default value.
- If {@code includingScientificNumber} is set to {@code true} , it will also consider scientific notation (e.g., 1.23e10) as valid double values.
- If no double value is found in the string, the specified default value is returned.
-
Parameters:
-
str(String) — the string to extract the double value from. -
defaultValue(double) — the default value to return if no double value is found. -
includingScientificNumber(boolean) — whether to include scientific notation in the search for double values.
-
- Returns: the extracted double value, or the specified default value if no double value is found or if the input string is null/empty.
- See also: #extractFirstDouble(String), #extractFirstDouble(String, boolean), #extractFirstDouble(String, double), Strings#extractFirstDouble(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
toByte(...) -> byte
-
Signature:
public static byte toByte(final String str) throws NumberFormatException - Summary: Converts the given string to a byte value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the byte representation of the provided string, or {@code 0} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a byte.
-
- See also: #toByte(String, byte), #toByte(Object), #isParsable(String), Byte#parseByte(String), Byte#decode(String)
-
Signature:
public static byte toByte(final Object obj) throws NumberFormatException - Summary: Converts the given object to a byte value.
-
Contract:
- If the object is {@code null} , default value {@code 0} is returned.
- If the object is a Number, its byte value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the byte representation of the provided object, or {@code 0} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a byte.
-
- See also: #toByte(String), #toByte(String, byte), #toByte(Object, byte), #isParsable(String), Byte#parseByte(String), Byte#decode(String)
-
Signature:
public static byte toByte(final String str, final byte defaultValue) throws NumberFormatException - Summary: Converts the given string to a byte value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(byte) — the default value to return if the string is {@code null} or empty.
-
- Returns: the byte representation of the provided string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a byte.
-
- See also: #toByte(String), #toByte(Object), #toByte(Object, byte), #isParsable(String), Byte#parseByte(String), Byte#decode(String)
-
Signature:
public static byte toByte(final Object obj, final byte defaultValue) throws NumberFormatException - Summary: Converts the given object to a byte value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its byte value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(byte) — the default value to return if the object is {@code null} .
-
- Returns: the byte representation of the provided object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a byte.
-
- See also: #toByte(String), #toByte(String, byte), #toByte(Object), #isParsable(String), Byte#parseByte(String), Byte#decode(String)
toShort(...) -> short
-
Signature:
public static short toShort(final String str) throws NumberFormatException - Summary: Converts the given string to a short value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the short representation of the provided string, or {@code 0} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a short.
-
- See also: #toShort(String, short), #toShort(Object), #isParsable(String), Short#parseShort(String), Short#decode(String)
-
Signature:
public static short toShort(final Object obj) throws NumberFormatException - Summary: Converts the given object to a short value.
-
Contract:
- If the object is {@code null} , default value {@code 0} is returned.
- If the object is a Number, its short value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the short representation of the provided object, or {@code 0} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a short.
-
- See also: #toShort(String), #toShort(String, short), #toShort(Object, short), #isParsable(String), Short#parseShort(String), Short#decode(String)
-
Signature:
public static short toShort(final String str, final short defaultValue) throws NumberFormatException - Summary: Converts the given string to a short value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(short) — the default value to return if the string is {@code null} or empty.
-
- Returns: the short representation of the provided string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a short.
-
- See also: #toShort(String), #toShort(Object), #toShort(Object, short), #isParsable(String), Short#parseShort(String), Short#decode(String)
-
Signature:
public static short toShort(final Object obj, final short defaultValue) throws NumberFormatException - Summary: Converts the given object to a short value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its short value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(short) — the default value to return if the object is {@code null} .
-
- Returns: the short representation of the provided object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a short.
-
- See also: #toShort(String), #toShort(String, short), #toShort(Object), #isParsable(String), Short#parseShort(String), Short#decode(String)
toInt(...) -> int
-
Signature:
public static int toInt(final String str) throws NumberFormatException - Summary: Converts the given string to an integer value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the integer representation of the provided string, or {@code 0} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as an integer.
-
- See also: #toInt(String, int), #toInt(Object), #isParsable(String), Integer#parseInt(String), Integer#decode(String)
-
Signature:
public static int toInt(final Object obj) throws NumberFormatException - Summary: Converts the given object to an integer value.
-
Contract:
- If the object is {@code null} , default value {@code 0} is returned.
- If the object is a Number, its integer value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the integer representation of the provided object, or {@code 0} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as an integer.
-
- See also: #toInt(String), #toInt(String, int), #toInt(Object, int), #isParsable(String), Integer#parseInt(String), Integer#decode(String)
-
Signature:
public static int toInt(final String str, final int defaultValue) throws NumberFormatException - Summary: Converts the given string to an integer value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(int) — the default value to return if the string is {@code null} or empty.
-
- Returns: the integer representation of the provided string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as an integer.
-
- See also: #toInt(String), #toInt(Object), #toInt(Object, int), #isParsable(String), Integer#parseInt(String), Integer#decode(String)
-
Signature:
public static int toInt(final Object obj, final int defaultValue) throws NumberFormatException - Summary: Converts the given object to an integer value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its integer value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(int) — the default value to return if the object is {@code null} .
-
- Returns: the integer representation of the provided object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as an integer.
-
- See also: #toInt(String), #toInt(String, int), #toInt(Object), #isParsable(String), Integer#parseInt(String), Integer#decode(String)
toLong(...) -> long
-
Signature:
public static long toLong(final String str) throws NumberFormatException - Summary: Converts the given string to a long value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0L} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the long representation of the provided string, or {@code 0L} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a long.
-
- See also: #toLong(String, long), #toLong(Object), #isParsable(String), Long#parseLong(String), Long#decode(String)
-
Signature:
public static long toLong(final Object obj) throws NumberFormatException - Summary: Converts the given object to a long value.
-
Contract:
- If the object is {@code null} , default value {@code 0} is returned.
- If the object is a Number, its long value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the long representation of the provided object, or {@code 0L} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a long.
-
- See also: #toLong(String), #toLong(String, long), #toLong(Object, long), #isParsable(String), Long#parseLong(String), Long#decode(String)
-
Signature:
public static long toLong(final String str, final long defaultValue) throws NumberFormatException - Summary: Converts the given string to a long value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(long) — the default value to return if the string is {@code null} or empty.
-
- Returns: the long representation of the provided string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a long.
-
- See also: #toLong(String), #toLong(Object), #toLong(Object, long), #isParsable(String), Long#parseLong(String), Long#decode(String)
-
Signature:
public static long toLong(final Object obj, final long defaultValue) throws NumberFormatException - Summary: Converts the given object to a long value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its long value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(long) — the default value to return if the object is {@code null} .
-
- Returns: the long representation of the provided object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a long.
-
- See also: #toLong(String), #toLong(String, long), #toLong(Object), #isParsable(String), Long#parseLong(String), Long#decode(String)
toFloat(...) -> float
-
Signature:
public static float toFloat(final String str) throws NumberFormatException - Summary: Converts the given string to a float value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0.0f} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the float representation of the string, or {@code 0.0f} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a float.
-
- See also: #toFloat(Object), #toFloat(String, float), #isParsable(String), Float#parseFloat(String)
-
Signature:
public static float toFloat(final Object obj) throws NumberFormatException - Summary: Converts the given object to a float value.
-
Contract:
- If the object is {@code null} , default value {@code 0.0f} is returned.
- If the object is a Number, its float value is returned.
- </p> <p> <b> Note: </b> When converting from {@code Double} to {@code Float} , the value is parsed through its string representation to maintain precision handling consistent with {@link Float#parseFloat(String)} .
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the float representation of the object, or {@code 0.0f} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a float.
-
- See also: #toFloat(String), #toFloat(String, float), #toFloat(Object, float), #isParsable(String), Float#parseFloat(String)
-
Signature:
public static float toFloat(final String str, final float defaultValue) throws NumberFormatException - Summary: Converts the given string to a float value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(float) — the default value to return if the string is {@code null} or empty.
-
- Returns: the float representation of the string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a float.
-
- See also: #toFloat(String), #toFloat(Object), #toFloat(Object, float), #isParsable(String), Float#parseFloat(String)
-
Signature:
public static float toFloat(final Object obj, final float defaultValue) throws NumberFormatException - Summary: Converts the given object to a float value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its float value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(float) — the default value to return if the object is {@code null} .
-
- Returns: the float representation of the object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a float.
-
- See also: #toFloat(String), #toFloat(String, float), #toFloat(Object), #isParsable(String), Float#parseFloat(String)
toDouble(...) -> double
-
Signature:
public static double toDouble(final String str) throws NumberFormatException - Summary: Converts the given string to a double value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0.0} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the double representation of the string, or {@code 0.0} if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a double.
-
- See also: #toDouble(Object), #toDouble(String, double), #isParsable(String), Double#parseDouble(String)
-
Signature:
public static double toDouble(final Object obj) throws NumberFormatException - Summary: Converts the given object to a double value.
-
Contract:
- If the object is {@code null} , default value {@code 0.0} is returned.
- If the object is a Number, its double value is returned.
- </p> <p> <b> Note: </b> When converting from {@code Float} to {@code Double} , the value is parsed through its string representation to maintain precision handling consistent with {@link Double#parseDouble(String)} .
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object.
-
- Returns: the double representation of the object, or {@code 0.0} if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a double.
-
- See also: #toDouble(String), #toDouble(String, double), #toDouble(Object, double), #isParsable(String), Double#parseDouble(String)
-
Signature:
public static double toDouble(final String str, final double defaultValue) throws NumberFormatException - Summary: Converts the given string to a double value.
-
Contract:
- If the string is {@code null} or empty, the provided default value is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String. -
defaultValue(double) — the default value to return if the string is {@code null} or empty.
-
- Returns: the double representation of the string, or the default value if the string is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as a double.
-
- See also: #toDouble(String), #toDouble(Object), #toDouble(Object, double), #isParsable(String), Double#parseDouble(String)
-
Signature:
public static double toDouble(final Object obj, final double defaultValue) throws NumberFormatException - Summary: Converts the given object to a double value.
-
Contract:
- If the object is {@code null} , the provided default value is returned.
- If the object is a Number, its double value is returned.
-
Parameters:
-
obj(Object) — the object to convert. This can be any instance of Object. -
defaultValue(double) — the default value to return if the object is {@code null} .
-
- Returns: the double representation of the object, or the default value if the object is {@code null} .
-
Throws:
-
java.lang.NumberFormatException— if the object is not a Number and its string representation cannot be parsed as a double.
-
- See also: #toDouble(String), #toDouble(String, double), #toDouble(Object), #isParsable(String), Double#parseDouble(String)
-
Signature:
public static double toDouble(final BigDecimal value) - Summary: Converts a {@code BigDecimal} to a {@code double} .
-
Contract:
- <p> If the {@code BigDecimal} {@code value} is {@code null} , then the default value {@code 0.0} is returned.
-
Parameters:
-
value(BigDecimal) — the {@code BigDecimal} to convert, may be {@code null} .
-
- Returns: the double represented by the {@code BigDecimal} or {@code 0.0} if the {@code BigDecimal} is {@code null} .
-
Signature:
public static double toDouble(final BigDecimal value, final double defaultValue) - Summary: Converts a {@code BigDecimal} to a {@code double} .
-
Contract:
- <p> If the {@code BigDecimal} {@code value} is {@code null} , then the specified default value is returned.
-
Parameters:
-
value(BigDecimal) — the {@code BigDecimal} to convert, may be {@code null} . -
defaultValue(double) — the default value to return if the {@code BigDecimal} is {@code null} .
-
- Returns: the double represented by the {@code BigDecimal} or the default value if the {@code BigDecimal} is {@code null} .
toScaledBigDecimal(...) -> BigDecimal
-
Signature:
public static BigDecimal toScaledBigDecimal(final BigDecimal value) - Summary: Convert a {@code BigDecimal} to a {@code BigDecimal} with a scale of two that has been rounded using {@code RoundingMode.HALF_EVEN} .
-
Contract:
- If the supplied {@code value} is {@code null} , then {@code BigDecimal.ZERO} is returned.
-
Parameters:
-
value(BigDecimal) — the {@code BigDecimal} to convert, may be {@code null} .
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final BigDecimal value, final int scale, final RoundingMode roundingMode) - Summary: Convert a {@code BigDecimal} to a {@code BigDecimal} whose scale is the specified value with a {@code RoundingMode} applied.
-
Contract:
- If the input {@code value} is {@code null} , we simply return {@code BigDecimal.ZERO} .
-
Parameters:
-
value(BigDecimal) — the {@code BigDecimal} to convert, may be {@code null} . -
scale(int) — the number of digits to the right of the decimal point. -
roundingMode(RoundingMode) — a rounding behavior for numerical operations capable of discarding precision.
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final Float value) - Summary: Convert a {@code Float} to a {@code BigDecimal} with a scale of two that has been rounded using {@code RoundingMode.HALF_EVEN} .
-
Contract:
- If the supplied {@code value} is {@code null} , then {@code BigDecimal.ZERO} is returned.
-
Parameters:
-
value(Float) — the {@code Float} to convert, may be {@code null} .
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final Float value, final int scale, final RoundingMode roundingMode) - Summary: Convert a {@code Float} to a {@code BigDecimal} whose scale is the specified value with a {@code RoundingMode} applied.
-
Contract:
- If the input {@code value} is {@code null} , we simply return {@code BigDecimal.ZERO} .
-
Parameters:
-
value(Float) — the {@code Float} to convert, may be {@code null} . -
scale(int) — the number of digits to the right of the decimal point. -
roundingMode(RoundingMode) — a rounding behavior for numerical operations capable of discarding precision.
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final Double value) - Summary: Convert a {@code Double} to a {@code BigDecimal} with a scale of two that has been rounded using {@code RoundingMode.HALF_EVEN} .
-
Contract:
- If the supplied {@code value} is {@code null} , then {@code BigDecimal.ZERO} is returned.
-
Parameters:
-
value(Double) — the {@code Double} to convert, may be {@code null} .
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final Double value, final int scale, final RoundingMode roundingMode) - Summary: Convert a {@code Double} to a {@code BigDecimal} whose scale is the specified value with a {@code RoundingMode} applied.
-
Contract:
- If the input {@code value} is {@code null} , we simply return {@code BigDecimal.ZERO} .
-
Parameters:
-
value(Double) — the {@code Double} to convert, may be {@code null} . -
scale(int) — the number of digits to the right of the decimal point. -
roundingMode(RoundingMode) — a rounding behavior for numerical operations capable of discarding precision.
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final String value) - Summary: Convert a {@code String} to a {@code BigDecimal} with a scale of two that has been rounded using {@code RoundingMode.HALF_EVEN} .
-
Contract:
- If the supplied {@code value} is {@code null} , then {@code BigDecimal.ZERO} is returned.
-
Parameters:
-
value(String) — the {@code String} to convert, may be {@code null} .
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
-
Signature:
public static BigDecimal toScaledBigDecimal(final String value, final int scale, final RoundingMode roundingMode) - Summary: Convert a {@code String} to a {@code BigDecimal} whose scale is the specified value with a {@code RoundingMode} applied.
-
Contract:
- If the input {@code value} is {@code null} , we simply return {@code BigDecimal.ZERO} .
-
Parameters:
-
value(String) — the {@code String} to convert, may be {@code null} . -
scale(int) — the number of digits to the right of the decimal point. -
roundingMode(RoundingMode) — a rounding behavior for numerical operations capable of discarding precision.
-
- Returns: the scaled, with appropriate rounding, {@code BigDecimal} .
toIntExact(...) -> int
-
Signature:
public static int toIntExact(final long value) - Summary: Returns the value of the {@code long} argument as an {@code int} , throwing an exception if the value overflows an {@code int} .
-
Contract:
- Returns the value of the {@code long} argument as an {@code int} , throwing an exception if the value overflows an {@code int} .
- <p> This method provides overflow checking when converting a long to an int.
- If the long value is outside the range of int values (Integer.MIN_VALUE to Integer.MAX_VALUE), an ArithmeticException is thrown.
-
Parameters:
-
value(long) — the long value to convert to an int
-
- Returns: the int value represented by the long argument
- See also: Math#toIntExact(long)
createInteger(...) -> Integer
-
Signature:
@MayReturnNull public static Integer createInteger(final String str) throws NumberFormatException - Summary: Converts a {@code String} to an {@code Integer} , handling hexadecimal (0x or 0X prefix) and octal (0 prefix) notations.
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the Integer value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or cannot be parsed as a valid integer
-
- See also: #isCreatable(String), Integer#decode(String), StrUtil#createInteger(String)
createLong(...) -> Long
-
Signature:
@MayReturnNull public static Long createLong(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a {@code Long} , handling hexadecimal (0x or 0X prefix) and octal (0 prefix) notations.
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the Long value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or cannot be parsed as a valid long
-
- See also: #isCreatable(String), Long#decode(String), StrUtil#createLong(String)
createFloat(...) -> Float
-
Signature:
@MayReturnNull public static Float createFloat(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a {@code Float} .
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the Float value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or cannot be parsed as a valid float
-
- See also: #isCreatable(String), Float#valueOf(String), StrUtil#createFloat(String)
createDouble(...) -> Double
-
Signature:
@MayReturnNull public static Double createDouble(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a {@code Double} .
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the Double value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or cannot be parsed as a valid double
-
- See also: #isCreatable(String), Double#valueOf(String), StrUtil#createDouble(String)
createBigInteger(...) -> BigInteger
-
Signature:
@MayReturnNull public static BigInteger createBigInteger(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a {@code BigInteger} .
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the BigInteger value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or not a valid BigInteger representation
-
- See also: #isCreatable(String), BigInteger#BigInteger(String, int), Long#decode(String), StrUtil#createBigInteger(String)
createBigDecimal(...) -> BigDecimal
-
Signature:
@MayReturnNull public static BigDecimal createBigDecimal(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a {@code BigDecimal} .
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the BigDecimal value represented by the string, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or not a valid BigDecimal representation
-
- See also: #isCreatable(String), BigDecimal#BigDecimal(String), StrUtil#createBigDecimal(String)
createNumber(...) -> Number
-
Signature:
@SuppressFBWarnings({ "SF_SWITCH_FALLTHROUGH", "SF_SWITCH_NO_DEFAULT" }) @MayReturnNull public static Number createNumber(final String str) throws NumberFormatException - Summary: Converts a {@code String} to a java.lang.Number.
-
Contract:
- <p> If the string starts with {@code 0x} or {@code -0x} (lower or upper case) or {@code #} or {@code -#} , it will be interpreted as a hexadecimal Integer - or Long, if the number of digits after the prefix is more than 8 - or BigInteger if there are more than 16 digits.
- If it is found, it starts trying to create successively larger types from the type specified until one is found that can represent the value.
- </p> <p> If a type specifier is not found, it will check for a decimal point and then try successively larger types from {@code Integer} to {@code BigInteger} and from {@code double} to {@code BigDecimal} .
-
Parameters:
-
str(String) — the string to convert; must not be {@code null} or empty
-
- Returns: the parsed Number value, or {@code null} if the input string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is empty or the value cannot be converted
-
- See also: #isCreatable(String), #createInteger(String), #createLong(String), #createFloat(String), #createDouble(String), #createBigInteger(String), #createBigDecimal(String), Long#decode(String), StrUtil#createNumber(String)
isDigits(...) -> boolean
-
Signature:
public static boolean isDigits(final String str) - Summary: Checks whether the {@link String} contains only digit characters.
-
Parameters:
-
str(String) — the string to check
-
- Returns: {@code true} if str contains only Unicode numeric
- See also: #isNumber(String), #isParsable(String), Strings#isNumeric(CharSequence)
isNumber(...) -> boolean
-
Signature:
public static boolean isNumber(final String str) - Summary: Checks whether the String is a valid Java number.
-
Parameters:
-
str(String) — the string to check
-
- Returns: {@code true} if the string is a valid number, otherwise {@code false}
- See also: #isCreatable(String), #isParsable(String), #isDigits(String)
isCreatable(...) -> boolean
-
Signature:
public static boolean isCreatable(final String str) - Summary: <p> Checks whether the String a valid Java number.
-
Contract:
- </p> <p> Note, {@link #createNumber(String)} should return a number for every input resulting in {@code true} .
-
Parameters:
-
str(String) — the string to check
-
- Returns: {@code true} if the string is a correctly formatted number
- See also: #isNumber(String), #isParsable(String)
isParsable(...) -> boolean
-
Signature:
public static boolean isParsable(final String str) - Summary: Checks whether the given String is a parsable number.
-
Contract:
- This method can be used instead of catching {@link NumberFormatException} when calling one of those methods.
-
Parameters:
-
str(String) — the String to check
-
- Returns: {@code true} if the string is a parsable number.
- See also: #isCreatable(String), #isNumber(String), #isDigits(String)
isPrime(...) -> boolean
-
Signature:
@SuppressWarnings("ConditionCoveredByFurtherCondition") public static boolean isPrime(final long n) - Summary: Returns {@code true} if {@code n} is a <a href="http://mathworld.wolfram.com/PrimeNumber.html"> prime number </a> : an integer <i> greater than one </i> that cannot be factored into a product of <i> smaller </i> positive integers.
-
Contract:
- Returns {@code true} if {@code n} is a <a href="http://mathworld.wolfram.com/PrimeNumber.html"> prime number </a> : an integer <i> greater than one </i> that cannot be factored into a product of <i> smaller </i> positive integers.
- </p> <p> Returns {@code false} if {@code n} is zero, one, or a composite number (one which <i> can </i> be factored into smaller positive integers).
-
Parameters:
-
n(long) — the number to test for primality; must be > = 0
-
- Returns: {@code true} if n is prime, {@code false} otherwise (including for n < 2)
- See also: BigInteger#isProbablePrime(int)
isPerfectSquare(...) -> boolean
-
Signature:
public static boolean isPerfectSquare(final int n) - Summary: Checks if the given integer is a perfect square (i.e., the square of an integer).
-
Contract:
- Checks if the given integer is a perfect square (i.e., the square of an integer).
-
Parameters:
-
n(int) — the integer to check
-
- Returns: {@code true} if n is a perfect square, {@code false} otherwise (including for negative numbers)
- See also: #isPerfectSquare(long)
-
Signature:
public static boolean isPerfectSquare(final long n) - Summary: Checks if the given long value is a perfect square (i.e., the square of an integer).
-
Contract:
- Checks if the given long value is a perfect square (i.e., the square of an integer).
-
Parameters:
-
n(long) — the long value to check
-
- Returns: {@code true} if n is a perfect square, {@code false} otherwise (including for negative numbers)
- See also: #isPerfectSquare(int)
isPowerOfTwo(...) -> boolean
-
Signature:
public static boolean isPowerOfTwo(final int x) - Summary: Checks if the given integer is a power of two (i.e., 2^k for some non-negative integer k).
-
Contract:
- Checks if the given integer is a power of two (i.e., 2^k for some non-negative integer k).
-
Parameters:
-
x(int) — the integer to check
-
- Returns: {@code true} if x is a power of two, {@code false} otherwise
-
Signature:
public static boolean isPowerOfTwo(final long x) - Summary: Checks if the given long value is a power of two (i.e., 2^k for some non-negative integer k).
-
Contract:
- Checks if the given long value is a power of two (i.e., 2^k for some non-negative integer k).
-
Parameters:
-
x(long) — the long value to check
-
- Returns: {@code true} if x is a power of two, {@code false} otherwise
-
Signature:
public static boolean isPowerOfTwo(final double x) - Summary: Checks if the given double value is a power of two (i.e., 2^k for some integer k).
-
Contract:
- Checks if the given double value is a power of two (i.e., 2^k for some integer k).
-
Parameters:
-
x(double) — the double value to check
-
- Returns: {@code true} if x is a power of two, {@code false} otherwise
-
Signature:
public static boolean isPowerOfTwo(final BigInteger x) throws IllegalArgumentException - Summary: Checks if the given BigInteger value is a power of two (i.e., 2^k for some non-negative integer k).
-
Contract:
- Checks if the given BigInteger value is a power of two (i.e., 2^k for some non-negative integer k).
- This method efficiently determines this by checking if exactly one bit is set in the binary representation of the number.
-
Parameters:
-
x(BigInteger) — the value to check
-
- Returns: {@code true} if x is a power of two, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if {@code x} is {@code null}
-
- See also: #isPowerOfTwo(int), #isPowerOfTwo(long), #isPowerOfTwo(double)
log(...) -> double
-
Signature:
public static double log(final double a) - Summary: Returns the natural logarithm (base e) of a double value.
-
Contract:
- The natural logarithm is the inverse of the exponential function: if y = log(x), then e^y = x.
-
Parameters:
-
a(double) — the value to compute the logarithm of
-
- Returns: the natural logarithm of the specified value
- See also: Math#log(double), #log2(double), #log10(double)
log2(...) -> int
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log2(final int x, final RoundingMode mode) - Summary: Returns the base-2 logarithm of an integer value, rounded according to the specified rounding mode.
-
Parameters:
-
x(int) — the integer value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-2 logarithm of the specified value, rounded according to the specified rounding mode
- See also: #log2(long, RoundingMode), #log2(double), #log2(double, RoundingMode), #log2(BigInteger, RoundingMode), RoundingMode
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log2(final long x, final RoundingMode mode) - Summary: Returns the base-2 logarithm of {@code x} , rounded according to the specified rounding mode.
-
Parameters:
-
x(long) — the value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-2 logarithm of x, rounded according to the specified mode
- See also: #log2(int, RoundingMode), #log2(double), #log2(double, RoundingMode), #log2(BigInteger, RoundingMode), RoundingMode
-
Signature:
public static double log2(final double x) - Summary: Returns the base 2 logarithm of a double value.
-
Contract:
- <p> Special cases: <ul> <li> If {@code x} is NaN or less than zero, the result is NaN.
- <li> If {@code x} is positive infinity, the result is positive infinity.
- <li> If {@code x} is positive or negative zero, the result is negative infinity.
- <p> If the result of this method will be immediately rounded to an {@code int} , {@link #log2(double, RoundingMode)} is faster.
-
Parameters:
-
x(double) — the value to compute the logarithm of
-
- Returns: the base-2 logarithm of the specified value
- See also: #log2(int, RoundingMode), #log2(long, RoundingMode), #log2(double, RoundingMode), #log2(BigInteger, RoundingMode), #log10(double), #log(double)
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log2(final double x, final RoundingMode mode) throws IllegalArgumentException - Summary: Returns the base 2 logarithm of a double value, rounded with the specified rounding mode to an {@code int} .
-
Parameters:
-
x(double) — the value to compute the logarithm of, must be positive and finite -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-2 logarithm of the specified value, rounded to an int
-
Throws:
-
java.lang.IllegalArgumentException— if {@code x <= 0.0} , {@code x} is NaN, or {@code x} is infinite
-
- See also: #log2(int, RoundingMode), #log2(long, RoundingMode), #log2(double), #log2(BigInteger, RoundingMode), RoundingMode
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") @SuppressWarnings("fallthrough") public static int log2(final BigInteger x, final RoundingMode mode) throws IllegalArgumentException - Summary: Returns the base-2 logarithm of {@code x} , rounded according to the specified rounding mode.
-
Parameters:
-
x(BigInteger) — the value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-2 logarithm of the specified value, rounded according to the specified rounding mode
-
Throws:
-
java.lang.IllegalArgumentException— if {@code x <= 0}
-
- See also: #log2(int, RoundingMode), #log2(long, RoundingMode), #log2(double), #log2(double, RoundingMode), RoundingMode
log10(...) -> int
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log10(final int x, final RoundingMode mode) - Summary: Returns the base-10 logarithm of an integer value, rounded according to the specified rounding mode.
-
Parameters:
-
x(int) — the integer value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-10 logarithm of the specified value, rounded according to the specified rounding mode
- See also: #log10(long, RoundingMode), #log10(double), #log10(BigInteger, RoundingMode), RoundingMode
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log10(final long x, final RoundingMode mode) - Summary: Returns the base-10 logarithm of {@code x} , rounded according to the specified rounding mode.
-
Parameters:
-
x(long) — the value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-10 logarithm of the specified value, rounded according to the specified rounding mode
- See also: #log10(int, RoundingMode), #log10(double), #log10(BigInteger, RoundingMode), RoundingMode
-
Signature:
public static double log10(final double x) - Summary: Returns the base-10 logarithm of the given double value.
-
Contract:
- The result is the power to which 10 must be raised to obtain the value x.
- </p> <p> Special cases: </p> <ul> <li> If the argument is NaN or less than zero, the result is NaN.
- </li> <li> If the argument is positive infinity, the result is positive infinity.
- </li> <li> If the argument is positive zero or negative zero, the result is negative infinity.
- </li> <li> If the argument is 10^n for integer n, the result is n.
-
Parameters:
-
x(double) — the value to compute the logarithm of
-
- Returns: the base-10 logarithm of x
- See also: Math#log10(double), #log10(int, RoundingMode), #log10(long, RoundingMode), #log10(BigInteger, RoundingMode), #log2(double), #log(double)
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int log10(final BigInteger x, final RoundingMode mode) - Summary: Returns the base-10 logarithm of {@code x} , rounded according to the specified rounding mode.
-
Parameters:
-
x(BigInteger) — the value to compute the logarithm of, must be positive -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the base-10 logarithm of the specified value, rounded according to the specified rounding mode
- See also: #log10(int, RoundingMode), #log10(long, RoundingMode), #log10(double), RoundingMode
pow(...) -> int
-
Signature:
public static int pow(int b, int k) - Summary: Returns {@code b} to the {@code k} th power.
-
Contract:
- If the result overflows, the returned value will be equal to the low-order bits of the {@code true} result, following standard Java overflow semantics (similar to multiplication overflow).
-
Parameters:
-
b(int) — the base integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power; if overflow occurs, returns the low-order bits
- Performance: <p> This method computes integer exponentiation using an efficient O(log k) algorithm.
- See also: #pow(long, int), #powExact(int, int), #saturatedPow(int, int)
-
Signature:
public static long pow(long b, int k) - Summary: Returns {@code b} to the {@code k} th power.
-
Contract:
- If the result overflows, the returned value will be equal to the low-order bits of the {@code true} result, specifically {@code BigInteger.valueOf(b).pow(k).longValue()} , following standard Java overflow semantics.
-
Parameters:
-
b(long) — the base long integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power; if overflow occurs, returns the low-order bits
- Performance: <p> This method computes long integer exponentiation using an efficient O(log k) algorithm.
- See also: #pow(int, int), #powExact(long, int), #saturatedPow(long, int)
ceilingPowerOfTwo(...) -> long
-
Signature:
public static long ceilingPowerOfTwo(final long x) - Summary: Returns the smallest power of two greater than or equal to {@code x} .
-
Parameters:
-
x(long) — the value to compute the ceiling power of two for, must be positive
-
- Returns: the smallest power of two greater than or equal to x
-
Signature:
public static BigInteger ceilingPowerOfTwo(final BigInteger x) - Summary: Returns the smallest power of two greater than or equal to the given BigInteger value.
-
Contract:
- For example, if x is 100, the result will be 128 (2^7).
-
Parameters:
-
x(BigInteger) — the BigInteger value (must be positive)
-
- Returns: the smallest power of two greater than or equal to x
- See also: #ceilingPowerOfTwo(long), #floorPowerOfTwo(BigInteger)
floorPowerOfTwo(...) -> long
-
Signature:
public static long floorPowerOfTwo(final long x) - Summary: Returns the largest power of two less than or equal to {@code x} .
-
Parameters:
-
x(long) — the value to compute the floor power of two for, must be positive
-
- Returns: the largest power of two less than or equal to x
-
Signature:
public static BigInteger floorPowerOfTwo(final BigInteger x) - Summary: Returns the largest power of two less than or equal to the given BigInteger value.
-
Contract:
- For example, if x is 100, the result will be 64 (2^6).
-
Parameters:
-
x(BigInteger) — the BigInteger value (must be positive)
-
- Returns: the largest power of two less than or equal to x
- See also: #floorPowerOfTwo(long), #ceilingPowerOfTwo(BigInteger)
sqrt(...) -> int
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") @SuppressWarnings("fallthrough") public static int sqrt(final int x, final RoundingMode mode) - Summary: Returns the square root of {@code x} , rounded with the specified rounding mode.
-
Parameters:
-
x(int) — the value to compute the square root of; must be non-negative -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the integer square root of {@code x} , rounded according to the specified mode
- See also: #sqrt(long, RoundingMode), #sqrt(BigInteger, RoundingMode), RoundingMode
-
Signature:
public static long sqrt(final long x, final RoundingMode mode) - Summary: Returns the square root of {@code x} , rounded with the specified rounding mode.
-
Parameters:
-
x(long) — the value to compute the square root of; must be non-negative -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the integer square root of {@code x} , rounded according to the specified mode
- See also: #sqrt(int, RoundingMode), #sqrt(BigInteger, RoundingMode), RoundingMode
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") @SuppressWarnings("fallthrough") public static BigInteger sqrt(final BigInteger x, final RoundingMode mode) - Summary: Returns the square root of {@code x} , rounded with the specified rounding mode.
-
Parameters:
-
x(BigInteger) — the value to compute the square root of; must be non-negative -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the integer square root of {@code x} , rounded according to the specified mode
- See also: RoundingMode, #sqrt(int, RoundingMode), #sqrt(long, RoundingMode)
divide(...) -> int
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static int divide(final int p, final int q, final RoundingMode mode) throws IllegalArgumentException - Summary: Returns the result of dividing {@code p} by {@code q} , rounding using the specified {@code RoundingMode} .
-
Parameters:
-
p(int) — the dividend -
q(int) — the divisor -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the result of {@code p / q} rounded according to the specified mode
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mode} is {@code null}
-
- See also: RoundingMode, #divide(long, long, RoundingMode)
-
Signature:
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH") public static long divide(final long p, final long q, final RoundingMode mode) throws IllegalArgumentException - Summary: Returns the result of dividing {@code p} by {@code q} , rounding using the specified {@code RoundingMode} .
-
Parameters:
-
p(long) — the dividend -
q(long) — the divisor -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the result of {@code p / q} rounded according to the specified mode
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mode} is {@code null}
-
- See also: RoundingMode, #divide(int, int, RoundingMode)
-
Signature:
public static BigInteger divide(final BigInteger p, final BigInteger q, final RoundingMode mode) throws ArithmeticException - Summary: Returns the result of dividing {@code p} by {@code q} , rounding using the specified {@code RoundingMode} .
-
Parameters:
-
p(BigInteger) — the dividend -
q(BigInteger) — the divisor -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the result of {@code p / q} rounded according to the specified mode as a BigInteger
-
Throws:
-
java.lang.ArithmeticException— if {@code q} is zero, or if {@code mode == UNNECESSARY} and {@code p} is not an integer multiple of {@code q}
-
- See also: RoundingMode, #divide(int, int, RoundingMode), #divide(long, long, RoundingMode)
mod(...) -> int
-
Signature:
public static int mod(final int x, final int m) - Summary: Returns {@code x mod m} , a non-negative value less than {@code m} .
-
Parameters:
-
x(int) — the dividend -
m(int) — the modulus, must be positive
-
- Returns: x mod m, a non-negative value less than m
- See also: <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3">,Remainder Operator,</a>
-
Signature:
public static int mod(final long x, final int m) - Summary: Returns {@code x mod m} , a non-negative value less than {@code m} .
-
Parameters:
-
x(long) — the dividend -
m(int) — the modulus, must be positive
-
- Returns: x mod m, a non-negative value less than m
- See also: <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3">,Remainder Operator,</a>
-
Signature:
public static long mod(final long x, final long m) - Summary: Returns {@code x mod m} , a non-negative value less than {@code m} .
-
Parameters:
-
x(long) — the dividend -
m(long) — the modulus, must be positive
-
- Returns: x mod m, a non-negative value less than m
- See also: <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3">,Remainder Operator,</a>
gcd(...) -> int
-
Signature:
public static int gcd(int a, int b) throws ArithmeticException - Summary: Returns the greatest common divisor (GCD) of two integers using the binary GCD algorithm.
-
Parameters:
-
a(int) — the first integer -
b(int) — the second integer
-
- Returns: the greatest common divisor of {@code a} and {@code b} ; returns {@code 0} if both are zero
-
Throws:
-
java.lang.ArithmeticException— if {@code (a == 0 && b == Integer.MIN_VALUE) || (b == 0 && a == Integer.MIN_VALUE)} because the GCD would be 2^31 which cannot be represented as a positive int
-
- See also: #gcd(long, long), #lcm(int, int)
-
Signature:
public static long gcd(long a, long b) throws ArithmeticException - Summary: Returns the greatest common divisor (GCD) of two long integers using the binary GCD algorithm.
-
Parameters:
-
a(long) — the first long integer -
b(long) — the second long integer
-
- Returns: the greatest common divisor of {@code a} and {@code b} ; returns {@code 0} if both are zero
-
Throws:
-
java.lang.ArithmeticException— if {@code (a == 0 && b == Long.MIN_VALUE) || (b == 0 && a == Long.MIN_VALUE)} because the GCD would be 2^63 which cannot be represented as a positive long
-
- See also: #gcd(int, int), #lcm(long, long)
lcm(...) -> int
-
Signature:
public static int lcm(final int a, final int b) throws ArithmeticException - Summary: Returns the least common multiple (LCM) of two integers.
-
Parameters:
-
a(int) — the first integer -
b(int) — the second integer
-
- Returns: the least common multiple of the absolute values of {@code a} and {@code b} ; returns {@code 0} if either is zero
-
Throws:
-
java.lang.ArithmeticException— if the result cannot be represented as a non-negative {@code int} value, or if the computation would overflow
-
- See also: #lcm(long, long), #gcd(int, int)
-
Signature:
public static long lcm(final long a, final long b) throws ArithmeticException - Summary: Returns the least common multiple (LCM) of two long integers.
-
Parameters:
-
a(long) — the first long integer -
b(long) — the second long integer
-
- Returns: the least common multiple of the absolute values of {@code a} and {@code b} ; returns {@code 0} if either is zero
-
Throws:
-
java.lang.ArithmeticException— if the result cannot be represented as a non-negative {@code long} value, or if the computation would overflow
-
- See also: #lcm(int, int), #gcd(long, long)
addExact(...) -> int
-
Signature:
public static int addExact(final int a, final int b) - Summary: Returns the sum of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of int values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(int) — the first int value to add -
b(int) — the second int value to add
-
- Returns: the sum of a and b
- See also: #addExact(long, long), #saturatedAdd(int, int)
-
Signature:
public static long addExact(final long a, final long b) - Summary: Returns the sum of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of long values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(long) — the first long value to add -
b(long) — the second long value to add
-
- Returns: the sum of a and b
- See also: #addExact(int, int), #saturatedAdd(long, long)
subtractExact(...) -> int
-
Signature:
public static int subtractExact(final int a, final int b) - Summary: Returns the difference of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of int values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(int) — the value to subtract from -
b(int) — the value to subtract
-
- Returns: the difference of a and b
- See also: #subtractExact(long, long), #saturatedSubtract(int, int)
-
Signature:
public static long subtractExact(final long a, final long b) - Summary: Returns the difference of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of long values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(long) — the value to subtract from -
b(long) — the value to subtract
-
- Returns: the difference of a and b
- See also: #subtractExact(int, int), #saturatedSubtract(long, long)
multiplyExact(...) -> int
-
Signature:
public static int multiplyExact(final int a, final int b) - Summary: Returns the product of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of int values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(int) — the first int value to multiply -
b(int) — the second int value to multiply
-
- Returns: the product of a and b
- See also: #multiplyExact(long, long), #saturatedMultiply(int, int)
-
Signature:
public static long multiplyExact(final long a, final long b) - Summary: Returns the product of {@code a} and {@code b} , provided it does not overflow.
-
Contract:
- If the result would exceed the range of long values, an ArithmeticException is thrown instead of silently wrapping around.
-
Parameters:
-
a(long) — the first long value to multiply -
b(long) — the second long value to multiply
-
- Returns: the product of a and b
- See also: #multiplyExact(int, int), #saturatedMultiply(long, long)
powExact(...) -> int
-
Signature:
public static int powExact(int b, int k) - Summary: Returns {@code b} to the {@code k} th power, throwing an exception if overflow occurs.
-
Contract:
- Returns {@code b} to the {@code k} th power, throwing an exception if overflow occurs.
- Unlike {@link #pow(int, int)} , which silently allows overflow, this method throws an {@code ArithmeticException} if the result cannot be represented as an {@code int} .
-
Parameters:
-
b(int) — the base integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power
- See also: #pow(int, int), #saturatedPow(int, int)
-
Signature:
public static long powExact(long b, int k) - Summary: Returns {@code b} to the {@code k} th power, throwing an exception if overflow occurs.
-
Contract:
- Returns {@code b} to the {@code k} th power, throwing an exception if overflow occurs.
- Unlike {@link #pow(long, int)} , which silently allows overflow, this method throws an {@code ArithmeticException} if the result cannot be represented as a {@code long} .
-
Parameters:
-
b(long) — the base long integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power
- See also: #pow(long, int), #saturatedPow(long, int)
saturatedAdd(...) -> int
-
Signature:
public static int saturatedAdd(final int a, final int b) - Summary: Returns the sum of {@code a} and {@code b} , saturating at the integer bounds instead of overflowing.
-
Contract:
- If the {@code true} sum would exceed {@code Integer.MAX_VALUE} , the method returns {@code Integer.MAX_VALUE} .
- If the {@code true} sum would be less than {@code Integer.MIN_VALUE} , the method returns {@code Integer.MIN_VALUE} .
-
Parameters:
-
a(int) — the first integer -
b(int) — the second integer
-
- Returns: the sum of {@code a} and {@code b} , or the appropriate bound if overflow would occur
- See also: #saturatedAdd(long, long), #addExact(int, int)
-
Signature:
public static long saturatedAdd(final long a, final long b) - Summary: Returns the sum of {@code a} and {@code b} , saturating at the long bounds instead of overflowing.
-
Contract:
- If the {@code true} sum would exceed {@code Long.MAX_VALUE} , the method returns {@code Long.MAX_VALUE} .
- If the {@code true} sum would be less than {@code Long.MIN_VALUE} , the method returns {@code Long.MIN_VALUE} .
-
Parameters:
-
a(long) — the first long integer -
b(long) — the second long integer
-
- Returns: the sum of {@code a} and {@code b} , or the appropriate bound if overflow would occur
- See also: #saturatedAdd(int, int), #addExact(long, long)
saturatedSubtract(...) -> int
-
Signature:
public static int saturatedSubtract(final int a, final int b) - Summary: Returns the difference of {@code a} and {@code b} , saturating at the integer bounds instead of overflowing.
-
Contract:
- If the {@code true} difference would exceed {@code Integer.MAX_VALUE} , the method returns {@code Integer.MAX_VALUE} .
- If the {@code true} difference would be less than {@code Integer.MIN_VALUE} , the method returns {@code Integer.MIN_VALUE} .
-
Parameters:
-
a(int) — the first integer -
b(int) — the second integer
-
- Returns: the difference {@code a - b} , or the appropriate bound if overflow would occur
- See also: #saturatedSubtract(long, long), #subtractExact(int, int)
-
Signature:
public static long saturatedSubtract(final long a, final long b) - Summary: Returns the difference of {@code a} and {@code b} , saturating at the long bounds instead of overflowing.
-
Contract:
- If the {@code true} difference would exceed {@code Long.MAX_VALUE} , the method returns {@code Long.MAX_VALUE} .
- If the {@code true} difference would be less than {@code Long.MIN_VALUE} , the method returns {@code Long.MIN_VALUE} .
-
Parameters:
-
a(long) — the first long value -
b(long) — the second long value
-
- Returns: the difference {@code a - b} , or the appropriate bound if overflow would occur
- See also: #saturatedSubtract(int, int), #subtractExact(long, long)
saturatedMultiply(...) -> int
-
Signature:
public static int saturatedMultiply(final int a, final int b) - Summary: Returns the product of {@code a} and {@code b} , saturating at the integer bounds instead of overflowing.
-
Contract:
- If the {@code true} product would exceed {@code Integer.MAX_VALUE} , the method returns {@code Integer.MAX_VALUE} .
- If the {@code true} product would be less than {@code Integer.MIN_VALUE} , the method returns {@code Integer.MIN_VALUE} .
-
Parameters:
-
a(int) — the first integer -
b(int) — the second integer
-
- Returns: the product {@code a * b} , or the appropriate bound if overflow would occur
- See also: #saturatedMultiply(long, long), #multiplyExact(int, int)
-
Signature:
public static long saturatedMultiply(final long a, final long b) - Summary: Returns the product of {@code a} and {@code b} , saturating at the long bounds instead of overflowing.
-
Contract:
- If the {@code true} product would exceed {@code Long.MAX_VALUE} , the method returns {@code Long.MAX_VALUE} .
- If the {@code true} product would be less than {@code Long.MIN_VALUE} , the method returns {@code Long.MIN_VALUE} .
-
Parameters:
-
a(long) — the first long integer -
b(long) — the second long integer
-
- Returns: the product {@code a * b} , or the appropriate bound if overflow would occur
- See also: #saturatedMultiply(int, int), #multiplyExact(long, long)
saturatedPow(...) -> int
-
Signature:
public static int saturatedPow(int b, int k) - Summary: Returns {@code b} to the {@code k} th power, saturating at the integer bounds instead of overflowing.
-
Contract:
- If the {@code true} result would exceed {@code Integer.MAX_VALUE} , the method returns {@code Integer.MAX_VALUE} .
- If the {@code true} result would be less than {@code Integer.MIN_VALUE} , the method returns {@code Integer.MIN_VALUE} .
- <p> This is useful when you want to avoid overflow but don't want to throw exceptions or use larger data types.
-
Parameters:
-
b(int) — the base integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power, or the appropriate bound if overflow would occur
- See also: #pow(int, int), #powExact(int, int)
-
Signature:
public static long saturatedPow(long b, int k) - Summary: Returns {@code b} to the {@code k} th power, saturating at the long bounds instead of overflowing.
-
Contract:
- If the {@code true} result would exceed {@code Long.MAX_VALUE} , the method returns {@code Long.MAX_VALUE} .
- If the {@code true} result would be less than {@code Long.MIN_VALUE} , the method returns {@code Long.MIN_VALUE} .
- <p> This is useful when you want to avoid overflow but don't want to throw exceptions or use larger data types like BigInteger.
-
Parameters:
-
b(long) — the base long integer -
k(int) — the exponent; must be non-negative
-
- Returns: {@code b} raised to the {@code k} th power, or the appropriate bound if overflow would occur
- See also: #pow(long, int), #powExact(long, int)
saturatedCast(...) -> int
-
Signature:
public static int saturatedCast(final long value) - Summary: Returns the {@code int} value nearest to {@code value} , saturating at the integer bounds.
-
Contract:
- If the value exceeds {@code Integer.MAX_VALUE} , the method returns {@code Integer.MAX_VALUE} .
- If the value is less than {@code Integer.MIN_VALUE} , the method returns {@code Integer.MIN_VALUE} .
-
Parameters:
-
value(long) — any {@code long} value
-
- Returns: the {@code int} value nearest to {@code value} , or {@code Integer.MAX_VALUE} if {@code value} is too large, or {@code Integer.MIN_VALUE} if {@code value} is too small
factorial(...) -> int
-
Signature:
public static int factorial(final int n) - Summary: Returns {@code n!} (n factorial), the product of the first {@code n} positive integers.
-
Contract:
- If the {@code true} result would exceed {@code Integer.MAX_VALUE} , this method returns {@code Integer.MAX_VALUE} instead.
-
Parameters:
-
n(int) — the non-negative integer to compute the factorial of
-
- Returns: {@code n!} if it fits in an {@code int} , otherwise {@code Integer.MAX_VALUE}
- See also: #factorialToLong(int), #factorialToBigInteger(int)
factorialToLong(...) -> long
-
Signature:
public static long factorialToLong(final int n) - Summary: Returns {@code n!} (n factorial) as a {@code long} , the product of the first {@code n} positive integers.
-
Contract:
- If the {@code true} result would exceed {@code Long.MAX_VALUE} , this method returns {@code Long.MAX_VALUE} instead.
-
Parameters:
-
n(int) — the non-negative integer to compute the factorial of
-
- Returns: {@code n!} if it fits in a {@code long} , otherwise {@code Long.MAX_VALUE}
- See also: #factorial(int), #factorialToBigInteger(int)
factorialToDouble(...) -> double
-
Signature:
public static double factorialToDouble(final int n) - Summary: Returns {@code n!} (n factorial) as a {@code double} , the product of the first {@code n} positive integers.
-
Contract:
- If the {@code true} result would exceed {@code Double.MAX_VALUE} , this method returns {@code Double.POSITIVE_INFINITY} .
-
Parameters:
-
n(int) — the non-negative integer to compute the factorial of
-
- Returns: the factorial of n as a double, or positive infinity if the result exceeds Double.MAX_VALUE
- See also: #factorial(int), #factorialToLong(int), #factorialToBigInteger(int)
factorialToBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger factorialToBigInteger(final int n) - Summary: Returns {@code n!} (n factorial) as a {@code BigInteger} , the product of the first {@code n} positive integers.
-
Parameters:
-
n(int) — the non-negative integer to compute the factorial of
-
- Returns: {@code n!} as a {@code BigInteger}
- Performance: The result takes <i> O(n log n) </i> space, so use cautiously for very large values of {@code n} .
- See also: #factorial(int), #factorialToLong(int)
binomial(...) -> int
-
Signature:
public static int binomial(final int n, int k) throws IllegalArgumentException - Summary: Returns the binomial coefficient "n choose k", denoted as C(n, k) or (n k).
-
Contract:
- If the result would exceed {@code Integer.MAX_VALUE} , this method returns {@code Integer.MAX_VALUE} .
-
Parameters:
-
n(int) — the total number of items; must be non-negative -
k(int) — the number of items to choose; must be non-negative and at most {@code n}
-
- Returns: the binomial coefficient C(n, k) if it fits in an {@code int} , otherwise {@code Integer.MAX_VALUE}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n < 0} , {@code k < 0} , or {@code k > n}
-
- See also: #binomialToLong(int, int), #binomialToBigInteger(int, int)
binomialToLong(...) -> long
-
Signature:
public static long binomialToLong(int n, int k) throws IllegalArgumentException - Summary: Returns the binomial coefficient "n choose k" as a {@code long} , denoted as C(n, k) or (n k).
-
Contract:
- If the result would exceed {@code Long.MAX_VALUE} , this method returns {@code Long.MAX_VALUE} .
-
Parameters:
-
n(int) — the total number of items; must be non-negative -
k(int) — the number of items to choose; must be non-negative and at most {@code n}
-
- Returns: the binomial coefficient C(n, k) if it fits in a {@code long} , otherwise {@code Long.MAX_VALUE}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n < 0} , {@code k < 0} , or {@code k > n}
-
- See also: #binomial(int, int), #binomialToBigInteger(int, int)
binomialToBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger binomialToBigInteger(final int n, int k) throws IllegalArgumentException - Summary: Returns the binomial coefficient "n choose k" as a {@code BigInteger} , denoted as C(n, k) or (n k).
-
Parameters:
-
n(int) — the total number of items; must be non-negative -
k(int) — the number of items to choose; must be non-negative and at most {@code n}
-
- Returns: the binomial coefficient C(n, k) as a {@code BigInteger}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n < 0} , {@code k < 0} , or {@code k > n}
-
- Performance: <p> <b> Performance Note: </b> The result can take as much as <i> O(k log n) </i> space.
- See also: #binomial(int, int), #binomialToLong(int, int)
mean(...) -> int
-
Signature:
public static int mean(final int x, final int y) - Summary: Returns the arithmetic mean of {@code x} and {@code y} , rounded towards negative infinity.
-
Parameters:
-
x(int) — first value -
y(int) — second value
-
- Returns: the arithmetic mean of {@code x} and {@code y} , rounded towards negative infinity
- See also: #mean(long, long), #mean(double, double), #mean(int...), #mean(long...), #mean(double...)
-
Signature:
public static long mean(final long x, final long y) - Summary: Returns the arithmetic mean of {@code x} and {@code y} , rounded towards negative infinity.
-
Parameters:
-
x(long) — first value -
y(long) — second value
-
- Returns: the arithmetic mean of {@code x} and {@code y} , rounded towards negative infinity
- See also: #mean(int, int), #mean(double, double), #mean(int...), #mean(long...), #mean(double...)
-
Signature:
public static double mean(final double x, final double y) - Summary: Returns the arithmetic mean of {@code x} and {@code y} .
-
Contract:
- Both inputs must be finite values.
-
Parameters:
-
x(double) — the first double value; must be finite -
y(double) — the second double value; must be finite
-
- Returns: the arithmetic mean of {@code x} and {@code y}
- See also: #mean(int, int), #mean(long, long), #mean(int...), #mean(long...), #mean(double...)
-
Signature:
public static double mean(final int... values) throws IllegalArgumentException - Summary: Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean"> arithmetic mean </a> of {@code values} .
-
Contract:
- <p> If these values are a sample drawn from a population, this is also an unbiased estimator of the arithmetic mean of the population.
-
Parameters:
-
values(int[]) — a nonempty series of values
-
- Returns: the arithmetic mean of the values
-
Throws:
-
java.lang.IllegalArgumentException— if {@code values} is empty
-
- See also: #mean(int, int), #mean(long, long), #mean(double, double), #mean(long...), #mean(double...)
-
Signature:
public static double mean(final long... values) throws IllegalArgumentException - Summary: Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean"> arithmetic mean </a> of {@code values} .
-
Contract:
- <p> If these values are a sample drawn from a population, this is also an unbiased estimator of the arithmetic mean of the population.
-
Parameters:
-
values(long[]) — a nonempty series of values, which will be converted to {@code double} values (this may cause loss of precision for longs of magnitude over 2^53 (slightly over 9e15))
-
- Returns: the arithmetic mean of the values
-
Throws:
-
java.lang.IllegalArgumentException— if {@code values} is empty
-
- See also: #mean(int, int), #mean(long, long), #mean(double, double), #mean(int...), #mean(double...)
-
Signature:
public static double mean(final double... values) throws IllegalArgumentException - Summary: Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean"> arithmetic mean </a> of {@code values} .
-
Contract:
- <p> If these values are a sample drawn from a population, this is also an unbiased estimator of the arithmetic mean of the population.
- <p> This method uses Knuth's algorithm for numerical stability when computing the mean of multiple values.
-
Parameters:
-
values(double[]) — a nonempty series of finite double values
-
- Returns: the arithmetic mean of the values
-
Throws:
-
java.lang.IllegalArgumentException— if {@code values} is empty or contains any non-finite values (NaN or infinite)
-
- See also: #mean(int, int), #mean(long, long), #mean(double, double), #mean(int...), #mean(long...)
round(...) -> float
-
Signature:
public static float round(final float x, final int scale) - Summary: Rounds the given float value to the specified number of decimal places.
-
Parameters:
-
x(float) — the float value to be rounded -
scale(int) — the number of decimal places to round to, must be non-negative
-
- Returns: the rounded float value
- See also: #round(float, int, RoundingMode), #round(double, int), Math#round(double)
-
Signature:
public static double round(final double x, final int scale) throws IllegalArgumentException - Summary: Rounds the given double value to the specified number of decimal places.
-
Parameters:
-
x(double) — the double value to be rounded -
scale(int) — the number of decimal places to round to, must be non-negative
-
- Returns: the rounded double value
-
Throws:
-
java.lang.IllegalArgumentException— if the scale is negative
-
- See also: #round(double, int, RoundingMode), #round(float, int), Math#round(double)
-
Signature:
public static float round(final float x, final int scale, final RoundingMode roundingMode) - Summary: Rounds the given float value to the specified number of decimal places.
-
Parameters:
-
x(float) — the float value to be rounded -
scale(int) — the number of decimal places to round to, must be non-negative -
roundingMode(RoundingMode) — the rounding mode to use
-
- Returns: the rounded float value
- See also: #round(float, int), #round(double, int, RoundingMode), BigDecimal#setScale(int, RoundingMode), BigDecimal#floatValue()
-
Signature:
public static double round(final double x, final int scale, final RoundingMode roundingMode) - Summary: Rounds the given double value to the specified number of decimal places.
-
Parameters:
-
x(double) — the double value to be rounded -
scale(int) — the number of decimal places to round to, must be non-negative -
roundingMode(RoundingMode) — the rounding mode to use
-
- Returns: the rounded double value
- See also: #round(double, int), #round(float, int, RoundingMode), BigDecimal#setScale(int, RoundingMode), BigDecimal#doubleValue()
-
Signature:
public static float round(final float x, final String decimalFormat) - Summary: Rounds the given float value using the specified DecimalFormat pattern.
-
Parameters:
-
x(float) — the float value to be rounded -
decimalFormat(String) — the DecimalFormat pattern to use for rounding
-
- Returns: the rounded float value
- See also: DecimalFormat#format(double), #toFloat(String), #round(float, int)
-
Signature:
public static double round(final double x, final String decimalFormat) - Summary: Rounds the given double value using the specified DecimalFormat pattern.
-
Parameters:
-
x(double) — the double value to be rounded -
decimalFormat(String) — the DecimalFormat pattern to use for rounding
-
- Returns: the rounded double value
- See also: DecimalFormat#format(double), #toDouble(String), #round(double, int)
-
Signature:
public static float round(final float x, final DecimalFormat decimalFormat) throws IllegalArgumentException - Summary: Rounds the given float value using the specified DecimalFormat instance.
-
Contract:
- This is useful when you have a pre-configured DecimalFormat that you want to reuse for multiple rounding operations.
-
Parameters:
-
x(float) — the float value to be rounded -
decimalFormat(DecimalFormat) — the DecimalFormat instance to use for rounding
-
- Returns: the rounded float value
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is null
-
- See also: DecimalFormat#format(double), #round(float, String), #round(float, int)
-
Signature:
public static double round(final double x, final DecimalFormat decimalFormat) throws IllegalArgumentException - Summary: Rounds the given double value using the specified DecimalFormat instance.
-
Contract:
- This is useful when you have a pre-configured DecimalFormat that you want to reuse for multiple rounding operations.
-
Parameters:
-
x(double) — the double value to be rounded -
decimalFormat(DecimalFormat) — the DecimalFormat instance to use for rounding
-
- Returns: the rounded double value
-
Throws:
-
java.lang.IllegalArgumentException— if the decimalFormat is null
-
- See also: DecimalFormat#format(double), #round(double, String), #round(double, int)
roundToInt(...) -> int
-
Signature:
public static int roundToInt(final double x, final RoundingMode mode) - Summary: Returns the {@code int} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Contract:
- Returns the {@code int} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Parameters:
-
x(double) — the value to round -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the rounded int value
- See also: #roundToLong(double, RoundingMode), #roundToBigInteger(double, RoundingMode), RoundingMode
roundToLong(...) -> long
-
Signature:
public static long roundToLong(final double x, final RoundingMode mode) - Summary: Returns the {@code long} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Contract:
- Returns the {@code long} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Parameters:
-
x(double) — the value to round -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the rounded long value
- See also: #roundToInt(double, RoundingMode), #roundToBigInteger(double, RoundingMode), RoundingMode
roundToBigInteger(...) -> BigInteger
-
Signature:
public static BigInteger roundToBigInteger(double x, final RoundingMode mode) - Summary: Returns the {@code BigInteger} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Contract:
- Returns the {@code BigInteger} value that is equal to {@code x} rounded with the specified rounding mode, if possible.
-
Parameters:
-
x(double) — the value to round -
mode(RoundingMode) — the rounding mode to apply
-
- Returns: the rounded BigInteger value
- See also: #roundToInt(double, RoundingMode), #roundToLong(double, RoundingMode), RoundingMode
fuzzyEquals(...) -> boolean
-
Signature:
public static boolean fuzzyEquals(final float a, final float b, final float tolerance) - Summary: Compares two float values for approximate equality within a specified tolerance.
-
Parameters:
-
a(float) — the first float value to compare -
b(float) — the second float value to compare -
tolerance(float) — the maximum absolute difference allowed between the two values to consider them equal
-
- Returns: {@code true} if the absolute difference between {@code a} and {@code b} is less than or equal to {@code tolerance} , {@code false} otherwise
- See also: #fuzzyEquals(double, double, double), Float#compare(float, float)
-
Signature:
public static boolean fuzzyEquals(final double a, final double b, final double tolerance) - Summary: Returns {@code true} if {@code a} and {@code b} are within {@code tolerance} of each other.
-
Contract:
- Returns {@code true} if {@code a} and {@code b} are within {@code tolerance} of each other.
- <li> If {@code a == b} , then {@code a} and {@code b} are always fuzzily equal.
- <li> If {@code tolerance} is zero, and neither {@code a} nor {@code b} is NaN, then {@code a} and {@code b} are fuzzily equal if and only if {@code a == b} .
-
Parameters:
-
a(double) — the first double value to compare -
b(double) — the second double value to compare -
tolerance(double) — the maximum absolute difference allowed between the two values to consider them equal
-
- Returns: {@code true} if the absolute difference between {@code a} and {@code b} is less than or equal to {@code tolerance} , {@code false} otherwise
fuzzyCompare(...) -> int
-
Signature:
public static int fuzzyCompare(final float a, final float b, final float tolerance) - Summary: Compares {@code a} and {@code b} "fuzzily," with a tolerance for nearly equal values.
-
Parameters:
-
a(float) — the first float value to compare -
b(float) — the second float value to compare -
tolerance(float) — the maximum absolute difference allowed between the two values to consider them equal
-
- Returns: {@code 0} if {@code a} and {@code b} are fuzzily equal, a negative integer if {@code a} is less than {@code b} , or a positive integer if {@code a} is greater than {@code b}
- See also: #fuzzyEquals(float, float, float), #fuzzyCompare(double, double, double)
-
Signature:
public static int fuzzyCompare(final double a, final double b, final double tolerance) - Summary: Compares {@code a} and {@code b} "fuzzily," with a tolerance for nearly equal values.
-
Parameters:
-
a(double) — the first double value to compare -
b(double) — the second double value to compare -
tolerance(double) — the maximum absolute difference allowed between the two values to consider them equal
-
- Returns: {@code 0} if {@code a} and {@code b} are fuzzily equal, a negative integer if {@code a} is less than {@code b} , or a positive integer if {@code a} is greater than {@code b}
- See also: #fuzzyEquals(double, double, double), #fuzzyCompare(float, float, float)
isMathematicalInteger(...) -> boolean
-
Signature:
public static boolean isMathematicalInteger(final double x) - Summary: Returns {@code true} if {@code x} represents a mathematical integer.
-
Contract:
- Returns {@code true} if {@code x} represents a mathematical integer.
-
Parameters:
-
x(double) — the value to check
-
- Returns: {@code true} if {@code x} is finite and represents an integer value, {@code false} otherwise
- See also: Math#rint(double)
asinh(...) -> double
-
Signature:
public static double asinh(double a) - Summary: Computes the inverse hyperbolic sine (arcsinh) of a number.
-
Parameters:
-
a(double) — the number on which to compute the inverse hyperbolic sine
-
- Returns: the inverse hyperbolic sine of {@code a}
- See also: #acosh(double), #atanh(double)
acosh(...) -> double
-
Signature:
public static double acosh(final double a) - Summary: Computes the inverse hyperbolic cosine (arccosh) of a number.
-
Parameters:
-
a(double) — the number on which to compute the inverse hyperbolic cosine; must be > = 1
-
- Returns: the inverse hyperbolic cosine of {@code a} , or NaN if {@code a < 1}
- See also: #asinh(double), #atanh(double)
atanh(...) -> double
-
Signature:
public static double atanh(double a) - Summary: Computes the inverse hyperbolic tangent (arctanh) of a number.
-
Parameters:
-
a(double) — the number on which to compute the inverse hyperbolic tangent; should be in (-1, 1)
-
- Returns: the inverse hyperbolic tangent of {@code a}
- See also: #asinh(double), #acosh(double)
Public Instance Methods
- (none)
Class ObjIterator (com.landawn.abacus.util.ObjIterator)
An abstract iterator implementation that provides additional functional operations beyond the standard Iterator interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> empty() - Summary: Returns an empty ObjIterator that has no elements.
-
Parameters:
- (none)
- Returns: an empty ObjIterator
just(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> just(final T val) - Summary: Returns an ObjIterator containing a single element.
-
Parameters:
-
val(T) — the single element to be returned by the iterator
-
- Returns: an ObjIterator containing exactly one element
of(...) -> ObjIterator<T>
-
Signature:
@SafeVarargs public static <T> ObjIterator<T> of(final T... a) - Summary: Returns an ObjIterator over the specified array.
-
Parameters:
-
a(T[]) — the array whose elements are to be iterated
-
- Returns: an ObjIterator over the array elements
-
Signature:
public static <T> ObjIterator<T> of(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an ObjIterator over a portion of the specified array.
-
Parameters:
-
a(T[]) — the array whose elements are to be iterated -
fromIndex(int) — the index of the first element to iterate (inclusive) -
toIndex(int) — the index after the last element to iterate (exclusive)
-
- Returns: an ObjIterator over the specified range of array elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > array length, or fromIndex > toIndex
-
-
Signature:
public static <T> ObjIterator<T> of(final Iterator<? extends T> iter) - Summary: Returns an ObjIterator that wraps the specified Iterator.
-
Contract:
- If the Iterator is {@code null} , returns an empty ObjIterator.
- If the Iterator is already an ObjIterator, returns it as-is.
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to wrap
-
- Returns: an ObjIterator wrapping the given Iterator
-
Signature:
public static <T> ObjIterator<T> of(final Collection<? extends T> iterable) - Summary: Returns an ObjIterator over the elements in the specified Collection.
-
Contract:
- If the Collection is {@code null} or empty, returns an empty ObjIterator.
-
Parameters:
-
iterable(Collection<? extends T>) — the Collection whose elements are to be iterated
-
- Returns: an ObjIterator over the collection elements
-
Signature:
public static <T> ObjIterator<T> of(final Iterable<? extends T> iterable) - Summary: Returns an ObjIterator over the elements in the specified Iterable.
-
Contract:
- If the Iterable is {@code null} , returns an empty ObjIterator.
-
Parameters:
-
iterable(Iterable<? extends T>) — the Iterable whose elements are to be iterated
-
- Returns: an ObjIterator over the iterable elements
defer(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> defer(final Supplier<? extends Iterator<? extends T>> iteratorSupplier) throws IllegalArgumentException - Summary: Returns an ObjIterator that defers creation of the underlying iterator until the first method call.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjIterator<String> lazy = ObjIterator.defer(() -> { System.out.println("Creating iterator"); return Arrays.asList("a", "b", "c").iterator(); }); // "Creating iterator" is printed only when hasNext() or next() is called } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends Iterator<? extends T>>) — a Supplier that produces the Iterator when needed
-
- Returns: an ObjIterator that lazily initializes using the supplier
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> ObjIterator<T>
-
Signature:
public static <T> ObjIterator<T> generate(final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Returns an infinite ObjIterator that generates elements using the provided supplier.
-
Parameters:
-
supplier(Supplier<? extends T>) — a Supplier that produces the next element on each call
-
- Returns: an infinite ObjIterator
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
- See also: #generate(BooleanSupplier, Supplier)
-
Signature:
public static <T> ObjIterator<T> generate(final BooleanSupplier hasNext, final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Returns an ObjIterator that generates elements while the hasNext condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if more elements should be generated -
supplier(Supplier<? extends T>) — a Supplier that produces the next element
-
- Returns: an ObjIterator that generates elements conditionally
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
-
Signature:
public static <T, U> ObjIterator<T> generate(final U init, final Predicate<? super U> hasNext, final Function<? super U, T> supplier) throws IllegalArgumentException - Summary: Returns an ObjIterator that generates elements using stateful generation.
-
Parameters:
-
init(U) — the initial state value -
hasNext(Predicate<? super U>) — a Predicate that tests the state to determine if more elements exist -
supplier(Function<? super U, T>) — a Function that generates the next element from the state
-
- Returns: an ObjIterator that generates elements based on state
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
-
Signature:
public static <T, U> ObjIterator<T> generate(final U init, final BiPredicate<? super U, T> hasNext, final BiFunction<? super U, T, T> supplier) throws IllegalArgumentException - Summary: Returns an ObjIterator that generates elements using both state and the previously generated value.
-
Parameters:
-
init(U) — the initial state value -
hasNext(BiPredicate<? super U, T>) — a BiPredicate that tests the state and previous value -
supplier(BiFunction<? super U, T, T>) — a BiFunction that generates the next element from state and previous value
-
- Returns: an ObjIterator that generates elements based on state and previous values
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
skip(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> skip(final long n) throws IllegalArgumentException - Summary: Returns a new ObjIterator that skips the first n elements.
-
Contract:
- If n is greater than or equal to the number of remaining elements, the returned iterator will be empty.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new ObjIterator that skips the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> limit(final long count) throws IllegalArgumentException - Summary: Returns a new ObjIterator that yields at most the first count elements.
-
Contract:
- If count is 0, returns an empty iterator.
- If count is greater than the number of remaining elements, returns all remaining elements.
-
Parameters:
-
count(long) — the maximum number of elements to return
-
- Returns: a new ObjIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
skipAndLimit(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> skipAndLimit(final long offset, final long count) - Summary: Returns a new ObjIterator that skips the first offset elements and then yields at most count elements.
-
Parameters:
-
offset(long) — the number of elements to skip -
count(long) — the maximum number of elements to return after skipping
-
- Returns: a new ObjIterator with skip and limit applied
filter(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> filter(final Predicate<? super T> predicate) - Summary: Returns a new ObjIterator that yields only elements matching the given predicate.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to apply to each element
-
- Returns: a new ObjIterator yielding only matching elements
map(...) -> ObjIterator<U>
-
Signature:
@Beta public <U> ObjIterator<U> map(final Function<? super T, U> mapper) - Summary: Returns a new ObjIterator that transforms each element using the provided mapping function.
-
Parameters:
-
mapper(Function<? super T, U>) — the function to apply to each element
-
- Returns: a new ObjIterator with transformed elements
distinct(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> distinct() - Summary: Returns a new ObjIterator containing only distinct elements.
-
Parameters:
- (none)
- Returns: a new ObjIterator with distinct elements
distinctBy(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> distinctBy(final Function<? super T, ?> keyExtractor) - Summary: Returns a new ObjIterator containing only distinct elements based on a key extractor.
-
Parameters:
-
keyExtractor(Function<? super T, ?>) — the function to extract the key for comparison
-
- Returns: a new ObjIterator with distinct elements based on extracted keys
first(...) -> Nullable<T>
-
Signature:
public Nullable<T> first() - Summary: Returns the first element of this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
- This operation consumes the first element if present.
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the first element, or empty if no elements
firstNonNull(...) -> u.Optional<T>
-
Signature:
public u.Optional<T> firstNonNull() - Summary: Returns the first {@code non-null} element of this iterator wrapped in an Optional.
-
Contract:
- If no {@code non-null} element is found, returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the first {@code non-null} element, or empty if none found
last(...) -> Nullable<T>
-
Signature:
public Nullable<T> last() - Summary: Returns the last element of this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the last element, or empty if no elements
skipNulls(...) -> ObjIterator<T>
-
Signature:
public ObjIterator<T> skipNulls() - Summary: Returns a new ObjIterator that skips {@code null} elements.
-
Parameters:
- (none)
- Returns: a new ObjIterator that filters out {@code null} elements
toArray(...) -> Object\[\]
-
Signature:
public Object[] toArray() - Summary: Converts the remaining elements in this iterator to an Object array.
-
Parameters:
- (none)
- Returns: an array containing all remaining elements
-
Signature:
public <A> A[] toArray(final A[] a) - Summary: Converts the remaining elements in this iterator to an array of the specified type.
-
Contract:
- If the provided array is large enough, it is used directly.
-
Parameters:
-
a(A[]) — the array into which elements are stored, if big enough
-
- Returns: an array containing all remaining elements
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Converts the remaining elements in this iterator to a List.
-
Parameters:
- (none)
- Returns: a List containing all remaining elements
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Returns a Stream containing the remaining elements of this iterator.
-
Contract:
- The iterator should not be used after calling this method.
-
Parameters:
- (none)
- Returns: a Stream of the remaining elements
indexed(...) -> ObjIterator<Indexed<T>>
-
Signature:
@Beta public ObjIterator<Indexed<T>> indexed() - Summary: Returns a new ObjIterator where each element is paired with its index.
-
Parameters:
- (none)
- Returns: a new ObjIterator of Indexed elements
-
Signature:
@Beta public ObjIterator<Indexed<T>> indexed(final long startIndex) - Summary: Returns a new ObjIterator where each element is paired with its index, starting from the specified start index.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: a new ObjIterator of Indexed elements
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element in this iterator.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to perform for each element
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntObjConsumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element, providing both the element and its index to the action.
-
Parameters:
-
action(Throwables.IntObjConsumer<? super T, E>) — the action to perform for each element and its index
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class ObjListIterator (com.landawn.abacus.util.ObjListIterator)
An abstract list iterator implementation that provides bidirectional iteration with additional functional operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ObjListIterator<T>
-
Signature:
public static <T> ObjListIterator<T> empty() - Summary: Returns an empty ObjListIterator that has no elements.
-
Parameters:
- (none)
- Returns: an empty ObjListIterator
just(...) -> ObjListIterator<T>
-
Signature:
public static <T> ObjListIterator<T> just(final T val) - Summary: Returns an ObjListIterator containing a single element.
-
Contract:
- The iterator starts before the element, so next() must be called to access it.
-
Parameters:
-
val(T) — the single element to be returned by the iterator
-
- Returns: an ObjListIterator containing exactly one element
of(...) -> ObjListIterator<T>
-
Signature:
@SafeVarargs public static <T> ObjListIterator<T> of(final T... a) - Summary: Returns an ObjListIterator over the specified array.
-
Parameters:
-
a(T[]) — the array whose elements are to be iterated
-
- Returns: an ObjListIterator over the array elements
-
Signature:
public static <T> ObjListIterator<T> of(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an ObjListIterator over a portion of the specified array.
-
Parameters:
-
a(T[]) — the array whose elements are to be iterated -
fromIndex(int) — the index of the first element to iterate (inclusive) -
toIndex(int) — the index after the last element to iterate (exclusive)
-
- Returns: an ObjListIterator over the specified range of array elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > array length, or fromIndex > toIndex
-
-
Signature:
public static <T> ObjListIterator<T> of(final List<? extends T> list) - Summary: Returns an ObjListIterator over the elements in the specified List.
-
Contract:
- If the List is {@code null} , returns an empty ObjListIterator.
-
Parameters:
-
list(List<? extends T>) — the List whose elements are to be iterated
-
- Returns: an ObjListIterator over the list elements
-
Signature:
public static <T> ObjListIterator<T> of(final ListIterator<? extends T> iter) - Summary: Returns an ObjListIterator that wraps the specified ListIterator.
-
Contract:
- If the ListIterator is {@code null} , returns an empty ObjListIterator.
- If the ListIterator is already an ObjListIterator, returns it as-is.
- <p> Note: The returned ObjListIterator does not support set() and add() operations, even if the underlying ListIterator does.
-
Parameters:
-
iter(ListIterator<? extends T>) — the ListIterator to wrap
-
- Returns: an ObjListIterator wrapping the given ListIterator
Public Instance Methods
skip(...) -> ObjListIterator<T>
-
Signature:
public ObjListIterator<T> skip(final long n) throws IllegalArgumentException - Summary: Returns a new ObjListIterator that skips the first n elements.
-
Contract:
- If n is greater than or equal to the number of remaining elements, the returned iterator will be empty for forward iteration.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new ObjListIterator that skips the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> ObjListIterator<T>
-
Signature:
public ObjListIterator<T> limit(final long count) throws IllegalArgumentException - Summary: Returns a new ObjListIterator that yields at most the first count elements.
-
Contract:
- If count is 0, returns an empty iterator.
- If count is greater than the number of remaining elements, returns all remaining elements.
-
Parameters:
-
count(long) — the maximum number of elements to return in forward iteration
-
- Returns: a new ObjListIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
first(...) -> Nullable<T>
-
Signature:
public Nullable<T> first() - Summary: Returns the first element of this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
- This operation consumes the first element if present.
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the first element, or empty if no elements
firstNonNull(...) -> u.Optional<T>
-
Signature:
public u.Optional<T> firstNonNull() - Summary: Returns the first {@code non-null} element of this iterator wrapped in an Optional.
-
Contract:
- If no {@code non-null} element is found, returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the first {@code non-null} element, or empty if none found
last(...) -> Nullable<T>
-
Signature:
public Nullable<T> last() - Summary: Returns the last element of this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the last element, or empty if no elements
toArray(...) -> Object\[\]
-
Signature:
public Object[] toArray() - Summary: Converts the remaining elements in this iterator to an Object array.
-
Parameters:
- (none)
- Returns: an array containing all remaining elements
-
Signature:
public <A> A[] toArray(final A[] a) - Summary: Converts the remaining elements in this iterator to an array of the specified type.
-
Contract:
- If the provided array is large enough, it is used directly.
-
Parameters:
-
a(A[]) — the array into which elements are stored, if big enough
-
- Returns: an array containing all remaining elements
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Converts the remaining elements in this iterator to a List.
-
Parameters:
- (none)
- Returns: a List containing all remaining elements
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Returns a Stream containing the remaining elements of this iterator.
-
Contract:
- The iterator should not be used after calling this method.
-
Parameters:
- (none)
- Returns: a Stream of the remaining elements
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element in forward direction.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to perform for each element
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntObjConsumer<? super T, E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element in forward direction, providing both the element and its index to the action.
-
Parameters:
-
action(Throwables.IntObjConsumer<? super T, E>) — the action to perform for each element and its index
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class ObjectPool (com.landawn.abacus.util.ObjectPool)
A thread-safe, fixed-size map implementation optimized for high-frequency reads and infrequent writes.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
@SuppressWarnings("unchecked") public ObjectPool(final int capacity) - Summary: Constructs an ObjectPool with the specified capacity.
-
Parameters:
-
capacity(int) — the maximum expected number of entries
-
get(...) -> V
-
Signature:
@MayReturnNull @Override public V get(final Object key) - Summary: Returns the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key.
-
Contract:
- Returns the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key.
-
Parameters:
-
key(Object) — the key whose associated value is to be returned
-
- Returns: the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key
put(...) -> V
-
Signature:
@MayReturnNull @Override public V put(final K key, final V value) - Summary: Associates the specified value with the specified key in this map.
-
Contract:
- If the map previously contained a mapping for the key, the old value is replaced.
- <p> If the pool size exceeds its capacity, a warning is logged once, but the operation completes successfully.
-
Parameters:
-
key(K) — key with which the specified value is to be associated -
value(V) — value to be associated with the specified key
-
- Returns: the previous value associated with key, or {@code null} if there was no mapping for key
putAll(...) -> void
-
Signature:
@Override public void putAll(final Map<? extends K, ? extends V> m) - Summary: Copies all of the mappings from the specified map to this map.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — mappings to be stored in this map
-
remove(...) -> V
-
Signature:
@MayReturnNull @Override public V remove(final Object key) - Summary: Removes the mapping for a key from this map if it is present.
-
Contract:
- Removes the mapping for a key from this map if it is present.
-
Parameters:
-
key(Object) — key whose mapping is to be removed from the map
-
- Returns: the previous value associated with key, or {@code null} if there was no mapping for key
containsKey(...) -> boolean
-
Signature:
@Override public boolean containsKey(final Object key) - Summary: Returns {@code true} if this map contains a mapping for the specified key.
-
Contract:
- Returns {@code true} if this map contains a mapping for the specified key.
-
Parameters:
-
key(Object) — key whose presence in this map is to be tested
-
- Returns: {@code true} if this map contains a {@code non-null} mapping for the specified key
containsValue(...) -> boolean
-
Signature:
@Override public boolean containsValue(final Object value) - Summary: Returns {@code true} if this map maps one or more keys to the specified value.
-
Contract:
- Returns {@code true} if this map maps one or more keys to the specified value.
-
Parameters:
-
value(Object) — value whose presence in this map is to be tested
-
- Returns: {@code true} if this map maps one or more keys to the specified value
keySet(...) -> Set<K>
-
Signature:
@Override public Set<K> keySet() - Summary: Returns an unmodifiable Set view of the keys contained in this map.
-
Parameters:
- (none)
- Returns: an unmodifiable set view of the keys contained in this map
values(...) -> Collection<V>
-
Signature:
@Override public Collection<V> values() - Summary: Returns an unmodifiable Collection view of the values contained in this map.
-
Parameters:
- (none)
- Returns: an unmodifiable collection view of the values contained in this map
entrySet(...) -> Set<Map.Entry<K, V>>
-
Signature:
@Override public Set<Map.Entry<K, V>> entrySet() - Summary: Returns an unmodifiable Set view of the mappings contained in this map.
-
Parameters:
- (none)
- Returns: an unmodifiable set view of the mappings contained in this map
size(...) -> int
-
Signature:
@Override public int size() -
Parameters:
- (none)
- Returns: unspecified
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this map contains no key-value mappings.
-
Contract:
- Returns {@code true} if this map contains no key-value mappings.
-
Parameters:
- (none)
- Returns: {@code true} if this map contains no key-value mappings
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all of the mappings from this map.
-
Parameters:
- (none)
Class Objectory (com.landawn.abacus.util.Objectory)
A factory class for creating and recycling commonly used objects to reduce memory allocation overhead.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
createList(...) -> List<T>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <T> List<T> createList() - Summary: Creates or retrieves a List from the object pool.
-
Contract:
- <p> After use, the list should be recycled using {@link #recycle(List)} .
-
Parameters:
- (none)
- Returns: an empty ArrayList from the pool or a new instance if the pool is empty
createSet(...) -> Set<T>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <T> Set<T> createSet() - Summary: Creates or retrieves a Set from the object pool.
-
Contract:
- <p> After use, the set should be recycled using {@link #recycle(Set)} .
-
Parameters:
- (none)
- Returns: an empty HashSet from the pool or a new instance if the pool is empty
createLinkedHashSet(...) -> Set<T>
-
Signature:
@Deprecated @SuppressWarnings("unchecked") public static <T> Set<T> createLinkedHashSet() - Summary: Creates or retrieves a LinkedHashSet from the object pool.
-
Contract:
- <p> After use, the set should be recycled using {@link #recycle(Set)} .
-
Parameters:
- (none)
- Returns: an empty LinkedHashSet from the pool or a new instance if the pool is empty
createMap(...) -> Map<K, V>
-
Signature:
@Deprecated public static <K, V> Map<K, V> createMap() - Summary: Creates or retrieves a Map from the object pool.
-
Contract:
- <p> After use, the map should be recycled using {@link #recycle(Map)} .
-
Parameters:
- (none)
- Returns: an empty HashMap from the pool or a new instance if the pool is empty
createLinkedHashMap(...) -> Map<K, V>
-
Signature:
@Deprecated public static <K, V> Map<K, V> createLinkedHashMap() - Summary: Creates or retrieves a LinkedHashMap from the object pool.
-
Contract:
- <p> After use, the map should be recycled using {@link #recycle(Map)} .
-
Parameters:
- (none)
- Returns: an empty LinkedHashMap from the pool or a new instance if the pool is empty
createObjectArray(...) -> Object\[\]
-
Signature:
public static Object[] createObjectArray() - Summary: Creates or retrieves an Object array with the default poolable size.
-
Contract:
- <p> After use, the array should be recycled using {@link #recycle(Object\[\])} .
-
Parameters:
- (none)
- Returns: an Object array from the pool or a new instance if the pool is empty
-
Signature:
public static Object[] createObjectArray(final int size) - Summary: Creates or retrieves an Object array of the specified size.
-
Contract:
- <p> After use, the array should be recycled using {@link #recycle(Object\[\])} .
-
Parameters:
-
size(int) — the desired size of the array
-
- Returns: an Object array of the specified size
createCharArrayBuffer(...) -> char\[\]
-
Signature:
public static char[] createCharArrayBuffer() - Summary: Creates or retrieves a char array buffer with the default buffer size.
-
Contract:
- <p> After use, the buffer should be recycled using {@link #recycle(char\[\])} .
-
Parameters:
- (none)
- Returns: a char array buffer from the pool or a new instance if the pool is empty
-
Signature:
public static char[] createCharArrayBuffer(final int capacity) - Summary: Creates or retrieves a char array buffer of the specified capacity.
-
Parameters:
-
capacity(int) — the desired capacity of the buffer
-
- Returns: a char array buffer of the specified capacity
createByteArrayBuffer(...) -> byte\[\]
-
Signature:
public static byte[] createByteArrayBuffer() - Summary: Creates or retrieves a byte array buffer with the default buffer size.
-
Contract:
- <p> After use, the buffer should be recycled using {@link #recycle(byte\[\])} .
-
Parameters:
- (none)
- Returns: a byte array buffer from the pool or a new instance if the pool is empty
-
Signature:
public static byte[] createByteArrayBuffer(final int capacity) - Summary: Creates or retrieves a byte array buffer of the specified capacity.
-
Parameters:
-
capacity(int) — the desired capacity of the buffer
-
- Returns: a byte array buffer of the specified capacity
createStringBuilder(...) -> StringBuilder
-
Signature:
public static StringBuilder createStringBuilder() - Summary: Creates or retrieves a StringBuilder with the default buffer size.
-
Contract:
- <p> After use, the StringBuilder should be recycled using {@link #recycle(StringBuilder)} .
-
Parameters:
- (none)
- Returns: a StringBuilder from the pool or a new instance if the pool is empty
-
Signature:
public static StringBuilder createStringBuilder(final int initCapacity) - Summary: Creates or retrieves a StringBuilder with the specified initial capacity.
-
Parameters:
-
initCapacity(int) — the desired initial capacity
-
- Returns: a StringBuilder with the specified initial capacity
createByteArrayOutputStream(...) -> ByteArrayOutputStream
-
Signature:
public static ByteArrayOutputStream createByteArrayOutputStream() - Summary: Creates or retrieves a ByteArrayOutputStream with the default buffer size.
-
Contract:
- <p> After use, the stream should be recycled using {@link #recycle(ByteArrayOutputStream)} .
-
Parameters:
- (none)
- Returns: a ByteArrayOutputStream from the pool or a new instance if the pool is empty
-
Signature:
public static ByteArrayOutputStream createByteArrayOutputStream(final int initCapacity) - Summary: Creates or retrieves a ByteArrayOutputStream with the specified initial capacity.
-
Parameters:
-
initCapacity(int) — the desired initial capacity
-
- Returns: a ByteArrayOutputStream with the specified initial capacity
createBufferedWriter(...) -> java.io.BufferedWriter
-
Signature:
public static java.io.BufferedWriter createBufferedWriter() - Summary: Creates or retrieves a BufferedWriter with no underlying writer.
-
Contract:
- The writer must be initialized with {@link BufferedWriter#reinit(Writer)} before use.
- <p> After use, the writer should be recycled using {@link #recycle(java.io.BufferedWriter)} .
-
Parameters:
- (none)
- Returns: a BufferedWriter from the pool or a new instance if the pool is empty
-
Signature:
public static java.io.BufferedWriter createBufferedWriter(final OutputStream os) - Summary: Creates or retrieves a BufferedWriter wrapping the specified OutputStream.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(java.io.BufferedWriter)} .
-
Parameters:
-
os(OutputStream) — the OutputStream to wrap
-
- Returns: a BufferedWriter wrapping the specified stream
-
Signature:
public static java.io.BufferedWriter createBufferedWriter(final Writer writer) - Summary: Creates or retrieves a BufferedWriter wrapping the specified Writer.
-
Contract:
- If the writer is already a BufferedWriter, it is returned as-is.
- <p> After use, the writer should be recycled using {@link #recycle(java.io.BufferedWriter)} .
-
Parameters:
-
writer(Writer) — the Writer to wrap
-
- Returns: a BufferedWriter wrapping the specified writer
createBufferedXmlWriter(...) -> BufferedXmlWriter
-
Signature:
public static BufferedXmlWriter createBufferedXmlWriter() - Summary: Creates or retrieves a BufferedXmlWriter with no underlying writer.
-
Contract:
- The writer must be initialized before use.
- <p> After use, the writer should be recycled using {@link #recycle(BufferedXmlWriter)} .
-
Parameters:
- (none)
- Returns: a BufferedXmlWriter from the pool or a new instance if the pool is empty
-
Signature:
public static BufferedXmlWriter createBufferedXmlWriter(final OutputStream os) - Summary: Creates or retrieves a BufferedXmlWriter wrapping the specified OutputStream.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedXmlWriter)} .
-
Parameters:
-
os(OutputStream) — the OutputStream to wrap
-
- Returns: a BufferedXmlWriter wrapping the specified stream
-
Signature:
public static BufferedXmlWriter createBufferedXmlWriter(final Writer writer) - Summary: Creates or retrieves a BufferedXmlWriter wrapping the specified Writer.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedXmlWriter)} .
-
Parameters:
-
writer(Writer) — the Writer to wrap
-
- Returns: a BufferedXmlWriter wrapping the specified writer
createBufferedJsonWriter(...) -> BufferedJsonWriter
-
Signature:
public static BufferedJsonWriter createBufferedJsonWriter() - Summary: Creates or retrieves a BufferedJsonWriter with no underlying writer.
-
Contract:
- The writer must be initialized before use.
- <p> After use, the writer should be recycled using {@link #recycle(BufferedJsonWriter)} .
-
Parameters:
- (none)
- Returns: a BufferedJsonWriter from the pool or a new instance if the pool is empty
-
Signature:
public static BufferedJsonWriter createBufferedJsonWriter(final OutputStream os) - Summary: Creates or retrieves a BufferedJsonWriter wrapping the specified OutputStream.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedJsonWriter)} .
-
Parameters:
-
os(OutputStream) — the OutputStream to wrap
-
- Returns: a BufferedJsonWriter wrapping the specified stream
-
Signature:
public static BufferedJsonWriter createBufferedJsonWriter(final Writer writer) - Summary: Creates or retrieves a BufferedJsonWriter wrapping the specified Writer.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedJsonWriter)} .
-
Parameters:
-
writer(Writer) — the Writer to wrap
-
- Returns: a BufferedJsonWriter wrapping the specified writer
createBufferedCsvWriter(...) -> BufferedCsvWriter
-
Signature:
public static BufferedCsvWriter createBufferedCsvWriter() - Summary: Creates or retrieves a BufferedCsvWriter with no underlying writer.
-
Contract:
- The writer must be initialized before use.
- <p> After use, the writer should be recycled using {@link #recycle(BufferedCsvWriter)} .
-
Parameters:
- (none)
- Returns: a BufferedCsvWriter from the pool or a new instance if the pool is empty
-
Signature:
public static BufferedCsvWriter createBufferedCsvWriter(final OutputStream os) - Summary: Creates or retrieves a BufferedCsvWriter wrapping the specified OutputStream.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedCsvWriter)} .
-
Parameters:
-
os(OutputStream) — the OutputStream to wrap
-
- Returns: a BufferedCsvWriter wrapping the specified stream
-
Signature:
public static BufferedCsvWriter createBufferedCsvWriter(final Writer writer) - Summary: Creates or retrieves a BufferedCsvWriter wrapping the specified Writer.
-
Contract:
- <p> After use, the writer should be recycled using {@link #recycle(BufferedCsvWriter)} .
-
Parameters:
-
writer(Writer) — the Writer to wrap
-
- Returns: a BufferedCsvWriter wrapping the specified writer
createBufferedReader(...) -> java.io.BufferedReader
-
Signature:
public static java.io.BufferedReader createBufferedReader(final String str) - Summary: Creates or retrieves a BufferedReader wrapping the specified String.
-
Contract:
- <p> After use, the reader should be recycled using {@link #recycle(java.io.BufferedReader)} .
-
Parameters:
-
str(String) — the String to read from
-
- Returns: a BufferedReader reading from the specified string
-
Signature:
public static java.io.BufferedReader createBufferedReader(final InputStream is) - Summary: Creates or retrieves a BufferedReader wrapping the specified InputStream.
-
Contract:
- <p> After use, the reader should be recycled using {@link #recycle(java.io.BufferedReader)} .
-
Parameters:
-
is(InputStream) — the InputStream to wrap
-
- Returns: a BufferedReader wrapping the specified stream
-
Signature:
public static java.io.BufferedReader createBufferedReader(final Reader reader) - Summary: Creates or retrieves a BufferedReader wrapping the specified Reader.
-
Contract:
- If the reader is already a BufferedReader, it is returned as-is.
- <p> After use, the reader should be recycled using {@link #recycle(java.io.BufferedReader)} .
-
Parameters:
-
reader(Reader) — the Reader to wrap
-
- Returns: a BufferedReader wrapping the specified reader
recycle(...) -> void
-
Signature:
@Deprecated public static void recycle(final List<?> list) - Summary: Returns a List to the object pool for reuse.
-
Contract:
- <p> This method should be called in a finally block to ensure proper recycling: </p> <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> list = Objectory.createList(); try { // Use the list } finally { Objectory.recycle(list); } } </pre>
-
Parameters:
-
list(List<?>) — the list to recycle
-
-
Signature:
@Deprecated public static void recycle(final Set<?> set) - Summary: Returns a Set to the object pool for reuse.
-
Parameters:
-
set(Set<?>) — the set to recycle
-
-
Signature:
@Deprecated public static void recycle(final Map<?, ?> map) - Summary: Returns a Map to the object pool for reuse.
-
Parameters:
-
map(Map<?, ?>) — the map to recycle
-
-
Signature:
public static void recycle(final Object[] objArray) - Summary: Returns an Object array to the object pool for reuse.
-
Parameters:
-
objArray(Object[]) — the array to recycle
-
-
Signature:
public static void recycle(final char[] cbuf) - Summary: Returns a char array buffer to the object pool for reuse.
-
Parameters:
-
cbuf(char[]) — the char array to recycle
-
-
Signature:
public static void recycle(final byte[] bbuf) - Summary: Returns a byte array buffer to the object pool for reuse.
-
Parameters:
-
bbuf(byte[]) — the byte array to recycle
-
-
Signature:
public static void recycle(final StringBuilder sb) - Summary: Returns a StringBuilder to the object pool for reuse.
-
Parameters:
-
sb(StringBuilder) — the StringBuilder to recycle
-
-
Signature:
public static void recycle(final ByteArrayOutputStream os) - Summary: Returns a ByteArrayOutputStream to the object pool for reuse.
-
Parameters:
-
os(ByteArrayOutputStream) — the ByteArrayOutputStream to recycle
-
-
Signature:
public static void recycle(final BufferedXmlWriter bw) - Summary: Returns a BufferedXmlWriter to the object pool for reuse.
-
Parameters:
-
bw(BufferedXmlWriter) — the BufferedXmlWriter to recycle
-
-
Signature:
public static void recycle(final BufferedJsonWriter bw) - Summary: Returns a BufferedJsonWriter to the object pool for reuse.
-
Parameters:
-
bw(BufferedJsonWriter) — the BufferedJsonWriter to recycle
-
-
Signature:
public static void recycle(final BufferedCsvWriter bw) - Summary: Returns a BufferedCsvWriter to the object pool for reuse.
-
Parameters:
-
bw(BufferedCsvWriter) — the BufferedCsvWriter to recycle
-
-
Signature:
public static void recycle(final java.io.BufferedWriter writer) - Summary: Returns a BufferedWriter to the object pool for reuse.
-
Parameters:
-
writer(java.io.BufferedWriter) — the BufferedWriter to recycle
-
-
Signature:
public static void recycle(final java.io.BufferedReader reader) - Summary: Returns a BufferedReader to the object pool for reuse.
-
Parameters:
-
reader(java.io.BufferedReader) — the BufferedReader to recycle
-
Public Instance Methods
- (none)
Class Observer (com.landawn.abacus.util.Observer)
A reactive stream implementation that provides asynchronous event processing with operators similar to RxJava's Observable.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
complete(...) -> void
-
Signature:
@SuppressWarnings("rawtypes") public static void complete(final BlockingQueue<?> queue) - Summary: Signals completion to a BlockingQueue by adding a special completion flag.
-
Parameters:
-
queue(BlockingQueue<?>) — the BlockingQueue to complete
-
of(...) -> Observer<T>
-
Signature:
public static <T> Observer<T> of(final BlockingQueue<T> queue) throws IllegalArgumentException - Summary: Creates an Observer from a BlockingQueue.
-
Parameters:
-
queue(BlockingQueue<T>) — the BlockingQueue to create an Observer from
-
- Returns: a new Observer that emits elements from the queue
-
Throws:
-
java.lang.IllegalArgumentException— if queue is null
-
-
Signature:
public static <T> Observer<T> of(final Collection<? extends T> c) - Summary: Creates an Observer from a Collection.
-
Parameters:
-
c(Collection<? extends T>) — the Collection to create an Observer from
-
- Returns: a new Observer that emits elements from the collection
-
Signature:
public static <T> Observer<T> of(final Iterator<? extends T> iter) throws IllegalArgumentException - Summary: Creates an Observer from an Iterator.
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to create an Observer from
-
- Returns: a new Observer that emits elements from the iterator
-
Throws:
-
java.lang.IllegalArgumentException— if iter is null
-
timer(...) -> Observer<Long>
-
Signature:
public static Observer<Long> timer(final long delayInMillis) - Summary: Creates an Observer that emits a single value (0L) after the specified delay in milliseconds.
-
Parameters:
-
delayInMillis(long) — the delay in milliseconds before emitting
-
- Returns: a new Observer that emits after the delay
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#timer(long,%20java.util.concurrent.TimeUnit)">,RxJava#timer,</a>
-
Signature:
public static Observer<Long> timer(final long delay, final TimeUnit unit) throws IllegalArgumentException - Summary: Creates an Observer that emits a single value (0L) after the specified delay.
-
Parameters:
-
delay(long) — the delay before emitting -
unit(TimeUnit) — the time unit of the delay
-
- Returns: a new Observer that emits after the delay
-
Throws:
-
java.lang.IllegalArgumentException— if delay is negative or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#timer(long,%20java.util.concurrent.TimeUnit)">,RxJava#timer,</a>
interval(...) -> Observer<Long>
-
Signature:
public static Observer<Long> interval(final long periodInMillis) - Summary: Creates an Observer that emits sequential numbers (0, 1, 2, ...) periodically with the specified interval in milliseconds.
-
Parameters:
-
periodInMillis(long) — the period between emissions in milliseconds
-
- Returns: a new Observer that emits periodically
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#interval(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#interval,</a>
-
Signature:
public static Observer<Long> interval(final long initialDelayInMillis, final long periodInMillis) - Summary: Creates an Observer that emits sequential numbers periodically with an initial delay and specified interval in milliseconds.
-
Parameters:
-
initialDelayInMillis(long) — the initial delay before the first emission in milliseconds -
periodInMillis(long) — the period between subsequent emissions in milliseconds
-
- Returns: a new Observer that emits periodically
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#interval(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#interval,</a>
-
Signature:
public static Observer<Long> interval(final long period, final TimeUnit unit) - Summary: Creates an Observer that emits sequential numbers periodically with the specified period and time unit.
-
Parameters:
-
period(long) — the period between emissions -
unit(TimeUnit) — the time unit of the period
-
- Returns: a new Observer that emits periodically
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#interval(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#interval,</a>
-
Signature:
public static Observer<Long> interval(final long initialDelay, final long period, final TimeUnit unit) throws IllegalArgumentException - Summary: Creates an Observer that emits sequential numbers periodically with an initial delay, period, and time unit.
-
Parameters:
-
initialDelay(long) — the initial delay before the first emission -
period(long) — the period between subsequent emissions -
unit(TimeUnit) — the time unit for both delay and period
-
- Returns: a new Observer that emits periodically
-
Throws:
-
java.lang.IllegalArgumentException— if initialDelay is negative, period is non-positive, or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#interval(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#interval,</a>
Public Instance Methods
debounce(...) -> Observer<T>
-
Signature:
public Observer<T> debounce(final long intervalDurationInMillis) - Summary: Applies debounce operator that only emits an item if a particular timespan has passed without emitting another item.
-
Contract:
- Applies debounce operator that only emits an item if a particular timespan has passed without emitting another item.
-
Parameters:
-
intervalDurationInMillis(long) — the debounce interval in milliseconds
-
- Returns: this Observer instance for method chaining
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#debounce(long,%20java.util.concurrent.TimeUnit,%20io.reactivex.Scheduler)">,RxJava#debounce,</a>
-
Signature:
public Observer<T> debounce(final long intervalDuration, final TimeUnit unit) throws IllegalArgumentException - Summary: Applies debounce operator that only emits an item if a particular timespan has passed without emitting another item.
-
Contract:
- Applies debounce operator that only emits an item if a particular timespan has passed without emitting another item.
-
Parameters:
-
intervalDuration(long) — the debounce interval -
unit(TimeUnit) — the time unit of the interval
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if intervalDuration is negative or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#debounce(long,%20java.util.concurrent.TimeUnit,%20io.reactivex.Scheduler)">,RxJava#debounce,</a>
throttleFirst(...) -> Observer<T>
-
Signature:
public Observer<T> throttleFirst(final long intervalDurationInMillis) - Summary: Applies throttleFirst operator that only emits the first item emitted during sequential time windows of a specified duration.
-
Parameters:
-
intervalDurationInMillis(long) — the throttle window duration in milliseconds
-
- Returns: this Observer instance for method chaining
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#throttleFirst(long,%20java.util.concurrent.TimeUnit)">,RxJava#throttleFirst,</a>
-
Signature:
public Observer<T> throttleFirst(final long intervalDuration, final TimeUnit unit) throws IllegalArgumentException - Summary: Applies throttleFirst operator that only emits the first item emitted during sequential time windows of a specified duration with custom time units.
-
Parameters:
-
intervalDuration(long) — the throttle window duration -
unit(TimeUnit) — the time unit of the interval
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if intervalDuration is negative or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#throttleFirst(long,%20java.util.concurrent.TimeUnit)">,RxJava#throttleFirst,</a>
throttleLast(...) -> Observer<T>
-
Signature:
public Observer<T> throttleLast(final long intervalDurationInMillis) - Summary: Applies throttleLast operator that only emits the last item emitted during sequential time windows of a specified duration.
-
Parameters:
-
intervalDurationInMillis(long) — the sampling window duration in milliseconds
-
- Returns: this Observer instance for method chaining
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#throttleLast(long,%20java.util.concurrent.TimeUnit)">,RxJava#throttleLast,</a>
-
Signature:
public Observer<T> throttleLast(final long intervalDuration, final TimeUnit unit) throws IllegalArgumentException - Summary: Applies throttleLast operator that only emits the last item emitted during sequential time windows of a specified duration with custom time units.
-
Parameters:
-
intervalDuration(long) — the sampling window duration -
unit(TimeUnit) — the time unit of the interval
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if intervalDuration is negative or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#throttleLast(long,%20java.util.concurrent.TimeUnit)">,RxJava#throttleLast,</a>
delay(...) -> Observer<T>
-
Signature:
public Observer<T> delay(final long delayInMillis) - Summary: Delays the emission of items by the specified duration in milliseconds.
-
Parameters:
-
delayInMillis(long) — the delay duration in milliseconds
-
- Returns: this Observer instance for method chaining
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#delay(long,%20java.util.concurrent.TimeUnit)">,RxJava#delay,</a>
-
Signature:
public Observer<T> delay(final long delay, final TimeUnit unit) throws IllegalArgumentException - Summary: Delays the emission of items by the specified duration with custom time units.
-
Parameters:
-
delay(long) — the delay duration -
unit(TimeUnit) — the time unit of the delay
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if delay is negative or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#delay(long,%20java.util.concurrent.TimeUnit)">,RxJava#delay,</a>
timeInterval(...) -> Observer<Timed<T>>
-
Signature:
public Observer<Timed<T>> timeInterval() - Summary: Transforms items into Timed objects that contain the time interval between consecutive emissions in milliseconds.
-
Parameters:
- (none)
- Returns: this Observer instance emitting Timed objects with interval information
- See also: <a href="http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html#timeInterval()">,RxJava#timeInterval,</a>
timestamp(...) -> Observer<Timed<T>>
-
Signature:
public Observer<Timed<T>> timestamp() - Summary: Transforms items into Timed objects that contain the timestamp of emission in milliseconds since epoch.
-
Parameters:
- (none)
- Returns: this Observer instance emitting Timed objects with timestamp information
- See also: <a href="http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html#timestamp()">,RxJava#timestamp,</a>
skip(...) -> Observer<T>
-
Signature:
public Observer<T> skip(final long n) throws IllegalArgumentException - Summary: Skips the first n items emitted by this Observer and emits the remaining items.
-
Parameters:
-
n(long) — the number of items to skip
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> Observer<T>
-
Signature:
public Observer<T> limit(final long maxSize) throws IllegalArgumentException - Summary: Limits the number of items emitted by this Observer to at most maxSize items.
-
Parameters:
-
maxSize(long) — the maximum number of items to emit
-
- Returns: this Observer instance for method chaining
-
Throws:
-
java.lang.IllegalArgumentException— if maxSize is negative
-
distinct(...) -> Observer<T>
-
Signature:
public Observer<T> distinct() - Summary: Filters out duplicate items, ensuring each unique item is emitted only once.
-
Parameters:
- (none)
- Returns: this Observer instance for method chaining
distinctBy(...) -> Observer<T>
-
Signature:
public Observer<T> distinctBy(final Function<? super T, ?> keyExtractor) - Summary: Filters out items with duplicate keys as determined by the keyExtractor function.
-
Parameters:
-
keyExtractor(Function<? super T, ?>) — function to extract the key for comparison
-
- Returns: this Observer instance for method chaining
filter(...) -> Observer<T>
-
Signature:
public Observer<T> filter(final Predicate<? super T> filter) - Summary: Filters items emitted by this Observer, only emitting those that satisfy the predicate.
-
Parameters:
-
filter(Predicate<? super T>) — the predicate to test items
-
- Returns: this Observer instance for method chaining
map(...) -> Observer<R>
-
Signature:
public <R> Observer<R> map(final Function<? super T, R> mapper) - Summary: Transforms each item emitted by this Observer by applying a mapper function.
-
Parameters:
-
mapper(Function<? super T, R>) — the function to transform items
-
- Returns: a new Observer emitting transformed items
flatMap(...) -> Observer<R>
-
Signature:
public <R> Observer<R> flatMap(final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Transforms each item into a collection and flattens the results into a single sequence.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends R>>) — function that transforms each item into a collection
-
- Returns: a new Observer emitting the flattened items
buffer(...) -> Observer<List<T>>
-
Signature:
public Observer<List<T>> buffer(final long timespan, final TimeUnit unit) - Summary: Buffers items into lists based on a time window.
-
Parameters:
-
timespan(long) — the time window duration -
unit(TimeUnit) — the time unit of the timespan
-
- Returns: this Observer instance emitting lists of buffered items
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#buffer(long,%20java.util.concurrent.TimeUnit)">,RxJava#window(long, java.util.concurrent.TimeUnit),</a>
-
Signature:
public Observer<List<T>> buffer(final long timespan, final TimeUnit unit, final int count) throws IllegalArgumentException - Summary: Buffers items into lists based on time windows or item count, whichever occurs first.
-
Contract:
- Emits when either the time window expires or the buffer reaches the specified count.
-
Parameters:
-
timespan(long) — the time window duration -
unit(TimeUnit) — the time unit of the timespan -
count(int) — the maximum number of items per buffer
-
- Returns: this Observer instance emitting lists of buffered items
-
Throws:
-
java.lang.IllegalArgumentException— if timespan or count is non-positive, or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#buffer(long,%20java.util.concurrent.TimeUnit,%20int)">,RxJava#window(long, java.util.concurrent.TimeUnit, int),</a>
-
Signature:
public Observer<List<T>> buffer(final long timespan, final long timeskip, final TimeUnit unit) - Summary: Buffers items into lists based on sliding time windows.
-
Parameters:
-
timespan(long) — the duration of each buffer window -
timeskip(long) — the interval between starting new buffers -
unit(TimeUnit) — the time unit for both timespan and timeskip
-
- Returns: this Observer instance emitting lists of buffered items
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#buffer(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#window(long, long, java.util.concurrent.TimeUnit),</a>
-
Signature:
public Observer<List<T>> buffer(final long timespan, final long timeskip, final TimeUnit unit, final int count) throws IllegalArgumentException - Summary: Buffers items into lists based on sliding time windows with a maximum count per buffer.
-
Contract:
- Creates overlapping or gapped windows that emit when either the window duration expires or the count is reached.
-
Parameters:
-
timespan(long) — the duration of each buffer window -
timeskip(long) — the interval between starting new buffers -
unit(TimeUnit) — the time unit for both timespan and timeskip -
count(int) — the maximum number of items per buffer
-
- Returns: this Observer instance emitting lists of buffered items
-
Throws:
-
java.lang.IllegalArgumentException— if timespan, timeskip, or count is non-positive, or unit is null
-
- See also: <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html#buffer(long,%20long,%20java.util.concurrent.TimeUnit)">,RxJava#window(long, long, java.util.concurrent.TimeUnit),</a>
observe(...) -> void
-
Signature:
public void observe(final Consumer<? super T> action) - Summary: Subscribes to this Observer with an action to be performed on each emitted item.
-
Contract:
- If an error occurs, it will be thrown as a RuntimeException.
-
Parameters:
-
action(Consumer<? super T>) — the action to perform on each item
-
-
Signature:
public void observe(final Consumer<? super T> action, final Consumer<? super Exception> onError) - Summary: Subscribes to this Observer with actions for items and errors.
-
Parameters:
-
action(Consumer<? super T>) — the action to perform on each item -
onError(Consumer<? super Exception>) — the action to perform on error
-
-
Signature:
public abstract void observe(final Consumer<? super T> action, final Consumer<? super Exception> onError, final Runnable onComplete) - Summary: Subscribes to this Observer with actions for items, errors, and completion.
-
Parameters:
-
action(Consumer<? super T>) — the action to perform on each item -
onError(Consumer<? super Exception>) — the action to perform on error -
onComplete(Runnable) — the action to perform on completion
-
Enum OperationType (com.landawn.abacus.util.OperationType)
Enumeration representing different types of database operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> OperationType
-
Signature:
public static OperationType valueOf(final int intValue) - Summary: Returns the OperationType corresponding to the specified integer value.
-
Parameters:
-
intValue(int) — the integer value to convert
-
- Returns: the corresponding OperationType
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this operation type.
-
Parameters:
- (none)
- Returns: the integer value of this operation type
Interface Paginated (com.landawn.abacus.util.Paginated)
Interface for handling paginated data structures, providing methods to navigate through pages of data and retrieve page information.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
firstPage(...) -> Optional<T>
-
Signature:
Optional<T> firstPage() - Summary: Returns the first page of the paginated data wrapped in an Optional.
-
Contract:
- If the paginated data is empty (contains no pages), an empty Optional is returned.
- <p> This method provides a safe way to access the first page without throwing exceptions when the data set is empty.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Paginated<List<Product>> products = productService.getPaginatedProducts(); products.firstPage().ifPresent(firstPageProducts -> { System.out.println("First page has " + firstPageProducts.size() + " products"); // Process first page products }); // Or with explicit handling Optional<List<Product>> firstPage = products.firstPage(); if (firstPage.isPresent()) { displayProducts(firstPage.get()); } else { System.out.println("No products found"); } } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the first page if it exists, or Optional.empty() if there are no pages
lastPage(...) -> Optional<T>
-
Signature:
Optional<T> lastPage() - Summary: Returns the last page of the paginated data wrapped in an Optional.
-
Contract:
- If the paginated data is empty (contains no pages), an empty Optional is returned.
- The implementation should efficiently retrieve the last page without iterating through all pages if possible.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Paginated<List<LogEntry>> logs = logService.getPaginatedLogs(); // Get the most recent log entries (assuming newest last) logs.lastPage().ifPresent(recentLogs -> { System.out.println("Latest " + recentLogs.size() + " log entries"); recentLogs.forEach(this::processLogEntry); }); // Check if there's data before processing if (logs.lastPage().isPresent()) { int totalPages = logs.totalPages(); System.out.println("Processing " + totalPages + " pages of logs"); } } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the last page if it exists, or Optional.empty() if there are no pages
getPage(...) -> T
-
Signature:
T getPage(int pageNum) - Summary: Retrieves the page at the specified page number (0-based index).
-
Contract:
- <p> This method throws an exception if the requested page number is out of bounds.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Paginated<List<Order>> orders = orderService.getPaginatedOrders(); int totalPages = orders.totalPages(); // Safely get a specific page int pageToRetrieve = 5; if (pageToRetrieve < totalPages) { List<Order> page = orders.getPage(pageToRetrieve); processOrders(page); } // Process multiple pages for (int i = 0; i < Math.min(10, totalPages); i++) { List<Order> page = orders.getPage(i); System.out.println("Page " + i + " has " + page.size() + " orders"); } } </pre>
-
Parameters:
-
pageNum(int) — the page number to retrieve (0-based index)
-
- Returns: the data contained in the specified page
pageSize(...) -> int
-
Signature:
int pageSize() - Summary: Returns the size of each page in the paginated data.
-
Contract:
- <p> Note that the last page may contain fewer items than the page size if the total number of items is not evenly divisible by the page size.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Paginated<List<Customer>> customers = customerService.getPaginatedCustomers(); int pageSize = customers.pageSize(); System.out.println("Each page contains up to " + pageSize + " customers"); // Calculate total items (if all pages are full except possibly the last) int totalPages = customers.totalPages(); customers.lastPage().ifPresent(lastPage -> { int totalItems = (totalPages - 1) * pageSize + lastPage.size(); System.out.println("Total customers: " + totalItems); }); } </pre>
-
Parameters:
- (none)
- Returns: the maximum number of items per page
pageCount(...) -> int
-
Signature:
@Deprecated int pageCount() - Summary: Returns the total number of pages in the paginated data.
-
Parameters:
- (none)
- Returns: the total number of pages
- See also: #totalPages()
totalPages(...) -> int
-
Signature:
int totalPages() - Summary: Returns the total number of pages in the paginated data.
-
Contract:
- If the data is empty, this method returns 0.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Paginated<List<Document>> documents = searchService.searchDocuments(query); int totalPages = documents.totalPages(); // Display pagination info System.out.println("Found " + totalPages + " pages of results"); // Build pagination controls for (int i = 0; i < Math.min(totalPages, 10); i++) { // Show first 10 page links createPageLink(i); } // Check if pagination is needed if (totalPages > 1) { showPaginationControls(); } } </pre>
-
Parameters:
- (none)
- Returns: the total number of pages, or 0 if the paginated data is empty
stream(...) -> Stream<T>
-
Signature:
Stream<T> stream() - Summary: Creates a Stream of all pages in the paginated data.
-
Contract:
- Pages are retrieved as needed when stream operations are performed.
-
Parameters:
- (none)
- Returns: a Stream of pages that can be processed using Stream operations
- See also: Stream
Class Pair (com.landawn.abacus.util.Pair)
A mutable container class that holds two related objects as a pair.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Pair<L, R>
-
Signature:
public static <L, R> Pair<L, R> of(final L leftValue, final R rightValue) - Summary: Creates a new Pair instance containing the specified left and right elements.
-
Parameters:
-
leftValue(L) — the left element of the pair, may be {@code null} . -
rightValue(R) — the right element of the pair, may be {@code null} .
-
- Returns: a new Pair instance containing the specified left and right elements.
create(...) -> Pair<K, V>
-
Signature:
public static <K, V> Pair<K, V> create(final Map.Entry<K, V> entry) - Summary: Creates a new Pair instance from an existing Map.Entry.
-
Contract:
- This method is useful when working with Map entries and you need to convert them to Pair objects for further processing.
-
Parameters:
-
entry(Map.Entry<K, V>) — the Map.Entry to convert to a Pair, must not be {@code null} .
-
- Returns: a new Pair instance with the key as the left element and the value as the right element.
emptyArray(...) -> Pair<L, R>\[\]
-
Signature:
@SuppressWarnings("unchecked") public static <L, R> Pair<L, R>[] emptyArray() - Summary: Returns a type-safe empty array of Pair instances.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Pair<String, Integer>\[\] emptyPairs = Pair.emptyArray(); // emptyPairs.length == 0 // Useful in methods that return arrays: public Pair<String, Integer>\[\] getPairs() { if (someCondition) { return Pair.emptyArray(); } // ...
-
Parameters:
- (none)
- Returns: an empty, immutable array of Pair instances.
Public Instance Methods
<init>(...) -> void
-
Signature:
public Pair() - Summary: Constructs an empty Pair with both left and right elements initialized to {@code null} .
-
Contract:
- This constructor is useful when you need to create a pair and set its values later.
-
Parameters:
- (none)
left(...) -> L
-
Signature:
public L left() - Summary: Returns the left element of this pair.
-
Parameters:
- (none)
- Returns: the left element of this pair, may be {@code null} .
right(...) -> R
-
Signature:
public R right() - Summary: Returns the right element of this pair.
-
Parameters:
- (none)
- Returns: the right element of this pair, may be {@code null} .
getLeft(...) -> L
-
Signature:
@Deprecated public L getLeft() - Summary: Gets the left element of this pair.
-
Parameters:
- (none)
- Returns: the left element of the pair, may be {@code null} .
- See also: #left()
setLeft(...) -> void
-
Signature:
public void setLeft(final L left) - Summary: Sets the left element of this pair to the specified value.
-
Parameters:
-
left(L) — the new value for the left element, may be {@code null} .
-
getRight(...) -> R
-
Signature:
@Deprecated public R getRight() - Summary: Gets the right element of this pair.
-
Parameters:
- (none)
- Returns: the right element of the pair, may be {@code null} .
- See also: #right()
setRight(...) -> void
-
Signature:
public void setRight(final R right) - Summary: Sets the right element of this pair to the specified value.
-
Parameters:
-
right(R) — the new value for the right element, may be {@code null} .
-
set(...) -> void
-
Signature:
public void set(final L left, final R right) - Summary: Sets both the left and right elements of this pair in a single operation.
-
Parameters:
-
left(L) — the new value for the left element, may be {@code null} . -
right(R) — the new value for the right element, may be {@code null} .
-
getAndSetLeft(...) -> L
-
Signature:
public L getAndSetLeft(final L newLeft) - Summary: Atomically sets the left element to the given value and returns the previous value.
-
Contract:
- This is particularly useful when you need to track state changes.
-
Parameters:
-
newLeft(L) — the new value to set for the left element, may be {@code null} .
-
- Returns: the previous value of the left element, may be {@code null} .
setAndGetLeft(...) -> L
-
Signature:
public L setAndGetLeft(final L newLeft) - Summary: Sets the left element to the given value and returns the new value.
-
Parameters:
-
newLeft(L) — the new value to set for the left element, may be {@code null} .
-
- Returns: the new value of the left element (same as the parameter), may be {@code null} .
getAndSetRight(...) -> R
-
Signature:
public R getAndSetRight(final R newRight) - Summary: Atomically sets the right element to the given value and returns the previous value.
-
Contract:
- This is particularly useful when you need to track state changes.
-
Parameters:
-
newRight(R) — the new value to set for the right element, may be {@code null} .
-
- Returns: the previous value of the right element, may be {@code null} .
setAndGetRight(...) -> R
-
Signature:
public R setAndGetRight(final R newRight) - Summary: Sets the right element to the given value and returns the new value.
-
Parameters:
-
newRight(R) — the new value to set for the right element, may be {@code null} .
-
- Returns: the new value of the right element (same as the parameter), may be {@code null} .
setLeftIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setLeftIf(final Throwables.BiPredicate<? super L, ? super R, E> predicate, final L newLeft) throws E - Summary: Conditionally sets the left element to the specified value.
-
Contract:
- If the predicate returns {@code true} , the left element is updated to {@code newLeft} ; otherwise this pair remains unchanged.
- If it throws an exception, the left element is not modified and the exception is propagated.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super L, ? super R, E>) — the condition to evaluate against the current left and right values; must not be {@code null} -
newLeft(L) — the new value to assign to the left element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if the left element was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setRightIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setRightIf(final Throwables.BiPredicate<? super L, ? super R, E> predicate, final R newRight) throws E - Summary: Conditionally sets the right element to the specified value.
-
Contract:
- If the predicate returns {@code true} , the right element is updated to {@code newRight} ; otherwise this pair remains unchanged.
- If it throws an exception, the right element is not modified and the exception is propagated.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super L, ? super R, E>) — the condition to evaluate against the current left and right values; must not be {@code null} -
newRight(R) — the new value to assign to the right element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if the right element was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.BiPredicate<? super L, ? super R, E> predicate, final L newLeft, final R newRight) throws E - Summary: Conditionally sets both the left and right elements to the specified values.
-
Contract:
- If the predicate returns {@code true} , both elements are updated to {@code newLeft} and {@code newRight} respectively.
- If the predicate returns {@code false} , this pair remains unchanged.
- If it throws an exception, neither element is modified and the exception is propagated.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super L, ? super R, E>) — the condition to evaluate against the current left and right values; must not be {@code null} -
newLeft(L) — the new value to assign to the left element if the predicate passes; may be {@code null} -
newRight(R) — the new value to assign to the right element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if both elements were updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
swap(...) -> Pair<R, L>
-
Signature:
@Beta public Pair<R, L> swap() - Summary: Creates and returns a new Pair with the left and right elements swapped.
-
Parameters:
- (none)
- Returns: a new Pair with the right element as the left and the left element as the right.
copy(...) -> Pair<L, R>
-
Signature:
public Pair<L, R> copy() - Summary: Creates and returns a shallow copy of this pair.
-
Contract:
- Note that this is a shallow copy - if the elements are mutable objects, changes to those objects will be reflected in both pairs.
-
Parameters:
- (none)
- Returns: a new Pair containing the same left and right elements as this pair.
toArray(...) -> Object\[\]
-
Signature:
public Object[] toArray() - Summary: Converts this pair to an Object array containing two elements.
-
Parameters:
- (none)
- Returns: a new Object array of length 2 containing \[left, right\].
-
Signature:
public <A> A[] toArray(A[] a) - Summary: Converts this pair to an array of the specified type, storing the left element at index 0 and the right element at index 1.
-
Contract:
- If the provided array has a length of at least 2, it is used directly; otherwise, a new array of the same type with length 2 is created.
-
Parameters:
-
a(A[]) — the array into which the elements are to be stored, if it is big enough;. otherwise, a new array of the same runtime type is allocated for this purpose
-
- Returns: an array containing the left element at index 0 and the right element at index 1.
forEach(...) -> void
-
Signature:
public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: Performs the given action on each element of this pair.
-
Contract:
- The consumer must be able to handle the types of both elements.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the action to be performed on each element; must accept a common. supertype of both L and R (typically Object)
-
-
Throws:
-
E— if the consumer throws an exception.
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.BiConsumer<? super L, ? super R, E> action) throws E - Summary: Performs the given action with both elements of this pair as arguments.
-
Contract:
- This method is useful when you need to process both elements together in a single operation.
-
Parameters:
-
action(Throwables.BiConsumer<? super L, ? super R, E>) — the action to be performed with the left and right elements as arguments.
-
-
Throws:
-
E— if the action throws an exception.
-
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super Pair<L, R>, E> action) throws E - Summary: Performs the given action with this pair as the argument.
-
Contract:
- This method is useful when you want to process the pair as a whole rather than its individual elements.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Pair<String, Integer> pair = Pair.of("Score", 100); List<Pair<String, Integer>> pairs = new ArrayList<>(); pair.accept(pairs::add); // pairs now contains the pair pair.accept(p -> { if (p.right() > 50) { System.out.println(p.left() + " is high"); } }); // Prints "Score is high" } </pre>
-
Parameters:
-
action(Throwables.Consumer<? super Pair<L, R>, E>) — the action to be performed with this pair as the argument.
-
-
Throws:
-
E— if the action throws an exception.
-
map(...) -> U
-
Signature:
public <U, E extends Exception> U map(final Throwables.BiFunction<? super L, ? super R, ? extends U, E> mapper) throws E - Summary: Applies the given function to both elements of this pair and returns the result.
-
Parameters:
-
mapper(Throwables.BiFunction<? super L, ? super R, ? extends U, E>) — the function to apply to the left and right elements.
-
- Returns: the result of applying the mapper function to both elements.
-
Throws:
-
E— if the mapper function throws an exception.
-
-
Signature:
public <U, E extends Exception> U map(final Throwables.Function<? super Pair<L, R>, ? extends U, E> mapper) throws E - Summary: Applies the given function to this pair and returns the result.
-
Parameters:
-
mapper(Throwables.Function<? super Pair<L, R>, ? extends U, E>) — the function to apply to this pair.
-
- Returns: the result of applying the mapper function to this pair.
-
Throws:
-
E— if the mapper function throws an exception.
-
filter(...) -> Optional<Pair<L, R>>
-
Signature:
public <E extends Exception> Optional<Pair<L, R>> filter(final Throwables.BiPredicate<? super L, ? super R, E> predicate) throws E - Summary: Returns an Optional containing this pair if the given predicate evaluates to true for the left and right elements, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this pair if the given predicate evaluates to true for the left and right elements, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super L, ? super R, E>) — the condition to test with the left and right elements.
-
- Returns: an Optional containing this pair if the predicate returns {@code true} ,. otherwise an empty Optional
-
Throws:
-
E— if the predicate throws an exception.
-
-
Signature:
public <E extends Exception> Optional<Pair<L, R>> filter(final Throwables.Predicate<? super Pair<L, R>, E> predicate) throws E - Summary: Returns an Optional containing this pair if the given predicate evaluates to true for this pair, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this pair if the given predicate evaluates to true for this pair, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.Predicate<? super Pair<L, R>, E>) — the condition to test with this pair.
-
- Returns: an Optional containing this pair if the predicate returns {@code true} ,. otherwise an empty Optional
-
Throws:
-
E— if the predicate throws an exception.
-
toTuple(...) -> Tuple2<L, R>
-
Signature:
public Tuple2<L, R> toTuple() - Summary: Converts this pair to a Tuple2 (2-element tuple).
-
Parameters:
- (none)
- Returns: a new Tuple2 containing the same elements as this pair.
toImmutableEntry(...) -> ImmutableEntry<L, R>
-
Signature:
public ImmutableEntry<L, R> toImmutableEntry() - Summary: Converts this pair to an immutable Map.Entry.
-
Contract:
- <p> This is useful when you need to pass the pair to APIs that expect Map.Entry objects but want to ensure the values cannot be modified.
-
Parameters:
- (none)
- Returns: a new immutable Map.Entry with the same key-value mapping as this pair.
getKey(...) -> L
-
Signature:
@Deprecated @Override public L getKey() - Summary: Returns the left element of this pair, implementing the Map.Entry interface.
-
Contract:
- When using Pair as a Map.Entry, the left element serves as the key.
-
Parameters:
- (none)
- Returns: the left element of this pair, may be {@code null} .
getValue(...) -> R
-
Signature:
@Deprecated @Override public R getValue() - Summary: Returns the right element of this pair, implementing the Map.Entry interface.
-
Contract:
- When using Pair as a Map.Entry, the right element serves as the value.
-
Parameters:
- (none)
- Returns: the right element of this pair, may be {@code null} .
setValue(...) -> R
-
Signature:
@Deprecated @Override public R setValue(final R value) - Summary: Sets the right element of this pair to the specified value and returns the previous value, implementing the Map.Entry interface.
-
Contract:
- When using Pair as a Map.Entry, this method modifies the value (right element) and returns the old value.
-
Parameters:
-
value(R) — the new value to set for the right element, may be {@code null} .
-
- Returns: the previous value of the right element, may be {@code null} .
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this pair.
-
Parameters:
- (none)
- Returns: a hash code value for this pair.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this pair to the specified object for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also a Pair, and both pairs have equal left and right elements.
- <p> Two elements are considered equal if they are both {@code null} , or if they are equal according to their equals() method.
-
Parameters:
-
obj(Object) — the object to be compared for equality with this pair.
-
- Returns: {@code true} if the specified object is equal to this pair, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this pair.
-
Parameters:
- (none)
- Returns: a string representation of this pair in the format (left, right).
Class Password (com.landawn.abacus.util.Password)
A utility class for password encryption and verification using various hashing algorithms.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public Password(final String algorithm) - Summary: Creates a new Password instance with the specified hashing algorithm.
-
Contract:
- The algorithm must be one supported by the Java security provider (e.g., "MD5", "SHA-1", "SHA-256", "SHA-512").
-
Parameters:
-
algorithm(String) — the name of the hashing algorithm to use
-
- See also: MessageDigest#getInstance(String)
getAlgorithm(...) -> String
-
Signature:
public String getAlgorithm() - Summary: Returns the name of the hashing algorithm used by this Password instance.
-
Parameters:
- (none)
- Returns: the algorithm name (e.g., "SHA-256", "MD5")
encrypt(...) -> String
-
Signature:
@MayReturnNull public synchronized String encrypt(final String x) - Summary: Encrypts the given password string using the configured hashing algorithm and returns the result encoded in Base64 format.
-
Parameters:
-
x(String) — the plain text password to encrypt
-
- Returns: the encrypted password encoded in Base64, or {@code null} if input is {@code null}
isEqual(...) -> boolean
-
Signature:
public boolean isEqual(final String plainPassword, final String encryptedPassword) - Summary: Verifies if a plain text password matches an encrypted password.
-
Contract:
- Verifies if a plain text password matches an encrypted password.
-
Parameters:
-
plainPassword(String) — the plain text password to verify -
encryptedPassword(String) — the encrypted password to compare against
-
- Returns: {@code true} if the passwords match, {@code false} otherwise. Returns {@code true} if both are {@code null} , {@code false} if only one is {@code null}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Password instance based on the algorithm name.
-
Parameters:
- (none)
- Returns: a hash code value for this object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this Password instance with the specified object for equality.
-
Contract:
- Two Password instances are considered equal if they use the same algorithm.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Password instance.
-
Parameters:
- (none)
- Returns: a string representation of this object
Enum Percentage (com.landawn.abacus.util.Percentage)
Enumeration representing common percentage values with their string representations and decimal equivalents.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
range(...) -> ImmutableSet<Percentage>
-
Signature:
public static ImmutableSet<Percentage> range(final Percentage startInclusive, final Percentage endExclusive) - Summary: Returns an immutable set of Percentage values within the specified range.
-
Parameters:
-
startInclusive(Percentage) — the starting percentage (inclusive), must not be {@code null} . -
endExclusive(Percentage) — the ending percentage (exclusive), must not be {@code null} .
-
- Returns: an immutable set containing all Percentage values in the specified range.
-
Signature:
public static ImmutableSet<Percentage> range(final Percentage startInclusive, final Percentage endExclusive, final Percentage by) - Summary: Returns an immutable set of Percentage values within the specified range with a step increment.
-
Parameters:
-
startInclusive(Percentage) — the starting percentage (inclusive), must not be {@code null} . -
endExclusive(Percentage) — the ending percentage (exclusive), must not be {@code null} . -
by(Percentage) — the step increment between percentages, must not be {@code null} .
-
- Returns: an immutable set containing Percentage values at the specified intervals.
rangeClosed(...) -> ImmutableSet<Percentage>
-
Signature:
public static ImmutableSet<Percentage> rangeClosed(final Percentage startInclusive, final Percentage endInclusive) - Summary: Returns an immutable set of Percentage values within the specified closed range.
-
Parameters:
-
startInclusive(Percentage) — the starting percentage (inclusive), must not be {@code null} . -
endInclusive(Percentage) — the ending percentage (inclusive), must not be {@code null} .
-
- Returns: an immutable set containing all Percentage values in the specified closed range.
-
Signature:
public static ImmutableSet<Percentage> rangeClosed(final Percentage startInclusive, final Percentage endInclusive, final Percentage by) - Summary: Returns an immutable set of Percentage values within the specified closed range with a step increment.
-
Parameters:
-
startInclusive(Percentage) — the starting percentage (inclusive), must not be {@code null} . -
endInclusive(Percentage) — the ending percentage (inclusive), must not be {@code null} . -
by(Percentage) — the step increment between percentages, must not be {@code null} .
-
- Returns: an immutable set containing Percentage values at the specified intervals.
Public Instance Methods
doubleValue(...) -> double
-
Signature:
public double doubleValue() - Summary: Returns the decimal representation of this percentage.
-
Parameters:
- (none)
- Returns: the decimal value of this percentage
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the string representation of this percentage.
-
Parameters:
- (none)
- Returns: the string representation of this percentage
Class PermutationIterator (com.landawn.abacus.util.PermutationIterator)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ObjIterator<List<T>>
-
Signature:
public static <T> ObjIterator<List<T>> of(final Collection<T> elements) - Summary: Returns an iterator over all permutations of the specified collection.
-
Contract:
- </p> <p> If the input collection contains duplicate elements, some of the generated permutations will be equal.
-
Parameters:
-
elements(Collection<T>) — the original collection whose elements have to be permuted
-
- Returns: an iterator containing all the different permutations of the original collection
ordered(...) -> ObjIterator<List<T>>
-
Signature:
public static <T extends Comparable<? super T>> ObjIterator<List<T>> ordered(final Collection<T> elements) - Summary: Returns an iterator over all permutations of the specified collection in lexicographical order.
-
Contract:
- The elements must implement {@link Comparable} .
-
Parameters:
-
elements(Collection<T>) — the original iterable whose elements have to be permuted
-
- Returns: an iterator containing all the different permutations of the original iterable
-
Signature:
public static <T> ObjIterator<List<T>> ordered(final Collection<T> elements, final Comparator<? super T> comparator) - Summary: Returns an iterator over all permutations of the specified collection using the specified {@link Comparator} for establishing the lexicographical ordering.
-
Parameters:
-
elements(Collection<T>) — the original iterable whose elements have to be permuted -
comparator(Comparator<? super T>) — a comparator for the iterable's elements
-
- Returns: an iterator containing all the different permutations of the original iterable
Public Instance Methods
- (none)
Class PrefixSearchTable (com.landawn.abacus.util.PrefixSearchTable)
A lookup table that stores prefix (a list of keys of type {@code K} ) - > value mappings.
Since: 7.1 Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
builder(...) -> Builder<K, V>
-
Signature:
public static <K, V> Builder<K, V> builder() - Summary: Returns a new builder.
-
Parameters:
- (none)
- Returns: a new builder instance
Public Instance Methods
get(...) -> Optional<V>
-
Signature:
public Optional<V> get(List<? extends K> compoundKey) - Summary: Searches the table for the longest prefix match of {@code compoundKey} .
-
Parameters:
-
compoundKey(List<? extends K>) — the compound key to search for
-
- Returns: the value mapped to the longest (non-empty) prefix of {@code compoundKey} if present
getAll(...) -> EntryStream<List<K>, V>
-
Signature:
public EntryStream<List<K>, V> getAll(List<? extends K> compoundKey) - Summary: Searches the table for prefixes of {@code compoundKey} and returns a <em> lazy </em> EntryStream of all mappings in ascending order of prefix length.
-
Contract:
- <p> If no non-empty prefix exists in the table, an empty EntryStream is returned.
-
Parameters:
-
compoundKey(List<? extends K>) — the compound key to search for
-
- Returns: EntryStream of the matched prefixes of {@code compoundKey} and the mapped values
toBuilder(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> toBuilder() - Summary: Returns a new builder initialized with the same prefix mappings in this table.
-
Parameters:
- (none)
- Returns: a builder initialized with the current mappings
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class Builder (com.landawn.abacus.util.PrefixSearchTable.Builder)
Builder of {@link PrefixSearchTable} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
add(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> add(List<? extends K> compoundKey, V value) - Summary: Adds the mapping from {@code compoundKey} to {@code value} .
-
Parameters:
-
compoundKey(List<? extends K>) — the compound key to add -
value(V) — the value to associate with the compound key
-
- Returns: this builder
addAll(...) -> Builder<K, V>
-
Signature:
public Builder<K, V> addAll(Map<? extends List<? extends K>, ? extends V> mappings) - Summary: Adds all of {@code mappings} into this builder.
-
Parameters:
-
mappings(Map<? extends List<? extends K>, ? extends V>) — the mappings to add
-
- Returns: this builder
build(...) -> PrefixSearchTable<K, V>
-
Signature:
public PrefixSearchTable<K, V> build() - Summary: Builds a PrefixSearchTable from the accumulated mappings.
-
Parameters:
- (none)
- Returns: a new PrefixSearchTable containing all added mappings
Class PrimitiveList (com.landawn.abacus.util.PrimitiveList)
An abstract base class that provides a comprehensive framework for implementing lists of primitive data types with high-performance operations and extensive functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
array(...) -> A
-
Signature:
@Deprecated @Beta public abstract A array() - Summary: Returns the internal array backing this list without creating a copy.
-
Contract:
- <p> <b> Warning: </b> The returned array should not be modified unless you understand the implications.
-
Parameters:
- (none)
- Returns: the internal array backing this list
addAll(...) -> boolean
-
Signature:
public abstract boolean addAll(L other) - Summary: Appends all elements from the specified PrimitiveList to the end of this list, in the order they appear in the specified list.
-
Contract:
- <p> This operation may cause the list to reallocate its internal array if the current capacity is insufficient to accommodate all new elements.
-
Parameters:
-
other(L) — the PrimitiveList containing elements to be added to this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty), {@code false} otherwise
-
Signature:
public abstract boolean addAll(int index, L other) - Summary: Inserts all elements from the specified PrimitiveList into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
- <p> This operation may cause the list to reallocate its internal array if the current capacity is insufficient to accommodate all new elements.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list. Must be between 0 and size() (inclusive). -
other(L) — the PrimitiveList containing elements to be inserted into this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if c was not empty), {@code false} otherwise
-
Signature:
public abstract boolean addAll(A values) - Summary: Appends all elements from the specified array to the end of this list, in the order they appear in the array.
-
Contract:
- <p> This operation may cause the list to reallocate its internal array if the current capacity is insufficient to accommodate all new elements.
-
Parameters:
-
values(A) — the array containing elements to be added to this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty), {@code false} otherwise
-
Signature:
public abstract boolean addAll(int index, A values) - Summary: Inserts all elements from the specified array into this list at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
- <p> This operation may cause the list to reallocate its internal array if the current capacity is insufficient to accommodate all new elements.
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array. Must be between 0 and size() (inclusive). -
values(A) — the array containing elements to be inserted into this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list changed as a result of the call (i.e., if the array was not empty), {@code false} otherwise
removeAll(...) -> boolean
-
Signature:
public abstract boolean removeAll(L other) - Summary: Removes from this list all of its elements that are contained in the specified PrimitiveList.
-
Contract:
- <p> For elements that appear multiple times in this list, all occurrences will be removed if the element appears at least once in the specified list.
-
Parameters:
-
other(L) — the PrimitiveList containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call, {@code false} otherwise
-
Signature:
public abstract boolean removeAll(A values) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Contract:
- <p> For elements that appear multiple times in this list, all occurrences will be removed if the element appears at least once in the specified array.
-
Parameters:
-
values(A) — the array containing elements to be removed from this list. If {@code null} or empty, this list remains unchanged.
-
- Returns: {@code true} if this list was modified as a result of the call, {@code false} otherwise
removeDuplicates(...) -> boolean
-
Signature:
public abstract boolean removeDuplicates() - Summary: Removes duplicate elements from this list, keeping only the first occurrence of each value.
-
Contract:
- <p> This method uses an optimized algorithm when the list is already sorted.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed from this list, {@code false} if the list already contained only unique elements
- Performance: For sorted lists, it runs in O(n) time.
retainAll(...) -> boolean
-
Signature:
public abstract boolean retainAll(L other) - Summary: Retains only the elements in this list that are contained in the specified PrimitiveList.
-
Parameters:
-
other(L) — the PrimitiveList containing elements to be retained in this list. If {@code null} or empty, this list will be cleared.
-
- Returns: {@code true} if this list was modified as a result of the call, {@code false} otherwise
-
Signature:
public abstract boolean retainAll(A values) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
values(A) — the array containing elements to be retained in this list. If {@code null} or empty, this list will be cleared.
-
- Returns: {@code true} if this list was modified as a result of the call, {@code false} otherwise
deleteAllByIndices(...) -> void
-
Signature:
public abstract void deleteAllByIndices(int... indices) - Summary: Removes the elements at the specified positions from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed. Null or empty array results in no change. Invalid indices (negative or > = size()) are ignored.
-
deleteRange(...) -> void
-
Signature:
public abstract void deleteRange(int fromIndex, int toIndex) - Summary: Removes from this list all elements whose index is between fromIndex (inclusive) and toIndex (exclusive).
-
Contract:
- If fromIndex equals toIndex, no elements are removed.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive). Must be non-negative. -
toIndex(int) — the index after the last element to be removed (exclusive). Must be > = fromIndex and < = size().
-
moveRange(...) -> void
-
Signature:
public abstract void moveRange(int fromIndex, int toIndex, int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — \\u2014 the zero-based index where the first element of the range will be placed after the move; must be between 0 and size() - lengthOfRange, inclusive.
-
replaceRange(...) -> void
-
Signature:
public abstract void replaceRange(int fromIndex, int toIndex, L replacement) - Summary: Replaces each element in the specified range of this list with elements from the replacement PrimitiveList.
-
Contract:
- <p> If the replacement list has a different size than the range being replaced, the list will grow or shrink accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to replace. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to replace. Must be > = fromIndex and < = size(). -
replacement(L) — the PrimitiveList whose elements will replace the specified range. If {@code null} or empty, the range is simply deleted.
-
-
Signature:
public abstract void replaceRange(int fromIndex, int toIndex, A replacement) - Summary: Replaces each element in the specified range of this list with elements from the replacement array.
-
Contract:
- <p> If the replacement array has a different length than the range being replaced, the list will grow or shrink accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to replace. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to replace. Must be > = fromIndex and < = size(). -
replacement(A) — the array whose elements will replace the specified range. If {@code null} or empty, the range is simply deleted.
-
containsAny(...) -> boolean
-
Signature:
public abstract boolean containsAny(L other) - Summary: Returns {@code true} if this list contains any element that is also contained in the specified PrimitiveList.
-
Contract:
- Returns {@code true} if this list contains any element that is also contained in the specified PrimitiveList.
- This method returns {@code true} if the two lists share at least one common element.
-
Parameters:
-
other(L) — the PrimitiveList to be checked for common elements with this list. If {@code null} or empty, returns {@code false} .
-
- Returns: {@code true} if this list contains any element from the specified list, {@code false} otherwise
- Performance: <p> This method uses an optimized algorithm when either list is large, potentially converting to a Set for O(1) lookup performance.
-
Signature:
public abstract boolean containsAny(A values) - Summary: Returns {@code true} if this list contains any element that is also contained in the specified array.
-
Contract:
- Returns {@code true} if this list contains any element that is also contained in the specified array.
- This method returns {@code true} if this list and the array share at least one common element.
-
Parameters:
-
values(A) — the array to be checked for common elements with this list. If {@code null} or empty, returns {@code false} .
-
- Returns: {@code true} if this list contains any element from the specified array, {@code false} otherwise
- Performance: <p> This method uses an optimized algorithm when either the list or array is large, potentially converting to a Set for O(1) lookup performance.
containsAll(...) -> boolean
-
Signature:
public abstract boolean containsAll(L other) - Summary: Returns {@code true} if this list contains all elements in the specified PrimitiveList.
-
Contract:
- Returns {@code true} if this list contains all elements in the specified PrimitiveList.
- This method returns {@code true} if the specified list is a subset of this list (ignoring element order but considering duplicates).
- <p> For elements that appear multiple times, this list must contain at least as many occurrences as the specified list.
-
Parameters:
-
other(L) — the PrimitiveList to be checked for containment in this list. If {@code null} or empty, returns {@code true} .
-
- Returns: {@code true} if this list contains all elements in the specified list, {@code false} otherwise
- Performance: </p> <p> This method uses an optimized algorithm when the lists are large, potentially converting to a Set for O(1) lookup performance.
-
Signature:
public abstract boolean containsAll(A values) - Summary: Returns {@code true} if this list contains all elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all elements in the specified array.
- This method returns {@code true} if all elements in the array are present in this list (ignoring element order but considering duplicates).
- <p> For elements that appear multiple times, this list must contain at least as many occurrences as in the array.
-
Parameters:
-
values(A) — the array to be checked for containment in this list. If {@code null} or empty, returns {@code true} .
-
- Returns: {@code true} if this list contains all elements in the specified array, {@code false} otherwise
- Performance: </p> <p> This method uses an optimized algorithm when the list or array is large, potentially converting to a Set for O(1) lookup performance.
disjoint(...) -> boolean
-
Signature:
public abstract boolean disjoint(L other) - Summary: Returns {@code true} if this list has no elements in common with the specified PrimitiveList.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified PrimitiveList.
- Two lists are disjoint if they share no common elements.
-
Parameters:
-
other(L) — the PrimitiveList to check for disjointness with this list. If {@code null} or empty, returns {@code true} .
-
- Returns: {@code true} if the two lists have no elements in common, {@code false} otherwise
- Performance: <p> This method uses an optimized algorithm when either list is large, potentially converting to a Set for O(1) lookup performance.
-
Signature:
public abstract boolean disjoint(A values) - Summary: Returns {@code true} if this list has no elements in common with the specified array.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified array.
- This list and the array are disjoint if they share no common elements.
-
Parameters:
-
values(A) — the array to check for disjointness with this list. If {@code null} or empty, returns {@code true} .
-
- Returns: {@code true} if this list and the array have no elements in common, {@code false} otherwise
- Performance: <p> This method uses an optimized algorithm when either the list or array is large, potentially converting to a Set for O(1) lookup performance.
intersection(...) -> L
-
Signature:
public abstract L intersection(final L other) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
other(L) — the list to find common elements with this list. If {@code null} or empty, returns an empty list.
-
- Returns: a new PrimitiveList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list.
- See also: IntList#intersection(IntList), N#intersection(int\[\], int\[\])
-
Signature:
public abstract L intersection(final A otherValues) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
otherValues(A) — the array to find common elements with this list. If {@code null} or empty, returns an empty list.
-
- Returns: a new PrimitiveList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source.
- See also: IntList#intersection(int\[\]), N#intersection(int\[\], int\[\])
difference(...) -> L
-
Signature:
public abstract L difference(final L other) - Summary: Returns a new list with the elements in this list but not in the specified list, considering the number of occurrences of each element.
-
Contract:
- <p> If an element appears multiple times in both lists, the difference will contain the extra occurrences from this list.
-
Parameters:
-
other(L) — the list to compare against this list. If {@code null} or empty, returns a copy of this list.
-
- Returns: a new PrimitiveList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: IntList#difference(IntList), N#difference(int\[\], int\[\])
-
Signature:
public abstract L difference(final A otherValues) - Summary: Returns a new list with the elements in this list but not in the specified array, considering the number of occurrences of each element.
-
Contract:
- <p> If an element appears multiple times in both sources, the difference will contain the extra occurrences from this list.
-
Parameters:
-
otherValues(A) — the array to compare against this list. If {@code null} or empty, returns a copy of this list.
-
- Returns: a new PrimitiveList containing the elements that are present in this list but not in the specified array, considering the number of occurrences.
- See also: IntList#difference(int\[\]), N#difference(int\[\], int\[\])
symmetricDifference(...) -> L
-
Signature:
public abstract L symmetricDifference(final L other) - Summary: Returns a new list containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
other(L) — the list to compare with this list for symmetric difference. If {@code null} or empty, returns a copy of this list.
-
- Returns: a new list containing elements that are present in either this list or the specified list, but not in both, considering the number of occurrences
- See also: IntList#symmetricDifference(IntList), N#symmetricDifference(int\[\], int\[\])
-
Signature:
public abstract L symmetricDifference(final A otherValues) - Summary: Returns a new list containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
otherValues(A) — the array to compare with this list for symmetric difference. If {@code null} or empty, returns a copy of this list.
-
- Returns: a new list containing elements that are present in either this list or the specified array, but not in both, considering the number of occurrences
- See also: IntList#symmetricDifference(int\[\]), N#symmetricDifference(int\[\], int\[\])
hasDuplicates(...) -> boolean
-
Signature:
public abstract boolean hasDuplicates() - Summary: Checks whether this list contains any duplicate elements.
-
Contract:
- An element is considered a duplicate if it appears more than once in the list.
-
Parameters:
- (none)
- Returns: {@code true} if the list contains at least one duplicate element, {@code false} otherwise
distinct(...) -> L
-
Signature:
public L distinct() - Summary: Returns a new list containing only the distinct elements from this list.
-
Parameters:
- (none)
- Returns: a new PrimitiveList with distinct elements
-
Signature:
public abstract L distinct(final int fromIndex, final int toIndex) - Summary: Returns a new list containing only the distinct elements from the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to process. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to process. Must be > = fromIndex and < = size().
-
- Returns: a new PrimitiveList with distinct elements from the specified range
isSorted(...) -> boolean
-
Signature:
public abstract boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if all elements are in ascending order (allowing equal consecutive values), {@code false} otherwise
sort(...) -> void
-
Signature:
public abstract void sort() - Summary: Sorts all elements in this list in ascending order.
-
Parameters:
- (none)
- Performance: <p> The sorting algorithm used is typically optimized for the primitive type, offering O(n log n) performance on average.
reverseSort(...) -> void
-
Signature:
public abstract void reverseSort() - Summary: Sorts all elements in this list in descending order.
-
Parameters:
- (none)
reverse(...) -> void
-
Signature:
public abstract void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
-
Signature:
public abstract void reverse(final int fromIndex, final int toIndex) - Summary: Reverses the order of elements in the specified range of this list.
-
Contract:
- <p> If fromIndex equals toIndex, the list is unchanged.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to reverse. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to reverse. Must be > = fromIndex and < = size().
-
rotate(...) -> void
-
Signature:
public abstract void rotate(int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left. The distance can be larger than the list size; it will be reduced modulo size.
-
shuffle(...) -> void
-
Signature:
public abstract void shuffle() - Summary: Randomly shuffles all elements in this list.
-
Parameters:
- (none)
-
Signature:
public abstract void shuffle(final Random rnd) - Summary: Randomly shuffles all elements in this list using the specified source of randomness.
-
Parameters:
-
rnd(Random) — the source of randomness to use for shuffling. Must not be {@code null} .
-
swap(...) -> void
-
Signature:
public abstract void swap(int i, int j) - Summary: Swaps the elements at the specified positions in this list.
-
Parameters:
-
i(int) — the index of the first element to swap. Must be > = 0 and < size(). -
j(int) — the index of the second element to swap. Must be > = 0 and < size().
-
copy(...) -> L
-
Signature:
public abstract L copy() - Summary: Returns a new PrimitiveList containing a copy of all elements in this list.
-
Parameters:
- (none)
- Returns: a new PrimitiveList containing all elements from this list
-
Signature:
public abstract L copy(final int fromIndex, final int toIndex) - Summary: Returns a new PrimitiveList containing a copy of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to copy. Must be > = fromIndex and < = size().
-
- Returns: a new PrimitiveList containing the elements in the specified range
-
Signature:
public abstract L copy(final int fromIndex, final int toIndex, final int step) - Summary: Returns a new PrimitiveList containing a copy of elements from the specified range of this list, selecting only elements at intervals defined by the step parameter.
-
Contract:
- For negative step values when fromIndex > toIndex, elements are selected in reverse direction.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy. For forward stepping, must be < toIndex. For reverse stepping, must be > toIndex (or toIndex can be -1 for start). -
toIndex(int) — the ending index (exclusive) of the range to copy. Can be -1 when using negative step to indicate copying to the start. -
step(int) — the interval between selected elements. Must not be zero. Positive values select elements in forward direction, negative values select elements in reverse direction.
-
- Returns: a new PrimitiveList containing the selected elements
split(...) -> List<L>
-
Signature:
public List<L> split(final int chunkSize) - Summary: Splits this list into consecutive chunks of the specified size and returns them as a List of PrimitiveLists.
-
Contract:
- The last chunk may have fewer elements if the list size is not evenly divisible by chunkSize.
-
Parameters:
-
chunkSize(int) — the desired size of each chunk. Must be greater than 0.
-
- Returns: a List containing the PrimitiveList chunks
-
Signature:
public abstract List<L> split(final int fromIndex, final int toIndex, final int chunkSize) - Summary: Splits the specified range of this list into consecutive chunks of the specified size and returns them as a List of PrimitiveLists.
-
Contract:
- The last chunk may have fewer elements if the range size is not evenly divisible by chunkSize.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to split. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to split. Must be > = fromIndex and < = size(). -
chunkSize(int) — the desired size of each chunk. Must be greater than 0.
-
- Returns: a List containing the PrimitiveList chunks
trimToSize(...) -> L
-
Signature:
@Beta public abstract L trimToSize() - Summary: Trims the capacity of this PrimitiveList instance to be the list's current size.
-
Contract:
- If the capacity is already equal to the size, this method does nothing.
-
Parameters:
- (none)
- Returns: this PrimitiveList instance (for method chaining)
clear(...) -> void
-
Signature:
public abstract void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
public abstract boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
public abstract int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
toArray(...) -> A
-
Signature:
public abstract A toArray() - Summary: Returns a new array containing all elements in this list.
-
Parameters:
- (none)
- Returns: a new array containing all elements from this list
boxed(...) -> List<B>
-
Signature:
public List<B> boxed() - Summary: Returns a List containing all elements in this list converted to their boxed type.
-
Contract:
- </p> <p> This method is useful when you need to work with APIs that require List < Integer > rather than primitive arrays.
-
Parameters:
- (none)
- Returns: a new List containing all elements from this list as boxed objects
-
Signature:
public abstract List<B> boxed(final int fromIndex, final int toIndex) - Summary: Returns a List containing elements from the specified range of this list converted to their boxed type.
-
Contract:
- <p> This method is useful when you need to work with APIs that require boxed types rather than primitives for a specific range of elements.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to box. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to box. Must be > = fromIndex and < = size().
-
- Returns: a new List containing elements from the specified range as boxed objects
toList(...) -> List<B>
-
Signature:
@Deprecated public List<B> toList() - Summary: Returns a List containing all elements in this list converted to their boxed type.
-
Parameters:
- (none)
- Returns: a new List containing all elements from this list as boxed objects
-
Signature:
@Deprecated public List<B> toList(final int fromIndex, final int toIndex) - Summary: Returns a List containing elements from the specified range of this list converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert
-
- Returns: a new List containing elements from the specified range as boxed objects
toSet(...) -> Set<B>
-
Signature:
public Set<B> toSet() - Summary: Returns a Set containing all elements in this list converted to their boxed type.
-
Parameters:
- (none)
- Returns: a new Set containing unique elements from this list as boxed objects
-
Signature:
public Set<B> toSet(final int fromIndex, final int toIndex) - Summary: Returns a Set containing elements from the specified range of this list converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert. Must be non-negative. -
toIndex(int) — the ending index (exclusive) of the range to convert. Must be > = fromIndex and < = size().
-
- Returns: a new Set containing unique elements from the specified range as boxed objects
toCollection(...) -> C
-
Signature:
public <C extends Collection<B>> C toCollection(final IntFunction<? extends C> supplier) - Summary: Returns a Collection containing all elements from this list converted to their boxed type.
-
Parameters:
-
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance with the given initial capacity. The supplier receives the number of elements that will be added.
-
- Returns: a Collection containing all elements from this list as boxed objects
-
Signature:
public abstract <C extends Collection<B>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<? extends C>) — a function that creates a new Collection instance of the desired type with the given initial capacity
-
- Returns: a Collection containing elements from the specified range in the same order
toMultiset(...) -> Multiset<B>
-
Signature:
public Multiset<B> toMultiset() - Summary: Returns a Multiset containing all elements from this list converted to their boxed type.
-
Parameters:
- (none)
- Returns: a Multiset containing all elements from this primitive list with their occurrence counts
-
Signature:
public Multiset<B> toMultiset(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert
-
- Returns: a Multiset containing elements from the specified range with their occurrence counts
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
-
Signature:
public Multiset<B> toMultiset(final IntFunction<Multiset<B>> supplier) - Summary: Returns a Multiset containing all elements from this list converted to their boxed type.
-
Parameters:
-
supplier(IntFunction<Multiset<B>>) — a function that creates a new Multiset instance with the given initial capacity
-
- Returns: a Multiset containing all elements from this primitive list with their occurrence counts
-
Signature:
public abstract Multiset<B> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<B>> supplier) - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to convert -
toIndex(int) — the ending index (exclusive) of the range to convert -
supplier(IntFunction<Multiset<B>>) — a function that creates a new Multiset instance with the given initial capacity
-
- Returns: a Multiset containing elements from the specified range with their occurrence counts
iterator(...) -> Iterator<B>
-
Signature:
public abstract Iterator<B> iterator() - Summary: Returns an iterator over the elements in this primitive list.
-
Parameters:
- (none)
- Returns: an Iterator over the boxed elements of type B in this list
Class Profiler (com.landawn.abacus.util.Profiler)
A comprehensive, enterprise-grade performance profiling and benchmarking utility providing advanced execution time measurement, multi-threaded performance testing, and detailed statistical analysis capabilities.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
run(...) -> MultiLoopsStatistics
-
Signature:
public static MultiLoopsStatistics run(final int threadNum, final int loopNum, final int roundNum, final Throwables.Runnable<? extends Exception> command) - Summary: Executes a multi-threaded performance test with the specified configuration parameters.
-
Parameters:
-
threadNum(int) — the number of concurrent threads to execute the test, must be greater than 0. Higher values test concurrent performance but consume more system resources. Typical values: 1 (single-threaded), 4-8 (moderate concurrency), 50+ (stress testing) -
loopNum(int) — the number of times each thread executes the command, must be greater than 0. Each execution is timed individually for statistical analysis. Recommended range: 100-10,000 for balanced memory usage and statistical significance -
roundNum(int) — the number of times to repeat the entire test (all threads and loops). Multiple rounds help eliminate JVM warmup effects and provide stable measurements. Recommended: 3-5 rounds for most tests, 1 for quick checks -
command(Throwables.Runnable<? extends Exception>) — the code to be profiled and executed in each loop iteration. This should be a Runnable that can throw checked exceptions. The command is executed (threadNum loopNum roundNum) times in total
-
- Returns: a {@link MultiLoopsStatistics} object containing comprehensive performance metrics including minimum, maximum, average, and percentile execution times for all test executions. The returned statistics represent the final round of testing
- See also: #run(int, int, int, String, Throwables.Runnable),for tests with custom labels, #run(int, long, int, long, int, String, Throwables.Runnable),for tests with timing delays
-
Signature:
public static MultiLoopsStatistics run(final int threadNum, final int loopNum, final int roundNum, final String label, final Throwables.Runnable<? extends Exception> command) - Summary: Executes a multi-threaded performance test with a custom descriptive label for result identification.
-
Contract:
- This method extends the basic {@link #run(int, int, int, Throwables.Runnable)} by allowing you to specify a meaningful label that appears in the performance statistics output, making it easier to identify and distinguish between different test scenarios when running multiple benchmarks.
-
Parameters:
-
threadNum(int) — the number of concurrent threads to execute the test, must be greater than 0. Determines the level of concurrent load applied during the test -
loopNum(int) — the number of times each thread executes the command, must be greater than 0. Each iteration is measured individually for comprehensive statistics -
roundNum(int) — the number of times to repeat the entire test sequence. Multiple rounds help produce stable, reliable performance measurements -
label(String) — a descriptive identifier for this test that appears in all result outputs. Use meaningful names that clearly describe what is being tested. This label will appear in console output, HTML reports, and XML exports. Can be {@code null} , in which case "run" is used as the default label -
command(Throwables.Runnable<? extends Exception>) — the code block to be profiled and executed in each loop iteration. Should be a Runnable that encapsulates the operation being benchmarked
-
- Returns: a {@link MultiLoopsStatistics} object containing comprehensive performance metrics for the labeled test, including execution times, percentiles, and statistical analysis. The statistics object includes the label for easy identification
- See also: #run(int, int, int, Throwables.Runnable),for basic testing without custom labels, #run(int, long, int, long, int, String, Throwables.Runnable),for tests with timing delays and labels
-
Signature:
public static MultiLoopsStatistics run(final int threadNum, final long threadDelay, final int loopNum, final long loopDelay, final int roundNum, final String label, final Throwables.Runnable<? extends Exception> command) - Summary: Executes a comprehensive multi-threaded performance test with fine-grained control over timing, delays, and execution patterns.
-
Parameters:
-
threadNum(int) — the number of concurrent threads to execute the test, must be greater than 0. Each thread runs independently and executes the full loop sequence -
threadDelay(long) — the delay in milliseconds to wait before starting each subsequent thread, must be >= 0. A value of 0 starts all threads simultaneously. Higher values create gradual ramp-up. Example: With 10 threads and 100ms delay, the 10th thread starts 900ms after the first -
loopNum(int) — the number of times each thread executes the command, must be greater than 0. Each execution is measured and contributes to the statistical analysis -
loopDelay(long) — the delay in milliseconds to wait between each loop iteration within a thread, must be >= 0. A value of 0 means continuous execution. Use positive values to throttle execution rate. This delay is NOT included in the measured execution time of each iteration -
roundNum(int) — the number of times to repeat the entire test (all threads and loops), must be greater than 0. Each round runs sequentially, with results from intermediate rounds printed to console. Multiple rounds help achieve statistically stable measurements -
label(String) — a descriptive identifier for this test that appears in all result outputs. Use meaningful names to distinguish between different test scenarios. Can be {@code null} , defaulting to a generic identifier -
command(Throwables.Runnable<? extends Exception>) — the code block to be profiled and executed in each loop iteration. Execution time is measured individually for each invocation, excluding delay periods. The command can throw checked exceptions which will be caught and logged
-
- Returns: a {@link MultiLoopsStatistics} object containing comprehensive performance metrics including minimum, maximum, average, percentile execution times, and failure information. The statistics represent the final round of testing
- See also: #run(int, int, int, Throwables.Runnable),for basic testing without delays, #run(int, int, int, String, Throwables.Runnable),for testing with labels but no delays
suspend(...) -> void
-
Signature:
public static void suspend(final boolean yesOrNo) - Summary: Controls the suspension state of the profiler, enabling or disabling full-scale performance testing.
-
Contract:
- When suspended, all profiler operations run in minimal mode (single thread, single loop, single round) regardless of the parameters specified in test method calls.
- This feature is invaluable during development and debugging when you want to verify test logic without incurring the time and resource overhead of comprehensive performance testing.
- <p> <b> Suspension Behavior: </b> When the profiler is suspended ( {@code suspend(true)} ): <ul> <li> All tests execute with exactly 1 thread, 1 loop, and 1 round </li> <li> Thread delays and loop delays are completely bypassed </li> <li> Garbage collection between rounds is skipped </li> <li> Test execution completes almost immediately </li> <li> Statistical analysis still occurs but with minimal data </li> </ul> <p> <b> Primary Use Cases: </b> <ul> <li> <b> Development Debugging: </b> Quickly verify that profiled code executes without errors </li> <li> <b> Integration Testing: </b> Test profiler integration without long-running performance tests </li> <li> <b> CI/CD Pipelines: </b> Run smoke tests with profiler calls without performance overhead </li> <li> <b> Rapid Iteration: </b> Quickly validate code changes before running full benchmarks </li> <li> <b> Exception Testing: </b> Verify error handling in profiled code without waiting </li> </ul> <p> <b> Important Considerations: </b> <ul> <li> Suspension is a global state affecting all profiler operations across all threads </li> <li> Statistics from suspended runs are NOT representative of actual performance </li> <li> Always resume the profiler before running actual performance tests </li> <li> Suspension state is not persisted; it resets when the JVM restarts </li> <li> This is a volatile variable, so changes are immediately visible across threads </li> </ul> <p> <b> Best Practices: </b> <ul> <li> Use try-finally blocks to ensure profiler is resumed after debugging sessions </li> <li> Never leave profiler suspended in production environments </li> <li> Document suspension state changes in test code comments </li> <li> Consider using environment variables or system properties to control suspension </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic suspension for debugging Profiler.suspend(true); try { // This runs with just 1 thread, 1 loop regardless of parameters Profiler.run(100, 1000, 10, () -> { complexMethod(); // Just verify it doesn't crash }); } finally { Profiler.suspend(false); // Always resume } // Conditional suspension based on environment boolean isDebugMode = System.getProperty("debug.mode", "false").equals("true"); Profiler.suspend(isDebugMode); // Quick smoke test of multiple profiler calls Profiler.suspend(true); testSuite.runAllProfilerTests(); // Fast execution Profiler.suspend(false); // Integration test scenario if (!"production".equals(environment)) { Profiler.suspend(true); // Skip heavy testing in non-prod } performanceTestSuite.run(); } </pre>
-
Parameters:
-
yesOrNo(boolean) — {@code true} to suspend the profiler (minimal execution mode), {@code false} to resume normal profiler operation with full performance testing capabilities. The suspension state affects all subsequent profiler operations until changed again
-
- See also: #isSuspended(),to check the current suspension state
isSuspended(...) -> boolean
-
Signature:
public static boolean isSuspended() - Summary: Checks if the profiler is currently suspended.
-
Contract:
- Checks if the profiler is currently suspended.
- When suspended, all profiler runs execute with only one thread and one loop, regardless of the specified parameters.
-
Parameters:
- (none)
- Returns: {@code true} if the profiler is suspended, {@code false} otherwise
Public Instance Methods
- (none)
Interface LoopStatistics (com.landawn.abacus.util.Profiler.LoopStatistics)
Interface for loop-level statistics, providing aggregate information about multiple method executions within loops.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getMethodNameList(...) -> List<String>
-
Signature:
List<String> getMethodNameList() - Summary: Gets the list of unique method names that were executed.
-
Parameters:
- (none)
- Returns: a list of method names
getMinElapsedTimeMethod(...) -> MethodStatistics
-
Signature:
MethodStatistics getMinElapsedTimeMethod() - Summary: Gets the method execution with the minimum elapsed time.
-
Parameters:
- (none)
- Returns: the MethodStatistics with minimum elapsed time
getMaxElapsedTimeMethod(...) -> MethodStatistics
-
Signature:
MethodStatistics getMaxElapsedTimeMethod() - Summary: Gets the method execution with the maximum elapsed time.
-
Parameters:
- (none)
- Returns: the MethodStatistics with maximum elapsed time
getMethodTotalElapsedTimeInMillis(...) -> double
-
Signature:
double getMethodTotalElapsedTimeInMillis(String methodName) - Summary: Gets the total elapsed time for all executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the total elapsed time in milliseconds
getMethodMaxElapsedTimeInMillis(...) -> double
-
Signature:
double getMethodMaxElapsedTimeInMillis(String methodName) - Summary: Gets the maximum elapsed time among all executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the maximum elapsed time in milliseconds
getMethodMinElapsedTimeInMillis(...) -> double
-
Signature:
double getMethodMinElapsedTimeInMillis(String methodName) - Summary: Gets the minimum elapsed time among all executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the minimum elapsed time in milliseconds
getMethodAverageElapsedTimeInMillis(...) -> double
-
Signature:
double getMethodAverageElapsedTimeInMillis(String methodName) - Summary: Gets the average elapsed time for all executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the average elapsed time in milliseconds
getTotalElapsedTimeInMillis(...) -> double
-
Signature:
double getTotalElapsedTimeInMillis() - Summary: Gets the total elapsed time for all method executions.
-
Parameters:
- (none)
- Returns: the total elapsed time in milliseconds
getMethodSize(...) -> int
-
Signature:
int getMethodSize(String methodName) - Summary: Gets the number of times the specified method was executed.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the execution count
getMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
List<MethodStatistics> getMethodStatisticsList(String methodName) - Summary: Gets all statistics for executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: a list of MethodStatistics
getFailedMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
List<MethodStatistics> getFailedMethodStatisticsList(String methodName) - Summary: Gets statistics for failed executions of the specified method.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: a list of MethodStatistics for failed executions
getAllFailedMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
List<MethodStatistics> getAllFailedMethodStatisticsList() - Summary: Gets all failed method executions across all methods.
-
Parameters:
- (none)
- Returns: a list of all failed MethodStatistics
Class MethodStatistics (com.landawn.abacus.util.Profiler.MethodStatistics)
Statistics for individual method executions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public MethodStatistics(final String methodName) - Summary: Creates a new MethodStatistics instance with the specified method name.
-
Parameters:
-
methodName(String) — the name of the method
-
-
Signature:
public MethodStatistics(final String methodName, final long startTimeInMillis, final long endTimeInMillis, final long startTimeInNano, final long endTimeInNano) - Summary: Creates a new MethodStatistics instance with timing information.
-
Parameters:
-
methodName(String) — the name of the method -
startTimeInMillis(long) — the start time in milliseconds -
endTimeInMillis(long) — the end time in milliseconds -
startTimeInNano(long) — the start time in nanoseconds -
endTimeInNano(long) — the end time in nanoseconds
-
-
Signature:
public MethodStatistics(final String methodName, final long startTimeInMillis, final long endTimeInMillis, final long startTimeInNano, final long endTimeInNano, final Object result) - Summary: Creates a new MethodStatistics instance with complete information.
-
Parameters:
-
methodName(String) — the name of the method -
startTimeInMillis(long) — the start time in milliseconds -
endTimeInMillis(long) — the end time in milliseconds -
startTimeInNano(long) — the start time in nanoseconds -
endTimeInNano(long) — the end time in nanoseconds -
result(Object) — the execution result (null for success, Exception for failure)
-
getMethodName(...) -> String
-
Signature:
public String getMethodName() - Summary: Gets the name of the method that was executed.
-
Parameters:
- (none)
- Returns: the method name
getResult(...) -> Object
-
Signature:
@Override public Object getResult() -
Parameters:
- (none)
- Returns: unspecified
setResult(...) -> void
-
Signature:
@Override public void setResult(final Object result) -
Parameters:
-
result(Object)
-
isFailed(...) -> boolean
-
Signature:
public boolean isFailed() - Summary: Checks if the method execution failed.
-
Contract:
- Checks if the method execution failed.
- A method is considered failed if the result is an Exception.
-
Parameters:
- (none)
- Returns: {@code true} if the execution failed, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this method statistics.
-
Parameters:
- (none)
- Returns: a string representation of the statistics
Class MultiLoopsStatistics (com.landawn.abacus.util.Profiler.MultiLoopsStatistics)
Comprehensive statistics for multiple loops across multiple threads.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public MultiLoopsStatistics(final long startTimeInMillis, final long endTimeInMillis, final long startTimeInNano, final long endTimeInNano, final int threadNum) - Summary: Creates a new MultiLoopsStatistics instance with timing information.
-
Parameters:
-
startTimeInMillis(long) — the overall start time in milliseconds -
endTimeInMillis(long) — the overall end time in milliseconds -
startTimeInNano(long) — the overall start time in nanoseconds -
endTimeInNano(long) — the overall end time in nanoseconds -
threadNum(int) — the number of threads used in the test
-
-
Signature:
public MultiLoopsStatistics(final long startTimeInMillis, final long endTimeInMillis, final long startTimeInNano, final long endTimeInNano, final int threadNum, final List<LoopStatistics> loopStatisticsList) - Summary: Creates a new MultiLoopsStatistics instance with complete information.
-
Parameters:
-
startTimeInMillis(long) — the overall start time in milliseconds -
endTimeInMillis(long) — the overall end time in milliseconds -
startTimeInNano(long) — the overall start time in nanoseconds -
endTimeInNano(long) — the overall end time in nanoseconds -
threadNum(int) — the number of threads used in the test -
loopStatisticsList(List<LoopStatistics>) — the list of loop statistics from all threads
-
getThreadNum(...) -> int
-
Signature:
public int getThreadNum() - Summary: Gets the number of threads used in the performance test.
-
Parameters:
- (none)
- Returns: the thread count
getMethodNameList(...) -> List<String>
-
Signature:
@Override public List<String> getMethodNameList() -
Parameters:
- (none)
- Returns: unspecified
getLoopStatisticsList(...) -> List<LoopStatistics>
-
Signature:
public List<LoopStatistics> getLoopStatisticsList() - Summary: Gets the loop statistics list.
-
Parameters:
- (none)
- Returns: the list of loop statistics from all threads
setLoopStatisticsList(...) -> void
-
Signature:
public void setLoopStatisticsList(final List<LoopStatistics> loopStatisticsList) - Summary: Sets the loop statistics list.
-
Parameters:
-
loopStatisticsList(List<LoopStatistics>) — the new loop statistics list
-
addMethodStatisticsList(...) -> void
-
Signature:
public void addMethodStatisticsList(final LoopStatistics loopStatistics) - Summary: Adds the loop statistics to the list of all loop statistics.
-
Parameters:
-
loopStatistics(LoopStatistics) — the loop statistics to add
-
getMaxElapsedTimeMethod(...) -> MethodStatistics
-
Signature:
@Override public MethodStatistics getMaxElapsedTimeMethod() -
Parameters:
- (none)
- Returns: unspecified
getMinElapsedTimeMethod(...) -> MethodStatistics
-
Signature:
@Override public MethodStatistics getMinElapsedTimeMethod() -
Parameters:
- (none)
- Returns: unspecified
getMethodTotalElapsedTimeInMillis(...) -> double
-
Signature:
@Override public double getMethodTotalElapsedTimeInMillis(final String methodName) - Summary: Gets the method total elapsed time in millis.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the total elapsed time in milliseconds
getMethodMaxElapsedTimeInMillis(...) -> double
-
Signature:
@Override public double getMethodMaxElapsedTimeInMillis(final String methodName) - Summary: Gets the method max elapsed time in millis.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the maximum elapsed time in milliseconds
getMethodMinElapsedTimeInMillis(...) -> double
-
Signature:
@Override public double getMethodMinElapsedTimeInMillis(final String methodName) - Summary: Gets the method min elapsed time in millis.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the minimum elapsed time in milliseconds
getMethodAverageElapsedTimeInMillis(...) -> double
-
Signature:
@Override public double getMethodAverageElapsedTimeInMillis(final String methodName) - Summary: Gets the method average elapsed time in millis.
-
Parameters:
-
methodName(String) — the name of the method
-
- Returns: the average elapsed time in milliseconds
getTotalElapsedTimeInMillis(...) -> double
-
Signature:
@Override public double getTotalElapsedTimeInMillis() -
Parameters:
- (none)
- Returns: unspecified
getMethodSize(...) -> int
-
Signature:
@Override public int getMethodSize(final String methodName) -
Parameters:
-
methodName(String)
-
- Returns: unspecified
getMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
@Override public List<MethodStatistics> getMethodStatisticsList(final String methodName) -
Parameters:
-
methodName(String)
-
- Returns: unspecified
getFailedMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
@Override public List<MethodStatistics> getFailedMethodStatisticsList(final String methodName) -
Parameters:
-
methodName(String)
-
- Returns: unspecified
getAllFailedMethodStatisticsList(...) -> List<MethodStatistics>
-
Signature:
@Override public List<MethodStatistics> getAllFailedMethodStatisticsList() -
Parameters:
- (none)
- Returns: unspecified
printResult(...) -> void
-
Signature:
public void printResult() - Summary: Prints comprehensive performance test results to the standard output console (System.out).
-
Parameters:
- (none)
- See also: #writeResult(OutputStream),to write results to a file or custom output stream, #writeResult(Writer),to write results using a Writer, #writeHtmlResult(Writer),for HTML-formatted output suitable for web reports, #writeXmlResult(Writer),for machine-readable XML output
writeResult(...) -> void
-
Signature:
public void writeResult(final OutputStream output) - Summary: Writes comprehensive performance test results to the specified OutputStream in human-readable text format.
-
Parameters:
-
output(OutputStream) — the OutputStream to which performance results will be written. Must not be {@code null} . The stream will be flushed but NOT closed by this method
-
- See also: #writeResult(Writer),for character-stream based output, #printResult(),for console output
-
Signature:
public void writeResult(final Writer output) - Summary: Writes comprehensive performance test results to the specified Writer in human-readable text format.
-
Contract:
- The caller is responsible for closing the Writer when appropriate, typically using try-with-resources.
-
Parameters:
-
output(Writer) — the Writer to which performance results will be written. Must not be {@code null} . The Writer will be flushed but NOT closed by this method. All timing data, statistics, and error information will be written in formatted text
-
- See also: #printResult(),for writing to standard output console, #writeResult(OutputStream),for byte-stream based output, #writeHtmlResult(Writer),for HTML-formatted output, #writeXmlResult(Writer),for structured XML output
writeHtmlResult(...) -> void
-
Signature:
public void writeHtmlResult(final OutputStream output) - Summary: Writes performance test results to the specified OutputStream in HTML format with structured tables and formatted markup.
-
Parameters:
-
output(OutputStream) — the OutputStream to which HTML-formatted results will be written. Must not be {@code null} . The stream will be flushed but NOT closed by this method
-
- See also: #writeHtmlResult(Writer),for character-stream based HTML output, #writeResult(OutputStream),for plain text output
-
Signature:
public void writeHtmlResult(final Writer output) - Summary: Writes performance test results to the specified Writer in HTML format with structured tables and formatted markup.
-
Contract:
- <p> <b> Generated HTML Structure: </b> <ul> <li> <b> Summary Header: </b> Test configuration, timing, and metadata in formatted lines </li> <li> <b> Statistics Table: </b> HTML table with headers and data rows for each profiled method </li> <li> <b> Table Columns: </b> Method name, avg/min/max times, and all percentile thresholds </li> <li> <b> Error Section: </b> HTML-formatted error details if any method executions failed </li> <li> <b> HTML Entities: </b> Proper encoding of special characters (e.g., > for >) </li> </ul> <p> <b> Common Use Cases: </b> <ul> <li> <b> Web Reports: </b> Embed results in HTML reports for web browsers </li> <li> <b> Email Notifications: </b> Send HTML-formatted performance reports via email </li> <li> <b> Dashboard Integration: </b> Display results in monitoring dashboards </li> <li> <b> Documentation: </b> Include results in technical documentation and wikis </li> <li> <b> Stakeholder Reports: </b> Create executive-friendly performance summaries </li> <li> <b> CI/CD Artifacts: </b> Generate HTML build artifacts for Jenkins, GitLab, etc.
-
Parameters:
-
output(Writer) — the Writer to which HTML-formatted performance results will be written. Must not be {@code null} . The Writer will be flushed but NOT closed by this method. All statistics are rendered as HTML tables and formatted text
-
- See also: #writeHtmlResult(OutputStream),for byte-stream based HTML output, #writeResult(Writer),for plain text formatted output, #writeXmlResult(Writer),for machine-readable XML output, #printResult(),for console output
writeXmlResult(...) -> void
-
Signature:
public void writeXmlResult(final OutputStream output) - Summary: Writes performance test results to the specified OutputStream in structured XML format, providing machine-readable output suitable for automated processing and data integration.
-
Parameters:
-
output(OutputStream) — the OutputStream to which XML-formatted results will be written. Must not be {@code null} . The stream will be flushed but NOT closed by this method
-
- See also: #writeXmlResult(Writer),for character-stream based XML output, #writeResult(OutputStream),for plain text output
-
Signature:
public void writeXmlResult(final Writer output) - Summary: Writes performance test results to the specified Writer in structured XML format, providing machine-readable output suitable for automated processing, data integration, and programmatic analysis.
-
Parameters:
-
output(Writer) — the Writer to which XML-formatted performance results will be written. Must not be {@code null} . The Writer will be flushed but NOT closed by this method. All statistics are rendered as well-formed XML elements
-
- See also: #writeXmlResult(OutputStream),for byte-stream based XML output, #writeResult(Writer),for plain text formatted output, #writeHtmlResult(Writer),for HTML-formatted output, #printResult(),for console output
Class Properties (com.landawn.abacus.util.Properties)
A generic Properties class that implements the Map interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> Properties<K, V>
-
Signature:
public static <K, V> Properties<K, V> create(final Map<? extends K, ? extends V> map) - Summary: Creates a new Properties instance from the specified map.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map from which to create the Properties instance
-
- Returns: a new Properties instance containing the entries from the specified map
Public Instance Methods
<init>(...) -> void
-
Signature:
public Properties() - Summary: Constructs an empty Properties instance with a LinkedHashMap as the underlying map.
-
Parameters:
- (none)
- See also: #create(Map)
get(...) -> V
-
Signature:
@Override public V get(final Object propName) - Summary: Retrieves the value associated with the specified property name.
-
Parameters:
-
propName(Object) — the name of the property whose associated value is to be returned
-
- Returns: the value associated with the specified property name, or {@code null} if the property is not found
- See also: #get(Object, Class), #getOrDefault(Object, Object), #getOrDefault(Object, Object, Class)
-
Signature:
public <T> T get(final Object propName, final Class<? extends T> targetType) - Summary: Retrieves the value associated with the specified property name and converts it to the specified target type.
-
Contract:
- This method helps avoid {@code NullPointerException} for primitive types if the target property is {@code null} or not set.
-
Parameters:
-
propName(Object) — the name of the property whose associated value is to be returned -
targetType(Class<? extends T>) — the class of the type to which the value should be converted
-
- Returns: the value associated with the specified property name, converted to the specified target type, or default value of {@code targetType} if the property is not found or its value is {@code null}
- See also: #get(Object), #getOrDefault(Object, Object), #getOrDefault(Object, Object, Class)
getOrDefault(...) -> V
-
Signature:
@Override public V getOrDefault(final Object propName, final V defaultValue) - Summary: Retrieves the value associated with the specified property name or returns the default value if the property is not found.
-
Contract:
- Retrieves the value associated with the specified property name or returns the default value if the property is not found.
-
Parameters:
-
propName(Object) — the name of the property whose associated value is to be returned -
defaultValue(V) — the value to be returned if the specified property name is not found or its value is {@code null}
-
- Returns: the value associated with the specified property name, or {@code defaultValue} if the property is not found or its value is {@code null}
- See also: #get(Object), #get(Object, Class), #getOrDefault(Object, Object, Class)
-
Signature:
public <T> T getOrDefault(final Object propName, final T defaultValue, final Class<? extends T> targetType) - Summary: Retrieves the value associated with the specified property name or returns the default value if the property is not found.
-
Contract:
- Retrieves the value associated with the specified property name or returns the default value if the property is not found.
-
Parameters:
-
propName(Object) — the name of the property whose associated value is to be returned -
defaultValue(T) — the value to be returned if the specified property name is not found or its value is {@code null} -
targetType(Class<? extends T>) — the class of the type to which the value should be converted
-
- Returns: the value associated with the specified property name, converted to the specified target type, or {@code defaultValue} if the property is not found or its value is {@code null}
- See also: #get(Object), #get(Object, Class), #getOrDefault(Object, Object)
set(...) -> Properties<K, V>
-
Signature:
public Properties<K, V> set(final K propName, final V propValue) - Summary: Sets the specified property name to the specified property value.
-
Parameters:
-
propName(K) — the name of the property to be set -
propValue(V) — the value to be set for the specified property name
-
- Returns: the current Properties instance with the updated property
- See also: #put(Object, Object)
put(...) -> V
-
Signature:
@Override public V put(final K propName, final V propValue) - Summary: Associates the specified value with the specified key in this map.
-
Contract:
- If the map previously contained a mapping for the key, the old value is replaced.
-
Parameters:
-
propName(K) — the key with which the specified value is to be associated -
propValue(V) — the value to be associated with the specified key
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key
- See also: #set(Object, Object)
putAll(...) -> void
-
Signature:
@Override public void putAll(final Map<? extends K, ? extends V> m) - Summary: Copies all the mappings from the specified map to this map.
-
Parameters:
-
m(Map<? extends K, ? extends V>) — the mappings to be stored in this map
-
putIfAbsent(...) -> V
-
Signature:
@Override public V putIfAbsent(final K propName, final V propValue) - Summary: Associates the specified value with the specified key in this map if the key is not already associated with a value.
-
Contract:
- Associates the specified value with the specified key in this map if the key is not already associated with a value.
-
Parameters:
-
propName(K) — the key with which the specified value is to be associated -
propValue(V) — the value to be associated with the specified key
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key
remove(...) -> V
-
Signature:
@Override public V remove(final Object propName) - Summary: Removes the mapping for the specified key from this map if present.
-
Contract:
- Removes the mapping for the specified key from this map if present.
-
Parameters:
-
propName(Object) — key whose mapping is to be removed from the map
-
- Returns: the previous value associated with key, or {@code null} if there was no mapping for key
-
Signature:
@Override public boolean remove(final Object propName, final Object propValue) - Summary: Removes the entry for the specified key only if it is currently mapped to the specified value.
-
Contract:
- Removes the entry for the specified key only if it is currently mapped to the specified value.
-
Parameters:
-
propName(Object) — key with which the specified value is associated -
propValue(Object) — value expected to be associated with the specified key
-
- Returns: {@code true} if the value was removed
replace(...) -> V
-
Signature:
@Override public V replace(final K propName, final V propValue) - Summary: Replaces the entry for the specified key only if it is currently mapped to some value.
-
Contract:
- Replaces the entry for the specified key only if it is currently mapped to some value.
-
Parameters:
-
propName(K) — key with which the specified value is associated -
propValue(V) — value to be associated with the specified key
-
- Returns: the previous value associated with the specified key, or {@code null} if there was no mapping for the key
-
Signature:
@Override public boolean replace(final K propName, final V oldPropValue, final V newPropValue) - Summary: Replaces the entry for the specified key only if currently mapped to the specified value.
-
Contract:
- Replaces the entry for the specified key only if currently mapped to the specified value.
-
Parameters:
-
propName(K) — key with which the specified value is associated -
oldPropValue(V) — value expected to be associated with the specified key -
newPropValue(V) — value to be associated with the specified key
-
- Returns: {@code true} if the value was replaced
containsKey(...) -> boolean
-
Signature:
@Override public boolean containsKey(final Object key) - Summary: Returns {@code true} if this map contains a mapping for the specified key.
-
Contract:
- Returns {@code true} if this map contains a mapping for the specified key.
-
Parameters:
-
key(Object) — key whose presence in this map is to be tested
-
- Returns: {@code true} if this map contains a mapping for the specified key
containsValue(...) -> boolean
-
Signature:
@Override public boolean containsValue(final Object value) - Summary: Returns {@code true} if this map maps one or more keys to the specified value.
-
Contract:
- Returns {@code true} if this map maps one or more keys to the specified value.
-
Parameters:
-
value(Object) — value whose presence in this map is to be tested
-
- Returns: {@code true} if this map maps one or more keys to the specified value
keySet(...) -> Set<K>
-
Signature:
@Override public Set<K> keySet() - Summary: Returns a Set view of the keys contained in this map.
-
Parameters:
- (none)
- Returns: a set view of the keys contained in this map
values(...) -> Collection<V>
-
Signature:
@Override public Collection<V> values() - Summary: Returns a Collection view of the values contained in this map.
-
Parameters:
- (none)
- Returns: a collection view of the values contained in this map
entrySet(...) -> Set<Map.Entry<K, V>>
-
Signature:
@Override public Set<Map.Entry<K, V>> entrySet() - Summary: Returns a Set view of the mappings contained in this map.
-
Parameters:
- (none)
- Returns: a set view of the mappings contained in this map
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this map contains no key-value mappings.
-
Contract:
- Returns {@code true} if this map contains no key-value mappings.
-
Parameters:
- (none)
- Returns: {@code true} if this map contains no key-value mappings
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of key-value mappings in this map.
-
Parameters:
- (none)
- Returns: the number of key-value mappings in this map
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all of the mappings from this map.
-
Parameters:
- (none)
copy(...) -> Properties<K, V>
-
Signature:
public Properties<K, V> copy() - Summary: Creates a shallow copy of this Properties instance.
-
Parameters:
- (none)
- Returns: a shallow copy of this Properties instance
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Properties object.
-
Parameters:
- (none)
- Returns: a hash code value for this Properties object
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares the specified object with this Properties for equality.
-
Contract:
- Returns {@code true} if the given object is also a Properties instance and the two Properties represent the same mappings.
-
Parameters:
-
obj(Object) — object to be compared for equality with this Properties
-
- Returns: {@code true} if the specified object is equal to this Properties
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Properties object.
-
Parameters:
- (none)
- Returns: a string representation of this Properties object
Class PropertiesUtil (com.landawn.abacus.util.PropertiesUtil)
Utility class for working with properties files and XML configuration files.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
getCommonConfigPaths(...) -> List<String>
-
Signature:
public static List<String> getCommonConfigPaths() - Summary: Gets a list of common configuration paths where configuration files are typically located.
-
Parameters:
- (none)
- Returns: a list of absolute paths to existing configuration directories
formatPath(...) -> File
-
Signature:
public static File formatPath(File file) - Summary: Formats a file path by replacing URL-encoded spaces (%20) with actual spaces.
-
Contract:
- If the original file doesn't exist but a file with decoded spaces does exist, returns the decoded file.
-
Parameters:
-
file(File) — the file whose path should be formatted
-
- Returns: a File object with properly formatted path
findDir(...) -> File
-
Signature:
@MayReturnNull public static File findDir(final String configDir) - Summary: Finds the directory with the specified configuration directory name.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File configDir = PropertiesUtil.findDir("config"); if (configDir != null && configDir.isDirectory()) { // Directory found } } </pre>
-
Parameters:
-
configDir(String) — the name of the configuration directory to find
-
- Returns: the File object representing the found directory, or {@code null} if not found
findFile(...) -> File
-
Signature:
@MayReturnNull public static File findFile(final String configFileName) - Summary: Finds the file with the specified configuration file name.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code File configFile = PropertiesUtil.findFile("application.properties"); if (configFile != null && configFile.exists()) { // File found } } </pre>
-
Parameters:
-
configFileName(String) — the name of the configuration file to find
-
- Returns: the File object representing the found file, or {@code null} if not found
findFileRelativeTo(...) -> File
-
Signature:
@MayReturnNull public static File findFileRelativeTo(final File srcFile, final String targetFileName) - Summary: Finds a file by searching from the directory of a source file.
-
Contract:
- The search starts in the parent directory of the source file, then falls back to common configuration paths if not found.
-
Parameters:
-
srcFile(File) — the source file whose directory will be used as the starting point -
targetFileName(String) — the name of the file to find
-
- Returns: the found file, or {@code null} if not found
findFileInDir(...) -> File
-
Signature:
@MayReturnNull public static File findFileInDir(final String configFileName, final File dir, final boolean isDir) - Summary: Finds a file or directory within a specified directory.
-
Parameters:
-
configFileName(String) — the name of the file or directory to find (can include relative path) -
dir(File) — the directory to search in -
isDir(boolean) — {@code true} if searching for a directory, {@code false} for a file
-
- Returns: the found file or directory, or {@code null} if not found
load(...) -> Properties<String, String>
-
Signature:
public static Properties<String, String> load(final File source) - Summary: Loads properties from the specified file.
-
Parameters:
-
source(File) — the file from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, String> load(final File source, final boolean autoRefresh) - Summary: Loads properties from the specified file with an option for auto-refresh.
-
Contract:
- When auto-refresh is enabled, the properties will be automatically updated when the file is modified.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Properties that auto-update when file changes Properties<String, String> props = PropertiesUtil.load(new File("config.properties"), true); // Properties will be automatically refreshed when the file is modified } </pre>
-
Parameters:
-
source(File) — the file from which to load the properties. -
autoRefresh(boolean) — if {@code true} , the properties will be automatically refreshed when the file is modified. A background thread checks the file last modification time every second.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, String> load(final InputStream source) - Summary: Loads properties from the specified InputStream.
-
Contract:
- The stream should contain properties in the standard Java properties format (key=value pairs, one per line, with support for comments starting with # or !).
-
Parameters:
-
source(InputStream) — the InputStream from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, String> load(final Reader source) - Summary: Loads properties from the specified Reader.
-
Contract:
- The reader should provide properties in the standard Java properties format (key=value pairs, one per line, with support for comments starting with # or !).
-
Parameters:
-
source(Reader) — the Reader from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
loadFromXml(...) -> Properties<String, Object>
-
Signature:
public static Properties<String, Object> loadFromXml(final File source) - Summary: Loads properties from the specified XML file.
-
Contract:
- The XML structure should have property names as element names and property values as element content.
-
Parameters:
-
source(File) — the XML file from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, Object> loadFromXml(final File source, final boolean autoRefresh) - Summary: Loads properties from the specified XML file with an option for auto-refresh.
-
Contract:
- When auto-refresh is enabled, the properties will be automatically updated when the file is modified.
-
Parameters:
-
source(File) — the XML file from which to load the properties. -
autoRefresh(boolean) — if {@code true} , the properties will be automatically refreshed when the file is modified. A background thread checks the file last modification time every second.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, Object> loadFromXml(final InputStream source) - Summary: Loads properties from the specified XML InputStream.
-
Contract:
- The XML structure should have property names as element names and property values as element content.
-
Parameters:
-
source(InputStream) — the InputStream from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static Properties<String, Object> loadFromXml(final Reader source) - Summary: Loads properties from the specified XML Reader.
-
Contract:
- The XML structure should have property names as element names and property values as element content.
-
Parameters:
-
source(Reader) — the Reader from which to load the properties.
-
- Returns: a Properties object containing the loaded properties.
-
Signature:
public static <T extends Properties<String, Object>> T loadFromXml(final File source, final Class<? extends T> targetClass) - Summary: Loads properties from the specified XML file into the target properties class.
-
Parameters:
-
source(File) — the XML file from which to load the properties. -
targetClass(Class<? extends T>) — the class of the target properties.
-
- Returns: an instance of the target properties class containing the loaded properties.
-
Signature:
public static <T extends Properties<String, Object>> T loadFromXml(final File source, final boolean autoRefresh, final Class<? extends T> targetClass) - Summary: Loads properties from the specified XML file into the target properties class with an option for auto-refresh.
-
Contract:
- When auto-refresh is enabled, the properties will be automatically updated when the file is modified.
- <p> <b> Usage Examples: </b> </p> <pre> {@code public class DatabaseConfig extends Properties<String, Object> { // Custom config class } DatabaseConfig config = PropertiesUtil.loadFromXml( new File("db-config.xml"), true, DatabaseConfig.class); // Config auto-refreshes when file changes } </pre>
-
Parameters:
-
source(File) — the XML file from which to load the properties. -
autoRefresh(boolean) — if {@code true} , the properties will be automatically refreshed when the file is modified. A background thread checks the file last modification time every second. -
targetClass(Class<? extends T>) — the class of the target properties.
-
- Returns: an instance of the target properties class containing the loaded properties.
-
Signature:
public static <T extends Properties<String, Object>> T loadFromXml(final InputStream source, final Class<? extends T> targetClass) - Summary: Loads properties from the specified XML InputStream into the target properties class.
-
Parameters:
-
source(InputStream) — the InputStream from which to load the properties. -
targetClass(Class<? extends T>) — the class of the target properties.
-
- Returns: an instance of the target properties class containing the loaded properties.
-
Signature:
public static <T extends Properties<String, Object>> T loadFromXml(final Reader source, final Class<? extends T> targetClass) - Summary: Loads properties from the specified XML Reader into the target properties class.
-
Parameters:
-
source(Reader) — the Reader from which to load the properties. -
targetClass(Class<? extends T>) — the class of the target properties.
-
- Returns: an instance of the target properties class containing the loaded properties.
store(...) -> void
-
Signature:
public static void store(final Properties<?, ?> properties, final String comments, final File output) - Summary: Stores the specified properties to the given file with optional comments.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
comments(String) — the comments to include in the stored file. -
output(File) — the file to which the properties will be stored.
-
-
Signature:
public static void store(final Properties<?, ?> properties, final String comments, final OutputStream output) - Summary: Stores the specified properties to the given OutputStream with optional comments.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
comments(String) — the comments to include in the stored output. -
output(OutputStream) — the OutputStream to which the properties will be stored.
-
-
Signature:
public static void store(final Properties<?, ?> properties, final String comments, final Writer output) - Summary: Stores the specified properties to the given Writer with optional comments.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
comments(String) — the comments to include in the stored output. -
output(Writer) — the Writer to which the properties will be stored.
-
storeToXml(...) -> void
-
Signature:
public static void storeToXml(final Properties<?, ?> properties, final String rootElementName, final boolean writeTypeInfo, final File output) - Summary: Stores the specified properties to the given XML file.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
rootElementName(String) — the name of the root element in the XML. -
writeTypeInfo(boolean) — if {@code true} , type information will be written as attributes in the XML. For example: {@code <port type="int">8080</port>} or {@code <enabled type="boolean">true</enabled>} . When {@code false} , all values are written as plain text without type attributes. -
output(File) — the file to which the properties will be stored.
-
-
Signature:
public static void storeToXml(final Properties<?, ?> properties, final String rootElementName, final boolean writeTypeInfo, final OutputStream output) throws UncheckedIOException - Summary: Stores the specified properties to the given XML OutputStream.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
rootElementName(String) — the name of the root element in the XML. -
writeTypeInfo(boolean) — if {@code true} , type information will be written as attributes in the XML. For example: {@code <port type="int">8080</port>} or {@code <enabled type="boolean">true</enabled>} . When {@code false} , all values are written as plain text without type attributes. -
output(OutputStream) — the OutputStream to which the properties will be stored.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the stream
-
-
Signature:
public static void storeToXml(final Properties<?, ?> properties, final String rootElementName, final boolean writeTypeInfo, final Writer output) throws UncheckedIOException - Summary: Stores the specified properties to the given XML Writer.
-
Parameters:
-
properties(Properties<?, ?>) — the properties to store. -
rootElementName(String) — the name of the root element in the XML. -
writeTypeInfo(boolean) — if {@code true} , type information will be written as attributes in the XML. For example: {@code <port type="int">8080</port>} or {@code <enabled type="boolean">true</enabled>} . When {@code false} , all values are written as plain text without type attributes. -
output(Writer) — the Writer to which the properties will be stored.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing to the writer
-
xmlToJava(...) -> void
-
Signature:
public static void xmlToJava(final String xml, final String srcPath, final String packageName, final String className, final boolean isPublicField) - Summary: Generate Java code from the specified XML string.
-
Parameters:
-
xml(String) — the XML content as a string. -
srcPath(String) — the source path where the generated Java code will be saved (e.g., "src/main/java"). -
packageName(String) — the package name for the generated Java classes. -
className(String) — the name of the generated Java class. -
isPublicField(boolean) — if {@code true} , the fields in the generated Java class will be public; otherwise private.
-
-
Signature:
public static void xmlToJava(final File xml, final String srcPath, final String packageName, final String className, final boolean isPublicField) - Summary: Generate Java code from the specified XML file.
-
Parameters:
-
xml(File) — the XML file from which to generate Java code. -
srcPath(String) — the source path where the generated Java code will be saved (e.g., "src/main/java"). -
packageName(String) — the package name for the generated Java classes. -
className(String) — the name of the generated Java class. -
isPublicField(boolean) — if {@code true} , the fields in the generated Java class will be public; otherwise private.
-
-
Signature:
public static void xmlToJava(final InputStream xml, final String srcPath, final String packageName, final String className, final boolean isPublicField) - Summary: Generates Java code from the specified XML InputStream.
-
Parameters:
-
xml(InputStream) — the InputStream from which to generate Java code. -
srcPath(String) — the source path where the generated Java code will be saved (e.g., "src/main/java"). -
packageName(String) — the package name for the generated Java classes. -
className(String) — the name of the generated Java class. -
isPublicField(boolean) — if {@code true} , the fields in the generated Java class will be public; otherwise private.
-
-
Signature:
@SuppressFBWarnings("REC_CATCH_EXCEPTION") public static void xmlToJava(final Reader xml, final String srcPath, final String packageName, String className, final boolean isPublicField) - Summary: Generates Java code from the specified XML Reader.
-
Parameters:
-
xml(Reader) — the Reader from which to generate Java code. -
srcPath(String) — the source path where the generated Java code will be saved (e.g., "src/main/java"). -
packageName(String) — the package name for the generated Java classes. -
className(String) — the name of the generated Java class. If {@code null} , uses the root element name from XML. -
isPublicField(boolean) — if {@code true} , the fields in the generated Java class will be public; otherwise private.
-
Public Instance Methods
- (none)
Class Range (com.landawn.abacus.util.Range)
An immutable mathematical range representing a continuous interval between two comparable values, supporting both open and closed boundaries.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
just(...) -> Range<T>
-
Signature:
public static <T extends Comparable<? super T>> Range<T> just(final T element) throws IllegalArgumentException - Summary: Creates a range containing only a single element.
-
Parameters:
-
element(T) — the single value to use for both endpoints of this range, must not be null.
-
- Returns: a new Range containing only the specified element.
-
Throws:
-
java.lang.IllegalArgumentException— if the element is null.
-
open(...) -> Range<T>
-
Signature:
public static <T extends Comparable<? super T>> Range<T> open(final T min, final T max) throws IllegalArgumentException - Summary: Creates an open range where both endpoints are exclusive.
-
Parameters:
-
min(T) — the lower bound (exclusive) of the range, must not be null. -
max(T) — the upper bound (exclusive) of the range, must not be null.
-
- Returns: a new open Range from min (exclusive) to max (exclusive).
-
Throws:
-
java.lang.IllegalArgumentException— if min or max is {@code null} , or if min > max.
-
openClosed(...) -> Range<T>
-
Signature:
public static <T extends Comparable<? super T>> Range<T> openClosed(final T min, final T max) throws IllegalArgumentException - Summary: Creates a half-open range where the lower endpoint is exclusive and the upper endpoint is inclusive.
-
Parameters:
-
min(T) — the lower bound (exclusive) of the range, must not be null. -
max(T) — the upper bound (inclusive) of the range, must not be null.
-
- Returns: a new Range from min (exclusive) to max (inclusive).
-
Throws:
-
java.lang.IllegalArgumentException— if min or max is {@code null} , or if min > max.
-
closedOpen(...) -> Range<T>
-
Signature:
public static <T extends Comparable<? super T>> Range<T> closedOpen(final T min, final T max) throws IllegalArgumentException - Summary: Creates a half-open range where the lower endpoint is inclusive and the upper endpoint is exclusive.
-
Parameters:
-
min(T) — the lower bound (inclusive) of the range, must not be null. -
max(T) — the upper bound (exclusive) of the range, must not be null.
-
- Returns: a new Range from min (inclusive) to max (exclusive).
-
Throws:
-
java.lang.IllegalArgumentException— if min or max is {@code null} , or if min > max.
-
closed(...) -> Range<T>
-
Signature:
public static <T extends Comparable<? super T>> Range<T> closed(final T min, final T max) throws IllegalArgumentException - Summary: Creates a closed range where both endpoints are inclusive.
-
Parameters:
-
min(T) — the lower bound (inclusive) of the range, must not be null. -
max(T) — the upper bound (inclusive) of the range, must not be null.
-
- Returns: a new closed Range from min (inclusive) to max (inclusive).
-
Throws:
-
java.lang.IllegalArgumentException— if min or max is {@code null} , or if min > max.
-
Public Instance Methods
map(...) -> Range<U>
-
Signature:
public <U extends Comparable<? super U>> Range<U> map(final Function<? super T, ? extends U> mapper) - Summary: Transforms this range by applying the given mapping function to both endpoints.
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — the function to apply to both endpoints, must not be {@code null} and must not return {@code null} values.
-
- Returns: a new Range with transformed endpoints maintaining the same bound types.
boundType(...) -> BoundType
-
Signature:
public BoundType boundType() - Summary: Returns the bound type of this range, indicating whether the lower and upper endpoints are open (exclusive) or closed (inclusive).
-
Parameters:
- (none)
- Returns: the BoundType enum value representing this range's endpoint types.
lowerEndpoint(...) -> T
-
Signature:
public T lowerEndpoint() - Summary: Returns the lower endpoint (minimum value) of this range.
-
Parameters:
- (none)
- Returns: the lower endpoint value of this range.
upperEndpoint(...) -> T
-
Signature:
public T upperEndpoint() - Summary: Returns the upper endpoint (maximum value) of this range.
-
Parameters:
- (none)
- Returns: the upper endpoint value of this range.
contains(...) -> boolean
-
Signature:
public boolean contains(final T valueToFind) - Summary: Checks whether the specified element occurs within this range.
-
Parameters:
-
valueToFind(T) — the element to check for containment, {@code null} returns false.
-
- Returns: {@code true} if the specified element occurs within this range's bounds, {@code false} otherwise.
containsAll(...) -> boolean
-
Signature:
public boolean containsAll(final Collection<? extends T> c) - Summary: Determines whether this range contains <em> all </em> elements in the specified collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to test; may be {@code null} or empty
-
- Returns: {@code true} if every element in {@code c} is contained within this range, or if {@code c} is {@code null} or empty; {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
public boolean containsAny(final Collection<? extends T> c) - Summary: Determines whether this range contains <em> any </em> element in the specified collection.
-
Contract:
- </p> <p> If the collection is {@code null} or empty, this method returns {@code false} .
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to test; may be {@code null} or empty
-
- Returns: {@code true} if at least one element in {@code c} is contained within this range; {@code false} if none are contained or if {@code c} is {@code null} or empty
isStartedBy(...) -> boolean
-
Signature:
public boolean isStartedBy(final T element) - Summary: Checks whether this range starts with the specified element.
-
Contract:
- Returns {@code true} only if the lower endpoint is closed (inclusive) and equals the specified element.
-
Parameters:
-
element(T) — the element to check against the lower endpoint, {@code null} returns false
-
- Returns: {@code true} if this range has a closed lower endpoint that equals the specified element
isEndedBy(...) -> boolean
-
Signature:
public boolean isEndedBy(final T element) - Summary: Checks whether this range ends with the specified element.
-
Contract:
- Returns {@code true} only if the upper endpoint is closed (inclusive) and equals the specified element.
-
Parameters:
-
element(T) — the element to check against the upper endpoint, {@code null} returns false
-
- Returns: {@code true} if this range has a closed upper endpoint that equals the specified element
isAfter(...) -> boolean
-
Signature:
public boolean isAfter(final T element) - Summary: Checks whether this range is entirely after the specified element.
-
Contract:
- Returns {@code true} if the element is less than the lower endpoint of this range (considering bound type).
-
Parameters:
-
element(T) — the element to check, {@code null} returns false
-
- Returns: {@code true} if this entire range is after (greater than) the specified element
isBefore(...) -> boolean
-
Signature:
public boolean isBefore(final T element) - Summary: Checks whether this range is entirely before the specified element.
-
Contract:
- Returns {@code true} if the element is greater than the upper endpoint of this range (considering bound type).
-
Parameters:
-
element(T) — the element to check, {@code null} returns false
-
- Returns: {@code true} if this entire range is before (less than) the specified element
positionOf(...) -> int
-
Signature:
public int positionOf(final T element) throws IllegalArgumentException - Summary: Compares the position of the specified element relative to this range.
-
Contract:
- <p> Returns: </p> <ul> <li> -1 if this range is entirely before the element </li> <li> 0 if the element is contained within this range </li> <li> 1 if this range is entirely after the element </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Range<Integer> range = Range.closed(5, 10); range.positionOf(3); // returns 1 (range is after 3) range.positionOf(7); // returns 0 (7 is within range) range.positionOf(12); // returns -1 (range is before 12) } </pre>
-
Parameters:
-
element(T) — the element to compare against this range, must not be null
-
- Returns: -1, 0, or 1 depending on the element's position relative to this range
-
Throws:
-
java.lang.IllegalArgumentException— if element is null
-
containsRange(...) -> boolean
-
Signature:
public boolean containsRange(final Range<T> other) - Summary: Checks whether this range contains all elements of the specified range.
-
Contract:
- A range contains another range if every possible value in the other range is also contained in this range, respecting bound types.
- <p> For a closed endpoint in the other range, this range must contain that endpoint value.
- For an open endpoint in the other range, this range's corresponding endpoint must extend strictly beyond the other's endpoint.
-
Parameters:
-
other(Range<T>) — the range to check for containment, {@code null} returns false
-
- Returns: {@code true} if this range contains all elements of the specified range
isAfterRange(...) -> boolean
-
Signature:
public boolean isAfterRange(final Range<T> other) - Summary: Checks whether this range is completely after the specified range.
-
Contract:
- Returns {@code true} if the lower endpoint of this range is greater than or equal to the upper endpoint of the other range (considering bound types).
-
Parameters:
-
other(Range<T>) — the range to compare against, {@code null} returns false
-
- Returns: {@code true} if this range is completely after the specified range
isBeforeRange(...) -> boolean
-
Signature:
public boolean isBeforeRange(final Range<T> other) - Summary: Checks whether this range is completely before the specified range.
-
Contract:
- Returns {@code true} if the upper endpoint of this range is less than or equal to the lower endpoint of the other range (considering bound types).
-
Parameters:
-
other(Range<T>) — the range to compare against, {@code null} returns false
-
- Returns: {@code true} if this range is completely before the specified range
isOverlappedBy(...) -> boolean
-
Signature:
public boolean isOverlappedBy(final Range<T> other) - Summary: Checks whether this range overlaps with the specified range.
-
Contract:
- Two ranges overlap if there is at least one element that is contained in both ranges.
- Ranges that touch at a single point are considered overlapping only if that point is included in both ranges.
-
Parameters:
-
other(Range<T>) — the range to test for overlap, {@code null} returns false
-
- Returns: {@code true} if the specified range overlaps with this range; otherwise, false
intersection(...) -> Optional<Range<T>>
-
Signature:
public Optional<Range<T>> intersection(final Range<T> other) - Summary: Calculates the intersection of this range with another overlapping range.
-
Contract:
- If the ranges do not overlap, returns an empty Optional.
-
Parameters:
-
other(Range<T>) — the range to intersect with this range, must not be null
-
- Returns: an Optional containing the intersection range if the ranges overlap, Optional.empty() if they don't overlap, or Optional containing this range if they are equal
span(...) -> Range<T>
-
Signature:
public Range<T> span(final Range<T> other) - Summary: Returns the minimal range that encloses both this range and the specified range.
-
Contract:
- If the input ranges are connected (overlapping or touching), the span is their union.
- If they are not connected, the span includes values between the ranges that are not in either input range.
-
Parameters:
-
other(Range<T>) — the range to span with this range, must not be null
-
- Returns: the minimal range that contains all values from both input ranges
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Checks if this range is empty.
-
Contract:
- Checks if this range is empty.
- A range is empty if and only if it has the form (a, a) where both endpoints are the same value and both are exclusive (open).
-
Parameters:
- (none)
- Returns: {@code true} if this range contains no values, {@code false} otherwise
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this range to another object for equality.
-
Contract:
- Two ranges are equal if they have the same lower and upper endpoints with the same bound types.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this range.
-
Parameters:
- (none)
- Returns: a hash code value for this object
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this range.
-
Parameters:
- (none)
- Returns: a string representation of this range
Enum BoundType (com.landawn.abacus.util.Range.BoundType)
The Enum BoundType.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class RateLimiter (com.landawn.abacus.util.RateLimiter)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> RateLimiter
-
Signature:
public static RateLimiter create(final double permitsPerSecond) - Summary: Creates a {@code RateLimiter} with the specified stable throughput, given as "permits per second" (commonly referred to as <i> QPS </i> , queries per second).
-
Contract:
- When the incoming request rate exceeds {@code permitsPerSecond} the rate limiter will release one permit every {@code (1.0 / permitsPerSecond)} seconds.
- When the rate limiter is unused, bursts of up to {@code permitsPerSecond} permits will be allowed, with subsequent requests being smoothly limited at the stable rate of {@code permitsPerSecond} .
- All permit acquisition methods ( {@link #acquire} , {@link #tryAcquire} , etc.) are synchronized internally to ensure consistent behavior when accessed concurrently.
- <p> <b> Usage Examples: </b> </p> <pre> {@code RateLimiter limiter = RateLimiter.create(5.0); // 5 permits per second limiter.acquire(); // Acquires one permit, may wait if necessary } </pre>
-
Parameters:
-
permitsPerSecond(double) — the rate of the returned {@code RateLimiter} , measured in how many permits become available per second, must be positive and not NaN
-
- Returns: a newly created {@code RateLimiter} with the specified rate
-
Signature:
public static RateLimiter create(final double permitsPerSecond, final long warmupPeriod, final TimeUnit unit) throws IllegalArgumentException - Summary: Creates a {@code RateLimiter} with the specified stable throughput, given as "permits per second" (commonly referred to as <i> QPS </i> , queries per second), and a <i> warmup period </i> , during which the {@code RateLimiter} smoothly ramps up its rate, until it reaches its maximum rate at the end of the period (as long as there are enough requests to saturate it).
-
Contract:
- Similarly, if the {@code RateLimiter} is left <i> unused </i> for a duration of {@code warmupPeriod} , it will gradually return to its "cold" state, i.e., it will go through the same warming-up process as when it was first created.
- <p> The returned {@code RateLimiter} starts in a "cold" state (i.e., the warmup period will follow), and if it is left unused for long enough, it will return to that state.
- All permit acquisition methods ( {@link #acquire} , {@link #tryAcquire} , etc.) are synchronized internally to ensure consistent behavior when accessed concurrently.
-
Parameters:
-
permitsPerSecond(double) — the rate of the returned {@code RateLimiter} , measured in how many permits become available per second, must be positive -
warmupPeriod(long) — the duration of the period where the {@code RateLimiter} ramps up its rate, before reaching its stable (maximum) rate, must be non-negative -
unit(TimeUnit) — the time unit of the warmupPeriod argument, must not be null
-
- Returns: a newly created {@code RateLimiter} with the specified rate and warmup period
-
Throws:
-
java.lang.IllegalArgumentException— if {@code permitsPerSecond} is negative or zero, or {@code warmupPeriod} is negative
-
Public Instance Methods
setRate(...) -> void
-
Signature:
public final void setRate(final double permitsPerSecond) throws IllegalArgumentException - Summary: Updates the stable rate of this {@code RateLimiter} , that is, the {@code permitsPerSecond} argument provided in the factory method that constructed the {@code RateLimiter} .
-
Contract:
- <p> Note though that, since each request repays (by waiting, if necessary) the cost of the <i> previous </i> request, this means that the very next request after an invocation to {@code setRate} will not be affected by the new rate; it will pay the cost of the previous request, which is in terms of the previous rate.
- <p> The behavior of the {@code RateLimiter} is not modified in any other way, e.g., if the {@code RateLimiter} was configured with a warmup period of 20 seconds, it still has a warmup period of 20 seconds after this method invocation.
-
Parameters:
-
permitsPerSecond(double) — the new stable rate of this {@code RateLimiter} , must be positive and not NaN
-
-
Throws:
-
java.lang.IllegalArgumentException— if {@code permitsPerSecond} is negative, zero, or NaN
-
- See also: #getRate(), #create(double)
getRate(...) -> double
-
Signature:
public final double getRate() - Summary: Returns the stable rate (as {@code permits per seconds} ) with which this {@code RateLimiter} is configured.
-
Parameters:
- (none)
- Returns: the current stable rate in permits per second
- See also: #setRate(double)
acquire(...) -> double
-
Signature:
public double acquire() - Summary: Acquires a single permit from this {@code RateLimiter} , blocking until the request can be granted.
-
Contract:
- <p> If the rate limiter has unused permits available, this method will return immediately with a return value of 0.0.
-
Parameters:
- (none)
- Returns: time spent sleeping to enforce rate, in seconds; 0.0 if not rate-limited
- See also: #acquire(int), #tryAcquire(), #tryAcquire(int), #tryAcquire(long, TimeUnit), #tryAcquire(int, long, TimeUnit)
-
Signature:
public double acquire(final int permits) - Summary: Acquires the given number of permits from this {@code RateLimiter} , blocking until the request can be granted.
-
Contract:
- If this method is called on an idle rate limiter, it will return immediately (even for a large number of permits), but subsequent requests will be throttled to compensate.
-
Parameters:
-
permits(int) — the number of permits to acquire, must be positive
-
- Returns: time spent sleeping to enforce rate, in seconds; 0.0 if not rate-limited
- See also: #acquire(), #tryAcquire(), #tryAcquire(int), #tryAcquire(long, TimeUnit), #tryAcquire(int, long, TimeUnit)
tryAcquire(...) -> boolean
-
Signature:
public boolean tryAcquire(final long timeout, final TimeUnit unit) - Summary: Acquires a permit from this {@code RateLimiter} if it can be obtained without exceeding the specified {@code timeout} , or returns {@code false} immediately (without waiting) if the permit had not been granted before the timeout expired.
-
Contract:
- Acquires a permit from this {@code RateLimiter} if it can be obtained without exceeding the specified {@code timeout} , or returns {@code false} immediately (without waiting) if the permit had not been granted before the timeout expired.
- <p> <b> Usage Examples: </b> </p> <pre> {@code RateLimiter limiter = RateLimiter.create(2.0); if (limiter.tryAcquire(100, TimeUnit.MILLISECONDS)) { // Permit acquired within 100ms } else { // Timeout expired } } </pre>
-
Parameters:
-
timeout(long) — the maximum time to wait for the permit. Negative values are treated as zero. -
unit(TimeUnit) — the time unit of the timeout argument, must not be null
-
- Returns: {@code true} if the permit was acquired, {@code false} otherwise
- See also: #tryAcquire(), #tryAcquire(int), #tryAcquire(int, long, TimeUnit), #acquire(), #acquire(int)
-
Signature:
public boolean tryAcquire(final int permits) - Summary: Acquires the specified number of permits from this {@link RateLimiter} if they can be acquired immediately without any delay.
-
Contract:
- Acquires the specified number of permits from this {@link RateLimiter} if they can be acquired immediately without any delay.
- <p> <b> Usage Examples: </b> </p> <pre> {@code RateLimiter limiter = RateLimiter.create(5.0); if (limiter.tryAcquire(3)) { // Successfully acquired 3 permits immediately } else { // Permits not available, no waiting performed } } </pre>
-
Parameters:
-
permits(int) — the number of permits to acquire, must be positive
-
- Returns: {@code true} if the permits were acquired, {@code false} otherwise
- See also: #tryAcquire(), #tryAcquire(long, TimeUnit), #tryAcquire(int, long, TimeUnit), #acquire(), #acquire(int)
-
Signature:
public boolean tryAcquire() - Summary: Acquires a single permit from this {@link RateLimiter} if it can be acquired immediately without any delay.
-
Contract:
- Acquires a single permit from this {@link RateLimiter} if it can be acquired immediately without any delay.
- <p> This is useful for operations that should only proceed if resources are immediately available, without waiting or queueing.
- <p> <b> Usage Examples: </b> </p> <pre> {@code RateLimiter limiter = RateLimiter.create(10.0); if (limiter.tryAcquire()) { // Permit acquired immediately, proceed with operation processRequest(); } else { // No permit available, skip or defer operation } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the permit was acquired, {@code false} otherwise
- See also: #tryAcquire(int), #tryAcquire(long, TimeUnit), #tryAcquire(int, long, TimeUnit), #acquire(), #acquire(int)
-
Signature:
public boolean tryAcquire(final int permits, final long timeout, final TimeUnit unit) - Summary: Acquires the given number of permits from this {@code RateLimiter} if they can be obtained without exceeding the specified {@code timeout} , or returns {@code false} immediately (without waiting) if the permits had not been granted before the timeout expired.
-
Contract:
- Acquires the given number of permits from this {@code RateLimiter} if they can be obtained without exceeding the specified {@code timeout} , or returns {@code false} immediately (without waiting) if the permits had not been granted before the timeout expired.
- If permits are available within the timeout, they are acquired and the method returns {@code true} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code RateLimiter limiter = RateLimiter.create(2.0); if (limiter.tryAcquire(5, 2, TimeUnit.SECONDS)) { // Successfully acquired 5 permits within 2 seconds processBatch(); } else { // Could not acquire permits within timeout handleTimeout(); } } </pre>
-
Parameters:
-
permits(int) — the number of permits to acquire, must be positive -
timeout(long) — the maximum time to wait for the permits. Negative values are treated as zero. -
unit(TimeUnit) — the time unit of the timeout argument, must not be null
-
- Returns: {@code true} if the permits were acquired, {@code false} otherwise
- See also: #tryAcquire(), #tryAcquire(int), #tryAcquire(long, TimeUnit), #acquire(), #acquire(int)
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code RateLimiter} , showing its current stable rate.
-
Parameters:
- (none)
- Returns: a string representation of this rate limiter
Class Reflection (com.landawn.abacus.util.Reflection)
A utility class that provides simplified reflection operations with improved performance through caching.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
on(...) -> Reflection<T>
-
Signature:
public static <T> Reflection<T> on(final String clsName) - Summary: Creates a Reflection instance for the specified class name.
-
Parameters:
-
clsName(String) — the fully qualified name of the class
-
- Returns: a Reflection instance for the specified class
-
Signature:
public static <T> Reflection<T> on(final Class<T> cls) - Summary: Creates a Reflection instance for the specified class.
-
Parameters:
-
cls(Class<T>) — the class to reflect upon
-
- Returns: a Reflection instance for the specified class
-
Signature:
public static <T> Reflection<T> on(final T target) - Summary: Creates a Reflection instance for the specified target object.
-
Parameters:
-
target(T) — the object to reflect upon
-
- Returns: a Reflection instance for the specified object
Public Instance Methods
_new(...) -> Reflection<T>
-
Signature:
public Reflection<T> _new() - Summary: Creates a new instance of the reflected class using its no-argument constructor.
-
Parameters:
- (none)
- Returns: a new Reflection instance wrapping the newly created object
-
Signature:
public Reflection<T> _new(final Object... args) - Summary: Creates a new instance of the reflected class using a constructor that matches the given arguments.
-
Parameters:
-
args(Object[]) — the arguments to pass to the constructor
-
- Returns: a new Reflection instance wrapping the newly created object
instance(...) -> T
-
Signature:
@MayReturnNull public T instance() - Summary: Returns the target instance being reflected upon.
-
Contract:
- Returns {@code null} if this Reflection was created from a Class rather than an instance.
-
Parameters:
- (none)
- Returns: the target instance, or {@code null} if reflecting on a class
get(...) -> V
-
Signature:
public <V> V get(final String fieldName) - Summary: Gets the value of the specified field from the target instance.
-
Contract:
- If ReflectASM is available, it will be used for better performance.
-
Parameters:
-
fieldName(String) — the name of the field to get
-
- Returns: the value of the field
set(...) -> Reflection<T>
-
Signature:
public Reflection<T> set(final String fieldName, final Object value) - Summary: Sets the value of the specified field in the target instance.
-
Contract:
- If ReflectASM is available, it will be used for better performance.
-
Parameters:
-
fieldName(String) — the name of the field to set -
value(Object) — the value to set
-
- Returns: this Reflection instance for method chaining
invoke(...) -> V
-
Signature:
public <V> V invoke(final String methodName, final Object... args) - Summary: Invokes the specified method on the target instance with the given arguments and returns the result.
-
Contract:
- If ReflectASM is available, it will be used for better performance.
-
Parameters:
-
methodName(String) — the name of the method to invoke -
args(Object[]) — the arguments to pass to the method
-
- Returns: the result of the method invocation
call(...) -> Reflection<T>
-
Signature:
public Reflection<T> call(final String methodName, final Object... args) - Summary: Invokes the specified method on the target instance with the given arguments without returning a result.
-
Contract:
- This is a convenience method for void methods or when the return value is not needed.
-
Parameters:
-
methodName(String) — the name of the method to invoke -
args(Object[]) — the arguments to pass to the method
-
- Returns: this Reflection instance for method chaining
Class RegExUtil (com.landawn.abacus.util.RegExUtil)
A comprehensive utility class providing high-performance, thread-safe methods for regular expression operations on strings, including pattern matching, replacement, splitting, and extraction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
find(...) -> boolean
-
Signature:
public static boolean find(final String source, final String regex) throws IllegalArgumentException - Summary: Checks whether the given regular expression pattern can be found anywhere in the source string.
-
Contract:
- It returns {@code true} if the pattern is found, {@code false} otherwise.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code boolean result = RegExUtil.find("Hello World 123", "\\\\d+"); // Returns: true (digits found) boolean hasEmail = RegExUtil.find("Contact: user@example.com", "\\\\w+@\\\\w+\\\\.\\\\w+"); // Returns: true (email pattern found) boolean noMatch = RegExUtil.find("abc def", "\\\\d+"); // Returns: false (no digits found) boolean emptySource = RegExUtil.find("", "test"); // Returns: false (empty string has no content) boolean nullSource = RegExUtil.find(null, "\\\\w+"); // Returns: false (null treated as empty string) } </pre> <p> <b> Performance Note: </b> If you need to use the same regex pattern multiple times, consider pre-compiling it with {@link Pattern#compile(String)} and using {@link #find(String, Pattern)} to avoid recompilation overhead.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
regex(String) — the regular expression string to search for; must not be {@code null} or empty
-
- Returns: {@code true} if the pattern is found in the source, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if {@code regex} is {@code null} or empty
-
- See also: #find(String, Pattern), #matches(String, String), #findFirst(String, String), #countMatches(String, String), Pattern#compile(String), Matcher#find()
-
Signature:
public static boolean find(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Checks whether the given compiled {@link Pattern} can be found anywhere in the source string.
-
Contract:
- It returns {@code true} if the pattern is found, {@code false} otherwise.
- This is more efficient than {@link #find(String, String)} when the same pattern is used multiple times, as it avoids recompiling the pattern on each invocation.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Pattern digitPattern = Pattern.compile("\\\\d+"); boolean result = RegExUtil.find("Hello World 123", digitPattern); // Returns: true (digits found) Pattern emailPattern = Pattern.compile("\\\\w+@\\\\w+\\\\.\\\\w+"); boolean hasEmail = RegExUtil.find("Contact: user@example.com", emailPattern); // Returns: true (email pattern found) Pattern numberPattern = Pattern.compile("\\\\d+"); boolean noMatch = RegExUtil.find("abc def", numberPattern); // Returns: false (no digits found) boolean emptySource = RegExUtil.find("", digitPattern); // Returns: false (empty string has no content) boolean nullSource = RegExUtil.find(null, digitPattern); // Returns: false (null treated as empty string) } </pre> <p> <b> Performance Note: </b> This method is preferred over {@link #find(String, String)} when performing multiple searches with the same pattern, as pattern compilation is an expensive operation.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
pattern(Pattern) — the compiled regex pattern to search for; must not be {@code null}
-
- Returns: {@code true} if the pattern is found in the source, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if {@code pattern} is {@code null}
-
- See also: #find(String, String), #matches(String, Pattern), #findFirst(String, Pattern), #countMatches(String, Pattern), Pattern#compile(String), Matcher#find()
matches(...) -> boolean
-
Signature:
public static boolean matches(final String source, final String regex) throws IllegalArgumentException - Summary: Checks whether the entire source string matches the given regular expression pattern.
-
Contract:
- It returns {@code true} only if the whole string matches, {@code false} otherwise.
- If you want to find a pattern anywhere in the string, use {@link #find(String, String)} instead.
-
Parameters:
-
source(String) — the input text to match; may be {@code null} (treated as empty string) -
regex(String) — the regular expression string to match against; must not be {@code null} or empty
-
- Returns: {@code true} if the entire source string matches the pattern, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if {@code regex} is {@code null} or empty
-
- See also: #matches(String, Pattern), #find(String, String), Pattern#matches(String, CharSequence), Matcher#matches()
-
Signature:
public static boolean matches(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Checks whether the entire source string matches the given compiled {@link Pattern} .
-
Contract:
- It returns {@code true} only if the whole string matches, {@code false} otherwise.
- This is more efficient than {@link #matches(String, String)} when the same pattern is used multiple times.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Pattern digitPattern = Pattern.compile("\\\\d+"); boolean result = RegExUtil.matches("12345", digitPattern); // Returns: true (entire string is digits) boolean partial = RegExUtil.matches("abc123def", digitPattern); // Returns: false (contains digits but also letters) Pattern emailPattern = Pattern.compile("\\\\w+@\\\\w+\\\\.\\\\w+"); boolean emailMatch = RegExUtil.matches("user@example.com", emailPattern); // Returns: true (entire string is an email) Pattern helloPattern = Pattern.compile("^Hello$"); boolean noMatch = RegExUtil.matches("Hello World", helloPattern); // Returns: false (string contains more than "Hello") Pattern anyPattern = Pattern.compile("."); boolean emptyMatch = RegExUtil.matches("", anyPattern); // Returns: true (empty string matches .) boolean nullMatch = RegExUtil.matches(null, anyPattern); // Returns: true (null treated as empty string, matches .*) } </pre> <p> <b> Performance Note: </b> This method is preferred over {@link #matches(String, String)} when performing multiple matches with the same pattern, as pattern compilation is an expensive operation.
-
Parameters:
-
source(String) — the input text to match; may be {@code null} (treated as empty string) -
pattern(Pattern) — the compiled regex pattern to match against; must not be {@code null}
-
- Returns: {@code true} if the entire source string matches the pattern, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if {@code pattern} is {@code null}
-
- See also: #matches(String, String), #find(String, Pattern), Matcher#matches(), Pattern#compile(String)
findFirst(...) -> String
-
Signature:
@MayReturnNull public static String findFirst(final String source, final String regex) - Summary: Finds the first match of the given regular expression in the specified input text.
-
Contract:
- If a match is found, the matched substring is returned.
- If no match is found, {@code null} is returned.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code String result = RegExUtil.findFirst("abc123xyz456", "\\\\d+"); // Returns: "123" String email = RegExUtil.findFirst("Contact: john@example.com or jane@test.org", "\\\\b\[A-Za-z0-9._%+-\]+@\[A-Za-z0-9.-\]+\\\\.\[A-Z|a-z\]{2,}\\\\b"); // Returns: "john@example.com" String noResult = RegExUtil.findFirst("abc", "\\\\d+"); // Returns: null (pattern not found) String word = RegExUtil.findFirst("", "\\\\b\\\\w+\\\\b"); // Returns: null (empty string has no matches) String nullSource = RegExUtil.findFirst(null, "\\\\d+"); // Returns: null (null source treated as empty) } </pre> <p> <b> Performance Note: </b> If you need to use the same regex pattern multiple times, consider using {@link #findFirst(String, Pattern)} instead to avoid recompiling the pattern on each call.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
regex(String) — the regular expression string to match; must not be {@code null} or empty
-
- Returns: the first matched substring, or {@code null} if no match is found
- See also: #findFirst(String, Pattern), #findLast(String, String), #find(String, String), #matchResults(String, String), Pattern#compile(String), Matcher#find(), Matcher#group()
-
Signature:
public static String findFirst(final String source, final Pattern pattern) - Summary: Finds the first match of the given {@link Pattern} in the specified input text.
-
Contract:
- If a match is found, the matched substring is returned.
- If no match is found, {@code null} is returned.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Pattern digitPattern = Pattern.compile("\\\\d+"); String result = RegExUtil.findFirst("abc123xyz456", digitPattern); // Returns: "123" Pattern emailPattern = Pattern.compile("\\\\b\[A-Za-z0-9._%+-\]+@\[A-Za-z0-9.-\]+\\\\.\[A-Z|a-z\]{2,}\\\\b"); String email = RegExUtil.findFirst("Contact: john@example.com or jane@test.org", emailPattern); // Returns: "john@example.com" Pattern wordPattern = Pattern.compile("\\\\b\\\\w+\\\\b"); String word = RegExUtil.findFirst("", wordPattern); // Returns: null (empty string has no matches) Pattern noMatch = Pattern.compile("xyz"); String noResult = RegExUtil.findFirst("abc123", noMatch); // Returns: null (pattern not found) String nullSource = RegExUtil.findFirst(null, digitPattern); // Returns: null (null source treated as empty) } </pre> <p> <b> Performance Note: </b> This method is more efficient than {@link #find(String, String)} when you need both to check for a match and retrieve the matched text, as it avoids recompiling the pattern and performs the search in a single operation.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
pattern(Pattern) — the compiled regex pattern to match; must not be {@code null}
-
- Returns: the first matched substring, or {@code null} if no match is found
- See also: #findLast(String, Pattern), #find(String, Pattern), #matchResults(String, Pattern), Matcher#find(), Matcher#group(), Pattern#compile(String)
findLast(...) -> String
-
Signature:
@MayReturnNull public static String findLast(final String source, final String regex) - Summary: Finds the last match of the given regular expression in the specified input text.
-
Contract:
- If no match is found, {@code null} is returned.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code String result = RegExUtil.findLast("abc123xyz456pqr789", "\\\\d+"); // Returns: "789" String word = RegExUtil.findLast("hello world java", "\\\\b\\\\w+\\\\b"); // Returns: "java" String email = RegExUtil.findLast("Contact: john@example.com or jane@test.org", "\\\\b\[A-Za-z0-9._%+-\]+@\[A-Za-z0-9.-\]+\\\\.\[A-Z|a-z\]{2,}\\\\b"); // Returns: "jane@test.org" String noResult = RegExUtil.findLast("abc", "\\\\d+"); // Returns: null (pattern not found) String nullSource = RegExUtil.findLast(null, "\\\\d+"); // Returns: null (null source treated as empty) String empty = RegExUtil.findLast("", "\\\\w+"); // Returns: null (empty string has no matches) } </pre> <p> <b> Performance Note: </b> If you need to use the same regex pattern multiple times, consider using {@link #findLast(String, Pattern)} instead to avoid recompiling the pattern on each call.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
regex(String) — the regular expression string to match; must not be {@code null} or empty
-
- Returns: the last matched substring, or {@code null} if no match is found
- See also: #findLast(String, Pattern), #findFirst(String, String), #find(String, String), #matchResults(String, String), Pattern#compile(String), Matcher#find(), Matcher#group()
-
Signature:
public static String findLast(final String source, final Pattern pattern) - Summary: Finds the last match of the given {@link Pattern} in the specified input text.
-
Contract:
- If no match is found, {@code null} is returned.
- For better performance with large texts, consider using alternative approaches if you only need to check for existence.
-
Parameters:
-
source(String) — the input text to search; may be {@code null} (treated as empty string) -
pattern(Pattern) — the compiled regex pattern to match; must not be {@code null}
-
- Returns: the last matched substring, or {@code null} if no match is found
- See also: #findFirst(String, Pattern), #find(String, Pattern), #matchResults(String, Pattern), Matcher#find(), Matcher#group(), Pattern#compile(String)
removeFirst(...) -> String
-
Signature:
public static String removeFirst(final String source, final String regex) throws IllegalArgumentException - Summary: Removes the first substring of the source string that matches the given regular expression.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
regex(String) — the regular expression to which this string is to be matched
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: #replaceFirst(String, String, String), String#replaceFirst(String, String), java.util.regex.Pattern
-
Signature:
public static String removeFirst(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Removes the first substring of the source string that matches the given regular expression pattern.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: #replaceFirst(String, Pattern, String), java.util.regex.Matcher#replaceFirst(String), java.util.regex.Pattern
removeLast(...) -> String
-
Signature:
@Beta public static String removeLast(final String source, final String regex) throws IllegalArgumentException - Summary: Removes the last substring of the source string that matches the given regular expression.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
regex(String) — the regular expression to which this string is to be matched
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: #replaceFirst(String, String, String), java.util.regex.Pattern
-
Signature:
@Beta public static String removeLast(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Removes the last substring of the source string that matches the given regular expression pattern.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: #replaceLast(String, Pattern, String), java.util.regex.Pattern
removeAll(...) -> String
-
Signature:
public static String removeAll(final String source, final String regex) throws IllegalArgumentException - Summary: Removes each substring of the source string that matches the given regular expression.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
regex(String) — the regular expression to which this string is to be matched
-
- Returns: the source string with any removes processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: #replaceAll(String, String, String), String#replaceAll(String, String)
-
Signature:
public static String removeAll(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Removes each substring of the source string that matches the given regular expression pattern.
-
Parameters:
-
source(String) — source string to remove from, which may be null -
pattern(Pattern) — the regular expression to which this string is to be matched
-
- Returns: the source string with any removes processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: #replaceAll(String, Pattern, String), java.util.regex.Matcher#replaceAll(String)
replaceFirst(...) -> String
-
Signature:
public static String replaceFirst(final String source, final String regex, final String replacement) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression with the given replacement.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacement(String) — the string to be substituted for the first match
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceFirst(String, String)
-
Signature:
public static String replaceFirst(final String source, final String regex, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression with the result of applying the given function to the matched substring.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceFirst(String, String)
-
Signature:
public static String replaceFirst(final String source, final String regex, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression with the result of applying the given function to the start and end indices of the match.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceFirst(String, String)
-
Signature:
public static String replaceFirst(final String source, final Pattern pattern, final String replacement) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression pattern with the given replacement.
-
Contract:
- This method is more efficient than {@link #replaceFirst(String, String, String)} when using the same pattern multiple times.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched -
replacement(String) — the string to be substituted for the first match
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: java.util.regex.Matcher#replaceFirst(String)
-
Signature:
public static String replaceFirst(final String source, final Pattern pattern, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression pattern with the given replacer.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: java.util.regex.Matcher#replaceFirst(String)
-
Signature:
public static String replaceFirst(final String source, final Pattern pattern, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Replaces the first substring of the source string that matches the given regular expression pattern with the given replacer.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the first replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: java.util.regex.Matcher#replaceFirst(String)
replaceLast(...) -> String
-
Signature:
@Beta @MayReturnNull public static String replaceLast(final String source, final String regex, final String replacement) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacement} .
-
Parameters:
-
source(String) — the source string to search in -
regex(String) — the regular expression pattern to search for -
replacement(String) — the replacement string
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: Matcher#replaceFirst(String)
-
Signature:
@Beta public static String replaceLast(final String source, final String regex, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacer} .
-
Parameters:
-
source(String) — the source string to search in -
regex(String) — the regular expression pattern to search for -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: Matcher#replaceFirst(Function)
-
Signature:
@Beta public static String replaceLast(final String source, final String regex, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacer} .
-
Parameters:
-
source(String) — the source string to search in -
regex(String) — the regular expression pattern to search for -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: Matcher#replaceFirst(Function)
-
Signature:
@Beta public static String replaceLast(final String source, final Pattern pattern, final String replacement) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacement} .
-
Parameters:
-
source(String) — the source string to search in -
pattern(Pattern) — the pre-compiled regular expression pattern to search for -
replacement(String) — the replacement string
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: Matcher#replaceFirst(String)
-
Signature:
@Beta public static String replaceLast(final String source, final Pattern pattern, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacer} .
-
Parameters:
-
source(String) — the source string to search in -
pattern(Pattern) — the pre-compiled regular expression pattern to search for -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: Matcher#replaceFirst(Function)
-
Signature:
@Beta public static String replaceLast(final String source, final Pattern pattern, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Searches for the last occurrence of the specified {@code regex} pattern in the specified source string, and replace it with the specified {@code replacer} .
-
Parameters:
-
source(String) — the source string to search in -
pattern(Pattern) — the pre-compiled regular expression pattern to search for -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with the last replacement processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: Matcher#replaceFirst(Function)
replaceAll(...) -> String
-
Signature:
public static String replaceAll(final String source, final String regex, final String replacement) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression with the given replacement.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacement(String) — the string to be substituted for each match
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceAll(String, String)
-
Signature:
public static String replaceAll(final String source, final String regex, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression with the result of applying the given function to the matched substring.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceAll(String, String)
-
Signature:
public static String replaceAll(final String source, final String regex, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression with the result of applying the given function to the start and end indices of the match.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
regex(String) — the regular expression to which this string is to be matched -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#replaceAll(String, String)
-
Signature:
public static String replaceAll(final String source, final Pattern pattern, final String replacement) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression pattern with the given replacement.
-
Contract:
- This method is more efficient than {@link #replaceAll(String, String, String)} when using the same pattern multiple times.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression pattern to which this string is to be matched -
replacement(String) — the string to be substituted for each match
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: java.util.regex.Matcher#replaceAll(String), java.util.regex.Pattern
-
Signature:
public static String replaceAll(final String source, final Pattern pattern, final Function<String, String> replacer) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression pattern with the result of applying the given function to the matched substring.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression to which this string is to be matched -
replacer(Function<String, String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: String#replaceAll(String, String)
-
Signature:
public static String replaceAll(final String source, final Pattern pattern, final IntBiFunction<String> replacer) throws IllegalArgumentException - Summary: Replaces each substring of the source string that matches the given regular expression pattern with the result of applying the given function to the start and end indices of the match.
-
Parameters:
-
source(String) — source string to search and replace in, which may be null -
pattern(Pattern) — the regular expression to which this string is to be matched -
replacer(IntBiFunction<String>) — The function to be applied to the match result of this matcher that returns a replacement string.
-
- Returns: the source string with any replacements processed, or an empty String {@code ""} if the input source string is {@code null} .
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: String#replaceAll(String, String)
countMatches(...) -> int
-
Signature:
public static int countMatches(final String source, final String regex) throws IllegalArgumentException - Summary: Counts the number of occurrences of the specified pattern in the given string.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
regex(String) — the regular expression pattern to be counted
-
- Returns: the number of occurrences of the specified pattern in the string, or 0 if the input source string is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: #countMatches(String, Pattern)
-
Signature:
public static int countMatches(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Counts the number of occurrences of the specified pattern in the given string.
-
Contract:
- This method is more efficient than {@link #countMatches(String, String)} when using the same pattern multiple times.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
pattern(Pattern) — the regular expression pattern to be counted
-
- Returns: the number of occurrences of the specified pattern in the string, or 0 if the input source string is {@code null} or empty
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: #countMatches(String, String)
matchResults(...) -> Stream<MatchResult>
-
Signature:
public static Stream<MatchResult> matchResults(final String source, final String regex) throws IllegalArgumentException - Summary: Finds all the occurrences of the specified pattern in the given string.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
regex(String) — the regular expression pattern to be counted
-
- Returns: a stream of match results for each subsequence of the input sequence that matches the pattern.
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: Matcher#results()
-
Signature:
public static Stream<MatchResult> matchResults(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Finds all the occurrences of the specified pattern in the given string.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
pattern(Pattern) — the regular expression pattern to be counted
-
- Returns: a stream of match results for each subsequence of the input sequence that matches the pattern.
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: Matcher#results()
matchIndices(...) -> IntStream
-
Signature:
public static IntStream matchIndices(final String source, final String regex) throws IllegalArgumentException - Summary: Finds all the occurrences of the specified pattern in the given string and returns a stream of start indices.
-
Contract:
- This is useful when you need to know the positions where matches occur in the string.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
regex(String) — the regular expression pattern to be counted
-
- Returns: a stream of start indices for each subsequence of the input sequence that matches the pattern
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: Matcher#results(), Strings#indicesOf(String, String), Strings#indicesOf(String, String, int)
-
Signature:
public static IntStream matchIndices(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Finds all the occurrences of the specified pattern in the given string and returns a stream of start indices.
-
Contract:
- This is useful when you need to know the positions where matches occur in the string.
-
Parameters:
-
source(String) — the string to be checked, may be {@code null} or empty -
pattern(Pattern) — the regular expression pattern to be counted
-
- Returns: a stream of start indices for each subsequence of the input sequence that matches the pattern
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: Matcher#results(), Strings#indicesOf(String, String), Strings#indicesOf(String, String, int)
split(...) -> String\[\]
-
Signature:
public static String[] split(final String source, final String regex) throws IllegalArgumentException - Summary: Splits the given string into an array of strings based on the specified regular expression.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
-
Parameters:
-
source(String) — the string to be split, may be {@code null} or empty -
regex(String) — the regular expression to split by
-
- Returns: an array of strings computed by splitting the source string around matches of the given regular expression. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#split(String), Splitter#with(Pattern), Splitter#split(CharSequence)
-
Signature:
public static String[] split(final String source, final String regex, final int limit) throws IllegalArgumentException - Summary: Splits the given string into an array of strings based on the specified regular expression with a limit.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
-
Parameters:
-
source(String) — the string to be split, may be {@code null} or empty -
regex(String) — the regular expression to split by -
limit(int) — the result threshold. A non-positive limit indicates no limit.
-
- Returns: an array of strings computed by splitting the source string around matches of the given regular expression. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
-
Throws:
-
java.lang.IllegalArgumentException— if the {@code regex} is {@code null} or empty
-
- See also: String#split(String, int), Splitter#with(Pattern), Splitter#split(CharSequence)
-
Signature:
public static String[] split(final String source, final Pattern pattern) throws IllegalArgumentException - Summary: Splits the given string into an array of strings based on the specified regular expression pattern.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
- This method is more efficient than {@link #split(String, String)} when using the same pattern multiple times.
-
Parameters:
-
source(String) — the string to be split, may be {@code null} or empty -
pattern(Pattern) — the regular expression pattern to split by
-
- Returns: an array of strings computed by splitting the source string around matches of the given regular expression. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: String#split(String), Splitter#with(Pattern), Splitter#split(CharSequence)
-
Signature:
public static String[] split(final String source, final Pattern pattern, final int limit) throws IllegalArgumentException - Summary: Splits the given string into an array of strings based on the specified regular expression pattern with a limit.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
-
Parameters:
-
source(String) — the string to be split, may be {@code null} or empty -
pattern(Pattern) — the regular expression pattern to split by -
limit(int) — the result threshold. A non-positive limit indicates no limit.
-
- Returns: an array of strings computed by splitting the source string around matches of the given regular expression. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
-
Throws:
-
java.lang.IllegalArgumentException— if the pattern is {@code null}
-
- See also: String#split(String, int), Splitter#with(Pattern), Splitter#split(CharSequence)
splitToLines(...) -> String\[\]
-
Signature:
public static String[] splitToLines(final String source) - Summary: Splits the given string into an array of lines, using the default line separator.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
-
Parameters:
-
source(String) — the string to be split into lines, may be {@code null} or empty
-
- Returns: an array of strings computed by splitting the source string into lines. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
- See also: #splitToLines(String, int), Pattern#split(CharSequence)
-
Signature:
public static String[] splitToLines(final String source, final int limit) - Summary: Splits the given string into an array of lines, with a specified limit on the number of lines.
-
Contract:
- If the string is {@code null} , an empty array is returned.
- If the string is empty, an array containing an empty string is returned.
-
Parameters:
-
source(String) — the string to be split into lines, may be {@code null} or empty -
limit(int) — the result threshold. A non-positive limit indicates no limit.
-
- Returns: an array of strings computed by splitting the source string into lines. An empty array is returned if the input source string is {@code null} , or an array containing an empty string if the input source string is empty
- See also: #splitToLines(String), Pattern#split(CharSequence, int)
Public Instance Methods
- (none)
Class Result (com.landawn.abacus.util.Result)
A type-safe container for operation results that can either hold a successful value of type {@code T} or an exception of type {@code E} , providing a functional programming approach to error handling without throwing exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
success(...) -> Result<T, E>
-
Signature:
public static <T, E extends Throwable> Result<T, E> success(final T value) - Summary: Creates a new successful Result instance containing the specified value with no exception.
-
Contract:
- returning null for errors: </b> Result distinguishes null success values from error conditions </li> </ul> <p> <b> Best Practices: </b> </p> <ul> <li> Prefer {@code Result.success()} over {@code Result.of(value, null)} for clarity </li> <li> Document whether null values are valid success cases in your API </li> <li> Consider using {@code Optional<T>} as the value type if null has special meaning </li> <li> Use meaningful exception types in the generic parameter for better type safety </li> </ul>
-
Parameters:
-
value(T) — the successful result value to wrap; may be {@code null} to represent a successful operation that returned no value (e.g., a void operation or a query with no results)
-
- Returns: a new {@code Result} instance representing a successful operation containing the specified value; never returns {@code null}
- Performance: </p> <p> <b> State Guarantees: </b> </p> <ul> <li> The returned Result will always have {@code exception == null} </li> <li> {@code isSuccess()} will always return {@code true} </li> <li> {@code isFailure()} will always return {@code false} </li> <li> {@code orElseThrow()} will return the value without throwing </li> <li> {@code getException()} will return {@code null} </li> </ul> <p> <b> Null Value Handling: </b> </p> <ul> <li> A {@code null} value is permitted and represents a successful operation that returned {@code null} </li> <li> To distinguish between "success with null" and "failure", use {@code isSuccess()} or {@code isFailure()} </li> <li> Example: A database query that successfully executes but finds no matching record might return {@code Result.success(null)} </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Creating a success result with a non-null value Result<String, IOException> result = Result.success("Hello World"); assert result.isSuccess(); // true assert result.orElseThrow().equals("Hello World"); // "Hello World" // Creating a success result with a null value (valid use case) Result<User, SQLException> nullResult = Result.success(null); assert nullResult.isSuccess(); // true - operation succeeded assert nullResult.orElseThrow() == null; // null - but that's the actual result // Using with different value types Result<Integer, ArithmeticException> intResult = Result.success(42); Result<List<String>, Exception> listResult = Result.success(Arrays.asList("a", "b", "c")); Result<Optional<String>, RuntimeException> optionalResult = Result.success(Optional.of("value")); // Typical pattern in service methods public Result<User, DatabaseException> findUserById(long id) { try { User user = userRepository.findById(id); return Result.success(user); // user may be null if not found } catch (DatabaseException e) { return Result.failure(e); } } // Chaining with conditional execution Result.success(computeValue()) .ifSuccess(value -> log.info("Computed: {}", value)) .ifFailure(ex -> log.error("Should never happen", ex)); } </pre> <p> <b> Thread Safety: </b> </p> <ul> <li> This method is thread-safe and can be called concurrently from multiple threads </li> <li> The returned Result instance is immutable and safe for concurrent access </li> <li> No synchronization is required when sharing Result instances between threads </li> </ul> <p> <b> Performance Characteristics: </b> </p> <ul> <li> <b> Time Complexity: </b> O(1) - constant time object allocation </li> <li> <b> Space Complexity: </b> O(1) - single object with two reference fields </li> <li> <b> Memory Allocation: </b> Creates exactly one new Result object per invocation </li> <li> <b> No Caching: </b> Each call creates a new instance; no interning or caching is performed </li> </ul> <p> <b> Comparison with Alternative Approaches: </b> </p> <ul> <li> <b> vs.
- See also: #failure(Throwable), #of(Object, Throwable), #isSuccess(), #orElseThrow()
failure(...) -> Result<T, E>
-
Signature:
public static <T, E extends Throwable> Result<T, E> failure(final E exception) - Summary: Creates a new failure Result instance containing the specified exception with no value.
-
Contract:
- {@code Optional.empty()} : </b> Result carries error details; Optional only indicates absence </li> </ul> <p> <b> Best Practices: </b> </p> <ul> <li> Prefer {@code Result.failure()} over {@code Result.of(null, exception)} for clarity </li> <li> Use specific exception types rather than generic {@code Exception} for better type safety </li> <li> Include meaningful error messages in the exception for debugging </li> <li> Preserve the original exception as the cause when wrapping exceptions </li> <li> Document which exception types your methods can return in their Result </li> <li> Avoid passing {@code null} as the exception parameter </li> </ul> <p> <b> Common Patterns: </b> </p> <pre> {@code // Pattern 1: Converting try-catch to Result public Result<Data, ServiceException> fetchData(String id) { try { Data data = externalService.fetch(id); return Result.success(data); } catch (NetworkException | TimeoutException e) { return Result.failure(new ServiceException("Failed to fetch data", e)); } } // Pattern 2: Validation with early return public Result<Order, ValidationException> createOrder(OrderRequest request) { if (request.getItems().isEmpty()) { return Result.failure(new ValidationException("Order must have at least one item")); } if (request.getCustomerId() == null) { return Result.failure(new ValidationException("Customer ID is required")); } // ...
- more validations return Result.success(orderService.create(request)); } // Pattern 3: Combining multiple Results Result<User, DbException> userResult = userRepo.findById(userId); Result<Account, DbException> accountResult = accountRepo.findByUserId(userId); if (userResult.isFailure()) { return Result.failure(userResult.getException()); } if (accountResult.isFailure()) { return Result.failure(accountResult.getException()); } return Result.success(new UserProfile(userResult.orElseThrow(), accountResult.orElseThrow())); } </pre>
-
Parameters:
-
exception(E) — the exception representing the failure cause; should not be {@code null} (passing {@code null} creates a Result where {@code isFailure()} returns {@code false} , which is likely not the intended behavior)
-
- Returns: a new {@code Result} instance representing a failed operation containing the specified exception; never returns {@code null}
- Performance: </p> <p> <b> State Guarantees: </b> </p> <ul> <li> The returned Result will always have {@code value == null} (internal state) </li> <li> {@code isFailure()} will always return {@code true} </li> <li> {@code isSuccess()} will always return {@code false} </li> <li> {@code orElseThrow()} will throw the contained exception </li> <li> {@code getException()} will return the provided exception </li> <li> {@code orElseIfFailure(defaultValue)} will return the default value </li> </ul> <p> <b> Null Exception Handling: </b> </p> <ul> <li> Passing a {@code null} exception is technically permitted but <b> strongly discouraged </b> </li> <li> A {@code null} exception creates an ambiguous state: {@code isFailure()} returns {@code false} </li> <li> If you need to represent "no error", use {@code Result.success(null)} instead </li> <li> Consider using {@code Objects.requireNonNull(exception)} before calling this method if null is unexpected </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Creating a failure result with a specific exception Result<String, IOException> result = Result.failure(new IOException("File not found")); assert result.isFailure(); // true assert result.getException().getMessage().equals("File not found"); // Attempting to get value throws the exception try { String value = result.orElseThrow(); // throws IOException } catch (IOException e) { System.out.println("Caught: " + e.getMessage()); } // Using with different exception types Result<Integer, ArithmeticException> mathError = Result.failure(new ArithmeticException("Division by zero")); Result<User, SQLException> dbError = Result.failure(new SQLException("Connection timeout")); Result<Config, IllegalStateException> configError = Result.failure(new IllegalStateException("Invalid config")); // Typical pattern in service methods public Result<User, ValidationException> validateUser(UserInput input) { if (input.getEmail() == null) { return Result.failure(new ValidationException("Email is required")); } if (!isValidEmail(input.getEmail())) { return Result.failure(new ValidationException("Invalid email format")); } return Result.success(createUser(input)); } // Wrapping checked exceptions from external APIs public Result<String, IOException> readFile(Path path) { try { return Result.success(Files.readString(path)); } catch (IOException e) { return Result.failure(e); } } // Chaining with conditional execution Result.<String, RuntimeException>failure(new IllegalArgumentException("Invalid input")) .ifSuccess(value -> log.info("Should never execute")) .ifFailure(ex -> log.error("Error occurred: {}", ex.getMessage())); // Transforming and re-throwing exceptions Result<Data, SQLException> dbResult = fetchFromDatabase(); Data data = dbResult.orElseThrow(sqlEx -> new ServiceException("Database error", sqlEx)); // Providing fallback values for failures String content = Result.<String, IOException>failure(new IOException("Read error")) .orElseIfFailure("default content"); assert content.equals("default content"); // Lazy fallback computation String lazyContent = result.orElseGetIfFailure(() -> loadFromBackupSource()); } </pre> <p> <b> Exception Preservation: </b> </p> <ul> <li> The exception instance is stored by reference, not copied </li> <li> Stack trace and all exception properties are preserved </li> <li> Chained exceptions (cause chain) remain intact </li> <li> The exact exception type is preserved through generics </li> </ul> <p> <b> Thread Safety: </b> </p> <ul> <li> This method is thread-safe and can be called concurrently from multiple threads </li> <li> The returned Result instance is immutable and safe for concurrent access </li> <li> The contained exception should ideally be immutable for full thread safety </li> <li> No synchronization is required when sharing Result instances between threads </li> </ul> <p> <b> Performance Characteristics: </b> </p> <ul> <li> <b> Time Complexity: </b> O(1) - constant time object allocation </li> <li> <b> Space Complexity: </b> O(1) - single object with two reference fields </li> <li> <b> Memory Allocation: </b> Creates exactly one new Result object per invocation </li> <li> <b> Exception Cost: </b> The exception should already be created; this method adds minimal overhead </li> <li> <b> No Stack Trace Creation: </b> This method does not create or modify stack traces </li> </ul> <p> <b> Comparison with Alternative Approaches: </b> </p> <ul> <li> <b> vs.
- See also: #success(Object), #of(Object, Throwable), #isFailure(), #getException(), #orElseThrow(), #orElseIfFailure(Object), #orElseGetIfFailure(Supplier)
of(...) -> Result<T, E>
-
Signature:
public static <T, E extends Throwable> Result<T, E> of(final T value, final E exception) - Summary: Creates a new Result instance with the specified value and exception.
-
Contract:
- Either value or exception can be present, but typically only one should be {@code non-null} .
- If both are {@code null} , it represents a successful operation with a {@code null} result.
- If both are {@code non-null} , the Result is considered to be in failure state (exception takes precedence).
-
Parameters:
-
value(T) — the successful result value, may be {@code null} . -
exception(E) — the exception that occurred during the operation, may be {@code null} if operation was successful.
-
- Returns: a new Result instance containing either the value or the exception.
Public Instance Methods
isFailure(...) -> boolean
-
Signature:
public boolean isFailure() - Summary: Checks if this Result represents a failed operation.
-
Contract:
- Checks if this Result represents a failed operation.
- A Result is considered a failure if it contains a {@code non-null} exception.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (result.isFailure()) { // handle failure case } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the Result contains an exception (operation failed), {@code false} otherwise.
isSuccess(...) -> boolean
-
Signature:
public boolean isSuccess() - Summary: Checks if this Result represents a successful operation.
-
Contract:
- Checks if this Result represents a successful operation.
- A Result is considered successful if it does not contain an exception (exception is null).
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (result.isSuccess()) { processValue(result.orElseThrow()); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the Result does not contain an exception (operation succeeded), {@code false} otherwise.
ifFailure(...) -> void
-
Signature:
public <E2 extends Throwable> void ifFailure(final Throwables.Consumer<? super E, E2> actionOnFailure) throws E2 - Summary: Executes the provided action if this Result represents a failure.
-
Contract:
- Executes the provided action if this Result represents a failure.
- If this Result is successful (no exception), the action is not executed.
-
Parameters:
-
actionOnFailure(Throwables.Consumer<? super E, E2>) — the action to execute if this Result contains an exception, must not be {@code null} .
-
-
Throws:
-
E2— if the actionOnFailure throws an exception of type E2.
-
ifFailureOrElse(...) -> void
-
Signature:
public <E2 extends Throwable, E3 extends Throwable> void ifFailureOrElse(final Throwables.Consumer<? super E, E2> actionOnFailure, final Throwables.Consumer<? super T, E3> actionOnSuccess) throws IllegalArgumentException, E2, E3 - Summary: Executes one of two actions based on whether this Result represents a failure or success.
-
Contract:
- If the Result contains an exception, actionOnFailure is executed with the exception.
- If the Result is successful, actionOnSuccess is executed with the value.
-
Parameters:
-
actionOnFailure(Throwables.Consumer<? super E, E2>) — the action to execute if this Result contains an exception, must not be {@code null} . -
actionOnSuccess(Throwables.Consumer<? super T, E3>) — the action to execute if this Result is successful, must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either actionOnFailure or actionOnSuccess is {@code null} . -
E2— if the actionOnFailure is executed and throws an exception. -
E3— if the actionOnSuccess is executed and throws an exception.
-
ifSuccess(...) -> void
-
Signature:
public <E2 extends Throwable> void ifSuccess(final Throwables.Consumer<? super T, E2> actionOnSuccess) throws E2 - Summary: Executes the provided action if this Result represents a success.
-
Contract:
- Executes the provided action if this Result represents a success.
- If this Result is a failure (contains an exception), the action is not executed.
-
Parameters:
-
actionOnSuccess(Throwables.Consumer<? super T, E2>) — the action to execute if this Result is successful, must not be {@code null} .
-
-
Throws:
-
E2— if the actionOnSuccess throws an exception of type E2.
-
ifSuccessOrElse(...) -> void
-
Signature:
public <E2 extends Throwable, E3 extends Throwable> void ifSuccessOrElse(final Throwables.Consumer<? super T, E2> actionOnSuccess, final Throwables.Consumer<? super E, E3> actionOnFailure) throws IllegalArgumentException, E2, E3 - Summary: Executes one of two actions based on whether this Result represents a success or failure.
-
Contract:
- If the Result is successful, actionOnSuccess is executed with the value.
- If the Result contains an exception, actionOnFailure is executed with the exception.
-
Parameters:
-
actionOnSuccess(Throwables.Consumer<? super T, E2>) — the action to execute if this Result is successful, must not be {@code null} . -
actionOnFailure(Throwables.Consumer<? super E, E3>) — the action to execute if this Result contains an exception, must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either actionOnSuccess or actionOnFailure is {@code null} . -
E2— if the actionOnSuccess is executed and throws an exception. -
E3— if the actionOnFailure is executed and throws an exception.
-
orElseIfFailure(...) -> T
-
Signature:
public T orElseIfFailure(final T defaultValueIfErrorOccurred) - Summary: Returns the value if this Result is successful, otherwise returns the specified default value.
-
Contract:
- Returns the value if this Result is successful, otherwise returns the specified default value.
-
Parameters:
-
defaultValueIfErrorOccurred(T) — the value to return if this Result contains an exception.
-
- Returns: the value contained in this Result if successful, otherwise the defaultValueIfErrorOccurred.
orElseGetIfFailure(...) -> T
-
Signature:
public T orElseGetIfFailure(final Supplier<? extends T> otherIfErrorOccurred) throws IllegalArgumentException - Summary: Returns the value if this Result is successful, otherwise returns a value supplied by the given supplier.
-
Contract:
- Returns the value if this Result is successful, otherwise returns a value supplied by the given supplier.
- The supplier is only invoked if this Result contains an exception.
-
Parameters:
-
otherIfErrorOccurred(Supplier<? extends T>) — the supplier that provides the value to return if this Result contains an exception, must not be {@code null} .
-
- Returns: the value contained in this Result if successful, otherwise the value provided by the supplier.
-
Throws:
-
java.lang.IllegalArgumentException— if otherIfErrorOccurred is {@code null} .
-
orElseThrow(...) -> T
-
Signature:
public T orElseThrow() throws E - Summary: Returns the value if this Result is successful, otherwise throws the contained exception.
-
Contract:
- Returns the value if this Result is successful, otherwise throws the contained exception.
- <p> <b> Usage Examples: </b> </p> <pre> {@code String value = result.orElseThrow(); // throws exception if failed } </pre>
-
Parameters:
- (none)
- Returns: the value contained in this Result if successful.
-
Throws:
-
E— the exception contained in this Result if it represents a failure.
-
-
Signature:
public <E2 extends Throwable> T orElseThrow(final Function<? super E, E2> exceptionSupplierIfErrorOccurred) throws IllegalArgumentException, E2 - Summary: Returns the value if this Result is successful, otherwise throws an exception created by applying the contained exception to the provided exception mapper function.
-
Contract:
- Returns the value if this Result is successful, otherwise throws an exception created by applying the contained exception to the provided exception mapper function.
-
Parameters:
-
exceptionSupplierIfErrorOccurred(Function<? super E, E2>) — the function that creates a new exception based on the contained exception, must not be {@code null} .
-
- Returns: the value contained in this Result if successful.
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplierIfErrorOccurred is {@code null} . -
E2— the exception created by the exceptionSupplierIfErrorOccurred function if this Result contains an exception.
-
-
Signature:
public <E2 extends Throwable> T orElseThrow(final Supplier<? extends E2> exceptionSupplier) throws IllegalArgumentException, E2 - Summary: Returns the value if this Result is successful, otherwise throws an exception supplied by the given supplier.
-
Contract:
- Returns the value if this Result is successful, otherwise throws an exception supplied by the given supplier.
- This method provides a way to throw a custom exception when the Result represents a failure.
- The supplier is only invoked if this Result contains an exception.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E2>) — the supplier that provides the exception to throw if this Result contains an exception, must not be {@code null} .
-
- Returns: the value contained in this Result if successful.
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplier is {@code null} . -
E2— the exception provided by the exceptionSupplier if this Result contains an exception.
-
-
Signature:
@Deprecated public <E2 extends Throwable> T orElseThrow(final E2 exception) throws E2 - Summary: Returns the value if this Result is successful, otherwise throws the specified exception.
-
Contract:
- Returns the value if this Result is successful, otherwise throws the specified exception.
- This method provides a way to throw a pre-created exception when the Result represents a failure.
- <p> <b> Note: </b> This method is deprecated because it requires creating the exception object eagerly even if the Result is successful.
-
Parameters:
-
exception(E2) — the exception to throw if this Result contains an exception, may be {@code null} .
-
- Returns: the value contained in this Result if successful.
-
Throws:
-
E2— the provided exception if this Result contains an exception.
-
getException(...) -> E
-
Signature:
@Beta public E getException() - Summary: Returns the exception contained in this Result, or {@code null} if the Result is successful.
-
Contract:
- Returns the exception contained in this Result, or {@code null} if the Result is successful.
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (result.isFailure()) { Exception ex = result.getException(); log.error("Error occurred", ex); } } </pre>
-
Parameters:
- (none)
- Returns: the exception if this Result represents a failure, {@code null} if the Result is successful.
getExceptionIfPresent(...) -> Optional<E>
-
Signature:
@Deprecated @Beta public Optional<E> getExceptionIfPresent() - Summary: Returns an Optional containing the exception if this Result represents a failure, or an empty Optional if the Result is successful.
-
Contract:
- Returns an Optional containing the exception if this Result represents a failure, or an empty Optional if the Result is successful.
-
Parameters:
- (none)
- Returns: an Optional containing the exception if present, otherwise an empty Optional.
toPair(...) -> Pair<T, E>
-
Signature:
public Pair<T, E> toPair() - Summary: Converts this Result to a Pair containing both the value and the exception.
-
Parameters:
- (none)
- Returns: a Pair where the first element is the value and the second element is the exception.
toTuple(...) -> Tuple2<T, E>
-
Signature:
public Tuple2<T, E> toTuple() - Summary: Converts this Result to a Tuple2 containing both the value and the exception.
-
Parameters:
- (none)
- Returns: a Tuple2 where the first element is the value and the second element is the exception.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Result.
-
Contract:
- The hash code is computed based on the exception if present, otherwise based on the value.
- <p> <b> Implementation Note: </b> The hash code prioritizes the exception over the value, meaning if an exception is present, its hash code is returned regardless of the value's hash code.
-
Parameters:
- (none)
- Returns: the hash code of the exception if present, otherwise the hash code of the value.
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this Result with another object for equality.
-
Contract:
- Two Results are considered equal if they are both successful with equal values, or both failures with equal exceptions.
- For equality, both the value and exception must match between the two Result instances.
- <p> <b> Equality Contract: </b> </p> <ul> <li> Returns {@code true} if and only if both Results have equal values AND equal exceptions </li> <li> Null values are compared using null-safe equality (two nulls are considered equal) </li> <li> Exception equality is based on the exception's own equals implementation </li> <li> Type parameters T and E do not need to match exactly, only the actual instances </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Result<String, Exception> r1 = Result.of("value", null); Result<String, Exception> r2 = Result.of("value", null); boolean isEqual = r1.equals(r2); // true Result<String, IOException> r3 = Result.of(null, new IOException("error")); Result<String, IOException> r4 = Result.of(null, new IOException("error")); boolean isEqual2 = r3.equals(r4); // depends on IOException's equals implementation } </pre>
-
Parameters:
-
obj(Object) — the object to compare with this Result.
-
- Returns: {@code true} if the specified object is a Result with equal value and exception, {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Result.
-
Parameters:
- (none)
- Returns: a string representation of this Result showing both value and exception.
Class RR (com.landawn.abacus.util.Result.RR)
A specialized Result class that specifically handles RuntimeException as the exception type.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Result.RR<T>
-
Signature:
public static <T> Result.RR<T> of(final T value, final RuntimeException exception) - Summary: Creates a new RR (Result with RuntimeException) instance with the specified value and exception.
-
Contract:
- Either value or exception can be present, but typically only one should be {@code non-null} .
-
Parameters:
-
value(T) — the successful result value, may be {@code null} . -
exception(RuntimeException) — the RuntimeException that occurred during the operation, may be {@code null} if operation was successful.
-
- Returns: a new RR instance containing either the value or the RuntimeException.
Public Instance Methods
- (none)
Class Retry (com.landawn.abacus.util.Retry)
This class provides a mechanism to retry operations in case of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
withFixedDelay(...) -> Retry<Void>
-
Signature:
public static Retry<Void> withFixedDelay(final int retryTimes, final long retryIntervalInMillis, final Predicate<? super Exception> retryCondition) throws IllegalArgumentException - Summary: Creates a new instance of {@code Retry<Void>} with the specified retry times, retry interval, and exception-based retry condition.
-
Contract:
- The retry logic will be triggered only when an exception is thrown and the {@code retryCondition} predicate evaluates to {@code true} for that exception.
- If {@code retryIntervalInMillis} is 0, retries will be executed immediately without delay.
-
Parameters:
-
retryTimes(int) — the maximum number of times to retry the operation if it fails. Must be non-negative. A value of 0 means no retries. -
retryIntervalInMillis(long) — the interval in milliseconds to wait between retries. Must be non-negative. A value of 0 means no delay between retries. -
retryCondition(Predicate<? super Exception>) — a predicate that tests the thrown exception. If it returns {@code true} , the operation will be retried. Must not be {@code null} .
-
- Returns: a new {@code Retry<Void>} instance configured with the specified parameters.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code retryTimes} is negative, {@code retryIntervalInMillis} is negative, or {@code retryCondition} is {@code null} .
-
-
Signature:
public static <T> Retry<T> withFixedDelay(final int retryTimes, final long retryIntervalInMillis, final BiPredicate<? super T, ? super Exception> retryCondition) throws IllegalArgumentException - Summary: Creates a new instance of {@code Retry<T>} with the specified retry times, retry interval, and result/exception-based retry condition.
-
Contract:
- If {@code retryIntervalInMillis} is 0, retries will be executed immediately without delay.
-
Parameters:
-
retryTimes(int) — the maximum number of times to retry the operation if it fails or returns an unsatisfactory result. Must be non-negative. A value of 0 means no retries. -
retryIntervalInMillis(long) — the interval in milliseconds to wait between retries. Must be non-negative. A value of 0 means no delay between retries. -
retryCondition(BiPredicate<? super T, ? super Exception>) — a bi-predicate that tests both the result and the exception. The first parameter is the result (or {@code null} if an exception occurred), and the second parameter is the exception (or {@code null} if no exception occurred). If it returns {@code true} , the operation will be retried. Must not be {@code null} .
-
- Returns: a new {@code Retry<T>} instance configured with the specified parameters.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code retryTimes} is negative, {@code retryIntervalInMillis} is negative, or {@code retryCondition} is {@code null} .
-
Public Instance Methods
run(...) -> void
-
Signature:
public void run(final Throwables.Runnable<? extends Exception> cmd) throws Exception - Summary: Executes the specified runnable operation and retries it if it fails according to the configured retry conditions.
-
Contract:
- Executes the specified runnable operation and retries it if it fails according to the configured retry conditions.
- <p> This method will execute the provided {@code cmd} and retry it up to {@code retryTimes} times if an exception is thrown and the retry condition is satisfied.
- Between retries, the thread will sleep for {@code retryIntervalInMillis} milliseconds if configured.
- If all retry attempts fail, the last exception thrown will be propagated.
- </p> <p> The retry logic is controlled by the retry conditions specified during construction: <ul> <li> If {@code retryCondition} is set, the operation is retried when the predicate returns {@code true} for the thrown exception.
- </li> <li> If {@code retryCondition2} is set, the operation is retried when the bi-predicate returns {@code true} for {@code null} result and the thrown exception.
- </li> </ul> <p> <b> Special case: </b> If {@code retryTimes} is 0, the operation is executed exactly once without any retries, and any exception thrown by the operation is propagated immediately.
-
Parameters:
-
cmd(Throwables.Runnable<? extends Exception>) — the runnable operation to execute, which may throw an exception.
-
-
Throws:
-
java.lang.Exception— any exception thrown by the {@code cmd} operation. If the operation is retried and all retry attempts are exhausted without success, the last exception encountered during the final retry attempt is thrown. If the retry condition is not satisfied for a thrown exception, that exception is thrown immediately without further retries.
-
call(...) -> T
-
Signature:
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") public T call(final java.util.concurrent.Callable<T> callable) throws Exception - Summary: Executes the specified callable operation and retries it if it fails or returns an unsatisfactory result according to the configured retry conditions.
-
Contract:
- Executes the specified callable operation and retries it if it fails or returns an unsatisfactory result according to the configured retry conditions.
- </li> </ul> Between retries, the thread will sleep for {@code retryIntervalInMillis} milliseconds if configured.
- <p> The retry logic is controlled by the retry conditions specified during construction: <ul> <li> If {@code retryCondition} is set, the operation is retried when the predicate returns {@code true} for the thrown exception.
- </li> <li> If {@code retryCondition2} is set, the operation is retried when the bi-predicate returns {@code true} for the result and/or exception.
- </li> </ul> <p> <b> Special case: </b> If {@code retryTimes} is 0, the operation is executed exactly once without any retries, and the result is returned directly (or any exception is propagated immediately).
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Retry up to 3 times with 1 second interval if result is null or TimeoutException occurs Retry<String> retry = Retry.withFixedDelay(3, 1000, (result, ex) -> result == null || ex instanceof java.util.concurrent.TimeoutException); String result = retry.call(() -> fetchDataFromServer()); } </pre>
-
Parameters:
-
callable(java.util.concurrent.Callable<T>) — the callable operation to execute, which may throw an exception or return a result.
-
- Returns: the result of the successful execution of {@code callable} . If all retry attempts are exhausted and the result still does not satisfy the retry condition, the last result obtained is returned (or an exception is thrown).
-
Throws:
-
java.lang.Exception— any exception thrown by the {@code callable} operation. If the operation is retried and all retry attempts are exhausted without success, the last exception encountered during the final retry attempt is thrown. If the retry condition is not satisfied for a thrown exception, that exception is thrown immediately without further retries.
-
Class RowDataset (com.landawn.abacus.util.RowDataset)
A row-oriented implementation of the Dataset interface that stores data in rows.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public RowDataset(final List<String> columnNameList, final List<List<Object>> columnList) - Summary: Constructs a new RowDataset with the specified column names and column data.
-
Contract:
- Each column is represented as a List of Objects, and all columns must have the same size to maintain data integrity across rows.
-
Parameters:
-
columnNameList(List<String>) — the list of column names for the dataset. Must not be {@code null} , must not contain empty/null names, and must not contain duplicates. The order of names corresponds to the order of columns in columnList. -
columnList(List<List<Object>>) — the list of columns, where each column is a List of Objects containing the data for that column. Must not be {@code null} , and each column must not be {@code null} . All columns must have the same size to ensure consistent row structure.
-
- See also: #RowDataset(List, List, Map)
-
Signature:
public RowDataset(final List<String> columnNameList, final List<List<Object>> columnList, final Map<String, Object> properties) throws IllegalArgumentException - Summary: Constructs a new RowDataset with the specified column names, column data, and properties.
-
Contract:
- Each column is represented as a List of Objects, and all columns must have the same size to maintain data integrity across rows.
-
Parameters:
-
columnNameList(List<String>) — the list of column names for the dataset. Must not be {@code null} , must not contain empty/null names, and must not contain duplicates. The order of names corresponds to the order of columns in columnList. -
columnList(List<List<Object>>) — the list of columns, where each column is a List of Objects containing the data for that column. Must not be {@code null} , and each column must not be {@code null} . All columns must have the same size to ensure consistent row structure. -
properties(Map<String, Object>) — optional properties map for storing metadata associated with this dataset. Can be {@code null} . A defensive copy is made of the provided properties.
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the following conditions are met: <ul> <li> columnNameList is null </li> <li> columnList is null </li> <li> columnNameList contains empty or {@code null} column names </li> <li> columnNameList contains duplicate column names </li> <li> the size of columnNameList differs from the size of columnList </li> <li> any column in columnList is null </li> <li> columns in columnList have different sizes </li> </ul>
-
- See also: #RowDataset(List, List), #copyProperties(Map)
columnNames(...) -> ImmutableList<String>
-
Signature:
@Override public ImmutableList<String> columnNames() -
Parameters:
- (none)
- Returns: unspecified
columnCount(...) -> int
-
Signature:
@Override public int columnCount() -
Parameters:
- (none)
- Returns: unspecified
getColumnName(...) -> String
-
Signature:
@Override public String getColumnName(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
getColumnIndex(...) -> int
-
Signature:
@Override public int getColumnIndex(final String columnName) throws IllegalArgumentException -
Parameters:
-
columnName(String)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
getColumnIndexes(...) -> int\[\]
-
Signature:
@Override public int[] getColumnIndexes(final Collection<String> columnNames) throws IllegalArgumentException -
Parameters:
-
columnNames(Collection<String>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
containsColumn(...) -> boolean
-
Signature:
@Override public boolean containsColumn(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
containsAllColumns(...) -> boolean
-
Signature:
@Override public boolean containsAllColumns(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
- Returns: unspecified
renameColumn(...) -> void
-
Signature:
@Override public void renameColumn(final String columnName, final String newColumnName) throws IllegalArgumentException -
Parameters:
-
columnName(String) -
newColumnName(String)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
renameColumns(...) -> void
-
Signature:
@Override public void renameColumns(final Map<String, String> oldNewNames) throws IllegalArgumentException -
Parameters:
-
oldNewNames(Map<String, String>)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public void renameColumns(final Collection<String> columnNames, final Function<? super String, String> func) throws IllegalArgumentException -
Parameters:
-
columnNames(Collection<String>) -
func(Function<? super String, String>)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public void renameColumns(final Function<? super String, String> func) throws IllegalArgumentException -
Parameters:
-
func(Function<? super String, String>)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
moveColumn(...) -> void
-
Signature:
@Override public void moveColumn(final String columnName, final int newPosition) throws IllegalArgumentException -
Parameters:
-
columnName(String) -
newPosition(int)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
moveColumns(...) -> void
-
Signature:
@Override public void moveColumns(List<String> columns, int newPosition) -
Parameters:
-
columns(List<String>) -
newPosition(int)
-
swapColumns(...) -> void
-
Signature:
@Override public void swapColumns(final String columnNameA, final String columnNameB) -
Parameters:
-
columnNameA(String) -
columnNameB(String)
-
moveRow(...) -> void
-
Signature:
@Override public void moveRow(final int rowIndex, final int newPosition) -
Parameters:
-
rowIndex(int) -
newPosition(int)
-
moveRows(...) -> void
-
Signature:
@Override public void moveRows(int fromRowIndex, int toRowIndex, int newPosition) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
newPosition(int)
-
-
Throws:
-
java.lang.IllegalArgumentException
-
swapRows(...) -> void
-
Signature:
@Override public void swapRows(final int rowIndexA, final int rowIndexB) -
Parameters:
-
rowIndexA(int) -
rowIndexB(int)
-
get(...) -> T
-
Signature:
@Override public <T> T get(final int rowIndex, final int columnIndex) -
Parameters:
-
rowIndex(int) -
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public <T> T get(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public <T> T get(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
set(...) -> void
-
Signature:
@Override public void set(final int rowIndex, final int columnIndex, final Object element) -
Parameters:
-
rowIndex(int) -
columnIndex(int) -
element(Object)
-
-
Signature:
@Override public void set(final int columnIndex, final Object value) -
Parameters:
-
columnIndex(int) -
value(Object)
-
-
Signature:
@Override public void set(final String columnName, final Object value) -
Parameters:
-
columnName(String) -
value(Object)
-
isNull(...) -> boolean
-
Signature:
@Override public boolean isNull(final int rowIndex, final int columnIndex) -
Parameters:
-
rowIndex(int) -
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public boolean isNull(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public boolean isNull(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getBoolean(...) -> boolean
-
Signature:
@Override public boolean getBoolean(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public boolean getBoolean(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getChar(...) -> char
-
Signature:
@Override public char getChar(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public char getChar(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getByte(...) -> byte
-
Signature:
@Override public byte getByte(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public byte getByte(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getShort(...) -> short
-
Signature:
@Override public short getShort(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public short getShort(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getInt(...) -> int
-
Signature:
@Override public int getInt(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public int getInt(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getLong(...) -> long
-
Signature:
@Override public long getLong(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public long getLong(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getFloat(...) -> float
-
Signature:
@Override public float getFloat(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public float getFloat(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getDouble(...) -> double
-
Signature:
@Override public double getDouble(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public double getDouble(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
getColumn(...) -> ImmutableList<T>
-
Signature:
@SuppressWarnings("rawtypes") @Override public <T> ImmutableList<T> getColumn(final int columnIndex) -
Parameters:
-
columnIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public <T> ImmutableList<T> getColumn(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
copyColumn(...) -> List<T>
-
Signature:
@SuppressWarnings("rawtypes") @Override public <T> List<T> copyColumn(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
addColumn(...) -> void
-
Signature:
@Override public void addColumn(final String newColumnName, final Collection<?> column) -
Parameters:
-
newColumnName(String) -
column(Collection<?>)
-
-
Signature:
@Override public void addColumn(final int newColumnPosition, final String newColumnName, final Collection<?> column) -
Parameters:
-
newColumnPosition(int) -
newColumnName(String) -
column(Collection<?>)
-
-
Signature:
@Override public void addColumn(final String newColumnName, final String fromColumnName, final Function<?, ?> func) -
Parameters:
-
newColumnName(String) -
fromColumnName(String) -
func(Function<?, ?>)
-
-
Signature:
@Override public void addColumn(final int newColumnPosition, final String newColumnName, final String fromColumnName, final Function<?, ?> func) -
Parameters:
-
newColumnPosition(int) -
newColumnName(String) -
fromColumnName(String) -
func(Function<?, ?>)
-
-
Signature:
@Override public void addColumn(final String newColumnName, final Collection<String> fromColumnNames, final Function<? super DisposableObjArray, ?> func) -
Parameters:
-
newColumnName(String) -
fromColumnNames(Collection<String>) -
func(Function<? super DisposableObjArray, ?>)
-
-
Signature:
@Override public void addColumn(final int newColumnPosition, final String newColumnName, final Collection<String> fromColumnNames, final Function<? super DisposableObjArray, ?> func) -
Parameters:
-
newColumnPosition(int) -
newColumnName(String) -
fromColumnNames(Collection<String>) -
func(Function<? super DisposableObjArray, ?>)
-
-
Signature:
@Override public void addColumn(final String newColumnName, final Tuple2<String, String> fromColumnNames, final BiFunction<?, ?, ?> func) -
Parameters:
-
newColumnName(String) -
fromColumnNames(Tuple2<String, String>) -
func(BiFunction<?, ?, ?>)
-
-
Signature:
@Override public void addColumn(final int newColumnPosition, final String newColumnName, final Tuple2<String, String> fromColumnNames, final BiFunction<?, ?, ?> func) -
Parameters:
-
newColumnPosition(int) -
newColumnName(String) -
fromColumnNames(Tuple2<String, String>) -
func(BiFunction<?, ?, ?>)
-
-
Signature:
@Override public void addColumn(final String newColumnName, final Tuple3<String, String, String> fromColumnNames, final TriFunction<?, ?, ?, ?> func) -
Parameters:
-
newColumnName(String) -
fromColumnNames(Tuple3<String, String, String>) -
func(TriFunction<?, ?, ?, ?>)
-
-
Signature:
@Override public void addColumn(final int newColumnPosition, final String newColumnName, final Tuple3<String, String, String> fromColumnNames, final TriFunction<?, ?, ?, ?> func) -
Parameters:
-
newColumnPosition(int) -
newColumnName(String) -
fromColumnNames(Tuple3<String, String, String>) -
func(TriFunction<?, ?, ?, ?>)
-
addColumns(...) -> void
-
Signature:
@Override public void addColumns(final List<String> newColumnNames, final List<? extends Collection<?>> newColumns) -
Parameters:
-
newColumnNames(List<String>) -
newColumns(List<? extends Collection<?>>)
-
-
Signature:
@Override public void addColumns(final int newColumnPosition, final List<String> newColumnNames, final List<? extends Collection<?>> newColumns) -
Parameters:
-
newColumnPosition(int) -
newColumnNames(List<String>) -
newColumns(List<? extends Collection<?>>)
-
removeColumn(...) -> List<T>
-
Signature:
@SuppressWarnings("rawtypes") @Override public <T> List<T> removeColumn(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
removeColumns(...) -> void
-
Signature:
@Override public void removeColumns(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
-
Signature:
@Override public void removeColumns(final Predicate<? super String> filter) -
Parameters:
-
filter(Predicate<? super String>)
-
convertColumn(...) -> void
-
Signature:
@Override public void convertColumn(final String columnName, final Class<?> targetType) -
Parameters:
-
columnName(String) -
targetType(Class<?>)
-
convertColumns(...) -> void
-
Signature:
@Override public void convertColumns(final Map<String, Class<?>> columnTargetTypes) -
Parameters:
-
columnTargetTypes(Map<String, Class<?>>)
-
updateColumn(...) -> void
-
Signature:
@Override public void updateColumn(final String columnName, final Function<?, ?> func) -
Parameters:
-
columnName(String) -
func(Function<?, ?>)
-
updateColumns(...) -> void
-
Signature:
@Override public void updateColumns(final Collection<String> columnNames, final IntBiObjFunction<String, ?, ?> func) -
Parameters:
-
columnNames(Collection<String>) -
func(IntBiObjFunction<String, ?, ?>)
-
combineColumns(...) -> void
-
Signature:
@Override public void combineColumns(final Collection<String> columnNames, final String newColumnName, final Class<?> newColumnType) -
Parameters:
-
columnNames(Collection<String>) -
newColumnName(String) -
newColumnType(Class<?>)
-
-
Signature:
@Override public void combineColumns(final Collection<String> columnNames, final String newColumnName, final Function<? super DisposableObjArray, ?> combineFunc) -
Parameters:
-
columnNames(Collection<String>) -
newColumnName(String) -
combineFunc(Function<? super DisposableObjArray, ?>)
-
-
Signature:
@Override public void combineColumns(final Tuple2<String, String> columnNames, final String newColumnName, final BiFunction<?, ?, ?> combineFunc) -
Parameters:
-
columnNames(Tuple2<String, String>) -
newColumnName(String) -
combineFunc(BiFunction<?, ?, ?>)
-
-
Signature:
@Override public void combineColumns(final Tuple3<String, String, String> columnNames, final String newColumnName, final TriFunction<?, ?, ?, ?> combineFunc) -
Parameters:
-
columnNames(Tuple3<String, String, String>) -
newColumnName(String) -
combineFunc(TriFunction<?, ?, ?, ?>)
-
divideColumn(...) -> void
-
Signature:
@Override public void divideColumn(final String columnName, final Collection<String> newColumnNames, final Function<?, ? extends List<?>> divideFunc) -
Parameters:
-
columnName(String) -
newColumnNames(Collection<String>) -
divideFunc(Function<?, ? extends List<?>>)
-
-
Signature:
@Override public void divideColumn(final String columnName, final Collection<String> newColumnNames, final BiConsumer<?, Object[]> output) -
Parameters:
-
columnName(String) -
newColumnNames(Collection<String>) -
output(BiConsumer<?, Object[]>)
-
-
Signature:
@Override public void divideColumn(final String columnName, final Tuple2<String, String> newColumnNames, final BiConsumer<?, Pair<Object, Object>> output) -
Parameters:
-
columnName(String) -
newColumnNames(Tuple2<String, String>) -
output(BiConsumer<?, Pair<Object, Object>>)
-
-
Signature:
@Override public void divideColumn(final String columnName, final Tuple3<String, String, String> newColumnNames, final BiConsumer<?, Triple<Object, Object, Object>> output) -
Parameters:
-
columnName(String) -
newColumnNames(Tuple3<String, String, String>) -
output(BiConsumer<?, Triple<Object, Object, Object>>)
-
columns(...) -> Stream<ImmutableList<Object>>
-
Signature:
@Override public Stream<ImmutableList<Object>> columns() -
Parameters:
- (none)
- Returns: unspecified
columnMap(...) -> Map<String, ImmutableList<Object>>
-
Signature:
@Override public Map<String, ImmutableList<Object>> columnMap() -
Parameters:
- (none)
- Returns: unspecified
addRow(...) -> void
-
Signature:
@Override public void addRow(final Object row) -
Parameters:
-
row(Object)
-
-
Signature:
@Override public void addRow(final int newRowPosition, final Object row) -
Parameters:
-
newRowPosition(int) -
row(Object)
-
addRows(...) -> void
-
Signature:
@Override public void addRows(final Collection<?> rows) -
Parameters:
-
rows(Collection<?>)
-
-
Signature:
@SuppressWarnings("rawtypes") @Override public void addRows(final int newRowPosition, final Collection<?> rows) -
Parameters:
-
newRowPosition(int) -
rows(Collection<?>)
-
removeRow(...) -> void
-
Signature:
@Override public void removeRow(final int rowIndex) -
Parameters:
-
rowIndex(int)
-
removeRowsAt(...) -> void
-
Signature:
@Override public void removeRowsAt(final int... rowIndexesToRemove) -
Parameters:
-
rowIndexesToRemove(int[])
-
removeRows(...) -> void
-
Signature:
@Override public void removeRows(final int inclusiveFromRowIndex, final int exclusiveToRowIndex) -
Parameters:
-
inclusiveFromRowIndex(int) -
exclusiveToRowIndex(int)
-
removeDuplicateRowsBy(...) -> void
-
Signature:
@Override public void removeDuplicateRowsBy(final String keyColumnName) throws IllegalStateException, IllegalArgumentException -
Parameters:
-
keyColumnName(String)
-
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException
-
-
Signature:
@Override public void removeDuplicateRowsBy(final String keyColumnName, final Function<?, ?> keyExtractor) throws IllegalStateException, IllegalArgumentException -
Parameters:
-
keyColumnName(String) -
keyExtractor(Function<?, ?>)
-
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException
-
-
Signature:
@Override public void removeDuplicateRowsBy(final Collection<String> keyColumnNames) throws IllegalStateException, IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>)
-
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException
-
-
Signature:
@Override public void removeDuplicateRowsBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalStateException, IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>)
-
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException
-
updateRow(...) -> void
-
Signature:
@Override public void updateRow(final int rowIndex, final Function<?, ?> func) -
Parameters:
-
rowIndex(int) -
func(Function<?, ?>)
-
updateRows(...) -> void
-
Signature:
@Override public void updateRows(final int[] rowIndexesToUpdate, final IntBiObjFunction<String, ?, ?> func) -
Parameters:
-
rowIndexesToUpdate(int[]) -
func(IntBiObjFunction<String, ?, ?>)
-
updateAll(...) -> void
-
Signature:
@Override public void updateAll(final Function<?, ?> func) -
Parameters:
-
func(Function<?, ?>)
-
-
Signature:
@Override public void updateAll(final IntBiObjFunction<String, ?, ?> func) -
Parameters:
-
func(IntBiObjFunction<String, ?, ?>)
-
replaceIf(...) -> void
-
Signature:
@Override public void replaceIf(final Predicate<?> predicate, final Object newValue) -
Parameters:
-
predicate(Predicate<?>) -
newValue(Object)
-
-
Signature:
@Override public void replaceIf(final IntBiObjPredicate<String, ?> predicate, final Object newValue) -
Parameters:
-
predicate(IntBiObjPredicate<String, ?>) -
newValue(Object)
-
prepend(...) -> void
-
Signature:
@Override public void prepend(final Dataset other) -
Parameters:
-
other(Dataset)
-
append(...) -> void
-
Signature:
@Override public void append(final Dataset other) -
Parameters:
-
other(Dataset)
-
merge(...) -> void
-
Signature:
@Override public void merge(final Dataset other) -
Parameters:
-
other(Dataset)
-
-
Signature:
@Override public void merge(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
-
Signature:
@Override public void merge(final Dataset other, final Collection<String> selectColumnNamesFromOtherToMerge) -
Parameters:
-
other(Dataset) -
selectColumnNamesFromOtherToMerge(Collection<String>)
-
-
Signature:
@Override public void merge(final Dataset other, final int fromRowIndexFromOther, final int toRowIndexFromOther, final Collection<String> selectColumnNamesFromOtherToMerge) -
Parameters:
-
other(Dataset) -
fromRowIndexFromOther(int) -
toRowIndexFromOther(int) -
selectColumnNamesFromOtherToMerge(Collection<String>)
-
currentRowIndex(...) -> int
-
Signature:
@Override public int currentRowIndex() -
Parameters:
- (none)
- Returns: unspecified
moveToRow(...) -> Dataset
-
Signature:
@Override public Dataset moveToRow(final int rowNum) -
Parameters:
-
rowNum(int)
-
- Returns: unspecified
getRow(...) -> Object\[\]
-
Signature:
@Override public Object[] getRow(final int rowIndex) -
Parameters:
-
rowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public <T> T getRow(final int rowIndex, final Class<? extends T> rowType) -
Parameters:
-
rowIndex(int) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> T getRow(final int rowIndex, final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
rowIndex(int) -
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> T getRow(final int rowIndex, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowIndex(int) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> T getRow(final int rowIndex, final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowIndex(int) -
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
firstRow(...) -> Optional<Object\[\]>
-
Signature:
@Override public Optional<Object[]> firstRow() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> firstRow(final Class<? extends T> rowType) -
Parameters:
-
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> firstRow(final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> firstRow(final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> firstRow(final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
lastRow(...) -> Optional<Object\[\]>
-
Signature:
@Override public Optional<Object[]> lastRow() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> lastRow(final Class<? extends T> rowType) -
Parameters:
-
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> lastRow(final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> lastRow(final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Optional<T> lastRow(final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
iterator(...) -> BiIterator<A, B>
-
Signature:
@Override public <A, B> BiIterator<A, B> iterator(final String columnNameA, final String columnNameB) -
Parameters:
-
columnNameA(String) -
columnNameB(String)
-
- Returns: unspecified
-
Signature:
@Override public <A, B> BiIterator<A, B> iterator(final int fromRowIndex, final int toRowIndex, final String columnNameA, final String columnNameB) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNameA(String) -
columnNameB(String)
-
- Returns: unspecified
-
Signature:
@Override public <A, B, C> TriIterator<A, B, C> iterator(final String columnNameA, final String columnNameB, final String columnNameC) -
Parameters:
-
columnNameA(String) -
columnNameB(String) -
columnNameC(String)
-
- Returns: unspecified
-
Signature:
@Override public <A, B, C> TriIterator<A, B, C> iterator(final int fromRowIndex, final int toRowIndex, final String columnNameA, final String columnNameB, final String columnNameC) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNameA(String) -
columnNameB(String) -
columnNameC(String)
-
- Returns: unspecified
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<? super DisposableObjArray, E> action) throws E -
Parameters:
-
action(Throwables.Consumer<? super DisposableObjArray, E>)
-
-
Throws:
-
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final Collection<String> columnNames, final Throwables.Consumer<? super DisposableObjArray, E> action) throws E -
Parameters:
-
columnNames(Collection<String>) -
action(Throwables.Consumer<? super DisposableObjArray, E>)
-
-
Throws:
-
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final int fromRowIndex, final int toRowIndex, final Throwables.Consumer<? super DisposableObjArray, E> action) throws E -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
action(Throwables.Consumer<? super DisposableObjArray, E>)
-
-
Throws:
-
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Throwables.Consumer<? super DisposableObjArray, E> action) throws IllegalArgumentException, E -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
action(Throwables.Consumer<? super DisposableObjArray, E>)
-
-
Throws:
-
java.lang.IllegalArgumentException -
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final Tuple2<String, String> columnNames, final Throwables.BiConsumer<?, ?, E> action) throws IllegalArgumentException, E -
Parameters:
-
columnNames(Tuple2<String, String>) -
action(Throwables.BiConsumer<?, ?, E>)
-
-
Throws:
-
java.lang.IllegalArgumentException -
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final int fromRowIndex, final int toRowIndex, final Tuple2<String, String> columnNames, final Throwables.BiConsumer<?, ?, E> action) throws E -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple2<String, String>) -
action(Throwables.BiConsumer<?, ?, E>)
-
-
Throws:
-
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final Tuple3<String, String, String> columnNames, final Throwables.TriConsumer<?, ?, ?, E> action) throws E -
Parameters:
-
columnNames(Tuple3<String, String, String>) -
action(Throwables.TriConsumer<?, ?, ?, E>)
-
-
Throws:
-
E
-
-
Signature:
@Override public <E extends Exception> void forEach(final int fromRowIndex, final int toRowIndex, final Tuple3<String, String, String> columnNames, final Throwables.TriConsumer<?, ?, ?, E> action) throws IllegalArgumentException, E -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple3<String, String, String>) -
action(Throwables.TriConsumer<?, ?, ?, E>)
-
-
Throws:
-
java.lang.IllegalArgumentException -
E
-
toList(...) -> List<Object\[\]>
-
Signature:
@Override public List<Object[]> toList() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public List<Object[]> toList(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final Class<? extends T> rowType) -
Parameters:
-
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final Predicate<? super String> columnNameFilter, final Function<? super String, String> columnNameConverter, final Class<? extends T> rowType) -
Parameters:
-
columnNameFilter(Predicate<? super String>) -
columnNameConverter(Function<? super String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final Predicate<? super String> columnNameFilter, final Function<? super String, String> columnNameConverter, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNameFilter(Predicate<? super String>) -
columnNameConverter(Function<? super String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final Predicate<? super String> columnNameFilter, final Function<? super String, String> columnNameConverter, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
columnNameFilter(Predicate<? super String>) -
columnNameConverter(Function<? super String, String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toList(final int fromRowIndex, final int toRowIndex, final Predicate<? super String> columnNameFilter, final Function<? super String, String> columnNameConverter, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNameFilter(Predicate<? super String>) -
columnNameConverter(Function<? super String, String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
toEntities(...) -> List<T>
-
Signature:
@Override public <T> List<T> toEntities(final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toEntities(final int fromRowIndex, final int toRowIndex, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toEntities(final Collection<String> columnNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toEntities(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
toMergedEntities(...) -> List<T>
-
Signature:
@Override public <T> List<T> toMergedEntities(final Class<? extends T> rowType) -
Parameters:
-
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final Collection<String> selectPropNames, final Class<? extends T> rowType) -
Parameters:
-
selectPropNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) throws IllegalArgumentException -
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public <T> List<T> toMergedEntities(final String idPropName, final Class<? extends T> rowType) -
Parameters:
-
idPropName(String) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final String idPropName, final Collection<String> selectPropNames, final Class<? extends T> rowType) -
Parameters:
-
idPropName(String) -
selectPropNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final String idPropName, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
idPropName(String) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final Collection<String> idPropNames, final Collection<String> selectPropNames, final Class<? extends T> rowType) -
Parameters:
-
idPropNames(Collection<String>) -
selectPropNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final Collection<String> idPropNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
idPropNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> List<T> toMergedEntities(final Collection<String> idPropNames, final Collection<String> selectPropNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) throws IllegalArgumentException -
Parameters:
-
idPropNames(Collection<String>) -
selectPropNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
toMap(...) -> Map<K, V>
-
Signature:
@Override public <K, V> Map<K, V> toMap(final String keyColumnName, final String valueColumnName) -
Parameters:
-
keyColumnName(String) -
valueColumnName(String)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final String keyColumnName, final String valueColumnName, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnName(String) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V> Map<K, V> toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final String valueColumnName) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnName(String)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final String valueColumnName, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnName(String) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V> Map<K, V> toMap(final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends V> rowType) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends V>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends V> rowType, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends V>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V> Map<K, V> toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends V> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends V>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends V> rowType, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends V>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V> Map<K, V> toMap(final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends V> rowSupplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends V>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends V> rowSupplier, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends V>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V> Map<K, V> toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends V> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends V>)
-
- Returns: unspecified
-
Signature:
@Override public <K, V, M extends Map<K, V>> M toMap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends V> rowSupplier, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends V>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
toMultimap(...) -> ListMultimap<K, T>
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final String keyColumnName, final String valueColumnName) -
Parameters:
-
keyColumnName(String) -
valueColumnName(String)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final String keyColumnName, final String valueColumnName, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnName(String) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final String valueColumnName) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnName(String)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final String valueColumnName, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnName(String) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends T> rowType) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends T> rowType, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends T>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final Class<? extends T> rowType, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowType(Class<? extends T>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends T> rowSupplier, final IntFunction<? extends M> supplier) -
Parameters:
-
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T> ListMultimap<K, T> toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <K, T, V extends Collection<T>, M extends Multimap<K, T, V>> M toMultimap(final int fromRowIndex, final int toRowIndex, final String keyColumnName, final Collection<String> valueColumnNames, final IntFunction<? extends T> rowSupplier, final IntFunction<? extends M> supplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
keyColumnName(String) -
valueColumnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>) -
supplier(IntFunction<? extends M>)
-
- Returns: unspecified
toJson(...) -> String
-
Signature:
@Override public String toJson() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public String toJson(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public String toJson(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public void toJson(final File output) -
Parameters:
-
output(File)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final File output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(File)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final File output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(File)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void toJson(final OutputStream output) -
Parameters:
-
output(OutputStream)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final OutputStream output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(OutputStream)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final OutputStream output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(OutputStream)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void toJson(final Writer output) -
Parameters:
-
output(Writer)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final Writer output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(Writer)
-
-
Signature:
@Override public void toJson(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Writer output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(Writer)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
toXml(...) -> String
-
Signature:
@Override public String toXml() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public String toXml(final String rowElementName) -
Parameters:
-
rowElementName(String)
-
- Returns: unspecified
-
Signature:
@Override public String toXml(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public String toXml(final int fromRowIndex, final int toRowIndex, final String rowElementName) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowElementName(String)
-
- Returns: unspecified
-
Signature:
@Override public String toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public String toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final String rowElementName) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowElementName(String)
-
- Returns: unspecified
-
Signature:
@Override public void toXml(final File output) -
Parameters:
-
output(File)
-
-
Signature:
@Override public void toXml(final String rowElementName, final File output) -
Parameters:
-
rowElementName(String) -
output(File)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final File output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(File)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final String rowElementName, final File output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowElementName(String) -
output(File)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final File output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(File)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final String rowElementName, final File output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowElementName(String) -
output(File)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void toXml(final OutputStream output) -
Parameters:
-
output(OutputStream)
-
-
Signature:
@Override public void toXml(final String rowElementName, final OutputStream output) -
Parameters:
-
rowElementName(String) -
output(OutputStream)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final OutputStream output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(OutputStream)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final String rowElementName, final OutputStream output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowElementName(String) -
output(OutputStream)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final OutputStream output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(OutputStream)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final String rowElementName, final OutputStream output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowElementName(String) -
output(OutputStream)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void toXml(final Writer output) -
Parameters:
-
output(Writer)
-
-
Signature:
@Override public void toXml(final String rowElementName, final Writer output) -
Parameters:
-
rowElementName(String) -
output(Writer)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Writer output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
output(Writer)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final String rowElementName, final Writer output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowElementName(String) -
output(Writer)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Writer output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(Writer)
-
-
Signature:
@Override public void toXml(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final String rowElementName, final Writer output) throws UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowElementName(String) -
output(Writer)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
toCsv(...) -> String
-
Signature:
@Override public String toCsv() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public String toCsv(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public void toCsv(final File output) -
Parameters:
-
output(File)
-
-
Signature:
@Override public void toCsv(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final File output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(File)
-
-
Signature:
@Override public void toCsv(final OutputStream output) -
Parameters:
-
output(OutputStream)
-
-
Signature:
@Override public void toCsv(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final OutputStream output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(OutputStream)
-
-
Signature:
@Override public void toCsv(final Writer output) -
Parameters:
-
output(Writer)
-
-
Signature:
@Override public void toCsv(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Writer output) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(Writer)
-
groupBy(...) -> Dataset
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnName(String) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnName(String) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnName(String) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Dataset groupBy(final String keyColumnName, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnName(String) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final Function<?, ?> keyExtractor, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnName(String) -
keyExtractor(Function<?, ?>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final Function<?, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnName(String) -
keyExtractor(Function<?, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final String keyColumnName, final Function<?, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnName(String) -
keyExtractor(Function<?, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Dataset groupBy(final String keyColumnName, final Function<?, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) throws IllegalArgumentException -
Parameters:
-
keyColumnName(String) -
keyExtractor(Function<?, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames) -
Parameters:
-
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) throws IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Dataset groupBy(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor) throws IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) throws IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) throws IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset groupBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Dataset groupBy(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) throws IllegalArgumentException -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
rollup(...) -> Stream<Dataset>
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames) -
Parameters:
-
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<Dataset> rollup(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
cube(...) -> Stream<Dataset>
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames) -
Parameters:
-
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<Dataset> cube(final Collection<String> keyColumnNames, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final String aggregateOnColumnName, final String aggregateResultColumnName, final Collector<?, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnName(String) -
aggregateResultColumnName(String) -
collector(Collector<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Class<?> rowType) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowType(Class<?>)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> cube(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Collector<? super Object[], ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
collector(Collector<? super Object[], ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<Dataset> cube(final Collection<String> keyColumnNames, final Function<? super DisposableObjArray, ?> keyExtractor, final Collection<String> aggregateOnColumnNames, final String aggregateResultColumnName, final Function<? super DisposableObjArray, ? extends T> rowMapper, final Collector<? super T, ?, ?> collector) -
Parameters:
-
keyColumnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>) -
aggregateOnColumnNames(Collection<String>) -
aggregateResultColumnName(String) -
rowMapper(Function<? super DisposableObjArray, ? extends T>) -
collector(Collector<? super T, ?, ?>)
-
- Returns: unspecified
pivot(...) -> Sheet<R, C, T>
-
Signature:
@Override public <R, C, T> Sheet<R, C, T> pivot(final String keyColumnName, final String pivotColumnName, final String aggregateOnColumnNames, final Collector<?, ?, ? extends T> collector) -
Parameters:
-
keyColumnName(String) -
pivotColumnName(String) -
aggregateOnColumnNames(String) -
collector(Collector<?, ?, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <R, C, T> Sheet<R, C, T> pivot(final String keyColumnName, final String pivotColumnName, final Collection<String> aggregateOnColumnNames, final Collector<? super Object[], ?, ? extends T> collector) -
Parameters:
-
keyColumnName(String) -
pivotColumnName(String) -
aggregateOnColumnNames(Collection<String>) -
collector(Collector<? super Object[], ?, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <R, C, U, T> Sheet<R, C, T> pivot(final String keyColumnName, final String pivotColumnName, final Collection<String> aggregateOnColumnNames, final Function<? super DisposableObjArray, ? extends U> rowMapper, final Collector<? super U, ?, ? extends T> collector) -
Parameters:
-
keyColumnName(String) -
pivotColumnName(String) -
aggregateOnColumnNames(Collection<String>) -
rowMapper(Function<? super DisposableObjArray, ? extends U>) -
collector(Collector<? super U, ?, ? extends T>)
-
- Returns: unspecified
sortBy(...) -> void
-
Signature:
@Override public void sortBy(final String columnName) -
Parameters:
-
columnName(String)
-
-
Signature:
@Override public void sortBy(final String columnName, final Comparator<?> cmp) -
Parameters:
-
columnName(String) -
cmp(Comparator<?>)
-
-
Signature:
@Override public void sortBy(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
-
Signature:
@Override public void sortBy(final Collection<String> columnNames, final Comparator<? super Object[]> cmp) -
Parameters:
-
columnNames(Collection<String>) -
cmp(Comparator<? super Object[]>)
-
-
Signature:
@SuppressWarnings("rawtypes") @Override public void sortBy(final Collection<String> columnNames, final Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) -
Parameters:
-
columnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>)
-
parallelSortBy(...) -> void
-
Signature:
@Override public void parallelSortBy(final String columnName) -
Parameters:
-
columnName(String)
-
-
Signature:
@Override public void parallelSortBy(final String columnName, final Comparator<?> cmp) -
Parameters:
-
columnName(String) -
cmp(Comparator<?>)
-
-
Signature:
@Override public void parallelSortBy(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
-
Signature:
@Override public void parallelSortBy(final Collection<String> columnNames, final Comparator<? super Object[]> cmp) -
Parameters:
-
columnNames(Collection<String>) -
cmp(Comparator<? super Object[]>)
-
-
Signature:
@SuppressWarnings("rawtypes") @Override public void parallelSortBy(final Collection<String> columnNames, final Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) -
Parameters:
-
columnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>)
-
topBy(...) -> Dataset
-
Signature:
@Override public Dataset topBy(final String columnName, final int n) -
Parameters:
-
columnName(String) -
n(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset topBy(final String columnName, final int n, final Comparator<?> cmp) -
Parameters:
-
columnName(String) -
n(int) -
cmp(Comparator<?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset topBy(final Collection<String> columnNames, final int n) -
Parameters:
-
columnNames(Collection<String>) -
n(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset topBy(final Collection<String> columnNames, final int n, final Comparator<? super Object[]> cmp) -
Parameters:
-
columnNames(Collection<String>) -
n(int) -
cmp(Comparator<? super Object[]>)
-
- Returns: unspecified
-
Signature:
@SuppressWarnings("rawtypes") @Override public Dataset topBy(final Collection<String> columnNames, final int n, final Function<? super DisposableObjArray, ? extends Comparable> keyExtractor) -
Parameters:
-
columnNames(Collection<String>) -
n(int) -
keyExtractor(Function<? super DisposableObjArray, ? extends Comparable>)
-
- Returns: unspecified
distinct(...) -> Dataset
-
Signature:
@Override public Dataset distinct() -
Parameters:
- (none)
- Returns: unspecified
distinctBy(...) -> Dataset
-
Signature:
@Override public Dataset distinctBy(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
-
Signature:
@Override public Dataset distinctBy(final String columnName, final Function<?, ?> keyExtractor) -
Parameters:
-
columnName(String) -
keyExtractor(Function<?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset distinctBy(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset distinctBy(final Collection<String> columnNames, final Function<? super DisposableObjArray, ?> keyExtractor) -
Parameters:
-
columnNames(Collection<String>) -
keyExtractor(Function<? super DisposableObjArray, ?>)
-
- Returns: unspecified
filter(...) -> Dataset
-
Signature:
@Override public Dataset filter(final Predicate<? super DisposableObjArray> filter) -
Parameters:
-
filter(Predicate<? super DisposableObjArray>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final Predicate<? super DisposableObjArray> filter, final int max) -
Parameters:
-
filter(Predicate<? super DisposableObjArray>) -
max(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Predicate<? super DisposableObjArray> filter) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
filter(Predicate<? super DisposableObjArray>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Predicate<? super DisposableObjArray> filter, final int max) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
filter(Predicate<? super DisposableObjArray>) -
max(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final Tuple2<String, String> columnNames, final BiPredicate<?, ?> filter) -
Parameters:
-
columnNames(Tuple2<String, String>) -
filter(BiPredicate<?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final Tuple2<String, String> columnNames, final BiPredicate<?, ?> filter, final int max) -
Parameters:
-
columnNames(Tuple2<String, String>) -
filter(BiPredicate<?, ?>) -
max(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Tuple2<String, String> columnNames, final BiPredicate<?, ?> filter) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple2<String, String>) -
filter(BiPredicate<?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Tuple2<String, String> columnNames, final BiPredicate<?, ?> filter, final int max) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple2<String, String>) -
filter(BiPredicate<?, ?>) -
max(int)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset filter(final Tuple3<String, String, String> columnNames, final TriPredicate<?, ?, ?> filter) -
Parameters:
-
columnNames(Tuple3<String, String, String>) -
filter(TriPredicate<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final Tuple3<String, String, String> columnNames, final TriPredicate<?, ?, ?> filter, final int max) -
Parameters:
-
columnNames(Tuple3<String, String, String>) -
filter(TriPredicate<?, ?, ?>) -
max(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Tuple3<String, String, String> columnNames, final TriPredicate<?, ?, ?> filter) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple3<String, String, String>) -
filter(TriPredicate<?, ?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Tuple3<String, String, String> columnNames, final TriPredicate<?, ?, ?> filter, final int max) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple3<String, String, String>) -
filter(TriPredicate<?, ?, ?>) -
max(int)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset filter(final String columnName, final Predicate<?> filter) -
Parameters:
-
columnName(String) -
filter(Predicate<?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final String columnName, final Predicate<?> filter, final int max) throws IllegalArgumentException -
Parameters:
-
columnName(String) -
filter(Predicate<?>) -
max(int)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final String columnName, final Predicate<?> filter) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnName(String) -
filter(Predicate<?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final String columnName, final Predicate<?> filter, int max) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnName(String) -
filter(Predicate<?>) -
max(int)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset filter(final Collection<String> columnNames, final Predicate<? super DisposableObjArray> filter) -
Parameters:
-
columnNames(Collection<String>) -
filter(Predicate<? super DisposableObjArray>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final Collection<String> columnNames, final Predicate<? super DisposableObjArray> filter, final int max) -
Parameters:
-
columnNames(Collection<String>) -
filter(Predicate<? super DisposableObjArray>) -
max(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Predicate<? super DisposableObjArray> filter) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
filter(Predicate<? super DisposableObjArray>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset filter(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Predicate<? super DisposableObjArray> filter, int max) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
filter(Predicate<? super DisposableObjArray>) -
max(int)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
mapColumn(...) -> Dataset
-
Signature:
@Override public Dataset mapColumn(final String fromColumnName, final String newColumnName, final String copyingColumnName, final Function<?, ?> mapper) -
Parameters:
-
fromColumnName(String) -
newColumnName(String) -
copyingColumnName(String) -
mapper(Function<?, ?>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset mapColumn(final String fromColumnName, final String newColumnName, final Collection<String> copyingColumnNames, final Function<?, ?> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnName(String) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(Function<?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
mapColumns(...) -> Dataset
-
Signature:
@Override public Dataset mapColumns(final Tuple2<String, String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final BiFunction<?, ?, ?> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Tuple2<String, String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(BiFunction<?, ?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset mapColumns(final Tuple3<String, String, String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final TriFunction<?, ?, ?, ?> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Tuple3<String, String, String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(TriFunction<?, ?, ?, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset mapColumns(final Collection<String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final Function<? super DisposableObjArray, ?> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Collection<String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(Function<? super DisposableObjArray, ?>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
flatMapColumn(...) -> Dataset
-
Signature:
@Override public Dataset flatMapColumn(final String fromColumnName, final String newColumnName, final String copyingColumnName, final Function<?, ? extends Collection<?>> mapper) -
Parameters:
-
fromColumnName(String) -
newColumnName(String) -
copyingColumnName(String) -
mapper(Function<?, ? extends Collection<?>>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset flatMapColumn(final String fromColumnName, final String newColumnName, final Collection<String> copyingColumnNames, final Function<?, ? extends Collection<?>> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnName(String) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(Function<?, ? extends Collection<?>>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
flatMapColumns(...) -> Dataset
-
Signature:
@Override public Dataset flatMapColumns(final Tuple2<String, String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final BiFunction<?, ?, ? extends Collection<?>> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Tuple2<String, String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(BiFunction<?, ?, ? extends Collection<?>>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset flatMapColumns(final Tuple3<String, String, String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final TriFunction<?, ?, ?, ? extends Collection<?>> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Tuple3<String, String, String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(TriFunction<?, ?, ?, ? extends Collection<?>>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public Dataset flatMapColumns(final Collection<String> fromColumnNames, final String newColumnName, final Collection<String> copyingColumnNames, final Function<? super DisposableObjArray, ? extends Collection<?>> mapper) throws IllegalArgumentException -
Parameters:
-
fromColumnNames(Collection<String>) -
newColumnName(String) -
copyingColumnNames(Collection<String>) -
mapper(Function<? super DisposableObjArray, ? extends Collection<?>>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
copy(...) -> Dataset
-
Signature:
@Override public Dataset copy() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public Dataset copy(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset copy(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset copy(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
clone(...) -> Dataset
-
Signature:
@SuppressWarnings("MethodDoesntCallSuperMethod") @SuppressFBWarnings("CN_IDIOM_NO_SUPER_CALL") @Override public Dataset clone() -
Parameters:
- (none)
- Returns: unspecified
-
Signature:
@Override public Dataset clone(final boolean freeze) -
Parameters:
-
freeze(boolean)
-
- Returns: unspecified
innerJoin(...) -> Dataset
-
Signature:
@Override public Dataset innerJoin(final Dataset right, final String columnName, final String joinColumnNameOnRight) -
Parameters:
-
right(Dataset) -
columnName(String) -
joinColumnNameOnRight(String)
-
- Returns: unspecified
-
Signature:
@Override public Dataset innerJoin(final Dataset right, final Map<String, String> onColumnNames) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset innerJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>)
-
- Returns: unspecified
-
Signature:
@SuppressWarnings("rawtypes") @Override public Dataset innerJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType, final IntFunction<? extends Collection> collSupplier) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>) -
collSupplier(IntFunction<? extends Collection>)
-
- Returns: unspecified
leftJoin(...) -> Dataset
-
Signature:
@Override public Dataset leftJoin(final Dataset right, final String columnName, final String joinColumnNameOnRight) -
Parameters:
-
right(Dataset) -
columnName(String) -
joinColumnNameOnRight(String)
-
- Returns: unspecified
-
Signature:
@Override public Dataset leftJoin(final Dataset right, final Map<String, String> onColumnNames) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset leftJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>)
-
- Returns: unspecified
-
Signature:
@SuppressWarnings("rawtypes") @Override public Dataset leftJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType, final IntFunction<? extends Collection> collSupplier) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>) -
collSupplier(IntFunction<? extends Collection>)
-
- Returns: unspecified
rightJoin(...) -> Dataset
-
Signature:
@Override public Dataset rightJoin(final Dataset right, final String columnName, final String joinColumnNameOnRight) -
Parameters:
-
right(Dataset) -
columnName(String) -
joinColumnNameOnRight(String)
-
- Returns: unspecified
-
Signature:
@Override public Dataset rightJoin(final Dataset right, final Map<String, String> onColumnNames) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset rightJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>)
-
- Returns: unspecified
-
Signature:
@SuppressWarnings("rawtypes") @Override public Dataset rightJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType, final IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>) -
collSupplier(IntFunction<? extends Collection>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
fullJoin(...) -> Dataset
-
Signature:
@Override public Dataset fullJoin(final Dataset right, final String columnName, final String joinColumnNameOnRight) -
Parameters:
-
right(Dataset) -
columnName(String) -
joinColumnNameOnRight(String)
-
- Returns: unspecified
-
Signature:
@Override public Dataset fullJoin(final Dataset right, final Map<String, String> onColumnNames) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset fullJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType) -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>)
-
- Returns: unspecified
-
Signature:
@SuppressWarnings("rawtypes") @Override public Dataset fullJoin(final Dataset right, final Map<String, String> onColumnNames, final String newColumnName, final Class<?> newColumnType, final IntFunction<? extends Collection> collSupplier) throws IllegalArgumentException -
Parameters:
-
right(Dataset) -
onColumnNames(Map<String, String>) -
newColumnName(String) -
newColumnType(Class<?>) -
collSupplier(IntFunction<? extends Collection>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
union(...) -> Dataset
-
Signature:
@Override public Dataset union(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset union(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
-
Signature:
@Override public Dataset union(final Dataset other, final Collection<String> keyColumnNames) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset union(final Dataset other, final Collection<String> keyColumnNames, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>) -
requiresSameColumns(boolean)
-
- Returns: unspecified
unionAll(...) -> Dataset
-
Signature:
@Override public Dataset unionAll(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset unionAll(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
intersect(...) -> Dataset
-
Signature:
@Override public Dataset intersect(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersect(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersect(final Dataset other, final Collection<String> keyColumnNames) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersect(final Dataset other, final Collection<String> keyColumnNames, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>) -
requiresSameColumns(boolean)
-
- Returns: unspecified
intersectAll(...) -> Dataset
-
Signature:
@Override public Dataset intersectAll(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersectAll(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersectAll(final Dataset other, final Collection<String> keyColumnNames) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset intersectAll(final Dataset other, final Collection<String> keyColumnNames, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>) -
requiresSameColumns(boolean)
-
- Returns: unspecified
except(...) -> Dataset
-
Signature:
@Override public Dataset except(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset except(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
-
Signature:
@Override public Dataset except(final Dataset other, final Collection<String> keyColumnNames) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset except(final Dataset other, final Collection<String> keyColumnNames, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>) -
requiresSameColumns(boolean)
-
- Returns: unspecified
exceptAll(...) -> Dataset
-
Signature:
@Override public Dataset exceptAll(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
-
Signature:
@Override public Dataset exceptAll(final Dataset other, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
requiresSameColumns(boolean)
-
- Returns: unspecified
-
Signature:
@Override public Dataset exceptAll(final Dataset other, final Collection<String> keyColumnNames) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset exceptAll(final Dataset other, final Collection<String> keyColumnNames, final boolean requiresSameColumns) -
Parameters:
-
other(Dataset) -
keyColumnNames(Collection<String>) -
requiresSameColumns(boolean)
-
- Returns: unspecified
cartesianProduct(...) -> Dataset
-
Signature:
@Override public Dataset cartesianProduct(final Dataset other) -
Parameters:
-
other(Dataset)
-
- Returns: unspecified
split(...) -> Stream<Dataset>
-
Signature:
@Override public Stream<Dataset> split(final int chunkSize) -
Parameters:
-
chunkSize(int)
-
- Returns: unspecified
-
Signature:
@Override public Stream<Dataset> split(final int chunkSize, final Collection<String> columnNames) throws IllegalArgumentException -
Parameters:
-
chunkSize(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
splitToList(...) -> List<Dataset>
-
Signature:
@Override public List<Dataset> splitToList(final int chunkSize) -
Parameters:
-
chunkSize(int)
-
- Returns: unspecified
-
Signature:
@Override public List<Dataset> splitToList(final int chunkSize, final Collection<String> columnNames) throws IllegalArgumentException -
Parameters:
-
chunkSize(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
slice(...) -> Dataset
-
Signature:
@Override public Dataset slice(final Collection<String> columnNames) -
Parameters:
-
columnNames(Collection<String>)
-
- Returns: unspecified
-
Signature:
@Override public Dataset slice(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
- Returns: unspecified
-
Signature:
@Override public Dataset slice(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) throws IndexOutOfBoundsException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IndexOutOfBoundsException
-
paginate(...) -> Paginated<Dataset>
-
Signature:
@Override public Paginated<Dataset> paginate(final int pageSize) -
Parameters:
-
pageSize(int)
-
- Returns: unspecified
-
Signature:
@Override public Paginated<Dataset> paginate(final Collection<String> columnNames, final int pageSize) -
Parameters:
-
columnNames(Collection<String>) -
pageSize(int)
-
- Returns: unspecified
stream(...) -> Stream<T>
-
Signature:
@Override public <T> Stream<T> stream(final String columnName) -
Parameters:
-
columnName(String)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final String columnName) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnName(String)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public <T> Stream<T> stream(final Class<? extends T> rowType) -
Parameters:
-
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final IntFunction<? extends T> rowSupplier) -
Parameters:
-
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final IntFunction<? extends T> rowSupplier) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowSupplier(IntFunction<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Collection<String> columnNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) -
Parameters:
-
columnNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Map<String, String> prefixAndFieldNameMap, final Class<? extends T> rowType) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
prefixAndFieldNameMap(Map<String, String>) -
rowType(Class<? extends T>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public <T> Stream<T> stream(final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) -
Parameters:
-
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Collection<String> columnNames, final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) -
Parameters:
-
columnNames(Collection<String>) -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) throws IllegalArgumentException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>)
-
- Returns: unspecified
-
Throws:
-
java.lang.IllegalArgumentException
-
-
Signature:
@Override public <T> Stream<T> stream(final Tuple2<String, String> columnNames, final BiFunction<?, ?, ? extends T> rowMapper) -
Parameters:
-
columnNames(Tuple2<String, String>) -
rowMapper(BiFunction<?, ?, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Tuple2<String, String> columnNames, final BiFunction<?, ?, ? extends T> rowMapper) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple2<String, String>) -
rowMapper(BiFunction<?, ?, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final Tuple3<String, String, String> columnNames, final TriFunction<?, ?, ?, ? extends T> rowMapper) -
Parameters:
-
columnNames(Tuple3<String, String, String>) -
rowMapper(TriFunction<?, ?, ?, ? extends T>)
-
- Returns: unspecified
-
Signature:
@Override public <T> Stream<T> stream(final int fromRowIndex, final int toRowIndex, final Tuple3<String, String, String> columnNames, final TriFunction<?, ?, ?, ? extends T> rowMapper) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Tuple3<String, String, String>) -
rowMapper(TriFunction<?, ?, ?, ? extends T>)
-
- Returns: unspecified
apply(...) -> R
-
Signature:
@Override public <R, E extends Exception> R apply(final Throwables.Function<? super Dataset, ? extends R, E> func) throws E -
Parameters:
-
func(Throwables.Function<? super Dataset, ? extends R, E>)
-
- Returns: unspecified
-
Throws:
-
E
-
applyIfNotEmpty(...) -> Optional<R>
-
Signature:
@Override public <R, E extends Exception> Optional<R> applyIfNotEmpty(final Throwables.Function<? super Dataset, ? extends R, E> func) throws E -
Parameters:
-
func(Throwables.Function<? super Dataset, ? extends R, E>)
-
- Returns: unspecified
-
Throws:
-
E
-
accept(...) -> void
-
Signature:
@Override public <E extends Exception> void accept(final Throwables.Consumer<? super Dataset, E> action) throws E -
Parameters:
-
action(Throwables.Consumer<? super Dataset, E>)
-
-
Throws:
-
E
-
acceptIfNotEmpty(...) -> OrElse
-
Signature:
@Override public <E extends Exception> OrElse acceptIfNotEmpty(final Throwables.Consumer<? super Dataset, E> action) throws E -
Parameters:
-
action(Throwables.Consumer<? super Dataset, E>)
-
- Returns: unspecified
-
Throws:
-
E
-
freeze(...) -> void
-
Signature:
@Override public void freeze() -
Parameters:
- (none)
isFrozen(...) -> boolean
-
Signature:
@Override public boolean isFrozen() -
Parameters:
- (none)
- Returns: unspecified
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() -
Parameters:
- (none)
- Returns: unspecified
trimToSize(...) -> void
-
Signature:
@Override public void trimToSize() -
Parameters:
- (none)
size(...) -> int
-
Signature:
@Override public int size() -
Parameters:
- (none)
- Returns: unspecified
clear(...) -> void
-
Signature:
@Override public void clear() -
Parameters:
- (none)
getProperties(...) -> Map<String, Object>
-
Signature:
@Override public Map<String, Object> getProperties() -
Parameters:
- (none)
- Returns: unspecified
setProperties(...) -> void
-
Signature:
@Override public void setProperties(final Map<String, ?> properties) -
Parameters:
-
properties(Map<String, ?>)
-
println(...) -> void
-
Signature:
@Override public void println() -
Parameters:
- (none)
-
Signature:
@Override public void println(String prefix) -
Parameters:
-
prefix(String)
-
-
Signature:
@Override public void println(final int fromRowIndex, final int toRowIndex) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int)
-
-
Signature:
@Override public void println(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames) -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>)
-
-
Signature:
@Override public void println(final Appendable output) throws UncheckedIOException -
Parameters:
-
output(Appendable)
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void println(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final Appendable output) throws IllegalArgumentException, UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
output(Appendable)
-
-
Throws:
-
java.lang.IllegalArgumentException -
com.landawn.abacus.exception.UncheckedIOException
-
-
Signature:
@Override public void println(final int fromRowIndex, final int toRowIndex, final Collection<String> columnNames, final String prefix, final Appendable output) throws IllegalArgumentException, UncheckedIOException -
Parameters:
-
fromRowIndex(int) -
toRowIndex(int) -
columnNames(Collection<String>) -
prefix(String) -
output(Appendable)
-
-
Throws:
-
java.lang.IllegalArgumentException -
com.landawn.abacus.exception.UncheckedIOException
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() -
Parameters:
- (none)
- Returns: unspecified
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) -
Parameters:
-
obj(Object)
-
- Returns: unspecified
toString(...) -> String
-
Signature:
@Override public String toString() -
Parameters:
- (none)
- Returns: unspecified
Class Script (com.landawn.abacus.util.Script)
A placeholder class for script execution functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class SecurityUtil (com.landawn.abacus.util.SecurityUtil)
A utility class for security-related operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Seid (com.landawn.abacus.util.Seid)
Simple Entity ID (Seid) - A flexible entity identifier implementation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Seid
-
Signature:
@Deprecated @Internal public static Seid of(final String entityName) - Summary: Creates a new Seid with the specified entity name.
-
Parameters:
-
entityName(String) — the name of the entity
-
- Returns: a new Seid instance
-
Signature:
public static Seid of(final String propName, final Object propValue) - Summary: Creates a new Seid with a single property-value pair.
-
Parameters:
-
propName(String) — the property name -
propValue(Object) — the property value
-
- Returns: a new Seid instance
-
Signature:
public static Seid of(final String propName1, final Object propValue1, final String propName2, final Object propValue2) - Summary: Creates a new Seid with two property-value pairs.
-
Parameters:
-
propName1(String) — the first property name -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value
-
- Returns: a new Seid instance
-
Signature:
public static Seid of(final String propName1, final Object propValue1, final String propName2, final Object propValue2, final String propName3, final Object propValue3) - Summary: Creates a new Seid with three property-value pairs.
-
Parameters:
-
propName1(String) — the first property name -
propValue1(Object) — the first property value -
propName2(String) — the second property name -
propValue2(Object) — the second property value -
propName3(String) — the third property name -
propValue3(Object) — the third property value
-
- Returns: a new Seid instance
create(...) -> Seid
-
Signature:
public static Seid create(final Map<String, Object> nameValues) - Summary: Creates a new Seid from a map of property names to values.
-
Parameters:
-
nameValues(Map<String, Object>) — a map of property names to their values
-
- Returns: a new Seid instance
-
Signature:
public static Seid create(final Object entity) - Summary: Creates a new Seid from an entity object by extracting its ID properties.
-
Contract:
- The entity class must have properties annotated as ID fields.
-
Parameters:
-
entity(Object) — the entity object to extract ID from
-
- Returns: a new Seid containing the entity's ID properties
-
Signature:
public static Seid create(final Object entity, final Collection<String> idPropNames) - Summary: Creates a new Seid from an entity object using specified property names as IDs.
-
Parameters:
-
entity(Object) — the entity object to extract values from -
idPropNames(Collection<String>) — the names of properties to use as ID
-
- Returns: a new Seid containing the specified properties
Public Instance Methods
<init>(...) -> void
-
Signature:
@Deprecated @Internal public Seid(final String entityName) - Summary: Creates a new Seid with the specified entity name.
-
Parameters:
-
entityName(String) — the name of the entity
-
-
Signature:
public Seid(final String propName, final Object propValue) - Summary: Creates a new Seid with a single property-value pair.
-
Parameters:
-
propName(String) — the property name (can be canonical like "Entity.property" or simple like "property") -
propValue(Object) — the property value
-
-
Signature:
public Seid(final Map<String, Object> nameValues) - Summary: Creates a new Seid from a map of property names to values.
-
Parameters:
-
nameValues(Map<String, Object>) — a map of property names to their values
-
entityName(...) -> String
-
Signature:
@Override public String entityName() - Summary: Returns the entity name associated with this Seid.
-
Parameters:
- (none)
- Returns: the entity name
get(...) -> T
-
Signature:
@SuppressWarnings("unchecked") @Override public <T> T get(final String propName) - Summary: Gets the value of the specified property.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value, or {@code null} if not found
-
Signature:
@Override public <T> T get(final String propName, final Class<? extends T> targetType) - Summary: Gets the value of the specified property, converting it to the target type if necessary.
-
Contract:
- Gets the value of the specified property, converting it to the target type if necessary.
- Returns the default value for the target type if the property value is {@code null} .
-
Parameters:
-
propName(String) — the property name -
targetType(Class<? extends T>) — the class of the target type
-
- Returns: the property value converted to the target type
getInt(...) -> int
-
Signature:
@Override public int getInt(final String propName) - Summary: Gets the value of the specified property as an int.
-
Contract:
- Performs automatic conversion if the stored value is not an int.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value as an int
getLong(...) -> long
-
Signature:
@Override public long getLong(final String propName) - Summary: Gets the value of the specified property as a long.
-
Contract:
- Performs automatic conversion if the stored value is not a long.
-
Parameters:
-
propName(String) — the property name
-
- Returns: the property value as a long
set(...) -> Seid
-
Signature:
@Deprecated @Internal public Seid set(final String propName, final Object propValue) - Summary: Sets a property value in this Seid.
-
Parameters:
-
propName(String) — the property name -
propValue(Object) — the property value
-
- Returns: this Seid instance for method chaining
-
Signature:
@Deprecated @Internal public void set(final Map<String, Object> nameValues) - Summary: Sets multiple property values in this Seid.
-
Parameters:
-
nameValues(Map<String, Object>) — a map of property names to their values
-
containsKey(...) -> boolean
-
Signature:
@Override public boolean containsKey(final String propName) - Summary: Checks if this Seid contains the specified property.
-
Contract:
- Checks if this Seid contains the specified property.
-
Parameters:
-
propName(String) — the property name to check
-
- Returns: {@code true} if the property exists, {@code false} otherwise
keySet(...) -> Set<String>
-
Signature:
@Override public Set<String> keySet() - Summary: Returns a set view of the property names in this Seid.
-
Parameters:
- (none)
- Returns: a set view of the property names
entrySet(...) -> Set<Entry<String, Object>>
-
Signature:
@Override public Set<Entry<String, Object>> entrySet() - Summary: Returns a set view of the property entries in this Seid.
-
Parameters:
- (none)
- Returns: a set view of the property entries
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of properties in this Seid.
-
Parameters:
- (none)
- Returns: the number of properties
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Checks if this Seid contains no properties.
-
Contract:
- Checks if this Seid contains no properties.
-
Parameters:
- (none)
- Returns: {@code true} if this Seid contains no properties, {@code false} otherwise
clear(...) -> void
-
Signature:
@Deprecated @Internal public void clear() - Summary: Removes all properties from this Seid.
-
Parameters:
- (none)
copy(...) -> Seid
-
Signature:
@Deprecated @Internal public Seid copy() - Summary: Creates a copy of this Seid.
-
Parameters:
- (none)
- Returns: a copy of this Seid
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this Seid is equal to another object.
-
Contract:
- Checks if this Seid is equal to another object.
- Two Seids are equal if they have the same string representation.
-
Parameters:
-
obj(Object) — the object to compare with
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Seid.
-
Parameters:
- (none)
- Returns: a hash code value
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Seid.
-
Parameters:
- (none)
- Returns: a string representation of this Seid
Class Seq (com.landawn.abacus.util.Seq)
A sequence class that represents a lazy, functional sequence of elements supporting both intermediate and terminal operations, similar to Java Streams but with support for checked exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> empty() - Summary: Returns an empty {@code Seq} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code Seq} .
- See also: #of(Object...)
defer(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> defer(final Supplier<? extends Seq<? extends T, ? extends E>> supplier) throws IllegalArgumentException - Summary: Returns a {@code Seq} that is lazily populated by the provided supplier.
-
Contract:
- The supplier is invoked only when a terminal operation is performed on the sequence.
-
Parameters:
-
supplier(Supplier<? extends Seq<? extends T, ? extends E>>) — a supplier that provides the sequence when invoked. Must not be {@code null} .
-
- Returns: a lazily populated {@code Seq} .
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null} .
-
- See also: #just(Object)
just(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> just(final T e) - Summary: Returns a {@code Seq} containing a single element.
-
Parameters:
-
e(T) — the single element to be contained in the sequence.
-
- Returns: a {@code Seq} containing the specified element.
- See also: #of(Object...), #ofNullable(Object)
-
Signature:
public static <T, E extends Exception> Seq<T, E> just(final T e, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing a single element with the specified exception type.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Explicitly specify exception type for type inference Seq<String, IOException> seq = Seq.just("hello", IOException.class); // Useful when the exception type needs to be explicit } </pre>
-
Parameters:
-
e(T) — the single element to be contained in the sequence. -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only).
-
- Returns: a {@code Seq} containing the specified element.
- See also: #just(Object)
ofNullable(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> ofNullable(final T e) - Summary: Returns a {@code Seq} containing the specified element if it is not {@code null} , otherwise returns an empty {@code Seq} .
-
Contract:
- Returns a {@code Seq} containing the specified element if it is not {@code null} , otherwise returns an empty {@code Seq} .
-
Parameters:
-
e(T) — the element to be contained in the sequence if not {@code null} .
-
- Returns: a {@code Seq} containing the element if not {@code null} , otherwise an empty {@code Seq} .
- See also: #just(Object), #empty()
-
Signature:
public static <T, E extends Exception> Seq<T, E> ofNullable(final T e, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing the specified element if it is not {@code null} , otherwise returns an empty {@code Seq} .
-
Contract:
- Returns a {@code Seq} containing the specified element if it is not {@code null} , otherwise returns an empty {@code Seq} .
-
Parameters:
-
e(T) — the element to be contained in the sequence if not {@code null} . -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only).
-
- Returns: a {@code Seq} containing the element if not {@code null} , otherwise an empty {@code Seq} .
- See also: #ofNullable(Object)
of(...) -> Seq<T, E>
-
Signature:
@SafeVarargs public static <T, E extends Exception> Seq<T, E> of(final T... a) - Summary: Returns a {@code Seq} containing the specified elements.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(T[]) — the array of elements to be contained in the sequence.
-
- Returns: a {@code Seq} containing the specified elements, or an empty sequence if the array is {@code null} or empty.
- See also: #just(Object), #just(Object, Class)
-
Signature:
public static <E extends Exception> Seq<Boolean, E> of(final boolean[] a) - Summary: Returns a {@code Seq} containing the elements from the specified boolean array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(boolean[]) — the boolean array to create the sequence from.
-
- Returns: a {@code Seq<Boolean, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Character, E> of(final char[] a) - Summary: Returns a {@code Seq} containing the elements from the specified char array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(char[]) — the char array to create the sequence from.
-
- Returns: a {@code Seq<Character, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Byte, E> of(final byte[] a) - Summary: Returns a {@code Seq} containing the elements from the specified byte array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(byte[]) — the byte array to create the sequence from.
-
- Returns: a {@code Seq<Byte, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Short, E> of(final short[] a) - Summary: Returns a {@code Seq} containing the elements from the specified short array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(short[]) — the short array to create the sequence from.
-
- Returns: a {@code Seq<Short, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Integer, E> of(final int[] a) - Summary: Returns a {@code Seq} containing the elements from the specified int array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(int[]) — the int array to create the sequence from.
-
- Returns: a {@code Seq<Integer, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Long, E> of(final long[] a) - Summary: Returns a {@code Seq} containing the elements from the specified long array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(long[]) — the long array to create the sequence from.
-
- Returns: a {@code Seq<Long, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Float, E> of(final float[] a) - Summary: Returns a {@code Seq} containing the elements from the specified float array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(float[]) — the float array to create the sequence from.
-
- Returns: a {@code Seq<Float, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <E extends Exception> Seq<Double, E> of(final double[] a) - Summary: Returns a {@code Seq} containing the elements from the specified double array.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
a(double[]) — the double array to create the sequence from.
-
- Returns: a {@code Seq<Double, E>} containing the elements from the array, or an empty sequence if the array is {@code null} or empty.
- See also: #of(Object...)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Optional<T> op) - Summary: Returns a {@code Seq} containing the value from the specified Optional if present, otherwise returns an empty {@code Seq} .
-
Contract:
- Returns a {@code Seq} containing the value from the specified Optional if present, otherwise returns an empty {@code Seq} .
-
Parameters:
-
op(Optional<T>) — the Optional to create the sequence from.
-
- Returns: a {@code Seq} containing the Optional value if present, otherwise an empty sequence.
- See also: #of(java.util.Optional), #ofNullable(Object)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final java.util.Optional<T> op) - Summary: Returns a {@code Seq} containing the value from the specified java.util.Optional if present, otherwise returns an empty {@code Seq} .
-
Contract:
- Returns a {@code Seq} containing the value from the specified java.util.Optional if present, otherwise returns an empty {@code Seq} .
-
Parameters:
-
op(java.util.Optional<T>) — the java.util.Optional to create the sequence from.
-
- Returns: a {@code Seq} containing the Optional value if present, otherwise an empty sequence.
- See also: #of(Optional), #ofNullable(Object)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Iterable<? extends T> iterable) - Summary: Returns a {@code Seq} containing all elements from the specified Iterable.
-
Contract:
- If the Iterable is {@code null} , an empty sequence is returned.
-
Parameters:
-
iterable(Iterable<? extends T>) — the Iterable to create the sequence from.
-
- Returns: a {@code Seq} containing all elements from the Iterable, or an empty sequence if the Iterable is {@code null} .
- See also: #of(Iterator), #of(Object...)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Iterable<? extends T> iterable, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing all elements from the specified Iterable.
-
Contract:
- If the Iterable is {@code null} , an empty sequence is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code List<String> list = Arrays.asList("a", "b", "c"); Seq<String, IOException> seq = Seq.of(list, IOException.class); // Useful when you need to specify the exception type explicitly } </pre>
-
Parameters:
-
iterable(Iterable<? extends T>) — the Iterable to create the sequence from. -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only).
-
- Returns: a {@code Seq} containing all elements from the Iterable, or an empty sequence if the Iterable is {@code null} .
- See also: #of(Iterable)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Iterator<? extends T> iter) - Summary: Returns a {@code Seq} containing all elements from the specified Iterator.
-
Contract:
- If the Iterator is {@code null} , an empty sequence is returned.
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to create the sequence from.
-
- Returns: a {@code Seq} containing all elements from the Iterator, or an empty sequence if the Iterator is {@code null} .
- See also: #of(Iterable), #of(Throwables.Iterator)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Throwables.Iterator<? extends T, ? extends E> iter) - Summary: Returns a {@code Seq} containing all elements from the specified Throwables.Iterator.
-
Contract:
- If the Iterator is {@code null} , an empty sequence is returned.
-
Parameters:
-
iter(Throwables.Iterator<? extends T, ? extends E>) — the Throwables.Iterator to create the sequence from.
-
- Returns: a {@code Seq} containing all elements from the Iterator, or an empty sequence if the Iterator is {@code null} .
- See also: #of(Iterator)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Iterator<? extends T> iter, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing all elements from the specified Iterator.
-
Contract:
- If the Iterator is {@code null} , an empty sequence is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Iterator<String> iterator = list.iterator(); Seq<String, SQLException> seq = Seq.of(iterator, SQLException.class); // Useful when you need to specify the exception type explicitly } </pre>
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to create the sequence from -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only)
-
- Returns: a {@code Seq} containing all elements from the Iterator, or an empty sequence if the Iterator is {@code null} .
- See also: #of(Iterator)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Enumeration<? extends T> enumeration) - Summary: Returns a {@code Seq} containing all elements from the specified Enumeration.
-
Contract:
- If the Enumeration is {@code null} , an empty sequence is returned.
-
Parameters:
-
enumeration(Enumeration<? extends T>) — the Enumeration to create the sequence from
-
- Returns: a {@code Seq} containing all elements from the Enumeration, or an empty sequence if the Enumeration is {@code null} .
- See also: #of(Enumeration, Class), #of(Iterator)
-
Signature:
public static <T, E extends Exception> Seq<T, E> of(final Enumeration<? extends T> enumeration, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing all elements from the specified Enumeration.
-
Contract:
- If the Enumeration is {@code null} , an empty sequence is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Enumeration<String> enumeration = Collections.enumeration(list); Seq<String, IOException> seq = Seq.of(enumeration, IOException.class); // Useful when you need to specify the exception type explicitly } </pre>
-
Parameters:
-
enumeration(Enumeration<? extends T>) — the Enumeration to create the sequence from -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only)
-
- Returns: a {@code Seq} containing all elements from the Enumeration, or an empty sequence if the Enumeration is {@code null} .
- See also: #of(Enumeration)
-
Signature:
public static <K, V, E extends Exception> Seq<Map.Entry<K, V>, E> of(final Map<K, V> m) - Summary: Returns a {@code Seq} containing all entries from the specified Map.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
m(Map<K, V>) — the Map to create the sequence from.
-
- Returns: a {@code Seq<Map.Entry<K, V>, E>} containing all entries from the Map, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofKeys(Map), #ofValues(Map)
-
Signature:
public static <K, V, E extends Exception> Seq<Map.Entry<K, V>, E> of(final Map<K, V> m, @SuppressWarnings("unused") final Class<E> exceptionType) - Summary: Returns a {@code Seq} containing all entries from the specified Map.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map<String, Integer> map = new HashMap<>(); map.put("a", 1); Seq<Map.Entry<String, Integer>, SQLException> seq = Seq.of(map, SQLException.class); // Useful when you need to specify the exception type explicitly } </pre>
-
Parameters:
-
m(Map<K, V>) — the Map to create the sequence from -
exceptionType(@SuppressWarnings(value = "unused") Class<E>) — the class of exception type (used for type inference only)
-
- Returns: a {@code Seq<Map.Entry<K, V>, E>} containing all entries from the Map, or an empty sequence if the Map is {@code null} or empty.
- See also: #of(Map)
ofKeys(...) -> Seq<K, E>
-
Signature:
public static <K, E extends Exception> Seq<K, E> ofKeys(final Map<K, ?> map) - Summary: Returns a {@code Seq} containing all keys from the specified Map.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<K, ?>) — the Map whose keys will be used to create the sequence.
-
- Returns: a {@code Seq<K, E>} containing all keys from the Map, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofValues(Map), #of(Map)
-
Signature:
public static <K, V, E extends Exception> Seq<K, E> ofKeys(final Map<K, V> map, final Throwables.Predicate<? super V, E> valueFilter) - Summary: Returns a {@code Seq} containing keys from the specified Map where the corresponding values satisfy the given predicate.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<K, V>) — the Map to filter. -
valueFilter(Throwables.Predicate<? super V, E>) — the predicate to test the values. Must not be {@code null} .
-
- Returns: a {@code Seq<K, E>} containing keys whose values satisfy the predicate, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofKeys(Map), #ofKeys(Map, Throwables.BiPredicate)
-
Signature:
public static <K, V, E extends Exception> Seq<K, E> ofKeys(final Map<K, V> map, final Throwables.BiPredicate<? super K, ? super V, E> filter) - Summary: Returns a {@code Seq} containing keys from the specified Map where the key-value pairs satisfy the given bi-predicate.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<K, V>) — the Map to filter. -
filter(Throwables.BiPredicate<? super K, ? super V, E>) — the bi-predicate to test the key-value pairs. Must not be {@code null} .
-
- Returns: a {@code Seq<K, E>} containing keys that satisfy the bi-predicate, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofKeys(Map, Throwables.Predicate), #ofValues(Map, Throwables.BiPredicate)
ofValues(...) -> Seq<V, E>
-
Signature:
public static <V, E extends Exception> Seq<V, E> ofValues(final Map<?, V> map) - Summary: Returns a {@code Seq} containing all values from the specified Map.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<?, V>) — the Map whose values will be used to create the sequence.
-
- Returns: a {@code Seq<V, E>} containing all values from the Map, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofKeys(Map), #of(Map)
-
Signature:
public static <K, V, E extends Exception> Seq<V, E> ofValues(final Map<K, V> map, final Throwables.Predicate<? super K, E> keyFilter) - Summary: Returns a {@code Seq} containing values from the specified Map where the corresponding keys satisfy the given predicate.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<K, V>) — the Map to filter. -
keyFilter(Throwables.Predicate<? super K, E>) — the predicate to test the keys. Must not be {@code null} .
-
- Returns: a {@code Seq<V, E>} containing values whose keys satisfy the predicate, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofValues(Map), #ofValues(Map, Throwables.BiPredicate)
-
Signature:
public static <K, V, E extends Exception> Seq<V, E> ofValues(final Map<K, V> map, final Throwables.BiPredicate<? super K, ? super V, E> filter) - Summary: Returns a {@code Seq} containing values from the specified Map where the key-value pairs satisfy the given bi-predicate.
-
Contract:
- If the Map is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
map(Map<K, V>) — the Map to filter. -
filter(Throwables.BiPredicate<? super K, ? super V, E>) — the bi-predicate to test the key-value pairs. Must not be {@code null} .
-
- Returns: a {@code Seq<V, E>} containing values that satisfy the bi-predicate, or an empty sequence if the Map is {@code null} or empty.
- See also: #ofValues(Map, Throwables.Predicate), #ofKeys(Map, Throwables.BiPredicate)
ofReversed(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> ofReversed(final T[] array) - Summary: Returns a {@code Seq} containing the elements from the specified array in reverse order.
-
Contract:
- If the array is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
array(T[]) — the array whose elements will be reversed.
-
- Returns: a {@code Seq} containing the array elements in reverse order, or an empty sequence if the array is {@code null} or empty.
- See also: #ofReversed(List), #of(Object...)
-
Signature:
public static <T, E extends Exception> Seq<T, E> ofReversed(final List<? extends T> list) - Summary: Returns a {@code Seq} containing the elements from the specified list in reverse order.
-
Contract:
- If the list is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
list(List<? extends T>) — the list whose elements will be reversed.
-
- Returns: a {@code Seq} containing the list elements in reverse order, or an empty sequence if the list is {@code null} or empty.
- See also: #ofReversed(Object\[\]), #of(Iterable)
repeat(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> repeat(final T element, final long n) throws IllegalArgumentException - Summary: Returns a {@code Seq} that repeats the given element for the specified number of times.
-
Contract:
- If n is 0, an empty sequence is returned.
-
Parameters:
-
element(T) — the element to repeat. -
n(long) — the number of times to repeat the element. Must not be negative.
-
- Returns: a {@code Seq} containing the element repeated n times, or an empty sequence if n is 0.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
- See also: #range(int, int)
range(...) -> Seq<Integer, E>
-
Signature:
@SuppressWarnings("deprecation") public static <E extends Exception> Seq<Integer, E> range(final int startInclusive, final int endExclusive) - Summary: Returns a {@code Seq} containing a range of integers from startInclusive (inclusive) to endExclusive (exclusive) with increment of 1.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive). -
endExclusive(int) — the ending value (exclusive).
-
- Returns: a {@code Seq<Integer, E>} containing the range of integers, or an empty sequence if {@code endExclusive <= startInclusive} .
- See also: #range(int, int, int), #rangeClosed(int, int)
-
Signature:
@SuppressWarnings("deprecation") public static <E extends Exception> Seq<Integer, E> range(final int startInclusive, final int endExclusive, final int by) - Summary: Returns a {@code Seq} containing a range of integers from startInclusive (inclusive) to endExclusive (exclusive) with the specified increment.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive). -
endExclusive(int) — the ending value (exclusive). -
by(int) — the increment value. Can be negative for descending ranges, but must not be zero.
-
- Returns: a {@code Seq<Integer, E>} containing the range of integers with the specified step.
- See also: #range(int, int), #rangeClosed(int, int, int)
rangeClosed(...) -> Seq<Integer, E>
-
Signature:
@SuppressWarnings("deprecation") public static <E extends Exception> Seq<Integer, E> rangeClosed(final int startInclusive, final int endInclusive) - Summary: Returns a {@code Seq} containing a range of integers from startInclusive (inclusive) to endInclusive (inclusive) with increment of 1.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive). -
endInclusive(int) — the ending value (inclusive).
-
- Returns: a {@code Seq<Integer, E>} containing the range of integers from start to end inclusive.
- See also: #range(int, int), #rangeClosed(int, int, int)
-
Signature:
@SuppressWarnings("deprecation") public static <E extends Exception> Seq<Integer, E> rangeClosed(final int startInclusive, final int endInclusive, final int by) - Summary: Returns a {@code Seq} containing a range of integers from startInclusive (inclusive) to endInclusive (inclusive) with the specified increment.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive). -
endInclusive(int) — the ending value (inclusive). -
by(int) — the increment value. Can be negative for descending ranges, but must not be zero.
-
- Returns: a {@code Seq<Integer, E>} containing the range of integers from start to end inclusive with the specified step.
- See also: #rangeClosed(int, int), #range(int, int, int)
split(...) -> Seq<String, E>
-
Signature:
public static <E extends Exception> Seq<String, E> split(final CharSequence str, final char delimiter) - Summary: Splits the given character sequence into a sequence of strings based on the specified delimiter character.
-
Contract:
- If the string is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
str(CharSequence) — the character sequence to split. -
delimiter(char) — the delimiter character to use for splitting.
-
- Returns: a {@code Seq<String, E>} containing the split strings, or an empty sequence if the string is {@code null} or empty.
- See also: #split(CharSequence, CharSequence), #split(CharSequence, Pattern), #splitToLines(String)
-
Signature:
public static <E extends Exception> Seq<String, E> split(final CharSequence str, final CharSequence delimiter) - Summary: Splits the given character sequence into a sequence of strings based on the specified delimiter string.
-
Contract:
- If the string is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
str(CharSequence) — the character sequence to split. -
delimiter(CharSequence) — the delimiter string to use for splitting.
-
- Returns: a {@code Seq<String, E>} containing the split strings, or an empty sequence if the string is {@code null} or empty.
- See also: #split(CharSequence, char), #split(CharSequence, Pattern), #splitToLines(String)
-
Signature:
public static <E extends Exception> Seq<String, E> split(final CharSequence str, final Pattern pattern) - Summary: Splits the given character sequence into a sequence of strings based on the specified pattern.
-
Contract:
- If the string is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
str(CharSequence) — the character sequence to split. -
pattern(Pattern) — the regex pattern to use for splitting. Must not be {@code null} .
-
- Returns: a {@code Seq<String, E>} containing the split strings, or an empty sequence if the string is {@code null} or empty.
- See also: #split(CharSequence, char), #split(CharSequence, CharSequence), #splitToLines(String)
splitToLines(...) -> Seq<String, E>
-
Signature:
public static <E extends Exception> Seq<String, E> splitToLines(final String str) - Summary: Splits the given string into a sequence of lines.
-
Contract:
- If the string is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
str(String) — the string to split into lines.
-
- Returns: a {@code Seq<String, E>} containing the lines, or an empty sequence if the string is {@code null} or empty.
- See also: #splitToLines(String, boolean, boolean), #ofLines(File)
-
Signature:
public static <E extends Exception> Seq<String, E> splitToLines(final String str, final boolean trim, final boolean omitEmptyLines) - Summary: Splits the given string into a sequence of lines with optional trimming and omission of empty lines.
-
Contract:
- If the string is {@code null} or empty, an empty sequence is returned.
-
Parameters:
-
str(String) — the string to split into lines. -
trim(boolean) — if {@code true} , trims whitespace from the beginning and end of each line. -
omitEmptyLines(boolean) — if {@code true} , omits empty lines (or whitespace-only lines if trim is {@code true} ) from the result.
-
- Returns: a {@code Seq<String, E>} containing the processed lines, or an empty sequence if the string is {@code null} or empty.
- See also: #splitToLines(String), #ofLines(File)
splitByChunkCount(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> splitByChunkCount(final int totalSize, final int maxChunkCount, final Throwables.IntBiFunction<? extends T, ? extends E> mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The length of returned sequence may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
mapper(Throwables.IntBiFunction<? extends T, ? extends E>) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: a sequence of the mapped chunk values
- See also: #splitByChunkCount(int, int, boolean, Throwables.IntBiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> splitByChunkCount(final int totalSize, final int maxChunkCount, final boolean sizeSmallerFirst, final Throwables.IntBiFunction<? extends T, ? extends E> mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The length of returned sequence may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
sizeSmallerFirst(boolean) — if {@code true} , smaller chunks will be created first; otherwise, larger chunks will be created first -
mapper(Throwables.IntBiFunction<? extends T, ? extends E>) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: a sequence of the mapped chunk values
- See also: Stream#splitByChunkCount(int, int, boolean, IntBiFunction)
ofLines(...) -> Seq<String, IOException>
-
Signature:
public static Seq<String, IOException> ofLines(final File file) - Summary: Creates a {@code Seq} that reads lines from the specified file using the default charset.
-
Contract:
- The file resources are automatically closed when the sequence is closed or fully consumed.
-
Parameters:
-
file(File) — the file to read lines from. Must not be {@code null} .
-
- Returns: a {@code Seq<String, IOException>} containing the lines of the file.
- See also: #ofLines(File, Charset), #ofLines(Path), #splitToLines(String)
-
Signature:
public static Seq<String, IOException> ofLines(final File file, final Charset charset) throws IllegalArgumentException - Summary: Creates a {@code Seq} that reads lines from the specified file using the given charset.
-
Contract:
- The file resources are automatically closed when the sequence is closed or fully consumed.
-
Parameters:
-
file(File) — the file to read lines from. Must not be {@code null} . -
charset(Charset) — the charset to use for decoding the file. Must not be {@code null} .
-
- Returns: a {@code Seq<String, IOException>} containing the lines of the file.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code file} is {@code null} .
-
- See also: #ofLines(File), #ofLines(Path, Charset)
-
Signature:
public static Seq<String, IOException> ofLines(final Path path) - Summary: Creates a {@code Seq} that reads lines from the specified path using the default charset.
-
Contract:
- The file resources are automatically closed when the sequence is closed or fully consumed.
-
Parameters:
-
path(Path) — the path to read lines from. Must not be {@code null} .
-
- Returns: a {@code Seq<String, IOException>} containing the lines of the file.
- See also: #ofLines(Path, Charset), #ofLines(File)
-
Signature:
public static Seq<String, IOException> ofLines(final Path path, final Charset charset) throws IllegalArgumentException - Summary: Creates a {@code Seq} that reads lines from the specified path using the given charset.
-
Contract:
- The file resources are automatically closed when the sequence is closed or fully consumed.
-
Parameters:
-
path(Path) — the path to read lines from. Must not be {@code null} . -
charset(Charset) — the charset to use for decoding the file. Must not be {@code null} .
-
- Returns: a {@code Seq<String, IOException>} containing the lines of the file.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code path} is {@code null} .
-
- See also: #ofLines(Path), #ofLines(File, Charset)
-
Signature:
public static Seq<String, IOException> ofLines(final Reader reader) throws IllegalArgumentException - Summary: Creates a {@code Seq} that reads lines from the given Reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Reader reader = new StringReader("line1\\nline2\\nline3"); Seq<String, IOException> lines = Seq.ofLines(reader); // User must close reader after use } </pre>
-
Parameters:
-
reader(Reader) — the Reader to read lines from. Must not be {@code null} .
-
- Returns: a {@code Seq<String, IOException>} containing the lines read from the Reader.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code reader} is {@code null} .
-
- See also: #ofLines(Reader, boolean), #ofLines(File)
-
Signature:
public static Seq<String, IOException> ofLines(final Reader reader, final boolean closeReaderWhenStreamIsClosed) throws IllegalArgumentException - Summary: Creates a {@code Seq} that reads lines from the given Reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Reader will be automatically closed try (Seq<String, IOException> lines = Seq.ofLines(new FileReader("data.txt"), true)) { lines.forEach(System.out::println); } // Reader must be closed manually Reader reader = new StringReader("data"); Seq<String, IOException> lines = Seq.ofLines(reader, false); // ...
-
Parameters:
-
reader(Reader) — the Reader to read lines from. Must not be {@code null} . -
closeReaderWhenStreamIsClosed(boolean) — if {@code true} , the input {@code Reader} will be closed when the sequence is closed.
-
- Returns: a {@code Seq<String, IOException>} containing the lines read from the Reader.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code reader} is {@code null} .
-
- See also: #ofLines(Reader), #ofLines(File)
listFiles(...) -> Seq<File, IOException>
-
Signature:
public static Seq<File, IOException> listFiles(final File parentPath) - Summary: Lists all files in the specified parent directory.
-
Contract:
- If the directory doesn't exist, an empty sequence is returned.
-
Parameters:
-
parentPath(File) — the parent directory to list files from. Must not be {@code null} .
-
- Returns: a {@code Seq<File, IOException>} containing all files in the directory. Returns an empty sequence if the directory doesn't exist or is not a directory.
- See also: #listFiles(File, boolean), File#listFiles()
-
Signature:
public static Seq<File, IOException> listFiles(final File parentPath, final boolean recursively) - Summary: Lists all files in the specified parent directory with optional recursive traversal.
-
Contract:
- If recursively is {@code false} , only immediate children files are listed.
- If recursively is {@code true} , all descendant files are listed in depth-first order.
- Directories are included in the results when recursively is {@code true} .
- The method uses a breadth-first traversal when recursive listing is enabled.
-
Parameters:
-
parentPath(File) — the parent directory to list files from. Must not be {@code null} . -
recursively(boolean) — if {@code true} , lists files recursively in all subdirectories; if {@code false} , lists only immediate children files
-
- Returns: a sequence containing File objects representing the files in the parent directory. Returns an empty sequence if the parent directory doesn't exist or is not a directory. When recursive, the sequence includes both files and directories.
- See also: #listFiles(File), File#listFiles()
concat(...) -> Seq<T, E>
-
Signature:
@SafeVarargs public static <T, E extends Exception> Seq<T, E> concat(final T[]... a) - Summary: Concatenates multiple arrays into a single sequence.
-
Parameters:
-
a(T[][]) — the arrays to be concatenated. Can be empty, contain {@code null} arrays, or be {@code null} itself
-
- Returns: a sequence containing all elements from all provided arrays in order. Returns an empty sequence if no arrays are provided or all arrays are {@code null}
- See also: #concat(Iterable...), #concat(Iterator...), #concat(Seq...)
-
Signature:
@SafeVarargs public static <T, E extends Exception> Seq<T, E> concat(final Iterable<? extends T>... a) - Summary: Concatenates multiple Iterables into a single sequence.
-
Parameters:
-
a(Iterable<? extends T>[]) — the Iterables to be concatenated. Can be empty, contain {@code null} Iterables, or be {@code null} itself
-
- Returns: a sequence containing all elements from all provided Iterables in order. Returns an empty sequence if no Iterables are provided or all Iterables are {@code null}
- See also: #concat(Object\[\]\[\]), #concat(Iterator...), #concat(Seq...)
-
Signature:
@SafeVarargs public static <T, E extends Exception> Seq<T, E> concat(final Iterator<? extends T>... a) - Summary: Concatenates multiple Iterators into a single sequence.
-
Parameters:
-
a(Iterator<? extends T>[]) — the Iterators to be concatenated. Can be empty, contain {@code null} Iterators, or be {@code null} itself
-
- Returns: a sequence containing all elements from all provided Iterators in order. Returns an empty sequence if no Iterators are provided or all Iterators are {@code null}
- See also: #concat(Object\[\]\[\]), #concat(Iterable...), #concat(Seq...)
-
Signature:
@SafeVarargs public static <T, E extends Exception> Seq<T, E> concat(final Seq<? extends T, E>... a) - Summary: Concatenates multiple sequences into a single sequence.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends T, E>[]) — the sequences to be concatenated. Can be empty, contain {@code null} sequences, or be {@code null} itself
-
- Returns: a sequence containing all elements from all provided sequences in order. Returns an empty sequence if no sequences are provided or all sequences are {@code null} . The returned sequence will close all input sequences when it is closed.
- See also: #concat(Collection)
-
Signature:
public static <T, E extends Exception> Seq<T, E> concat(final Collection<? extends Seq<? extends T, E>> c) - Summary: Concatenates a collection of sequences into a single sequence.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
c(Collection<? extends Seq<? extends T, E>>) — the collection of sequences to be concatenated. Can be empty, contain {@code null} sequences, or be {@code null} itself
-
- Returns: a sequence containing all elements from all provided sequences in order. Returns an empty sequence if the collection is empty or {@code null} . The returned sequence will close all input sequences when it is closed.
- See also: #concat(Seq...)
zip(...) -> Seq<T, E>
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final A[] a, final B[] b, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two arrays into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip. Can be {@code null} or empty -
b(B[]) — the second array to zip. Can be {@code null} or empty -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two arrays. Must not be {@code null} . Takes an element from the first array and an element from the second array, and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shorter array's length. Returns an empty sequence if either array is {@code null} or empty
- See also: #zip(Object\[\], Object\[\], Object, Object, Throwables.BiFunction), N#zip(Object\[\], Object\[\], java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final A[] a, final B[] b, final C[] c, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three arrays into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(A[]) — the first array to zip. Can be {@code null} or empty -
b(B[]) — the second array to zip. Can be {@code null} or empty -
c(C[]) — the third array to zip. Can be {@code null} or empty -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three arrays. Must not be {@code null} . Takes an element from each array and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shortest array's length. Returns an empty sequence if any array is {@code null} or empty
- See also: #zip(Object\[\], Object\[\], Throwables.BiFunction), N#zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two iterables into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable to zip. Can be {@code null} or empty -
b(Iterable<? extends B>) — the second iterable to zip. Can be {@code null} or empty -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two iterables. Must not be {@code null} . Takes an element from the first iterable and an element from the second iterable, and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shorter iterable's length. Returns an empty sequence if either iterable is {@code null} or empty
- See also: #zip(Iterator, Iterator, Throwables.BiFunction), N#zip(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three iterables into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable to zip. Can be {@code null} or empty -
b(Iterable<? extends B>) — the second iterable to zip. Can be {@code null} or empty -
c(Iterable<? extends C>) — the third iterable to zip. Can be {@code null} or empty -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three iterables. Must not be {@code null} . Takes an element from each iterable and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shortest iterable's length. Returns an empty sequence if any iterable is {@code null} or empty
- See also: #zip(Iterable, Iterable, Throwables.BiFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two iterators into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator to zip. Can be {@code null} or empty -
b(Iterator<? extends B>) — the second iterator to zip. Can be {@code null} or empty -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two iterators. Must not be {@code null} . Takes an element from the first iterator and an element from the second iterator, and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shorter iterator's length. Returns an empty sequence if either iterator is {@code null} or empty
- See also: #zip(Iterable, Iterable, Throwables.BiFunction), Iterators#zip(Iterable, Iterable, BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three iterators into a single sequence by combining corresponding elements using the provided zip function.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator to zip. Can be {@code null} or empty -
b(Iterator<? extends B>) — the second iterator to zip. Can be {@code null} or empty -
c(Iterator<? extends C>) — the third iterator to zip. Can be {@code null} or empty -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three iterators. Must not be {@code null} . Takes an element from each iterator and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shortest iterator's length. Returns an empty sequence if any iterator is {@code null} or empty
- See also: #zip(Iterator, Iterator, Throwables.BiFunction), Iterators#zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Seq<? extends A, E> a, final Seq<? extends B, E> b, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two sequences into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends A, E>) — the first sequence to zip. Can be {@code null} or empty -
b(Seq<? extends B, E>) — the second sequence to zip. Can be {@code null} or empty -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two sequences. Must not be {@code null} . Takes an element from the first sequence and an element from the second sequence, and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shorter sequence's length. Returns an empty sequence if either sequence is {@code null} or empty. The returned sequence will close both input sequences when it is closed.
- See also: #zip(Seq, Seq, Object, Object, Throwables.BiFunction), N#zip(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Seq<? extends A, E> a, final Seq<? extends B, E> b, final Seq<? extends C, E> c, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three sequences into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends A, E>) — the first sequence to zip. Can be {@code null} or empty -
b(Seq<? extends B, E>) — the second sequence to zip. Can be {@code null} or empty -
c(Seq<? extends C, E>) — the third sequence to zip. Can be {@code null} or empty -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three sequences. Must not be {@code null} . Takes an element from each sequence and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the shortest sequence's length. Returns an empty sequence if any sequence is {@code null} or empty. The returned sequence will close all input sequences when it is closed.
- See also: #zip(Seq, Seq, Throwables.BiFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two arrays into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one array is shorter than the other, the provided default values are used for the missing elements.
-
Parameters:
-
a(A[]) — the first array to zip. Can be {@code null} or empty -
b(B[]) — the second array to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first array runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second array runs out of elements. Can be {@code null} -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two arrays. Must not be {@code null} . Takes an element (or default value) from each array and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longer array's length
- See also: #zip(Object\[\], Object\[\], Throwables.BiFunction), N#zip(Object\[\], Object\[\], Object, Object, java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three arrays into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one array is shorter than the others, the provided default values are used for the missing elements.
-
Parameters:
-
a(A[]) — the first array to zip. Can be {@code null} or empty -
b(B[]) — the second array to zip. Can be {@code null} or empty -
c(C[]) — the third array to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first array runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second array runs out of elements. Can be {@code null} -
valueForNoneC(C) — the default value to use when the third array runs out of elements. Can be {@code null} -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three arrays. Must not be {@code null} . Takes an element (or default value) from each array and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longest array's length
- See also: #zip(Object\[\], Object\[\], Object\[\], Throwables.TriFunction), N#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two iterables into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one iterable is shorter than the other, the provided default values are used for the missing elements.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable to zip. Can be {@code null} or empty -
b(Iterable<? extends B>) — the second iterable to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first iterable runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second iterable runs out of elements. Can be {@code null} -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two iterables. Must not be {@code null} . Takes an element (or default value) from each iterable and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longer iterable's length
- See also: #zip(Iterable, Iterable, Throwables.BiFunction), N#zip(Iterable, Iterable, Object, Object, java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three iterables into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one iterable is shorter than the others, the provided default values are used for the missing elements.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable to zip. Can be {@code null} or empty -
b(Iterable<? extends B>) — the second iterable to zip. Can be {@code null} or empty -
c(Iterable<? extends C>) — the third iterable to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first iterable runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second iterable runs out of elements. Can be {@code null} -
valueForNoneC(C) — the default value to use when the third iterable runs out of elements. Can be {@code null} -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three iterables. Must not be {@code null} . Takes an element (or default value) from each iterable and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longest iterable's length
- See also: #zip(Iterable, Iterable, Iterable, Throwables.TriFunction), N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two iterators into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one iterator is shorter than the other, the provided default values are used for the missing elements.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator to zip. Can be {@code null} or empty -
b(Iterator<? extends B>) — the second iterator to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first iterator runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second iterator runs out of elements. Can be {@code null} -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two iterators. Must not be {@code null} . Takes an element (or default value) from each iterator and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longer iterator's length
- See also: #zip(Iterator, Iterator, Throwables.BiFunction), N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three iterators into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one iterator is shorter than the others, the provided default values are used for the missing elements.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator to zip. Can be {@code null} or empty -
b(Iterator<? extends B>) — the second iterator to zip. Can be {@code null} or empty -
c(Iterator<? extends C>) — the third iterator to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first iterator runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second iterator runs out of elements. Can be {@code null} -
valueForNoneC(C) — the default value to use when the third iterator runs out of elements. Can be {@code null} -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three iterators. Must not be {@code null} . Takes an element (or default value) from each iterator and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longest iterator's length
- See also: #zip(Iterator, Iterator, Iterator, Throwables.TriFunction), N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, T, E extends Exception> Seq<T, E> zip(final Seq<? extends A, E> a, final Seq<? extends B, E> b, final A valueForNoneA, final B valueForNoneB, final Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E> zipFunction) - Summary: Zips two sequences into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one sequence is shorter than the other, the provided default values are used for the missing elements.
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends A, E>) — the first sequence to zip. Can be {@code null} or empty -
b(Seq<? extends B, E>) — the second sequence to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first sequence runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second sequence runs out of elements. Can be {@code null} -
zipFunction(Throwables.BiFunction<? super A, ? super B, ? extends T, ? extends E>) — a function that combines elements from the two sequences. Must not be {@code null} . Takes an element (or default value) from each sequence and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longer sequence's length. The returned sequence will close both input sequences when it is closed.
- See also: #zip(Seq, Seq, Throwables.BiFunction), N#zip(Iterable, Iterable, Object, Object, java.util.function.BiFunction)
-
Signature:
public static <A, B, C, T, E extends Exception> Seq<T, E> zip(final Seq<? extends A, E> a, final Seq<? extends B, E> b, final Seq<? extends C, E> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) - Summary: Zips three sequences into a single sequence by combining corresponding elements using the provided zip function.
-
Contract:
- If one sequence is shorter than the others, the provided default values are used for the missing elements.
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends A, E>) — the first sequence to zip. Can be {@code null} or empty -
b(Seq<? extends B, E>) — the second sequence to zip. Can be {@code null} or empty -
c(Seq<? extends C, E>) — the third sequence to zip. Can be {@code null} or empty -
valueForNoneA(A) — the default value to use when the first sequence runs out of elements. Can be {@code null} -
valueForNoneB(B) — the default value to use when the second sequence runs out of elements. Can be {@code null} -
valueForNoneC(C) — the default value to use when the third sequence runs out of elements. Can be {@code null} -
zipFunction(Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E>) — a function that combines elements from the three sequences. Must not be {@code null} . Takes an element (or default value) from each sequence and returns the combined result
-
- Returns: a sequence of combined elements. The length equals the longest sequence's length. The returned sequence will close all input sequences when it is closed.
- See also: #zip(Seq, Seq, Seq, Throwables.TriFunction), N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
merge(...) -> Seq<T, E>
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final T[] a, final T[] b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges two arrays into a single sequence by selecting elements based on the provided next selector function.
-
Contract:
- <p> The merging process works as follows: </p> <ul> <li> The function starts with cursors at the beginning of both arrays </li> <li> At each step, it calls the nextSelector with the current elements from both arrays </li> <li> If nextSelector returns MergeResult.TAKE_FIRST, the element from the first array is taken </li> <li> Otherwise, the element from the second array is taken </li> <li> When one array is exhausted, all remaining elements from the other array are included </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code Integer\[\] arr1 = {1, 3, 5}; Integer\[\] arr2 = {2, 4, 6}; Seq<Integer, Exception> merged = Seq.merge(arr1, arr2, (a, b) -> a <= b ?
-
Parameters:
-
a(T[]) — the first array to merge -
b(T[]) — the second array to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements (one from each array) and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from both arrays in the order determined by the next selector. If either array is {@code null} or empty, returns a sequence containing the other array's elements
- See also: N#merge(Object\[\], Object\[\], java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final T[] a, final T[] b, final T[] c, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges three arrays into a single sequence by selecting elements based on the provided next selector function.
-
Parameters:
-
a(T[]) — the first array to merge -
b(T[]) — the second array to merge -
c(T[]) — the third array to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from all three arrays in the order determined by the next selector
- See also: N#merge(Object\[\], Object\[\], java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges two iterables into a single sequence by selecting elements based on the provided next selector function.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable to merge -
b(Iterable<? extends T>) — the second iterable to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements (one from each iterable) and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from both iterables in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final Iterable<? extends T> c, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges three iterables into a single sequence by selecting elements based on the provided next selector function.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable to merge -
b(Iterable<? extends T>) — the second iterable to merge -
c(Iterable<? extends T>) — the third iterable to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from all three iterables in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Iterator<? extends T> a, final Iterator<? extends T> b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges two iterators into a single sequence by selecting elements based on the provided next selector function.
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator to merge -
b(Iterator<? extends T>) — the second iterator to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements (one from each iterator) and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from both iterators in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Iterator<? extends T> a, final Iterator<? extends T> b, final Iterator<? extends T> c, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges three iterators into a single sequence by selecting elements based on the provided next selector function.
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator to merge -
b(Iterator<? extends T>) — the second iterator to merge -
c(Iterator<? extends T>) — the third iterator to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from all three iterators in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Seq<? extends T, E> a, final Seq<? extends T, E> b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges two sequences into a single sequence by selecting elements based on the provided next selector function.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends T, E>) — the first sequence to merge -
b(Seq<? extends T, E>) — the second sequence to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements (one from each sequence) and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from both sequences in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
-
Signature:
public static <T, E extends Exception> Seq<T, E> merge(final Seq<? extends T, E> a, final Seq<? extends T, E> b, final Seq<? extends T, E> c, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Summary: Merges three sequences into a single sequence by selecting elements based on the provided next selector function.
-
Contract:
- All input sequences will be automatically closed when the returned sequence is closed.
-
Parameters:
-
a(Seq<? extends T, E>) — the first sequence to merge -
b(Seq<? extends T, E>) — the second sequence to merge -
c(Seq<? extends T, E>) — the third sequence to merge -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a function that takes two elements and returns MergeResult.TAKE_FIRST to select the first element, or any other value to select the second element
-
- Returns: a sequence containing all elements from all three sequences in the order determined by the next selector
- See also: N#merge(Iterable, Iterable, java.util.function.BiFunction)
Public Instance Methods
filter(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> filter(final Throwables.Predicate<? super T, ? extends E> predicate) throws IllegalStateException - Summary: Filters the elements of this sequence, returning a new sequence containing only the elements that satisfy the given predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine if it should be included
-
- Returns: a new sequence containing only the elements that match the predicate
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@Beta @IntermediateOp public Seq<T, E> filter(final Throwables.Predicate<? super T, ? extends E> predicate, final Throwables.Consumer<? super T, ? extends E> onDrop) throws IllegalStateException - Summary: Filters the elements of this sequence, returning a new sequence containing only the elements that satisfy the given predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine if it should be included -
onDrop(Throwables.Consumer<? super T, ? extends E>) — the action to perform on items that are dropped by the filter
-
- Returns: a new sequence containing only the elements that match the predicate
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
takeWhile(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> takeWhile(final Throwables.Predicate<? super T, ? extends E> predicate) throws IllegalStateException - Summary: Takes elements from this sequence while the provided predicate returns {@code true} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine if it should be included
-
- Returns: a new sequence containing the elements taken while the predicate is true
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
dropWhile(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> dropWhile(final Throwables.Predicate<? super T, ? extends E> predicate) throws IllegalStateException - Summary: Drops (skips) elements from this sequence while the provided predicate returns {@code true} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine if it should be dropped
-
- Returns: a new sequence containing the elements after the predicate becomes false
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@Beta @IntermediateOp public Seq<T, E> dropWhile(final Throwables.Predicate<? super T, ? extends E> predicate, final Throwables.Consumer<? super T, ? extends E> onDrop) throws IllegalStateException - Summary: Drops (skips) elements from this sequence while the provided predicate returns {@code true} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine if it should be dropped -
onDrop(Throwables.Consumer<? super T, ? extends E>) — the action to perform on items that are dropped
-
- Returns: a new sequence containing the elements after the predicate becomes false
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
skipUntil(...) -> Seq<T, E>
-
Signature:
@Beta @IntermediateOp public Seq<T, E> skipUntil(final Throwables.Predicate<? super T, ? extends E> predicate) throws IllegalStateException - Summary: Skips elements from this sequence until the provided predicate returns {@code true} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to apply to each element to determine when to stop skipping
-
- Returns: a new sequence containing the elements after the predicate becomes true
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
distinct(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> distinct() throws IllegalStateException - Summary: Returns a sequence consisting of the distinct elements of this sequence.
-
Parameters:
- (none)
- Returns: a new sequence containing distinct elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> distinct(final Throwables.BinaryOperator<T, ? extends E> mergeFunction) throws IllegalStateException - Summary: Returns a sequence consisting of the distinct elements of this sequence, using the provided merge function to handle duplicates.
-
Contract:
- When duplicate elements are encountered, the merge function determines which element to keep.
-
Parameters:
-
mergeFunction(Throwables.BinaryOperator<T, ? extends E>) — the function to merge elements that are considered equal
-
- Returns: a new sequence containing distinct elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
distinctBy(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> distinctBy(final Throwables.Function<? super T, ?, ? extends E> keyMapper) throws IllegalStateException - Summary: Returns a sequence consisting of the distinct elements of this sequence, where distinct elements are determined by the provided key extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ?, ? extends E>) — the function to extract the key from the elements
-
- Returns: a new sequence containing distinct elements based on the extracted keys
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> distinctBy(final Throwables.Function<? super T, ?, ? extends E> keyMapper, final Throwables.BinaryOperator<T, ? extends E> mergeFunction) throws IllegalStateException - Summary: Returns a sequence consisting of the distinct elements of this sequence, where distinct elements are determined by the provided key extractor function.
-
Contract:
- If multiple elements have the same key, they are merged using the provided merge function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ?, ? extends E>) — the function to extract the key from the elements -
mergeFunction(Throwables.BinaryOperator<T, ? extends E>) — the function to merge elements that have the same key
-
- Returns: a new sequence containing distinct elements based on the extracted keys
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
map(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> map(final Throwables.Function<? super T, ? extends R, ? extends E> mapper) throws IllegalStateException - Summary: Transforms each element of this sequence using the provided mapper function.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends R, ? extends E>) — the function to apply to each element
-
- Returns: a new sequence containing the transformed elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapIfNotNull(...) -> Seq<R, E>
-
Signature:
@Beta @IntermediateOp public <R> Seq<R, E> mapIfNotNull(final Throwables.Function<? super T, ? extends R, ? extends E> mapper) throws IllegalStateException - Summary: Transforms the {@code non-null} elements of this sequence using the provided mapper function, skipping {@code null} elements.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends R, ? extends E>) — the function to apply to each {@code non-null} element
-
- Returns: a new sequence containing the transformed {@code non-null} elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapFirst(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> mapFirst(final Throwables.Function<? super T, ? extends T, ? extends E> mapperForFirst) throws IllegalStateException - Summary: Returns a sequence consisting of the elements of this sequence with the first element transformed by the given function.
-
Contract:
- <p> If the sequence is empty, the returned sequence is also empty.
-
Parameters:
-
mapperForFirst(Throwables.Function<? super T, ? extends T, ? extends E>) — a non-interfering, stateless function to apply to the first element of this sequence
-
- Returns: a new sequence consisting of the transformed first element and the unchanged remaining elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapFirstOrElse(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> mapFirstOrElse(final Throwables.Function<? super T, ? extends R, E> mapperForFirst, final Throwables.Function<? super T, ? extends R, E> mapperForElse) throws IllegalStateException - Summary: Returns a sequence consisting of the elements of this sequence with the first element transformed by the specified {@code mapperForFirst} and all other elements transformed by {@code mapperForElse} .
-
Parameters:
-
mapperForFirst(Throwables.Function<? super T, ? extends R, E>) — a non-interfering, stateless function to apply to the first element of this sequence -
mapperForElse(Throwables.Function<? super T, ? extends R, E>) — a non-interfering, stateless function to apply to all other elements of this sequence
-
- Returns: a new sequence consisting of the results of applying the appropriate mapper function to each element
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapLast(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> mapLast(final Throwables.Function<? super T, ? extends T, ? extends E> mapperForLast) throws IllegalStateException - Summary: Returns a sequence consisting of the elements of this sequence with the last element transformed by the given function.
-
Parameters:
-
mapperForLast(Throwables.Function<? super T, ? extends T, ? extends E>) — a non-interfering, stateless function to apply to the last element of this sequence
-
- Returns: a new sequence consisting of the unchanged preceding elements and the transformed last element
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapLastOrElse(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> mapLastOrElse(final Throwables.Function<? super T, ? extends R, E> mapperForLast, final Throwables.Function<? super T, ? extends R, E> mapperForElse) throws IllegalStateException - Summary: Returns a sequence consisting of the elements of this sequence with the last element transformed by the specified {@code mapperForLast} and all other elements transformed by {@code mapperForElse} .
-
Parameters:
-
mapperForLast(Throwables.Function<? super T, ? extends R, E>) — a non-interfering, stateless function to apply to the last element of this sequence -
mapperForElse(Throwables.Function<? super T, ? extends R, E>) — a non-interfering, stateless function to apply to all other elements of this sequence
-
- Returns: a new sequence consisting of the results of applying the appropriate mapper function to each element
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
flatMap(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> flatMap(final Throwables.Function<? super T, ? extends Seq<? extends R, ? extends E>, ? extends E> mapper) throws IllegalStateException - Summary: Transforms each element of this sequence using the provided mapper function, which returns a new sequence for each element.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Seq<? extends R, ? extends E>, ? extends E>) — the function to apply to each element, which returns a new sequence
-
- Returns: a new sequence containing the flattened elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
flatmap(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> flatmap(final Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) - Summary: Transforms each element of this sequence using the provided mapper function, which returns a collection of new elements for each element.
-
Contract:
- It's more efficient when the mapper returns small collections.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E>) — the function to apply to each element, which returns a collection of new elements
-
- Returns: a new sequence containing the flattened elements
flattmap(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> flattmap(final Throwables.Function<? super T, R[], ? extends E> mapper) - Summary: Transforms each element of this sequence using the provided mapper function, which returns an array of new elements for each element.
-
Parameters:
-
mapper(Throwables.Function<? super T, R[], ? extends E>) — the function to apply to each element, which returns an array of new elements
-
- Returns: a new sequence containing the flattened elements
flatmapIfNotNull(...) -> Seq<R, E>
-
Signature:
@Beta @IntermediateOp public <R> Seq<R, E> flatmapIfNotNull(final Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) throws IllegalStateException - Summary: Transforms the {@code non-null} elements of this sequence using the provided mapper function, which returns a collection of new elements for each {@code non-null} element.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E>) — the function to apply to each {@code non-null} element, which returns a collection of new elements
-
- Returns: a new sequence containing the flattened elements from {@code non-null} source elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@Beta @IntermediateOp public <U, R> Seq<R, E> flatmapIfNotNull(final Throwables.Function<? super T, ? extends Collection<? extends U>, ? extends E> mapper, final Throwables.Function<? super U, ? extends Collection<? extends R>, ? extends E> secondMapper) throws IllegalStateException - Summary: Transforms the {@code non-null} elements of this sequence using two successive mapper functions.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Collection<? extends U>, ? extends E>) — the function to apply to each {@code non-null} element, which returns a collection of intermediate elements -
secondMapper(Throwables.Function<? super U, ? extends Collection<? extends R>, ? extends E>) — the function to apply to each intermediate element, which returns a collection of final elements
-
- Returns: a new sequence containing the flattened elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapPartial(...) -> Seq<R, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta @IntermediateOp public <R> Seq<R, E> mapPartial(final Throwables.Function<? super T, Optional<R>, E> mapper) throws IllegalStateException - Summary: Transforms the elements of this sequence using the provided mapper function, which returns an Optional of new elements for each element.
-
Parameters:
-
mapper(Throwables.Function<? super T, Optional<R>, E>) — the function to apply to each element, which returns an Optional of new elements
-
- Returns: a new sequence containing the transformed elements that are present
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapPartialToInt(...) -> Seq<Integer, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta @IntermediateOp public Seq<Integer, E> mapPartialToInt(final Throwables.Function<? super T, OptionalInt, E> mapper) throws IllegalStateException - Summary: Transforms the elements of this sequence using the provided mapper function, which returns an OptionalInt of new elements for each element.
-
Parameters:
-
mapper(Throwables.Function<? super T, OptionalInt, E>) — the function to apply to each element, which returns an OptionalInt of new elements
-
- Returns: a new sequence containing the transformed elements that are present
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
mapPartialToLong(...) -> Seq<Long, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta @IntermediateOp public Seq<Long, E> mapPartialToLong(final Throwables.Function<? super T, OptionalLong, E> mapper) throws IllegalStateException - Summary: Transforms the elements of this sequence using the provided mapper function, which returns an OptionalLong for each element.
-
Contract:
- It's particularly useful when you have a transformation that may not produce a valid result for every input element.
-
Parameters:
-
mapper(Throwables.Function<? super T, OptionalLong, E>) — the function to apply to each element, which returns an OptionalLong. The function should return OptionalLong.empty() for elements that should be filtered out.
-
- Returns: a new sequence containing Long values extracted from the present OptionalLong results
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #mapPartialToDouble(Throwables.Function)
mapPartialToDouble(...) -> Seq<Double, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta @IntermediateOp public Seq<Double, E> mapPartialToDouble(final Throwables.Function<? super T, OptionalDouble, E> mapper) throws IllegalStateException - Summary: Transforms the elements of this sequence using the provided mapper function, which returns an OptionalDouble for each element.
-
Contract:
- It's particularly useful when you have a transformation that may not produce a valid result for every input element.
-
Parameters:
-
mapper(Throwables.Function<? super T, OptionalDouble, E>) — the function to apply to each element, which returns an OptionalDouble. The function should return OptionalDouble.empty() for elements that should be filtered out.
-
- Returns: a new sequence containing Double values extracted from the present OptionalDouble results
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #mapPartialToLong(Throwables.Function)
mapMulti(...) -> Seq<R, E>
-
Signature:
public <R> Seq<R, E> mapMulti(final Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E> mapper) throws IllegalStateException - Summary: Transforms each element of this sequence into zero or more elements using the provided mapper function.
-
Parameters:
-
mapper(Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E>) — the function that accepts an element and a consumer. The function should call the consumer for each element to be included in the resulting sequence.
-
- Returns: a new sequence containing all elements added via the consumer
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
slidingMap(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException - Summary: Returns a sequence consisting of the results of applying the given function to each adjacent pair of elements in this sequence.
-
Parameters:
-
mapper(Throwables.BiFunction<? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each adjacent pair of this sequence's elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each adjacent pair of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #slidingMap(int, Throwables.BiFunction)
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final int increment, final Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException, IllegalArgumentException - Summary: Returns a sequence consisting of the results of applying the given function to pairs of elements separated by the specified increment in this sequence.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair (must be positive) -
mapper(Throwables.BiFunction<? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each pair of elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each pair of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the mapper is {@code null} or increment is not positive
-
- See also: #slidingMap(int, boolean, Throwables.BiFunction)
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final int increment, final boolean ignoreNotPaired, final Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException, IllegalArgumentException - Summary: Returns a sequence consisting of the results of applying the given function to pairs of elements separated by the specified increment in this sequence, with control over unpaired elements.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair (must be positive) -
ignoreNotPaired(boolean) — if {@code false} , unpaired elements will be processed with {@code null} as their pair; if {@code true} , the last element will be ignored if there is no element to pair with it -
mapper(Throwables.BiFunction<? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each pair of elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each pair of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the mapper is {@code null} or increment is not positive
-
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException - Summary: Returns a sequence consisting of the results of applying the given function to each adjacent triple of elements in this sequence.
-
Parameters:
-
mapper(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each adjacent triple of this sequence's elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each adjacent triple of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #slidingMap(int, Throwables.TriFunction)
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final int increment, final Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException, IllegalArgumentException - Summary: Returns a sequence consisting of the results of applying the given function to triples of elements separated by the specified increment in this sequence.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple (must be positive) -
mapper(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each triple of elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each triple of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the mapper is {@code null} or increment is not positive
-
- See also: #slidingMap(int, boolean, Throwables.TriFunction)
-
Signature:
@IntermediateOp public <R> Seq<R, E> slidingMap(final int increment, final boolean ignoreNotPaired, final Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) throws IllegalStateException, IllegalArgumentException - Summary: Returns a sequence consisting of the results of applying the given function to triples of elements separated by the specified increment in this sequence, with control over unpaired elements.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple (must be positive) -
ignoreNotPaired(boolean) — if {@code false} , unpaired elements will be processed with {@code null} as their pair; if {@code true} , elements that cannot form a complete triple will be ignored -
mapper(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E>) — a non-interfering, stateless function to apply to each triple of elements
-
- Returns: a new sequence consisting of the results of applying the mapper function to each triple of elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the mapper is {@code null} or increment is not positive
-
groupBy(...) -> Seq<Map.Entry<K, List<T>>, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K> Seq<Map.Entry<K, List<T>>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a list of elements with that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #groupBy(Throwables.Function, Supplier)
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K> Seq<Map.Entry<K, List<T>>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Supplier<? extends Map<K, List<T>>> mapFactory) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function, using the specified map factory to create the backing map.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
mapFactory(Supplier<? extends Map<K, List<T>>>) — the supplier to create a new map instance for storing the groups
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a list of elements with that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V> Seq<Map.Entry<K, List<V>>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function and transforms the values using the provided value mapper function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be grouped
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a list of transformed values
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V> Seq<Map.Entry<K, List<V>>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, final Supplier<? extends Map<K, List<V>>> mapFactory) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function and transforms the values using the provided value mapper function, using the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be grouped -
mapFactory(Supplier<? extends Map<K, List<V>>>) — the supplier to create a new map instance for storing the groups
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a list of transformed values
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V> Seq<Map.Entry<K, V>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, final Throwables.BinaryOperator<V, ? extends E> mergeFunction) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function and merges values with the same key using the provided merge function.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Sum integers by their remainder when divided by 3 seq.groupBy(n -> n % 3, n -> n, Integer::sum) .forEach(entry -> System.out.println("Remainder " + entry.getKey() + " sum: " + entry.getValue())); } </pre>
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be grouped -
mergeFunction(Throwables.BinaryOperator<V, ? extends E>) — the function to merge values with the same key
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a single merged value
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V> Seq<Map.Entry<K, V>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, final Throwables.BinaryOperator<V, ? extends E> mergeFunction, final Supplier<? extends Map<K, V>> mapFactory) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function and merges values with the same key using the provided merge function, using the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be grouped -
mergeFunction(Throwables.BinaryOperator<V, ? extends E>) — the function to merge values with the same key -
mapFactory(Supplier<? extends Map<K, V>>) — the supplier to create a new map instance for storing the groups
-
- Returns: a new sequence containing Map.Entry objects where each key maps to a single merged value
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#toMap(Function, Function, BinaryOperator), Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, D> Seq<Map.Entry<K, D>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Collector<? super T, ?, D> downstream) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function, and collects the grouped elements using the provided downstream collector.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
downstream(Collector<? super T, ?, D>) — the collector to use for elements in each group
-
- Returns: a new sequence containing Map.Entry objects where each key maps to the collector result
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, D> Seq<Map.Entry<K, D>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Collector<? super T, ?, D> downstream, final Supplier<? extends Map<K, D>> mapFactory) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function, and collects the grouped elements using the provided downstream collector, using the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
downstream(Collector<? super T, ?, D>) — the collector to use for elements in each group -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier to create a new map instance for storing the groups
-
- Returns: a new sequence containing Map.Entry objects where each key maps to the collector result
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V, D> Seq<Map.Entry<K, D>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, final Collector<? super V, ?, D> downstream) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function, transforms values using the value mapper, and collects the transformed values using the downstream collector.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be collected -
downstream(Collector<? super V, ?, D>) — the collector to use for the transformed values in each group
-
- Returns: a new sequence containing Map.Entry objects where each key maps to the collector result
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K, V, D> Seq<Map.Entry<K, D>, E> groupBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, final Collector<? super V, ?, D> downstream, final Supplier<? extends Map<K, D>> mapFactory) throws IllegalStateException - Summary: Groups the elements of this sequence by a key extracted using the provided key extractor function, transforms values using the value mapper, and collects the transformed values using the downstream collector, using the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
valueMapper(Throwables.Function<? super T, ? extends V, ? extends E>) — the function to transform each element into the value to be collected -
downstream(Collector<? super V, ?, D>) — the collector to use for the transformed values in each group -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier to create a new map instance for storing the groups
-
- Returns: a new sequence containing Map.Entry objects where each key maps to the collector result
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
partitionBy(...) -> Seq<Map.Entry<Boolean, List<T>>, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<Map.Entry<Boolean, List<T>>, E> partitionBy(final Throwables.Predicate<? super T, E> predicate) throws IllegalStateException - Summary: Partitions the elements of this sequence into two groups based on the provided predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate used to classify elements
-
- Returns: a new sequence containing exactly two entries: true- > matching elements, false- > non-matching elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#partitioningBy(Predicate)
-
Signature:
@IntermediateOp @TerminalOpTriggered public <D> Seq<Map.Entry<Boolean, D>, E> partitionBy(final Throwables.Predicate<? super T, E> predicate, final Collector<? super T, ?, D> downstream) throws IllegalStateException - Summary: Partitions the elements of this sequence into two groups based on the provided predicate, and collects each partition using the provided downstream collector.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate used to classify elements -
downstream(Collector<? super T, ?, D>) — the collector to use for elements in each partition
-
- Returns: a new sequence containing exactly two entries with the collector results
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: Collectors#partitioningBy(Predicate, Collector)
countBy(...) -> Seq<Map.Entry<K, Integer>, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K> Seq<Map.Entry<K, Integer>, E> countBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) throws IllegalStateException - Summary: Counts the occurrences of elements in this sequence grouped by a key extracted using the provided key extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element
-
- Returns: a new sequence containing Map.Entry objects where each key maps to its count
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp @TerminalOpTriggered public <K> Seq<Map.Entry<K, Integer>, E> countBy(final Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, final Supplier<? extends Map<K, Integer>> mapFactory) throws IllegalStateException - Summary: Counts the occurrences of elements in this sequence grouped by a key extracted using the provided key extractor function, using the specified map factory to create the backing map.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, ? extends E>) — the function to extract the key from each element -
mapFactory(Supplier<? extends Map<K, Integer>>) — the supplier to create a new map instance for storing the counts
-
- Returns: a new sequence containing Map.Entry objects where each key maps to its count
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
intersection(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> intersection(final Collection<?> c) throws IllegalStateException - Summary: Returns a new sequence containing elements that are present in both this sequence and the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection to find common elements with this sequence
-
- Returns: a new sequence containing elements present in both this sequence and the specified collection, considering the minimum number of occurrences in either source
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Collection#retainAll(Collection), N#intersection(int\[\], int\[\])
-
Signature:
@IntermediateOp public <U> Seq<T, E> intersection(final Throwables.Function<? super T, ? extends U, E> mapper, final Collection<U> c) throws IllegalStateException - Summary: Returns a new sequence containing elements from this sequence that, when mapped by the given function, produce values that are present in the specified collection.
-
Contract:
- Returns a new sequence containing elements from this sequence that, when mapped by the given function, produce values that are present in the specified collection.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the function to apply to elements of this sequence for comparison -
c(Collection<U>) — the collection to find common elements with (after mapping)
-
- Returns: a new sequence containing elements whose mapped values are present in the specified collection, considering the minimum number of occurrences in either source
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #intersection(Collection), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), N#intersection(int\[\], int\[\])
difference(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> difference(final Collection<?> c) throws IllegalStateException - Summary: Returns a new sequence containing elements from this sequence that are not in the specified collection, considering the number of occurrences of each element.
-
Contract:
- If an element appears multiple times in this sequence and also in the collection, the result will contain the extra occurrences from this sequence.
-
Parameters:
-
c(Collection<?>) — the collection to compare against this sequence
-
- Returns: a new sequence containing the elements that are present in this sequence but not in the specified collection, considering the number of occurrences
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #difference(Function, Collection), N#difference(Collection, Collection), N#difference(int\[\], int\[\])
-
Signature:
@IntermediateOp public <U> Seq<T, E> difference(final Function<? super T, ? extends U> mapper, final Collection<U> c) throws IllegalStateException - Summary: Returns a new sequence containing elements from this sequence whose mapped values are not in the specified collection, considering the number of occurrences.
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — the function to apply to each element of this sequence for comparison -
c(Collection<U>) — the collection of mapped values to compare against
-
- Returns: a new sequence containing the elements whose mapped values are not in the specified collection, considering the number of occurrences after mapping
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #difference(Collection), N#difference(Collection, Collection)
symmetricDifference(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> symmetricDifference(final Collection<T> c) throws IllegalStateException - Summary: Returns a new sequence containing elements that are present in either this sequence or the specified collection, but not in both.
-
Parameters:
-
c(Collection<T>) — the collection to find symmetric difference with this sequence
-
- Returns: a new sequence containing elements that are present in either this sequence or the specified collection, but not in both, considering the number of occurrences
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: N#symmetricDifference(Collection, Collection), N#symmetricDifference(int\[\], int\[\]), #intersection(Collection), #difference(Collection), Iterables#symmetricDifference(Set, Set)
prepend(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @SafeVarargs public final Seq<T, E> prepend(final T... a) throws IllegalStateException - Summary: Prepends the specified elements to the beginning of this sequence.
-
Parameters:
-
a(T[]) — the elements to be prepended to this sequence
-
- Returns: a new Seq with the specified elements prepended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> prepend(final Collection<? extends T> c) throws IllegalStateException - Summary: Prepends the specified collection of elements to the beginning of this sequence.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be prepended to this sequence
-
- Returns: a new Seq with the specified collection of elements prepended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> prepend(final Seq<T, E> s) throws IllegalStateException - Summary: Prepends the specified sequence to the beginning of this sequence.
-
Parameters:
-
s(Seq<T, E>) — the sequence to be prepended to this sequence
-
- Returns: a new Seq with the specified sequence prepended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> prepend(final u.Optional<T> op) throws IllegalStateException - Summary: Prepends the specified optional element to the beginning of this sequence if it's not empty.
-
Contract:
- Prepends the specified optional element to the beginning of this sequence if it's not empty.
- If the Optional is empty, the sequence remains unchanged.
- If the Optional contains a value, that value is prepended to the beginning of the sequence.
-
Parameters:
-
op(u.Optional<T>) — the optional element to be prepended to this sequence
-
- Returns: a new Seq with the specified optional element prepended if present, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
append(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @SafeVarargs public final Seq<T, E> append(final T... a) throws IllegalStateException - Summary: Appends the specified elements to the end of this sequence.
-
Parameters:
-
a(T[]) — the elements to be appended to this sequence
-
- Returns: a new Seq with the specified elements appended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> append(final Collection<? extends T> c) throws IllegalStateException - Summary: Appends the specified collection of elements to the end of this sequence.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be appended to this sequence
-
- Returns: a new Seq with the specified collection of elements appended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> append(final Seq<T, E> s) throws IllegalStateException - Summary: Appends the specified sequence to the end of this sequence.
-
Parameters:
-
s(Seq<T, E>) — the sequence to be appended to this sequence
-
- Returns: a new Seq with the specified sequence appended
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> append(final u.Optional<T> op) throws IllegalStateException - Summary: Appends the specified optional element to the end of this sequence if it's not empty.
-
Contract:
- Appends the specified optional element to the end of this sequence if it's not empty.
- If the Optional is empty, the sequence remains unchanged.
- If the Optional contains a value, that value is appended to the end of the sequence.
-
Parameters:
-
op(u.Optional<T>) — the optional element to be appended to this sequence
-
- Returns: a new Seq with the specified optional element appended if present, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
appendIfEmpty(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @SafeVarargs public final Seq<T, E> appendIfEmpty(final T... a) throws IllegalStateException - Summary: Appends the specified elements to the end of this sequence if this sequence is empty.
-
Contract:
- Appends the specified elements to the end of this sequence if this sequence is empty.
- If the sequence already contains elements, it remains unchanged.
-
Parameters:
-
a(T[]) — the elements to be appended if this sequence is empty
-
- Returns: a new Seq with the specified elements appended if this sequence is empty, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> appendIfEmpty(final Collection<? extends T> c) throws IllegalStateException - Summary: Appends the elements from the specified collection to the end of this Seq if the Seq is empty.
-
Contract:
- Appends the elements from the specified collection to the end of this Seq if the Seq is empty.
- If the sequence already contains elements, it remains unchanged.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to append if the Seq is empty
-
- Returns: a new Seq with the elements from the specified collection appended if the Seq is empty, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> appendIfEmpty(final Supplier<? extends Seq<T, E>> supplier) throws IllegalStateException - Summary: Appends the elements from the Seq provided by the supplier to the end of this Seq if the Seq is empty.
-
Contract:
- Appends the elements from the Seq provided by the supplier to the end of this Seq if the Seq is empty.
- If the sequence already contains elements, it remains unchanged.
- The supplier is only invoked if this sequence is empty, providing lazy evaluation of the default elements.
-
Parameters:
-
supplier(Supplier<? extends Seq<T, E>>) — the supplier that provides a Seq of elements to append if the Seq is empty
-
- Returns: a new Seq with the elements from the Seq provided by the supplier appended if the Seq is empty, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
defaultIfEmpty(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> defaultIfEmpty(final T defaultValue) throws IllegalStateException - Summary: Returns a new Seq that contains the specified default value if this Seq is empty.
-
Contract:
- Returns a new Seq that contains the specified default value if this Seq is empty.
-
Parameters:
-
defaultValue(T) — the default value to return if this Seq is empty
-
- Returns: a new Seq containing the default value if this Seq is empty, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #appendIfEmpty(Object...)
-
Signature:
@IntermediateOp public Seq<T, E> defaultIfEmpty(final Supplier<? extends Seq<T, E>> supplier) throws IllegalStateException - Summary: Returns a new Seq that contains the elements from the Seq provided by the supplier if this Seq is empty.
-
Contract:
- Returns a new Seq that contains the elements from the Seq provided by the supplier if this Seq is empty.
- The supplier is only invoked if this sequence is empty, providing lazy evaluation.
-
Parameters:
-
supplier(Supplier<? extends Seq<T, E>>) — the supplier that provides a Seq of elements to return if this Seq is empty
-
- Returns: a new Seq with the elements from the Seq provided by the supplier if this Seq is empty, otherwise returns this sequence unchanged
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #appendIfEmpty(Supplier)
throwIfEmpty(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> throwIfEmpty() throws IllegalStateException, NoSuchElementException - Summary: Throws a {@code NoSuchElementException} in executed terminal operation if this {@code Seq} is empty.
-
Contract:
- Throws a {@code NoSuchElementException} in executed terminal operation if this {@code Seq} is empty.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Seq<Integer> seq = getSeq(); Integer first = seq.throwIfEmpty().first().orElseThrow(); // Throws NoSuchElementException if seq was empty } </pre>
-
Parameters:
- (none)
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.util.NoSuchElementException— if the sequence is empty (thrown when terminal operation is executed)
-
-
Signature:
@IntermediateOp public Seq<T, E> throwIfEmpty(final Supplier<? extends RuntimeException> exceptionSupplier) throws IllegalStateException - Summary: Throws a custom exception provided by the supplier in terminal operation if this {@code Seq} is empty.
-
Contract:
- Throws a custom exception provided by the supplier in terminal operation if this {@code Seq} is empty.
- This allows customization of the exception thrown when the sequence is empty.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Seq<String> seq = getSeq(); String result = seq.throwIfEmpty(() -> new IllegalStateException("Sequence must not be empty")) .join(", "); // Throws IllegalStateException if seq was empty } </pre>
-
Parameters:
-
exceptionSupplier(Supplier<? extends RuntimeException>) — the supplier that provides the exception to throw if this {@code Seq} is empty
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
ifEmpty(...) -> Seq<T, E>
-
Signature:
@Beta @IntermediateOp public Seq<T, E> ifEmpty(final Throwables.Runnable<? extends E> action) throws IllegalStateException - Summary: Executes the given action if the sequence is empty.
-
Contract:
- Executes the given action if the sequence is empty.
- The action is executed lazily when a terminal operation determines that the sequence is empty.
- If the sequence contains elements, the action is not executed.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Seq<String> seq = getSeq(); seq.ifEmpty(() -> System.out.println("Sequence is empty")) .forEach(System.out::println); // Prints "Sequence is empty" if seq has no elements, otherwise prints each element } </pre>
-
Parameters:
-
action(Throwables.Runnable<? extends E>) — the action to be executed if the sequence is empty
-
- Returns: the current stream
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
onEach(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> onEach(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action on the elements pulled by downstream/terminal operation.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed on the elements pulled by downstream/terminal operation
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
onFirst(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> onFirst(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action for the first element of this {@code Seq} .
-
Contract:
- The action is executed only for the first element when it is consumed by a terminal operation.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed for the first element
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
onLast(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> onLast(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action for the last element of this {@code Seq} .
-
Contract:
- The action is executed only when the last element is consumed by a terminal operation.
- The last element is detected when there are no more elements after it.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed for the last element
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
peek(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> peek(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action on the elements pulled by downstream/terminal operation.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed on the elements pulled by downstream/terminal operation
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #onEach(Throwables.Consumer)
peekFirst(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> peekFirst(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action on the first element pulled by downstream/terminal operation.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed on the first element pulled by downstream/terminal operation
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #onFirst(Throwables.Consumer)
peekLast(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> peekLast(final Throwables.Consumer<? super T, ? extends E> action) throws IllegalStateException - Summary: Performs the given action on the last element pulled by downstream/terminal operation.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends E>) — the action to be performed on the last element pulled by downstream/terminal operation
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #onLast(Throwables.Consumer)
peekIf(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> peekIf(final Throwables.Predicate<? super T, E> predicate, final Throwables.Consumer<? super T, E> action) throws IllegalStateException - Summary: Performs the given action on the elements pulled by downstream/terminal operation which matches the given predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to test each element -
action(Throwables.Consumer<? super T, E>) — the action to be performed on the elements pulled by downstream/terminal operation which matches the given predicate
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@Beta @IntermediateOp public Seq<T, E> peekIf(final Throwables.BiPredicate<? super T, ? super Long, E> predicate, final Consumer<? super T> action) throws IllegalStateException - Summary: Performs the given action on the elements pulled by downstream/terminal operation which matches the given predicate.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super T, ? super Long, E>) — the predicate to test each element. The first parameter is the element, and the second parameter is the count of iterated elements, starting with 1. -
action(Consumer<? super T>) — the action to be performed on the elements pulled by downstream/terminal operation which matches the given predicate
-
- Returns: this {@code Seq} instance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
split(...) -> Seq<List<T>, E>
-
Signature:
@IntermediateOp public Seq<List<T>, E> split(final int chunkSize) throws IllegalStateException - Summary: Returns a sequence of Lists, where each List contains a chunk of elements from the original sequence.
-
Contract:
- The final chunk may be smaller if there are not enough elements.
-
Parameters:
-
chunkSize(int) — the desired size of each chunk (the last chunk may be smaller)
-
- Returns: a sequence of Lists, each containing a chunk of elements from the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public <C extends Collection<T>> Seq<C, E> split(final int chunkSize, final IntFunction<? extends C> collectionSupplier) throws IllegalStateException - Summary: Splits the elements of this sequence into subsequences of the specified size.
-
Parameters:
-
chunkSize(int) — the desired size of each subsequence (the last subsequence may be smaller) -
collectionSupplier(IntFunction<? extends C>) — a function that provides a new collection to hold each sub-sequence
-
- Returns: a new sequence where each element is a collection containing a subsequence of the original elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is in an invalid state
-
-
Signature:
@IntermediateOp public <R> Seq<R, E> split(final int chunkSize, final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException - Summary: Splits the sequence into subsequences of the specified size and collects them using the provided collector.
-
Parameters:
-
chunkSize(int) — the desired size of each subsequence (the last may be smaller) -
collector(Collector<? super T, ?, R>) — the collector to use for collecting the subsequences
-
- Returns: a new Seq where each element is the result of collecting a subsequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if chunkSize is less than or equal to 0, or collector is null
-
-
Signature:
@IntermediateOp public Seq<List<T>, E> split(final Throwables.Predicate<? super T, ? extends E> predicate) throws IllegalStateException - Summary: Splits the sequence into subsequences based on the given predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to determine the boundaries of the subsequences
-
- Returns: a new Seq where each element is a List of elements that satisfy the predicate
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public <C extends Collection<T>> Seq<C, E> split(final Throwables.Predicate<? super T, ? extends E> predicate, final Supplier<? extends C> collectionSupplier) throws IllegalStateException - Summary: Splits the sequence into subsequences based on the given predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to determine the boundaries of the subsequences -
collectionSupplier(Supplier<? extends C>) — the supplier to provide the Collection to collect the subsequences
-
- Returns: a new Seq where each element is a Collection of elements that satisfy the predicate
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public <R> Seq<R, E> split(final Throwables.Predicate<? super T, ? extends E> predicate, final Collector<? super T, ?, R> collector) throws IllegalStateException - Summary: Splits the sequence into subsequences based on the given predicate and collects them using the provided collector.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends E>) — the predicate to determine the boundaries of the subsequences -
collector(Collector<? super T, ?, R>) — the collector to use for collecting the subsequences
-
- Returns: a new Seq where each element is the result of collecting a subsequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
splitAt(...) -> Seq<Seq<T, E>, E>
-
Signature:
@IntermediateOp public Seq<Seq<T, E>, E> splitAt(final int position) throws IllegalStateException, IllegalArgumentException - Summary: Splits the sequence at the specified position into two subsequences.
-
Parameters:
-
position(int) — the position at which to split the sequence
-
- Returns: a new Seq containing two subsequences split at the specified position
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the specified position less than 0
-
-
Signature:
@IntermediateOp public Seq<Seq<T, E>, E> splitAt(final Throwables.Predicate<? super T, ? extends E> where) throws IllegalStateException - Summary: Splits the sequence at the position where the given predicate returns {@code true} .
-
Parameters:
-
where(Throwables.Predicate<? super T, ? extends E>) — the predicate to determine the position at which to split the sequence
-
- Returns: a new Seq containing two subsequences split at the position where the predicate returns true
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
sliding(...) -> Seq<List<T>, E>
-
Signature:
@IntermediateOp public Seq<List<T>, E> sliding(final int windowSize) throws IllegalStateException - Summary: Creates a sliding window view of the sequence with the specified window size.
-
Parameters:
-
windowSize(int) — the size of the sliding window
-
- Returns: a new Seq where each element is a list representing a sliding window of the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public <C extends Collection<T>> Seq<C, E> sliding(final int windowSize, final IntFunction<? extends C> collectionSupplier) throws IllegalStateException, IllegalArgumentException - Summary: Creates a sliding window view of the sequence with the specified window size and collection supplier.
-
Parameters:
-
windowSize(int) — the size of the sliding window -
collectionSupplier(IntFunction<? extends C>) — a function that provides a new collection instance for each window
-
- Returns: a new Seq where each element is a collection representing a sliding window of the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the window size is less than or equal to zero or collectionSupplier is null
-
-
Signature:
@IntermediateOp public <R> Seq<R, E> sliding(final int windowSize, final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException - Summary: Creates a sliding window view of the sequence with the specified window size and collector.
-
Parameters:
-
windowSize(int) — the size of the sliding window -
collector(Collector<? super T, ?, R>) — a Collector that collects the elements of each window into a result container
-
- Returns: a new Seq where each element is a result container representing a sliding window of the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the window size is less than or equal to zero or collector is null
-
-
Signature:
@IntermediateOp public Seq<List<T>, E> sliding(final int windowSize, final int increment) throws IllegalStateException, IllegalArgumentException - Summary: Creates a sliding window view of the sequence with the specified window size and increment.
-
Parameters:
-
windowSize(int) — the size of the sliding window, must be greater than 0 -
increment(int) — the increment by which the window moves forward, must be greater than 0
-
- Returns: a new Seq where each element is a list representing a sliding window of the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the window size or increment is less than or equal to zero
-
- See also: #sliding(int, int, IntFunction)
-
Signature:
@IntermediateOp public <C extends Collection<T>> Seq<C, E> sliding(final int windowSize, final int increment, final IntFunction<? extends C> collectionSupplier) throws IllegalStateException, IllegalArgumentException - Summary: Creates a sliding window view of the sequence with the specified window size and increment.
-
Parameters:
-
windowSize(int) — the size of the sliding window, must be greater than 0 -
increment(int) — the increment by which the window moves forward, must be greater than 0 -
collectionSupplier(IntFunction<? extends C>) — a function that provides a new collection of type C for each window
-
- Returns: a new Seq where each element is a collection representing a sliding window of the original sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the window size or increment is less than or equal to zero, or if collectionSupplier is null
-
- See also: #sliding(int, int), #sliding(int, int, Collector)
-
Signature:
@IntermediateOp public <R> Seq<R, E> sliding(final int windowSize, final int increment, final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException - Summary: Creates a sliding window view of the sequence with the specified window size and increment.
-
Contract:
- <p> This method is useful when you need to apply complex aggregations to each window, such as joining strings, computing statistics, or creating custom data structures.
-
Parameters:
-
windowSize(int) — the size of the sliding window, must be greater than 0 -
increment(int) — the increment by which the window moves forward, must be greater than 0 -
collector(Collector<? super T, ?, R>) — a Collector that collects the elements of each window into a result
-
- Returns: a new Seq where each element is the result of collecting the elements of a sliding window
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the window size or increment is less than or equal to zero, or if collector is null
-
- See also: #sliding(int, int), Collectors
skip(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> skip(final long n) throws IllegalStateException, IllegalArgumentException - Summary: Skips the first <i> n </i> elements of the sequence and returns a new sequence.
-
Contract:
- If <i> n </i> is greater than the number of elements in the sequence, an empty sequence is returned.
- If <i> n </i> is 0, the original sequence is returned unchanged.
-
Parameters:
-
n(long) — the number of elements to skip, must not be negative
-
- Returns: a new sequence with the first <i> n </i> elements skipped
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if <i> n </i> is negative
-
- See also: #limit(long), #skipLast(int)
-
Signature:
public Seq<T, E> skip(final long n, final Throwables.Consumer<? super T, ? extends E> onSkip) throws IllegalStateException, IllegalArgumentException - Summary: Skips the first <i> n </i> elements of the sequence and performs the given action on each skipped element.
-
Contract:
- This method is useful when you need to process skipped elements, such as for logging or statistics.
-
Parameters:
-
n(long) — the number of elements to skip, must not be negative -
onSkip(Throwables.Consumer<? super T, ? extends E>) — the action to be performed on each skipped element
-
- Returns: a new sequence where the first <i> n </i> elements are skipped and the action is performed on each skipped element
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if <i> n </i> is negative or onSkip is null
-
- See also: #skip(long)
skipNulls(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> skipNulls() - Summary: Filters out {@code null} elements from this {@code Seq} .
-
Parameters:
- (none)
- Returns: a new {@code Seq} instance with {@code null} elements removed
- See also: #filter(Throwables.Predicate)
skipLast(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> skipLast(final int n) throws IllegalStateException - Summary: Skips the last <i> n </i> elements of the sequence and returns a new sequence.
-
Contract:
- If <i> n </i> is greater than the number of elements in the sequence, an empty sequence is returned.
-
Parameters:
-
n(int) — the number of elements to skip from the end, must not be negative
-
- Returns: a new sequence where the last <i> n </i> elements are skipped
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #skip(long), #takeLast(int)
limit(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> limit(final long maxSize) throws IllegalStateException, IllegalArgumentException - Summary: Limits the number of elements in the sequence to the specified maximum size.
-
Contract:
- If the sequence contains fewer elements than maxSize, all elements are included.
-
Parameters:
-
maxSize(long) — the maximum number of elements to include in the sequence, must not be negative
-
- Returns: a new sequence containing at most maxSize elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if <i> maxSize </i> is negative
-
- See also: #skip(long)
-
Signature:
@IntermediateOp public Seq<T, E> limit(final long offset, final long maxSize) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} consisting of elements from this sequence, starting after skipping the first {@code offset} elements and containing at most {@code maxSize} elements.
-
Contract:
- <p> This is a convenience method equivalent to calling {@code skip(offset).limit(maxSize)} , but optimized for common cases: <ul> <li> If {@code offset} is 0, delegates directly to {@link #limit(long)} </li> <li> If {@code maxSize} is {@code Long.MAX_VALUE} , delegates directly to {@link #skip(long)} </li> </ul> <p> Example usage: <pre> {@code // Get elements 3, 4, 5 from a sequence of 1-10 Seq.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .limit(2, 3) .toList(); // Returns \[3, 4, 5\] // Pagination: get page 3 with page size 10 (elements 21-30) Seq.rangeClosed(1, 100) .limit(20, 10) .toList(); // Returns \[21, 22, 23, 24, 25, 26, 27, 28, 29, 30\] // If offset exceeds sequence size, returns empty sequence Seq.of(1, 2, 3) .limit(5, 10) .toList(); // Returns \[\] // If fewer elements available than maxSize, returns remaining elements Seq.of(1, 2, 3, 4, 5) .limit(3, 10) .toList(); // Returns \[4, 5\] } </pre> <br/> This is an intermediate operation and will not close the sequence.
-
Parameters:
-
offset(long) — the number of leading elements to skip before starting to include elements -
maxSize(long) — the maximum number of elements to include in the new sequence
-
- Returns: a new {@code Seq} consisting of at most {@code maxSize} elements after skipping the first {@code offset} elements from this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if {@code offset} or {@code maxSize} is negative
-
- See also: #skip(long), #limit(long), #step(long)
last(...) -> Seq<T, E>
-
Signature:
@Deprecated @Beta @IntermediateOp public Seq<T, E> last(final int n) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} consisting of the last {@code n} elements of this sequence.
-
Contract:
- It may cause <code> OutOfMemoryError </code> if {@code n} is big enough.
- <br/> All the elements will be loaded to get the last {@code n} elements and the sequence will be closed after that, if a terminal operation is triggered.
-
Parameters:
-
n(int) — the number of elements to retain from the end of the sequence
-
- Returns: a new {@code Seq} consisting of the last {@code n} elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if {@code n} is negative
-
- See also: Stream#takeLast(int)
-
Signature:
@TerminalOp public Optional<T> last() throws IllegalStateException, E - Summary: Returns an {@code Optional} describing the last element of this sequence, or an empty {@code Optional} if the sequence is empty.
-
Contract:
- Returns an {@code Optional} describing the last element of this sequence, or an empty {@code Optional} if the sequence is empty.
- </p> <p> Performance note: Consider using {@code seq.reversed().first()} for better performance when the sequence supports efficient reversal.
-
Parameters:
- (none)
- Returns: an {@code Optional} describing the last element of this sequence, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #first(), #elementAt(long)
takeLast(...) -> Seq<T, E>
-
Signature:
@Beta @IntermediateOp public Seq<T, E> takeLast(final int n) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} consisting of the last {@code n} elements of this sequence.
-
Contract:
- It may cause <code> OutOfMemoryError </code> if {@code n} is big enough.
- <br/> All the elements will be loaded to get the last {@code n} elements and the sequence will be closed after that, if a terminal operation is triggered.
-
Parameters:
-
n(int) — the number of elements to retain from the end of the sequence, must not be negative
-
- Returns: a new {@code Seq} consisting of the last {@code n} elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if {@code n} is negative
-
- See also: Stream#takeLast(int), #skipLast(int)
top(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> top(final int n) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} consisting of the top n elements of this {@code Seq} , according to the natural order of the elements.
-
Contract:
- If this {@code Seq} contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to retain, must not be negative
-
- Returns: a new {@code Seq} consisting of the top {@code n} elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if {@code n} is negative
-
- See also: Stream#top(int), #top(int, Comparator)
-
Signature:
@IntermediateOp public Seq<T, E> top(final int n, final Comparator<? super T> comparator) throws IllegalStateException, IllegalArgumentException - Summary: Returns a {@code Seq} consisting of the top n elements of this {@code Seq} compared by the provided Comparator.
-
Contract:
- If this {@code Seq} contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to retain, must be positive -
comparator(Comparator<? super T>) — the comparator to compare the elements
-
- Returns: a new {@code Seq} consisting of the top {@code n} elements according to the comparator
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if {@code n} is not positive
-
- See also: Stream#top(int, Comparator), #kthLargest(int, Comparator)
reversed(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reversed() throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements in reverse order.
-
Parameters:
- (none)
- Returns: a new {@code Seq} with the elements in reverse order
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- Performance: </p> <p> This operation requires O(n) space where n is the number of elements in the sequence.
- See also: #rotated(int)
rotated(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> rotated(final int distance) throws IllegalStateException - Summary: Rotates the elements in this sequence by the specified distance.
-
Contract:
- If the distance is positive, the elements are rotated to the right.
- If the distance is negative, the elements are rotated to the left.
- If the distance is zero, the sequence is not modified.
-
Parameters:
-
distance(int) — the distance to rotate the elements. Positive values rotate to the right, negative values rotate to the left
-
- Returns: a new {@code Seq} with the elements rotated by the specified distance
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #reversed()
shuffled(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> shuffled() throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements shuffled in random order.
-
Parameters:
- (none)
- Returns: a new {@code Seq} with the elements shuffled
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #shuffled(Random)
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> shuffled(final Random rnd) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements shuffled using the specified random number generator.
-
Parameters:
-
rnd(Random) — the random number generator to use for shuffling the elements
-
- Returns: a new {@code Seq} with the elements shuffled
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #shuffled()
sorted(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> sorted() throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in their natural order.
-
Contract:
- </p> <p> Elements must implement {@code Comparable} or a {@code ClassCastException} will be thrown when the terminal operation is executed.
-
Parameters:
- (none)
- Returns: a new {@code Seq} with the elements sorted
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator)
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> sorted(final Comparator<? super T> comparator) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted using the specified comparator.
-
Contract:
- A {@code null} comparator indicates natural ordering should be used.
- </p> <p> If the sequence is already sorted with the same comparator, this operation is a no-op.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to use for sorting the elements, or {@code null} for natural ordering
-
- Returns: a new {@code Seq} with the elements sorted
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(), #reverseSorted(Comparator)
sortedByInt(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> sortedByInt(final ToIntFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted according to integer values extracted by the provided key extractor function.
-
Contract:
- This method provides better performance than using a general comparator when sorting by integer values.
-
Parameters:
-
keyMapper(ToIntFunction<? super T>) — a function that extracts an integer key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted by the extracted integer key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator), #sortedByLong(ToLongFunction)
sortedByLong(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> sortedByLong(final ToLongFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted according to long values extracted by the provided key extractor function.
-
Contract:
- This method provides better performance than using a general comparator when sorting by long values.
-
Parameters:
-
keyMapper(ToLongFunction<? super T>) — a function that extracts a long key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted by the extracted long key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator), #sortedByDouble(ToDoubleFunction)
sortedByDouble(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> sortedByDouble(final ToDoubleFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted according to double values extracted by the provided key extractor function.
-
Contract:
- This method provides better performance than using a general comparator when sorting by double values.
-
Parameters:
-
keyMapper(ToDoubleFunction<? super T>) — a function that extracts a double key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted by the extracted double key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator), #sortedBy(Function)
sortedBy(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered @SuppressWarnings("rawtypes") public Seq<T, E> sortedBy(final Function<? super T, ? extends Comparable> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted according to natural order of the values extracted by the provided key extractor function.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function that extracts a comparable key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted by the extracted key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator), Comparators#comparingBy(Function)
reverseSorted(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSorted() throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse natural order.
-
Parameters:
- (none)
- Returns: a new {@code Seq} with the elements sorted in reverse order
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(), #reverseSorted(Comparator)
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSorted(final Comparator<? super T> comparator) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse order using the specified comparator.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to use for sorting the elements in reverse order
-
- Returns: a new {@code Seq} with the elements sorted in reverse order
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sorted(Comparator), Comparators#reverseOrder(Comparator)
reverseSortedByInt(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSortedByInt(final ToIntFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse order according to integer values extracted by the provided key extractor function.
-
Parameters:
-
keyMapper(ToIntFunction<? super T>) — a function that extracts an integer key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted in reverse order by the extracted integer key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sortedByInt(ToIntFunction), #reverseSorted(Comparator)
reverseSortedByLong(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSortedByLong(final ToLongFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse order according to long values extracted by the provided key extractor function.
-
Parameters:
-
keyMapper(ToLongFunction<? super T>) — a function that extracts a long key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted in reverse order by the extracted long key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sortedByLong(ToLongFunction), #reverseSorted(Comparator)
reverseSortedByDouble(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSortedByDouble(final ToDoubleFunction<? super T> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse order according to double values extracted by the provided key extractor function.
-
Parameters:
-
keyMapper(ToDoubleFunction<? super T>) — a function that extracts a double key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted in reverse order by the extracted double key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sortedByDouble(ToDoubleFunction), #reverseSorted(Comparator)
reverseSortedBy(...) -> Seq<T, E>
-
Signature:
@IntermediateOp @TerminalOpTriggered public Seq<T, E> reverseSortedBy(@SuppressWarnings("rawtypes") final Function<? super T, ? extends Comparable> keyMapper) throws IllegalStateException - Summary: Returns a new {@code Seq} with the elements sorted in reverse order according to natural order of the values extracted by the provided key extractor function.
-
Parameters:
-
keyMapper(@SuppressWarnings(value = "rawtypes") Function<? super T, ? extends Comparable>) — a function that extracts a comparable key from each element, which will be used for sorting
-
- Returns: a new {@code Seq} with the elements sorted in reverse order by the extracted key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #sortedBy(Function), #reverseSorted(Comparator)
cycled(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> cycled() throws IllegalStateException - Summary: Returns a new {@code Seq} that cycles through the elements of this sequence indefinitely.
-
Contract:
- When the end of the sequence is reached, it starts again from the beginning.
-
Parameters:
- (none)
- Returns: a new {@code Seq} that cycles through the elements indefinitely
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #cycled(long)
-
Signature:
@IntermediateOp public Seq<T, E> cycled(final long rounds) throws IllegalStateException - Summary: Returns a new {@code Seq} that cycles through the elements of this sequence for the specified number of rounds.
-
Contract:
- If rounds is 0, an empty sequence is returned.
-
Parameters:
-
rounds(long) — the number of times to cycle through the elements, must not be negative
-
- Returns: a new {@code Seq} that cycles through the elements for the specified number of rounds
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #cycled()
rateLimited(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> rateLimited(final double permitsPerSecond) throws IllegalStateException - Summary: Returns a new {@code Seq} that is rate-limited to the specified number of permits per second.
-
Parameters:
-
permitsPerSecond(double) — the number of permits per second to allow, must be positive
-
- Returns: a new {@code Seq} that is rate-limited to the specified number of permits per second
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: RateLimiter, #rateLimited(RateLimiter)
-
Signature:
@IntermediateOp public Seq<T, E> rateLimited(final RateLimiter rateLimiter) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} that is rate-limited using the specified {@link RateLimiter} .
-
Parameters:
-
rateLimiter(RateLimiter) — the rate limiter to use
-
- Returns: a new {@code Seq} that is rate-limited to the specified rate limiter
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the rate limiter is null
-
- See also: #rateLimited(double), #delay(Duration)
delay(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> delay(final Duration duration) throws IllegalStateException, IllegalArgumentException - Summary: Delays each element in this {@code Seq} by the given {@link Duration} except the first element.
-
Parameters:
-
duration(Duration) — the duration to delay each element
-
- Returns: a new {@code Seq} with each element delayed by the specified duration
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the duration is null
-
- See also: #rateLimited(double)
-
Signature:
@IntermediateOp public Seq<T, E> delay(final java.time.Duration duration) throws IllegalStateException, IllegalArgumentException - Summary: Delays each element in this {@code Seq} by the given {@link Duration} except the first element.
-
Parameters:
-
duration(java.time.Duration) — the duration to delay each element
-
- Returns: a new {@code Seq} with each element delayed by the specified duration
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the duration is null
-
- See also: #rateLimited(double)
debounce(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> debounce(final int maxWindowSize, final Duration duration) - Summary: Returns a new {@code Seq} that limits elements to at most {@code maxWindowSize} within each time window of the specified {@code duration} .
-
Contract:
- When the elapsed time exceeds the duration, the window slides forward and the element counter resets, allowing a new burst of elements.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Allow at most 5 elements per second Seq.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .debounce(5, Duration.ofSeconds(1)) .forEach(Fn.println()); // Only first 5 elements pass through immediately // Throttle log messages to at most 10 per minute Seq.of(logMessages) .debounce(10, Duration.ofMinutes(1)) .forEach(msg -> logger.info(msg)); // Limit API requests to 100 per hour Seq.of(requests) .debounce(100, Duration.ofHours(1)) .forEach(this::processRequest); } </pre> <p> <b> Behavior Details: </b> </p> <ul> <li> The time window starts when the first element is processed </li> <li> Elements within the limit are emitted immediately without delay </li> <li> Elements exceeding the limit within the window are silently dropped (filtered out) </li> <li> When the current time exceeds the window duration, the window advances and the counter resets </li> <li> The implementation uses {@link System#currentTimeMillis()} for time tracking </li> </ul> <p> <b> Comparison with {@code rateLimited} : </b> </p> <pre> {@code // debounce: allows bursting, then blocks until next window // Timeline: \[e1,e2,e3,e4,e5\]----gap----\[e6,e7,e8,e9,e10\]...
-
Parameters:
-
maxWindowSize(int) — the maximum number of elements to allow within each time window. Must be positive. -
duration(Duration) — the length of each time window. Must not be {@code null} and must have a positive millisecond value.
-
- Returns: a new {@code Seq} that limits elements to {@code maxWindowSize} per {@code duration} window
- See also: #rateLimited(double), #rateLimited(RateLimiter), #delay(Duration), #filter(Throwables.Predicate)
intersperse(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> intersperse(final T delimiter) throws IllegalStateException - Summary: Intersperses the specified delimiter between each element of this {@code Seq} .
-
Parameters:
-
delimiter(T) — the element to intersperse between each element of this {@code Seq}
-
- Returns: a new {@code Seq} with the delimiter interspersed between each element
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
step(...) -> Seq<T, E>
-
Signature:
@Beta @IntermediateOp public Seq<T, E> step(final long step) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new {@code Seq} that steps through the elements of this sequence with the specified step size.
-
Parameters:
-
step(long) — the step size to use when iterating through the elements. Must be greater than 0.
-
- Returns: a new {@code Seq} that steps through the elements with the specified step size
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the step size is less than or equal to zero
-
indexed(...) -> Seq<Indexed<T>, E>
-
Signature:
@Beta @IntermediateOp public Seq<Indexed<T>, E> indexed() throws IllegalStateException - Summary: Returns a new {@code Seq} where each element is paired with its index.
-
Parameters:
- (none)
- Returns: a new {@code Seq} where each element is wrapped in an {@link Indexed} object with its index
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
buffered(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> buffered() throws IllegalStateException - Summary: Returns a new sequence with elements from a temporary queue which is filled by reading the elements from this sequence asynchronously with a new thread.
-
Contract:
- This is useful for decoupling slow consumers from fast producers or when implementing read-write with different threads pattern.
- If the queue becomes full, the producer thread will block until space becomes available.
-
Parameters:
- (none)
- Returns: a new {@code Seq} with elements read asynchronously into a buffer
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #buffered(int)
-
Signature:
@IntermediateOp public Seq<T, E> buffered(final int bufferSize) throws IllegalStateException, IllegalArgumentException - Summary: Returns a new sequence with elements from a temporary queue which is filled by reading the elements from this sequence asynchronously with a new thread.
-
Contract:
- This is useful for decoupling slow consumers from fast producers or when implementing read-write with different threads pattern.
- </p> <p> If the queue becomes full, the producer thread will block until space becomes available.
-
Parameters:
-
bufferSize(int) — the size of the buffer queue. Must be greater than 0.
-
- Returns: a new {@code Seq} with elements read asynchronously into a buffer of the specified size
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the buffer size is less than or equal to zero
-
mergeWith(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> mergeWith(final Collection<? extends T> b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) throws IllegalStateException - Summary: Merges this sequence with the given collection using the provided next selector function.
-
Parameters:
-
b(Collection<? extends T>) — the collection to merge with this sequence -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a BiFunction that takes an element from this sequence and an element from the collection, and returns a MergeResult indicating which element(s) to select
-
- Returns: a new {@code Seq} resulting from merging this sequence with the given collection
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
-
Signature:
@IntermediateOp public Seq<T, E> mergeWith(final Seq<? extends T, E> b, final Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) throws IllegalStateException - Summary: Merges this sequence with the given sequence using the provided next selector function.
-
Parameters:
-
b(Seq<? extends T, E>) — the sequence to merge with this sequence -
nextSelector(Throwables.BiFunction<? super T, ? super T, MergeResult, E>) — a BiFunction that takes an element from each sequence and returns a MergeResult indicating which element(s) to select
-
- Returns: a new {@code Seq} resulting from merging this sequence with the given sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
zipWith(...) -> Seq<R, E>
-
Signature:
@IntermediateOp public <T2, R> Seq<R, E> zipWith(final Collection<T2> b, final Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given collection using the provided zip function.
-
Parameters:
-
b(Collection<T2>) — the Collection to be combined with the current Seq. Must be {@code non-null} . -
zipFunction(Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E>) — a BiFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Collection
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #zipWith(Collection, Object, Object, Throwables.BiFunction), N#zip(Iterable, Iterable, BiFunction)
-
Signature:
@IntermediateOp public <T2, R> Seq<R, E> zipWith(final Collection<T2> b, final T valueForNoneA, final T2 valueForNoneB, final Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given collection using the provided zip function.
-
Contract:
- If the current stream or the given collection runs out of elements before the other, the provided default values are used.
-
Parameters:
-
b(Collection<T2>) — the Collection to be combined with the current Seq. Must be {@code non-null} . -
valueForNoneA(T) — the default value to use for the current Seq when it runs out of elements -
valueForNoneB(T2) — the default value to use for the Collection when it runs out of elements -
zipFunction(Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E>) — a BiFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Collection
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
@IntermediateOp public <T2, T3, R> Seq<R, E> zipWith(final Collection<T2> b, final Collection<T3> c, final Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given collections using the provided zip function.
-
Parameters:
-
b(Collection<T2>) — the first Collection to be combined with the current Seq. Must be {@code non-null} . -
c(Collection<T3>) — the second Collection to be combined with the current Seq. Must be {@code non-null} . -
zipFunction(Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E>) — a TriFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Collections
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #zipWith(Collection, Collection, Object, Object, Object, Throwables.TriFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
@IntermediateOp public <T2, T3, R> Seq<R, E> zipWith(final Collection<T2> b, final Collection<T3> c, final T valueForNoneA, final T2 valueForNoneB, final T3 valueForNoneC, final Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given collections using the provided zip function.
-
Contract:
- If the current stream or one of the given collections runs out of elements before the other, the provided default values are used.
-
Parameters:
-
b(Collection<T2>) — the first Collection to be combined with the current Seq. Must be {@code non-null} . -
c(Collection<T3>) — the second Collection to be combined with the current Seq. Must be {@code non-null} . -
valueForNoneA(T) — the default value to use for the current Seq when it runs out of elements -
valueForNoneB(T2) — the default value to use for the first Collection when it runs out of elements -
valueForNoneC(T3) — the default value to use for the second Collection when it runs out of elements -
zipFunction(Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E>) — a TriFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Collections
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
@IntermediateOp public <T2, R> Seq<R, E> zipWith(final Seq<T2, E> b, final Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given stream using the provided zip function.
-
Parameters:
-
b(Seq<T2, E>) — the Seq to be combined with the current Seq. Must be {@code non-null} . -
zipFunction(Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E>) — a BiFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Seq
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #zipWith(Seq, Object, Object, Throwables.BiFunction), N#zip(Iterable, Iterable, BiFunction)
-
Signature:
@IntermediateOp public <T2, R> Seq<R, E> zipWith(final Seq<T2, E> b, final T valueForNoneA, final T2 valueForNoneB, final Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(Seq<T2, E>) — the Seq to be combined with the current Seq. Will be closed along with this Seq. -
valueForNoneA(T) — the default value to use for the current Seq when it runs out of elements -
valueForNoneB(T2) — the default value to use for the given Seq when it runs out of elements -
zipFunction(Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E>) — a BiFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Seq
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
@IntermediateOp public <T2, T3, R> Seq<R, E> zipWith(final Seq<T2, E> b, final Seq<T3, E> c, final Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) throws IllegalStateException - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(Seq<T2, E>) — the second Seq to be combined with the current Seq. Will be closed along with this Seq. -
c(Seq<T3, E>) — the third Seq to be combined with the current Seq. Will be closed along with this Seq. -
zipFunction(Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E>) — a TriFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Seqs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed
-
- See also: #zipWith(Seq, Seq, Object, Object, Object, Throwables.TriFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
@IntermediateOp public <T2, T3, R> Seq<R, E> zipWith(final Seq<T2, E> b, final Seq<T3, E> c, final T valueForNoneA, final T2 valueForNoneB, final T3 valueForNoneC, final Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) throws IllegalArgumentException - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(Seq<T2, E>) — the second Seq to be combined with the current Seq. Will be closed along with this Seq. -
c(Seq<T3, E>) — the third Seq to be combined with the current Seq. Will be closed along with this Seq. -
valueForNoneA(T) — the default value to use for the current Seq when it runs out of elements -
valueForNoneB(T2) — the default value to use for the second Seq when it runs out of elements -
valueForNoneC(T3) — the default value to use for the third Seq when it runs out of elements -
zipFunction(Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E>) — a TriFunction that determines the combination of elements in the combined Seq. Must be {@code non-null} .
-
- Returns: a new Seq that is the result of combining the current Seq with the given Seqs
-
Throws:
-
java.lang.IllegalArgumentException
-
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
foreach(...) -> void
-
Signature:
@Beta @TerminalOp public void foreach(final Consumer<? super T> action) throws E - Summary: Performs the given action for each element of this sequence.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on each element
-
-
Throws:
-
E— if an exception occurs during iteration
-
- See also: #forEach(Throwables.Consumer)
forEach(...) -> void
-
Signature:
@TerminalOp public <E2 extends Exception> void forEach(final Throwables.Consumer<? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action for each element of this sequence.
-
Parameters:
-
action(Throwables.Consumer<? super T, E2>) — a non-interfering action to perform on each element
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
-
Signature:
@TerminalOp public <E2 extends Exception, E3 extends Exception> void forEach(final Throwables.Consumer<? super T, E2> action, final Throwables.Runnable<E3> onComplete) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Performs the given action for each element of this sequence, and then performs the provided onComplete action.
-
Contract:
- <p> The onComplete action is executed even if no elements are present in the sequence, but is not executed if an exception occurs during element processing.
-
Parameters:
-
action(Throwables.Consumer<? super T, E2>) — a non-interfering action to perform on each element -
onComplete(Throwables.Runnable<E3>) — a Runnable to execute after all elements have been processed
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action or onComplete is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception -
E3— if the onComplete action throws an exception
-
-
Signature:
@TerminalOp public <U, E2 extends Exception, E3 extends Exception> void forEach(final Throwables.Function<? super T, ? extends Iterable<? extends U>, E2> flatMapper, final Throwables.BiConsumer<? super T, ? super U, E3> action) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Iterates over the elements, applying a flat-mapping function to each element and executing an action on the results.
-
Parameters:
-
flatMapper(Throwables.Function<? super T, ? extends Iterable<? extends U>, E2>) — a function that returns an Iterable for each element -
action(Throwables.BiConsumer<? super T, ? super U, E3>) — a BiConsumer that processes the original element and each item from the Iterable
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the flatMapper or action is null -
E— if an exception occurs during iteration -
E2— if the flat-mapper throws an exception -
E3— if the action throws an exception
-
-
Signature:
@TerminalOp public <T2, T3, E2 extends Exception, E3 extends Exception, E4 extends Exception> void forEach( final Throwables.Function<? super T, ? extends Iterable<T2>, E2> flatMapper, final Throwables.Function<? super T2, ? extends Iterable<T3>, E3> flatMapper2, final Throwables.TriConsumer<? super T, ? super T2, ? super T3, E4> action) throws IllegalStateException, IllegalArgumentException, E, E2, E3, E4 - Summary: Iterates over the elements, applying two levels of flat-mapping and executing an action on the results.
-
Parameters:
-
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E2>) — a function that returns an Iterable of T2 for each element -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E3>) — a function that returns an Iterable of T3 for each T2 -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E4>) — a TriConsumer that processes the original element, T2, and T3
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if any of the parameters is null -
E— if an exception occurs during iteration -
E2— if the first flat-mapper throws an exception -
E3— if the second flat-mapper throws an exception -
E4— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachIndexed(final Throwables.IntObjConsumer<? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action for each element of this sequence, providing the element's index.
-
Parameters:
-
action(Throwables.IntObjConsumer<? super T, E2>) — a non-interfering action that accepts an index and element
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
forEachUntil(...) -> void
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachUntil(final Throwables.BiConsumer<? super T, MutableBoolean, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Iterates and executes the given action until the flag is set to {@code true} .
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Process elements until sum exceeds 100 MutableInt sum = MutableInt.of(0); seq.forEachUntil((value, flag) -> { sum.add(value); if (sum.value() > 100) { flag.setTrue(); } }); } </pre>
-
Parameters:
-
action(Throwables.BiConsumer<? super T, MutableBoolean, E2>) — a BiConsumer that takes an element and a MutableBoolean flag. Set the flag to {@code true} to break the loop.
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
- See also: #forEachUntil(MutableBoolean, Throwables.Consumer)
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachUntil(final MutableBoolean flagToBreak, final Throwables.Consumer<? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Iterates and executes the action until the flag is set to {@code true} .
-
Parameters:
-
flagToBreak(MutableBoolean) — a MutableBoolean flag to control iteration. Set to {@code true} to stop. -
action(Throwables.Consumer<? super T, E2>) — a Consumer to be applied to each element while the flag is {@code false}
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
- See also: #forEachUntil(Throwables.BiConsumer)
forEachPair(...) -> void
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachPair(final Throwables.BiConsumer<? super T, ? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action on each adjacent pair of elements in this sequence.
-
Contract:
- </p> <p> If the sequence has fewer than 2 elements, no action is performed.
-
Parameters:
-
action(Throwables.BiConsumer<? super T, ? super T, E2>) — a non-interfering action to perform on each adjacent pair of elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachPair(final int increment, final Throwables.BiConsumer<? super T, ? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action on pairs of elements with the specified increment between pairs.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair (must be positive) -
action(Throwables.BiConsumer<? super T, ? super T, E2>) — a non-interfering action to perform on each pair of elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is {@code null} or increment is not positive -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
forEachTriple(...) -> void
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachTriple(final Throwables.TriConsumer<? super T, ? super T, ? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action on each adjacent triple of elements in this sequence.
-
Contract:
- </p> <p> If the sequence has fewer than 3 elements, no action is performed.
-
Parameters:
-
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E2>) — a non-interfering action to perform on each adjacent triple of elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is null -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> void forEachTriple(final int increment, final Throwables.TriConsumer<? super T, ? super T, ? super T, E2> action) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs the given action on triples of elements with the specified increment between triples.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple (must be positive) -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E2>) — a non-interfering action to perform on each triple of elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the action is {@code null} or increment is not positive -
E— if an exception occurs during iteration -
E2— if the action throws an exception
-
min(...) -> Optional<T>
-
Signature:
@TerminalOp public Optional<T> min(Comparator<? super T> comparator) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an Optional containing the minimum element according to the provided comparator.
-
Contract:
- </p> <p> If the sequence is already sorted with the same comparator, this operation will return the first element for optimal performance.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to determine the order of elements
-
- Returns: an Optional containing the minimum element, or empty if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the specified comparator is null -
E— if an exception occurs during iteration
-
- See also: #minBy(Function), Iterables#min(Iterable, Comparator)
minBy(...) -> Optional<T>
-
Signature:
@TerminalOp @SuppressWarnings("rawtypes") public Optional<T> minBy(final Function<? super T, ? extends Comparable> keyMapper) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an Optional containing the minimum element according to the key extracted by the keyMapper function.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — the function to extract the comparable key for comparison
-
- Returns: an Optional containing the element with the minimum key, or empty if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the specified keyMapper is null -
E— if an exception occurs during iteration
-
- See also: #min(Comparator), Iterables#minBy(Iterable, Function)
max(...) -> Optional<T>
-
Signature:
@TerminalOp public Optional<T> max(Comparator<? super T> comparator) throws IllegalStateException, E - Summary: Returns an {@code Optional} containing the maximum element of this sequence according to the provided comparator.
-
Contract:
- Returns an empty {@code Optional} if this sequence is empty.
-
Parameters:
-
comparator(Comparator<? super T>) — a non-interfering, stateless {@code Comparator} to compare elements of this sequence. If {@code null} , natural ordering is used
-
- Returns: an {@code Optional} describing the maximum element of this sequence, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during the computation
-
- See also: #min(Comparator), #maxBy(Function)
maxBy(...) -> Optional<T>
-
Signature:
@TerminalOp @SuppressWarnings("rawtypes") public Optional<T> maxBy(final Function<? super T, ? extends Comparable> keyMapper) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an {@code Optional} containing the maximum element of this sequence according to the comparable value extracted by the provided key mapper function.
-
Contract:
- Returns an empty {@code Optional} if this sequence is empty.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — the function used to extract the {@code Comparable} sort key from each element
-
- Returns: an {@code Optional} describing the element with the maximum extracted key value, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified keyMapper is {@code null} -
E— if an exception occurs during the computation
-
- See also: #max(Comparator), #minBy(Function), Iterables#maxBy(Iterable, Function)
anyMatch(...) -> boolean
-
Signature:
@TerminalOp public <E2 extends Exception> boolean anyMatch(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns whether any elements of this sequence match the provided predicate.
-
Contract:
- Returns {@code false} if the sequence is empty.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: {@code true} if any elements of the sequence match the provided predicate, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #allMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate), N#anyMatch(Iterable, Predicate)
allMatch(...) -> boolean
-
Signature:
@TerminalOp public <E2 extends Exception> boolean allMatch(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns whether all elements of this sequence match the provided predicate.
-
Contract:
- Returns {@code true} if the sequence is empty.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: {@code true} if either all elements of the sequence match the provided predicate or the sequence is empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate), N#allMatch(Iterable, Predicate)
noneMatch(...) -> boolean
-
Signature:
@TerminalOp public <E2 extends Exception> boolean noneMatch(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns whether no elements of this sequence match the provided predicate.
-
Contract:
- Returns {@code true} if the sequence is empty.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: {@code true} if either no elements of the sequence match the provided predicate or the sequence is empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.Predicate), #allMatch(Throwables.Predicate), N#noneMatch(Iterable, Predicate)
nMatch(...) -> boolean
-
Signature:
@TerminalOp public <E2 extends Exception> boolean nMatch(final long atLeast, final long atMost, final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Returns whether the number of elements matching the provided predicate is between {@code atLeast} and {@code atMost} , inclusive.
-
Parameters:
-
atLeast(long) — the minimum number of elements that must match the predicate (inclusive) -
atMost(long) — the maximum number of elements that can match the predicate (inclusive) -
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: {@code true} if the number of elements matching the predicate is between {@code atLeast} and {@code atMost} (inclusive), otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if {@code atLeast} or {@code atMost} is negative, or if {@code atMost} is less than {@code atLeast} -
E— if an exception occurs while processing the stream -
E2— if the predicate throws an exception
-
findFirst(...) -> Optional<T>
-
Signature:
@TerminalOp public <E2 extends Exception> Optional<T> findFirst(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns an {@code Optional} describing the first element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
-
Contract:
- Returns an {@code Optional} describing the first element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: an {@code Optional} describing the first element that matches the predicate, or an empty {@code Optional} if no such element exists
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #findAny(Throwables.Predicate), #findLast(Throwables.Predicate), N#findFirst(Iterable, Predicate)
findAny(...) -> Optional<T>
-
Signature:
@Deprecated @TerminalOp public <E2 extends Exception> Optional<T> findAny(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns an {@code Optional} describing the first element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
-
Contract:
- Returns an {@code Optional} describing the first element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: an {@code Optional} describing the first element that matches the predicate, or an empty {@code Optional} if no such element exists
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #findFirst(Throwables.Predicate)
findLast(...) -> Optional<T>
-
Signature:
@Beta @TerminalOp public <E2 extends Exception> Optional<T> findLast(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Returns an {@code Optional} describing the last element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
-
Contract:
- Returns an {@code Optional} describing the last element of this sequence that matches the given predicate, or an empty {@code Optional} if no such element exists.
- </p> <p> Performance note: Consider using {@code seq.reversed().findFirst(predicate)} for better performance if the sequence supports efficient reversal.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — a non-interfering, stateless predicate to apply to elements of this sequence
-
- Returns: an {@code Optional} describing the last element that matches the predicate, or an empty {@code Optional} if no such element exists
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration -
E2— if the predicate throws an exception
-
- See also: #reversed(), #findFirst(Throwables.Predicate), N#findLast(Iterable, Predicate)
containsAll(...) -> boolean
-
Signature:
@TerminalOp @SafeVarargs public final boolean containsAll(final T... a) throws IllegalStateException, E - Summary: Returns whether this sequence contains all of the specified elements.
-
Parameters:
-
a(T[]) — the elements to check for containment in this sequence
-
- Returns: {@code true} if this sequence contains all of the specified elements, or if this sequence is empty, or if {@code a} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAny(Object\[\]), #containsNone(Object\[\]), N#containsAll(Collection, Object...)
-
Signature:
@TerminalOp public boolean containsAll(final Collection<? extends T> c) throws IllegalStateException, E - Summary: Returns whether this sequence contains all elements in the specified collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to check for containment in this sequence
-
- Returns: {@code true} if this sequence contains all elements in the specified collection, or if this sequence is empty, or if {@code c} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAny(Collection), #containsNone(Collection), N#containsAll(Collection, Collection)
containsAny(...) -> boolean
-
Signature:
@TerminalOp @SafeVarargs public final boolean containsAny(final T... a) throws IllegalStateException, E - Summary: Returns whether this sequence contains any of the specified elements.
-
Parameters:
-
a(T[]) — the elements to check for containment in this sequence
-
- Returns: {@code true} if this sequence contains any of the specified elements, or if this sequence is empty, or if {@code a} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAll(Object\[\]), #containsNone(Object\[\]), N#containsAny(Collection, Object...)
-
Signature:
@TerminalOp public boolean containsAny(final Collection<? extends T> c) throws IllegalStateException, E - Summary: Returns whether this sequence contains any element from the specified collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to check for containment in this sequence
-
- Returns: {@code true} if this sequence contains any element from the specified collection, or if this sequence is empty, or if {@code c} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAll(Collection), #containsNone(Collection), N#containsAny(Collection, Collection)
containsNone(...) -> boolean
-
Signature:
@TerminalOp @SafeVarargs public final boolean containsNone(final T... a) throws IllegalStateException, E - Summary: Returns whether this sequence contains none of the specified elements.
-
Parameters:
-
a(T[]) — the elements to check for non-containment in this sequence
-
- Returns: {@code true} if this sequence doesn't contain any of the specified elements, or if this sequence is empty, or if {@code a} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAll(Object\[\]), #containsAny(Object\[\])
-
Signature:
@TerminalOp public boolean containsNone(final Collection<? extends T> c) throws IllegalStateException, E - Summary: Returns whether this sequence contains none of the elements from the specified collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to check for non-containment in this sequence
-
- Returns: {@code true} if this sequence doesn't contain any element from the specified collection, or if this sequence is empty, or if {@code c} is {@code null} or empty, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #containsAll(Collection), #containsAny(Collection)
hasDuplicates(...) -> boolean
-
Signature:
@TerminalOp public boolean hasDuplicates() throws IllegalStateException, E - Summary: Returns whether this sequence contains duplicate elements.
-
Parameters:
- (none)
- Returns: {@code true} if this sequence contains at least one duplicate element, otherwise {@code false}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: N#hasDuplicates(Collection)
kthLargest(...) -> Optional<T>
-
Signature:
@TerminalOp public Optional<T> kthLargest(final int k, Comparator<? super T> comparator) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an {@code Optional} containing the k-th largest element in this sequence according to the provided comparator, or an empty {@code Optional} if this sequence has fewer than k elements.
-
Contract:
- Returns an {@code Optional} containing the k-th largest element in this sequence according to the provided comparator, or an empty {@code Optional} if this sequence has fewer than k elements.
-
Parameters:
-
k(int) — the position (1-based) of the largest element to find. For example, k=1 finds the largest element, k=2 finds the second largest, etc. -
comparator(Comparator<? super T>) — the comparator to determine the order of elements. If {@code null} , natural ordering is used
-
- Returns: an {@code Optional} containing the k-th largest element, or an empty {@code Optional} if the sequence has fewer than k elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if k is less than 1 -
E— if an exception occurs during iteration
-
- See also: N#kthLargest(Collection, int, Comparator)
percentiles(...) -> Optional<Map<Percentage, T>>
-
Signature:
public Optional<Map<Percentage, T>> percentiles() throws IllegalStateException, E - Summary: Calculates the percentiles of the elements in the sequence.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing a map where keys are {@code Percentage} values and values are the corresponding elements at those percentiles, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: N#percentilesOfSorted(int\[\])
-
Signature:
@TerminalOp public Optional<Map<Percentage, T>> percentiles(final Comparator<? super T> comparator) throws IllegalStateException, IllegalArgumentException, E - Summary: Calculates the percentiles of the elements in the sequence according to the provided comparator.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
-
comparator(Comparator<? super T>) — a comparator to determine the order of elements for percentile calculation
-
- Returns: an {@code Optional} containing a map where keys are {@code Percentage} values and values are the corresponding elements at those percentiles, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified comparator is {@code null} -
E— if an exception occurs during iteration
-
- See also: N#percentilesOfSorted(int\[\])
first(...) -> Optional<T>
-
Signature:
@TerminalOp public Optional<T> first() throws IllegalStateException, E - Summary: Returns an {@code Optional} describing the first element of this sequence, or an empty {@code Optional} if the sequence is empty.
-
Contract:
- Returns an {@code Optional} describing the first element of this sequence, or an empty {@code Optional} if the sequence is empty.
-
Parameters:
- (none)
- Returns: an {@code Optional} describing the first element of this sequence, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #last(), #elementAt(long)
elementAt(...) -> Optional<T>
-
Signature:
@Beta @TerminalOp public Optional<T> elementAt(final long position) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an {@code Optional} describing the element at the specified position in this sequence, or an empty {@code Optional} if the sequence has fewer elements than the specified position.
-
Contract:
- Returns an {@code Optional} describing the element at the specified position in this sequence, or an empty {@code Optional} if the sequence has fewer elements than the specified position.
-
Parameters:
-
position(long) — the position of the element to return (0-based index)
-
- Returns: an {@code Optional} describing the element at the specified position, or an empty {@code Optional} if the sequence has fewer than {@code position + 1} elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if {@code position} is negative -
E— if an exception occurs during iteration
-
- See also: #first(), #last()
onlyOne(...) -> Optional<T>
-
Signature:
@TerminalOp public Optional<T> onlyOne() throws IllegalStateException, TooManyElementsException, E - Summary: Returns an {@code Optional} describing the only element of this sequence, or an empty {@code Optional} if the sequence is empty.
-
Contract:
- Returns an {@code Optional} describing the only element of this sequence, or an empty {@code Optional} if the sequence is empty.
- If the sequence contains more than one element, a {@code TooManyElementsException} is thrown.
-
Parameters:
- (none)
- Returns: an {@code Optional} describing the only element of this sequence, or an empty {@code Optional} if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
com.landawn.abacus.exception.TooManyElementsException— if the sequence contains more than one element -
E— if an exception occurs during iteration
-
count(...) -> long
-
Signature:
@TerminalOp public long count() throws IllegalStateException, E - Summary: Returns the count of elements in this sequence.
-
Parameters:
- (none)
- Returns: the count of elements in this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
toArray(...) -> Object\[\]
-
Signature:
@TerminalOp public Object[] toArray() throws IllegalStateException, E - Summary: Returns an array containing all the elements of this sequence.
-
Parameters:
- (none)
- Returns: an array containing all the elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #toArray(IntFunction), #toList()
-
Signature:
@TerminalOp public <A> A[] toArray(final IntFunction<A[]> generator) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns an array containing all the elements of this sequence, using the provided generator function to allocate the returned array.
-
Parameters:
-
generator(IntFunction<A[]>) — a function which produces a new array of the desired type and the provided length
-
- Returns: an array containing all the elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the generator function is {@code null} -
E— if an exception occurs during iteration
-
- See also: #toList(), List#toArray(IntFunction)
toList(...) -> List<T>
-
Signature:
@TerminalOp public List<T> toList() throws IllegalStateException, E - Summary: Returns a {@code List} containing all the elements of this sequence in encounter order.
-
Parameters:
- (none)
- Returns: a {@code List} containing all the elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #toSet(), #toCollection(Supplier)
toSet(...) -> Set<T>
-
Signature:
@TerminalOp public Set<T> toSet() throws IllegalStateException, E - Summary: Returns a {@code Set} containing all the distinct elements of this sequence.
-
Parameters:
- (none)
- Returns: a {@code Set} containing all the distinct elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #toList(), #toCollection(Supplier)
toCollection(...) -> C
-
Signature:
@TerminalOp public <C extends Collection<T>> C toCollection(final Supplier<? extends C> supplier) throws IllegalStateException, IllegalArgumentException, E - Summary: Returns a collection containing all the elements of this sequence, using the provided supplier to create the collection instance.
-
Parameters:
-
supplier(Supplier<? extends C>) — a function which returns a new, empty collection of the appropriate type
-
- Returns: a collection containing all the elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the supplier function is {@code null} -
E— if an exception occurs during iteration
-
- See also: #toList(), #toSet()
toImmutableList(...) -> ImmutableList<T>
-
Signature:
@TerminalOp public ImmutableList<T> toImmutableList() throws IllegalStateException, E - Summary: Returns an immutable list containing all the elements of this sequence in encounter order.
-
Parameters:
- (none)
- Returns: an immutable list containing all the elements of this sequence in encounter order
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #toList(), #toImmutableSet()
toImmutableSet(...) -> ImmutableSet<T>
-
Signature:
@TerminalOp public ImmutableSet<T> toImmutableSet() throws IllegalStateException, E - Summary: Returns an immutable set containing all the distinct elements of this sequence.
-
Parameters:
- (none)
- Returns: an immutable set containing all the distinct elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
E— if an exception occurs during iteration
-
- See also: #toSet(), #toImmutableList()
toListThenApply(...) -> R
-
Signature:
@TerminalOp public <R, E2 extends Exception> R toListThenApply(final Throwables.Function<? super List<T>, R, E2> func) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all elements of this sequence into a list and applies the given function to it.
-
Parameters:
-
func(Throwables.Function<? super List<T>, R, E2>) — the function to apply to the list of all elements
-
- Returns: the result of applying the function to the list
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified function is {@code null} -
E— if an exception occurs during iteration -
E2— if the function throws an exception
-
- See also: #toListThenAccept(Throwables.Consumer), #toSetThenApply(Throwables.Function)
toListThenAccept(...) -> void
-
Signature:
@TerminalOp public <E2 extends Exception> void toListThenAccept(final Throwables.Consumer<? super List<T>, E2> consumer) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all elements of this sequence into a list and performs the given action on it.
-
Parameters:
-
consumer(Throwables.Consumer<? super List<T>, E2>) — the action to perform on the list of all elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified consumer is {@code null} -
E— if an exception occurs during iteration -
E2— if the consumer throws an exception
-
- See also: #toListThenApply(Throwables.Function), #toSetThenAccept(Throwables.Consumer)
toSetThenApply(...) -> R
-
Signature:
@TerminalOp public <R, E2 extends Exception> R toSetThenApply(final Throwables.Function<? super Set<T>, R, E2> func) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all distinct elements of this sequence into a set and applies the given function to it.
-
Parameters:
-
func(Throwables.Function<? super Set<T>, R, E2>) — the function to apply to the set of distinct elements
-
- Returns: the result of applying the function to the set
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified function is {@code null} -
E— if an exception occurs during iteration -
E2— if the function throws an exception
-
- See also: #toSetThenAccept(Throwables.Consumer), #toListThenApply(Throwables.Function)
toSetThenAccept(...) -> void
-
Signature:
@TerminalOp public <E2 extends Exception> void toSetThenAccept(final Throwables.Consumer<? super Set<T>, E2> consumer) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all distinct elements of this sequence into a set and performs the given action on it.
-
Parameters:
-
consumer(Throwables.Consumer<? super Set<T>, E2>) — the action to perform on the set of distinct elements
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified consumer is {@code null} -
E— if an exception occurs during iteration -
E2— if the consumer throws an exception
-
- See also: #toSetThenApply(Throwables.Function), #toListThenAccept(Throwables.Consumer)
toCollectionThenApply(...) -> R
-
Signature:
@TerminalOp public <R, C extends Collection<T>, E2 extends Exception> R toCollectionThenApply(final Supplier<? extends C> supplier, final Throwables.Function<? super C, R, E2> func) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all elements of this sequence into a collection created by the supplier and applies the given function to it.
-
Parameters:
-
supplier(Supplier<? extends C>) — a function which returns a new, empty collection of the appropriate type -
func(Throwables.Function<? super C, R, E2>) — the function to apply to the collection
-
- Returns: the result of applying the function to the collection
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified supplier or function is {@code null} -
E— if an exception occurs during iteration -
E2— if the function throws an exception
-
- See also: #toCollectionThenAccept(Supplier, Throwables.Consumer)
toCollectionThenAccept(...) -> void
-
Signature:
@TerminalOp public <C extends Collection<T>, E2 extends Exception> void toCollectionThenAccept(final Supplier<? extends C> supplier, final Throwables.Consumer<? super C, E2> consumer) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects all elements of this sequence into a collection created by the supplier and performs the given action on it.
-
Parameters:
-
supplier(Supplier<? extends C>) — a function which returns a new, empty collection of the appropriate type -
consumer(Throwables.Consumer<? super C, E2>) — the action to perform on the collection
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed -
java.lang.IllegalArgumentException— if the specified supplier or consumer is {@code null} -
E— if an exception occurs during iteration -
E2— if the consumer throws an exception
-
- See also: #toCollectionThenApply(Supplier, Throwables.Function)
toMap(...) -> Map<K, V>
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception> Map<K, V> toMap(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper) throws IllegalStateException, E, E2, E3 - Summary: Converts the elements in this sequence to a Map using the provided key and value extractors.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} will be thrown.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} .
-
- Returns: a Map containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed or there are duplicate keys -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
-
Signature:
@TerminalOp public <K, V, M extends Map<K, V>, E2 extends Exception, E3 extends Exception> M toMap(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2, E3 - Summary: Converts the elements in this sequence to a Map using the provided key and value extractors, storing the results in a map created by the specified map factory.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} will be thrown.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed or there are duplicate keys -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception, E4 extends Exception> Map<K, V> toMap( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Throwables.BinaryOperator<V, E4> mergeFunction) throws IllegalStateException, E, E2, E3, E4 - Summary: Converts the elements in this sequence to a Map using the provided key and value extractors, with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the merge function is applied to resolve the conflict between the existing and new values.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mergeFunction(Throwables.BinaryOperator<V, E4>) — the function to resolve collisions between values associated with the same key. Must not be {@code null} .
-
- Returns: a Map containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction -
E4— if an exception occurs during merging
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
-
Signature:
@TerminalOp public <K, V, M extends Map<K, V>, E2 extends Exception, E3 extends Exception, E4 extends Exception> M toMap( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Throwables.BinaryOperator<V, E4> mergeFunction, final Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2, E3, E4 - Summary: Converts the elements in this sequence to a Map using the provided key and value extractors, with a merge function to handle duplicate keys and a custom map factory.
-
Contract:
- When duplicate keys are encountered, the merge function is applied to resolve the conflict between the existing and new values.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mergeFunction(Throwables.BinaryOperator<V, E4>) — the function to resolve collisions between values associated with the same key. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction -
E4— if an exception occurs during merging
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
toImmutableMap(...) -> ImmutableMap<K, V>
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception> ImmutableMap<K, V> toImmutableMap(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper) throws IllegalStateException, E, E2, E3 - Summary: Converts the elements in this sequence to an ImmutableMap using the provided key and value extractors.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} will be thrown.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} .
-
- Returns: an ImmutableMap containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed or there are duplicate keys -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception, E4 extends Exception> ImmutableMap<K, V> toImmutableMap( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Throwables.BinaryOperator<V, E4> mergeFunction) throws IllegalStateException, E, E2, E3, E4 - Summary: Converts the elements in this sequence to an ImmutableMap using the provided key and value extractors, with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the merge function is applied to resolve the conflict between the existing and new values.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mergeFunction(Throwables.BinaryOperator<V, E4>) — the function to resolve collisions between values associated with the same key. Must not be {@code null} .
-
- Returns: an ImmutableMap containing the elements of this sequence transformed into key-value pairs
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction -
E4— if an exception occurs during merging
-
- See also: Fnn#throwingMerger(), Fnn#replacingMerger(), Fnn#ignoringMerger()
groupTo(...) -> Map<K, List<T>>
-
Signature:
@TerminalOp public <K, E2 extends Exception> Map<K, List<T>> groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper) throws IllegalStateException, E, E2 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} .
-
- Returns: a Map where each key is associated with a list of elements that share that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
- See also: #groupTo(Throwables.Function, Supplier)
-
Signature:
@TerminalOp public <K, M extends Map<K, List<T>>, E2 extends Exception> M groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, storing the results in a map created by the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map where each key is associated with a list of elements that share that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
- See also: Collectors#groupingBy(Function, Supplier)
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception> Map<K, List<V>> groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper) throws IllegalStateException, E, E2, E3 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, and transforms the values using the provided value extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} .
-
- Returns: a Map where each key is associated with a list of values that share that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
- See also: #groupTo(Throwables.Function, Throwables.Function, Supplier)
-
Signature:
@TerminalOp public <K, V, M extends Map<K, List<V>>, E2 extends Exception, E3 extends Exception> M groupTo( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Supplier<? extends M> mapFactory) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, transforms the values using the provided value extractor function, and stores the results in a map created by the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map where each key is associated with a list of values that share that key
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the key extractor, value extractor, or map factory is null -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
- See also: #groupTo(Throwables.Function, Collector, Supplier), Collectors#groupingBy(Function, Supplier)
-
Signature:
@TerminalOp public <K, D, E2 extends Exception> Map<K, D> groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Collector<? super T, ?, D> downstream) throws IllegalStateException, E, E2 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function and collects the grouped elements using the provided downstream collector.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
downstream(Collector<? super T, ?, D>) — the collector to collect the grouped elements. Must not be {@code null} .
-
- Returns: a Map where each key is associated with the result of the downstream collector
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
-
Signature:
@TerminalOp public <K, D, M extends Map<K, D>, E2 extends Exception> M groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Collector<? super T, ?, D> downstream, final Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, collects the grouped elements using the provided downstream collector, and stores the results in a map created by the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
downstream(Collector<? super T, ?, D>) — the collector to collect the grouped elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map where each key is associated with the result of the downstream collector
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
-
Signature:
@TerminalOp public <K, V, D, E2 extends Exception, E3 extends Exception> Map<K, D> groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Collector<? super V, ?, D> downstream) throws IllegalStateException, E, E2, E3 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, transforms the values using the provided value extractor, and collects the transformed values using the provided downstream collector.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
downstream(Collector<? super V, ?, D>) — the collector to collect the grouped values. Must not be {@code null} .
-
- Returns: a Map where each key is associated with the result of the downstream collector
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
-
Signature:
@TerminalOp public <K, V, D, M extends Map<K, D>, E2 extends Exception, E3 extends Exception> M groupTo(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Collector<? super V, ?, D> downstream, final Supplier<? extends M> mapFactory) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Groups the elements in this sequence by the keys extracted using the provided key extractor function, transforms the values using the provided value extractor, collects the transformed values using the provided downstream collector, and stores the results in a map created by the specified map factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
downstream(Collector<? super V, ?, D>) — the collector to collect the grouped values. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting map. Must not be {@code null} .
-
- Returns: a Map where each key is associated with the result of the downstream collector
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the key extractor, value extractor, downstream collector or map supplier is null -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
partitionTo(...) -> Map<Boolean, List<T>>
-
Signature:
@TerminalOp public <E2 extends Exception> Map<Boolean, List<T>> partitionTo(final Throwables.Predicate<? super T, E2> predicate) throws IllegalStateException, E, E2 - Summary: Partitions the elements in this sequence into a map of two lists based on the provided predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — the predicate to test elements. Must not be {@code null} .
-
- Returns: a Map with two entries: {@code true} for elements that match the predicate, and {@code false} for elements that do not
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during predicate evaluation
-
-
Signature:
@TerminalOp public <D, E2 extends Exception> Map<Boolean, D> partitionTo(final Throwables.Predicate<? super T, E2> predicate, final Collector<? super T, ?, D> downstream) throws IllegalStateException, E, E2 - Summary: Partitions the elements in this sequence into a map of two collected results based on the provided predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E2>) — the predicate to test elements. Must not be {@code null} . -
downstream(Collector<? super T, ?, D>) — the collector to apply to each partition. Must not be {@code null} .
-
- Returns: a Map with two entries: {@code true} for collected result that match the predicate, and {@code false} for collected result that do not
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during predicate evaluation
-
toMultimap(...) -> ListMultimap<K, T>
-
Signature:
@TerminalOp public <K, E2 extends Exception> ListMultimap<K, T> toMultimap(final Throwables.Function<? super T, ? extends K, E2> keyMapper) throws IllegalStateException, E, E2 - Summary: Converts the elements in this sequence into a ListMultimap based on the provided key extractor function.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} .
-
- Returns: a ListMultimap where the keys are generated by the key extractor function and the values are the elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
-
Signature:
@TerminalOp public <K, V extends Collection<T>, M extends Multimap<K, T, V>, E2 extends Exception> M toMultimap( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2 - Summary: Converts the elements in this sequence into a multimap based on the provided key extractor function, using a custom multimap factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting multimap. Must not be {@code null} .
-
- Returns: a multimap where the keys are generated by the key extractor function and the values are the elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction
-
-
Signature:
@TerminalOp public <K, V, E2 extends Exception, E3 extends Exception> ListMultimap<K, V> toMultimap(final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper) throws IllegalStateException, E, E2, E3 - Summary: Converts the elements in this sequence into a ListMultimap based on the provided key and value extractor functions.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} .
-
- Returns: a ListMultimap where the keys are generated by the key extractor function and the values are generated by the value extractor function
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
-
Signature:
@TerminalOp public <K, V, C extends Collection<V>, M extends Multimap<K, V, C>, E2 extends Exception, E3 extends Exception> M toMultimap( final Throwables.Function<? super T, ? extends K, E2> keyMapper, final Throwables.Function<? super T, ? extends V, E3> valueMapper, final Supplier<? extends M> mapFactory) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Converts the elements in this sequence into a multimap based on the provided key and value extractor functions, using a custom multimap factory.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E2>) — the function to extract keys from the elements. Must not be {@code null} . -
valueMapper(Throwables.Function<? super T, ? extends V, E3>) — the function to extract values from the elements. Must not be {@code null} . -
mapFactory(Supplier<? extends M>) — the supplier to create the resulting multimap. Must not be {@code null} .
-
- Returns: a multimap where the keys are generated by the key extractor function and the values are generated by the value extractor function
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the key extractor, value extractor or map factory is null -
E— if an exception occurs during iteration -
E2— if an exception occurs during key extraction -
E3— if an exception occurs during value extraction
-
toMultiset(...) -> Multiset<T>
-
Signature:
@TerminalOp public Multiset<T> toMultiset() throws IllegalStateException, E - Summary: Converts the elements in this sequence into a Multiset.
-
Parameters:
- (none)
- Returns: a Multiset containing all the elements from this sequence with their occurrence counts
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration
-
-
Signature:
@TerminalOp public Multiset<T> toMultiset(final Supplier<? extends Multiset<T>> supplier) throws IllegalStateException, IllegalArgumentException, E - Summary: Converts the elements in this sequence into a Multiset using the specified supplier.
-
Parameters:
-
supplier(Supplier<? extends Multiset<T>>) — the supplier to create the resulting multiset. Must not be {@code null} .
-
- Returns: a Multiset containing all the elements from this sequence with their occurrence counts
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the specified supplier is null -
E— if an exception occurs during iteration
-
toDataset(...) -> Dataset
-
Signature:
@Beta @TerminalOp public Dataset toDataset() throws IllegalStateException, E - Summary: Converts the elements of this sequence into a Dataset.
-
Contract:
- The element type {@code T} in this sequence must be a Map or Bean for retrieving column names.
-
Parameters:
- (none)
- Returns: a Dataset containing the elements from this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the conversion
-
- See also: N#newDataset(Collection)
-
Signature:
@TerminalOp public Dataset toDataset(final List<String> columnNames) throws IllegalStateException, E - Summary: Converts the elements of the sequence into a Dataset.
-
Contract:
- The element type {@code T} in this stream must be an array/collection, Map or Bean.
-
Parameters:
-
columnNames(List<String>) — the list of column names to be used in the Dataset. Must not be {@code null} .
-
- Returns: a Dataset containing the elements from this sequence with the specified column names
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the conversion
-
- See also: N#newDataset(Collection, Collection)
sumInt(...) -> long
-
Signature:
@TerminalOp public <E2 extends Exception> long sumInt(final Throwables.ToIntFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Sums the integer values extracted from the elements in this sequence using the provided function.
-
Parameters:
-
func(Throwables.ToIntFunction<? super T, E2>) — the function to extract integer values from the elements. Must not be {@code null} .
-
- Returns: the sum of the integer values as a long
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
sumLong(...) -> long
-
Signature:
@TerminalOp public <E2 extends Exception> long sumLong(final Throwables.ToLongFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Sums the long values extracted from the elements in this sequence using the provided function.
-
Parameters:
-
func(Throwables.ToLongFunction<? super T, E2>) — the function to extract long values from the elements. Must not be {@code null} .
-
- Returns: the sum of the long values
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
sumDouble(...) -> double
-
Signature:
@TerminalOp public <E2 extends Exception> double sumDouble(final Throwables.ToDoubleFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Sums the double values extracted from the elements in this sequence using the provided function.
-
Parameters:
-
func(Throwables.ToDoubleFunction<? super T, E2>) — the function to extract double values from the elements. Must not be {@code null} .
-
- Returns: the sum of the double values
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
averageInt(...) -> OptionalDouble
-
Signature:
@TerminalOp public <E2 extends Exception> OptionalDouble averageInt(final Throwables.ToIntFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Calculates the average of the integer values extracted from the elements in this sequence using the provided function.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average age OptionalDouble avgAge = seq.averageInt(person -> person.getAge()); if (avgAge.isPresent()) { System.out.println("Average age: " + avgAge.getAsDouble()); } } </pre>
-
Parameters:
-
func(Throwables.ToIntFunction<? super T, E2>) — the function to extract integer values from the elements. Must not be {@code null} .
-
- Returns: an OptionalDouble containing the average, or empty if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
averageLong(...) -> OptionalDouble
-
Signature:
@TerminalOp public <E2 extends Exception> OptionalDouble averageLong(final Throwables.ToLongFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Calculates the average of the long values extracted from the elements in this sequence using the provided function.
-
Parameters:
-
func(Throwables.ToLongFunction<? super T, E2>) — the function to extract long values from the elements. Must not be {@code null} .
-
- Returns: an OptionalDouble containing the average, or empty if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
averageDouble(...) -> OptionalDouble
-
Signature:
@TerminalOp public <E2 extends Exception> OptionalDouble averageDouble(final Throwables.ToDoubleFunction<? super T, E2> func) throws IllegalStateException, E, E2 - Summary: Calculates the average of the double values extracted from the elements in this sequence using the provided function.
-
Parameters:
-
func(Throwables.ToDoubleFunction<? super T, E2>) — the function to extract double values from the elements. Must not be {@code null} .
-
- Returns: an OptionalDouble containing the average, or empty if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during the operation -
E2— if the provided function throws an exception
-
reduce(...) -> Optional<T>
-
Signature:
@TerminalOp public <E2 extends Exception> Optional<T> reduce(final Throwables.BinaryOperator<T, E2> accumulator) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs a reduction on the elements of this sequence using the provided binary operator.
-
Parameters:
-
accumulator(Throwables.BinaryOperator<T, E2>) — a function for combining two values, must be associative and stateless
-
- Returns: an Optional containing the result of the reduction, or an empty Optional if the sequence is empty
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the accumulator function is null -
E— if an exception occurs during iteration of the sequence -
E2— if the accumulator function throws an exception
-
- See also: Stream#reduce(BinaryOperator)
-
Signature:
@TerminalOp public <U, E2 extends Exception> U reduce(final U identity, final Throwables.BiFunction<? super U, ? super T, U, E2> accumulator) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Performs a reduction on the elements of this sequence using the provided identity value and accumulator function.
-
Parameters:
-
identity(U) — the initial value for the accumulation -
accumulator(Throwables.BiFunction<? super U, ? super T, U, E2>) — a function for combining the current accumulated value with a sequence element
-
- Returns: the result of the reduction
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the accumulator function is null -
E— if an exception occurs during iteration of the sequence -
E2— if the accumulator function throws an exception
-
- See also: Stream#reduce(Object, BinaryOperator)
collect(...) -> R
-
Signature:
@TerminalOp public <R, E2 extends Exception, E3 extends Exception> R collect(final Throwables.Supplier<R, E2> supplier, final Throwables.BiConsumer<? super R, ? super T, E3> accumulator) throws IllegalStateException, IllegalArgumentException, E, E2, E3 - Summary: Collects the elements of this sequence into a mutable result container.
-
Parameters:
-
supplier(Throwables.Supplier<R, E2>) — a function that creates a new mutable result container -
accumulator(Throwables.BiConsumer<? super R, ? super T, E3>) — a function that folds an element into the result container
-
- Returns: the result container with all elements of this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the supplier or accumulator is null -
E— if an exception occurs during iteration of the sequence -
E2— if the supplier throws an exception -
E3— if the accumulator throws an exception
-
-
Signature:
@TerminalOp public <R, RR, E2 extends Exception, E3 extends Exception, E4 extends Exception> RR collect(final Throwables.Supplier<R, E2> supplier, final Throwables.BiConsumer<? super R, ? super T, E3> accumulator, final Throwables.Function<? super R, ? extends RR, E4> finisher) throws E, E2, E3, E4 - Summary: Collects the elements of this sequence into a mutable result container, then applies a finisher function to transform the container into the final result.
-
Parameters:
-
supplier(Throwables.Supplier<R, E2>) — a function that creates a new mutable result container -
accumulator(Throwables.BiConsumer<? super R, ? super T, E3>) — a function that folds an element into the result container -
finisher(Throwables.Function<? super R, ? extends RR, E4>) — a function that transforms the result container into the final result
-
- Returns: the final result after applying the finisher function
-
Throws:
-
E— if an exception occurs during iteration of the sequence -
E2— if the supplier throws an exception -
E3— if the accumulator throws an exception -
E4— if the finisher throws an exception
-
-
Signature:
@TerminalOp public <R> R collect(final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException, E - Summary: Collects the elements of this sequence using the provided Collector.
-
Parameters:
-
collector(Collector<? super T, ?, R>) — the Collector describing the reduction
-
- Returns: the result of the reduction
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the collector is null -
E— if an exception occurs during iteration of the sequence
-
collectThenApply(...) -> RR
-
Signature:
@TerminalOp public <R, RR, E2 extends Exception> RR collectThenApply(final Collector<? super T, ?, R> collector, final Throwables.Function<? super R, ? extends RR, E2> func) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects the elements of this sequence using the provided Collector and then applies the given function to the collected result.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Collect to List then check if contains element Boolean contains = Seq.of("a", "b", "c") .collectThenApply(Collectors.toList(), list -> list.contains("b")); // Result: true // Collect to Set then get size Integer uniqueCount = Seq.of("a", "b", "a", "c", "b") .collectThenApply(Collectors.toSet(), Set::size); // Result: 3 } </pre>
-
Parameters:
-
collector(Collector<? super T, ?, R>) — the Collector describing the reduction -
func(Throwables.Function<? super R, ? extends RR, E2>) — the function to apply to the collected result
-
- Returns: the result of applying the function to the collected elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the collector or function is null -
E— if an exception occurs during iteration of the sequence -
E2— if the function throws an exception
-
collectThenAccept(...) -> void
-
Signature:
@TerminalOp public <R, E2 extends Exception> void collectThenAccept(final Collector<? super T, ?, R> collector, final Throwables.Consumer<? super R, E2> consumer) throws IllegalStateException, IllegalArgumentException, E, E2 - Summary: Collects the elements of this sequence using the provided Collector and then passes the collected result to the given consumer.
-
Parameters:
-
collector(Collector<? super T, ?, R>) — the Collector describing the reduction -
consumer(Throwables.Consumer<? super R, E2>) — the consumer to accept the collected result
-
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the collector or consumer is null -
E— if an exception occurs during iteration of the sequence -
E2— if the consumer throws an exception
-
join(...) -> String
-
Signature:
@TerminalOp public String join(final CharSequence delimiter) throws IllegalStateException, E - Summary: Joins the elements of this sequence into a single String with the specified delimiter.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to separate each element
-
- Returns: a String containing all elements joined by the delimiter
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration of the sequence
-
-
Signature:
@TerminalOp public String join(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix) throws IllegalStateException, E - Summary: Joins the elements of this sequence into a single String with the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to separate each element -
prefix(CharSequence) — the string to be added at the beginning of the result -
suffix(CharSequence) — the string to be added at the end of the result
-
- Returns: a String containing all elements joined by the delimiter with prefix and suffix
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if an exception occurs during iteration of the sequence
-
joinTo(...) -> Joiner
-
Signature:
@TerminalOp public Joiner joinTo(final Joiner joiner) throws IllegalStateException, IllegalArgumentException, E - Summary: Joins the elements of this sequence into the provided Joiner.
-
Parameters:
-
joiner(Joiner) — the Joiner to append the elements to
-
- Returns: the provided Joiner after appending all elements
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the joiner is null -
E— if an exception occurs during iteration of the sequence
-
println(...) -> void
-
Signature:
@Beta @TerminalOp public void println() throws IllegalStateException, E - Summary: Prints at most the first thousand elements of this sequence to the standard output in a formatted manner.
-
Contract:
- If there are more than a thousand elements, only the first thousand will be printed followed by an ellipsis (...).
- If this sequence is empty, it will print {@code \[\]} .
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been closed -
E— if an exception occurs during element processing
-
cast(...) -> Seq<T, Exception>
-
Signature:
@Beta @IntermediateOp public Seq<T, Exception> cast() throws IllegalStateException - Summary: Casts this sequence to a sequence with exception type {@code Exception} .
-
Contract:
- This is useful when you need to pass the sequence to a method that expects a more general exception type.
-
Parameters:
- (none)
- Returns: this sequence cast to {@code Seq<T, Exception>}
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been closed
-
stream(...) -> Stream<T>
-
Signature:
@IntermediateOp public Stream<T> stream() throws IllegalStateException - Summary: Converts this sequence to a sequential {@code Stream} .
-
Contract:
- If this sequence has close handlers registered, they will be transferred to the stream and will be invoked when the stream is closed.
-
Parameters:
- (none)
- Returns: a sequential {@code Stream} containing the same elements as this sequence
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been closed
-
transform(...) -> Seq<U, E>
-
Signature:
@Beta @IntermediateOp public <U> Seq<U, E> transform(final Function<? super Seq<T, E>, Seq<U, E>> transfer) - Summary: Transforms this sequence into another sequence by applying the provided transformation function.
-
Parameters:
-
transfer(Function<? super Seq<T, E>, Seq<U, E>>) — the transformation function that takes this sequence and returns a new sequence. Must not be {@code null}
-
- Returns: a new sequence resulting from applying the transformation function
- See also: #transformB(Function), #transformB(Function, boolean), #sps(Function), #sps(int, Function)
transformB(...) -> Seq<U, E>
-
Signature:
@Beta @IntermediateOp public <U> Seq<U, E> transformB(final Function<? super Stream<T>, ? extends Stream<? extends U>> transfer) throws IllegalStateException, IllegalArgumentException - Summary: Transforms this sequence by converting it to a Stream, applying the provided transformation function, and then converting the result back to a Seq.
-
Parameters:
-
transfer(Function<? super Stream<T>, ? extends Stream<? extends U>>) — the transformation function that takes a Stream representation of this sequence and returns a new Stream. Must not be {@code null}
-
- Returns: a new Seq containing the elements from the transformed Stream
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been closed -
java.lang.IllegalArgumentException— if the transfer function is {@code null}
-
- See also: #transform(Function), #transformB(Function, boolean), #sps(Function), #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public <U> Seq<U, E> transformB(final Function<? super Stream<T>, ? extends Stream<? extends U>> transfer, final boolean deferred) throws IllegalArgumentException - Summary: Transforms this sequence by converting it to a Stream, applying the provided transformation function, and then converting the result back to a Seq.
-
Contract:
- This method supports deferred execution, allowing the transformation to be applied lazily when the returned sequence is actually consumed.
-
Parameters:
-
transfer(Function<? super Stream<T>, ? extends Stream<? extends U>>) — the transformation function that takes a Stream representation of this sequence and returns a new Stream. Must not be {@code null} -
deferred(boolean) — if {@code true} , the transformation is deferred and will only be executed when the returned sequence is consumed. If {@code false} , the transformation is applied immediately
-
- Returns: a new Seq containing the elements from the transformed Stream
-
Throws:
-
java.lang.IllegalArgumentException— if the transfer function is {@code null}
-
- See also: #transform(Function), #transformB(Function), #sps(Function), #sps(int, Function)
sps(...) -> Seq<R, E>
-
Signature:
@Beta @IntermediateOp public <R> Seq<R, E> sps(final Function<? super Stream<T>, ? extends Stream<? extends R>> ops) throws IllegalStateException - Summary: Temporarily switches the sequence to a parallel stream for the operation defined by {@code ops} , and then switches it back to a sequence.
-
Contract:
- </p> <p> This is particularly useful when you have a computationally intensive operation that can benefit from parallel processing, but you want to maintain sequential processing for the rest of your pipeline.
-
Parameters:
-
ops(Function<? super Stream<T>, ? extends Stream<? extends R>>) — the function to be applied on the parallel stream. This function takes the current sequence converted to a parallel stream and returns a stream with elements of type R
-
- Returns: a new sequence containing the elements resulting from the parallel stream operations
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed
-
- See also: #sps(int, Function), #transform(Function), #transformB(Function), #transformB(Function, boolean), Stream#sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Seq<R, E> sps(final int maxThreadNum, final Function<? super Stream<T>, ? extends Stream<? extends R>> ops) throws IllegalStateException - Summary: Temporarily switches the sequence to a parallel stream with a specified maximum number of threads for the operation defined by {@code ops} , and then switches it back to a sequence.
-
Contract:
- This is useful when you want to limit resource consumption or when you know the optimal parallelism level for your specific use case.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel processing. Must be a positive integer greater than 0 -
ops(Function<? super Stream<T>, ? extends Stream<? extends R>>) — the function defining the operations to be performed on the parallel stream. This function takes the current sequence converted to a parallel stream with the specified thread limit and returns a stream with elements of type R
-
- Returns: a sequence containing the elements resulting from applying the operations defined by {@code ops} with the specified parallelism level
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed
-
- See also: #sps(Function), #sps(int, Executor, Function), #transform(Function), #transformB(Function), #transformB(Function, boolean), Stream#sps(int, Function)
-
Signature:
@Beta @IntermediateOp public <R> Seq<R, E> sps(final int maxThreadNum, final Executor executor, final Function<? super Stream<T>, ? extends Stream<? extends R>> ops) throws IllegalStateException - Summary: Temporarily switches the sequence to a parallel stream with a specified maximum number of threads and custom executor for the operation defined by {@code ops} , and then switches it back to a sequence.
-
Contract:
- This combination is useful when you need precise control over resource allocation, thread naming, priority, or other execution characteristics.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel processing. Must be a positive integer greater than 0 -
executor(Executor) — the custom executor to use for parallel processing. Must not be {@code null} . This can be any implementation of {@link Executor} , including thread pools, custom schedulers, or specialized execution contexts -
ops(Function<? super Stream<T>, ? extends Stream<? extends R>>) — the function defining the operations to be performed on the parallel stream. This function takes the current sequence converted to a parallel stream with the specified thread limit and executor, and returns a stream with elements of type R
-
- Returns: a sequence containing the elements resulting from applying the operations defined by {@code ops} with the specified parallelism level and executor
-
Throws:
-
java.lang.IllegalStateException— if the sequence has already been operated upon or closed
-
- See also: #sps(Function), #sps(int, Function), #transform(Function), #transformB(Function), #transformB(Function, boolean), Stream#parallel(int, Executor)
asyncRun(...) -> ContinuableFuture<Void>
-
Signature:
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(final Throwables.Consumer<? super Seq<T, E>, ? extends Exception> terminalAction) throws IllegalStateException, IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this sequence using the default executor.
-
Parameters:
-
terminalAction(Throwables.Consumer<? super Seq<T, E>, ? extends Exception>) — the terminal operation to be executed on this sequence. The consumer receives this sequence as its parameter and may throw an exception
-
- Returns: a ContinuableFuture representing the asynchronous computation. The future completes with {@code null} when the operation finishes successfully, or completes exceptionally if the operation throws an exception
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if terminalAction is null
-
-
Signature:
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(final Throwables.Consumer<? super Seq<T, E>, ? extends Exception> terminalAction, final Executor executor) throws IllegalStateException, IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this sequence using the specified executor.
-
Contract:
- This is particularly useful when you need to manage thread resources or prioritize different types of operations.
-
Parameters:
-
terminalAction(Throwables.Consumer<? super Seq<T, E>, ? extends Exception>) — the terminal operation to be executed on this sequence. The consumer receives this sequence as its parameter and may throw an exception -
executor(Executor) — the executor to run the terminal operation. This executor determines which thread or thread pool will execute the operation
-
- Returns: a ContinuableFuture representing the asynchronous computation. The future completes with {@code null} when the operation finishes successfully, or completes exceptionally if the operation throws an exception
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if terminalAction or executor is null
-
asyncCall(...) -> ContinuableFuture<R>
-
Signature:
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(final Throwables.Function<? super Seq<T, E>, R, ? extends Exception> terminalAction) throws IllegalStateException, IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this sequence using the default executor and returns a result.
-
Parameters:
-
terminalAction(Throwables.Function<? super Seq<T, E>, R, ? extends Exception>) — the terminal operation to be executed on this sequence. The function receives this sequence as its parameter, must return a value of type R, and may throw an exception
-
- Returns: a ContinuableFuture representing the asynchronous computation. The future completes with the result of the terminal operation when it finishes successfully, or completes exceptionally if the operation throws an exception
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if terminalAction is null
-
-
Signature:
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(final Throwables.Function<? super Seq<T, E>, R, ? extends Exception> terminalAction, final Executor executor) throws IllegalStateException, IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this sequence using the specified executor and returns a result.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code ExecutorService ioExecutor = Executors.newCachedThreadPool(); ContinuableFuture<Map<String, List<Item>>> future = seq.asyncCall(s -> s.filter(item -> item.isActive()) .groupBy(Item::getCategory), ioExecutor ); // Process the result when ready future.thenAccept(groupedItems -> { groupedItems.forEach((category, items) -> System.out.println(category + ": " + items.size()) ); }); } </pre>
-
Parameters:
-
terminalAction(Throwables.Function<? super Seq<T, E>, R, ? extends Exception>) — the terminal operation to be executed on this sequence. The function receives this sequence as its parameter, must return a value of type R, and may throw an exception -
executor(Executor) — the executor to run the terminal operation. This executor determines which thread or thread pool will execute the operation
-
- Returns: a ContinuableFuture representing the asynchronous computation. The future completes with the result of the terminal operation when it finishes successfully, or completes exceptionally if the operation throws an exception
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if terminalAction or executor is null
-
applyIfNotEmpty(...) -> u.Optional<R>
-
Signature:
@TerminalOp public <R, E2 extends Exception> u.Optional<R> applyIfNotEmpty(final Throwables.Function<? super Seq<T, E>, R, E2> func) throws IllegalStateException, E, E2 - Summary: Applies the provided function to this sequence if it contains at least one element and returns the result wrapped in an Optional.
-
Contract:
- Applies the provided function to this sequence if it contains at least one element and returns the result wrapped in an Optional.
- If the sequence is empty, returns an empty Optional without executing the function.
- <p> This method is useful when you want to perform a terminal operation on a sequence only if it contains elements, avoiding unnecessary computation or side effects for empty sequences.
-
Parameters:
-
func(Throwables.Function<? super Seq<T, E>, R, E2>) — the function to be applied to this sequence if it's not empty. The function receives the entire sequence as its parameter and can return null
-
- Returns: an Optional containing the result of the function application if this sequence is not empty, or an empty Optional if the sequence is empty. If the function returns {@code null} , the Optional will contain null
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if the underlying sequence operations throw an exception -
E2— if the provided function throws an exception
-
acceptIfNotEmpty(...) -> OrElse
-
Signature:
@TerminalOp public <E2 extends Exception> OrElse acceptIfNotEmpty(final Throwables.Consumer<? super Seq<T, E>, E2> action) throws IllegalStateException, E, E2 - Summary: Executes the provided action on this sequence if it contains at least one element.
-
Contract:
- Executes the provided action on this sequence if it contains at least one element.
- If the sequence is empty, the action is not executed.
- <p> This method is useful when you want to perform side effects or terminal operations on a sequence only if it contains elements.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code seq.acceptIfNotEmpty(s -> s.forEach(item -> processItem(item)) ).orElse(() -> System.out.println("No items to process") ); // Another example: saving to database if not empty boolean wasProcessed = seq.acceptIfNotEmpty(s -> { List<Item> items = s.toList(); database.saveAll(items); logger.info("Saved " + items.size() + " items"); }).isTrue(); if (!wasProcessed) { logger.info("No items to save"); } } </pre>
-
Parameters:
-
action(Throwables.Consumer<? super Seq<T, E>, E2>) — the action to be executed on this sequence if it's not empty. The consumer receives the entire sequence as its parameter
-
- Returns: an OrElse instance that is TRUE if the action was executed (sequence was not empty), or FALSE if the action was not executed (sequence was empty). This can be used to chain alternative actions for the empty case
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
E— if the underlying sequence operations throw an exception -
E2— if the provided action throws an exception
-
onClose(...) -> Seq<T, E>
-
Signature:
@IntermediateOp public Seq<T, E> onClose(final Runnable closeHandler) throws IllegalStateException, IllegalArgumentException - Summary: Registers a close handler to be invoked when the sequence is closed.
-
Contract:
- Registers a close handler to be invoked when the sequence is closed.
- <p> Close handlers are typically used to release resources, close connections, or perform cleanup operations that should happen when the sequence processing is complete.
- This is particularly useful when working with sequences that wrap external resources like files, network connections, or database cursors.
- If a close handler throws an exception, subsequent handlers will still be executed, and all exceptions will be aggregated.
-
Parameters:
-
closeHandler(Runnable) — the Runnable to be executed when the sequence is closed. Must not be {@code null} .
-
- Returns: a sequence with the close handler registered. This may be the same sequence instance.
-
Throws:
-
java.lang.IllegalStateException— if the sequence is already closed -
java.lang.IllegalArgumentException— if the specified closeHandler is {@code null}
-
close(...) -> void
-
Signature:
@TerminalOp @Override public synchronized void close() - Summary: Closes the sequence, releasing any system resources associated with it.
-
Contract:
- If the sequence is already closed, then invoking this method has no effect.
- <p> Sequences are automatically closed when a terminal operation completes, so explicit closing is typically not necessary.
- However, if a sequence may be abandoned before a terminal operation (e.g., due to an exception), it should be closed explicitly to ensure proper resource cleanup.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Seq<String, IOException> lines = null; try { lines = Seq.fromFile("data.txt") .onClose(() -> System.out.println("File closed")); // Process some lines lines.limit(10).forEach(System.out::println); } finally { if (lines != null) { lines.close(); // Explicit close in finally block } } // Or using try-with-resources (recommended) try (Seq<String, IOException> lines = Seq.fromFile("data.txt")) { lines.limit(10).forEach(System.out::println); } // Automatically closed here } </pre> <p> <b> Note: </b> After closing, any attempt to perform operations on this sequence will result in an {@link IllegalStateException} .
-
Parameters:
- (none)
- See also: #onClose(Runnable), AutoCloseable#close()
Enum ServiceStatus (com.landawn.abacus.util.ServiceStatus)
Enumeration representing various states of a service lifecycle.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
fromCode(...) -> ServiceStatus
-
Signature:
public static ServiceStatus fromCode(final int code) - Summary: Returns the ServiceStatus corresponding to the specified integer value.
-
Contract:
- <p> This method provides a way to reconstruct a ServiceStatus from its integer representation, useful when retrieving status values from storage or network protocols.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Retrieve from database int storedValue = database.getStatus(serviceId); ServiceStatus status = ServiceStatus.fromCode(storedValue); if (status == ServiceStatus.ACTIVE) { // Handle active service } } </pre>
-
Parameters:
-
code(int) — the integer value to convert to ServiceStatus
-
- Returns: the ServiceStatus corresponding to the given integer value
Public Instance Methods
code(...) -> int
-
Signature:
public int code() - Summary: Returns the integer value associated with this service status.
-
Parameters:
- (none)
- Returns: the integer value of this status
Class SetMultimap (com.landawn.abacus.util.SetMultimap)
A specialized {@link Multimap} implementation that uses {@link Set} collections to store unique values for each key, ensuring that duplicate values are automatically eliminated.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> SetMultimap<K, E>
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1) - Summary: Creates a new instance of SetMultimap with one key-value pair.
-
Parameters:
-
k1(K) — the key of the key-value pair -
v1(E) — the value of the key-value pair
-
- Returns: a new instance of SetMultimap with the specified key-value pair
- See also: #of(Object, Object, Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2) - Summary: Creates a new instance of SetMultimap with two key-value pairs.
-
Contract:
- If both keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3) - Summary: Creates a new instance of SetMultimap with three key-value pairs.
-
Contract:
- If multiple keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4) - Summary: Creates a new instance of SetMultimap with four key-value pairs.
-
Contract:
- If multiple keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5) - Summary: Creates a new instance of SetMultimap with five key-value pairs.
-
Contract:
- If multiple keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5, final K k6, final E v6) - Summary: Creates a new instance of SetMultimap with six key-value pairs.
-
Contract:
- If multiple keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs -
k6(K) — the sixth key of the key-value pairs -
v6(E) — the sixth value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
-
Signature:
public static <K, E> SetMultimap<K, E> of(final K k1, final E v1, final K k2, final E v2, final K k3, final E v3, final K k4, final E v4, final K k5, final E v5, final K k6, final E v6, final K k7, final E v7) - Summary: Creates a new instance of SetMultimap with seven key-value pairs.
-
Contract:
- If multiple keys are the same, only unique values will be added to the set associated with that key.
-
Parameters:
-
k1(K) — the first key of the key-value pairs -
v1(E) — the first value of the key-value pairs -
k2(K) — the second key of the key-value pairs -
v2(E) — the second value of the key-value pairs -
k3(K) — the third key of the key-value pairs -
v3(E) — the third value of the key-value pairs -
k4(K) — the fourth key of the key-value pairs -
v4(E) — the fourth value of the key-value pairs -
k5(K) — the fifth key of the key-value pairs -
v5(E) — the fifth value of the key-value pairs -
k6(K) — the sixth key of the key-value pairs -
v6(E) — the sixth value of the key-value pairs -
k7(K) — the seventh key of the key-value pairs -
v7(E) — the seventh value of the key-value pairs
-
- Returns: a new instance of SetMultimap with the specified key-value pairs
- See also: #of(Object, Object), #fromMap(Map)
fromMap(...) -> SetMultimap<K, E>
-
Signature:
public static <K, E> SetMultimap<K, E> fromMap(final Map<? extends K, ? extends E> map) - Summary: Creates a new instance of SetMultimap from a regular map by converting each key-value pair into a key with a single-element set containing the value.
-
Parameters:
-
map(Map<? extends K, ? extends E>) — The map containing the key-value pairs to be added to the new SetMultimap, may be {@code null} or empty
-
- Returns: a new instance of SetMultimap with the key-value pairs from the specified map
fromCollection(...) -> SetMultimap<K, T>
-
Signature:
public static <T, K> SetMultimap<K, T> fromCollection(final Collection<? extends T> c, final Function<? super T, ? extends K> keyExtractor) throws IllegalArgumentException - Summary: Creates a new instance of SetMultimap from a collection by grouping elements by keys extracted using the provided function.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be added to the SetMultimap, may be {@code null} or empty -
keyExtractor(Function<? super T, ? extends K>) — the function to extract keys from elements; must not be null
-
- Returns: a new instance of SetMultimap with keys extracted from elements and values being the elements themselves
-
Throws:
-
java.lang.IllegalArgumentException— if the keyExtractor is null
-
-
Signature:
public static <T, K, E> SetMultimap<K, E> fromCollection(final Collection<? extends T> c, final Function<? super T, ? extends K> keyExtractor, final Function<? super T, ? extends E> valueExtractor) - Summary: Creates a new instance of SetMultimap from a collection by extracting both keys and values using the provided functions.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to be transformed, may be {@code null} or empty -
keyExtractor(Function<? super T, ? extends K>) — the function to extract keys from elements; must not be null -
valueExtractor(Function<? super T, ? extends E>) — the function to extract values from elements; must not be null
-
- Returns: a new instance of SetMultimap with extracted keys and values from the specified collection
merge(...) -> SetMultimap<K, E>
-
Signature:
public static <K, E> SetMultimap<K, E> merge(final Map<? extends K, ? extends E> a, final Map<? extends K, ? extends E> b) - Summary: Creates a new instance of SetMultimap by merging the key-value pairs from two specified maps.
-
Contract:
- <p> If the same key appears in both maps, both values will be added to the resulting set for that key.
-
Parameters:
-
a(Map<? extends K, ? extends E>) — the first map containing the key-value pairs to be added to the new SetMultimap, may be {@code null} -
b(Map<? extends K, ? extends E>) — the second map containing the key-value pairs to be added to the new SetMultimap, may be {@code null}
-
- Returns: a new instance of SetMultimap with the key-value pairs from the specified maps
-
Signature:
public static <K, E> SetMultimap<K, E> merge(final Map<? extends K, ? extends E> a, final Map<? extends K, ? extends E> b, final Map<? extends K, ? extends E> c) - Summary: Creates a new instance of SetMultimap by merging the key-value pairs from three specified maps.
-
Contract:
- <p> If the same key appears in multiple maps, all unique values will be added to the resulting set for that key.
-
Parameters:
-
a(Map<? extends K, ? extends E>) — the first map containing the key-value pairs to be added to the new SetMultimap, may be {@code null} -
b(Map<? extends K, ? extends E>) — the second map containing the key-value pairs to be added to the new SetMultimap, may be {@code null} -
c(Map<? extends K, ? extends E>) — the third map containing the key-value pairs to be added to the new SetMultimap, may be {@code null}
-
- Returns: a new instance of SetMultimap with the key-value pairs from the specified maps
-
Signature:
public static <K, E> SetMultimap<K, E> merge(final Collection<? extends Map<? extends K, ? extends E>> c) - Summary: Creates a new instance of SetMultimap by merging the key-value pairs from a collection of maps.
-
Contract:
- <p> If the same key appears in multiple maps within the collection, all unique values will be added to the resulting set for that key.
- If the collection is {@code null} or empty, an empty SetMultimap is returned.
-
Parameters:
-
c(Collection<? extends Map<? extends K, ? extends E>>) — the collection of maps containing the key-value pairs to be added to the new SetMultimap, may be {@code null} or empty
-
- Returns: a new instance of SetMultimap with the key-value pairs from the specified collection of maps
wrap(...) -> SetMultimap<K, E>
-
Signature:
@SuppressWarnings("rawtypes") @Beta public static <K, E, V extends Set<E>> SetMultimap<K, E> wrap(final Map<K, V> map) throws IllegalArgumentException - Summary: Wraps an existing map into a SetMultimap without copying its contents.
-
Contract:
- <p> <strong> Important: </strong> The provided map must not contain {@code null} values.
- All values must be {@code non-null} Set instances.
- <p> This method is useful when you want to treat an existing Map < K, Set < E > > as a SetMultimap without creating a copy.
-
Parameters:
-
map(Map<K, V>) — The map to be wrapped into a SetMultimap; must not be {@code null} and must not contain {@code null} values
-
- Returns: a SetMultimap instance backed by the provided map
-
Throws:
-
java.lang.IllegalArgumentException— if the provided map is {@code null} or contains {@code null} values
-
-
Signature:
@Beta public static <K, E, V extends Set<E>> SetMultimap<K, E> wrap(final Map<K, V> map, final Supplier<? extends V> valueSupplier) throws IllegalArgumentException - Summary: Wraps an existing map into a SetMultimap with a custom set supplier.
-
Contract:
- <p> The provided value supplier will be used to create new sets when new keys are added to the multimap.
-
Parameters:
-
map(Map<K, V>) — The map to be wrapped into a SetMultimap -
valueSupplier(Supplier<? extends V>) — The supplier that provides the set to be used as the value collection
-
- Returns: a SetMultimap instance backed by the provided map
-
Throws:
-
java.lang.IllegalArgumentException— if the provided map or valueSupplier is null
-
Public Instance Methods
invert(...) -> SetMultimap<E, K>
-
Signature:
public SetMultimap<E, K> invert() - Summary: Creates a new SetMultimap with inverted key-value relationships.
-
Contract:
- For example, if you have a mapping of users to roles, invert() will give you a mapping of roles to users.
-
Parameters:
- (none)
- Returns: a new SetMultimap where each original value is mapped to the set of keys that contained it
copy(...) -> SetMultimap<K, E>
-
Signature:
@Override public SetMultimap<K, E> copy() - Summary: Creates a deep copy of this SetMultimap.
-
Parameters:
- (none)
- Returns: a new SetMultimap containing all the key-value pairs of this SetMultimap
- See also: #putValues(Multimap)
toImmutableMap(...) -> ImmutableMap<K, ImmutableSet<E>>
-
Signature:
public ImmutableMap<K, ImmutableSet<E>> toImmutableMap() - Summary: Converts this SetMultimap into an immutable map where each key is associated with an immutable set of values.
-
Parameters:
- (none)
- Returns: an ImmutableMap where each key from this multimap is associated with an ImmutableSet containing all values that were associated with that key
-
Signature:
public ImmutableMap<K, ImmutableSet<E>> toImmutableMap(final IntFunction<? extends Map<K, ImmutableSet<E>>> mapSupplier) - Summary: Converts this SetMultimap into an immutable map using a custom map supplier.
-
Parameters:
-
mapSupplier(IntFunction<? extends Map<K, ImmutableSet<E>>>) — a function that creates a new map instance given an initial capacity; the function receives the size of this multimap as its argument
-
- Returns: an ImmutableMap where each key from this multimap is associated with an ImmutableSet containing all values that were associated with that key
Class Sheet (com.landawn.abacus.util.Sheet)
A two-dimensional tabular data structure that stores values in cells identified by row and column keys, providing a flexible and powerful API for working with structured data.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Sheet<R, C, V>
-
Signature:
@SuppressWarnings({ "cast" }) public static <R, C, V> Sheet<R, C, V> empty() - Summary: Returns an empty, immutable Sheet instance.
-
Contract:
- Useful for initialization or when an empty Sheet is needed without creating a new instance.
-
Parameters:
- (none)
- Returns: an empty, immutable Sheet instance
- See also: #Sheet(), #freeze()
rows(...) -> Sheet<R, C, V>
-
Signature:
public static <R, C, V> Sheet<R, C, V> rows(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Object[][] rows) throws IllegalArgumentException - Summary: Creates a new Sheet from row-oriented data.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values -
rows(Object[][]) — the data as a two-dimensional array where each inner array represents a row
-
- Returns: a new Sheet with the specified keys and data
-
Throws:
-
java.lang.IllegalArgumentException— if any keys are {@code null} or duplicated, or dimensions don't match
-
- See also: #Sheet(Collection, Collection, Object\[\]\[\]), #rows(Collection, Collection, Collection), #columns(Collection, Collection, Object\[\]\[\])
-
Signature:
public static <R, C, V> Sheet<R, C, V> rows(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Collection<? extends Collection<? extends V>> rows) throws IllegalArgumentException - Summary: Creates a new Sheet from row-oriented collection data.
-
Contract:
- The order of values in each inner collection must correspond to the order of column keys.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values -
rows(Collection<? extends Collection<? extends V>>) — the data as a collection of collections where each inner collection represents a row
-
- Returns: a new Sheet with the specified keys and data
-
Throws:
-
java.lang.IllegalArgumentException— if any keys are {@code null} or duplicated, or dimensions don't match
-
- See also: #rows(Collection, Collection, Object\[\]\[\]), #columns(Collection, Collection, Collection)
columns(...) -> Sheet<R, C, V>
-
Signature:
public static <R, C, V> Sheet<R, C, V> columns(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Object[][] columns) throws IllegalArgumentException - Summary: Creates a new Sheet from column-oriented data.
-
Contract:
- This is useful when your data is naturally organized by columns rather than rows.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values -
columns(Object[][]) — the data as a two-dimensional array where each inner array represents a column
-
- Returns: a new Sheet with the specified keys and data
-
Throws:
-
java.lang.IllegalArgumentException— if any keys are {@code null} or duplicated, or dimensions don't match
-
- See also: #columns(Collection, Collection, Collection), #rows(Collection, Collection, Object\[\]\[\])
-
Signature:
public static <R, C, V> Sheet<R, C, V> columns(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Collection<? extends Collection<? extends V>> columns) throws IllegalArgumentException - Summary: Creates a new Sheet from column-oriented collection data.
-
Contract:
- The order of values in each inner collection must correspond to the order of row keys.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values -
columns(Collection<? extends Collection<? extends V>>) — the data as a collection of collections where each inner collection represents a column
-
- Returns: a new Sheet with the specified keys and data
-
Throws:
-
java.lang.IllegalArgumentException— if any keys are {@code null} or duplicated, or dimensions don't match
-
- See also: #columns(Collection, Collection, Object\[\]\[\]), #rows(Collection, Collection, Collection)
Public Instance Methods
<init>(...) -> void
-
Signature:
public Sheet() - Summary: Creates an empty Sheet with no row keys and no column keys.
-
Parameters:
- (none)
- See also: #Sheet(Collection, Collection), #Sheet(Collection, Collection, Object\[\]\[\]), #empty()
-
Signature:
public Sheet(final Collection<R> rowKeySet, final Collection<C> columnKeySet) throws IllegalArgumentException - Summary: Creates a new Sheet with the specified row keys and column keys.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values
-
-
Throws:
-
java.lang.IllegalArgumentException— if any of the row keys or column keys are {@code null} or duplicated
-
- See also: #Sheet(), #Sheet(Collection, Collection, Object\[\]\[\]), #rows(Collection, Collection, Object\[\]\[\]), #columns(Collection, Collection, Object\[\]\[\])
-
Signature:
public Sheet(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Object[][] rows) throws IllegalArgumentException - Summary: Creates a new Sheet with the specified row keys, column keys, and initial data.
-
Contract:
- The dimensions of the array must match the sizes of the row and column key sets exactly.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys for the Sheet; must not contain {@code null} or duplicate values -
columnKeySet(Collection<C>) — the collection of column keys for the Sheet; must not contain {@code null} or duplicate values -
rows(Object[][]) — the initial data as a two-dimensional array where rows\[i\]\[j\] is the value at row i, column j; must have length equal to rowKeySet size, and each inner array must have length equal to columnKeySet size
-
-
Throws:
-
java.lang.IllegalArgumentException— if any row/column keys are {@code null} or duplicated, or if array dimensions don't match the key sets
-
- See also: #Sheet(Collection, Collection), #rows(Collection, Collection, Object\[\]\[\]), #columns(Collection, Collection, Object\[\]\[\])
rowKeySet(...) -> ImmutableSet<R>
-
Signature:
public ImmutableSet<R> rowKeySet() - Summary: Returns an immutable set of all row keys in this Sheet.
-
Parameters:
- (none)
- Returns: an immutable set containing all row keys in insertion order
- See also: #columnKeySet(), #containsRow(Object)
columnKeySet(...) -> ImmutableSet<C>
-
Signature:
public ImmutableSet<C> columnKeySet() - Summary: Returns an immutable set of all column keys in this Sheet.
-
Parameters:
- (none)
- Returns: an immutable set containing all column keys in insertion order
- See also: #rowKeySet(), #containsColumn(Object)
isNull(...) -> boolean
-
Signature:
public boolean isNull(final R rowKey, final C columnKey) throws IllegalArgumentException - Summary: Checks whether the cell at the specified row key and column key contains a {@code null} value.
-
Contract:
- <p> Returns {@code true} if the cell is {@code null} or if the Sheet has not been initialized with data yet.
- Returns {@code false} if the cell contains a non- {@code null} value.
-
Parameters:
-
rowKey(R) — the key identifying the row -
columnKey(C) — the key identifying the column
-
- Returns: {@code true} if the cell contains {@code null} , {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if the row key or column key does not exist in this Sheet
-
- See also: #isNull(int, int), #isNull(Point), #get(Object, Object)
-
Signature:
public boolean isNull(final int rowIndex, final int columnIndex) throws IndexOutOfBoundsException - Summary: Checks whether the cell at the specified row and column indices contains a {@code null} value.
-
Parameters:
-
rowIndex(int) — the zero-based index of the row -
columnIndex(int) — the zero-based index of the column
-
- Returns: {@code true} if the cell contains {@code null} , {@code false} otherwise
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of bounds
-
- See also: #isNull(Object, Object), #isNull(Point), #get(int, int)
-
Signature:
@Beta public boolean isNull(final Point point) throws IndexOutOfBoundsException - Summary: Checks whether the cell at the specified point contains a {@code null} value.
-
Parameters:
-
point(Point) — the Point containing row and column indices
-
- Returns: {@code true} if the cell contains {@code null} , {@code false} otherwise
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the point's indices are out of bounds
-
- See also: #isNull(int, int), #isNull(Object, Object), #get(Point)
get(...) -> V
-
Signature:
@MayReturnNull public V get(final R rowKey, final C columnKey) throws IllegalArgumentException - Summary: Retrieves the value stored in the cell identified by the specified row key and column key.
-
Contract:
- <p> Returns {@code null} if the cell has not been initialized or explicitly contains {@code null} .
-
Parameters:
-
rowKey(R) — the key identifying the row -
columnKey(C) — the key identifying the column
-
- Returns: the value in the cell, or {@code null} if the cell is empty
-
Throws:
-
java.lang.IllegalArgumentException— if the row key or column key does not exist in this Sheet
-
- See also: #get(int, int), #get(Point), #set(Object, Object, Object), #isNull(Object, Object)
-
Signature:
@MayReturnNull public V get(final int rowIndex, final int columnIndex) throws IndexOutOfBoundsException - Summary: Retrieves the value stored in the cell at the specified row and column indices.
-
Contract:
- Returns {@code null} if the cell has not been initialized or contains {@code null} .
-
Parameters:
-
rowIndex(int) — the zero-based index of the row -
columnIndex(int) — the zero-based index of the column
-
- Returns: the value in the cell, or {@code null} if the cell is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of bounds
-
- See also: #get(Object, Object), #get(Point), #set(int, int, Object), #isNull(int, int)
-
Signature:
@MayReturnNull @Beta public V get(final Point point) throws IndexOutOfBoundsException - Summary: Retrieves the value stored in the cell at the specified point.
-
Parameters:
-
point(Point) — the Point containing row and column indices
-
- Returns: the value in the cell, or {@code null} if the cell is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the point's indices are out of bounds
-
- See also: #get(int, int), #get(Object, Object), #set(Point, Object), #isNull(Point)
set(...) -> V
-
Signature:
@MayReturnNull public V set(final R rowKey, final C columnKey, final V value) throws IllegalStateException, IllegalArgumentException - Summary: Sets or updates the value in the cell identified by the specified row key and column key.
-
Contract:
- <p> If the cell already contains a value, it is replaced with the new value.
- The Sheet must not be frozen for this operation to succeed.
-
Parameters:
-
rowKey(R) — the key identifying the row -
columnKey(C) — the key identifying the column -
value(V) — the new value to store in the cell (can be {@code null} )
-
- Returns: the previous value in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key or column key does not exist in this Sheet
-
- See also: #set(int, int, Object), #set(Point, Object), #get(Object, Object), #putAll(Sheet)
-
Signature:
@MayReturnNull public V set(final int rowIndex, final int columnIndex, final V value) throws IllegalStateException, IndexOutOfBoundsException - Summary: Sets or updates the value in the cell at the specified row and column indices.
-
Contract:
- The Sheet must not be frozen for this operation to succeed.
-
Parameters:
-
rowIndex(int) — the zero-based index of the row -
columnIndex(int) — the zero-based index of the column -
value(V) — the new value to be stored in the cell
-
- Returns: the previous value in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if the specified indices are out of bounds
-
- See also: #set(Object, Object, Object), #set(Point, Object), #get(int, int)
-
Signature:
@Beta @MayReturnNull public V set(final Point point, final V value) throws IllegalStateException, IndexOutOfBoundsException - Summary: Sets or updates the value in the cell at the specified point.
-
Contract:
- The Sheet must not be frozen for this operation to succeed.
-
Parameters:
-
point(Point) — the Point containing row and column indices -
value(V) — the new value to be stored in the cell
-
- Returns: the previous value in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if the point's indices are out of bounds
-
- See also: #set(int, int, Object), #set(Object, Object, Object), #get(Point)
putAll(...) -> void
-
Signature:
public void putAll(final Sheet<? extends R, ? extends C, ? extends V> source) throws IllegalStateException, IllegalArgumentException - Summary: <p> Copies all values from the source Sheet into this Sheet.
-
Contract:
- The source Sheet must have row keys and column keys that are contained within this Sheet.
-
Parameters:
-
source(Sheet<? extends R, ? extends C, ? extends V>) — the source Sheet from which to get the values
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen and cannot be modified -
java.lang.IllegalArgumentException— if the source Sheet contains row keys or column keys that are not present in this Sheet
-
- See also: #putAll(Sheet, BiFunction), #set(Object, Object, Object), #merge(Sheet, BiFunction)
-
Signature:
public void putAll(final Sheet<? extends R, ? extends C, ? extends V> source, final BiFunction<? super V, ? super V, ? extends V> mergeFunction) throws IllegalStateException, IllegalArgumentException - Summary: <p> Merges all values from the source Sheet into this Sheet using the specified merge function to resolve conflicts.
-
Contract:
- When a cell in both sheets contains a value, the provided merge function determines how to combine them, taking the current value and source value as parameters.
- The source Sheet must have row keys and column keys that are contained within this Sheet.
-
Parameters:
-
source(Sheet<? extends R, ? extends C, ? extends V>) — the source Sheet from which to get the values -
mergeFunction(BiFunction<? super V, ? super V, ? extends V>) — the function to resolve conflicts when both sheets have a value for the same cell; takes the current value from this sheet and the value from the source sheet as parameters
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen and cannot be modified -
java.lang.IllegalArgumentException— if the source Sheet contains row keys or column keys that are not present in this Sheet
-
- See also: #putAll(Sheet), #set(Object, Object, Object), #merge(Sheet, BiFunction)
remove(...) -> V
-
Signature:
@MayReturnNull public V remove(final R rowKey, final C columnKey) throws IllegalStateException, IllegalArgumentException - Summary: Removes the value stored in the cell identified by the specified row key and column key.
-
Parameters:
-
rowKey(R) — the row key of the cell to clear -
columnKey(C) — the column key of the cell to clear
-
- Returns: the value that was previously stored in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key or column key does not exist in this Sheet
-
- See also: #remove(int, int), #remove(Point), #set(Object, Object, Object)
-
Signature:
@MayReturnNull public V remove(final int rowIndex, final int columnIndex) throws IllegalStateException, IndexOutOfBoundsException - Summary: Removes the value stored in the cell at the specified row and column indices.
-
Parameters:
-
rowIndex(int) — the zero-based index of the row -
columnIndex(int) — the zero-based index of the column
-
- Returns: the value that was previously stored in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if rowIndex < 0 or rowIndex > = rowLength() or columnIndex < 0 or columnIndex > = columnLength()
-
- See also: #remove(Object, Object), #remove(Point), #set(int, int, Object)
-
Signature:
@Beta @MayReturnNull public V remove(final Point point) throws IllegalStateException, IndexOutOfBoundsException - Summary: Removes the value stored in the cell at the specified Point.
-
Parameters:
-
point(Point) — the Point containing the row and column indices of the cell
-
- Returns: the value that was previously stored in the cell, or {@code null} if the cell was empty
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if the point indices are out of bounds
-
- See also: #remove(int, int), #remove(Object, Object), #set(Point, Object)
containsCell(...) -> boolean
-
Signature:
public boolean containsCell(final R rowKey, final C columnKey) - Summary: Checks if the Sheet contains a cell identified by the specified row key and column key.
-
Contract:
- Checks if the Sheet contains a cell identified by the specified row key and column key.
- <p> This method verifies if the combination of row and column keys exists in the Sheet structure.
- It returns {@code true} if both keys are present, regardless of the cell's value (including {@code null} ).
-
Parameters:
-
rowKey(R) — the row key to check -
columnKey(C) — the column key to check
-
- Returns: {@code true} if the cell position exists in the Sheet structure, {@code false} otherwise
- See also: #containsValueAt(Object, Object, Object), #containsRow(Object), #containsColumn(Object)
containsValueAt(...) -> boolean
-
Signature:
public boolean containsValueAt(final R rowKey, final C columnKey, final Object value) - Summary: Checks if the Sheet contains a cell with the specified row key, column key, and value.
-
Contract:
- Checks if the Sheet contains a cell with the specified row key, column key, and value.
-
Parameters:
-
rowKey(R) — the row key of the cell to check -
columnKey(C) — the column key of the cell to check -
value(Object) — the value to check for equality in the cell
-
- Returns: {@code true} if the cell exists and contains the specified value, {@code false} otherwise
- See also: #containsCell(Object, Object), #containsValue(Object), #get(Object, Object)
containsValue(...) -> boolean
-
Signature:
public boolean containsValue(final Object value) - Summary: Checks if the Sheet contains any cell with the specified value.
-
Contract:
- Checks if the Sheet contains any cell with the specified value.
- For uninitialized Sheets, only returns {@code true} if searching for {@code null} .
-
Parameters:
-
value(Object) — the value to search for in all cells
-
- Returns: {@code true} if any cell contains the specified value, {@code false} otherwise
- See also: #containsValueAt(Object, Object, Object), #countOfNonNullValues()
rowValues(...) -> ImmutableList<V>
-
Signature:
public ImmutableList<V> rowValues(final R rowKey) throws IllegalArgumentException - Summary: Retrieves all the values in the row identified by the specified row key.
-
Contract:
- The list may contain {@code null} values if cells in the row are empty.
-
Parameters:
-
rowKey(R) — the row key identifying the row to retrieve
-
- Returns: an immutable list of values in the row, in column order
-
Throws:
-
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet
-
- See also: #columnValues(Object), #setRow(Object, Collection), #rowAsMap(Object)
setRow(...) -> void
-
Signature:
public void setRow(final R rowKey, final Collection<? extends V> row) throws IllegalStateException, IllegalArgumentException - Summary: Sets the values for a specific row in the Sheet.
-
Contract:
- The values must be in the same order as the column keys.
- If the collection is empty, all cells in the row will be set to {@code null} .
-
Parameters:
-
rowKey(R) — the key of the row to be set -
row(Collection<? extends V>) — the collection of values to set in the row; must match the number of columns or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet or the collection size does not match column count (unless empty)
-
- See also: #rowValues(Object), #updateRow(Object, Function), #addRow(Object, Collection)
addRow(...) -> void
-
Signature:
public void addRow(final R rowKey, final Collection<? extends V> row) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new row to the Sheet at the end.
-
Contract:
- The values must be provided in the same order as the column keys.
- If an empty collection is provided, the new row will contain all {@code null} values.
-
Parameters:
-
rowKey(R) — the unique key for the new row; must not already exist in the Sheet -
row(Collection<? extends V>) — the collection of values for the new row; must match the number of columns or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key already exists in this Sheet or the collection size does not match column count (unless empty)
-
- See also: #addRow(int, Object, Collection), #removeRow(Object), #setRow(Object, Collection)
-
Signature:
public void addRow(final int rowIndex, final R rowKey, final Collection<? extends V> row) throws IllegalStateException, IndexOutOfBoundsException, IllegalArgumentException - Summary: Inserts a new row at the specified index in the Sheet.
-
Contract:
- The index must be between 0 (insert at beginning) and rowLength() (append at end).
-
Parameters:
-
rowIndex(int) — the zero-based index where the row should be inserted; must be > = 0 and < = rowLength() -
rowKey(R) — the unique key for the new row; must not already exist in the Sheet -
row(Collection<? extends V>) — the collection of values for the new row; must match the number of columns or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if rowIndex < 0 or rowIndex > rowLength() -
java.lang.IllegalArgumentException— if the row key already exists in this Sheet or the collection size does not match column count (unless empty)
-
- See also: #addRow(Object, Collection), #moveRow(Object, int), #removeRow(Object)
updateRow(...) -> void
-
Signature:
public void updateRow(final R rowKey, final Function<? super V, ? extends V> func) throws IllegalStateException, IllegalArgumentException - Summary: Updates the values in the row identified by the specified row key using the specified function.
-
Parameters:
-
rowKey(R) — the key of the row to be updated -
func(Function<? super V, ? extends V>) — the function to apply to each value in the row; receives current value (may be null) and returns new value
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet
-
- See also: #updateColumn(Object, Function), #updateAll(Function)
removeRow(...) -> void
-
Signature:
public void removeRow(final R rowKey) throws IllegalStateException, IllegalArgumentException - Summary: Removes the row identified by the specified row key from this Sheet.
-
Parameters:
-
rowKey(R) — the key of the row to be removed
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet
-
- See also: #removeColumn(Object), #addRow(Object, Collection)
moveRow(...) -> void
-
Signature:
public void moveRow(final R rowKey, final int newRowIndex) throws IllegalStateException, IllegalArgumentException, IndexOutOfBoundsException - Summary: Moves the row identified by the specified row key to a new position in this Sheet.
-
Parameters:
-
rowKey(R) — the key of the row to be moved -
newRowIndex(int) — the new zero-based index where the row should be positioned
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet -
java.lang.IndexOutOfBoundsException— if newRowIndex < 0 or newRowIndex > = rowLength()
-
- See also: #swapRows(Object, Object), #moveColumn(Object, int), #addRow(int, Object, Collection)
swapRows(...) -> void
-
Signature:
public void swapRows(final R rowKeyA, final R rowKeyB) throws IllegalStateException, IllegalArgumentException - Summary: Swaps the positions of two rows in this Sheet.
-
Parameters:
-
rowKeyA(R) — the key of the first row to swap -
rowKeyB(R) — the key of the second row to swap
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if either row key does not exist in this Sheet
-
- See also: #moveRow(Object, int), #swapColumns(Object, Object)
renameRow(...) -> void
-
Signature:
public void renameRow(final R rowKey, final R newRowKey) throws IllegalStateException, IllegalArgumentException - Summary: Renames a row in this Sheet.
-
Contract:
- The new key must not already exist in this Sheet.
-
Parameters:
-
rowKey(R) — the current key of the row to rename -
newRowKey(R) — the new key for the row; must not already exist
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if rowKey does not exist in this Sheet or newRowKey already exists
-
- See also: #renameColumn(Object, Object)
containsRow(...) -> boolean
-
Signature:
public boolean containsRow(final R rowKey) - Summary: Checks if this Sheet contains a row identified by the specified row key.
-
Contract:
- Checks if this Sheet contains a row identified by the specified row key.
-
Parameters:
-
rowKey(R) — the row key to check
-
- Returns: {@code true} if the row exists, {@code false} otherwise
- See also: #containsColumn(Object), #containsCell(Object, Object)
rowAsMap(...) -> Map<C, V>
-
Signature:
public Map<C, V> rowAsMap(final R rowKey) throws IllegalArgumentException - Summary: Retrieves a map representing a row in this Sheet.
-
Parameters:
-
rowKey(R) — the key identifying the row
-
- Returns: a map of column keys to cell values for the specified row
-
Throws:
-
java.lang.IllegalArgumentException— if the row key does not exist in this Sheet
-
- See also: #columnAsMap(Object), #rowsMap(), #rowValues(Object)
rowsMap(...) -> Map<R, Map<C, V>>
-
Signature:
public Map<R, Map<C, V>> rowsMap() - Summary: Retrieves a map representing all rows in this Sheet.
-
Parameters:
- (none)
- Returns: a map of row keys to row maps, where each row map contains column keys to cell values
- See also: #columnsMap(), #rowAsMap(Object)
columnValues(...) -> ImmutableList<V>
-
Signature:
public ImmutableList<V> columnValues(final C columnKey) throws IllegalArgumentException - Summary: Retrieves all the values in the column identified by the specified column key.
-
Contract:
- The list may contain {@code null} values if cells in the column are empty.
-
Parameters:
-
columnKey(C) — the key identifying the column to retrieve
-
- Returns: an immutable list of values in the column, in row order
-
Throws:
-
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet
-
- See also: #rowValues(Object), #setColumn(Object, Collection), #columnAsMap(Object)
setColumn(...) -> void
-
Signature:
public void setColumn(final C columnKey, final Collection<? extends V> column) throws IllegalStateException, IllegalArgumentException - Summary: Sets the values for a specific column in this Sheet.
-
Contract:
- The values must be in the same order as the row keys.
- If the collection is empty, all cells in the column will be set to {@code null} .
-
Parameters:
-
columnKey(C) — the key of the column to be set -
column(Collection<? extends V>) — the collection of values to set in the column; must match the number of rows or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet or collection size does not match row count (unless empty)
-
- See also: #columnValues(Object), #updateColumn(Object, Function), #addColumn(Object, Collection)
addColumn(...) -> void
-
Signature:
public void addColumn(final C columnKey, final Collection<? extends V> column) throws IllegalStateException, IllegalArgumentException - Summary: Adds a new column to this Sheet at the end.
-
Contract:
- The values must be provided in the same order as the row keys.
- If an empty collection is provided, the new column will contain all {@code null} values.
-
Parameters:
-
columnKey(C) — the unique key for the new column; must not already exist in this Sheet -
column(Collection<? extends V>) — the collection of values for the new column; must match the number of rows or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the column key already exists or collection size does not match row count (unless empty)
-
- See also: #addColumn(int, Object, Collection), #removeColumn(Object), #setColumn(Object, Collection)
-
Signature:
public void addColumn(final int columnIndex, final C columnKey, final Collection<? extends V> column) throws IllegalStateException, IndexOutOfBoundsException, IllegalArgumentException - Summary: Inserts a new column at the specified index in this Sheet.
-
Contract:
- The index must be between 0 (insert at beginning) and columnLength() (append at end).
-
Parameters:
-
columnIndex(int) — the zero-based index where the column should be inserted; must be > = 0 and < = columnLength() -
columnKey(C) — the unique key for the new column; must not already exist in this Sheet -
column(Collection<? extends V>) — the collection of values for the new column; must match the number of rows or be empty
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IndexOutOfBoundsException— if columnIndex < 0 or columnIndex > columnLength() -
java.lang.IllegalArgumentException— if the column key already exists or collection size does not match row count (unless empty)
-
- See also: #addColumn(Object, Collection), #moveColumn(Object, int)
updateColumn(...) -> void
-
Signature:
public void updateColumn(final C columnKey, final Function<? super V, ? extends V> func) throws IllegalStateException, IllegalArgumentException - Summary: Updates the values in the column identified by the specified column key using the specified function.
-
Parameters:
-
columnKey(C) — the key of the column to be updated -
func(Function<? super V, ? extends V>) — the function to apply to each value in the column; receives current value (may be null) and returns new value
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet
-
- See also: #updateRow(Object, Function), #updateAll(Function)
removeColumn(...) -> void
-
Signature:
public void removeColumn(final C columnKey) throws IllegalStateException, IllegalArgumentException - Summary: Removes the column identified by the specified column key from this Sheet.
-
Parameters:
-
columnKey(C) — the key of the column to be removed
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet
-
- See also: #addColumn(Object, Collection), #removeRow(Object)
moveColumn(...) -> void
-
Signature:
public void moveColumn(final C columnKey, final int newColumnIndex) throws IllegalStateException, IllegalArgumentException, IndexOutOfBoundsException - Summary: Moves the column identified by the specified column key to a new position in this Sheet.
-
Parameters:
-
columnKey(C) — the key of the column to be moved -
newColumnIndex(int) — the new zero-based index where the column should be positioned
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet -
java.lang.IndexOutOfBoundsException— if newColumnIndex < 0 or newColumnIndex > = columnLength()
-
- See also: #swapColumns(Object, Object), #moveRow(Object, int), #addColumn(int, Object, Collection)
swapColumns(...) -> void
-
Signature:
public void swapColumns(final C columnKeyA, final C columnKeyB) throws IllegalStateException, IllegalArgumentException - Summary: Swaps the positions of two columns in this Sheet.
-
Parameters:
-
columnKeyA(C) — the key of the first column to swap -
columnKeyB(C) — the key of the second column to swap
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if either column key does not exist in this Sheet
-
- See also: #moveColumn(Object, int), #swapRows(Object, Object)
renameColumn(...) -> void
-
Signature:
public void renameColumn(final C columnKey, final C newColumnKey) throws IllegalStateException, IllegalArgumentException - Summary: Renames a column in this Sheet.
-
Contract:
- The new key must not already exist in this Sheet.
-
Parameters:
-
columnKey(C) — the current key of the column to rename -
newColumnKey(C) — the new key for the column; must not already exist
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen -
java.lang.IllegalArgumentException— if columnKey does not exist in this Sheet or newColumnKey already exists
-
- See also: #renameRow(Object, Object)
containsColumn(...) -> boolean
-
Signature:
public boolean containsColumn(final C columnKey) - Summary: Checks if this Sheet contains a column identified by the specified column key.
-
Contract:
- Checks if this Sheet contains a column identified by the specified column key.
-
Parameters:
-
columnKey(C) — the column key to check
-
- Returns: {@code true} if the column exists, {@code false} otherwise
- See also: #containsRow(Object), #containsCell(Object, Object)
columnAsMap(...) -> Map<R, V>
-
Signature:
public Map<R, V> columnAsMap(final C columnKey) throws IllegalArgumentException - Summary: Retrieves a map representing a column in this Sheet.
-
Parameters:
-
columnKey(C) — the key identifying the column
-
- Returns: a map of row keys to cell values for the specified column
-
Throws:
-
java.lang.IllegalArgumentException— if the column key does not exist in this Sheet
-
- See also: #rowAsMap(Object), #columnsMap(), #columnValues(Object)
columnsMap(...) -> Map<C, Map<R, V>>
-
Signature:
public Map<C, Map<R, V>> columnsMap() - Summary: Retrieves a map representing all columns in this Sheet.
-
Parameters:
- (none)
- Returns: a map of column keys to column maps, where each column map contains row keys to cell values
- See also: #rowsMap(), #columnAsMap(Object)
rowCount(...) -> int
-
Signature:
public int rowCount() - Summary: Returns the number of rows in this Sheet.
-
Parameters:
- (none)
- Returns: the number of rows in this Sheet
- See also: #columnCount(), #isEmpty()
columnCount(...) -> int
-
Signature:
public int columnCount() - Summary: Returns the number of columns in this Sheet.
-
Parameters:
- (none)
- Returns: the number of columns in this Sheet
- See also: #rowCount(), #isEmpty()
updateAll(...) -> void
-
Signature:
public void updateAll(final Function<? super V, ? extends V> func) throws IllegalStateException - Summary: Updates all values in this Sheet using the specified function.
-
Parameters:
-
func(Function<? super V, ? extends V>) — the function to apply to each value; receives current value (may be null) and returns new value
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #updateAll(IntBiFunction), #updateAll(TriFunction), #replaceIf(Predicate, Object)
-
Signature:
public void updateAll(final IntBiFunction<? extends V> func) throws IllegalStateException - Summary: Updates all values in this Sheet using the specified index-based function.
-
Contract:
- This is useful when the new value depends on the cell's position.
-
Parameters:
-
func(IntBiFunction<? extends V>) — the function to apply; receives row and column indices (zero-based) and returns new value
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #updateAll(Function), #updateAll(TriFunction)
-
Signature:
public void updateAll(final TriFunction<? super R, ? super C, ? super V, ? extends V> func) throws IllegalStateException - Summary: Updates all values in the Sheet using the specified key-based function.
-
Parameters:
-
func(TriFunction<? super R, ? super C, ? super V, ? extends V>) — the function to apply; receives row key, column key, and current value (may be null), returns new value
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #updateAll(Function), #updateAll(IntBiFunction)
replaceIf(...) -> void
-
Signature:
public void replaceIf(final Predicate<? super V> predicate, final V newValue) throws IllegalStateException - Summary: Replaces all values in the Sheet that satisfy the specified predicate with the new value.
-
Contract:
- <p> Tests each cell value with the predicate and replaces it with the new value if the predicate returns {@code true} .
-
Parameters:
-
predicate(Predicate<? super V>) — the predicate to test each value; receives current value (may be null) -
newValue(V) — the value to replace matching cells with
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #replaceIf(IntBiPredicate, Object), #replaceIf(TriPredicate, Object), #updateAll(Function)
-
Signature:
public void replaceIf(final IntBiPredicate predicate, final V newValue) throws IllegalStateException - Summary: Replaces all values in the Sheet that satisfy the provided index-based predicate with the new value.
-
Contract:
- <p> Tests each cell using its row and column indices and replaces it with the new value if the predicate returns {@code true} .
-
Parameters:
-
predicate(IntBiPredicate) — the predicate to test; receives row and column indices (zero-based) -
newValue(V) — the value to replace matching cells with
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #replaceIf(Predicate, Object), #replaceIf(TriPredicate, Object)
-
Signature:
public void replaceIf(final TriPredicate<? super R, ? super C, ? super V> predicate, final V newValue) throws IllegalStateException - Summary: Replaces all values in the Sheet that satisfy the provided key-based predicate with the new value.
-
Contract:
- <p> Tests each cell using its row key, column key, and current value, replacing it with the new value if the predicate returns {@code true} .
-
Parameters:
-
predicate(TriPredicate<? super R, ? super C, ? super V>) — the predicate to test; receives row key, column key, and current value (may be null) -
newValue(V) — the value to replace matching cells with
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #replaceIf(Predicate, Object), #replaceIf(IntBiPredicate, Object)
sortByRowKey(...) -> void
-
Signature:
public void sortByRowKey() throws IllegalStateException - Summary: Sorts the rows in the Sheet based on the natural ordering of the row keys.
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortByRowKey(Comparator), #sortByColumnKey()
-
Signature:
public void sortByRowKey(final Comparator<? super R> cmp) throws IllegalStateException - Summary: Sorts the rows in the Sheet based on the row keys using the specified comparator.
-
Parameters:
-
cmp(Comparator<? super R>) — the comparator to determine row key ordering; must not be null
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortByRowKey(), #sortByColumnKey(Comparator)
sortRowsByColumnValues(...) -> void
-
Signature:
public void sortRowsByColumnValues(final C columnKey, final Comparator<? super V> cmp) throws IllegalStateException - Summary: Sorts the rows in the Sheet based on the values in the specified column.
-
Contract:
- If the comparator is {@code null} , natural ordering is used (values must implement {@code Comparable} ).
-
Parameters:
-
columnKey(C) — the key of the column whose values will determine the row ordering -
cmp(Comparator<? super V>) — the comparator to determine the order of values; {@code null} for natural ordering
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortColumnsByRowValues(Object, Comparator), #sortRowsByColumnValues(Collection, Comparator)
-
Signature:
public void sortRowsByColumnValues(final Collection<C> columnKeysToSort, final Comparator<? super Object[]> cmp) throws IllegalStateException - Summary: Sorts the rows in the Sheet based on the values in the specified columns.
-
Parameters:
-
columnKeysToSort(Collection<C>) — the keys of columns whose values will determine row ordering -
cmp(Comparator<? super Object[]>) — the comparator applied to arrays of values from the specified columns
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortRowsByColumnValues(Object, Comparator), #sortColumnsByRowValues(Collection, Comparator)
sortByColumnKey(...) -> void
-
Signature:
public void sortByColumnKey() throws IllegalStateException - Summary: Sorts the columns in the Sheet based on the natural ordering of the column keys.
-
Contract:
- Column keys must implement {@code Comparable} .
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortByColumnKey(Comparator), #sortByRowKey()
-
Signature:
public void sortByColumnKey(final Comparator<? super C> cmp) throws IllegalStateException - Summary: Sorts the columns in the Sheet based on the column keys using the specified comparator.
-
Contract:
- If the comparator is {@code null} , natural ordering is used (column keys must implement {@code Comparable} ).
-
Parameters:
-
cmp(Comparator<? super C>) — the comparator to determine the order of the column keys; {@code null} for natural ordering
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortByColumnKey(), #sortByRowKey(Comparator)
sortColumnsByRowValues(...) -> void
-
Signature:
public void sortColumnsByRowValues(final R rowKey, final Comparator<? super V> cmp) throws IllegalStateException - Summary: Sorts the columns in the Sheet based on the values in the specified row.
-
Parameters:
-
rowKey(R) — the key of the row whose values will determine the column ordering -
cmp(Comparator<? super V>) — the comparator to apply to values in the specified row
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortRowsByColumnValues(Object, Comparator), #sortColumnsByRowValues(Collection, Comparator)
-
Signature:
public void sortColumnsByRowValues(final Collection<R> rowKeysToSort, final Comparator<? super Object[]> cmp) throws IllegalStateException - Summary: Sorts the columns in the Sheet based on the values in the specified rows.
-
Parameters:
-
rowKeysToSort(Collection<R>) — the keys of rows whose values will determine column ordering -
cmp(Comparator<? super Object[]>) — the comparator applied to arrays of values from the specified rows
-
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #sortColumnsByRowValues(Object, Comparator), #sortRowsByColumnValues(Collection, Comparator)
copy(...) -> Sheet<R, C, V>
-
Signature:
public Sheet<R, C, V> copy() - Summary: Creates a copy of the current Sheet object.
-
Parameters:
- (none)
- Returns: a new Sheet object that is a copy of the current Sheet.
-
Signature:
public Sheet<R, C, V> copy(final Collection<R> rowKeySet, final Collection<C> columnKeySet) - Summary: Creates a copy of the current Sheet object with the specified row keys and column keys.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys to be included in the copied Sheet. -
columnKeySet(Collection<C>) — the collection of column keys to be included in the copied Sheet.
-
- Returns: a new Sheet object that is a copy of the current Sheet with the specified row keys and column keys.
clone(...) -> Sheet<R, C, V>
-
Signature:
@SuppressWarnings("MethodDoesntCallSuperMethod") @Beta @Override public Sheet<R, C, V> clone() - Summary: Creates a deep copy of the current Sheet object by Serialization/Deserialization.
-
Parameters:
- (none)
- Returns: a new Sheet object that is a deep copy of the current Sheet.
-
Signature:
public Sheet<R, C, V> clone(final boolean freeze) - Summary: Creates a deep copy of the current Sheet object by Serialization/Deserialization.
-
Parameters:
-
freeze(boolean) — a boolean value that determines whether the copied Sheet should be frozen (read-only).
-
- Returns: a new Sheet object that is a deep copy of the current Sheet.
merge(...) -> Sheet<R, C, X>
-
Signature:
public <U, X> Sheet<R, C, X> merge(final Sheet<? extends R, ? extends C, ? extends U> b, final BiFunction<? super V, ? super U, ? extends X> mergeFunction) - Summary: Merges this Sheet with another Sheet using a merge function.
-
Parameters:
-
b(Sheet<? extends R, ? extends C, ? extends U>) — the other Sheet to merge with this one -
mergeFunction(BiFunction<? super V, ? super U, ? extends X>) — function to combine values; receives value from this Sheet and other Sheet (either may be null)
-
- Returns: a new Sheet containing the merged result
- See also: #putAll(Sheet, BiFunction)
transpose(...) -> Sheet<C, R, V>
-
Signature:
public Sheet<C, R, V> transpose() - Summary: Creates a transposed copy of this Sheet.
-
Parameters:
- (none)
- Returns: a new transposed Sheet where row and column keys are swapped
- See also: #copy()
freeze(...) -> void
-
Signature:
public void freeze() - Summary: Makes this Sheet immutable by freezing it.
-
Parameters:
- (none)
- See also: #isFrozen(), #clone(boolean)
isFrozen(...) -> boolean
-
Signature:
public boolean isFrozen() - Summary: Checks if this Sheet is frozen (immutable).
-
Contract:
- Checks if this Sheet is frozen (immutable).
-
Parameters:
- (none)
- Returns: {@code true} if the Sheet is frozen, {@code false} otherwise
- See also: #freeze()
clear(...) -> void
-
Signature:
public void clear() throws IllegalStateException - Summary: Clears all values in the Sheet, setting them to {@code null} .
-
Parameters:
- (none)
-
Throws:
-
java.lang.IllegalStateException— if this Sheet is frozen
-
- See also: #isEmpty()
trimToSize(...) -> void
-
Signature:
public void trimToSize() - Summary: Optimizes the memory usage by trimming internal storage capacity.
-
Parameters:
- (none)
- See also: #clear()
countOfNonNullValues(...) -> long
-
Signature:
public long countOfNonNullValues() - Summary: Counts the number of {@code non-null} values in the Sheet.
-
Parameters:
- (none)
- Returns: the number of {@code non-null} values in the Sheet
- See also: #isEmpty()
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Checks if the Sheet has no rows or no columns.
-
Contract:
- Checks if the Sheet has no rows or no columns.
- <p> A Sheet is considered empty if it has zero rows or zero columns.
-
Parameters:
- (none)
- Returns: {@code true} if the Sheet has no rows or no columns, {@code false} otherwise
- See also: #rowCount(), #columnCount()
forEachH(...) -> void
-
Signature:
public <E extends Exception> void forEachH(final Throwables.TriConsumer<? super R, ? super C, ? super V, E> action) throws E - Summary: Performs the given action for each cell in the Sheet in horizontal order (row by row).
-
Parameters:
-
action(Throwables.TriConsumer<? super R, ? super C, ? super V, E>) — the action to perform on each cell; receives row key, column key, and value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachV(Throwables.TriConsumer), #forEachNonNullH(Throwables.TriConsumer)
forEachV(...) -> void
-
Signature:
public <E extends Exception> void forEachV(final Throwables.TriConsumer<? super R, ? super C, ? super V, E> action) throws E - Summary: Performs the given action for each cell in the Sheet in vertical order (column by column).
-
Parameters:
-
action(Throwables.TriConsumer<? super R, ? super C, ? super V, E>) — the action to perform on each cell; receives row key, column key, and value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachH(Throwables.TriConsumer), #forEachNonNullV(Throwables.TriConsumer)
forEachNonNullH(...) -> void
-
Signature:
public <E extends Exception> void forEachNonNullH(final Throwables.TriConsumer<? super R, ? super C, ? super V, E> action) throws E - Summary: Performs the given action for each {@code non-null} cell in the Sheet in horizontal order (row by row).
-
Parameters:
-
action(Throwables.TriConsumer<? super R, ? super C, ? super V, E>) — the action to perform on each {@code non-null} cell; receives row key, column key, and {@code non-null} value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachH(Throwables.TriConsumer), #forEachNonNullV(Throwables.TriConsumer)
forEachNonNullV(...) -> void
-
Signature:
public <E extends Exception> void forEachNonNullV(final Throwables.TriConsumer<? super R, ? super C, ? super V, E> action) throws E - Summary: Performs the given action for each {@code non-null} cell in the Sheet in vertical order (column by column).
-
Parameters:
-
action(Throwables.TriConsumer<? super R, ? super C, ? super V, E>) — the action to perform on each {@code non-null} cell; receives row key, column key, and {@code non-null} value
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachV(Throwables.TriConsumer), #forEachNonNullH(Throwables.TriConsumer)
cellsH(...) -> Stream<Sheet.Cell<R, C, V>>
-
Signature:
public Stream<Sheet.Cell<R, C, V>> cellsH() - Summary: Returns a stream of all cells in the Sheet in horizontal order (row by row).
-
Parameters:
- (none)
- Returns: a Stream of Cell objects representing all cells, ordered by rows
- See also: #cellsH(int, int), #cellsV()
-
Signature:
public Stream<Sheet.Cell<R, C, V>> cellsH(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of cells from a range of rows in horizontal order.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Cell objects from the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #cellsH(), #cellsV(int, int)
cellsV(...) -> Stream<Sheet.Cell<R, C, V>>
-
Signature:
public Stream<Sheet.Cell<R, C, V>> cellsV() - Summary: Returns a stream of all cells in the Sheet in vertical order (column by column).
-
Parameters:
- (none)
- Returns: a Stream of Cell objects representing all cells, ordered by columns
- See also: #cellsV(int, int), #cellsH()
-
Signature:
public Stream<Sheet.Cell<R, C, V>> cellsV(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of cells from a range of columns in vertical order.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Cell objects from the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #cellsV(), #cellsH(int, int)
cellsR(...) -> Stream<Stream<Cell<R, C, V>>>
-
Signature:
public Stream<Stream<Cell<R, C, V>>> cellsR() - Summary: Returns a stream of row streams, where each inner stream contains the cells of one row.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a row's cells
- See also: #cellsR(int, int), #cellsC()
-
Signature:
public Stream<Stream<Cell<R, C, V>>> cellsR(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of row streams for a range of rows.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Streams for the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #cellsR(), #cellsC(int, int)
cellsC(...) -> Stream<Stream<Cell<R, C, V>>>
-
Signature:
public Stream<Stream<Cell<R, C, V>>> cellsC() - Summary: Returns a stream of column streams, where each inner stream contains the cells of one column.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a column's cells
- See also: #cellsC(int, int), #cellsR()
-
Signature:
public Stream<Stream<Cell<R, C, V>>> cellsC(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of column streams for a range of columns.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Streams for the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #cellsC(), #cellsR(int, int)
pointsH(...) -> Stream<Point>
-
Signature:
public Stream<Point> pointsH() - Summary: Returns a stream of all coordinate points in the Sheet in horizontal order (row by row).
-
Parameters:
- (none)
- Returns: a Stream of Point objects representing all cell coordinates, ordered by rows
- See also: #pointsH(int, int), #pointsV()
-
Signature:
public Stream<Point> pointsH(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of coordinate points for a range of rows in horizontal order.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Point objects for the specified row range, ordered by rows
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #pointsH(), #pointsV(int, int), #pointsR(int, int)
pointsV(...) -> Stream<Point>
-
Signature:
public Stream<Point> pointsV() - Summary: Returns a stream of all coordinate points in the Sheet in vertical order (column by column).
-
Parameters:
- (none)
- Returns: a Stream of Point objects representing all cell coordinates, ordered by columns
- See also: #pointsV(int, int), #pointsH(), #pointsC()
-
Signature:
public Stream<Point> pointsV(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of coordinate points for a range of columns in vertical order.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Point objects for the specified column range, ordered by columns
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #pointsV(), #pointsH(int, int), #pointsC(int, int)
pointsR(...) -> Stream<Stream<Point>>
-
Signature:
public Stream<Stream<Point>> pointsR() - Summary: Returns a stream of point streams where each inner stream represents the points in one row.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a row's coordinate points
- See also: #pointsR(int, int), #pointsC(), #pointsH()
-
Signature:
public Stream<Stream<Point>> pointsR(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of point streams for a range of rows.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Streams for the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #pointsR(), #pointsC(int, int), #pointsH(int, int)
pointsC(...) -> Stream<Stream<Point>>
-
Signature:
public Stream<Stream<Point>> pointsC() - Summary: Returns a stream of point streams where each inner stream represents the points in one column.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a column's coordinate points
- See also: #pointsC(int, int), #pointsR(), #pointsV()
-
Signature:
public Stream<Stream<Point>> pointsC(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of point streams for a range of columns.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Streams for the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #pointsC(), #pointsR(int, int), #pointsV(int, int)
streamH(...) -> Stream<V>
-
Signature:
public Stream<V> streamH() - Summary: Returns a stream of all values in the Sheet in horizontal order (row by row).
-
Parameters:
- (none)
- Returns: a Stream of values from all cells, ordered by rows
- See also: #streamH(int, int), #streamV()
-
Signature:
public Stream<V> streamH(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of values from a range of rows in horizontal order.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of values from the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #streamH(), #streamV(int, int), #streamR(int, int)
streamV(...) -> Stream<V>
-
Signature:
public Stream<V> streamV() - Summary: Returns a stream of all values in the Sheet in vertical order (column by column).
-
Parameters:
- (none)
- Returns: a Stream of values from all cells, ordered by columns
- See also: #streamV(int, int), #streamH(), #streamC()
-
Signature:
public Stream<V> streamV(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of values from a range of columns in vertical order.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of values from the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #streamV(), #streamH(int, int)
streamR(...) -> Stream<Stream<V>>
-
Signature:
public Stream<Stream<V>> streamR() - Summary: Returns a stream of row streams, where each inner stream contains the values of one row.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a row's values
- See also: #streamR(int, int), #streamC()
-
Signature:
public Stream<Stream<V>> streamR(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of row streams for a range of rows.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Streams for the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #streamR(), #streamC(int, int)
streamC(...) -> Stream<Stream<V>>
-
Signature:
public Stream<Stream<V>> streamC() - Summary: Returns a stream of column value streams.
-
Parameters:
- (none)
- Returns: a Stream of Streams where each inner stream represents a column's values
- See also: #streamC(int, int), #streamR()
-
Signature:
public Stream<Stream<V>> streamC(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of column value streams for a range of columns.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Streams for the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #streamC(), #streamR(int, int)
rows(...) -> Stream<Pair<R, Stream<V>>>
-
Signature:
public Stream<Pair<R, Stream<V>>> rows() - Summary: Returns a stream of key-value pairs representing all rows in the Sheet.
-
Parameters:
- (none)
- Returns: a Stream of Pair objects where each pair contains a row key and its value stream
- See also: #rows(int, int), #columns()
-
Signature:
public Stream<Pair<R, Stream<V>>> rows(final int fromRowIndex, final int toRowIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of key-value pairs for a range of rows in the Sheet.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive)
-
- Returns: a Stream of Pair objects for the specified row range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromRowIndex > toRowIndex
-
- See also: #rows(), #columns(int, int), #streamR(int, int)
-
Signature:
public <T> Stream<Pair<R, T>> rows(final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) - Summary: Returns a stream of key-value pairs representing all rows in the Sheet, where each pair consists of a row key and a mapped value.
-
Parameters:
-
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Sheet, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of Pair objects, where each Pair consists of a row key and a mapped value obtained by applying the {@code rowMapper} function to the row's values, ordered by rows.
-
Signature:
public <T> Stream<Pair<R, T>> rows(final int fromRowIndex, final int toRowIndex, final IntObjFunction<? super DisposableObjArray, ? extends T> rowMapper) - Summary: Returns a stream of key-value pairs for a range of rows in the Sheet, where each pair consists of a row key and a mapped value.
-
Parameters:
-
fromRowIndex(int) — the starting row index (inclusive) -
toRowIndex(int) — the ending row index (exclusive) -
rowMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the row in the Sheet, and the DisposableObjArray represents the row itself.
-
- Returns: a Stream of Pair objects for the specified row range, where each Pair consists of a row key and a mapped value obtained by applying the {@code rowMapper} function to the row's values, ordered by rows.
columns(...) -> Stream<Pair<C, Stream<V>>>
-
Signature:
public Stream<Pair<C, Stream<V>>> columns() - Summary: Returns a stream of key-value pairs representing all columns in the Sheet.
-
Parameters:
- (none)
- Returns: a Stream of Pair objects where each pair contains a column key and its value stream
- See also: #columns(int, int), #rows()
-
Signature:
public Stream<Pair<C, Stream<V>>> columns(final int fromColumnIndex, final int toColumnIndex) throws IndexOutOfBoundsException - Summary: Returns a stream of key-value pairs for a range of columns in the Sheet.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive)
-
- Returns: a Stream of Pair objects for the specified column range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if indices are out of bounds or fromColumnIndex > toColumnIndex
-
- See also: #columns(), #rows(int, int)
-
Signature:
public <T> Stream<Pair<C, T>> columns(final IntObjFunction<? super DisposableObjArray, ? extends T> columnMapper) - Summary: Returns a stream of key-value pairs representing all columns in the Sheet, where each pair consists of a column key and a mapped value.
-
Parameters:
-
columnMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the column in the Sheet, and the DisposableObjArray represents the column itself.
-
- Returns: a Stream of Pair objects, where each Pair consists of a column key and a mapped value obtained by applying the {@code columnMapper} function to the column's values, ordered by columns.
-
Signature:
public <T> Stream<Pair<C, T>> columns(final int fromColumnIndex, final int toColumnIndex, final IntObjFunction<? super DisposableObjArray, ? extends T> columnMapper) - Summary: Returns a stream of key-value pairs for a range of columns in the Sheet, where each pair consists of a column key and a mapped value.
-
Parameters:
-
fromColumnIndex(int) — the starting column index (inclusive) -
toColumnIndex(int) — the ending column index (exclusive) -
columnMapper(IntObjFunction<? super DisposableObjArray, ? extends T>) — a function that takes an integer and a DisposableObjArray as input and produces an object of type T. The integer represents the index of the column in the Sheet, and the DisposableObjArray represents the column itself.
-
- Returns: a Stream of Pair objects for the specified column range, where each Pair consists of a column key and a mapped value obtained by applying the {@code columnMapper} function to the column's values, ordered by columns.
toDatasetH(...) -> Dataset
-
Signature:
public Dataset toDatasetH() - Summary: Converts the Sheet into a Dataset with row-based organization (horizontal layout).
-
Parameters:
- (none)
- Returns: a Dataset object with rows corresponding to Sheet rows and columns named by Sheet column keys
- See also: #toDatasetV(), #toArrayH()
toDatasetV(...) -> Dataset
-
Signature:
public Dataset toDatasetV() - Summary: Converts the Sheet into a Dataset with column-based organization (vertical/transposed layout).
-
Parameters:
- (none)
- Returns: a Dataset object with rows corresponding to Sheet columns and columns named by Sheet row keys (transposed)
- See also: #toDatasetH(), #toArrayV()
toArrayH(...) -> Object\[\]\[\]
-
Signature:
public Object[][] toArrayH() - Summary: Converts the Sheet into a two-dimensional array with row-major ordering.
-
Parameters:
- (none)
- Returns: a two-dimensional Object array with row-major ordering
- See also: #toArrayH(Class), #toArrayV()
-
Signature:
public <T> T[][] toArrayH(final Class<T> componentType) - Summary: Converts the Sheet into a typed two-dimensional array with row-major ordering.
-
Parameters:
-
componentType(Class<T>) — the Class object representing the element type
-
- Returns: a two-dimensional typed array with row-major ordering
- See also: #toArrayH(), #toArrayV(Class)
toArrayV(...) -> Object\[\]\[\]
-
Signature:
public Object[][] toArrayV() - Summary: Converts the Sheet into a two-dimensional array with column-major ordering.
-
Parameters:
- (none)
- Returns: a two-dimensional Object array with column-major ordering
- See also: #toArrayV(Class), #toArrayH()
-
Signature:
public <T> T[][] toArrayV(final Class<T> componentType) - Summary: Converts the Sheet into a typed two-dimensional array with column-major ordering.
-
Parameters:
-
componentType(Class<T>) — the Class object representing the element type
-
- Returns: a two-dimensional typed array with column-major ordering
- See also: #toArrayV(), #toArrayH(Class)
apply(...) -> T
-
Signature:
public <T, E extends Exception> T apply(final Throwables.Function<? super Sheet<R, C, V>, T, E> func) throws E - Summary: Applies a transformation function to this Sheet and returns the result.
-
Parameters:
-
func(Throwables.Function<? super Sheet<R, C, V>, T, E>) — the function to apply to this Sheet
-
- Returns: the result produced by applying the function to this Sheet
-
Throws:
-
E— if the function throws an exception
-
- See also: #applyIfNotEmpty(Throwables.Function)
applyIfNotEmpty(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> applyIfNotEmpty(final Throwables.Function<? super Sheet<R, C, V>, T, E> func) throws E - Summary: Applies a transformation function to this Sheet if it's not empty, returning an Optional result.
-
Contract:
- Applies a transformation function to this Sheet if it's not empty, returning an Optional result.
- <p> This method provides safe functional-style operations by only applying the function when the Sheet contains data.
- Returns an empty Optional if the Sheet is empty.
-
Parameters:
-
func(Throwables.Function<? super Sheet<R, C, V>, T, E>) — the function to apply to this Sheet if not empty
-
- Returns: an Optional containing the result if Sheet is not empty, empty Optional otherwise
-
Throws:
-
E— if the function throws an exception
-
- See also: #apply(Throwables.Function), #isEmpty()
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super Sheet<R, C, V>, E> action) throws E - Summary: Executes an action on this Sheet without returning a value.
-
Parameters:
-
action(Throwables.Consumer<? super Sheet<R, C, V>, E>) — the action to perform on this Sheet
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #acceptIfNotEmpty(Throwables.Consumer)
acceptIfNotEmpty(...) -> OrElse
-
Signature:
public <E extends Exception> OrElse acceptIfNotEmpty(final Throwables.Consumer<? super Sheet<R, C, V>, E> action) throws E - Summary: Executes an action on this Sheet if it's not empty, returning whether the action was performed.
-
Contract:
- Executes an action on this Sheet if it's not empty, returning whether the action was performed.
- Returns {@link OrElse#TRUE} if the action was executed, {@link OrElse#FALSE} if the Sheet was empty.
-
Parameters:
-
action(Throwables.Consumer<? super Sheet<R, C, V>, E>) — the action to perform on this Sheet if not empty
-
- Returns: OrElse.TRUE if the action was executed, OrElse.FALSE if the Sheet was empty
-
Throws:
-
E— if the action throws an exception
-
- See also: #accept(Throwables.Consumer), #isEmpty()
println(...) -> void
-
Signature:
public void println() throws UncheckedIOException - Summary: Prints the entire Sheet to standard output in a formatted table.
-
Parameters:
- (none)
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while printing
-
- See also: #println(String), #println(Appendable)
-
Signature:
public void println(String prefix) throws UncheckedIOException - Summary: Prints the entire Sheet to standard output with a prefix on each line.
-
Contract:
- Useful for logging or when integrating Sheet output into larger formatted output.
-
Parameters:
-
prefix(String) — the string to prepend to each line of output
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while printing
-
- See also: #println(), #println(Collection, Collection, String, Appendable)
-
Signature:
public void println(final Collection<R> rowKeySet, final Collection<C> columnKeySet) throws UncheckedIOException - Summary: Prints a subset of the Sheet to standard output showing only specified rows and columns.
-
Parameters:
-
rowKeySet(Collection<R>) — the row keys to include in the output -
columnKeySet(Collection<C>) — the column keys to include in the output
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while printing
-
- See also: #println(), #println(Collection, Collection, Appendable)
-
Signature:
public void println(final Appendable output) throws UncheckedIOException - Summary: Prints the entire Sheet to the specified output destination.
-
Parameters:
-
output(Appendable) — the destination for the formatted output
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while writing
-
- See also: #println(), #println(Collection, Collection, Appendable)
-
Signature:
public void println(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final Appendable output) throws IllegalArgumentException, UncheckedIOException - Summary: Prints a subset of the Sheet to the specified Appendable output.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys to include in the output -
columnKeySet(Collection<C>) — the collection of column keys to include in the output -
output(Appendable) — the destination for the formatted output
-
-
Throws:
-
java.lang.IllegalArgumentException— if any specified row or column keys do not exist in this Sheet -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while printing
-
- See also: #println(), #println(Appendable), #println(Collection, Collection, String, Appendable)
-
Signature:
public void println(final Collection<R> rowKeySet, final Collection<C> columnKeySet, final String prefix, final Appendable output) throws IllegalArgumentException, UncheckedIOException - Summary: Prints a subset of the Sheet to the specified Appendable output with a prefix on each line.
-
Parameters:
-
rowKeySet(Collection<R>) — the collection of row keys to include in the output -
columnKeySet(Collection<C>) — the collection of column keys to include in the output -
prefix(String) — the string to prepend to each line of output -
output(Appendable) — the destination for the formatted output
-
-
Throws:
-
java.lang.IllegalArgumentException— if any specified row or column keys do not exist in this Sheet -
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while printing
-
- See also: #println(), #println(String), #println(Collection, Collection, Appendable)
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Sheet.
-
Parameters:
- (none)
- Returns: a hash code value for this Sheet
- See also: #equals(Object)
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this Sheet.
-
Contract:
- <p> Two Sheets are considered equal if they have the same row keys, column keys, and identical values at corresponding positions.
-
Parameters:
-
obj(Object) — the reference object with which to compare
-
- Returns: {@code true} if this Sheet is equal to the obj argument; {@code false} otherwise
- See also: #hashCode()
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Sheet.
-
Parameters:
- (none)
- Returns: a string representation of this Sheet
- See also: #println()
Record Cell (com.landawn.abacus.util.Sheet.Cell)
A record representing a cell in the Sheet.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Cell<R, C, V>
-
Signature:
public static <R, C, V> Cell<R, C, V> of(final R rowKey, final C columnKey, final V value) - Summary: Creates a new Cell with the specified row key, column key, and value.
-
Parameters:
-
rowKey(R) — the key of the row -
columnKey(C) — the key of the column -
value(V) — the value stored in the cell
-
- Returns: a new Cell with the specified row key, column key, and value
Public Instance Methods
<init>(...) -> void
-
Signature:
record Cell<R, C, V>(R rowKey, C columnKey, V value) { /** * Creates a new Cell with the specified row key, column key, and value. * * @param <R> the type of the row key * @param <C> the type of the column key * @param <V> the type of the value * @param rowKey the key of the row * @param columnKey the key of the column * @param value the value stored in the cell * @return a new Cell with the specified row key, column key, and value */ public static <R, C, V> Cell<R, C, V> of(final R rowKey, final C columnKey, final V value) { return new Cell<>(rowKey, columnKey, value); } } /** * A record representing a point in a two-dimensional space, such as a cell in a Sheet. * A point is identified by a rowIndex and a columnIndex. * * @param rowIndex the index of the row * @param columnIndex the index of the column */ public record Point(int rowIndex, int columnIndex) { private static final int MAX_CACHE_SIZE = 128; private static final Point[][] CACHE = new Point[MAX_CACHE_SIZE][MAX_CACHE_SIZE]; static { for (int i = 0; i < MAX_CACHE_SIZE; i++) { for (int j = 0; j < MAX_CACHE_SIZE; j++) { CACHE[i][j] = new Point(i, j); } } } public static final Point ZERO = CACHE[0][0]; /** * Creates a new Point with the specified row index and column index. * * @param rowIndex the index of the row * @param columnIndex the index of the column * @return a new Point with the specified row index and column index */ public static Point of(final int rowIndex, final int columnIndex) { if (rowIndex >= 0 && rowIndex < MAX_CACHE_SIZE && columnIndex >= 0 && columnIndex < MAX_CACHE_SIZE) { return CACHE[rowIndex][columnIndex]; } return new Point(rowIndex, columnIndex); } } } -
Parameters:
-
rowKey(R) -
columnKey(C) -
value(V)
-
Record Point (com.landawn.abacus.util.Sheet.Point)
A record representing a point in a two-dimensional space, such as a cell in a Sheet.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Point
-
Signature:
public static Point of(final int rowIndex, final int columnIndex) - Summary: Creates a new Point with the specified row index and column index.
-
Parameters:
-
rowIndex(int) — the index of the row -
columnIndex(int) — the index of the column
-
- Returns: a new Point with the specified row index and column index
Public Instance Methods
<init>(...) -> void
-
Signature:
record Point(int rowIndex, int columnIndex) { private static final int MAX_CACHE_SIZE = 128; private static final Point[][] CACHE = new Point[MAX_CACHE_SIZE][MAX_CACHE_SIZE]; static { for (int i = 0; i < MAX_CACHE_SIZE; i++) { for (int j = 0; j < MAX_CACHE_SIZE; j++) { CACHE[i][j] = new Point(i, j); } } } public static final Point ZERO = CACHE[0][0]; /** * Creates a new Point with the specified row index and column index. * * @param rowIndex the index of the row * @param columnIndex the index of the column * @return a new Point with the specified row index and column index */ public static Point of(final int rowIndex, final int columnIndex) { if (rowIndex >= 0 && rowIndex < MAX_CACHE_SIZE && columnIndex >= 0 && columnIndex < MAX_CACHE_SIZE) { return CACHE[rowIndex][columnIndex]; } return new Point(rowIndex, columnIndex); } } } -
Parameters:
-
rowIndex(int) -
columnIndex(int)
-
Class ShortIterator (com.landawn.abacus.util.ShortIterator)
A specialized iterator for primitive short values that extends ImmutableIterator.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ShortIterator
-
Signature:
@SuppressWarnings("SameReturnValue") public static ShortIterator empty() - Summary: Returns an empty {@code ShortIterator} with no elements.
-
Parameters:
- (none)
- Returns: an empty {@code ShortIterator}
of(...) -> ShortIterator
-
Signature:
public static ShortIterator of(final short... a) - Summary: Creates a {@code ShortIterator} from the specified short array.
-
Contract:
- <p> If the array is {@code null} or empty, returns an empty iterator.
-
Parameters:
-
a(short[]) — the short array (may be {@code null} )
-
- Returns: a new {@code ShortIterator} over the array elements, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static ShortIterator of(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a {@code ShortIterator} from a subsequence of the specified short array.
-
Contract:
- If {@code fromIndex} equals {@code toIndex} , an empty iterator is returned.
-
Parameters:
-
a(short[]) — the short array (may be {@code null} ) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a new {@code ShortIterator} over the specified range, or an empty iterator if the array is {@code null} or fromIndex equals toIndex
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of bounds
-
defer(...) -> ShortIterator
-
Signature:
public static ShortIterator defer(final Supplier<? extends ShortIterator> iteratorSupplier) throws IllegalArgumentException - Summary: Creates a ShortIterator that is initialized lazily using the provided Supplier.
-
Parameters:
-
iteratorSupplier(Supplier<? extends ShortIterator>) — a Supplier that provides the ShortIterator when needed
-
- Returns: a lazily initialized ShortIterator
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
generate(...) -> ShortIterator
-
Signature:
public static ShortIterator generate(final ShortSupplier supplier) throws IllegalArgumentException - Summary: Creates an infinite ShortIterator that generates values using the provided supplier.
-
Parameters:
-
supplier(ShortSupplier) — the supplier function that generates short values
-
- Returns: an infinite ShortIterator
-
Throws:
-
java.lang.IllegalArgumentException— if supplier is null
-
-
Signature:
public static ShortIterator generate(final BooleanSupplier hasNext, final ShortSupplier supplier) throws IllegalArgumentException - Summary: Creates a ShortIterator that generates values using the provided supplier while the hasNext condition is {@code true} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that determines if there are more elements -
supplier(ShortSupplier) — the supplier function that generates short values
-
- Returns: a conditional ShortIterator
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or supplier is null
-
Public Instance Methods
next(...) -> Short
-
Signature:
@Deprecated @Override public Short next() - Summary: Returns the next element in the iteration as a boxed Short.
-
Parameters:
- (none)
- Returns: the next short element as a Short object
nextShort(...) -> short
-
Signature:
public abstract short nextShort() - Summary: Returns the next short value in the iteration.
-
Parameters:
- (none)
- Returns: the next short value
skip(...) -> ShortIterator
-
Signature:
public ShortIterator skip(final long n) throws IllegalArgumentException - Summary: Returns a new ShortIterator that skips the first n elements.
-
Contract:
- If n is greater than the number of remaining elements, all elements are skipped.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new ShortIterator that skips the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
limit(...) -> ShortIterator
-
Signature:
public ShortIterator limit(final long count) throws IllegalArgumentException - Summary: Returns a new ShortIterator that limits the number of elements to iterate over.
-
Parameters:
-
count(long) — the maximum number of elements to iterate
-
- Returns: a new ShortIterator limited to count elements
-
Throws:
-
java.lang.IllegalArgumentException— if count is negative
-
filter(...) -> ShortIterator
-
Signature:
public ShortIterator filter(final ShortPredicate predicate) throws IllegalArgumentException - Summary: Returns a new ShortIterator that only includes elements matching the given predicate.
-
Parameters:
-
predicate(ShortPredicate) — the predicate to test each element
-
- Returns: a new filtered ShortIterator
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null
-
first(...) -> OptionalShort
-
Signature:
public OptionalShort first() - Summary: Returns the first element as an OptionalShort, or empty if the iterator has no elements.
-
Contract:
- Returns the first element as an OptionalShort, or empty if the iterator has no elements.
- This method consumes the first element if present.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the first element, or empty if no elements
last(...) -> OptionalShort
-
Signature:
public OptionalShort last() - Summary: Returns the last element as an OptionalShort, or empty if the iterator has no elements.
-
Contract:
- Returns the last element as an OptionalShort, or empty if the iterator has no elements.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the last element, or empty if no elements
toArray(...) -> short\[\]
-
Signature:
@SuppressWarnings("deprecation") public short[] toArray() - Summary: Converts the remaining elements to a short array.
-
Contract:
- If the iterator is already empty, returns an empty array.
-
Parameters:
- (none)
- Returns: a short array containing all remaining elements
toList(...) -> ShortList
-
Signature:
public ShortList toList() - Summary: Converts the remaining elements to a ShortList.
-
Contract:
- If the iterator is already empty, returns an empty ShortList.
-
Parameters:
- (none)
- Returns: a ShortList containing all remaining elements
stream(...) -> ShortStream
-
Signature:
public ShortStream stream() - Summary: Creates a ShortStream from the remaining elements in this iterator.
-
Parameters:
- (none)
- Returns: a ShortStream of the remaining elements
indexed(...) -> ObjIterator<IndexedShort>
-
Signature:
@Beta public ObjIterator<IndexedShort> indexed() - Summary: Returns an iterator of IndexedShort objects pairing each element with its index.
-
Parameters:
- (none)
- Returns: an iterator of IndexedShort objects
-
Signature:
@Beta public ObjIterator<IndexedShort> indexed(final long startIndex) - Summary: Returns an iterator of IndexedShort objects pairing each element with its index.
-
Parameters:
-
startIndex(long) — the starting index value
-
- Returns: an iterator of IndexedShort objects
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final java.util.function.Consumer<? super Short> action) - Summary: Performs the given action for each remaining element using Java's Consumer interface.
-
Parameters:
-
action(java.util.function.Consumer<? super Short>) — the action to perform on each element
-
foreachRemaining(...) -> void
-
Signature:
public <E extends Exception> void foreachRemaining(final Throwables.ShortConsumer<E> action) throws E - Summary: Performs the given action for each remaining short element.
-
Parameters:
-
action(Throwables.ShortConsumer<E>) — the action to perform on each element
-
-
Throws:
-
E— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E extends Exception> void foreachIndexed(final Throwables.IntShortConsumer<E> action) throws IllegalArgumentException, E - Summary: Performs the given action for each remaining element along with its index.
-
Parameters:
-
action(Throwables.IntShortConsumer<E>) — the action to perform on each element with its index
-
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
Class ShortList (com.landawn.abacus.util.ShortList)
A high-performance, resizable array implementation for primitive short values that provides specialized operations optimized for 16-bit integer data types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ShortList
-
Signature:
public static ShortList of(final short... a) - Summary: Creates a new ShortList containing the specified elements.
-
Contract:
- If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(short[]) — the array of elements to be included in the new list. Can be {@code null} .
-
- Returns: a new ShortList containing the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static ShortList of(final short[] a, final int size) throws IndexOutOfBoundsException - Summary: Creates a new ShortList containing the first {@code size} elements of the specified array.
-
Contract:
- If the input array is {@code null} , it is treated as an empty array.
-
Parameters:
-
a(short[]) — the array of short values to be used as the backing array. Can be {@code null} . -
size(int) — the number of elements from the array to include in the list. Must be between 0 and the array length (inclusive).
-
- Returns: a new ShortList containing the first {@code size} elements of the specified array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code size} is negative or greater than the array length
-
copyOf(...) -> ShortList
-
Signature:
public static ShortList copyOf(final short[] a) - Summary: Creates a new ShortList that is a copy of the specified array.
-
Contract:
- </p> <p> If the input array is {@code null} , an empty list is returned.
-
Parameters:
-
a(short[]) — the array to be copied. Can be {@code null} .
-
- Returns: a new ShortList containing a copy of the elements from the specified array, or an empty list if the array is {@code null}
-
Signature:
public static ShortList copyOf(final short[] a, final int fromIndex, final int toIndex) - Summary: Creates a new ShortList that is a copy of the specified range within the given array.
-
Parameters:
-
a(short[]) — the array from which a range is to be copied. Must not be {@code null} . -
fromIndex(int) — the initial index of the range to be copied, inclusive. -
toIndex(int) — the final index of the range to be copied, exclusive.
-
- Returns: a new ShortList containing a copy of the elements in the specified range
range(...) -> ShortList
-
Signature:
public static ShortList range(final short startInclusive, final short endExclusive) - Summary: Creates a ShortList containing a sequence of short values from startInclusive (inclusive) to endExclusive (exclusive), incrementing by 1.
-
Contract:
- If startInclusive > = endExclusive, an empty list is returned.
-
Parameters:
-
startInclusive(short) — the starting value (inclusive) -
endExclusive(short) — the ending value (exclusive)
-
- Returns: a new ShortList containing the sequence of values
-
Signature:
public static ShortList range(final short startInclusive, final short endExclusive, final short by) - Summary: Creates a ShortList containing a sequence of short values from startInclusive (inclusive) to endExclusive (exclusive), incrementing by the specified step value.
-
Contract:
- If the step would not reach endExclusive from startInclusive, an empty list is returned.
-
Parameters:
-
startInclusive(short) — the starting value (inclusive) -
endExclusive(short) — the ending value (exclusive) -
by(short) — the step value for incrementing. Must not be zero.
-
- Returns: a new ShortList containing the sequence of values
rangeClosed(...) -> ShortList
-
Signature:
public static ShortList rangeClosed(final short startInclusive, final short endInclusive) - Summary: Creates a ShortList containing a sequence of short values from startInclusive to endInclusive (both inclusive), incrementing by 1.
-
Contract:
- If startInclusive > endInclusive, an empty list is returned.
-
Parameters:
-
startInclusive(short) — the starting value (inclusive) -
endInclusive(short) — the ending value (inclusive)
-
- Returns: a new ShortList containing the sequence of values including both endpoints
-
Signature:
public static ShortList rangeClosed(final short startInclusive, final short endInclusive, final short by) - Summary: Creates a ShortList containing a sequence of short values from startInclusive to endInclusive (both inclusive), incrementing by the specified step value.
-
Parameters:
-
startInclusive(short) — the starting value (inclusive) -
endInclusive(short) — the ending value (inclusive) -
by(short) — the step value for incrementing. Must not be zero.
-
- Returns: a new ShortList containing the sequence of values including both endpoints
repeat(...) -> ShortList
-
Signature:
public static ShortList repeat(final short element, final int len) - Summary: Creates a ShortList containing the specified element repeated the given number of times.
-
Parameters:
-
element(short) — the short value to be repeated -
len(int) — the number of times to repeat the element. Must be non-negative.
-
- Returns: a new ShortList containing the element repeated len times
random(...) -> ShortList
-
Signature:
public static ShortList random(final int len) - Summary: Creates a ShortList containing the specified number of random short values.
-
Parameters:
-
len(int) — the number of random elements to generate. Must be non-negative.
-
- Returns: a new ShortList containing len random short values
Public Instance Methods
<init>(...) -> void
-
Signature:
public ShortList() - Summary: Constructs an empty ShortList with an initial capacity of zero.
-
Contract:
- The internal array will be initialized to an empty array and will grow as needed when elements are added.
-
Parameters:
- (none)
-
Signature:
public ShortList(final int initialCapacity) - Summary: Constructs an empty ShortList with the specified initial capacity.
-
Contract:
- <p> This constructor is useful when the approximate size of the list is known in advance, as it can help avoid the performance overhead of array resizing during element additions.
-
Parameters:
-
initialCapacity(int) — the initial capacity of the list. Must be non-negative.
-
-
Signature:
public ShortList(final short[] a) - Summary: Constructs a ShortList using the specified array as the backing array for this list without copying.
-
Parameters:
-
a(short[]) — the array to be used as the backing array for this list. Must not be {@code null} .
-
-
Signature:
public ShortList(final short[] a, final int size) throws IndexOutOfBoundsException - Summary: Constructs a ShortList using the specified array as the backing array for this list without copying.
-
Parameters:
-
a(short[]) — the array to be used as the backing array for this list. Must not be {@code null} . -
size(int) — the number of elements in the list. Must be between 0 and a.length (inclusive).
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if size is negative or greater than a.length
-
array(...) -> short\[\]
-
Signature:
@Beta @Deprecated @Override public short[] array() - Summary: Returns the underlying short array backing this list without creating a copy.
-
Contract:
- </p> <p> This method is marked as {@code @Beta} and should be used with caution.
-
Parameters:
- (none)
- Returns: the internal short array backing this list
get(...) -> short
-
Signature:
public short get(final int index) - Summary: Returns the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to return
-
- Returns: the element at the specified position in this list
set(...) -> short
-
Signature:
public short set(final int index, final short e) - Summary: Replaces the element at the specified position in this list with the specified element.
-
Parameters:
-
index(int) — the index of the element to replace -
e(short) — the element to be stored at the specified position
-
- Returns: the element previously at the specified position
add(...) -> void
-
Signature:
public void add(final short e) - Summary: Appends the specified element to the end of this list.
-
Contract:
- The list will automatically grow if necessary.
- If the internal array needs to be resized to accommodate the new element, all existing elements will be copied to a new, larger array.
-
Parameters:
-
e(short) — the element to be appended to this list
-
-
Signature:
public void add(final int index, final short e) - Summary: Inserts the specified element at the specified position in this list.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- The list will automatically grow if necessary.
- <p> This method runs in linear time in the worst case (when inserting at the beginning of the list), as it may need to shift all existing elements.
-
Parameters:
-
index(int) — the index at which the specified element is to be inserted -
e(short) — the element to be inserted
-
addAll(...) -> boolean
-
Signature:
@Override public boolean addAll(final ShortList c) - Summary: Appends all elements from the specified ShortList to the end of this list, in the order they are stored in the specified list.
-
Contract:
- The behavior of this operation is undefined if the specified list is modified during the operation.
-
Parameters:
-
c(ShortList) — the ShortList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean addAll(final int index, final ShortList c) - Summary: Inserts all elements from the specified ShortList into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified list -
c(ShortList) — the ShortList containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean addAll(final short[] a) - Summary: Appends all elements from the specified array to the end of this list, in the order they appear in the array.
-
Parameters:
-
a(short[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} only if the array is empty)
-
Signature:
@Override public boolean addAll(final int index, final short[] a) - Summary: Inserts all elements from the specified array into this list, starting at the specified position.
-
Contract:
- Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).
-
Parameters:
-
index(int) — the index at which to insert the first element from the specified array -
a(short[]) — the array containing elements to be added to this list
-
- Returns: {@code true} if this list changed as a result of the call (returns {@code false} only if the array is empty)
remove(...) -> boolean
-
Signature:
public boolean remove(final short e) - Summary: Removes the first occurrence of the specified element from this list, if it is present.
-
Contract:
- Removes the first occurrence of the specified element from this list, if it is present.
- If the list does not contain the element, it is unchanged.
-
Parameters:
-
e(short) — the element to be removed from this list, if present
-
- Returns: {@code true} if this list contained the specified element (and it was removed); {@code false} otherwise
removeAllOccurrences(...) -> boolean
-
Signature:
public boolean removeAllOccurrences(final short e) - Summary: Removes all occurrences of the specified element from this list.
-
Parameters:
-
e(short) — the element to be removed from this list
-
- Returns: {@code true} if this list was modified (i.e., at least one occurrence was removed)
removeAll(...) -> boolean
-
Signature:
@Override public boolean removeAll(final ShortList c) - Summary: Removes from this list all of its elements that are contained in the specified ShortList.
-
Parameters:
-
c(ShortList) — the ShortList containing elements to be removed from this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean removeAll(final short[] a) - Summary: Removes from this list all of its elements that are contained in the specified array.
-
Parameters:
-
a(short[]) — the array containing elements to be removed from this list
-
- Returns: {@code true} if this list changed as a result of the call
removeIf(...) -> boolean
-
Signature:
public boolean removeIf(final ShortPredicate p) - Summary: Removes all elements from this list that satisfy the given predicate.
-
Parameters:
-
p(ShortPredicate) — the predicate which returns {@code true} for elements to be removed. Must not be {@code null} .
-
- Returns: {@code true} if any elements were removed; {@code false} if the list was unchanged
removeDuplicates(...) -> boolean
-
Signature:
@Override public boolean removeDuplicates() - Summary: Removes all duplicate elements from this list, keeping only the first occurrence of each value.
-
Contract:
- If the list is already sorted, this operation is optimized to run in linear time.
-
Parameters:
- (none)
- Returns: {@code true} if any duplicates were removed, {@code false} if all elements were already unique
retainAll(...) -> boolean
-
Signature:
@Override public boolean retainAll(final ShortList c) - Summary: Retains only the elements in this list that are contained in the specified ShortList.
-
Parameters:
-
c(ShortList) — the ShortList containing elements to be retained in this list
-
- Returns: {@code true} if this list changed as a result of the call
-
Signature:
@Override public boolean retainAll(final short[] a) - Summary: Retains only the elements in this list that are contained in the specified array.
-
Parameters:
-
a(short[]) — the array containing elements to be retained in this list
-
- Returns: {@code true} if this list changed as a result of the call
delete(...) -> short
-
Signature:
public short delete(final int index) - Summary: Removes the element at the specified position in this list.
-
Parameters:
-
index(int) — the index of the element to be removed
-
- Returns: the element that was removed from the list
deleteAllByIndices(...) -> void
-
Signature:
@Override public void deleteAllByIndices(final int... indices) - Summary: Removes all elements at the specified indices from this list.
-
Parameters:
-
indices(int[]) — the indices of elements to be removed. Can be empty, {@code null} , or contain duplicates.
-
deleteRange(...) -> void
-
Signature:
@Override public void deleteRange(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Removes from this list all elements whose index is between fromIndex (inclusive) and toIndex (exclusive).
-
Contract:
- If fromIndex equals toIndex, no elements are removed.
-
Parameters:
-
fromIndex(int) — the index of the first element to be removed (inclusive) -
toIndex(int) — the index after the last element to be removed (exclusive)
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
moveRange(...) -> void
-
Signature:
@Override public void moveRange(final int fromIndex, final int toIndex, final int newPositionAfterMove) - Summary: Moves a range of elements within this list to a new position.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — the index where the first element of the range should be positioned after the move; must be > = 0 and < = {@code size() - lengthOfRange}
-
replaceRange(...) -> void
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final ShortList replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified ShortList.
-
Contract:
- If the replacement list has a different size than the range being replaced, the list will be resized accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be replaced -
toIndex(int) — the ending index (exclusive) of the range to be replaced -
replacement(ShortList) — the ShortList whose elements will replace the specified range. Can be empty.
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
-
Signature:
@Override public void replaceRange(final int fromIndex, final int toIndex, final short[] replacement) throws IndexOutOfBoundsException - Summary: Replaces a range of elements in this list with the elements from the specified array.
-
Contract:
- If the replacement array has a different size than the range being replaced, the list will be resized accordingly.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to be replaced -
toIndex(int) — the ending index (exclusive) of the range to be replaced -
replacement(short[]) — the array whose elements will replace the specified range. Can be empty or {@code null} .
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
replaceAll(...) -> int
-
Signature:
public int replaceAll(final short oldVal, final short newVal) - Summary: Replaces all occurrences of the specified value in this list with the new value.
-
Parameters:
-
oldVal(short) — the value to be replaced -
newVal(short) — the value to replace oldVal
-
- Returns: the number of elements replaced
-
Signature:
public void replaceAll(final ShortUnaryOperator operator) - Summary: Replaces each element of this list with the result of applying the specified operator to that element.
-
Parameters:
-
operator(ShortUnaryOperator) — the operator to apply to each element
-
replaceIf(...) -> boolean
-
Signature:
public boolean replaceIf(final ShortPredicate predicate, final short newValue) - Summary: Replaces all elements that satisfy the given predicate with the specified new value.
-
Parameters:
-
predicate(ShortPredicate) — the predicate to test each element -
newValue(short) — the value to replace matching elements with
-
- Returns: {@code true} if any elements were replaced
fill(...) -> void
-
Signature:
public void fill(final short val) - Summary: Replaces all elements in this list with the specified value.
-
Parameters:
-
val(short) — the value to be stored in all elements of the list
-
-
Signature:
public void fill(final int fromIndex, final int toIndex, final short val) throws IndexOutOfBoundsException - Summary: Replaces all elements in the specified range with the specified value.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to be filled with the specified value -
toIndex(int) — the index after the last element (exclusive) to be filled with the specified value -
val(short) — the value to be stored in all elements of the specified range
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
contains(...) -> boolean
-
Signature:
public boolean contains(final short valueToFind) - Summary: Returns {@code true} if this list contains the specified element.
-
Contract:
- Returns {@code true} if this list contains the specified element.
- More formally, returns {@code true} if and only if this list contains at least one element {@code e} such that {@code e == valueToFind} .
-
Parameters:
-
valueToFind(short) — the element whose presence in this list is to be tested
-
- Returns: {@code true} if this list contains the specified element, {@code false} otherwise
containsAny(...) -> boolean
-
Signature:
@Override public boolean containsAny(final ShortList c) - Summary: Returns {@code true} if this list contains any of the elements in the specified ShortList.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified ShortList.
-
Parameters:
-
c(ShortList) — the ShortList to be checked for containment in this list
-
- Returns: {@code true} if this list contains any element from the specified list
-
Signature:
@Override public boolean containsAny(final short[] a) - Summary: Returns {@code true} if this list contains any of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains any of the elements in the specified array.
-
Parameters:
-
a(short[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains any element from the specified array
containsAll(...) -> boolean
-
Signature:
@Override public boolean containsAll(final ShortList c) - Summary: Returns {@code true} if this list contains all of the elements in the specified ShortList.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified ShortList.
- Each element's occurrences are counted independently - if an element appears twice in the specified list, this list must contain at least two occurrences of that element.
-
Parameters:
-
c(ShortList) — the ShortList to be checked for containment in this list
-
- Returns: {@code true} if this list contains all elements of the specified list
-
Signature:
@Override public boolean containsAll(final short[] a) - Summary: Returns {@code true} if this list contains all of the elements in the specified array.
-
Contract:
- Returns {@code true} if this list contains all of the elements in the specified array.
- Each element's occurrences are counted independently - if an element appears twice in the specified array, this list must contain at least two occurrences of that element.
-
Parameters:
-
a(short[]) — the array to be checked for containment in this list
-
- Returns: {@code true} if this list contains all elements of the specified array
disjoint(...) -> boolean
-
Signature:
@Override public boolean disjoint(final ShortList c) - Summary: Returns {@code true} if this list has no elements in common with the specified ShortList.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified ShortList.
- Two lists are disjoint if they share no common elements.
-
Parameters:
-
c(ShortList) — the ShortList to be checked for disjointness with this list
-
- Returns: {@code true} if this list has no elements in common with the specified list
-
Signature:
@Override public boolean disjoint(final short[] b) - Summary: Returns {@code true} if this list has no elements in common with the specified array.
-
Contract:
- Returns {@code true} if this list has no elements in common with the specified array.
- This list and the array are disjoint if they share no common elements.
-
Parameters:
-
b(short[]) — the array to be checked for disjointness with this list
-
- Returns: {@code true} if this list has no elements in common with the specified array
intersection(...) -> ShortList
-
Signature:
@Override public ShortList intersection(final ShortList b) - Summary: Returns a new list containing elements that are present in both this list and the specified list.
-
Parameters:
-
b(ShortList) — the list to find common elements with this list
-
- Returns: a new ShortList containing elements present in both this list and the specified list, considering the minimum number of occurrences in either list. Returns an empty list if either list is {@code null} or empty.
- See also: #intersection(short\[\]), #difference(ShortList), #symmetricDifference(ShortList), N#intersection(short\[\], short\[\]), N#intersection(int\[\], int\[\])
-
Signature:
@Override public ShortList intersection(final short[] b) - Summary: Returns a new list containing elements that are present in both this list and the specified array.
-
Parameters:
-
b(short[]) — the array to find common elements with this list
-
- Returns: a new ShortList containing elements present in both this list and the specified array, considering the minimum number of occurrences in either source. Returns an empty list if the array is {@code null} or empty.
- See also: #intersection(ShortList), #difference(short\[\]), #symmetricDifference(short\[\]), N#intersection(short\[\], short\[\]), N#intersection(int\[\], int\[\])
difference(...) -> ShortList
-
Signature:
@Override public ShortList difference(final ShortList b) - Summary: Returns a new list containing the elements that are in this list but not in the specified list.
-
Contract:
- If an element appears multiple times, the difference considers the count of occurrences - only the excess occurrences remain in the result.
-
Parameters:
-
b(ShortList) — the list to compare against this list
-
- Returns: a new ShortList containing the elements that are present in this list but not in the specified list, considering the number of occurrences.
- See also: #difference(short\[\]), #symmetricDifference(ShortList), #intersection(ShortList), N#difference(short\[\], short\[\]), N#difference(int\[\], int\[\])
-
Signature:
@Override public ShortList difference(final short[] b) - Summary: Returns a new list containing the elements that are in this list but not in the specified array.
-
Contract:
- If an element appears multiple times, the difference considers the count of occurrences - only the excess occurrences remain in the result.
-
Parameters:
-
b(short[]) — the array to compare against this list
-
- Returns: a new ShortList containing the elements that are present in this list but not in the specified array, considering the number of occurrences. Returns a copy of this list if {@code b} is {@code null} or empty.
- See also: #difference(ShortList), #symmetricDifference(short\[\]), #intersection(short\[\]), N#difference(short\[\], short\[\]), N#difference(int\[\], int\[\])
symmetricDifference(...) -> ShortList
-
Signature:
@Override public ShortList symmetricDifference(final ShortList b) - Summary: Returns a new ShortList containing elements that are present in either this list or the specified list, but not in both.
-
Parameters:
-
b(ShortList) — the list to compare with this list for symmetric difference
-
- Returns: a new ShortList containing elements that are present in either this list or the specified list, but not in both, considering the number of occurrences
- See also: #symmetricDifference(short\[\]), #difference(ShortList), #intersection(ShortList), N#symmetricDifference(short\[\], short\[\]), N#symmetricDifference(int\[\], int\[\])
-
Signature:
@Override public ShortList symmetricDifference(final short[] b) - Summary: Returns a new ShortList containing elements that are present in either this list or the specified array, but not in both.
-
Parameters:
-
b(short[]) — the array to compare with this list for symmetric difference
-
- Returns: a new ShortList containing elements that are present in either this list or the specified array, but not in both, considering the number of occurrences
- See also: #symmetricDifference(ShortList), #difference(short\[\]), #intersection(short\[\]), N#symmetricDifference(short\[\], short\[\]), N#symmetricDifference(int\[\], int\[\])
occurrencesOf(...) -> int
-
Signature:
public int occurrencesOf(final short valueToFind) - Summary: Returns the number of times the specified value appears in this list.
-
Parameters:
-
valueToFind(short) — the value to count occurrences of
-
- Returns: the number of times the specified value appears in this list
indexOf(...) -> int
-
Signature:
public int indexOf(final short valueToFind) - Summary: Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
- More formally, returns the lowest index i such that elementData\[i\] == valueToFind, or -1 if there is no such index.
-
Parameters:
-
valueToFind(short) — the element to search for
-
- Returns: the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
-
Signature:
public int indexOf(final short valueToFind, final int fromIndex) - Summary: Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the first occurrence of the specified element in this list, searching forwards from the specified index, or -1 if the element is not found.
- More formally, returns the lowest index i > = fromIndex such that elementData\[i\] == valueToFind, or -1 if there is no such index.
-
Parameters:
-
valueToFind(short) — the element to search for -
fromIndex(int) — the index to start searching from (inclusive)
-
- Returns: the index of the first occurrence of the element at position > = fromIndex, or -1 if the element is not found
lastIndexOf(...) -> int
-
Signature:
public int lastIndexOf(final short valueToFind) - Summary: Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
- More formally, returns the highest index i such that elementData\[i\] == valueToFind, or -1 if there is no such index.
-
Parameters:
-
valueToFind(short) — the element to search for
-
- Returns: the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element
-
Signature:
public int lastIndexOf(final short valueToFind, final int startIndexFromBack) - Summary: Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
-
Contract:
- Returns the index of the last occurrence of the specified element in this list, searching backwards from the specified index, or -1 if the element is not found.
- More formally, returns the highest index i < = startIndexFromBack such that elementData\[i\] == valueToFind, or -1 if there is no such index.
-
Parameters:
-
valueToFind(short) — the element to search for -
startIndexFromBack(int) — the index to start searching backwards from (inclusive). Can be size() to search the entire list.
-
- Returns: the index of the last occurrence of the element at position < = startIndexFromBack, or -1 if the element is not found
min(...) -> OptionalShort
-
Signature:
public OptionalShort min() - Summary: Returns the minimum element in this list.
-
Contract:
- If the list is empty, an empty OptionalShort is returned.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the minimum element, or an empty OptionalShort if this list is empty
-
Signature:
public OptionalShort min(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the minimum element in the specified range of this list.
-
Contract:
- If the range is empty (fromIndex == toIndex), an empty OptionalShort is returned.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to examine -
toIndex(int) — the index after the last element (exclusive) to examine
-
- Returns: an OptionalShort containing the minimum element in the specified range, or an empty OptionalShort if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
max(...) -> OptionalShort
-
Signature:
public OptionalShort max() - Summary: Returns the maximum element in this list.
-
Contract:
- If the list is empty, an empty OptionalShort is returned.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the maximum element, or an empty OptionalShort if this list is empty
-
Signature:
public OptionalShort max(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the maximum element in the specified range of this list.
-
Contract:
- If the range is empty (fromIndex == toIndex), an empty OptionalShort is returned.
-
Parameters:
-
fromIndex(int) — the index of the first element (inclusive) to examine -
toIndex(int) — the index after the last element (exclusive) to examine
-
- Returns: an OptionalShort containing the maximum element in the specified range, or an empty OptionalShort if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
-
median(...) -> OptionalShort
-
Signature:
public OptionalShort median() - Summary: Returns the median value of all elements in this list.
-
Contract:
- <p> The median is the middle value when the elements are sorted in ascending order.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the median value if the list is non-empty, or an empty OptionalShort if the list is empty
-
Signature:
public OptionalShort median(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns the median value of elements within the specified range of this list.
-
Contract:
- For ranges with an odd number of elements, this returns the exact middle element when sorted.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to calculate median for -
toIndex(int) — the ending index (exclusive) of the range to calculate median for
-
- Returns: an OptionalShort containing the median value if the range is non-empty, or an empty OptionalShort if the range is empty
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex < 0} or {@code toIndex > size()} or {@code fromIndex > toIndex}
-
forEach(...) -> void
-
Signature:
public void forEach(final ShortConsumer action) - Summary: Performs the given action for each element in this list.
-
Parameters:
-
action(ShortConsumer) — the action to be performed for each element
-
-
Signature:
public void forEach(final int fromIndex, final int toIndex, final ShortConsumer action) throws IndexOutOfBoundsException - Summary: Performs the given action for each element within the specified range of this list.
-
Contract:
- <p> This method supports both forward and backward iteration based on the relative values of fromIndex and toIndex: </p> <ul> <li> If {@code fromIndex <= toIndex} : iterates forward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code fromIndex > toIndex} : iterates backward from fromIndex (inclusive) to toIndex (exclusive) </li> <li> If {@code toIndex == -1} : treated as backward iteration from fromIndex to the beginning of the list </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code ShortList list = ShortList.of((short)10, (short)20, (short)30, (short)40, (short)50); list.forEach(0, 3, action); // Forward: processes indices 0,1,2 list.forEach(3, 0, action); // Backward: processes indices 3,2,1 list.forEach(4, -1, action); // Backward: processes indices 4,3,2,1,0 } </pre>
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive), or -1 for backward iteration to the start -
action(ShortConsumer) — the action to be performed for each element
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are out of range
-
first(...) -> OptionalShort
-
Signature:
public OptionalShort first() - Summary: Returns the first element in this list wrapped in an OptionalShort.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the first element, or empty if the list is empty
last(...) -> OptionalShort
-
Signature:
public OptionalShort last() - Summary: Returns the last element in this list wrapped in an OptionalShort.
-
Parameters:
- (none)
- Returns: an OptionalShort containing the last element, or empty if the list is empty
distinct(...) -> ShortList
-
Signature:
@Override public ShortList distinct(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a new ShortList containing only the distinct elements from the specified range.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: a new ShortList containing the distinct elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
hasDuplicates(...) -> boolean
-
Signature:
@Override public boolean hasDuplicates() - Summary: Checks whether this list contains duplicate elements.
-
Parameters:
- (none)
- Returns: {@code true} if the list contains at least one duplicate element, {@code false} otherwise
isSorted(...) -> boolean
-
Signature:
@Override public boolean isSorted() - Summary: Checks whether the elements in this list are sorted in ascending order.
-
Parameters:
- (none)
- Returns: {@code true} if the list is sorted in ascending order or is empty, {@code false} otherwise
sort(...) -> void
-
Signature:
@Override public void sort() - Summary: Sorts all elements in this list in ascending order.
-
Parameters:
- (none)
parallelSort(...) -> void
-
Signature:
public void parallelSort() - Summary: Sorts all elements in this list in ascending order using a parallel sort algorithm.
-
Parameters:
- (none)
reverseSort(...) -> void
-
Signature:
@Override public void reverseSort() - Summary: Sorts all elements in this list in descending order.
-
Parameters:
- (none)
binarySearch(...) -> int
-
Signature:
public int binarySearch(final short valueToFind) - Summary: Searches for the specified value using binary search algorithm.
-
Contract:
- <p> The list must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
-
Parameters:
-
valueToFind(short) — the value to search for
-
- Returns: the index of the search key if found; otherwise, (-(insertion point) - 1). The insertion point is the point at which the key would be inserted into the list.
-
Signature:
public int binarySearch(final int fromIndex, final int toIndex, final short valueToFind) throws IndexOutOfBoundsException - Summary: Searches for the specified value in the given range using binary search algorithm.
-
Contract:
- <p> The specified range of the list must be sorted in ascending order prior to making this call.
- If it is not sorted, the results are undefined.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to search -
toIndex(int) — the ending index (exclusive) of the range to search -
valueToFind(short) — the value to search for
-
- Returns: the index of the search key if found within the range; otherwise, (-(insertion point) - 1). The insertion point is the point at which the key would be inserted into the list.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
reverse(...) -> void
-
Signature:
@Override public void reverse() - Summary: Reverses the order of all elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void reverse(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Reverses the order of elements in the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to reverse -
toIndex(int) — the ending index (exclusive) of the range to reverse
-
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
rotate(...) -> void
-
Signature:
@Override public void rotate(final int distance) - Summary: Rotates all elements in this list by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the list. Positive values rotate right, negative values rotate left
-
- See also: N#rotate(int\[\], int)
shuffle(...) -> void
-
Signature:
@Override public void shuffle() - Summary: Randomly shuffles the elements in this list.
-
Parameters:
- (none)
-
Signature:
@Override public void shuffle(final Random rnd) - Summary: Randomly shuffles the elements in this list using the specified random number generator.
-
Parameters:
-
rnd(Random) — the random number generator to use for shuffling
-
swap(...) -> void
-
Signature:
@Override public void swap(final int i, final int j) - Summary: Swaps the elements at the specified positions in this list.
-
Contract:
- <p> If the specified positions are the same, the list is not modified.
-
Parameters:
-
i(int) — the index of the first element to swap -
j(int) — the index of the second element to swap
-
copy(...) -> ShortList
-
Signature:
@Override public ShortList copy() - Summary: Creates and returns a new ShortList containing all elements of this list.
-
Parameters:
- (none)
- Returns: a new ShortList containing all elements of this list
-
Signature:
@Override public ShortList copy(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates and returns a new ShortList containing elements from the specified range.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy
-
- Returns: a new ShortList containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
-
Signature:
@Override public ShortList copy(final int fromIndex, final int toIndex, final int step) throws IndexOutOfBoundsException - Summary: Creates and returns a new ShortList containing elements from the specified range with the given step.
-
Contract:
- If step is negative, the elements are selected in reverse order.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to copy -
toIndex(int) — the ending index (exclusive) of the range to copy -
step(int) — the step size between selected elements. Must not be zero.
-
- Returns: a new ShortList containing the selected elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: N#copyOfRange(int\[\], int, int, int)
split(...) -> List<ShortList>
-
Signature:
@Override public List<ShortList> split(final int fromIndex, final int toIndex, final int chunkSize) throws IndexOutOfBoundsException - Summary: Splits this list into consecutive subsequences of the specified size.
-
Contract:
- The last list may have fewer elements if the range size is not evenly divisible by the specified size.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to split -
toIndex(int) — the ending index (exclusive) of the range to split -
chunkSize(int) — the desired size of each subsequence. Must be positive.
-
- Returns: a List of ShortList instances containing the split subsequences
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
trimToSize(...) -> ShortList
-
Signature:
@Override public ShortList trimToSize() - Summary: Trims the capacity of this list to its current size.
-
Contract:
- <p> If the capacity of this list is larger than its current size, the capacity is reduced to match the size.
-
Parameters:
- (none)
- Returns: this list instance (for method chaining)
clear(...) -> void
-
Signature:
@Override public void clear() - Summary: Removes all elements from this list.
-
Parameters:
- (none)
isEmpty(...) -> boolean
-
Signature:
@Override public boolean isEmpty() - Summary: Returns {@code true} if this list contains no elements.
-
Contract:
- Returns {@code true} if this list contains no elements.
-
Parameters:
- (none)
- Returns: {@code true} if this list contains no elements, {@code false} otherwise
size(...) -> int
-
Signature:
@Override public int size() - Summary: Returns the number of elements in this list.
-
Parameters:
- (none)
- Returns: the number of elements in this list
boxed(...) -> List<Short>
-
Signature:
@Override public List<Short> boxed() - Summary: Returns a List containing all elements of this list as boxed Short objects.
-
Parameters:
- (none)
- Returns: a new List < Short > containing all elements as boxed values
-
Signature:
@Override public List<Short> boxed(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a List containing elements from the specified range as boxed Short objects.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to box -
toIndex(int) — the ending index (exclusive) of the range to box
-
- Returns: a new List < Short > containing the specified range of elements as boxed values
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
toArray(...) -> short\[\]
-
Signature:
@Override public short[] toArray() - Summary: Returns a new array containing all elements of this list in proper sequence.
-
Parameters:
- (none)
- Returns: a new short array containing all elements of this list
toIntList(...) -> IntList
-
Signature:
public IntList toIntList() - Summary: Converts this ShortList to an IntList.
-
Parameters:
- (none)
- Returns: a new IntList containing all elements of this list widened to int values
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Short>> C toCollection(final int fromIndex, final int toIndex, final IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Summary: Returns a Collection containing the elements from the specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range to add -
toIndex(int) — the ending index (exclusive) of the range to add -
supplier(IntFunction<? extends C>) — a function that creates the collection with the specified initial capacity
-
- Returns: the collection with the added elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
toMultiset(...) -> Multiset<Short>
-
Signature:
@Override public Multiset<Short> toMultiset(final int fromIndex, final int toIndex, final IntFunction<Multiset<Short>> supplier) throws IndexOutOfBoundsException - Summary: Returns a Multiset containing all elements from specified range converted to their boxed type.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range -
supplier(IntFunction<Multiset<Short>>) — a function that creates the Multiset with the specified initial capacity
-
- Returns: a Multiset containing the elements from the specified range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
iterator(...) -> ShortIterator
-
Signature:
@Override public ShortIterator iterator() - Summary: Returns an iterator over the elements in this list.
-
Parameters:
- (none)
- Returns: a ShortIterator over the elements in this list
stream(...) -> ShortStream
-
Signature:
public ShortStream stream() - Summary: Returns a ShortStream with this list as its source.
-
Parameters:
- (none)
- Returns: a sequential ShortStream over the elements in this list
-
Signature:
public ShortStream stream(final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a ShortStream for the specified range of this list.
-
Parameters:
-
fromIndex(int) — the starting index (inclusive) of the range -
toIndex(int) — the ending index (exclusive) of the range
-
- Returns: a sequential ShortStream over the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex < 0, toIndex > size(), or fromIndex > toIndex
-
getFirst(...) -> short
-
Signature:
public short getFirst() - Summary: Returns the first element in this list.
-
Parameters:
- (none)
- Returns: the first short value in the list
getLast(...) -> short
-
Signature:
public short getLast() - Summary: Returns the last element in this list.
-
Parameters:
- (none)
- Returns: the last short value in the list
addFirst(...) -> void
-
Signature:
public void addFirst(final short e) - Summary: Inserts the specified element at the beginning of this list.
-
Parameters:
-
e(short) — the element to add at the beginning of the list
-
addLast(...) -> void
-
Signature:
public void addLast(final short e) - Summary: Appends the specified element to the end of this list.
-
Parameters:
-
e(short) — the element to add at the end of the list
-
removeFirst(...) -> short
-
Signature:
public short removeFirst() - Summary: Removes and returns the first element from this list.
-
Parameters:
- (none)
- Returns: the first short value that was removed from the list
removeLast(...) -> short
-
Signature:
public short removeLast() - Summary: Removes and returns the last element from this list.
-
Parameters:
- (none)
- Returns: the last short value that was removed from the list
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code value for this list.
-
Parameters:
- (none)
- Returns: the hash code value for this list
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Compares this list with the specified object for equality.
-
Contract:
- <p> Returns {@code true} if and only if the specified object is also a ShortList, both lists have the same size, and all corresponding pairs of elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with this list for equality
-
- Returns: {@code true} if the specified object is equal to this list, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this list.
-
Parameters:
- (none)
- Returns: a string representation of this list
Class ShortSummaryStatistics (com.landawn.abacus.util.ShortSummaryStatistics)
A state object for collecting statistics such as count, min, max, sum, and average for {@code short} values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ShortSummaryStatistics() - Summary: Constructs an empty instance with zero count, zero sum, {@code Short.MAX_VALUE} min, and {@code Short.MIN_VALUE} max.
-
Parameters:
- (none)
-
Signature:
public ShortSummaryStatistics(final long count, final short min, final short max, final long sum) - Summary: Constructs a non-empty instance with the specified count, min, max, and sum.
-
Parameters:
-
count(long) — the count of values -
min(short) — the minimum value -
max(short) — the maximum value -
sum(long) — the sum of all values
-
accept(...) -> void
-
Signature:
@Override public void accept(final short value) - Summary: Records a new short value into the summary information.
-
Parameters:
-
value(short) — the input value to be recorded
-
combine(...) -> void
-
Signature:
public void combine(final ShortSummaryStatistics other) - Summary: Combines the state of another {@code ShortSummaryStatistics} into this one.
-
Parameters:
-
other(ShortSummaryStatistics) — another {@code ShortSummaryStatistics} to be combined with this one
-
getMin(...) -> short
-
Signature:
public final short getMin() - Summary: Returns the minimum value recorded, or {@code Short.MAX_VALUE} if no values have been recorded.
-
Contract:
- Returns the minimum value recorded, or {@code Short.MAX_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the minimum value, or {@code Short.MAX_VALUE} if none
getMax(...) -> short
-
Signature:
public final short getMax() - Summary: Returns the maximum value recorded, or {@code Short.MIN_VALUE} if no values have been recorded.
-
Contract:
- Returns the maximum value recorded, or {@code Short.MIN_VALUE} if no values have been recorded.
-
Parameters:
- (none)
- Returns: the maximum value, or {@code Short.MIN_VALUE} if none
getCount(...) -> long
-
Signature:
public final long getCount() - Summary: Returns the count of values recorded.
-
Parameters:
- (none)
- Returns: the count of values
getSum(...) -> Long
-
Signature:
public final Long getSum() - Summary: Returns the sum of values recorded.
-
Parameters:
- (none)
- Returns: the sum of values as a Long
getAverage(...) -> Double
-
Signature:
public final Double getAverage() - Summary: Returns the arithmetic mean of values recorded, or 0.0 if no values have been recorded.
-
Contract:
- Returns the arithmetic mean of values recorded, or 0.0 if no values have been recorded.
-
Parameters:
- (none)
- Returns: the arithmetic mean of values, or 0.0 if none
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this statistics object.
-
Parameters:
- (none)
- Returns: a string representation of this object
Class SnappyInputStream (com.landawn.abacus.util.SnappyInputStream)
A wrapper class for Snappy-compressed input streams that provides transparent decompression.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public SnappyInputStream(final InputStream is) throws IOException - Summary: Creates a new SnappyInputStream that decompresses data from the specified input stream.
-
Contract:
- The input stream should contain data that was compressed using Snappy compression.
-
Parameters:
-
is(InputStream) — the input stream containing Snappy-compressed data
-
-
Throws:
-
java.io.IOException— if an I/O error occurs during initialization
-
read(...) -> int
-
Signature:
@Override public int read() throws IOException - Summary: Reads the next byte of decompressed data from this input stream.
-
Contract:
- If no byte is available because the end of the stream has been reached, the value -1 is returned.
-
Parameters:
- (none)
- Returns: the next byte of data, or -1 if the end of the stream is reached
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public int read(final byte[] b) throws IOException - Summary: Reads up to {@code b.length} bytes of decompressed data from this input stream into an array of bytes.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public int read(final byte[] b, final int off, final int len) throws IOException - Summary: Reads up to {@code len} bytes of decompressed data from this input stream into an array of bytes, starting at the specified offset.
-
Parameters:
-
b(byte[]) — the buffer into which the data is read -
off(int) — the start offset in the destination array {@code b} -
len(int) — the maximum number of bytes to read
-
- Returns: the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
skip(...) -> long
-
Signature:
@Override public long skip(final long n) throws IllegalArgumentException, IOException - Summary: Skips over and discards {@code n} bytes of decompressed data from this input stream.
-
Parameters:
-
n(long) — the number of bytes to be skipped
-
- Returns: the actual number of bytes skipped
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative -
java.io.IOException— if an I/O error occurs
-
available(...) -> int
-
Signature:
@Override public int available() throws IOException - Summary: Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
-
Parameters:
- (none)
- Returns: an estimate of the number of bytes that can be read without blocking
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
mark(...) -> void
-
Signature:
@Override public synchronized void mark(final int readLimit) - Summary: Marks the current position in this input stream.
-
Parameters:
-
readLimit(int) — the maximum limit of bytes that can be read before the mark position becomes invalid
-
- See also: #reset(), #markSupported()
reset(...) -> void
-
Signature:
@Override public synchronized void reset() throws IOException - Summary: Repositions this stream to the position at the time the {@code mark} method was last called on this input stream.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if this stream has not been marked or if the mark has been invalidated
-
- See also: #mark(int), #markSupported()
markSupported(...) -> boolean
-
Signature:
@Override public boolean markSupported() - Summary: Tests if this input stream supports the {@code mark} and {@code reset} methods.
-
Contract:
- Tests if this input stream supports the {@code mark} and {@code reset} methods.
-
Parameters:
- (none)
- Returns: {@code true} if this stream instance supports the mark and reset methods; {@code false} otherwise
- See also: #mark(int), #reset()
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes this input stream and releases any system resources associated with the stream.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
Class SnappyOutputStream (com.landawn.abacus.util.SnappyOutputStream)
A compression output stream that uses the Snappy compression algorithm.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public SnappyOutputStream(final OutputStream os) - Summary: Creates a new SnappyOutputStream that compresses data written to the specified output stream.
-
Parameters:
-
os(OutputStream) — the underlying output stream to write compressed data to
-
-
Signature:
public SnappyOutputStream(final OutputStream os, final int bufferSize) - Summary: Creates a new SnappyOutputStream with the specified buffer size.
-
Parameters:
-
os(OutputStream) — the underlying output stream to write compressed data to -
bufferSize(int) — the size of the compression buffer in bytes
-
write(...) -> void
-
Signature:
@Override public void write(final int b) throws IOException - Summary: Writes a single byte of compressed data to the output stream.
-
Parameters:
-
b(int) — the byte to write (as an integer, where only the low-order byte is used)
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public void write(final byte[] b) throws IOException - Summary: Writes an array of bytes to the output stream after compression.
-
Parameters:
-
b(byte[]) — the byte array to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@Override public void write(final byte[] b, final int off, final int len) throws IOException - Summary: Writes a portion of a byte array to the output stream after compression.
-
Parameters:
-
b(byte[]) — the byte array containing data to write -
off(int) — the start offset in the array -
len(int) — the number of bytes to write
-
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
flush(...) -> void
-
Signature:
@Override public void flush() throws IOException - Summary: Flushes this output stream and forces any buffered output bytes to be written out.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
close(...) -> void
-
Signature:
@Override public void close() throws IOException - Summary: Closes this output stream and releases any system resources associated with it.
-
Parameters:
- (none)
-
Throws:
-
java.io.IOException— if an I/O error occurs during closing
-
Class Splitter (com.landawn.abacus.util.Splitter)
A flexible string splitting utility that divides strings into parts based on configurable delimiters and patterns.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
defauLt(...) -> Splitter
-
Signature:
@Beta public static Splitter defauLt() - Summary: Returns a new Splitter instance configured with the default delimiter: ", " (comma followed by space).
-
Parameters:
- (none)
- Returns: a new Splitter instance configured with the default delimiter ", ".
- See also: #with(CharSequence), #forLines(), Joiner#DEFAULT_DELIMITER, Joiner#defauLt()
forLines(...) -> Splitter
-
Signature:
@Beta public static Splitter forLines() - Summary: Returns a new Splitter instance configured to split text by line separators.
-
Parameters:
- (none)
- Returns: a new Splitter instance configured to split by line separators.
- See also: #with(Pattern), #defauLt()
with(...) -> Splitter
-
Signature:
public static Splitter with(final char delimiter) - Summary: Returns a new Splitter instance that uses the specified character as a delimiter.
-
Contract:
- This is the most efficient option when splitting by a single character.
-
Parameters:
-
delimiter(char) — the character to use as a delimiter for splitting.
-
- Returns: a new Splitter instance configured with the specified character delimiter.
- See also: #with(CharSequence), #with(Pattern)
-
Signature:
public static Splitter with(final CharSequence delimiter) throws IllegalArgumentException - Summary: Returns a new Splitter instance that uses the specified character sequence as a delimiter.
-
Contract:
- If the delimiter is a single character, this method delegates to the more efficient single-character version.
-
Parameters:
-
delimiter(CharSequence) — the character sequence to use as a delimiter for splitting, not {@code null} or empty.
-
- Returns: a new Splitter instance configured with the specified delimiter.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified delimiter is {@code null} or empty.
-
- See also: #with(char), #with(Pattern), #pattern(CharSequence)
-
Signature:
public static Splitter with(final Pattern delimiter) throws IllegalArgumentException - Summary: Returns a new Splitter instance that uses the specified regular expression pattern as a delimiter.
-
Parameters:
-
delimiter(Pattern) — the Pattern to use as a delimiter for splitting, not {@code null} .
-
- Returns: a new Splitter instance configured with the specified pattern delimiter.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified delimiter is {@code null} , or if the pattern can match an empty string.
-
- See also: #pattern(CharSequence), #with(CharSequence)
pattern(...) -> Splitter
-
Signature:
public static Splitter pattern(final CharSequence delimiterRegex) throws IllegalArgumentException - Summary: Returns a new Splitter instance that uses the specified regular expression as a delimiter.
-
Parameters:
-
delimiterRegex(CharSequence) — the regular expression to use as a delimiter for splitting, not {@code null} or empty.
-
- Returns: a new Splitter instance configured with the compiled pattern delimiter.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified delimiter regex is {@code null} or empty, or if the resulting pattern can match an empty string.
-
- See also: #with(Pattern), #with(CharSequence)
Public Instance Methods
omitEmptyStrings(...) -> Splitter
-
Signature:
@Deprecated public Splitter omitEmptyStrings(final boolean omitEmptyStrings) - Summary: Configures this Splitter to omit empty strings from the results when the specified parameter is {@code true} .
-
Contract:
- Configures this Splitter to omit empty strings from the results when the specified parameter is {@code true} .
- Empty strings can occur when there are consecutive delimiters or when delimiters appear at the beginning or end of the input.
-
Parameters:
-
omitEmptyStrings(boolean) — {@code true} to omit empty strings from results, {@code false} to include them.
-
- Returns: this Splitter instance for method chaining.
-
Signature:
public Splitter omitEmptyStrings() - Summary: Configures this Splitter to omit empty strings from the results.
-
Contract:
- Empty strings can occur when there are consecutive delimiters or when delimiters appear at the beginning or end of the input.
-
Parameters:
- (none)
- Returns: this Splitter instance for method chaining.
- See also: #trimResults(), #stripResults()
trim(...) -> Splitter
-
Signature:
@Deprecated public Splitter trim(final boolean trim) - Summary: Configures this Splitter to trim leading and trailing spaces from each resulting substring when the specified parameter is {@code true} .
-
Contract:
- Configures this Splitter to trim leading and trailing spaces from each resulting substring when the specified parameter is {@code true} .
-
Parameters:
-
trim(boolean) — {@code true} to trim spaces from results, {@code false} to leave them as-is.
-
- Returns: this Splitter instance for method chaining.
trimResults(...) -> Splitter
-
Signature:
public Splitter trimResults() - Summary: Configures this Splitter to trim leading and trailing spaces from each resulting substring.
-
Parameters:
- (none)
- Returns: this Splitter instance for method chaining.
- See also: #stripResults(), #omitEmptyStrings()
strip(...) -> Splitter
-
Signature:
@Deprecated public Splitter strip(final boolean strip) - Summary: Configures this Splitter to remove leading and trailing whitespace characters from each resulting substring when the specified parameter is {@code true} .
-
Contract:
- Configures this Splitter to remove leading and trailing whitespace characters from each resulting substring when the specified parameter is {@code true} .
-
Parameters:
-
strip(boolean) — {@code true} to strip whitespace from results, {@code false} to leave them as-is.
-
- Returns: this Splitter instance for method chaining.
- See also: Character#isWhitespace(char)
stripResults(...) -> Splitter
-
Signature:
public Splitter stripResults() - Summary: Configures this Splitter to remove leading and trailing whitespace characters from each resulting substring.
-
Parameters:
- (none)
- Returns: this Splitter instance for method chaining.
- See also: #trimResults(), #omitEmptyStrings(), Character#isWhitespace(char)
limit(...) -> Splitter
-
Signature:
public Splitter limit(final int limit) throws IllegalArgumentException - Summary: Configures this Splitter to limit the maximum number of substrings to return when splitting.
-
Contract:
- Configures this Splitter to limit the maximum number of substrings to return when splitting.
- If the limit is reached, the remainder of the input string will be included in the last substring, without further splitting.
-
Parameters:
-
limit(int) — the maximum number of substrings to return; must be positive.
-
- Returns: this Splitter instance for method chaining.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided limit is not a positive integer.
-
- See also: #split(CharSequence)
split(...) -> List<String>
-
Signature:
public List<String> split(final CharSequence source) - Summary: Splits the specified CharSequence using this Splitter's configuration and returns the results as a List of strings.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} .
-
- Returns: a new ArrayList containing the split results; returns an empty list if source is {@code null} .
- See also: #split(CharSequence, Supplier), #split(CharSequence, Function), #split(CharSequence, Class), #splitToArray(CharSequence), #splitToStream(CharSequence)
-
Signature:
public <C extends Collection<String>> C split(final CharSequence source, final Supplier<? extends C> supplier) - Summary: Splits the specified CharSequence using this Splitter's configuration and returns the results in a Collection created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
supplier(Supplier<? extends C>) — a Supplier that creates a new Collection instance to hold the results.
-
- Returns: the Collection created by the supplier, populated with the split results.
- See also: #split(CharSequence), #split(CharSequence, Class, Supplier)
-
Signature:
public <T> List<T> split(final CharSequence source, final Function<? super String, ? extends T> mapper) - Summary: Splits the specified CharSequence using this Splitter's configuration and applies the provided mapping function to each resulting substring.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
mapper(Function<? super String, ? extends T>) — a function to apply to each split string.
-
- Returns: a new List containing the mapped results.
- See also: #split(CharSequence), #split(CharSequence, Class), #splitThenApply(CharSequence, Function)
-
Signature:
public <T> List<T> split(final CharSequence source, final Class<? extends T> targetType) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration and converts each resulting substring to the specified target type using the type system's valueOf method.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Class<? extends T>) — the Class representing the type to convert each substring to, not {@code null} .
-
- Returns: a new List containing the converted results.
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is {@code null} .
-
- See also: #split(CharSequence, Type), #split(CharSequence, Class, Supplier), #splitToArray(CharSequence, Class)
-
Signature:
public <T, C extends Collection<T>> C split(final CharSequence source, final Class<? extends T> targetType, final Supplier<? extends C> supplier) - Summary: Splits the specified CharSequence using this Splitter's configuration, converts each resulting substring to the specified target type, and returns the results in a Collection created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Class<? extends T>) — the Class representing the type to convert each substring to. -
supplier(Supplier<? extends C>) — a Supplier that creates a new Collection instance to hold the results.
-
- Returns: the Collection created by the supplier, populated with the converted results.
-
Signature:
public <T> List<T> split(final CharSequence source, final Type<? extends T> targetType) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration and converts each resulting substring to the specified target type using the provided Type instance for conversion.
-
Contract:
- This method is useful when working with the type system directly or when Class objects are insufficient (e.g., for generic types).
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Type<? extends T>) — the Type instance used for converting strings to the target type.
-
- Returns: a List containing the converted results.
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is null.
-
-
Signature:
public <T, C extends Collection<T>> C split(final CharSequence source, final Type<? extends T> targetType, final Supplier<? extends C> supplier) - Summary: Splits the specified CharSequence using this Splitter's configuration, converts each resulting substring to the specified target type using the provided Type instance, and returns the results in a Collection created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Type<? extends T>) — the Type instance used for converting strings to the target type. -
supplier(Supplier<? extends C>) — a Supplier that creates a new Collection instance to hold the results.
-
- Returns: the Collection created by the supplier, populated with the converted results.
-
Signature:
public <C extends Collection<String>> void split(final CharSequence source, final C output) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration and adds the resulting substrings to the provided output collection.
-
Contract:
- This method is useful when you want to append split results to an existing collection rather than creating a new one.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
output(C) — the Collection to add the split results to, not {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if output is {@code null} .
-
- See also: #split(CharSequence), #split(CharSequence, Supplier)
-
Signature:
public <T, C extends Collection<T>> void split(final CharSequence source, final Class<? extends T> targetType, final C output) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration, converts each resulting substring to the specified target type, and adds the converted values to the provided output collection.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Class<? extends T>) — the Class representing the type to convert each substring to. -
output(C) — the Collection to add the converted results to.
-
-
Throws:
-
java.lang.IllegalArgumentException— if targetType or output is null.
-
-
Signature:
public <T, C extends Collection<T>> void split(final CharSequence source, final Type<? extends T> targetType, final C output) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration, converts each resulting substring to the specified target type using the provided Type instance, and adds the converted values to the provided output collection.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Type<? extends T>) — the Type instance used for converting strings to the target type. -
output(C) — the Collection to add the converted results to.
-
-
Throws:
-
java.lang.IllegalArgumentException— if targetType or output is null.
-
splitToImmutableList(...) -> ImmutableList<String>
-
Signature:
public ImmutableList<String> splitToImmutableList(final CharSequence source) - Summary: Splits the specified CharSequence using this Splitter's configuration and returns the results as an ImmutableList.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} .
-
- Returns: an ImmutableList containing the split results.
- See also: #split(CharSequence), #splitToImmutableList(CharSequence, Class)
-
Signature:
public <T> ImmutableList<T> splitToImmutableList(final CharSequence source, final Class<? extends T> targetType) - Summary: Splits the specified CharSequence using this Splitter's configuration, converts each resulting substring to the specified target type, and returns the results as an ImmutableList.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
targetType(Class<? extends T>) — the Class representing the type to convert each substring to.
-
- Returns: an ImmutableList containing the converted results.
splitToArray(...) -> String\[\]
-
Signature:
public String[] splitToArray(final CharSequence source) - Summary: Splits the specified CharSequence using this Splitter's configuration and returns the results as a String array.
-
Contract:
- This is useful when an array is preferred over a List.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} .
-
- Returns: a String array containing the split results; returns an empty array if source is {@code null} .
- See also: #split(CharSequence), #splitToArray(CharSequence, Function), #splitToArray(CharSequence, Class)
-
Signature:
public String[] splitToArray(final CharSequence source, final Function<? super String, String> mapper) - Summary: Splits the specified CharSequence using this Splitter's configuration, applies the provided mapping function to each resulting substring, and returns the results as a String array.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
mapper(Function<? super String, String>) — a function to apply to each split string.
-
- Returns: a String array containing the mapped results.
-
Signature:
public <T> T splitToArray(final CharSequence source, final Class<T> arrayType) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration, converts the results to the specified array type, and returns the array.
-
Contract:
- The array type must be an array class (e.g., String\[\].class, Integer\[\].class).
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
arrayType(Class<T>) — the Class object representing the desired array type.
-
- Returns: an array of the specified type containing the split and converted results.
-
Throws:
-
java.lang.IllegalArgumentException— if arrayType is {@code null} or not an array type.
-
-
Signature:
public void splitToArray(final CharSequence source, final String[] output) throws IllegalArgumentException - Summary: Splits the specified CharSequence using this Splitter's configuration and populates the provided String array with the results.
-
Contract:
- If the array is larger than the number of split results, remaining elements are left unchanged.
- If the array is smaller than the number of split results, only the first array.length results are stored.
- This method is useful when you want to reuse an existing array or have pre-allocated storage.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
output(String[]) — the String array to populate with split results.
-
-
Throws:
-
java.lang.IllegalArgumentException— if output is {@code null} or empty.
-
splitToStream(...) -> Stream<String>
-
Signature:
public Stream<String> splitToStream(final CharSequence source) - Summary: Splits the specified CharSequence using this Splitter's configuration and returns the results as a Stream of strings.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} .
-
- Returns: a Stream containing the split results; returns an empty stream if source is {@code null} .
- See also: #split(CharSequence), #splitThenForEach(CharSequence, Consumer)
splitThenApply(...) -> R
-
Signature:
public <R> R splitThenApply(final CharSequence source, final Function<? super List<String>, R> converter) - Summary: Splits the specified CharSequence using this Splitter's configuration and applies the provided function to the resulting list of strings.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
converter(Function<? super List<String>, R>) — a function that transforms the list of split strings into a result.
-
- Returns: the result of applying the converter function to the split results.
- See also: #split(CharSequence), #splitThenAccept(CharSequence, Consumer)
splitThenAccept(...) -> void
-
Signature:
public void splitThenAccept(final CharSequence source, final Consumer<? super List<String>> consumer) - Summary: Splits the specified CharSequence using this Splitter's configuration and passes the resulting list of strings to the provided consumer.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
consumer(Consumer<? super List<String>>) — a consumer that processes the list of split strings.
-
- See also: #split(CharSequence), #splitThenApply(CharSequence, Function), #splitThenForEach(CharSequence, Consumer)
splitThenForEach(...) -> void
-
Signature:
@Beta public void splitThenForEach(final CharSequence source, final Consumer<? super String> action) - Summary: Splits the specified CharSequence using this Splitter's configuration and applies the provided action to each resulting substring.
-
Parameters:
-
source(CharSequence) — the CharSequence to split; may be {@code null} . -
action(Consumer<? super String>) — the Consumer to apply to each resulting substring.
-
- See also: #splitToStream(CharSequence), #splitThenAccept(CharSequence, Consumer)
Class MapSplitter (com.landawn.abacus.util.Splitter.MapSplitter)
A specialized splitter for creating maps from strings.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
defauLt(...) -> MapSplitter
-
Signature:
@Beta public static MapSplitter defauLt() - Summary: Returns a new MapSplitter instance configured with the default entry and key-value delimiters.
-
Parameters:
- (none)
- Returns: a new MapSplitter instance with default delimiters ", " and "=".
- See also: #with(CharSequence, CharSequence), Joiner#DEFAULT_DELIMITER, Joiner#DEFAULT_KEY_VALUE_DELIMITER, Joiner#defauLt()
with(...) -> MapSplitter
-
Signature:
public static MapSplitter with(final CharSequence entryDelimiter, final CharSequence keyValueDelimiter) throws IllegalArgumentException - Summary: Returns a new MapSplitter instance with the specified entry and key-value delimiters.
-
Parameters:
-
entryDelimiter(CharSequence) — the delimiter that separates entries (key-value pairs), not {@code null} or empty. -
keyValueDelimiter(CharSequence) — the delimiter that separates keys from values, not {@code null} or empty.
-
- Returns: a new MapSplitter instance with the specified delimiters.
-
Throws:
-
java.lang.IllegalArgumentException— if either delimiter is {@code null} or empty.
-
- See also: #with(Pattern, Pattern), #pattern(CharSequence, CharSequence), Splitter#with(CharSequence)
-
Signature:
public static MapSplitter with(final Pattern entryDelimiter, final Pattern keyValueDelimiter) throws IllegalArgumentException - Summary: Returns a new MapSplitter instance with the specified entry and key-value delimiter patterns.
-
Parameters:
-
entryDelimiter(Pattern) — the Pattern that separates entries (key-value pairs), not {@code null} . -
keyValueDelimiter(Pattern) — the Pattern that separates keys from values, not {@code null} .
-
- Returns: a new MapSplitter instance with the specified pattern delimiters.
-
Throws:
-
java.lang.IllegalArgumentException— if either delimiter is {@code null} , or if either pattern can match an empty string.
-
- See also: #with(CharSequence, CharSequence), #pattern(CharSequence, CharSequence), Splitter#with(Pattern)
pattern(...) -> MapSplitter
-
Signature:
public static MapSplitter pattern(final CharSequence entryDelimiterRegex, final CharSequence keyValueDelimiterRegex) throws IllegalArgumentException - Summary: Returns a new MapSplitter instance with the specified entry and key-value delimiter regular expressions.
-
Parameters:
-
entryDelimiterRegex(CharSequence) — the regular expression that separates entries, not {@code null} or empty. -
keyValueDelimiterRegex(CharSequence) — the regular expression that separates keys from values, not {@code null} or empty.
-
- Returns: a new MapSplitter instance with the compiled pattern delimiters.
-
Throws:
-
java.lang.IllegalArgumentException— if either regex is {@code null} or empty, or if the compiled patterns can match an empty string.
-
- See also: #with(Pattern, Pattern), #with(CharSequence, CharSequence), Splitter#pattern(CharSequence)
Public Instance Methods
omitEmptyStrings(...) -> MapSplitter
-
Signature:
@Deprecated public MapSplitter omitEmptyStrings(final boolean omitEmptyStrings) - Summary: Configures this MapSplitter to omit entries with empty values when the specified parameter is {@code true} .
-
Contract:
- Configures this MapSplitter to omit entries with empty values when the specified parameter is {@code true} .
-
Parameters:
-
omitEmptyStrings(boolean) — {@code true} to omit entries with empty keys and values, {@code false} to include them.
-
- Returns: this MapSplitter instance for method chaining.
-
Signature:
public MapSplitter omitEmptyStrings() - Summary: Configures this MapSplitter to omit entries with empty values.
-
Parameters:
- (none)
- Returns: this MapSplitter instance for method chaining.
- See also: #trimResults(), #stripResults()
trim(...) -> MapSplitter
-
Signature:
@Deprecated public MapSplitter trim(final boolean trim) - Summary: Configures this MapSplitter to trim spaces from both entries and key-value pairs when the specified parameter is {@code true} .
-
Contract:
- Configures this MapSplitter to trim spaces from both entries and key-value pairs when the specified parameter is {@code true} .
-
Parameters:
-
trim(boolean) — {@code true} to trim spaces, {@code false} to leave them as-is.
-
- Returns: this MapSplitter instance for method chaining.
trimResults(...) -> MapSplitter
-
Signature:
public MapSplitter trimResults() - Summary: Configures this MapSplitter to trim leading and trailing spaces from both entries and key-value pairs.
-
Parameters:
- (none)
- Returns: this MapSplitter instance for method chaining.
- See also: #stripResults(), #omitEmptyStrings()
strip(...) -> MapSplitter
-
Signature:
@Deprecated public MapSplitter strip(final boolean strip) - Summary: Configures this MapSplitter to strip all leading and trailing whitespace characters from both entries and key-value pairs when the specified parameter is {@code true} .
-
Contract:
- Configures this MapSplitter to strip all leading and trailing whitespace characters from both entries and key-value pairs when the specified parameter is {@code true} .
-
Parameters:
-
strip(boolean) — {@code true} to strip whitespace, {@code false} to leave it as-is.
-
- Returns: this MapSplitter instance for method chaining.
- See also: Character#isWhitespace(char)
stripResults(...) -> MapSplitter
-
Signature:
public MapSplitter stripResults() - Summary: Configures this MapSplitter to strip all leading and trailing whitespace characters from both entries and key-value pairs.
-
Parameters:
- (none)
- Returns: this MapSplitter instance for method chaining.
- See also: #trimResults(), #omitEmptyStrings(), Character#isWhitespace(char)
limit(...) -> MapSplitter
-
Signature:
public MapSplitter limit(final int limit) throws IllegalArgumentException - Summary: Sets the maximum number of map entries to produce when splitting.
-
Contract:
- Sets the maximum number of map entries to produce when splitting.
- <p> <b> Limit Semantics - "Up To N": </b> <ul> <li> {@code limit(N)} means: produce <b> AT MOST N </b> map entries </li> <li> If input has fewer than N pairs: returns all pairs </li> <li> If input has exactly N pairs: returns all N pairs </li> <li> If input has more than N pairs: returns first N pairs, remainder is discarded </li> </ul> <p> <b> Common Confusion: </b> <ul> <li> {@code limit(2)} does NOT mean "return 1 entry" </li> <li> {@code limit(2)} means "return up to 2 entries" </li> <li> This is consistent with {@code String.split()} limit behavior </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code MapSplitter splitter = MapSplitter.with(",", "="); // Input has more entries than limit splitter.limit(2).split("a=1,b=2,c=3,d=4") // Returns: {a=1, b=2} - exactly 2 entries // Input has exactly limit entries splitter.limit(2).split("a=1,b=2") // Returns: {a=1, b=2} - all 2 entries // Input has fewer entries than limit splitter.limit(5).split("a=1,b=2") // Returns: {a=1, b=2} - all available entries (only 2) // Input is empty splitter.limit(2).split("") // Returns: {} - empty map // Combined with other options splitter.limit(2).trimResults().omitEmptyStrings().split(" a = 1 , , b = 2 , c = 3 ") // Returns: {a=1, b=2} - 2 entries after trimming and omitting empty } </pre> <p> <b> Common Mistakes: </b> </p> <pre> {@code // DON'T: Think limit(2) returns 1 entry Map<String, String> result = splitter.limit(2).split("a=1,b=2,c=3"); assertEquals(1, result.size()); // WRONG!
-
Parameters:
-
limit(int) — the maximum number of entries to return; must be > 0.
-
- Returns: this MapSplitter for method chaining.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code limit} < = 0.
-
- See also: Splitter#limit(int)
split(...) -> Map<String, String>
-
Signature:
public Map<String, String> split(final CharSequence source) - Summary: Splits the specified CharSequence into a map of string key-value pairs using this MapSplitter's configuration.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} .
-
- Returns: a LinkedHashMap containing the parsed key-value pairs.
- See also: #split(CharSequence, Supplier), #split(CharSequence, Class, Class), #splitToImmutableMap(CharSequence), #splitToStream(CharSequence)
-
Signature:
public <M extends Map<String, String>> M split(final CharSequence source, final Supplier<? extends M> supplier) - Summary: Splits the specified CharSequence into a map of string key-value pairs using this MapSplitter's configuration and returns the results in a Map created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
supplier(Supplier<? extends M>) — a Supplier that creates a new Map instance to hold the results
-
- Returns: the Map created by the supplier, populated with the parsed key-value pairs
-
Signature:
public <K, V> Map<K, V> split(final CharSequence source, final Class<K> keyType, final Class<V> valueType) throws IllegalArgumentException - Summary: Splits the specified CharSequence into a map with keys and values converted to the specified types using this MapSplitter's configuration.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Class<K>) — the Class representing the type to convert keys to, not {@code null} -
valueType(Class<V>) — the Class representing the type to convert values to, not {@code null}
-
- Returns: a LinkedHashMap containing the parsed and converted key-value pairs
-
Throws:
-
java.lang.IllegalArgumentException— if keyType or valueType is {@code null}
-
- See also: #split(CharSequence), #split(CharSequence, Type, Type), #split(CharSequence, Class, Class, Supplier)
-
Signature:
public <K, V> Map<K, V> split(final CharSequence source, final Type<K> keyType, final Type<V> valueType) throws IllegalArgumentException - Summary: Splits the specified CharSequence into a map with keys and values converted to the specified types using the provided Type instances for conversion.
-
Contract:
- This method is useful when working with the type system directly or when Class objects are insufficient for conversion needs.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Type<K>) — the Type instance used for converting strings to keys -
valueType(Type<V>) — the Type instance used for converting strings to values
-
- Returns: a LinkedHashMap containing the parsed and converted key-value pairs
-
Throws:
-
java.lang.IllegalArgumentException— if keyType or valueType is null
-
-
Signature:
public <K, V, M extends Map<K, V>> M split(final CharSequence source, final Class<K> keyType, final Class<V> valueType, final Supplier<? extends M> supplier) - Summary: Splits the specified CharSequence into a map with keys and values converted to the specified types, and returns the results in a Map created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Class<K>) — the Class representing the type to convert keys to -
valueType(Class<V>) — the Class representing the type to convert values to -
supplier(Supplier<? extends M>) — a Supplier that creates a new Map instance to hold the results
-
- Returns: the Map created by the supplier, populated with the converted key-value pairs
-
Signature:
public <K, V, M extends Map<K, V>> M split(final CharSequence source, final Type<K> keyType, final Type<V> valueType, final Supplier<? extends M> supplier) - Summary: Splits the specified CharSequence into a map with keys and values converted using the provided Type instances, and returns the results in a Map created by the provided supplier.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Type<K>) — the Type instance used for converting strings to keys -
valueType(Type<V>) — the Type instance used for converting strings to values -
supplier(Supplier<? extends M>) — a Supplier that creates a new Map instance to hold the results
-
- Returns: the Map created by the supplier, populated with the converted key-value pairs
-
Signature:
public <M extends Map<String, String>> void split(final CharSequence source, final M output) throws IllegalArgumentException - Summary: Splits the specified CharSequence into string key-value pairs and adds them to the provided output map.
-
Contract:
- <p> Each entry must contain exactly one key-value delimiter.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
output(M) — the Map to add the parsed key-value pairs to
-
-
Throws:
-
java.lang.IllegalArgumentException— if output is {@code null} , or if any entry string cannot be properly parsed into a key-value pair
-
-
Signature:
public <K, V, M extends Map<K, V>> void split(final CharSequence source, final Class<K> keyType, final Class<V> valueType, final M output) throws IllegalArgumentException - Summary: Splits the specified CharSequence into key-value pairs, converts them to the specified types, and adds them to the provided output map.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Class<K>) — the Class representing the type to convert keys to -
valueType(Class<V>) — the Class representing the type to convert values to -
output(M) — the Map to add the converted key-value pairs to
-
-
Throws:
-
java.lang.IllegalArgumentException— if keyType, valueType, or output is {@code null} , or if any entry string cannot be properly parsed into a key-value pair
-
-
Signature:
public <K, V, M extends Map<K, V>> void split(final CharSequence source, final Type<K> keyType, final Type<V> valueType, final M output) throws IllegalArgumentException - Summary: Splits the specified CharSequence into key-value pairs, converts them using the provided Type instances, and adds them to the provided output map.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Type<K>) — the Type instance used for converting strings to keys -
valueType(Type<V>) — the Type instance used for converting strings to values -
output(M) — the Map to add the converted key-value pairs to
-
-
Throws:
-
java.lang.IllegalArgumentException— if keyType, valueType, or output is {@code null} , or if any entry string cannot be properly parsed into a key-value pair
-
splitToImmutableMap(...) -> ImmutableMap<String, String>
-
Signature:
public ImmutableMap<String, String> splitToImmutableMap(final CharSequence source) - Summary: Splits the specified CharSequence into a map of string key-value pairs and returns the results as an ImmutableMap.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null}
-
- Returns: an ImmutableMap containing the parsed key-value pairs
-
Signature:
public <K, V> ImmutableMap<K, V> splitToImmutableMap(final CharSequence source, final Class<K> keyType, final Class<V> valueType) - Summary: Splits the specified CharSequence into a map with keys and values converted to the specified types, and returns the results as an ImmutableMap.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
keyType(Class<K>) — the Class representing the type to convert keys to -
valueType(Class<V>) — the Class representing the type to convert values to
-
- Returns: an ImmutableMap containing the parsed and converted key-value pairs
splitToStream(...) -> Stream<Map.Entry<String, String>>
-
Signature:
public Stream<Map.Entry<String, String>> splitToStream(final CharSequence source) - Summary: Splits the specified CharSequence into a Stream of Map.Entry objects.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into entries; may be {@code null}
-
- Returns: a Stream of Map.Entry objects containing the parsed key-value pairs; returns an empty stream if source is {@code null}
- See also: #split(CharSequence), #splitToEntryStream(CharSequence)
splitToEntryStream(...) -> EntryStream<String, String>
-
Signature:
public EntryStream<String, String> splitToEntryStream(final CharSequence source) - Summary: Splits the specified CharSequence into an EntryStream of string key-value pairs.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into entries; may be {@code null}
-
- Returns: an EntryStream containing the parsed key-value pairs
splitThenApply(...) -> T
-
Signature:
public <T> T splitThenApply(final CharSequence source, final Function<? super Map<String, String>, T> converter) - Summary: Splits the specified CharSequence into a map and applies the provided function to transform the resulting map.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
converter(Function<? super Map<String, String>, T>) — a function that transforms the parsed map into a result
-
- Returns: the result of applying the converter function to the parsed map
- See also: #split(CharSequence), #splitThenAccept(CharSequence, Consumer)
splitThenAccept(...) -> void
-
Signature:
public void splitThenAccept(final CharSequence source, final Consumer<? super Map<String, String>> consumer) - Summary: Splits the specified CharSequence into a map and passes it to the provided consumer.
-
Parameters:
-
source(CharSequence) — the CharSequence to split into a map; may be {@code null} -
consumer(Consumer<? super Map<String, String>>) — a consumer that processes the parsed map
-
- See also: #split(CharSequence), #splitThenApply(CharSequence, Function)
Class Stopwatch (com.landawn.abacus.util.Stopwatch)
<p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
createUnstarted(...) -> Stopwatch
-
Signature:
public static Stopwatch createUnstarted() - Summary: Creates (but does not start) a new stopwatch using {@link System#nanoTime} as its time source.
-
Parameters:
- (none)
- Returns: a new stopwatch instance that is not running
-
Signature:
public static Stopwatch createUnstarted(final Ticker ticker) - Summary: Creates (but does not start) a new stopwatch, using the specified time source.
-
Contract:
- This is useful for testing or when you need to use an alternative time source.
-
Parameters:
-
ticker(Ticker) — the time source to use for measuring elapsed time
-
- Returns: a new stopwatch instance that is not running
createStarted(...) -> Stopwatch
-
Signature:
public static Stopwatch createStarted() - Summary: Creates (and starts) a new stopwatch using {@link System#nanoTime} as its time source.
-
Parameters:
- (none)
- Returns: a new stopwatch instance that is already running
-
Signature:
public static Stopwatch createStarted(final Ticker ticker) - Summary: Creates (and starts) a new stopwatch, using the specified time source.
-
Parameters:
-
ticker(Ticker) — the time source to use for measuring elapsed time
-
- Returns: a new stopwatch instance that is already running
Public Instance Methods
isRunning(...) -> boolean
-
Signature:
public boolean isRunning() - Summary: Returns {@code true} if {@link #start()} has been called on this stopwatch, and {@link #stop()} has not been called since the last call to {@code start()} .
-
Contract:
- Returns {@code true} if {@link #start()} has been called on this stopwatch, and {@link #stop()} has not been called since the last call to {@code start()} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code if (stopwatch.isRunning()) { stopwatch.stop(); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the stopwatch is currently running, {@code false} otherwise
start(...) -> Stopwatch
-
Signature:
public Stopwatch start() - Summary: Starts the stopwatch.
-
Parameters:
- (none)
- Returns: this {@code Stopwatch} instance for method chaining
- See also: #stop(), #isRunning()
stop(...) -> Stopwatch
-
Signature:
public Stopwatch stop() - Summary: Stops the stopwatch.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code stopwatch.stop(); Duration duration = stopwatch.elapsed(); // Time when stopped Thread.sleep(1000); Duration sameDuration = stopwatch.elapsed(); // Still the same time } </pre>
-
Parameters:
- (none)
- Returns: this {@code Stopwatch} instance for method chaining
- See also: #start(), #isRunning()
reset(...) -> Stopwatch
-
Signature:
public Stopwatch reset() - Summary: Sets the elapsed time for this stopwatch to zero, and places it in a stopped state.
-
Parameters:
- (none)
- Returns: this {@code Stopwatch} instance for method chaining
- See also: #start()
elapsed(...) -> long
-
Signature:
public long elapsed(final TimeUnit desiredUnit) - Summary: Returns the current elapsed time shown on this stopwatch, expressed in the desired time unit, with any fraction rounded down.
-
Parameters:
-
desiredUnit(TimeUnit) — the unit of time to express the elapsed time in
-
- Returns: the elapsed time in the specified unit, rounded down
- See also: #elapsed()
-
Signature:
public Duration elapsed() - Summary: Returns the current elapsed time shown on this stopwatch as a {@link Duration} .
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Duration elapsed = stopwatch.elapsed(); System.out.println("Elapsed: " + elapsed.toMillis() + " ms"); // Can be used with Java 8+ time APIs if (elapsed.compareTo(Duration.ofSeconds(5)) > 0) { System.out.println("Operation took more than 5 seconds"); } } </pre>
-
Parameters:
- (none)
- Returns: a {@code Duration} representing the elapsed time
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of the current elapsed time.
-
Parameters:
- (none)
- Returns: a string representation of the elapsed time with appropriate unit
Class StringWriter (com.landawn.abacus.util.StringWriter)
A high-performance string writer implementation built on StringBuilder.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public StringWriter() - Summary: Creates a new StringWriter with a default initial capacity.
-
Parameters:
- (none)
-
Signature:
public StringWriter(final int initialSize) - Summary: Creates a new StringWriter with the specified initial capacity.
-
Contract:
- This can improve performance when the approximate size of the content is known.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // If expecting approximately 1000 characters StringWriter writer = new StringWriter(1000); } </pre>
-
Parameters:
-
initialSize(int) — the initial capacity of the internal StringBuilder
-
-
Signature:
public StringWriter(final StringBuilder sb) - Summary: Creates a new StringWriter that wraps the provided StringBuilder.
-
Parameters:
-
sb(StringBuilder) — the StringBuilder to use as the internal buffer
-
stringBuilder(...) -> StringBuilder
-
Signature:
public StringBuilder stringBuilder() - Summary: Returns the underlying StringBuilder used by this writer.
-
Contract:
- This allows direct manipulation of the buffer when needed.
-
Parameters:
- (none)
- Returns: the internal StringBuilder buffer
append(...) -> StringWriter
-
Signature:
@Override public StringWriter append(final char c) - Summary: Appends a single character to this writer.
-
Parameters:
-
c(char) — the character to append
-
- Returns: this StringWriter instance for method chaining
-
Signature:
@Override public StringWriter append(final CharSequence csq) - Summary: Appends a character sequence to this writer.
-
Contract:
- If the sequence is {@code null} , the string "null" is appended.
-
Parameters:
-
csq(CharSequence) — the character sequence to append, may be null
-
- Returns: this StringWriter instance for method chaining
-
Signature:
@Override public StringWriter append(final CharSequence csq, final int start, final int end) - Summary: Appends a portion of a character sequence to this writer.
-
Contract:
- If the sequence is {@code null} , then characters are appended as if the sequence contained the four characters "null".
-
Parameters:
-
csq(CharSequence) — the character sequence to append, may be null -
start(int) — the index of the first character to append -
end(int) — the index after the last character to append
-
- Returns: this StringWriter instance for method chaining
write(...) -> void
-
Signature:
@Override public void write(final int c) - Summary: Writes a single character to this writer.
-
Parameters:
-
c(int) — the character to write (as an integer)
-
-
Signature:
@Override public void write(final char[] cbuf) - Summary: Writes an array of characters to this writer.
-
Parameters:
-
cbuf(char[]) — the character array to write
-
-
Signature:
@Override public void write(final char[] cbuf, final int off, final int len) - Summary: Writes a portion of a character array to this writer.
-
Parameters:
-
cbuf(char[]) — the character array containing data to write -
off(int) — the offset from which to start writing characters -
len(int) — the number of characters to write
-
-
Signature:
@Override public void write(final String str) - Summary: Writes a string to this writer.
-
Contract:
- If the string is {@code null} , nothing is written.
-
Parameters:
-
str(String) — the string to write
-
-
Signature:
@Override public void write(final String str, final int off, final int len) - Summary: Writes a portion of a string to this writer.
-
Parameters:
-
str(String) — the string containing data to write -
off(int) — the offset from which to start writing characters -
len(int) — the number of characters to write
-
flush(...) -> void
-
Signature:
@Override public void flush() - Summary: Flushes the writer.
-
Parameters:
- (none)
close(...) -> void
-
Signature:
@Override public void close() - Summary: Closes the writer.
-
Parameters:
- (none)
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns the current content of the buffer as a string.
-
Parameters:
- (none)
- Returns: a string containing the current buffer content
Class Strings (com.landawn.abacus.util.Strings)
A comprehensive utility class providing an extensive collection of static methods for string operations, manipulations, validations, and transformations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
uuid(...) -> String
-
Signature:
public static String uuid() - Summary: Generates a new universally unique identifier (UUID) string.
-
Parameters:
- (none)
- Returns: a new UUID string in the standard format (8-4-4-4-12).
- See also: #uuidWithoutHyphens(), UUID#randomUUID()
uuidWithoutHyphens(...) -> String
-
Signature:
public static String uuidWithoutHyphens() - Summary: Generates a new universally unique identifier (UUID) string without hyphens.
-
Parameters:
- (none)
- Returns: a new UUID string without hyphens, consisting of 32 hexadecimal characters.
- See also: #uuid(), UUID#randomUUID()
valueOf(...) -> String
-
Signature:
@MayReturnNull public static String valueOf(final char[] value) - Summary: Converts the provided character array into a String.
-
Contract:
- If the input array is {@code null} , the method returns {@code null} rather than throwing a NullPointerException.
-
Parameters:
-
value(char[]) — the character array to be converted, may be {@code null}
-
- Returns: a String representation of the character array. Returns {@code null} if <i> value </i> is {@code null} .
- See also: String#valueOf(char\[\]), N#toString(Object)
isValidJavaIdentifier(...) -> boolean
-
Signature:
public static boolean isValidJavaIdentifier(final CharSequence cs) - Summary: Checks if the given CharSequence is a valid Java identifier.
-
Contract:
- Checks if the given CharSequence is a valid Java identifier.
- <p> A valid Java identifier must start with a letter, a currency character ($), or a connecting character such as underscore (_).
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is a valid Java identifier, {@code false} otherwise.
- See also: Character#isJavaIdentifierStart(char), Character#isJavaIdentifierPart(char), <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8">,Java Language Specification - Identifiers,</a>
isKeyword(...) -> boolean
-
Signature:
public static boolean isKeyword(final CharSequence cs) - Summary: Checks if the given CharSequence is a Java keyword.
-
Contract:
- Checks if the given CharSequence is a Java keyword.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is a Java keyword, {@code false} otherwise.
- See also: javax.lang.model.SourceVersion#isKeyword(CharSequence)
isValidEmailAddress(...) -> boolean
-
Signature:
public static boolean isValidEmailAddress(final CharSequence cs) - Summary: Checks if the given CharSequence is a valid email address.
-
Contract:
- Checks if the given CharSequence is a valid email address.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is a valid email address, {@code false} otherwise.
- See also: #findFirstEmailAddress(CharSequence), #findAllEmailAddresses(CharSequence)
isValidUrl(...) -> boolean
-
Signature:
public static boolean isValidUrl(final CharSequence cs) - Summary: Checks if the given CharSequence is a valid URL.
-
Contract:
- Checks if the given CharSequence is a valid URL.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is a valid URL, {@code false} otherwise.
isValidHttpUrl(...) -> boolean
-
Signature:
public static boolean isValidHttpUrl(final CharSequence cs) - Summary: Checks if the given CharSequence is a valid HTTP URL.
-
Contract:
- Checks if the given CharSequence is a valid HTTP URL.
- The URL must start with http:// or https://.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is a valid HTTP URL, {@code false} otherwise.
isEmpty(...) -> boolean
-
Signature:
public static boolean isEmpty(final CharSequence cs) - Summary: Checks if the specified {@code CharSequence} is {@code null} or empty.
-
Contract:
- Checks if the specified {@code CharSequence} is {@code null} or empty.
- <p> A CharSequence is considered empty if it has zero length.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if the CharSequence is {@code null} or has zero length, {@code false} otherwise.
isBlank(...) -> boolean
-
Signature:
public static boolean isBlank(final CharSequence cs) - Summary: Checks if the given CharSequence is {@code null} or contains only whitespace characters.
-
Contract:
- Checks if the given CharSequence is {@code null} or contains only whitespace characters.
- <p> A CharSequence is considered blank if it is {@code null} , empty, or contains only whitespace characters as defined by {@link Character#isWhitespace(char)} .
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence is {@code null} or contains only whitespace characters, {@code false} otherwise.
isNotEmpty(...) -> boolean
-
Signature:
public static boolean isNotEmpty(final CharSequence cs) - Summary: Checks if the given CharSequence is not {@code null} and not empty.
-
Contract:
- Checks if the given CharSequence is not {@code null} and not empty.
- It returns {@code true} when the CharSequence is not {@code null} and has at least one character.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if the CharSequence is not {@code null} and not empty, {@code false} otherwise.
isNotBlank(...) -> boolean
-
Signature:
@Beta public static boolean isNotBlank(final CharSequence cs) - Summary: Checks if the given CharSequence is not {@code null} and contains non-whitespace characters.
-
Contract:
- Checks if the given CharSequence is not {@code null} and contains non-whitespace characters.
- It returns {@code true} when the CharSequence is not {@code null} and contains at least one non-whitespace character.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if the CharSequence is not {@code null} and contains non-whitespace characters, {@code false} otherwise.
isAllEmpty(...) -> boolean
-
Signature:
public static boolean isAllEmpty(final CharSequence a, final CharSequence b) - Summary: Checks if both of the provided CharSequences are empty or {@code null} .
-
Contract:
- Checks if both of the provided CharSequences are empty or {@code null} .
- <p> This method returns {@code true} only when both CharSequences are either {@code null} or empty.
- If at least one CharSequence is not empty, the method returns {@code false} .
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if both CharSequences are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAllEmpty(CharSequence, CharSequence, CharSequence), #isAllEmpty(CharSequence...), #isAnyEmpty(CharSequence, CharSequence)
-
Signature:
public static boolean isAllEmpty(final CharSequence a, final CharSequence b, final CharSequence c) - Summary: Checks if all the provided CharSequences are empty or {@code null} .
-
Contract:
- Checks if all the provided CharSequences are empty or {@code null} .
- <p> This method returns {@code true} only when all three CharSequences are either {@code null} or empty.
- If at least one CharSequence is not empty, the method returns {@code false} .
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null} -
c(CharSequence) — the third CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if all CharSequences are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAllEmpty(CharSequence, CharSequence), #isAllEmpty(CharSequence...), #isAnyEmpty(CharSequence, CharSequence, CharSequence)
-
Signature:
public static boolean isAllEmpty(final CharSequence... css) - Summary: Checks if all the CharSequences are empty or {@code null} .
-
Contract:
- Checks if all the CharSequences are empty or {@code null} .
- <p> This method returns {@code true} only when all provided CharSequences are either {@code null} or empty.
- If the input array itself is {@code null} or empty, the method returns {@code true} .
- If at least one CharSequence is not empty, the method returns {@code false} .
-
Parameters:
-
css(CharSequence[]) — the CharSequences to check, may be {@code null} or empty
-
- Returns: {@code true} if all the CharSequences are empty or null
- See also: #isEmpty(CharSequence), #isAllEmpty(CharSequence, CharSequence), #isAllEmpty(Iterable), #isAnyEmpty(CharSequence...)
-
Signature:
public static boolean isAllEmpty(final Iterable<? extends CharSequence> css) - Summary: Checks if all the provided CharSequences in the Iterable are empty or {@code null} .
-
Contract:
- Checks if all the provided CharSequences in the Iterable are empty or {@code null} .
- <p> This method returns {@code true} only when all CharSequences in the Iterable are either {@code null} or empty.
- If the Iterable itself is {@code null} or empty, the method returns {@code true} .
- If at least one CharSequence is not empty, the method returns {@code false} .
-
Parameters:
-
css(Iterable<? extends CharSequence>) — the Iterable of CharSequences to be checked, may be {@code null}
-
- Returns: {@code true} if all CharSequences in the Iterable are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAllEmpty(CharSequence...), #isAnyEmpty(Iterable)
isAllBlank(...) -> boolean
-
Signature:
public static boolean isAllBlank(final CharSequence a, final CharSequence b) - Summary: Checks if both of the provided CharSequences are blank or {@code null} .
-
Contract:
- Checks if both of the provided CharSequences are blank or {@code null} .
- <p> This method returns {@code true} only when both CharSequences are either {@code null} , empty, or contain only whitespace.
- If at least one CharSequence contains non-whitespace characters, the method returns {@code false} .
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if both CharSequences are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAllBlank(CharSequence, CharSequence, CharSequence), #isAllBlank(CharSequence...), #isAnyBlank(CharSequence, CharSequence)
-
Signature:
public static boolean isAllBlank(final CharSequence a, final CharSequence b, final CharSequence c) - Summary: Checks if all the provided CharSequences are blank or {@code null} .
-
Contract:
- Checks if all the provided CharSequences are blank or {@code null} .
- <p> This method returns {@code true} only when all three CharSequences are either {@code null} , empty, or contain only whitespace.
- If at least one CharSequence contains non-whitespace characters, the method returns {@code false} .
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null} -
c(CharSequence) — the third CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if all CharSequences are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAllBlank(CharSequence, CharSequence), #isAllBlank(CharSequence...), #isAnyBlank(CharSequence, CharSequence, CharSequence)
-
Signature:
public static boolean isAllBlank(final CharSequence... css) - Summary: Checks if all the CharSequences are blank or {@code null} .
-
Contract:
- Checks if all the CharSequences are blank or {@code null} .
- </p> <p> This method returns {@code true} only when all provided CharSequences are either {@code null} , empty, or contain only whitespace.
- If the input array itself is {@code null} or empty, the method returns {@code true} .
- If at least one CharSequence contains non-whitespace characters, the method returns {@code false} .
-
Parameters:
-
css(CharSequence[]) — the CharSequences to check, may be {@code null} or empty
-
- Returns: {@code true} if all the CharSequences are empty or {@code null} or whitespace only
- See also: #isBlank(CharSequence), #isAllBlank(CharSequence, CharSequence), #isAllBlank(Iterable), #isAnyBlank(CharSequence...)
-
Signature:
public static boolean isAllBlank(final Iterable<? extends CharSequence> css) - Summary: Checks if all the provided CharSequences in the Iterable are blank or {@code null} .
-
Contract:
- Checks if all the provided CharSequences in the Iterable are blank or {@code null} .
- <p> This method returns {@code true} only when all CharSequences in the Iterable are either {@code null} , empty, or contain only whitespace.
- If the Iterable itself is {@code null} or empty, the method returns {@code true} .
- If at least one CharSequence contains non-whitespace characters, the method returns {@code false} .
-
Parameters:
-
css(Iterable<? extends CharSequence>) — the Iterable of CharSequences to be checked, may be {@code null}
-
- Returns: {@code true} if all CharSequences in the Iterable are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAllBlank(CharSequence...), #isAnyBlank(Iterable)
isAnyEmpty(...) -> boolean
-
Signature:
public static boolean isAnyEmpty(final CharSequence a, final CharSequence b) - Summary: Checks if any of the provided CharSequences are empty or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences are empty or {@code null} .
- <p> This method returns {@code true} if at least one of the two CharSequences is either {@code null} or empty.
- It returns {@code false} only when both CharSequences are not empty.
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if any of the CharSequences are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAnyEmpty(CharSequence, CharSequence, CharSequence), #isAnyEmpty(CharSequence...), #isAllEmpty(CharSequence, CharSequence)
-
Signature:
public static boolean isAnyEmpty(final CharSequence a, final CharSequence b, final CharSequence c) - Summary: Checks if any of the provided CharSequences are empty or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences are empty or {@code null} .
- <p> This method returns {@code true} if at least one of the three CharSequences is either {@code null} or empty.
- It returns {@code false} only when all CharSequences are not empty.
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null} -
c(CharSequence) — the third CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if any of the CharSequences are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAnyEmpty(CharSequence, CharSequence), #isAnyEmpty(CharSequence...), #isAllEmpty(CharSequence, CharSequence, CharSequence)
-
Signature:
public static boolean isAnyEmpty(final CharSequence... css) - Summary: Checks if any of the CharSequences are empty or {@code null} .
-
Contract:
- Checks if any of the CharSequences are empty or {@code null} .
- <p> This method returns {@code true} if at least one of the provided CharSequences is either {@code null} or empty.
- If the input array itself is {@code null} or has zero length, the method returns {@code false} .
- It returns {@code false} only when all CharSequences in the array are not empty.
-
Parameters:
-
css(CharSequence[]) — the CharSequences to check, may be {@code null} or empty
-
- Returns: {@code true} if any of the CharSequences are empty or null
- See also: #isEmpty(CharSequence), #isAnyEmpty(CharSequence, CharSequence), #isAnyEmpty(Iterable), #isAllEmpty(CharSequence...)
-
Signature:
public static boolean isAnyEmpty(final Iterable<? extends CharSequence> css) - Summary: Checks if any of the provided CharSequences in the Iterable are empty or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences in the Iterable are empty or {@code null} .
- <p> This method returns {@code true} if at least one CharSequence in the Iterable is either {@code null} or empty.
- If the Iterable itself is {@code null} or empty, the method returns {@code false} .
- It returns {@code false} only when all CharSequences in the Iterable are not empty.
-
Parameters:
-
css(Iterable<? extends CharSequence>) — the Iterable of CharSequences to be checked, may be {@code null}
-
- Returns: {@code true} if any CharSequences in the Iterable are {@code null} or empty, {@code false} otherwise.
- See also: #isEmpty(CharSequence), #isAnyEmpty(CharSequence...), #isAllEmpty(Iterable)
isAnyBlank(...) -> boolean
-
Signature:
public static boolean isAnyBlank(final CharSequence a, final CharSequence b) - Summary: Checks if any of the provided CharSequences are blank or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences are blank or {@code null} .
- <p> This method returns {@code true} if at least one of the two CharSequences is either {@code null} , empty, or contains only whitespace.
- It returns {@code false} only when both CharSequences contain non-whitespace characters.
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if any of the CharSequences are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAnyBlank(CharSequence, CharSequence, CharSequence), #isAnyBlank(CharSequence...), #isAllBlank(CharSequence, CharSequence)
-
Signature:
public static boolean isAnyBlank(final CharSequence a, final CharSequence b, final CharSequence c) - Summary: Checks if any of the provided CharSequences are blank or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences are blank or {@code null} .
- <p> This method returns {@code true} if at least one of the three CharSequences is either {@code null} , empty, or contains only whitespace.
- It returns {@code false} only when all CharSequences contain non-whitespace characters.
-
Parameters:
-
a(CharSequence) — the first CharSequence to be checked, may be {@code null} -
b(CharSequence) — the second CharSequence to be checked, may be {@code null} -
c(CharSequence) — the third CharSequence to be checked, may be {@code null}
-
- Returns: {@code true} if any of the CharSequences are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAnyBlank(CharSequence, CharSequence), #isAnyBlank(CharSequence...), #isAllBlank(CharSequence, CharSequence, CharSequence)
-
Signature:
public static boolean isAnyBlank(final CharSequence... css) - Summary: Checks if any of the CharSequences are blank or {@code null} .
-
Contract:
- Checks if any of the CharSequences are blank or {@code null} .
- </p> <p> This method returns {@code true} if at least one of the provided CharSequences is either {@code null} , empty, or contains only whitespace.
- If the input array itself is {@code null} or has zero length, the method returns {@code false} .
- It returns {@code false} only when all CharSequences in the array contain non-whitespace characters.
-
Parameters:
-
css(CharSequence[]) — the CharSequences to check, may be {@code null} or empty
-
- Returns: {@code true} if any of the CharSequences are empty or {@code null} or whitespace only
- See also: #isBlank(CharSequence), #isAnyBlank(CharSequence, CharSequence), #isAnyBlank(Iterable), #isAllBlank(CharSequence...)
-
Signature:
public static boolean isAnyBlank(final Iterable<? extends CharSequence> css) - Summary: Checks if any of the provided CharSequences in the Iterable are blank or {@code null} .
-
Contract:
- Checks if any of the provided CharSequences in the Iterable are blank or {@code null} .
- <p> This method returns {@code true} if at least one CharSequence in the Iterable is either {@code null} , empty, or contains only whitespace.
- If the Iterable itself is {@code null} or empty, the method returns {@code false} .
- It returns {@code false} only when all CharSequences in the Iterable contain non-whitespace characters.
-
Parameters:
-
css(Iterable<? extends CharSequence>) — the Iterable of CharSequences to be checked, may be {@code null}
-
- Returns: {@code true} if any CharSequences in the Iterable are {@code null} or blank, {@code false} otherwise.
- See also: #isBlank(CharSequence), #isAnyBlank(CharSequence...), #isAllBlank(Iterable)
isWrappedWith(...) -> boolean
-
Signature:
public static boolean isWrappedWith(final String str, final String prefixSuffix) throws IllegalArgumentException - Summary: Checks if the input string is wrapped with the specified prefix and suffix string.
-
Contract:
- Checks if the input string is wrapped with the specified prefix and suffix string.
-
Parameters:
-
str(String) — the input string to be checked, may be {@code null} or empty -
prefixSuffix(String) — the string that should be the prefix and suffix of the input string.
-
- Returns: {@code true} if the input string starts and ends with the prefixSuffix string, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if prefixSuffix is empty.
-
- See also: #isWrappedWith(String, String, String)
-
Signature:
public static boolean isWrappedWith(final String str, final String prefix, final String suffix) throws IllegalArgumentException - Summary: Checks if the input string is wrapped with the specified prefix and suffix string.
-
Contract:
- Checks if the input string is wrapped with the specified prefix and suffix string.
-
Parameters:
-
str(String) — the input string to be checked, may be {@code null} or empty -
prefix(String) — the string that should be the prefix of the input string. -
suffix(String) — the string that should be the suffix of the input string.
-
- Returns: {@code true} if the input string starts with the prefix and ends with the suffix, {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if prefix or suffix is empty.
-
- See also: #isWrappedWith(String, String)
defaultIfNull(...) -> T
-
Signature:
public static <T extends CharSequence> T defaultIfNull(final T str, final T defaultValue) throws IllegalArgumentException - Summary: Returns the specified default value if the given {@code charSequence} is {@code null} , otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the specified default value if the given {@code charSequence} is {@code null} , otherwise returns the {@code charSequence} itself.
- The default value must not be {@code null} .
-
Parameters:
-
str(T) — the {@code charSequence} to check for {@code null} -
defaultValue(T) — the default value to return if {@code str} is {@code null}
-
- Returns: {@code str} if it is not {@code null} , otherwise {@code defaultValue}
-
Throws:
-
java.lang.IllegalArgumentException— if the specified default value is {@code null} .
-
- See also: #defaultIfNull(CharSequence, Supplier), #defaultIfEmpty(CharSequence, CharSequence), #defaultIfBlank(CharSequence, CharSequence), N#defaultIfNull(Object, Object)
-
Signature:
public static <T extends CharSequence> T defaultIfNull(final T str, final Supplier<? extends T> defaultValueSupplier) throws IllegalArgumentException - Summary: Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is {@code null} , otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is {@code null} , otherwise returns the {@code charSequence} itself.
- The supplier is only invoked if the input CharSequence is {@code null} .
-
Parameters:
-
str(T) — the {@code charSequence} to check for {@code null} -
defaultValueSupplier(Supplier<? extends T>) — the supplier that provides the default value if {@code str} is {@code null}
-
- Returns: {@code str} if it is not {@code null} , otherwise the value provided by {@code defaultValueSupplier}
-
Throws:
-
java.lang.IllegalArgumentException— if default value provided by specified {@code Supplier} is {@code null} when the specified {@code charSequence} is {@code null} .
-
- See also: #defaultIfNull(CharSequence, CharSequence), #defaultIfEmpty(CharSequence, Supplier), #defaultIfBlank(CharSequence, Supplier), N#defaultIfNull(Object, Supplier)
defaultIfEmpty(...) -> T
-
Signature:
public static <T extends CharSequence> T defaultIfEmpty(final T str, final T defaultValue) throws IllegalArgumentException - Summary: Returns the specified default value if the specified {@code charSequence} is empty, otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the specified default value if the specified {@code charSequence} is empty, otherwise returns the {@code charSequence} itself.
- <p> This method considers a CharSequence empty if it is {@code null} or has zero length.
- The default value must not be empty.
-
Parameters:
-
str(T) — the {@code charSequence} to check for emptiness -
defaultValue(T) — the default value to return if {@code str} is empty
-
- Returns: {@code str} if it is not empty, otherwise {@code defaultValue}
-
Throws:
-
java.lang.IllegalArgumentException— if the specified default charSequence value is empty.
-
- See also: #defaultIfEmpty(CharSequence, Supplier), #defaultIfNull(CharSequence, CharSequence), #defaultIfBlank(CharSequence, CharSequence), #firstNonEmpty(String, String), N#defaultIfEmpty(CharSequence, CharSequence)
-
Signature:
public static <T extends CharSequence> T defaultIfEmpty(final T str, final Supplier<? extends T> defaultValueSupplier) - Summary: Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is empty, otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is empty, otherwise returns the {@code charSequence} itself.
- <p> This method considers a CharSequence empty if it is {@code null} or has zero length.
- The supplier is only invoked if the input CharSequence is empty.
-
Parameters:
-
str(T) — the {@code charSequence} to check for emptiness -
defaultValueSupplier(Supplier<? extends T>) — the supplier that provides the default value if {@code str} is empty
-
- Returns: {@code str} if it is not empty, otherwise the value provided by {@code defaultValueSupplier}
- See also: #defaultIfEmpty(CharSequence, CharSequence), #defaultIfNull(CharSequence, Supplier), #defaultIfBlank(CharSequence, Supplier), #firstNonEmpty(String, String), N#defaultIfEmpty(CharSequence, Supplier)
defaultIfBlank(...) -> T
-
Signature:
public static <T extends CharSequence> T defaultIfBlank(final T str, final T defaultValue) throws IllegalArgumentException - Summary: Returns the specified default value if the specified {@code charSequence} is blank, otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the specified default value if the specified {@code charSequence} is blank, otherwise returns the {@code charSequence} itself.
- <p> This method considers a CharSequence blank if it is {@code null} , empty, or contains only whitespace characters.
- The default value must not be blank.
-
Parameters:
-
str(T) — the {@code charSequence} to check for blankness -
defaultValue(T) — the default value to return if {@code str} is blank
-
- Returns: {@code str} if it is not blank, otherwise {@code defaultValue}
-
Throws:
-
java.lang.IllegalArgumentException— if the specified default charSequence value is blank.
-
- See also: #defaultIfBlank(CharSequence, Supplier), #defaultIfNull(CharSequence, CharSequence), #defaultIfEmpty(CharSequence, CharSequence), #firstNonBlank(String, String), N#defaultIfBlank(CharSequence, CharSequence)
-
Signature:
public static <T extends CharSequence> T defaultIfBlank(final T str, final Supplier<? extends T> defaultValueSupplier) - Summary: Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is blank, otherwise returns the {@code charSequence} itself.
-
Contract:
- Returns the default value provided by specified {@code Supplier} if the specified {@code charSequence} is blank, otherwise returns the {@code charSequence} itself.
- <p> This method considers a CharSequence blank if it is {@code null} , empty, or contains only whitespace characters.
- The supplier is only invoked if the input CharSequence is blank.
-
Parameters:
-
str(T) — the {@code charSequence} to check for blankness -
defaultValueSupplier(Supplier<? extends T>) — the supplier that provides the default value if {@code str} is blank
-
- Returns: {@code str} if it is not blank, otherwise the value provided by {@code defaultValueSupplier}
- See also: #defaultIfBlank(CharSequence, CharSequence), #defaultIfNull(CharSequence, Supplier), #defaultIfEmpty(CharSequence, Supplier), #firstNonBlank(String, String), N#defaultIfBlank(CharSequence, Supplier)
firstNonEmpty(...) -> String
-
Signature:
public static String firstNonEmpty(final String a, final String b) - Summary: Returns the first non-empty String from the given two Strings.
-
Contract:
- A string is considered empty if it is {@code null} or has zero length.
- If both strings are empty, an empty string ("") is returned.
-
Parameters:
-
a(String) — the first String to be checked, may be {@code null} or empty -
b(String) — the second String to be checked, may be {@code null} or empty
-
- Returns: the first non-empty String from the given two Strings. If both are empty, returns an empty string {@code ""} .
- See also: #firstNonEmpty(String, String, String), #firstNonEmpty(String...), #firstNonBlank(String, String), N#firstNonEmpty(CharSequence, CharSequence)
-
Signature:
public static String firstNonEmpty(final String a, final String b, final String c) - Summary: Returns the first non-empty String from the given three Strings.
-
Contract:
- A string is considered empty if it is {@code null} or has zero length.
- If all strings are empty, an empty string ("") is returned.
-
Parameters:
-
a(String) — the first String to be checked, may be {@code null} or empty -
b(String) — the second String to be checked, may be {@code null} or empty -
c(String) — the third String to be checked, may be {@code null} or empty
-
- Returns: the first non-empty String from the given three Strings. If all are empty, returns an empty string {@code ""} .
- See also: #firstNonEmpty(String, String), #firstNonEmpty(String...), #firstNonBlank(String, String, String), N#firstNonEmpty(CharSequence, CharSequence, CharSequence)
-
Signature:
public static String firstNonEmpty(final String... css) - Summary: Returns the first non-empty String from the given array of Strings.
-
Contract:
- A string is considered empty if it is {@code null} or has zero length.
- If all values are empty or the array is {@code null} or empty, an empty string ("") is returned.
-
Parameters:
-
css(String[]) — the values to test, may be {@code null} or empty
-
- Returns: the first non-empty String from the given array. If all Strings are empty or the array is {@code null} , returns an empty string {@code ""} .
- See also: #firstNonEmpty(String, String), #firstNonEmpty(Iterable), #firstNonBlank(String...), N#firstNonEmpty(CharSequence...)
-
Signature:
public static String firstNonEmpty(final Iterable<String> css) - Summary: Returns the first non-empty String from the given Iterable of Strings.
-
Contract:
- A string is considered empty if it is {@code null} or has zero length.
- If all strings are empty or the Iterable is {@code null} or empty, an empty string ("") is returned.
-
Parameters:
-
css(Iterable<String>) — the Iterable of Strings to be checked, may be {@code null}
-
- Returns: the first non-empty String from the given Iterable. If all Strings are empty or the Iterable is {@code null} , returns an empty string {@code ""} .
- See also: #firstNonEmpty(String...), #firstNonBlank(Iterable), N#firstNonEmpty(Iterable)
firstNonBlank(...) -> String
-
Signature:
public static String firstNonBlank(final String a, final String b) - Summary: Returns the first non-blank String from the given two Strings.
-
Contract:
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
- If both strings are blank, an empty string ("") is returned.
-
Parameters:
-
a(String) — the first String to be checked, may be {@code null} or empty -
b(String) — the second String to be checked, may be {@code null} or empty
-
- Returns: the first non-blank String from the given two Strings. If both are blank, returns an empty string {@code ""} .
- See also: #firstNonBlank(String, String, String), #firstNonBlank(String...), #firstNonEmpty(String, String), N#firstNonBlank(CharSequence, CharSequence)
-
Signature:
public static String firstNonBlank(final String a, final String b, final String c) - Summary: Returns the first non-blank String from the given three Strings.
-
Contract:
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
- If all strings are blank, an empty string ("") is returned.
-
Parameters:
-
a(String) — the first String to be checked, may be {@code null} or empty -
b(String) — the second String to be checked, may be {@code null} or empty -
c(String) — the third String to be checked, may be {@code null} or empty
-
- Returns: the first non-blank String from the given three Strings. If all are blank, returns an empty string {@code ""} .
- See also: #firstNonBlank(String, String), #firstNonBlank(String...), #firstNonEmpty(String, String, String), N#firstNonBlank(CharSequence, CharSequence, CharSequence)
-
Signature:
public static String firstNonBlank(final String... css) - Summary: Returns the first non-blank String from the given Strings.
-
Contract:
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
- If all strings are blank or the array is {@code null} or empty, an empty string ("") is returned.
-
Parameters:
-
css(String[]) — the Strings to be checked. They can be {@code null} or empty.
-
- Returns: the first non-blank String from the given Strings. If all are blank, returns an empty string {@code ""} .
- See also: #firstNonBlank(String, String), #firstNonBlank(Iterable), #firstNonEmpty(String...), N#firstNonBlank(CharSequence...)
-
Signature:
public static String firstNonBlank(final Iterable<String> css) - Summary: Returns the first non-blank String from the given Iterable of Strings.
-
Contract:
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
- If all strings are blank or the Iterable is {@code null} or empty, an empty string ("") is returned.
-
Parameters:
-
css(Iterable<String>) — the Iterable of Strings to be checked, may be {@code null}
-
- Returns: the first non-blank String from the given Iterable. If all Strings are blank or the Iterable is {@code null} , returns an empty string {@code ""} .
- See also: #firstNonBlank(String...), #firstNonEmpty(Iterable), N#firstNonBlank(Iterable)
nullToEmpty(...) -> String
-
Signature:
public static String nullToEmpty(final String str) - Summary: Converts the specified String to an empty String {@code ""} if it's {@code null} , otherwise returns the original string.
-
Contract:
- Converts the specified String to an empty String {@code ""} if it's {@code null} , otherwise returns the original string.
-
Parameters:
-
str(String) — the input string to be checked, may be {@code null}
-
- Returns: an empty string if the input string is {@code null} , otherwise the original string.
- See also: N#nullToEmpty(String)
-
Signature:
public static void nullToEmpty(final String[] strs) - Summary: Converts each {@code null} String element in the specified String array to an empty String {@code ""} .
-
Contract:
- Do nothing if the input array is {@code null} or empty.
-
Parameters:
-
strs(String[]) — the input string array to be checked. Each {@code null} element in the array will be converted to an empty string, may be {@code null} or empty
-
- See also: N#nullToEmpty(String\[\]), N#nullElementsToEmpty(String\[\])
emptyToNull(...) -> T
-
Signature:
public static <T extends CharSequence> T emptyToNull(final T str) - Summary: Converts the specified String to {@code null} if it's empty, otherwise returns the original string.
-
Contract:
- Converts the specified String to {@code null} if it's empty, otherwise returns the original string.
- <p> This method considers a string empty if it has zero length.
-
Parameters:
-
str(T) — the input string to be checked, may be {@code null} or empty
-
- Returns: {@code null} if the input string is empty, otherwise the original string.
-
Signature:
public static <T extends CharSequence> void emptyToNull(final T[] strs) - Summary: Converts each empty String element in the specified String array to {@code null} .
-
Contract:
- Do nothing if the input array is {@code null} or empty.
-
Parameters:
-
strs(T[]) — the input string array to be checked. Each empty element in the array will be converted to {@code null} , may be {@code null} or empty
-
blankToEmpty(...) -> String
-
Signature:
public static String blankToEmpty(final String str) - Summary: Converts the specified String to an empty String {@code ""} if it's blank, otherwise returns the original string.
-
Contract:
- Converts the specified String to an empty String {@code ""} if it's blank, otherwise returns the original string.
- <p> This method considers a string blank if it is {@code null} , empty, or contains only whitespace characters.
-
Parameters:
-
str(String) — the input string to be checked, may be {@code null} or empty
-
- Returns: an empty string if the input string is blank, otherwise the original string.
-
Signature:
public static void blankToEmpty(final String[] strs) - Summary: Converts each blank String element in the specified String array to an empty String {@code ""} .
-
Contract:
- Do nothing if the input array is {@code null} or empty.
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
-
Parameters:
-
strs(String[]) — the input string array to be checked. Each blank element in the array will be converted to an empty string, may be {@code null} or empty
-
blankToNull(...) -> T
-
Signature:
public static <T extends CharSequence> T blankToNull(final T str) - Summary: Converts the specified String to {@code null} if it's blank, otherwise returns the original string.
-
Contract:
- Converts the specified String to {@code null} if it's blank, otherwise returns the original string.
- <p> This method considers a string blank if it is {@code null} , empty, or contains only whitespace characters.
-
Parameters:
-
str(T) — the input string to be checked, may be {@code null} or empty
-
- Returns: {@code null} if the input string is blank, otherwise the original string.
-
Signature:
public static <T extends CharSequence> void blankToNull(final T[] strs) - Summary: Converts each blank String element in the specified String array to {@code null} .
-
Contract:
- Do nothing if the input array is {@code null} or empty.
- A string is considered blank if it is {@code null} , empty, or contains only whitespace characters.
-
Parameters:
-
strs(T[]) — the input string array to be checked. Each blank element in the array will be converted to {@code null} , may be {@code null} or empty
-
abbreviate(...) -> String
-
Signature:
public static String abbreviate(final String str, final int maxWidth) - Summary: <p> Abbreviates a String using ellipses.
-
Contract:
- This will turn "Now is the time for all good men" into "Now is the time for..." </p> <p> Specifically: </p> <ul> <li> If the number of characters in {@code str} is less than or equal to {@code maxWidth} , return {@code str} .
- </li> <li> If {@code maxWidth} is less than {@code 4} , throw an {@code IllegalArgumentException} .
-
Parameters:
-
str(String) — the String to check, may be {@code null} -
maxWidth(int) — maximum length of result String, must be at least 4
-
- Returns: abbreviated String
-
Signature:
public static String abbreviate(final String str, final String abbrevMarker, final int maxWidth) - Summary: <p> Abbreviates a String using another given String as replacement marker.
-
Contract:
- This will turn "Now is the time for all good men" into "Now is the time for..." if "..." was defined as the replacement marker.
- </p> <p> Specifically: </p> <ul> <li> If the number of characters in {@code str} is less than or equal to {@code maxWidth} , return {@code str} .
- </li> <li> If {@code maxWidth} is less than {@code abbrevMarker.length + 1} , throw an {@code IllegalArgumentException} .
-
Parameters:
-
str(String) — the String to check, may be {@code null} -
abbrevMarker(String) — the String used as replacement marker -
maxWidth(int) — maximum length of result String, must be at least {@code abbrevMarker.length + 1}
-
- Returns: abbreviated String
abbreviateMiddle(...) -> String
-
Signature:
public static String abbreviateMiddle(final String str, final String middle, final int length) - Summary: <p> Abbreviates a String to the length passed, replacing the middle characters with the supplied replacement String.
-
Contract:
- </p> <p> This abbreviation only occurs if the following criteria is met: </p> <ul> <li> Neither the String for abbreviation nor the replacement String are {@code null} or empty </li> <li> The length to truncate to is less than the length of the supplied String </li> <li> The length to truncate to is greater than 0 </li> <li> The abbreviated String will have enough room for the length supplied replacement String and the first and last characters of the supplied String for abbreviation </li> </ul> <p> Otherwise, the returned String will be the same as the supplied String for abbreviation.
-
Parameters:
-
str(String) — the String to abbreviate, may be {@code null} -
middle(String) — the String to replace the middle characters with, may be {@code null} -
length(int) — the length to abbreviate {@code str} to.
-
- Returns: the abbreviated String if the above criteria is met, or the original String supplied for abbreviation.
center(...) -> String
-
Signature:
public static String center(final String str, final int size) - Summary: <p> Centers a String in a larger String of size {@code size} using the space character (' ').
-
Contract:
- </p> <p> If the size is less than the String length, the original String is returned.
-
Parameters:
-
str(String) — the String to center, may be {@code null} -
size(int) — the int size of new String
-
- Returns: centered String
-
Signature:
public static String center(String str, final int size, final char padChar) throws IllegalArgumentException - Summary: <p> Centers a String in a larger String of size {@code size} .
-
Contract:
- </p> <p> If the size is less than the String length, the String is returned.
- If the padding cannot be evenly distributed, the extra padding character is added to the right side.
-
Parameters:
-
str(String) — the String to center, may be {@code null} -
size(int) — the int size of new String. -
padChar(char) — the character to pad the new String with
-
- Returns: centered String
-
Throws:
-
java.lang.IllegalArgumentException— if size is negative
-
-
Signature:
public static String center(String str, final int minLength, String padStr) throws IllegalArgumentException - Summary: <p> Centers a String in a larger String of size {@code minLength} .
-
Contract:
- </p> <p> If the size is less than the String length, the String is returned.
- If the padding cannot be evenly distributed, the extra padding is added to the right side.
-
Parameters:
-
str(String) — the String to center, may be {@code null} -
minLength(int) — the minimum size of new String. -
padStr(String) — the String to pad the new String with, must not be {@code null} or empty
-
- Returns: centered String
-
Throws:
-
java.lang.IllegalArgumentException— if minLength is negative
-
padStart(...) -> String
-
Signature:
public static String padStart(final String str, final int minLength) - Summary: Pads the given string from the start (left) with spaces until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative.
-
- Returns: a new string that is a copy of the original string padded with leading spaces so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
-
Signature:
public static String padStart(String str, final int minLength, final char padChar) - Summary: Pads the given string from the start (left) with the specified character until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative. -
padChar(char) — the character to be used for padding.
-
- Returns: a new string that is a copy of the original string padded with the padChar so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
-
Signature:
public static String padStart(String str, final int minLength, final String padStr) - Summary: Pads the given string from the start (left) with the specified string until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
- <p> If the padding string is longer than the remaining space, only the necessary portion of the padding string is used.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative. -
padStr(String) — the string to be used for padding.
-
- Returns: a new string that is a copy of the original string padded with the padStr so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
padEnd(...) -> String
-
Signature:
public static String padEnd(final String str, final int minLength) - Summary: Pads the given string from the end (right) with spaces until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative.
-
- Returns: a new string that is a copy of the original string padded with trailing spaces so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
-
Signature:
public static String padEnd(String str, final int minLength, final char padChar) - Summary: Pads the given string from the end (right) with the specified character until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative. -
padChar(char) — the character to be used for padding.
-
- Returns: a new string that is a copy of the original string padded with the padChar so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
-
Signature:
public static String padEnd(String str, final int minLength, final String padStr) - Summary: Pads the given string from the end (right) with the specified string until the string reaches the specified minimum length.
-
Contract:
- If the length of the given string is already greater than or equal to the specified minimum length, the original string is returned.
- <p> If the padding string is longer than the remaining space, only the necessary portion of the padding string is used.
-
Parameters:
-
str(String) — the string to be padded, may be {@code null} or empty -
minLength(int) — the minimum length the string should have after padding. Must be non-negative. -
padStr(String) — the string to be used for padding. Must not be {@code null} or empty.
-
- Returns: a new string that is a copy of the original string padded with the padStr so that it reaches the specified minimum length. If the original string is already greater than or equal to the specified minimum length, the original string is returned.
repeat(...) -> String
-
Signature:
public static String repeat(final char ch, final int n) throws IllegalArgumentException - Summary: Repeats the given character a specified number of times and returns the resulting string.
-
Parameters:
-
ch(char) — the character to be repeated. -
n(int) — the number of times the character should be repeated. Must be non-negative.
-
- Returns: a string consisting of the given character repeated n times.
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative.
-
-
Signature:
public static String repeat(final char ch, final int n, final char delimiter) throws IllegalArgumentException - Summary: Repeats the given character a specified number of times, separated by a specified delimiter, and returns the resulting string.
-
Parameters:
-
ch(char) — the character to be repeated. -
n(int) — the number of times the character should be repeated. Must be non-negative. -
delimiter(char) — the character used to separate the repeated characters.
-
- Returns: a string consisting of the given character repeated n times, separated by the delimiter.
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative.
-
- See also: #repeat(char, int, char), #repeat(String, int, String)
-
Signature:
public static String repeat(final String str, final int n) throws IllegalArgumentException - Summary: Repeats the given string a specified number of times and returns the resulting string.
-
Contract:
- If the input string is {@code null} or empty, or n is 0, empty string {@code ""} is returned.
-
Parameters:
-
str(String) — the string to be repeated, may be {@code null} or empty -
n(int) — the number of times the string should be repeated. Must be non-negative.
-
- Returns: a string consisting of the given string repeated n times, an empty string {@code ""} if the input string is {@code null} or empty, or n is 0.
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative.
-
- See also: #repeat(char, int, char), #repeat(String, int, String)
-
Signature:
public static String repeat(final String str, final int n, final String delimiter) throws IllegalArgumentException - Summary: Repeats the given string a specified number of times, separated by a specified delimiter, and returns the resulting string.
-
Parameters:
-
str(String) — the string to be repeated, may be {@code null} or empty -
n(int) — the number of times the string should be repeated. Must be non-negative. -
delimiter(String) — the string used to separate the repeated strings.
-
- Returns: a string consisting of the given string repeated n times, separated by the delimiter.
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative.
-
-
Signature:
public static String repeat(String str, final int n, String delimiter, String prefix, String suffix) throws IllegalArgumentException - Summary: Repeats the given string a specified number of times, separated by a specified delimiter, and returns the resulting string.
-
Parameters:
-
str(String) — the string to be repeated, may be {@code null} or empty -
n(int) — the number of times the string should be repeated. Must be non-negative. -
delimiter(String) — the string used to separate the repeated strings. -
prefix(String) — the string to be added at the start of the resulting string. -
suffix(String) — the string to be added at the end of the resulting string.
-
- Returns: a string consisting of the prefix, the given string repeated n times separated by the delimiter, and the suffix.
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative.
-
getBytes(...) -> byte\[\]
-
Signature:
@MayReturnNull public static byte[] getBytes(final String string) - Summary: Returns the byte array returned by {@code String.getBytes()} , or {@code null} if the specified String is {@code null} .
-
Contract:
- Returns the byte array returned by {@code String.getBytes()} , or {@code null} if the specified String is {@code null} .
-
Parameters:
-
string(String) — the input string to be converted, may be {@code null}
-
- Returns: a byte array representation of the input string using the default charset, or {@code null} if the input string is {@code null} .
-
Signature:
@MayReturnNull public static byte[] getBytes(final String string, final Charset charset) - Summary: Returns the byte array returned by {@code String#getBytes(Charset)} , or {@code null} if the specified String is {@code null} .
-
Contract:
- Returns the byte array returned by {@code String#getBytes(Charset)} , or {@code null} if the specified String is {@code null} .
-
Parameters:
-
string(String) — the input string to be converted, may be {@code null} -
charset(Charset) — the charset to be used for encoding.
-
- Returns: the encoded bytes
getBytesUtf8(...) -> byte\[\]
-
Signature:
@MayReturnNull public static byte[] getBytesUtf8(final String string) - Summary: Returns the byte array returned by {@code String#getBytes(Charsets.UTF_8)} , or {@code null} if the specified String is {@code null} .
-
Contract:
- Returns the byte array returned by {@code String#getBytes(Charsets.UTF_8)} , or {@code null} if the specified String is {@code null} .
-
Parameters:
-
string(String) — the input string to be converted, may be {@code null}
-
- Returns: a byte array representation of the input string using UTF-8 encoding, or {@code null} if the input string is {@code null} .
toCharArray(...) -> char\[\]
-
Signature:
@MayReturnNull public static char[] toCharArray(final CharSequence source) - Summary: Returns the char array of the specified CharSequence, or {@code null} if the specified String is {@code null} .
-
Contract:
- Returns the char array of the specified CharSequence, or {@code null} if the specified String is {@code null} .
-
Parameters:
-
source(CharSequence) — the input CharSequence to be converted, may be {@code null}
-
- Returns: a char array representation of the input CharSequence. Returns {@code null} if the input CharSequence is {@code null} .
toCodePoints(...) -> int\[\]
-
Signature:
@MayReturnNull public static int[] toCodePoints(final CharSequence str) - Summary: <p> Converts a {@code CharSequence} into an array of code points.
-
Parameters:
-
str(CharSequence) — the character sequence to convert
-
- Returns: an array of code points representing the input CharSequence, or {@code null} if the input is {@code null} .
toLowerCase(...) -> char
-
Signature:
public static char toLowerCase(final char ch) - Summary: Converts a character to lowercase.
-
Parameters:
-
ch(char) — the character to convert to lowercase.
-
- Returns: the lowercase equivalent of the character.
- See also: Character#toLowerCase(char)
-
Signature:
public static String toLowerCase(final String str) - Summary: <p> Converts a String to lower case as per {@link String#toLowerCase()} .
-
Contract:
- For platform-independent case transformations, the method {@link #toLowerCase(String, Locale)} should be used with a specific locale (e.g., {@link Locale#ENGLISH} ).
-
Parameters:
-
str(String) — the String to lower case, may be {@code null}
-
- Returns: the lower case String, or the specified String if it's {@code null} or empty.
-
Signature:
public static String toLowerCase(final String str, final Locale locale) - Summary: <p> Converts a String to lower case as per {@link String#toLowerCase(Locale)} .
-
Parameters:
-
str(String) — the String to lower case, may be {@code null} -
locale(Locale) — the locale that defines the case transformation rules, must not be null
-
- Returns: the lower case String, or the specified String if it's {@code null} or empty.
toUpperCase(...) -> char
-
Signature:
public static char toUpperCase(final char ch) - Summary: Converts a character to uppercase.
-
Parameters:
-
ch(char) — the character to convert to uppercase.
-
- Returns: the uppercase equivalent of the character.
- See also: Character#toUpperCase(char)
-
Signature:
public static String toUpperCase(final String str) - Summary: <p> Converts a String to upper case as per {@link String#toUpperCase()} .
-
Contract:
- For platform-independent case transformations, the method {@link #toUpperCase(String, Locale)} should be used with a specific locale (e.g., {@link Locale#ENGLISH} ).
-
Parameters:
-
str(String) — the String to upper case, may be {@code null}
-
- Returns: the upper case String, or the specified String if it's {@code null} or empty.
-
Signature:
public static String toUpperCase(final String str, final Locale locale) - Summary: <p> Converts a String to upper case as per {@link String#toUpperCase(Locale)}
-
Parameters:
-
str(String) — the String to upper case, may be {@code null} -
locale(Locale) — the locale that defines the case transformation rules, must not be null
-
- Returns: the upper case String, or the specified String if it's {@code null} or empty.
toCamelCase(...) -> String
-
Signature:
public static String toCamelCase(final String str) - Summary: Converts the specified string to camel case.
-
Contract:
- </p> <p> If the input string contains no delimiters but has uppercase letters, it intelligently converts from UpperCamelCase or UPPER_CASE to camelCase.
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty
-
- Returns: a camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toCamelCase(String, char), #toUpperCamelCase(String), #toSnakeCase(String)
-
Signature:
public static String toCamelCase(final String str, final char splitChar) - Summary: Converts the specified string to camel case using a custom split character.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty -
splitChar(char) — the character used to split the input string.
-
- Returns: a camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toCamelCase(String), #toUpperCamelCase(String, char), #toSnakeCase(String)
toUpperCamelCase(...) -> String
-
Signature:
public static String toUpperCamelCase(final String str) - Summary: Converts the specified string to upper camel case.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty
-
- Returns: a upper camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toUpperCamelCase(String, char), #toCamelCase(String), #toScreamingSnakeCase(String)
-
Signature:
public static String toUpperCamelCase(final String str, final char splitChar) - Summary: Converts the specified string to upper camel case using a custom split character.
-
Contract:
- </p> <p> If the string contains no delimiter characters, only the first character is converted to uppercase.
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty -
splitChar(char) — the character used to split the input string.
-
- Returns: a upper camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toUpperCamelCase(String), #toCamelCase(String, char), #toScreamingSnakeCase(String)
toPascalCase(...) -> String
-
Signature:
@Deprecated public static String toPascalCase(final String str) - Summary: Converts the specified string to upper camel case.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty
-
- Returns: a upper camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toUpperCamelCase(String), #toUpperCamelCase(String, char)
-
Signature:
@Deprecated public static String toPascalCase(final String str, final char splitChar) - Summary: Converts the specified string to upper camel case using a custom split character.
-
Contract:
- </p> <p> If the string contains no delimiter characters, only the first character is converted to uppercase.
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty -
splitChar(char) — the character used to split the input string.
-
- Returns: a upper camel case representation of the input string. Returns the original string if it's {@code null} or empty.
- See also: #toUpperCamelCase(String), #toUpperCamelCase(String, char)
toSnakeCase(...) -> String
-
Signature:
public static String toSnakeCase(final String str) - Summary: Converts the given string to lower case with underscores.
-
Contract:
- If the input string is {@code null} or empty, it returns the input string.
-
Parameters:
-
str(String) — the input string to be converted
-
- Returns: the converted string in lower case with underscores
- See also: #toScreamingSnakeCase(String), #toCamelCase(String), #toUpperCamelCase(String)
toScreamingSnakeCase(...) -> String
-
Signature:
public static String toScreamingSnakeCase(final String str) - Summary: Converts the given string to upper case with underscores.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be converted, may be {@code null} or empty
-
- Returns: the converted string in upper case with underscores, or the original string if it is {@code null} or empty.
- See also: #toSnakeCase(String), #toCamelCase(String), #toUpperCamelCase(String)
toKebabCase(...) -> String
-
Signature:
public static String toKebabCase(final String str) - Summary: Converts the given string to lower case with hyphens.
-
Contract:
- If the input string is {@code null} or empty, it returns the input string.
-
Parameters:
-
str(String) — the input string to be converted
-
- Returns: the converted string in lower case with hyphens
- See also: #toSnakeCase(String)
swapCase(...) -> char
-
Signature:
public static char swapCase(final char ch) - Summary: Swaps the case of a character changing upper and title case to lower case, and lower case to upper case.
-
Parameters:
-
ch(char) — the input character to be case-swapped.
-
- Returns: the case-swapped representation of the input character.
- See also: #swapCase(String), Character#toLowerCase(char), Character#toUpperCase(char)
-
Signature:
public static String swapCase(final String str) - Summary: Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} .
-
Parameters:
-
str(String) — the String to swap case, may be {@code null}
-
- Returns: the case-swapped String, {@code null} if the input is {@code null}
- See also: #swapCase(char)
uncapitalize(...) -> String
-
Signature:
public static String uncapitalize(final String str) - Summary: Converts the first character of the given string to lower case.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} , empty, or already starts with a lowercase character.
-
Parameters:
-
str(String) — the string to be uncapitalized, may be {@code null} or empty
-
- Returns: a string with its first character converted to lower case, or the original string if it's {@code null} , empty, or already starts with a lowercase character.
- See also: #capitalize(String), #capitalizeFully(String)
capitalize(...) -> String
-
Signature:
public static String capitalize(final String str) - Summary: Converts the first character of the given string to upper case.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} , empty, or already starts with an uppercase character.
-
Parameters:
-
str(String) — the string to be capitalized, may be {@code null} or empty
-
- Returns: a string with its first character converted to upper case, or the original string if it's {@code null} , empty, or already starts with an uppercase character.
- See also: #uncapitalize(String), #capitalizeFully(String)
capitalizeFully(...) -> String
-
Signature:
public static String capitalizeFully(final String str) - Summary: Capitalizes all the words in the specified string split by space (' ').
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty
-
- Returns: the processed string with all words capitalized, or the original string if it's {@code null} or empty.
- See also: #capitalizeFully(String, String), #capitalize(String)
-
Signature:
public static String capitalizeFully(final String str, final String delimiter) throws IllegalArgumentException - Summary: Capitalizes all the words in the specified string split by the provided delimiter.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty -
delimiter(String) — the delimiter used to split the string into words. It must not be empty.
-
- Returns: the processed string with all words capitalized, or the original string if it's {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided delimiter is empty.
-
- See also: #capitalizeFully(String), #capitalizeFully(String, String, String...), #convertWords(String, String, Collection, Function)
-
Signature:
public static String capitalizeFully(final String str, final String delimiter, final String... excludedWords) throws IllegalArgumentException - Summary: Capitalizes all the words in the given string, split by the provided delimiter, excluding the specified words except the first word.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty If it's {@code null} or empty, the method will return the input string. -
delimiter(String) — the delimiter used to split the string into words. It must not be empty. -
excludedWords(String[]) — an array of words to be excluded from capitalization. If it's {@code null} or empty, all words will be capitalized.
-
- Returns: the processed string with all non-excluded words capitalized.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided delimiter is empty.
-
- See also: #capitalizeFully(String, String), #capitalizeFully(String, String, Collection)
-
Signature:
public static String capitalizeFully(final String str, final String delimiter, final Collection<String> excludedWords) throws IllegalArgumentException - Summary: Capitalizes all the words in the given string, split by the provided delimiter, excluding the words in the excludedWords collection except the first word.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty If it's {@code null} or empty, the method will return the input string. -
delimiter(String) — the delimiter used to split the string into words. It must not be empty. -
excludedWords(Collection<String>) — a collection of words to be excluded from capitalization. If it's {@code null} or empty, all words will be capitalized.
-
- Returns: the processed string with all non-excluded words capitalized.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided delimiter is empty.
-
- See also: #capitalizeFully(String, String), #capitalizeFully(String, String, String...), #convertWords(String, String, Collection, Function)
convertWords(...) -> String
-
Signature:
public static String convertWords(final String str, final Function<? super String, String> converter) - Summary: Converts all the words in the given string using the provided converter function.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty If it's {@code null} or empty, the method will return the input string. -
converter(Function<? super String, String>) — the function used to convert each word. This function should accept a string and return a string.
-
- Returns: the processed string with all words converted using the provided converter function.
- See also: #convertWords(String, String, Function), #convertWords(String, String, Collection, Function)
-
Signature:
public static String convertWords(final String str, final String delimiter, final Function<? super String, String> converter) throws IllegalArgumentException - Summary: Converts all the words from the specified string, split by the provided delimiter, using the provided converter function.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty If it's {@code null} or empty, the method will return the input string. -
delimiter(String) — the delimiter used to split the string into words. It must not be empty. -
converter(Function<? super String, String>) — the function used to convert each word.
-
- Returns: the processed string with all words converted using the provided converter function.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided delimiter is empty.
-
- See also: #convertWords(String, Function), #convertWords(String, String, Collection, Function)
-
Signature:
public static String convertWords(final String str, final String delimiter, final Collection<String> excludedWords, final Function<? super String, String> converter) throws IllegalArgumentException - Summary: Converts all the words from the specified string, split by the provided delimiter, using the provided converter function.
-
Contract:
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty If it's {@code null} or empty, the method will return the input string. -
delimiter(String) — the delimiter used to split the string into words. It must not be empty. -
excludedWords(Collection<String>) — a collection of words to be excluded from conversion. If it's {@code null} or empty, all words will be converted. -
converter(Function<? super String, String>) — the function used to convert each word. If a word is in the excludedWords collection, it will not be converted.
-
- Returns: the processed string with all non-excluded words converted using the provided converter function.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided delimiter is empty.
-
- See also: #convertWords(String, Function), #convertWords(String, String, Function)
quoteEscaped(...) -> String
-
Signature:
public static String quoteEscaped(final String str) - Summary: Replaces single quotes (') and double quotes (") with escaped versions (\\' and \\") if they are not already escaped.
-
Contract:
- Replaces single quotes (') and double quotes (") with escaped versions (\\' and \\") if they are not already escaped.
- If a quote is already preceded by a backslash, it will not be escaped again.
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty
-
- Returns: the string with all unescaped single and double quotes escaped, or the original string if it's {@code null} or empty.
- See also: #quoteEscaped(String, char)
-
Signature:
public static String quoteEscaped(final String str, final char quoteChar) - Summary: Escapes the specified quotation character in the given string if it is not already escaped.
-
Contract:
- Escapes the specified quotation character in the given string if it is not already escaped.
- If the quote character is already preceded by a backslash, it will not be escaped again.
- </p> <p> The method returns the original string if it is {@code null} or empty.
-
Parameters:
-
str(String) — the input string to be processed, may be {@code null} or empty -
quoteChar(char) — the quotation character to be escaped, should be either {@code "} or {@code '}
-
- Returns: the processed string with the specified quotation character escaped, or the original string if it is {@code null} or empty
- See also: #quoteEscaped(String)
unicodeEscaped(...) -> String
-
Signature:
public static String unicodeEscaped(final char ch) - Summary: Converts the char to the unicode format ' '.
-
Parameters:
-
ch(char) — the character to convert
-
- Returns: the Unicode escape sequence representation of the character
normalizeSpace(...) -> String
-
Signature:
public static String normalizeSpace(final String str) - Summary: Normalizes whitespace in a string by trimming leading and trailing whitespace and replacing sequences of whitespace characters with a single space.
-
Contract:
- </p> <p> The method returns {@code null} if the input is {@code null} , and an empty string if the input is empty or contains only whitespace.
-
Parameters:
-
str(String) — the source String to normalize whitespaces from, may be {@code null}
-
- Returns: the normalized String, {@code null} if the input is {@code null}
- See also: Pattern, #trim(String), <a href="http://www.w3.org/TR/xpath/#function-normalize-space">,http://www.w3.org/TR/xpath/#function-normalize-space,</a>
replaceAll(...) -> String
-
Signature:
public static String replaceAll(final String str, final String target, final String replacement) - Summary: Replaces all occurrences of a String within another String.
-
Parameters:
-
str(String) — text to search and replace in, may be {@code null} -
target(String) — the String to search for, may be {@code null} -
replacement(String) — the String to replace it with, may be {@code null}
-
- Returns: the text with all occurrences of the target string replaced, {@code null} if the input is {@code null}
-
Signature:
public static String replaceAll(final String str, final int fromIndex, final String target, final String replacement) - Summary: Replaces all occurrences of a target string in the input string with a replacement string, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: the text with all occurrences of the target string replaced starting from the specified index, {@code null} if the input is {@code null}
replaceFirst(...) -> String
-
Signature:
public static String replaceFirst(final String str, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: the text with the first occurrence of the target string replaced, {@code null} if the input is {@code null}
-
Signature:
public static String replaceFirst(final String str, final int fromIndex, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: the text with the first occurrence of the target string replaced starting from the specified index, {@code null} if the input is {@code null}
replaceOnce(...) -> String
-
Signature:
@Deprecated public static String replaceOnce(final String str, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} -
target(String) — the string to be replaced, may be {@code null} -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with the first occurrence of the target string replaced with the replacement string. If the input string or target string is {@code null} , the method returns the original string.
-
Signature:
@Deprecated public static String replaceOnce(final String str, final int fromIndex, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with the first occurrence of the target string replaced with the replacement string, starting from the specified index.
replaceLast(...) -> String
-
Signature:
public static String replaceLast(final String str, final String target, final String replacement) - Summary: Replaces the last occurrence of a target string in the input string with a replacement string.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the String to replace with, may be {@code null}
-
- Returns: a new string with the last occurrence of the target string replaced with the replacement string. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
-
Signature:
public static String replaceLast(final String str, final int startIndexFromBack, final String target, final String replacement) - Summary: Replaces the last occurrence of a target string in the input string with a replacement string, searching backward from a specified index.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
startIndexFromBack(int) — the index to start the search from, searching backward. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with the last occurrence of the target string replaced with the replacement string, starting from the specified index backward. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
replace(...) -> String
-
Signature:
public static String replace(final String str, final int fromIndex, final String target, final String replacement, final int max) - Summary: Replaces occurrences of a target string in the input string with a replacement string, starting from a specified index and up to a maximum number of replacements.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} -
replacement(String) — the string to replace the target string. If it's {@code null} , it will be treated as an empty string. -
max(int) — the maximum number of replacements. If it's -1, all occurrences will be replaced.
-
- Returns: a new string with occurrences of the target string replaced with the replacement string, starting from the specified index and up to the maximum number of replacements. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
-
Signature:
@Deprecated public static String replace(final String str, final int fromIndex, final int toIndex, final String replacement) throws IndexOutOfBoundsException - Summary: Replaces the substring specified by the start and end indices with the specified replacement string.
-
Parameters:
-
str(String) — the input string where the replacement should occur. It cannot be {@code null} . -
fromIndex(int) — the start index of the substring to be replaced. It should be a non-negative integer and less than the length of the input string. -
toIndex(int) — the end index of the substring to be replaced. It should be a non-negative integer, greater than the start index and less than or equal to the length of the input string. -
replacement(String) — the string to replace the substring. It cannot be {@code null} .
-
- Returns: a new string with the specified substring replaced with the replacement string.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the start or end index is out of the string bounds.
-
- See also: #replaceRange(String, int, int, String)
replaceAllIgnoreCase(...) -> String
-
Signature:
public static String replaceAllIgnoreCase(final String str, final String target, final String replacement) - Summary: Replaces all occurrences of a target string in the input string with a replacement string, ignoring case considerations.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with all occurrences of the target string replaced with the replacement string, ignoring case considerations. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
-
Signature:
public static String replaceAllIgnoreCase(final String str, final int fromIndex, final String target, final String replacement) - Summary: Replaces all occurrences of a target string in the input string with a replacement string, ignoring case considerations, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with all occurrences of the target string replaced with the replacement string, ignoring case considerations, starting from the specified index. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
replaceFirstIgnoreCase(...) -> String
-
Signature:
public static String replaceFirstIgnoreCase(final String str, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string, ignoring case considerations.
-
Contract:
- </p> <p> The method returns the original string if the target is not found or if the input/target is {@code null} or empty.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with the first occurrence of the target string replaced with the replacement string, ignoring case considerations. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
-
Signature:
public static String replaceFirstIgnoreCase(final String str, final int fromIndex, final String target, final String replacement) - Summary: Replaces the first occurrence of a target string in the input string with a replacement string, ignoring case considerations, starting from a specified index.
-
Contract:
- </p> <p> The method returns the original string if the target is not found after the specified index or if the input/target is {@code null} or empty.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null}
-
- Returns: a new string with the first occurrence of the target string replaced with the replacement string, ignoring case considerations, starting from the specified index. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
replaceIgnoreCase(...) -> String
-
Signature:
public static String replaceIgnoreCase(final String str, final int fromIndex, final String target, final String replacement, final int max) - Summary: Replaces occurrences of a target string in the input string with a replacement string, ignoring case considerations, starting from a specified index and up to a maximum number of replacements.
-
Contract:
- </p> <p> If max is -1, all occurrences will be replaced.
- If max is 0, no replacements will be made.
- If the replacement is {@code null} , it will be treated as an empty string.
-
Parameters:
-
str(String) — the input string where the replacement should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the search for the target string. It should be a non-negative integer. -
target(String) — the string to be replaced, may be {@code null} or empty -
replacement(String) — the string to replace the target string, may be {@code null} -
max(int) — the maximum number of replacements. If it's -1, all occurrences will be replaced.
-
- Returns: a new string with occurrences of the target string replaced with the replacement string, ignoring case considerations, starting from the specified index and up to the maximum number of replacements. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the target string is not found, the input string is returned unchanged.
replaceBetween(...) -> String
-
Signature:
public static String replaceBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex, final String replacement) - Summary: Replaces the substring between two specified delimiters in the given string with a replacement string.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty -
delimiterOfExclusiveBeginIndex(String) — the delimiter after which the replacement should start. -
delimiterOfExclusiveEndIndex(String) — the delimiter before which the replacement should end. -
replacement(String) — the string to replace the substring between the delimiters. If it's {@code null} , the substring between the delimiters will be removed.
-
- Returns: the processed string with the substring between the delimiters replaced with the replacement string. If the input string is {@code null} or either of the delimiters is {@code null} , the original string is returned.
- See also: #substringBetween(String, String, String)
replaceAfter(...) -> String
-
Signature:
public static String replaceAfter(final String str, final String delimiterOfExclusiveBeginIndex, final String replacement) - Summary: Replaces the substring after a specified delimiter in the given string with a replacement string.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty -
delimiterOfExclusiveBeginIndex(String) — the delimiter after which the replacement should start. -
replacement(String) — the string to replace the substring after the delimiter. If it's {@code null} , the substring after the delimiter will be removed.
-
- Returns: the processed string with the substring after the delimiter replaced with the replacement string. If the input string is {@code null} or the delimiter is {@code null} , the original string is returned.
replaceBefore(...) -> String
-
Signature:
public static String replaceBefore(final String str, final String delimiterOfExclusiveEndIndex, final String replacement) - Summary: Replaces the substring before a specified delimiter in the given string with a replacement string.
-
Parameters:
-
str(String) — the string to be processed, may be {@code null} or empty -
delimiterOfExclusiveEndIndex(String) — the delimiter before which the replacement should end. -
replacement(String) — the string to replace the substring before the delimiter. If it's {@code null} , the substring before the delimiter will be removed.
-
- Returns: the processed string with the substring before the delimiter replaced with the replacement string. If the input string is {@code null} or the delimiter is {@code null} , the original string is returned.
removeStart(...) -> String
-
Signature:
public static String removeStart(final String str, final String removeStr) - Summary: Removes a substring only if it is at the beginning of a source string, otherwise returns the source string.
-
Contract:
- Removes a substring only if it is at the beginning of a source string, otherwise returns the source string.
-
Parameters:
-
str(String) — the source String to search, may be {@code null} -
removeStr(String) — the String to search for and remove, may be {@code null}
-
- Returns: the string with the prefix removed if found, or the original string. Returns {@code null} if the input is {@code null} .
removeStartIgnoreCase(...) -> String
-
Signature:
public static String removeStartIgnoreCase(final String str, final String removeStr) - Summary: Case-insensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string.
-
Contract:
- Case-insensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string.
-
Parameters:
-
str(String) — the source String to search, may be {@code null} -
removeStr(String) — the String to search for (case insensitive) and remove, may be {@code null}
-
- Returns: the string with the prefix removed if found (ignoring case), or the original string. Returns {@code null} if the input is {@code null} .
removeEnd(...) -> String
-
Signature:
public static String removeEnd(final String str, final String removeStr) - Summary: Removes a substring only if it is at the end of a source string, otherwise returns the source string.
-
Contract:
- Removes a substring only if it is at the end of a source string, otherwise returns the source string.
-
Parameters:
-
str(String) — the source String to search, may be {@code null} -
removeStr(String) — the String to search for and remove, may be {@code null}
-
- Returns: the string with the suffix removed if found, or the original string. Returns {@code null} if the input is {@code null} .
removeEndIgnoreCase(...) -> String
-
Signature:
public static String removeEndIgnoreCase(final String str, final String removeStr) - Summary: Case-insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.
-
Contract:
- Case-insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.
-
Parameters:
-
str(String) — the source String to search, may be {@code null} -
removeStr(String) — the String to search for (case insensitive) and remove, may be {@code null}
-
- Returns: the string with the suffix removed if found (ignoring case), or the original string. Returns {@code null} if the input is {@code null} .
removeAll(...) -> String
-
Signature:
public static String removeAll(final String str, final char removeChar) - Summary: Removes all occurrences of a specified character from the input string.
-
Contract:
- If the character is not found, the original string is returned unchanged.
-
Parameters:
-
str(String) — the input string from which the character should be removed, may be {@code null} or empty -
removeChar(char) — the character to be removed.
-
- Returns: a new string with all occurrences of the specified character removed. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the character is not found, the input string is returned unchanged.
-
Signature:
public static String removeAll(final String str, final int fromIndex, final char removeChar) - Summary: Removes all occurrences of a specified character from the input string, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the removal should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the removal. It should be a non-negative integer. -
removeChar(char) — the character to be removed.
-
- Returns: a new string with all occurrences of the specified character removed, starting from the specified index. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the character is not found, the input string is returned unchanged.
-
Signature:
public static String removeAll(final String str, final String removeStr) - Summary: Removes all occurrences of a substring from within the source string.
-
Parameters:
-
str(String) — the source String to search, may be {@code null} -
removeStr(String) — the String to search for and remove, may be {@code null}
-
- Returns: the specified String if it's {@code null} or empty.
-
Signature:
public static String removeAll(final String str, final int fromIndex, final String removeStr) - Summary: Removes all occurrences of a specified string from the input string, starting from a specified index.
-
Parameters:
-
str(String) — the input string where the removal should occur, may be {@code null} or empty -
fromIndex(int) — the index from which to start the removal. It should be a non-negative integer. -
removeStr(String) — the string to be removed, may be {@code null} or empty
-
- Returns: a new string with all occurrences of the specified string removed, starting from the specified index. If the input string is {@code null} , the method returns {@code null} . If the input string is empty, or the string to be removed is not found, the input string is returned unchanged.
split(...) -> String\[\]
-
Signature:
public static String[] split(final String str, final char delimiter) - Summary: Splits the given string into an array of substrings, using the specified delimiter character.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(char) — the character used as the delimiter for splitting the string
-
- Returns: an array of substrings derived from the input string, split based on the delimiter character. If the input string is {@code null} or empty, the method will return an empty String array.
-
Signature:
public static String[] split(final String str, final char delimiter, final boolean trim) - Summary: Splits the given string into an array of substrings, using the specified delimiter character.
-
Contract:
- If the trim parameter is {@code true} , it trims leading and trailing whitespace from each substring.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(char) — the character used as the delimiter for splitting the string -
trim(boolean) — a boolean that determines whether to trim leading and trailing whitespace from each substring.
-
- Returns: an array of substrings derived from the input string, split based on the delimiter character and optionally trimmed. If the input string is {@code null} or empty, the method will return an empty String array.
-
Signature:
public static String[] split(final String str, final String delimiter) - Summary: Splits the given string into an array of substrings, using the specified delimiter string.
-
Contract:
- If delimiter is {@code null} , the string is split on whitespace.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace.
-
- Returns: an array of substrings derived from the input string, split based on the delimiter string. If the input string is {@code null} or empty, the method will return an empty String array.
-
Signature:
public static String[] split(final String str, final String delimiter, final boolean trim) - Summary: Splits the given string into an array of substrings, using the specified delimiter string.
-
Contract:
- If the trim parameter is {@code true} , it trims leading and trailing whitespace from each substring.
- If delimiter is {@code null} , the string is split on whitespace.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
trim(boolean) — a boolean that determines whether to trim leading and trailing whitespace from each substring.
-
- Returns: an array of substrings derived from the input string, split based on the delimiter string and optionally trimmed. If the input string is {@code null} or empty, the method will return an empty String array.
-
Signature:
public static String[] split(final String str, final String delimiter, final int max) throws IllegalArgumentException - Summary: Splits the given string into an array of substrings, using the specified delimiter string.
-
Contract:
- If the string contains more delimiters than max-1, the last substring will contain all remaining text including delimiters.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
max(int) — the maximum number of substrings to be included in the resulting array. If the string contains more delimiters, the last substring will contain all remaining text.
-
- Returns: an array of substrings derived from the input string, split based on the delimiter string. If the input string is {@code null} or empty, the method will return an empty String array.
-
Throws:
-
java.lang.IllegalArgumentException— if the max parameter is not a positive integer.
-
-
Signature:
public static String[] split(final String str, final String delimiter, final int max, final boolean trim) throws IllegalArgumentException - Summary: Splits the given string into an array of substrings, using the specified delimiter string.
-
Contract:
- If the trim parameter is {@code true} , it trims leading and trailing whitespace from each substring.
- If the string contains more delimiters than max-1, the last substring will contain all remaining text including delimiters.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
max(int) — the maximum number of substrings to be included in the resulting array. If the string contains more delimiters, the last substring will contain all remaining text. -
trim(boolean) — a boolean that determines whether to trim leading and trailing whitespace from each substring.
-
- Returns: an array of substrings derived from the input string, split based on the delimiter string, limited by the max parameter and optionally trimmed. If the input string is {@code null} or empty, the method will return an empty String array.
-
Throws:
-
java.lang.IllegalArgumentException— if the max parameter is not a positive integer.
-
splitPreserveAllTokens(...) -> String\[\]
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final char delimiter) - Summary: Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
-
Contract:
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(char) — the character used as the delimiter
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final char delimiter, final boolean trim) - Summary: Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
-
Contract:
- If the trim parameter is {@code true} , leading and trailing whitespace is removed from each substring.
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(char) — the character used as the delimiter -
trim(boolean) — if {@code true} , leading and trailing whitespace is removed from each substring.
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final String delimiter) - Summary: Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
-
Contract:
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace.
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final String delimiter, final boolean trim) - Summary: Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
-
Contract:
- If the trim parameter is {@code true} , leading and trailing whitespace is removed from each substring.
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
trim(boolean) — if {@code true} , leading and trailing whitespace is removed from each substring.
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final String delimiter, final int max) throws IllegalArgumentException - Summary: Splits the provided text into an array with a maximum length, separators specified, preserving all tokens.
-
Contract:
- If more than {@code max} delimited substrings are found, the last returned string includes all characters after the first {@code max - 1} returned strings (including separator characters).
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
max(int) — the maximum number of substrings to be included in the resulting array.
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the max parameter is not a positive integer.
-
-
Signature:
public static String[] splitPreserveAllTokens(final String str, final String delimiter, final int max, final boolean trim) throws IllegalArgumentException - Summary: Splits the provided text into an array with a maximum length, separators specified, preserving all tokens.
-
Contract:
- If more than {@code max} delimited substrings are found, the last returned string includes all characters after the first {@code max - 1} returned strings (including separator characters).
- If the trim parameter is {@code true} , leading and trailing whitespace is removed from each substring.
- </p> <p> An empty String array {@code \[\]} will be returned if the input string {@code null} .
- A String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Parameters:
-
str(String) — the String to parse, may be {@code null} -
delimiter(String) — the string used as the delimiter for splitting the string. {@code null} for splitting on whitespace. -
max(int) — the maximum number of substrings to be included in the resulting array. -
trim(boolean) — if {@code true} , leading and trailing whitespace is removed from each substring.
-
- Returns: an array of parsed Strings. An empty String array {@code \[\]} will be returned if the input string {@code null} , or a String array with single empty String: {@code \[""\]} will be returned if the input string is empty.
-
Throws:
-
java.lang.IllegalArgumentException— if the max parameter is not a positive integer.
-
splitToLines(...) -> String\[\]
-
Signature:
public static String[] splitToLines(final String str) - Summary: Splits the given string into an array of substrings, each of which is a line of text from the original string.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty If it's {@code null} , the method will return an empty String array.
-
- Returns: an array of substrings derived from the input string, each of which is a line of text. If the input string is {@code null} , return an empty String array. If the input string is empty, return an String array with one empty String inside.
-
Signature:
public static String[] splitToLines(final String str, final boolean trim, final boolean omitEmptyLines) - Summary: Splits the given string into an array of substrings, each of which is a line of text from the original string.
-
Contract:
- If the trim parameter is {@code true} , leading and trailing whitespace is removed from each line of text.
- If the omitEmptyLines parameter is {@code true} , empty lines (after trimming, if the trim parameter is true) are not included in the resulting array.
-
Parameters:
-
str(String) — the string to be split, may be {@code null} or empty -
trim(boolean) — a boolean that determines whether to trim leading and trailing whitespace from each line of text. -
omitEmptyLines(boolean) — a boolean that determines whether to omit empty lines from the resulting array.
-
- Returns: an array of substrings derived from the input string, each of which is a line of text, optionally trimmed and with empty lines optionally omitted. If the input string is {@code null} or {@code str.length() == 0 && omitEmptyLines} , return an empty String array. If the input string is empty, return an String array with one empty String inside.
trim(...) -> String
-
Signature:
public static String trim(final String str) - Summary: Removes space characters (char < = 32) from both ends of this String, handling {@code null} by returning {@code null} .
-
Parameters:
-
str(String) — the String to be trimmed, may be {@code null}
-
- Returns: the trimmed string, {@code null} if {@code null} String input
-
Signature:
public static void trim(final String[] strs) - Summary: Trims leading and trailing space characters from each string in the provided array.
-
Contract:
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be trimmed. Each string in the array will be updated in-place.
-
trimToNull(...) -> String
-
Signature:
@MayReturnNull public static String trimToNull(String str) - Summary: Removes space characters (char < = 32) from both ends of this String returning {@code null} if the String is empty ("") after the trim or if it is {@code null} .
-
Contract:
- Removes space characters (char < = 32) from both ends of this String returning {@code null} if the String is empty ("") after the trim or if it is {@code null} .
-
Parameters:
-
str(String) — the String to be trimmed, may be {@code null}
-
- Returns: the trimmed String, {@code null} if only spaces, empty or {@code null} String input
-
Signature:
public static void trimToNull(final String[] strs) - Summary: Trims leading and trailing whitespace from each string in the provided array and sets the string to {@code null} if it is empty after trimming.
-
Contract:
- Trims leading and trailing whitespace from each string in the provided array and sets the string to {@code null} if it is empty after trimming.
- If a string becomes empty after trimming, it is set to {@code null} .
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be trimmed. Each string in the array will be updated in-place.
-
trimToEmpty(...) -> String
-
Signature:
public static String trimToEmpty(final String str) - Summary: Removes control characters (char < = 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is {@code null} .
-
Contract:
- Removes control characters (char < = 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is {@code null} .
-
Parameters:
-
str(String) — the String to be trimmed, may be {@code null}
-
- Returns: the trimmed String, or an empty String if {@code null} input
-
Signature:
public static void trimToEmpty(final String[] strs) - Summary: Trims leading and trailing whitespace from each string in the provided array.
-
Contract:
- <p> If a string becomes {@code null} after trimming, it is set to empty string.
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be trimmed. Each string in the array will be updated in-place.
-
strip(...) -> String
-
Signature:
public static String strip(final String str) - Summary: Strips whitespace from the start and end of a String.
-
Parameters:
-
str(String) — the String to remove whitespace from, may be {@code null}
-
- Returns: the stripped String, {@code null} if {@code null} String input
-
Signature:
public static void strip(final String[] strs) - Summary: Strips whitespace from the start and end of each string in the provided array.
-
Contract:
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place.
-
-
Signature:
public static String strip(final String str, final String stripChars) - Summary: Strips any of a set of characters from the start and end of a String.
-
Contract:
- </p> <p> If the stripChars String is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
-
Parameters:
-
str(String) — the String to remove characters from, may be {@code null} -
stripChars(String) — the characters to remove, {@code null} treated as whitespace
-
- Returns: the specified String if it's {@code null} or empty.
-
Signature:
public static void strip(final String[] strs, final String stripChars) - Summary: Strips the specified characters from the start and end of each string in the provided array.
-
Contract:
- If the stripChars is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place. -
stripChars(String) — the set of characters to be stripped from the strings. If {@code null} , the method behaves as {@link #strip(String)} .
-
stripToNull(...) -> String
-
Signature:
@MayReturnNull public static String stripToNull(String str) - Summary: Strips whitespace from the start and end of a String returning {@code null} if the String is empty ("") after the strip.
-
Contract:
- Strips whitespace from the start and end of a String returning {@code null} if the String is empty ("") after the strip.
-
Parameters:
-
str(String) — the String to be stripped, may be {@code null}
-
- Returns: the stripped String, {@code null} if whitespace, empty or {@code null} String input
-
Signature:
public static void stripToNull(final String[] strs) - Summary: Strips whitespace from the start and end of each string in the provided array and sets the string to {@code null} if it is empty after stripping.
-
Contract:
- Strips whitespace from the start and end of each string in the provided array and sets the string to {@code null} if it is empty after stripping.
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place.
-
stripToEmpty(...) -> String
-
Signature:
public static String stripToEmpty(final String str) - Summary: Strips whitespace from the start and end of a String returning an empty String if {@code null} input.
-
Contract:
- Strips whitespace from the start and end of a String returning an empty String if {@code null} input.
-
Parameters:
-
str(String) — the String to be stripped, may be {@code null}
-
- Returns: the trimmed String, or an empty String if {@code null} input
-
Signature:
public static void stripToEmpty(final String[] strs) - Summary: Strips leading and trailing whitespace from each string in the provided array.
-
Contract:
- <p> If a string becomes {@code null} after stripping, it is set to an empty string.
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place.
-
stripStart(...) -> String
-
Signature:
public static String stripStart(final String str) - Summary: Strips whitespace from the start of a String.
-
Parameters:
-
str(String) — the String to remove whitespace from, may be {@code null}
-
- Returns: the stripped String, {@code null} if {@code null} String input
-
Signature:
public static String stripStart(final String str, final String stripChars) - Summary: Strips any of a set of characters from the start of a String.
-
Contract:
- </p> <p> If the stripChars String is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
-
Parameters:
-
str(String) — the String to remove characters from, may be {@code null} -
stripChars(String) — the characters to remove, {@code null} treated as whitespace
-
- Returns: the specified String if it's {@code null} or empty.
-
Signature:
public static void stripStart(final String[] strs, final String stripChars) - Summary: Strips the specified characters from the start of each string in the provided array.
-
Contract:
- If the stripChars is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place. -
stripChars(String) — the set of characters to be stripped from the start of the strings. If {@code null} , the method behaves as {@link #stripStart(String, String)} .
-
- See also: #stripStart(String, String)
stripEnd(...) -> String
-
Signature:
public static String stripEnd(final String str) - Summary: Strips whitespace from the end of a String.
-
Parameters:
-
str(String) — the String to remove whitespace from, may be {@code null}
-
- Returns: the stripped String, {@code null} if {@code null} String input
-
Signature:
public static String stripEnd(final String str, final String stripChars) - Summary: Strips any of a set of characters from the end of a String.
-
Contract:
- </p> <p> If the stripChars String is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
-
Parameters:
-
str(String) — the String to remove characters from, may be {@code null} -
stripChars(String) — the set of characters to remove, {@code null} treated as whitespace
-
- Returns: the specified String if it's {@code null} or empty.
-
Signature:
public static void stripEnd(final String[] strs, final String stripChars) - Summary: Strips the specified characters from the end of each string in the provided array.
-
Contract:
- If the stripChars is {@code null} , whitespace is stripped as defined by {@link Character#isWhitespace(char)} .
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place. -
stripChars(String) — the set of characters to be stripped from the end of the strings. If {@code null} , the method behaves as {@link #stripEnd(String, String)} .
-
- See also: #stripEnd(String, String)
stripAccents(...) -> String
-
Signature:
@MayReturnNull public static String stripAccents(final String str) - Summary: Removes diacritics (~ = accents) from a string.
-
Parameters:
-
str(String) — the String to strip accents from, may be {@code null}
-
- Returns: the stripped String, {@code null} if {@code null} String input
-
Signature:
public static void stripAccents(final String[] strs) - Summary: Strips accents from each string in the provided array.
-
Contract:
- If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be stripped. Each string in the array will be updated in-place.
-
chomp(...) -> String
-
Signature:
public static String chomp(final String str) - Summary: Removes one newline from end of a String if it's there, otherwise leave it alone.
-
Contract:
- Removes one newline from end of a String if it's there, otherwise leave it alone.
- If the string ends with multiple newlines, only the last one is removed.
- </p> <p> The method returns {@code null} if the input is {@code null} .
-
Parameters:
-
str(String) — the String to chomp a newline from, may be {@code null}
-
- Returns: string without newline at the end, {@code null} if {@code null} String input
- See also: #chop(String)
-
Signature:
public static void chomp(final String[] strs) - Summary: Removes one newline from end of each string in the provided array if it's there, otherwise leaves it alone.
-
Contract:
- Removes one newline from end of each string in the provided array if it's there, otherwise leaves it alone.
- </p> <p> If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be chomped. Each string in the array will be updated in-place.
-
chop(...) -> String
-
Signature:
public static String chop(final String str) - Summary: Remove the last character from a String.
-
Contract:
- <p> If the String ends in "\\r\\n", then both characters are removed.
- </p> <p> The method returns {@code null} if the input is {@code null} , and an empty string if the input has only one character or is already empty.
-
Parameters:
-
str(String) — the String to chop last character from, may be {@code null}
-
- Returns: string without last character, {@code null} if {@code null} String input
- See also: #chomp(String)
-
Signature:
public static void chop(final String[] strs) - Summary: Removes the last character from each string in the provided array.
-
Contract:
- <p> If a string in the array ends in "\\r\\n", both characters are removed.
- </p> <p> If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be chopped. Each string in the array will be updated in-place.
-
truncate(...) -> String
-
Signature:
public static String truncate(final String str, final int maxWidth) - Summary: Truncates a String to a specified maximum width.
-
Contract:
- <p> This method will return the original string if it is shorter than or equal to the specified maximum width.
- If the string is longer, it will be truncated to exactly the maximum width.
- </p> <p> If {@code maxWidth} is less than 0, an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the String to truncate, may be {@code null} -
maxWidth(int) — maximum length of result String, must be positive
-
- Returns: truncated String, {@code null} if {@code null} String input
- See also: #truncate(String, int, int), #truncate(String\[\], int)
-
Signature:
@MayReturnNull public static String truncate(final String str, final int offset, final int maxWidth) throws IllegalArgumentException - Summary: Truncates a String to a specified maximum width starting from a given offset.
-
Contract:
- <p> This method allows you to specify a "left edge" offset from where the truncation should begin.
- If the string is shorter than {@code offset + maxWidth} , the entire substring from offset is returned.
- </p> <p> If {@code offset} or {@code maxWidth} is less than 0, an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the String to truncate, may be {@code null} -
offset(int) — left edge of source String -
maxWidth(int) — maximum length of result String, must be positive
-
- Returns: truncated String, {@code null} if {@code null} String input
-
Throws:
-
java.lang.IllegalArgumentException— if {@code offset} or {@code maxWidth} is less than 0
-
- See also: #truncate(String, int), #truncate(String\[\], int, int)
-
Signature:
public static void truncate(final String[] strs, final int maxWidth) - Summary: Truncates each string in the provided array to the specified maximum width.
-
Contract:
- <p> If a string in the array has a length less than or equal to the maxWidth, it remains unchanged.
- If a string in the array has a length greater than the maxWidth, it is truncated to the maxWidth.
- </p> <p> If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be truncated. Each string in the array will be updated in-place. -
maxWidth(int) — the maximum length for each string. Must be non-negative.
-
- See also: #truncate(String, int), #truncate(String\[\], int, int)
-
Signature:
public static void truncate(final String[] strs, final int offset, final int maxWidth) - Summary: Truncates each string in the provided array to the specified maximum width starting from the given offset.
-
Contract:
- For each string, if it has a length less than or equal to the offset, it becomes an empty string.
- </p> <p> If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be truncated. Each string in the array will be updated in-place. -
offset(int) — the starting index from where the string needs to be truncated. -
maxWidth(int) — the maximum length for each string starting from the offset. Must be non-negative.
-
- See also: #truncate(String, int, int), #truncate(String\[\], int)
deleteWhitespace(...) -> String
-
Signature:
public static String deleteWhitespace(final String str) - Summary: Deletes all whitespace from a String as defined by {@link Character#isWhitespace(char)} .
-
Contract:
- The method returns {@code null} if the input is {@code null} .
-
Parameters:
-
str(String) — the String to delete whitespace from, may be {@code null}
-
- Returns: the String without whitespaces, {@code null} if {@code null} String input
- See also: #deleteWhitespace(String\[\])
-
Signature:
public static void deleteWhitespace(final String[] strs) - Summary: Deletes all whitespace from each string in the provided array.
-
Contract:
- </p> <p> If the input array is {@code null} or empty, the method does nothing.
-
Parameters:
-
strs(String[]) — the array of strings to be processed. Each string in the array will be updated in-place.
-
- See also: #deleteWhitespace(String)
appendIfMissing(...) -> String
-
Signature:
public static String appendIfMissing(final String str, final String suffix) throws IllegalArgumentException - Summary: Appends the specified suffix to the input string if it is not already present at the end of the string.
-
Contract:
- Appends the specified suffix to the input string if it is not already present at the end of the string.
- <p> This method checks if the string already ends with the specified suffix.
- If it does, the original string is returned unchanged.
- If not, the suffix is appended to the string.
- If the input string is {@code null} or empty, the suffix is returned as is.
- </p> <p> The suffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to which the suffix should be appended, may be {@code null} or empty -
suffix(String) — the suffix to append to the string. Must not be empty.
-
- Returns: the input string with the suffix appended if it was not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the suffix is empty.
-
- See also: #appendIfMissingIgnoreCase(String, String), #prependIfMissing(String, String)
appendIfMissingIgnoreCase(...) -> String
-
Signature:
public static String appendIfMissingIgnoreCase(final String str, final String suffix) throws IllegalArgumentException - Summary: Appends the specified suffix to the input string if it is not already present at the end of the string, ignoring case considerations.
-
Contract:
- Appends the specified suffix to the input string if it is not already present at the end of the string, ignoring case considerations.
- <p> This method performs a case-insensitive check to determine if the string already ends with the specified suffix.
- If it does, the original string is returned unchanged.
- If not, the suffix is appended to the string.
- If the input string is {@code null} or empty, the suffix is returned as is.
- </p> <p> The suffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to which the suffix should be appended, may be {@code null} or empty -
suffix(String) — the suffix to append to the string. Must not be empty.
-
- Returns: the input string with the suffix appended if it was not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the suffix is empty.
-
- See also: #appendIfMissing(String, String), #prependIfMissingIgnoreCase(String, String)
prependIfMissing(...) -> String
-
Signature:
public static String prependIfMissing(final String str, final String prefix) throws IllegalArgumentException - Summary: Prepends the specified prefix to the input string if it is not already present at the start of the string.
-
Contract:
- Prepends the specified prefix to the input string if it is not already present at the start of the string.
- <p> This method checks if the string already starts with the specified prefix.
- If it does, the original string is returned unchanged.
- If not, the prefix is prepended to the string.
- If the input string is {@code null} or empty, the prefix is returned as is.
- </p> <p> The prefix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to which the prefix should be prepended, may be {@code null} or empty -
prefix(String) — the prefix to prepend to the string. Must not be empty.
-
- Returns: the input string with the prefix prepended if it was not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefix is empty.
-
- See also: #prependIfMissingIgnoreCase(String, String), #appendIfMissing(String, String)
prependIfMissingIgnoreCase(...) -> String
-
Signature:
public static String prependIfMissingIgnoreCase(final String str, final String prefix) throws IllegalArgumentException - Summary: Prepends the specified prefix to the input string if it is not already present at the start of the string, ignoring case considerations.
-
Contract:
- Prepends the specified prefix to the input string if it is not already present at the start of the string, ignoring case considerations.
- <p> This method performs a case-insensitive check to determine if the string already starts with the specified prefix.
- If it does, the original string is returned unchanged.
- If not, the prefix is prepended to the string.
- If the input string is {@code null} or empty, the prefix is returned as is.
- </p> <p> The prefix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to which the prefix should be prepended, may be {@code null} or empty -
prefix(String) — the prefix to prepend to the string. Must not be empty.
-
- Returns: the input string with the prefix prepended if it was not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefix is empty.
-
- See also: #prependIfMissing(String, String), #appendIfMissingIgnoreCase(String, String)
wrapIfMissing(...) -> String
-
Signature:
public static String wrapIfMissing(final String str, final String prefixSuffix) throws IllegalArgumentException - Summary: Wraps the input string with the specified prefix and suffix if they are not already present.
-
Contract:
- Wraps the input string with the specified prefix and suffix if they are not already present.
- The method follows these rules: </p> <ul> <li> If the input string is {@code null} or empty, the prefix and suffix are concatenated and returned.
- </li> <li> If the input string already starts with the prefix and ends with the suffix, the original string is returned.
- </li> <li> If the input string already starts with the prefix but not ends with the suffix, then {@code str + prefixSuffix} is returned.
- </li> <li> If the input string ends with the suffix but not starts with the prefix, then {@code prefixSuffix + str} is returned.
- </li> </ul> <p> The prefixSuffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be wrapped. May be {@code null} or empty. -
prefixSuffix(String) — the string to be used as both the prefix and suffix for wrapping. Must not be empty.
-
- Returns: the input string wrapped with the prefixSuffix at both ends if they were not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefixSuffix is empty.
-
- See also: #wrapIfMissing(String, String, String), #wrap(String, String)
-
Signature:
public static String wrapIfMissing(final String str, final String prefix, final String suffix) throws IllegalArgumentException - Summary: Wraps the input string with the specified prefix and suffix if they are not already present.
-
Contract:
- Wraps the input string with the specified prefix and suffix if they are not already present.
- <p> The method follows these rules: </p> <ul> <li> If the input string is {@code null} or empty, the prefix and suffix are concatenated and returned.
- </li> <li> If the input string already starts with the prefix and ends with the suffix, the original string is returned.
- </li> <li> If the input string already starts with the prefix but not ends with the suffix, then {@code str + suffix} is returned.
- </li> <li> If the input string ends with the suffix but not starts with the prefix, then {@code prefix + str} is returned.
- </li> </ul> <p> The prefix and suffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be wrapped. May be {@code null} or empty. -
prefix(String) — the string to be used as the prefix for wrapping. Must not be empty. -
suffix(String) — the string to be used as the suffix for wrapping. Must not be empty.
-
- Returns: the input string wrapped with the prefix and suffix at both ends if they were not already present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefix or suffix is empty.
-
- See also: #wrapIfMissing(String, String), #wrap(String, String, String)
wrap(...) -> String
-
Signature:
public static String wrap(final String str, final String prefixSuffix) throws IllegalArgumentException - Summary: Wraps the input string with the specified prefix and suffix.
-
Contract:
- If the input string is {@code null} , it will be treated as an empty string.
- </p> <p> The prefixSuffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be wrapped. May be {@code null} . -
prefixSuffix(String) — the string to be used as both the prefix and suffix for wrapping. Must not be empty.
-
- Returns: the input string wrapped with the prefixSuffix at both ends.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefixSuffix is empty.
-
- See also: #wrap(String, String, String), #wrapIfMissing(String, String)
-
Signature:
public static String wrap(final String str, final String prefix, final String suffix) throws IllegalArgumentException - Summary: Wraps the input string with the specified prefix and suffix.
-
Contract:
- If the input string is {@code null} , it will be treated as an empty string.
- </p> <p> The prefix and suffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be wrapped. May be {@code null} . -
prefix(String) — the string to be used as the prefix for wrapping. Must not be empty. -
suffix(String) — the string to be used as the suffix for wrapping. Must not be empty.
-
- Returns: the input string wrapped with the prefix and suffix at both ends.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefix or suffix is empty.
-
- See also: #wrap(String, String), #wrapIfMissing(String, String, String)
unwrap(...) -> String
-
Signature:
public static String unwrap(final String str, final String prefixSuffix) throws IllegalArgumentException - Summary: Unwraps the input string if it is wrapped by the specified prefixSuffix at both ends.
-
Contract:
- Unwraps the input string if it is wrapped by the specified prefixSuffix at both ends.
- <p> This method removes the prefixSuffix from both the start and end of the string if and only if the string starts and ends with the prefixSuffix.
- If the input string is {@code null} or empty, the original string is returned.
- If the input string is not wrapped by the prefixSuffix, the original string is returned unchanged.
- </p> <p> The prefixSuffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be unwrapped. May be {@code null} or empty. -
prefixSuffix(String) — the string used as both the prefix and suffix for unwrapping. Must not be empty.
-
- Returns: the input string with the prefixSuffix removed from both ends if they were present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefixSuffix is empty.
-
- See also: #unwrap(String, String, String)
-
Signature:
public static String unwrap(final String str, final String prefix, final String suffix) throws IllegalArgumentException - Summary: Unwraps the input string if it is wrapped by the specified prefix and suffix.
-
Contract:
- Unwraps the input string if it is wrapped by the specified prefix and suffix.
- <p> This method removes the prefix from the start and the suffix from the end of the string if and only if the string starts with the prefix and ends with the suffix.
- If the input string is {@code null} or empty, the original string is returned.
- If the input string is not wrapped by the prefix and suffix, the original string is returned unchanged.
- </p> <p> The prefix and suffix must not be empty, otherwise an {@code IllegalArgumentException} is thrown.
-
Parameters:
-
str(String) — the string to be unwrapped. May be {@code null} or empty. -
prefix(String) — the string used as the prefix for unwrapping. Must not be empty. -
suffix(String) — the string used as the suffix for unwrapping. Must not be empty.
-
- Returns: the input string with the prefix and suffix removed from both ends if they were present; otherwise, the original string.
-
Throws:
-
java.lang.IllegalArgumentException— if the prefix or suffix is empty.
-
- See also: #unwrap(String, String)
isLowerCase(...) -> boolean
-
Signature:
public static boolean isLowerCase(final char ch) - Summary: Checks if the specified character is a lowercase character.
-
Contract:
- Checks if the specified character is a lowercase character.
- <p> This method delegates to {@link Character#isLowerCase(char)} to determine if the character is a lowercase letter according to Unicode standards.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is lowercase, {@code false} otherwise
- See also: Character#isLowerCase(char), #isUpperCase(char), #isAsciiLowerCase(char)
isAsciiLowerCase(...) -> boolean
-
Signature:
public static boolean isAsciiLowerCase(final char ch) - Summary: Checks if the specified character is an ASCII lowercase character.
-
Contract:
- Checks if the specified character is an ASCII lowercase character.
- <p> This method checks if the character is in the range 'a' to 'z' (ASCII values 97 to 122).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is an ASCII lowercase letter, {@code false} otherwise
- See also: #isLowerCase(char), #isAsciiAlphaLower(char), #isAsciiUpperCase(char)
isUpperCase(...) -> boolean
-
Signature:
public static boolean isUpperCase(final char ch) - Summary: Checks if the specified character is an uppercase character.
-
Contract:
- Checks if the specified character is an uppercase character.
- <p> This method delegates to {@link Character#isUpperCase(char)} to determine if the character is an uppercase letter according to Unicode standards.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is uppercase, {@code false} otherwise
- See also: Character#isUpperCase(char), #isLowerCase(char), #isAsciiUpperCase(char)
isAsciiUpperCase(...) -> boolean
-
Signature:
public static boolean isAsciiUpperCase(final char ch) - Summary: Checks if the specified character is an ASCII uppercase character.
-
Contract:
- Checks if the specified character is an ASCII uppercase character.
- <p> This method checks if the character is in the range 'A' to 'Z' (ASCII values 65 to 90).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is an ASCII uppercase letter, {@code false} otherwise
- See also: #isUpperCase(char), #isAsciiAlphaUpper(char), #isAsciiLowerCase(char)
isAllLowerCase(...) -> boolean
-
Signature:
public static boolean isAllLowerCase(final CharSequence cs) - Summary: Checks if all characters in the given CharSequence are lowercase.
-
Contract:
- Checks if all characters in the given CharSequence are lowercase.
- <p> This method returns {@code true} if all characters in the CharSequence are lowercase letters according to {@link Character#isLowerCase(char)} .
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if all characters are lowercase or the CharSequence is empty or {@code null} ; {@code false} otherwise
- See also: #isLowerCase(char), #isAllUpperCase(CharSequence), #isMixedCase(CharSequence)
isAllUpperCase(...) -> boolean
-
Signature:
public static boolean isAllUpperCase(final CharSequence cs) - Summary: Checks if all characters in the given CharSequence are uppercase.
-
Contract:
- Checks if all characters in the given CharSequence are uppercase.
- <p> This method returns {@code true} if all characters in the CharSequence are uppercase letters according to {@link Character#isUpperCase(char)} .
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if all characters are uppercase or the CharSequence is empty; {@code false} otherwise
- See also: #isUpperCase(char), #isAllLowerCase(CharSequence), #isMixedCase(CharSequence)
isMixedCase(...) -> boolean
-
Signature:
public static boolean isMixedCase(final CharSequence cs) - Summary: Checks if the given CharSequence contains mixed case characters.
-
Contract:
- Checks if the given CharSequence contains mixed case characters.
- <p> A CharSequence is considered mixed case if it contains both uppercase and lowercase characters.
- If the CharSequence is empty, {@code null} , or contains only a single character, it is not considered mixed case and the method returns {@code false} .
-
Parameters:
-
cs(CharSequence) — the CharSequence to check. It may be {@code null} .
-
- Returns: {@code true} if the CharSequence is mixed case, {@code false} otherwise.
- See also: #isAllLowerCase(CharSequence), #isAllUpperCase(CharSequence)
isDigit(...) -> boolean
-
Signature:
public static boolean isDigit(final char ch) - Summary: Checks if the specified character is a digit.
-
Contract:
- Checks if the specified character is a digit.
- <p> This method delegates to {@link Character#isDigit(char)} to determine if the character is a digit (0-9) according to Unicode standards.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is a digit, {@code false} otherwise
- See also: Character#isDigit(char), #isLetter(char), #isLetterOrDigit(char), #isAsciiNumeric(char)
isLetter(...) -> boolean
-
Signature:
public static boolean isLetter(final char ch) - Summary: Checks if the specified character is a letter.
-
Contract:
- Checks if the specified character is a letter.
- <p> This method delegates to {@link Character#isLetter(char)} to determine if the character is a letter according to Unicode standards.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is a letter, {@code false} otherwise
- See also: Character#isLetter(char), #isDigit(char), #isLetterOrDigit(char), #isAsciiAlpha(char)
isLetterOrDigit(...) -> boolean
-
Signature:
public static boolean isLetterOrDigit(final char ch) - Summary: Checks if the specified character is a letter or digit.
-
Contract:
- Checks if the specified character is a letter or digit.
- <p> This method delegates to {@link Character#isLetterOrDigit(char)} to determine if the character is either a letter or a digit according to Unicode standards.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character is a letter or digit, {@code false} otherwise
- See also: Character#isLetterOrDigit(char), #isLetter(char), #isDigit(char), #isAsciiAlphanumeric(char)
isAscii(...) -> boolean
-
Signature:
public static boolean isAscii(final char ch) - Summary: Checks whether the character is ASCII 7 bit.
-
Contract:
- <p> This method checks if the character value is less than 128, which means it belongs to the standard ASCII character set (0-127).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if the character value is less than 128, {@code false} otherwise
- See also: #isAsciiPrintable(char), #isAsciiControl(char), #isAsciiAlpha(char), #isAsciiNumeric(char)
isAsciiPrintable(...) -> boolean
-
Signature:
public static boolean isAsciiPrintable(final char ch) - Summary: Checks whether the character is ASCII 7 bit printable.
-
Contract:
- <p> This method checks if the character is in the range of printable ASCII characters, which are characters with values from 32 to 126 inclusive.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 32 and 126 inclusive, {@code false} otherwise
- See also: #isAscii(char), #isAsciiControl(char), #isAsciiPrintable(CharSequence)
-
Signature:
public static boolean isAsciiPrintable(final CharSequence cs) - Summary: Checks if the CharSequence contains only ASCII printable characters.
-
Contract:
- Checks if the CharSequence contains only ASCII printable characters.
- <p> This method checks if all characters in the CharSequence are ASCII printable characters (values 32-126).
- The method will return {@code false} if any character is outside the printable ASCII range.
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be null
-
- Returns: {@code true} if every character is ASCII printable, {@code false} if the CharSequence is {@code null} or contains non-printable characters
- See also: #isAsciiPrintable(char)
isAsciiControl(...) -> boolean
-
Signature:
public static boolean isAsciiControl(final char ch) - Summary: Checks whether the character is ASCII 7 bit control.
-
Contract:
- <p> This method checks if the character is an ASCII control character.
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if less than 32 or equals 127, {@code false} otherwise
- See also: #isAscii(char), #isAsciiPrintable(char)
isAsciiAlpha(...) -> boolean
-
Signature:
public static boolean isAsciiAlpha(final char ch) - Summary: Checks whether the character is ASCII 7 bit alphabetic.
-
Contract:
- <p> This method checks if the character is an ASCII letter, either uppercase (A-Z) or lowercase (a-z).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 65 and 90 or 97 and 122 inclusive, {@code false} otherwise
- See also: #isAsciiAlphaUpper(char), #isAsciiAlphaLower(char), #isAsciiAlphanumeric(char), #isLetter(char)
-
Signature:
public static boolean isAsciiAlpha(final CharSequence cs) - Summary: Checks if the given CharSequence contains only ASCII alphabetic characters (a-z, A-Z).
-
Contract:
- Checks if the given CharSequence contains only ASCII alphabetic characters (a-z, A-Z).
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence contains only ASCII alphabetic characters and is non-null/non-empty, {@code false} otherwise.
- See also: #isAsciiAlpha(char), #isAlpha(CharSequence), #isAsciiAlphaSpace(CharSequence)
isAsciiAlphaUpper(...) -> boolean
-
Signature:
public static boolean isAsciiAlphaUpper(final char ch) - Summary: Checks whether the character is ASCII 7 bit alphabetic upper case.
-
Contract:
- <p> This method checks if the character is an ASCII uppercase letter (A-Z).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 65 and 90 inclusive, {@code false} otherwise
- See also: #isUpperCase(char), #isAsciiLowerCase(char)
isAsciiAlphaLower(...) -> boolean
-
Signature:
public static boolean isAsciiAlphaLower(final char ch) - Summary: Checks whether the character is ASCII 7 bit alphabetic lower case.
-
Contract:
- <p> This method checks if the character is an ASCII lowercase letter (a-z).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 97 and 122 inclusive, {@code false} otherwise
- See also: #isAsciiAlpha(char), #isAsciiAlphaUpper(char), #isLowerCase(char)
isAsciiNumeric(...) -> boolean
-
Signature:
public static boolean isAsciiNumeric(final char ch) - Summary: Checks whether the character is ASCII 7 bit numeric.
-
Contract:
- <p> This method checks if the character is an ASCII digit (0-9).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 48 and 57 inclusive, {@code false} otherwise
- See also: #isDigit(char), #isAsciiAlphanumeric(char)
-
Signature:
public static boolean isAsciiNumeric(final CharSequence cs) - Summary: Checks if the given CharSequence contains only ASCII numeric characters (0-9).
-
Contract:
- Checks if the given CharSequence contains only ASCII numeric characters (0-9).
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence contains only ASCII numeric characters and is non-null/non-empty, {@code false} otherwise.
- See also: #isNumeric(CharSequence), #isAsciiNumber(String)
isAsciiAlphanumeric(...) -> boolean
-
Signature:
public static boolean isAsciiAlphanumeric(final char ch) - Summary: Checks whether the character is ASCII 7 bit alphanumeric.
-
Contract:
- <p> This method checks if the character is either an ASCII letter (A-Z, a-z) or an ASCII digit (0-9).
-
Parameters:
-
ch(char) — the character to check
-
- Returns: {@code true} if between 48 and 57 or 65 and 90 or 97 and 122 inclusive, {@code false} otherwise
- See also: #isLetterOrDigit(char), #isAsciiAlpha(char), #isAsciiNumeric(char)
-
Signature:
public static boolean isAsciiAlphanumeric(final CharSequence cs) - Summary: Checks if the given CharSequence contains only ASCII alphanumeric characters (a-z, A-Z, 0-9).
-
Contract:
- Checks if the given CharSequence contains only ASCII alphanumeric characters (a-z, A-Z, 0-9).
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence contains only ASCII alphanumeric characters and is non-null/non-empty, {@code false} otherwise.
- See also: #isAlphanumeric(CharSequence), #isAsciiAlpha(CharSequence), #isAsciiNumeric(CharSequence)
isAsciiAlphaSpace(...) -> boolean
-
Signature:
public static boolean isAsciiAlphaSpace(final CharSequence cs) - Summary: Checks if the given CharSequence contains only ASCII alphabetic characters (a-z, A-Z) and spaces.
-
Contract:
- Checks if the given CharSequence contains only ASCII alphabetic characters (a-z, A-Z) and spaces.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence contains only ASCII alphabetic characters and spaces and is {@code non-null} , {@code false} otherwise.
- See also: #isAsciiAlpha(CharSequence), #isAlphaSpace(CharSequence)
isAsciiAlphanumericSpace(...) -> boolean
-
Signature:
public static boolean isAsciiAlphanumericSpace(final CharSequence cs) - Summary: Checks if the given CharSequence contains only ASCII alphanumeric characters (a-z, A-Z, 0-9) and spaces.
-
Contract:
- Checks if the given CharSequence contains only ASCII alphanumeric characters (a-z, A-Z, 0-9) and spaces.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the CharSequence contains only ASCII alphanumeric characters and spaces and is {@code non-null} , {@code false} otherwise.
- See also: #isAsciiAlphanumeric(CharSequence), #isAlphanumericSpace(CharSequence)
isAlpha(...) -> boolean
-
Signature:
public static boolean isAlpha(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode letters.
-
Contract:
- Checks if the CharSequence contains only Unicode letters.
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains letters and is non-null/non-empty, {@code false} otherwise.
- See also: Character#isLetter(char), #isAsciiAlpha(CharSequence)
isAlphaSpace(...) -> boolean
-
Signature:
public static boolean isAlphaSpace(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode letters and space (' ').
-
Contract:
- Checks if the CharSequence contains only Unicode letters and space (' ').
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains letters and spaces and is {@code non-null} , {@code false} otherwise.
- See also: #isAlpha(CharSequence), #isAsciiAlphaSpace(CharSequence)
isAlphanumeric(...) -> boolean
-
Signature:
public static boolean isAlphanumeric(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode letters or digits.
-
Contract:
- Checks if the CharSequence contains only Unicode letters or digits.
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains letters or digits and is non-null/non-empty, {@code false} otherwise.
- See also: Character#isLetterOrDigit(char), #isAsciiAlphanumeric(CharSequence)
isAlphanumericSpace(...) -> boolean
-
Signature:
public static boolean isAlphanumericSpace(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode letters, digits or space (' ').
-
Contract:
- Checks if the CharSequence contains only Unicode letters, digits or space (' ').
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains letters, digits or spaces and is {@code non-null} , {@code false} otherwise.
- See also: #isAlphanumeric(CharSequence), #isAsciiAlphanumericSpace(CharSequence)
isNumeric(...) -> boolean
-
Signature:
public static boolean isNumeric(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode digits.
-
Contract:
- Checks if the CharSequence contains only Unicode digits.
- Also, if a String passes the numeric test, it may still generate a NumberFormatException when parsed by Integer.parseInt or Long.parseLong, e.g., if the value is outside the range for int or long respectively.
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains digits and is non-null/non-empty, {@code false} otherwise.
- See also: Character#isDigit(char), #isAsciiNumeric(CharSequence), #isNumber(String)
isNumericSpace(...) -> boolean
-
Signature:
public static boolean isNumericSpace(final CharSequence cs) - Summary: Checks if the CharSequence contains only Unicode digits or space (' ').
-
Contract:
- Checks if the CharSequence contains only Unicode digits or space (' ').
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains digits or spaces and is {@code non-null} , {@code false} otherwise.
- See also: #isNumeric(CharSequence), Character#isDigit(char)
isWhitespace(...) -> boolean
-
Signature:
public static boolean isWhitespace(final CharSequence cs) - Summary: Checks if the CharSequence contains only whitespace.
-
Contract:
- Checks if the CharSequence contains only whitespace.
-
Parameters:
-
cs(CharSequence) — the CharSequence to check, may be {@code null}
-
- Returns: {@code true} if only contains whitespace and is {@code non-null} , {@code false} otherwise.
- See also: Character#isWhitespace(char)
isNumber(...) -> boolean
-
Signature:
@Deprecated public static boolean isNumber(final String str) - Summary: Note: It's copied from NumberUtils in Apache Commons Lang under Apache License 2.0
-
Contract:
- {@code true} is returned if there is a number which can be initialized by {@code createNumber} with specified String.
-
Parameters:
-
str(String) — the {@code String} to check
-
- Returns: {@code true} if the string is a correctly formatted number
- See also: Numbers#isNumber(String), Numbers#isCreatable(String), Numbers#isParsable(String),validation
isAsciiNumber(...) -> boolean
-
Signature:
public static boolean isAsciiNumber(final String str) - Summary: Checks if the given string contains only valid ASCII number characters.
-
Contract:
- Checks if the given string contains only valid ASCII number characters.
- <p> This method checks if the string is a valid number representation using only ASCII characters.
-
Parameters:
-
str(String) — the string to check, may be {@code null}
-
- Returns: {@code true} if the string represents a valid ASCII digital number, {@code false} otherwise.
- See also: #isAsciiInteger(String), #isNumber(String)
isAsciiInteger(...) -> boolean
-
Signature:
public static boolean isAsciiInteger(final String str) - Summary: Checks if the given string contains only valid ASCII integer characters.
-
Contract:
- Checks if the given string contains only valid ASCII integer characters.
- <p> This method checks if the string is a valid integer representation using only ASCII characters.
-
Parameters:
-
str(String) — the string to check, may be {@code null}
-
- Returns: {@code true} if the string represents a valid ASCII digital integer, {@code false} otherwise.
- See also: #isAsciiNumber(String), #isAsciiNumeric(CharSequence)
indexOf(...) -> int
-
Signature:
public static int indexOf(final String str, final int charValueToFind) - Summary: Returns the index within this string of the first occurrence of the specified character.
-
Contract:
- <p> If a character with value {@code charValueToFind} occurs in the character sequence represented by this {@code String} object, then the index of the first such occurrence is returned.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
charValueToFind(int) — the Unicode code of the character to be found.
-
- Returns: the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
- See also: String#indexOf(int)
-
Signature:
public static int indexOf(final String str, final int charValueToFind, int fromIndex) - Summary: Returns the index within the input string of the first occurrence of the specified character, starting the search at the specified index.
-
Contract:
- <p> If a character with value {@code charValueToFind} occurs in the character sequence represented by the input {@code String} object at an index no smaller than {@code fromIndex} , then the index of the first such occurrence is returned.
- If {@code fromIndex} is negative, it is treated as zero.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
charValueToFind(int) — the Unicode code of the character to be found. -
fromIndex(int) — the index to start the search from.
-
- Returns: the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
- See also: String#indexOf(int, int)
-
Signature:
public static int indexOf(final String str, final String valueToFind) - Summary: Returns the index within the input string of the first occurrence of the specified substring.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object, then the index of the first character of the first such substring is returned.
- </p> <p> The method returns {@code -1} if the substring is not found, or if either parameter is {@code null} , or if the substring is longer than the string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found.
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur.
- See also: String#indexOf(String)
-
Signature:
public static int indexOf(final String str, final String valueToFind, int fromIndex) - Summary: Returns the index within the input string of the first occurrence of the specified substring, starting the search at the specified index.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object at an index no smaller than {@code fromIndex} , then the index of the first character of the first such substring is returned.
- If {@code fromIndex} is negative, it is treated as zero.
- </p> <p> The method returns {@code -1} if the substring is not found, or if either parameter is {@code null} , or if the substring cannot fit in the remaining portion of the string from {@code fromIndex} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found. -
fromIndex(int) — the index to start the search from.
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur.
- See also: String#indexOf(String, int)
-
Signature:
public static int indexOf(final String str, final String valueToFind, final String delimiter) - Summary: Returns the index within the input string of the first occurrence of the specified substring, using the specified delimiter to separate the search.
-
Contract:
- A match is valid only if the substring is preceded by the delimiter (or is at the start of the string) and followed by the delimiter (or is at the end of the string).
- </p> <p> If the delimiter is empty, this method behaves the same as {@link #indexOf(String, String)} .
- The method returns {@code -1} if the substring is not found as a delimited token.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found. -
delimiter(String) — the delimiter to separate the search.
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur.
- See also: #indexOf(String, String, String, int)
-
Signature:
public static int indexOf(final String str, final String valueToFind, final String delimiter, int fromIndex) - Summary: Returns the index within the input string of the first occurrence of the specified substring, using the specified delimiter to separate the search, starting the search at the specified index.
-
Contract:
- A match is valid only if the substring is preceded by the delimiter (or is at the start of the search) and followed by the delimiter (or is at the end of the string).
- If {@code fromIndex} is negative, it is treated as zero.
- </p> <p> If the delimiter is empty, this method behaves the same as {@link #indexOf(String, String, int)} .
- The method returns {@code -1} if the substring is not found as a delimited token.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found. -
delimiter(String) — the delimiter to separate the search. -
fromIndex(int) — the index to start the search from.
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur.
- See also: #indexOf(String, String, String)
indexOfAny(...) -> int
-
Signature:
public static int indexOfAny(final String str, final char... valuesToFind) throws IllegalArgumentException - Summary: Returns the index within the input string of the first occurrence of any specified character.
-
Contract:
- <p> If any character within the array {@code valuesToFind} occurs in the character sequence represented by the input {@code String} object, then the index of the first such occurrence is returned.
- </p> <p> The method returns {@code -1} if none of the characters are found, or if the input string is {@code null} or empty, or if the character array is {@code null} or empty.
- </p> <p> Note: Use the {@code Strings.indexOf(String, int)} method when searching for a single character to avoid ambiguous compilation errors.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(char[]) — the array of characters to be found.
-
- Returns: the index of the first occurrence of any character in the character sequence represented by this object, or -1 if none of the characters occur.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
- See also: #indexOfAny(String, int, char...), #indexOf(String, int)
-
Signature:
public static int indexOfAny(final String str, int fromIndex, final char... valuesToFind) throws IllegalArgumentException - Summary: Returns the index within the input string of the first occurrence of any specified character, starting the search at the specified index.
-
Contract:
- <p> If any character within the array {@code valuesToFind} occurs in the character sequence represented by the input {@code String} object at an index no smaller than {@code fromIndex} , then the index of the first such occurrence is returned.
- If {@code fromIndex} is negative, it is treated as zero.
- </p> <p> The method returns {@code -1} if none of the characters are found, or if the input string is {@code null} or empty, or if the character array is {@code null} or empty.
- </p> <p> Note: Use the {@code Strings.indexOf(String, int, int)} method when searching for a single character to avoid ambiguous compilation errors.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. -
valuesToFind(char[]) — the array of characters to be found.
-
- Returns: the index of the first occurrence of any character in the character sequence represented by this object, or -1 if none of the characters occur.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
- See also: #indexOfAny(String, char...), #indexOf(String, int, int)
-
Signature:
public static int indexOfAny(final String str, final String... valuesToFind) - Summary: Returns the index within the input string of the first occurrence of any specified substring.
-
Contract:
- <p> If any substring within the array {@code valuesToFind} occurs in the character sequence represented by the input {@code String} object, then the index of the first character of the first such substring is returned.
- </p> <p> The method returns {@code -1} if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
- </p> <p> Note: Use the {@code Strings.indexOf(String, String)} method when searching for a single string to avoid ambiguous compilation errors.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(String[]) — the array of substrings to be found.
-
- Returns: the index of the first occurrence of any substring in the character sequence represented by this object, or -1 if none of the substrings occur.
- See also: #indexOfAny(String, int, String...), #indexOf(String, String)
-
Signature:
public static int indexOfAny(final String str, int fromIndex, final String... valuesToFind) - Summary: Returns the index within the input string of the first occurrence of any specified substring, starting the search at the specified index.
-
Contract:
- <p> If any substring within the array {@code valuesToFind} occurs in the character sequence represented by the input {@code String} object at an index no smaller than {@code fromIndex} , then the index of the first character of the first such substring is returned.
- If {@code fromIndex} is negative, it is treated as zero.
- </p> <p> The method returns {@code -1} if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
- </p> <p> Note: Use the {@code Strings.indexOf(String, String, int)} method when searching for a single string to avoid ambiguous compilation errors.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. -
valuesToFind(String[]) — the array of substrings to be found.
-
- Returns: the index of the first occurrence of any substring in the character sequence represented by this object, or -1 if none of the substrings occur.
- See also: #indexOfAny(String, String...), #indexOf(String, String, int)
indexOfAnyBut(...) -> int
-
Signature:
public static int indexOfAnyBut(final String str, final char... valuesToExclude) - Summary: Returns the index within the input string of the first occurrence of any character that is not in the specified array of characters to exclude.
-
Contract:
- <p> If a character not within the array {@code valuesToExclude} occurs in the character sequence represented by the input {@code String} object, then the index of the first such occurrence is returned.
- </p> <p> The method returns {@code -1} if all characters in the string are in the exclusion array, or if the string is {@code null} or empty.
- If the exclusion array is {@code null} or empty, returns 0 (the first character is not excluded).
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToExclude(char[]) — the array of characters to exclude from the search.
-
- Returns: the index of the first occurrence of any character not in the array of characters to exclude, or -1 if all characters are in the array or the string is {@code null} or empty.
- See also: #indexOfAnyBut(String, int, char...)
-
Signature:
public static int indexOfAnyBut(final String str, int fromIndex, final char... valuesToExclude) - Summary: Returns the index within the input string of the first occurrence of any character that is not in the specified array of characters to exclude, starting the search at the specified index.
-
Contract:
- <p> If a character not within the array {@code valuesToExclude} occurs in the character sequence represented by the input {@code String} object at an index no smaller than {@code fromIndex} , then the index of the first such occurrence is returned.
- If {@code fromIndex} is negative, it is treated as zero.
- </p> <p> The method returns {@code -1} if all characters from {@code fromIndex} onwards are in the exclusion array, or if the string is {@code null} or empty.
- If the exclusion array is {@code null} or empty, returns {@code fromIndex} (if valid).
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. -
valuesToExclude(char[]) — the array of characters to exclude from the search.
-
- Returns: the index of the first occurrence of any character not in the array of characters to exclude, or -1 if all characters are in the array or the string is {@code null} or empty.
- See also: #indexOfAnyBut(String, char...)
indexOfIgnoreCase(...) -> int
-
Signature:
public static int indexOfIgnoreCase(final String str, final String valueToFind) - Summary: Returns the index within the input string of the first occurrence of the specified substring, ignoring case considerations.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object, then the index of the first such occurrence is returned.
- </p> <p> The method returns -1 if the substring is not found, or if either the input string or the substring to find is {@code null} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} .
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur or if either parameter is {@code null} .
-
Signature:
public static int indexOfIgnoreCase(final String str, final String valueToFind, int fromIndex) - Summary: Returns the index within the input string of the first occurrence of the specified substring, ignoring case considerations, starting the search at the specified index.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object at or after the specified {@code fromIndex} , then the index of the first such occurrence is returned.
- </p> <p> The method returns -1 if the substring is not found, or if either the input string or the substring to find is {@code null} .
- If {@code fromIndex} is negative, it is treated as 0.
- If {@code fromIndex} is greater than the string length, -1 is returned.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
fromIndex(int) — the index to start the search from. Negative values are treated as 0.
-
- Returns: the index of the first occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur or if either string parameter is {@code null} .
-
Signature:
public static int indexOfIgnoreCase(final String str, final String valueToFind, final String delimiter) - Summary: Returns the index within the input string of the first occurrence of the specified substring, ignoring case considerations, where the substring is bounded by the specified delimiter.
-
Contract:
- <p> This method searches for the substring within the input string, but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if any parameter is {@code null} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to be used for the search, may be {@code null} or empty.
-
- Returns: the index of the first occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if any parameter is {@code null} .
-
Signature:
public static int indexOfIgnoreCase(final String str, final String valueToFind, final String delimiter, int fromIndex) - Summary: Returns the index within the input string of the first occurrence of the specified substring, ignoring case considerations, where the substring is bounded by the specified delimiter, starting the search at the specified index.
-
Contract:
- <p> This method searches for the substring within the input string starting from {@code fromIndex} , but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if the input string or substring to find is {@code null} .
- If the delimiter is empty or {@code null} , the method behaves the same as {@link #indexOfIgnoreCase(String, String, int)} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to be used for the search, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. Negative values are treated as 0.
-
- Returns: the index of the first occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if the input string or substring to find is {@code null} .
lastIndexOf(...) -> int
-
Signature:
public static int lastIndexOf(final String str, final int charValueToFind) - Summary: Returns the index within this string of the last occurrence of the specified character.
-
Contract:
- <p> If a character with value {@code charValueToFind} occurs in the character sequence represented by this {@code String} object, then the index of the last such occurrence is returned.
- </p> <p> The method returns -1 if the character is not found, or if the input string is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
charValueToFind(int) — the character to be found.
-
- Returns: the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur or if the string is {@code null} or empty.
-
Signature:
public static int lastIndexOf(final String str, final int charValueToFind, int startIndexFromBack) - Summary: Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
-
Contract:
- </p> <p> If no such character occurs in this string at or before position {@code startIndexFromBack} , then -1 is returned.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
charValueToFind(int) — a character (Unicode code point). -
startIndexFromBack(int) — the index to start the search from. There is no restriction on the value of {@code startIndexFromBack} . If it is greater than or equal to the length of this string, it has the same effect as if it were equal to one less than the length of this string: this entire string may be searched. If it is negative, -1 is returned.
-
- Returns: the index of the last occurrence of the character in the character sequence represented by this object that is less than or equal to {@code startIndexFromBack} , or {@code -1} if the character does not occur before that point.
-
Signature:
public static int lastIndexOf(final String str, final String valueToFind) - Summary: Returns the index within this string of the last occurrence of the specified substring.
-
Contract:
- If the substring does not occur, -1 is returned.
- </p> <p> The method returns -1 if either the input string or the substring to find is {@code null} , or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} .
-
- Returns: the index of the last occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur or if either parameter is {@code null} .
-
Signature:
public static int lastIndexOf(final String str, final String valueToFind, int startIndexFromBack) - Summary: Returns the index within {@code str} of the last occurrence of the specified {@code valueToFind} , searching backward starting at the specified index.
-
Contract:
- If no such value of <i> k </i> exists, then {@code -1} is returned.
- </p> <p> The method returns -1 if either the input string or the substring to find is {@code null} , if {@code startIndexFromBack} is negative, or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched.
-
- Returns: the index of the last occurrence of the substring at or before the specified index, or -1 if the substring does not occur or if any parameter is invalid.
-
Signature:
public static int lastIndexOf(final String str, final String valueToFind, final String delimiter) - Summary: Returns the index within the input string of the last occurrence of the specified substring, where the substring is bounded by the specified delimiter.
-
Contract:
- <p> This method searches for the substring within the input string from the end, but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if any parameter is {@code null} .
- If the delimiter is empty or {@code null} , the method behaves the same as {@link #lastIndexOf(String, String)} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to separate the search, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if any parameter is {@code null} .
-
Signature:
public static int lastIndexOf(final String str, final String valueToFind, final String delimiter, int startIndexFromBack) - Summary: Returns the index within the input string of the last occurrence of the specified substring, where the substring is bounded by the specified delimiter, starting the search at the specified index.
-
Contract:
- <p> This method searches for the substring within the input string from {@code startIndexFromBack} backwards, but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if the input string or substring to find is {@code null} .
- If the delimiter is empty or {@code null} , the method behaves the same as {@link #lastIndexOf(String, String, int)} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to separate the search, may be {@code null} or empty. -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched.
-
- Returns: the index of the last occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if the input string or substring to find is {@code null} .
lastIndexOfIgnoreCase(...) -> int
-
Signature:
public static int lastIndexOfIgnoreCase(final String str, final String valueToFind) - Summary: Returns the index within the input string of the last occurrence of the specified substring, ignoring case considerations.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object, then the index of the last such occurrence is returned.
- </p> <p> The method returns -1 if the substring is not found, or if either the input string or the substring to find is {@code null} , or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} .
-
- Returns: the index of the last occurrence of the substring in the character sequence represented by this object, or -1 if the substring does not occur or if either parameter is {@code null} .
-
Signature:
public static int lastIndexOfIgnoreCase(final String str, final String valueToFind, int startIndexFromBack) - Summary: Returns the index within the input string of the last occurrence of the specified substring, ignoring case considerations, searching backward starting at the specified index.
-
Contract:
- <p> If a substring with value {@code valueToFind} occurs in the character sequence represented by the input {@code String} object at or before the specified {@code startIndexFromBack} , then the index of the last such occurrence is returned.
- </p> <p> The method returns -1 if the substring is not found at or before the specified index, or if either the input string or the substring to find is {@code null} , if {@code startIndexFromBack} is negative, or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched.
-
- Returns: the index of the last occurrence of the substring at or before the specified index, or -1 if the substring does not occur or if any parameter is invalid.
-
Signature:
public static int lastIndexOfIgnoreCase(final String str, final String valueToFind, final String delimiter) - Summary: Returns the index within the input string of the last occurrence of the specified substring, ignoring case considerations, where the substring is bounded by the specified delimiter.
-
Contract:
- <p> This method searches for the substring within the input string from the end, but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if any parameter is {@code null} .
- If the delimiter is empty or {@code null} , the method behaves the same as {@link #lastIndexOfIgnoreCase(String, String)} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to separate the search, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if any parameter is {@code null} .
-
Signature:
public static int lastIndexOfIgnoreCase(final String str, final String valueToFind, final String delimiter, int startIndexFromBack) - Summary: Returns the index within the input string of the last occurrence of the specified substring, ignoring case considerations, where the substring is bounded by the specified delimiter, starting the search at the specified index.
-
Contract:
- <p> This method searches for the substring within the input string from {@code startIndexFromBack} backwards, but only considers it a match if it is preceded and/or followed by the specified delimiter (or at the beginning/end of the string).
- </p> <p> The method returns -1 if the substring is not found with the required delimiter boundaries, or if the input string or substring to find is {@code null} .
- If the delimiter is empty or {@code null} , the method behaves the same as {@link #lastIndexOfIgnoreCase(String, String, int)} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the substring to be found, may be {@code null} . -
delimiter(String) — the delimiter to separate the search, may be {@code null} or empty. -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched.
-
- Returns: the index of the last occurrence of the substring bounded by the delimiter in the character sequence represented by this object, or -1 if the substring does not occur with proper boundaries or if the input string or substring to find is {@code null} .
lastIndexOfAny(...) -> int
-
Signature:
public static int lastIndexOfAny(final String str, final char... valuesToFind) throws IllegalArgumentException - Summary: Returns the index within the input string of the last occurrence of any specified character.
-
Contract:
- </p> <p> The method returns -1 if none of the characters are found, or if the input string is {@code null} or empty, or if the character array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(char[]) — the array of characters to be found, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of any character in the character sequence represented by this object, or -1 if none of the characters occur or if the string or character array is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
- See also: #minLastIndexOfAll(String, String\[\]), #minLastIndexOfAll(String, int, String\[\]), #maxLastIndexOfAll(String, String\[\]), #maxLastIndexOfAll(String, int, String\[\])
-
Signature:
public static int lastIndexOfAny(final String str, int startIndexFromBack, final char... valuesToFind) throws IllegalArgumentException - Summary: Returns the index within the input string of the last occurrence of any specified character, searching backward starting at the specified index.
-
Contract:
- </p> <p> The method returns -1 if none of the characters are found at or before the specified index, or if the input string is {@code null} or empty, or if the character array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched. -
valuesToFind(char[]) — the array of characters to be found, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of any character in the character sequence represented by this object that is less than or equal to {@code startIndexFromBack} , or -1 if none of the characters occur before that point or if the string or character array is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
-
Signature:
public static int lastIndexOfAny(final String str, final String... valuesToFind) - Summary: Returns the index within the input string of the last occurrence of any specified substring.
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of any substring in the character sequence represented by this object, or -1 if none of the substrings occur or if the string or substring array is {@code null} or empty.
- See also: #minLastIndexOfAll(String, String\[\]), #minLastIndexOfAll(String, int, String\[\]), #maxLastIndexOfAll(String, String\[\]), #maxLastIndexOfAll(String, int, String\[\])
-
Signature:
public static int lastIndexOfAny(final String str, int startIndexFromBack, final String... valuesToFind) - Summary: Returns the index within the input string of the last occurrence of any specified substring, searching backward starting at the specified index.
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found at or before the specified index, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the index of the last occurrence of any substring in the character sequence represented by this object that is less than or equal to {@code startIndexFromBack} , or -1 if none of the substrings occur before that point or if the string or substring array is {@code null} or empty.
minIndexOfAll(...) -> int
-
Signature:
public static int minIndexOfAll(final String str, final String... valuesToFind) - Summary: Finds the smallest index of all specified substrings within the input string.
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the smallest index of all substrings within the input string or -1 if none of the substrings occur.
- See also: #indexOfAny(String, String\[\]), #indexOfAny(String, int, String\[\])
-
Signature:
public static int minIndexOfAll(final String str, int fromIndex, final String... valuesToFind) - Summary: Finds the smallest index of all substrings in {@code valuesToFind} within the input string from {@code fromIndex} .
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found from the specified index, or if the input string is {@code null} , if {@code fromIndex} is greater than the string length, or if the substring array is {@code null} or empty.
- If {@code fromIndex} is negative, it is treated as 0.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. Negative values are treated as 0. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the smallest index of all substrings within the input string from {@code fromIndex} or -1 if none of the substrings occur.
- See also: #indexOfAny(String, String\[\]), #indexOfAny(String, int, String\[\])
maxIndexOfAll(...) -> int
-
Signature:
public static int maxIndexOfAll(final String str, final String... valuesToFind) - Summary: Finds the largest index of all substrings in {@code valuesToFind} within the input string.
-
Contract:
- The search is optimized by prioritizing longer substrings when they might affect the result.
- </p> <p> The method returns -1 if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the largest index of all substrings within the input string or -1 if none of the substrings occur.
- See also: #indexOfAny(String, String\[\]), #indexOfAny(String, int, String\[\])
-
Signature:
public static int maxIndexOfAll(final String str, final int fromIndex, final String... valuesToFind) - Summary: Finds the largest index of all substrings in {@code valuesToFind} within the input string from {@code fromIndex} .
-
Contract:
- The search is optimized by prioritizing longer substrings when they might affect the result.
- </p> <p> The method returns -1 if none of the substrings are found from the specified index, or if the input string is {@code null} , if {@code fromIndex} is greater than the string length, or if the substring array is {@code null} or empty.
- If {@code fromIndex} is negative, it is treated as 0.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
fromIndex(int) — the index to start the search from. Negative values are treated as 0. -
valuesToFind(String[]) — the array of substrings to be found, may be {@code null} or empty.
-
- Returns: the largest index of all substrings within the input string from {@code fromIndex} or -1 if none of the substrings occur.
- See also: #indexOfAny(String, String\[\]), #indexOfAny(String, int, String\[\])
minLastIndexOfAll(...) -> int
-
Signature:
public static int minLastIndexOfAll(final String str, final String... valuesToFind) - Summary: Finds the smallest last index of all substrings in {@code valuesToFind} within the input string.
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to search within, may be {@code null} . -
valuesToFind(String[]) — the substrings to find within the string, may be empty or {@code null} .
-
- Returns: the smallest last index of all substrings within the input string or -1 if none of the substrings occur.
- See also: #lastIndexOfAny(String, String\[\]), #lastIndexOfAny(String, char\[\])
-
Signature:
public static int minLastIndexOfAll(final String str, int startIndexFromBack, final String... valuesToFind) - Summary: Finds the smallest last index of all substrings in {@code valuesToFind} within the input string from {@code startIndexFromBack} .
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found at or before the specified index, or if the input string is {@code null} , if {@code startIndexFromBack} is negative, or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to search within, may be {@code null} . -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched. -
valuesToFind(String[]) — the substrings to find within the string, may be empty or {@code null} .
-
- Returns: the smallest index of all substrings within the input string from {@code startIndexFromBack} or -1 if none of the substrings occur.
- See also: #lastIndexOfAny(String, String\[\]), #lastIndexOfAny(String, char\[\])
maxLastIndexOfAll(...) -> int
-
Signature:
public static int maxLastIndexOfAll(final String str, final String... valuesToFind) - Summary: Finds the largest last index of all substrings in {@code valuesToFind} within the input string.
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found, or if the input string is {@code null} , or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to search within, may be {@code null} . -
valuesToFind(String[]) — the substrings to find within the string, may be empty or {@code null} .
-
- Returns: the largest last index of all substrings within the input string or -1 if none of the substrings occur.
- See also: #lastIndexOfAny(String, String\[\]), #lastIndexOfAny(String, char\[\])
-
Signature:
public static int maxLastIndexOfAll(final String str, int startIndexFromBack, final String... valuesToFind) - Summary: Finds the largest last index of all substrings in {@code valuesToFind} within the input string from {@code startIndexFromBack} .
-
Contract:
- </p> <p> The method returns -1 if none of the substrings are found at or before the specified index, or if the input string is {@code null} , if {@code startIndexFromBack} is negative, or if the substring array is {@code null} or empty.
-
Parameters:
-
str(String) — the string to search within, may be {@code null} . -
startIndexFromBack(int) — the index to start the search from, searching backward. If greater than or equal to the string length, the entire string is searched. -
valuesToFind(String[]) — the substrings to find within the string, may be empty or {@code null} .
-
- Returns: the largest index of all substrings within the input string from {@code startIndexFromBack} or -1 if none of the substrings occur.
- See also: #lastIndexOfAny(String, String\[\]), #lastIndexOfAny(String, char\[\])
ordinalIndexOf(...) -> int
-
Signature:
public static int ordinalIndexOf(final String str, final String valueToFind, final int ordinal) - Summary: Finds the n-th occurrence of the specified value within the input string.
-
Contract:
- The ordinal parameter must be greater than or equal to 1.
- </p> <p> The method returns -1 if the value does not occur as many times as requested, or if either the input string or the value to find is {@code null} , or if the value is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the value to be found, may be {@code null} . -
ordinal(int) — the n-th occurrence to find. Must be greater than or equal to 1.
-
- Returns: the index of the n-th occurrence of the specified value within the input string, or -1 if the value does not occur as many times as requested.
lastOrdinalIndexOf(...) -> int
-
Signature:
public static int lastOrdinalIndexOf(final String str, final String valueToFind, final int ordinal) - Summary: Finds the n-th last occurrence of the specified value within the input string.
-
Contract:
- The ordinal parameter must be greater than or equal to 1.
- </p> <p> The method returns -1 if the value does not occur as many times as requested, or if either the input string or the value to find is {@code null} , or if the value is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty. -
valueToFind(String) — the value to be found, may be {@code null} . -
ordinal(int) — the n-th last occurrence to find. Must be greater than or equal to 1.
-
- Returns: the index of the n-th last occurrence of the specified value within the input string, or -1 if the value does not occur as many times as requested.
indicesOf(...) -> IntStream
-
Signature:
public static IntStream indicesOf(final String str, final String valueToFind) - Summary: Returns a stream of indices of all occurrences of the specified substring.
-
Contract:
- If the substring is empty, it returns indices of all positions in the string (0 through string length).
- </p> <p> The method returns an empty stream if the input string or the substring to find is {@code null} , or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null}
-
- Returns: a stream of indices of all occurrences of the specified substring, or an empty stream if the substring is not found
- See also: RegExUtil#matchIndices(String, String), RegExUtil#matchIndices(String, Pattern), IntStream#ofIndices(Object, int, int, com.landawn.abacus.util.function.ObjIntFunction)
-
Signature:
public static IntStream indicesOf(final String str, final String valueToFind, final int fromIndex) - Summary: Returns a stream of indices of all occurrences of the specified substring, starting the search at the specified index.
-
Contract:
- If the substring is empty, it returns indices of all positions in the string from {@code fromIndex} to string length.
- </p> <p> The method returns an empty stream if the input string or the substring to find is {@code null} , or if the substring is longer than the remaining part of the input string from {@code fromIndex} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null} -
fromIndex(int) — the index to start the search from
-
- Returns: a stream of indices of all occurrences of the specified substring, or an empty stream if the substring is not found
- See also: RegExUtil#matchIndices(String, String), RegExUtil#matchIndices(String, Pattern), IntStream#ofIndices(Object, int, int, com.landawn.abacus.util.function.ObjIntFunction)
indicesOfIgnoreCase(...) -> IntStream
-
Signature:
public static IntStream indicesOfIgnoreCase(final String str, final String valueToFind) - Summary: Returns a stream of indices of all occurrences of the specified substring, ignoring case considerations.
-
Contract:
- If the substring is empty, it returns indices of all positions in the string (0 through string length).
- </p> <p> The method returns an empty stream if the input string or the substring to find is {@code null} , or if the substring is longer than the input string.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null}
-
- Returns: a stream of indices of all occurrences of the specified substring, or an empty stream if the substring is not found
- See also: #indicesOf(String, String), RegExUtil#matchIndices(String, String), RegExUtil#matchIndices(String, Pattern), IntStream#ofIndices(Object, int, int, com.landawn.abacus.util.function.ObjIntFunction)
-
Signature:
public static IntStream indicesOfIgnoreCase(final String str, final String valueToFind, final int fromIndex) - Summary: Returns a stream of indices of all occurrences of the specified substring, starting the search at the specified index, ignoring case considerations.
-
Contract:
- If the substring is empty, it returns indices of all positions in the string from {@code fromIndex} to string length.
- </p> <p> The method returns an empty stream if the input string or the substring to find is {@code null} , or if the substring is longer than the remaining part of the input string from {@code fromIndex} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null} -
fromIndex(int) — the index to start the search from
-
- Returns: a stream of indices of all occurrences of the specified substring, or an empty stream if the substring is not found
- See also: #indicesOf(String, String, int), RegExUtil#matchIndices(String, String), RegExUtil#matchIndices(String, Pattern), IntStream#ofIndices(Object, int, int, com.landawn.abacus.util.function.ObjIntFunction)
countMatches(...) -> int
-
Signature:
@SuppressWarnings("deprecation") public static int countMatches(final String str, final char charValueToFind) - Summary: Counts the number of occurrences of the specified character in the given string.
-
Contract:
- If the input string is {@code null} or empty, the method returns 0.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
charValueToFind(char) — the character to be counted
-
- Returns: the number of occurrences of the specified character in the string, or 0 if the string is {@code null} or empty
- See also: N#occurrencesOf(String, char)
-
Signature:
public static int countMatches(final String str, final String valueToFind) - Summary: Counts the number of occurrences of the specified substring in the given string.
-
Contract:
- If either the input string or the substring to find is {@code null} or empty, the method returns 0.
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be counted
-
- Returns: the number of occurrences of the specified substring in the string, or 0 if either parameter is {@code null} or empty
- See also: N#occurrencesOf(String, String)
contains(...) -> boolean
-
Signature:
public static boolean contains(final String str, final char charValueToFind) - Summary: Checks if the specified character is present in the given string.
-
Contract:
- Checks if the specified character is present in the given string.
- If the input string is {@code null} or empty, the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
charValueToFind(char) — the character to be found
-
- Returns: {@code true} if the character is found in the string, {@code false} otherwise
-
Signature:
public static boolean contains(final String str, final String valueToFind) - Summary: Checks if the specified substring is present in the given string.
-
Contract:
- Checks if the specified substring is present in the given string.
- If either the input string or the substring is {@code null} , the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null}
-
- Returns: {@code true} if the substring is found in the string, {@code false} otherwise
-
Signature:
public static boolean contains(final String str, final String valueToFind, final String delimiter) - Summary: Checks if the specified substring is present in the given string, considering the specified delimiter.
-
Contract:
- Checks if the specified substring is present in the given string, considering the specified delimiter.
- The method only returns {@code true} if the substring appears as a complete token, not as part of another token.
- </p> <p> If either the input string or the substring is {@code null} , the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null} -
delimiter(String) — the delimiter to be considered, may be {@code null}
-
- Returns: {@code true} if the substring is found as a complete token in the string considering the delimiter, {@code false} otherwise
containsIgnoreCase(...) -> boolean
-
Signature:
public static boolean containsIgnoreCase(final String str, final String valueToFind) - Summary: Checks if the specified substring is present in the given string, ignoring case considerations.
-
Contract:
- Checks if the specified substring is present in the given string, ignoring case considerations.
- If either the input string or the substring is {@code null} , the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null}
-
- Returns: {@code true} if the substring is found in the string ignoring case considerations, {@code false} otherwise
-
Signature:
public static boolean containsIgnoreCase(final String str, final String valueToFind, final String delimiter) - Summary: Checks if the specified substring is present in the given string, considering the specified delimiter and ignoring case considerations.
-
Contract:
- Checks if the specified substring is present in the given string, considering the specified delimiter and ignoring case considerations.
- The method only returns {@code true} if the substring appears as a complete token, not as part of another token.
- </p> <p> If either the input string or the substring is {@code null} , the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valueToFind(String) — the substring to be found, may be {@code null} -
delimiter(String) — the delimiter to be considered, may be {@code null}
-
- Returns: {@code true} if the substring is found as a complete token in the string considering the delimiter and ignoring case considerations, {@code false} otherwise
containsAll(...) -> boolean
-
Signature:
public static boolean containsAll(final String str, final char... valuesToFind) throws IllegalArgumentException - Summary: Checks if all the specified characters are present in the given string.
-
Contract:
- Checks if all the specified characters are present in the given string.
- The method returns {@code true} if the specified character array is empty or {@code null} .
- If the input string is {@code null} or empty but the character array is not empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all characters are present Strings.containsAll("hello world", 'h', 'e', 'l'); // returns true Strings.containsAll("hello world", 'h', 'x'); // returns {@code false} ('x' not present) Strings.containsAll("test", 't', 'e', 's'); // returns true Strings.containsAll("test"); // returns {@code true} (empty array) Strings.containsAll(null, 'a'); // returns false Strings.containsAll("", 'a'); // returns false Strings.containsAll("abc", '\\udc00', 'a'); // throws IllegalArgumentException for Character.isLowSurrogate('\\udc00') is true Strings.containsAll("abc", '\\udfff', 'a'); // throws IllegalArgumentException for Character.isHighSurrogate('\\udfff') is true } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(char[]) — the array of characters to be found
-
- Returns: {@code true} if all the characters are found in the given string, or if the {@code valuesToFind} array is {@code null} or empty. Returns {@code false} otherwise.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
-
Signature:
public static boolean containsAll(final String str, final String... valuesToFind) - Summary: Checks if all the specified substrings are present in the given string.
-
Contract:
- Checks if all the specified substrings are present in the given string.
- The method returns {@code true} if the specified substring array is empty or {@code null} .
- If the input string is {@code null} or empty but the substring array is not empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all substrings are present Strings.containsAll("hello world", "hello", "world"); // returns true Strings.containsAll("hello world", "hello", "xyz"); // returns false Strings.containsAll("programming", "gram", "pro"); // returns true Strings.containsAll("test"); // returns {@code true} (empty array) Strings.containsAll(null, "test"); // returns false Strings.containsAll("", "test"); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be found
-
- Returns: {@code true} if all the substrings are found in the given string, or if the substring array is {@code null} or empty. Returns {@code false} otherwise.
containsAllIgnoreCase(...) -> boolean
-
Signature:
public static boolean containsAllIgnoreCase(final String str, final String... valuesToFind) - Summary: Checks if all the specified substrings are present in the given string, ignoring case considerations.
-
Contract:
- Checks if all the specified substrings are present in the given string, ignoring case considerations.
- The method returns {@code true} if the specified substring array is empty or {@code null} .
- If the input string is {@code null} or empty but the substring array is not empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all substrings are present ignoring case Strings.containsAllIgnoreCase("Hello World", "HELLO", "world"); // returns true Strings.containsAllIgnoreCase("Hello World", "HELLO", "XYZ"); // returns false Strings.containsAllIgnoreCase("Programming", "GRAM", "PRO"); // returns true Strings.containsAllIgnoreCase("test"); // returns {@code true} (empty array) Strings.containsAllIgnoreCase(null, "test"); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be found
-
- Returns: {@code true} if all the substrings are found in the given string (ignoring case), or if the substring array is {@code null} or empty. Returns {@code false} otherwise.
containsAny(...) -> boolean
-
Signature:
public static boolean containsAny(final String str, final char... valuesToFind) - Summary: Checks if any of the specified characters are present in the given string.
-
Contract:
- Checks if any of the specified characters are present in the given string.
- If either the input string or the character array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any character is present Strings.containsAny("hello", 'a', 'e', 'i'); // returns {@code true} ('e' is present) Strings.containsAny("hello", 'x', 'y', 'z'); // returns false Strings.containsAny("test", 't'); // returns true Strings.containsAny("", 'a'); // returns false Strings.containsAny(null, 'a'); // returns false Strings.containsAny("test"); // returns {@code false} (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(char[]) — the array of characters to be found
-
- Returns: {@code true} if any of the characters are found in the given string. Returns {@code false} if no characters are found, or if the string or {@code valuesToFind} array is {@code null} or empty.
- See also: #containsNone(String, char\[\])
-
Signature:
public static boolean containsAny(final String str, final String... valuesToFind) - Summary: Checks if any of the specified substrings are present in the given string.
-
Contract:
- Checks if any of the specified substrings are present in the given string.
- If either the input string or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any substring is present Strings.containsAny("hello world", "xyz", "world"); // returns {@code true} ("world" is present) Strings.containsAny("hello world", "xyz", "abc"); // returns false Strings.containsAny("programming", "gram", "xyz"); // returns true Strings.containsAny("", "test"); // returns false Strings.containsAny(null, "test"); // returns false Strings.containsAny(null, ""); // returns false Strings.containsAny(null, null); // returns false Strings.containsAny("", ""); // returns false Strings.containsAny("", null); // returns false Strings.containsAny("test"); // returns {@code false} (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be found
-
- Returns: {@code true} if any of the substrings are found in the given string. Returns {@code false} if no substrings are found, or if the string or substrings array is {@code null} or empty.
- See also: #containsNone(String, String\[\])
containsAnyIgnoreCase(...) -> boolean
-
Signature:
public static boolean containsAnyIgnoreCase(final String str, final String... valuesToFind) - Summary: Checks if any of the specified substrings are present in the given string, ignoring case considerations.
-
Contract:
- Checks if any of the specified substrings are present in the given string, ignoring case considerations.
- If either the input string or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any substring is present ignoring case Strings.containsAnyIgnoreCase("Hello World", "xyz", "WORLD"); // returns true Strings.containsAnyIgnoreCase("Hello World", "XYZ", "ABC"); // returns false Strings.containsAnyIgnoreCase("Programming", "GRAM", "xyz"); // returns true Strings.containsAnyIgnoreCase("", "test"); // returns false Strings.containsAnyIgnoreCase(null, "test"); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be found
-
- Returns: {@code true} if any of the substrings are found in the given string (ignoring case). Returns {@code false} if no substrings are found, or if the string or substrings array is {@code null} or empty.
- See also: #containsNoneIgnoreCase(String, String\[\])
containsNone(...) -> boolean
-
Signature:
public static boolean containsNone(final String str, final char... valuesToFind) throws IllegalArgumentException - Summary: Checks if none of the specified characters are present in the given string.
-
Contract:
- Checks if none of the specified characters are present in the given string.
- The method returns {@code true} if the string is {@code null} or empty, or if the specified character array is empty or {@code null} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if none of the characters are present Strings.containsNone("hello", 'x', 'y', 'z'); // returns true Strings.containsNone("hello", 'h', 'x'); // returns false ('h' is present) Strings.containsNone("test", 'a', 'b', 'c'); // returns true Strings.containsNone("", 'a'); // returns true Strings.containsNone(null, 'a'); // returns true Strings.containsNone("test"); // returns true (empty array) Strings.containsNone("abc", '\\udc00', 'a'); // throws IllegalArgumentException (Character.isLowSurrogate('\\udc00') is true) Strings.containsNone("abc", '\\ud800', 'a'); // throws IllegalArgumentException (Character.isHighSurrogate('\\ud800') is true) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(char[]) — the array of characters to be checked
-
- Returns: {@code true} if none of the characters are found in the given string or if the given string is {@code null} or empty, or if the specified {@code valuesToFind} char array is {@code null} or empty, {@code false} otherwise
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code valuesToFind} contains low-surrogate or high-surrogate code unit.
-
- See also: #containsAny(String, char\[\])
-
Signature:
public static boolean containsNone(final String str, final String... valuesToFind) - Summary: Checks if none of the specified substrings are present in the given string.
-
Contract:
- Checks if none of the specified substrings are present in the given string.
- If either the input string or the substring array is {@code null} or empty, the method returns {@code true} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if none of the substrings are present Strings.containsNone("hello world", "xyz", "abc"); // returns true Strings.containsNone("hello world", "hello", "xyz"); // returns false ("hello" is present) Strings.containsNone("test", "abc", "xyz"); // returns true Strings.containsNone("", "test"); // returns true Strings.containsNone(null, "test"); // returns true Strings.containsNone(null, null); // returns true Strings.containsNone("", ""); // returns true Strings.containsNone("", null); // returns true } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if none of the substrings are found in the given string or if the given string is {@code null} or empty, or if the specified {@code valuesToFind} char array is {@code null} or empty, {@code false} otherwise
- See also: #containsAny(String, String\[\])
containsNoneIgnoreCase(...) -> boolean
-
Signature:
public static boolean containsNoneIgnoreCase(final String str, final String... valuesToFind) - Summary: Checks if none of the specified substrings are present in the given string, ignoring case considerations.
-
Contract:
- Checks if none of the specified substrings are present in the given string, ignoring case considerations.
- The method returns {@code true} if the string is {@code null} or empty, or if the specified substring array is empty or {@code null} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if none of the substrings are present ignoring case Strings.containsNoneIgnoreCase("Hello World", "xyz", "abc"); // returns true Strings.containsNoneIgnoreCase("Hello World", "HELLO", "xyz"); // returns false Strings.containsNoneIgnoreCase("test", "ABC", "XYZ"); // returns true Strings.containsNoneIgnoreCase("", "test"); // returns true Strings.containsNoneIgnoreCase(null, "test"); // returns true } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if none of the substrings are found in the given string or if the given string is {@code null} or empty, or if the specified {@code valuesToFind} char array is {@code null} or empty, ignoring case considerations, {@code false} otherwise
- See also: #containsAnyIgnoreCase(String, String\[\])
containsOnly(...) -> boolean
-
Signature:
public static boolean containsOnly(final String str, final char... valuesToFind) - Summary: Checks if the given string contains only the specified characters.
-
Contract:
- Checks if the given string contains only the specified characters.
- The method returns {@code true} if the string is {@code null} or empty.
- If the character array is {@code null} or empty but the string is not empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string contains only specified characters Strings.containsOnly("aaa", 'a'); // returns true Strings.containsOnly("abc", 'a', 'b', 'c', 'd'); // returns true Strings.containsOnly("abcd", 'a', 'b', 'c'); // returns false ('d' not allowed) Strings.containsOnly("", 'a'); // returns true Strings.containsOnly(null, 'a'); // returns true Strings.containsOnly("test"); // returns false (empty allowed set) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
valuesToFind(char[]) — the character to be checked
-
- Returns: {@code true} if the given string contains only the specified character or the given string is {@code null} or empty, {@code false} otherwise
containsWhitespace(...) -> boolean
-
Signature:
public static boolean containsWhitespace(final String str) - Summary: Checks if the given string contains any whitespace characters.
-
Contract:
- Checks if the given string contains any whitespace characters.
- If the string is {@code null} or empty, the method returns {@code false} .
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty
-
- Returns: {@code true} if the string contains any whitespace characters, {@code false} otherwise
startsWith(...) -> boolean
-
Signature:
public static boolean startsWith(final String str, final String prefix) - Summary: Checks if the given string starts with the specified prefix.
-
Contract:
- Checks if the given string starts with the specified prefix.
- If either the string or the prefix is {@code null} , or if the prefix is longer than the string, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string starts with prefix Strings.startsWith("hello world", "hello"); // returns true Strings.startsWith("hello world", "Hello"); // returns false (case-sensitive) Strings.startsWith("hello", "hello world"); // returns false (prefix too long) Strings.startsWith("test", ""); // returns true (empty prefix) Strings.startsWith(null, "test"); // returns false Strings.startsWith("test", null); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
prefix(String) — the prefix to be checked
-
- Returns: {@code true} if the string starts with the specified prefix, {@code false} otherwise
startsWithIgnoreCase(...) -> boolean
-
Signature:
public static boolean startsWithIgnoreCase(final String str, final String prefix) - Summary: Checks if the given string starts with the specified prefix, ignoring case considerations.
-
Contract:
- Checks if the given string starts with the specified prefix, ignoring case considerations.
- If either the string or the prefix is {@code null} , or if the prefix is longer than the string, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string starts with prefix ignoring case Strings.startsWithIgnoreCase("Hello World", "hello"); // returns true Strings.startsWithIgnoreCase("Hello World", "HELLO"); // returns true Strings.startsWithIgnoreCase("test", "TEST"); // returns true Strings.startsWithIgnoreCase("hello", "hello world"); // returns false (prefix too long) Strings.startsWithIgnoreCase(null, "test"); // returns false Strings.startsWithIgnoreCase("test", null); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
prefix(String) — the prefix to be checked
-
- Returns: {@code true} if the string starts with the specified prefix, ignoring case considerations, {@code false} otherwise
startsWithAny(...) -> boolean
-
Signature:
public static boolean startsWithAny(final String str, final String... substrs) - Summary: Checks if the given string starts with any of the specified substrings.
-
Contract:
- Checks if the given string starts with any of the specified substrings.
- If the string is {@code null} or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string starts with any prefix Strings.startsWithAny("hello world", "hi", "hello"); // returns true Strings.startsWithAny("hello world", "Hi", "Hello"); // returns false (case-sensitive) Strings.startsWithAny("test", "a", "b", "t"); // returns true Strings.startsWithAny("test", "a", "b", "c"); // returns false Strings.startsWithAny(null, "test"); // returns false Strings.startsWithAny("test"); // returns false (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
substrs(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if the string starts with any of the specified substrings, {@code false} otherwise
startsWithAnyIgnoreCase(...) -> boolean
-
Signature:
public static boolean startsWithAnyIgnoreCase(final String str, final String... substrs) - Summary: Checks if the given string starts with any of the specified substrings, ignoring case considerations.
-
Contract:
- Checks if the given string starts with any of the specified substrings, ignoring case considerations.
- If the string is {@code null} or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string starts with any prefix ignoring case Strings.startsWithAnyIgnoreCase("Hello World", "hi", "hello"); // returns true Strings.startsWithAnyIgnoreCase("Hello World", "HI", "HELLO"); // returns true Strings.startsWithAnyIgnoreCase("test", "A", "B", "T"); // returns true Strings.startsWithAnyIgnoreCase("test", "A", "B", "C"); // returns false Strings.startsWithAnyIgnoreCase(null, "test"); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
substrs(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if the string starts with any of the specified substrings, ignoring case considerations, {@code false} otherwise
endsWith(...) -> boolean
-
Signature:
public static boolean endsWith(final String str, final String suffix) - Summary: Checks if the given string ends with the specified suffix.
-
Contract:
- Checks if the given string ends with the specified suffix.
- If either the string or the suffix is {@code null} , or if the suffix is longer than the string, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string ends with suffix Strings.endsWith("hello world", "world"); // returns true Strings.endsWith("hello world", "World"); // returns false (case-sensitive) Strings.endsWith("hello", "hello world"); // returns false (suffix too long) Strings.endsWith("test", ""); // returns true (empty suffix) Strings.endsWith(null, "test"); // returns false Strings.endsWith("test", null); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
suffix(String) — the suffix to be checked
-
- Returns: {@code true} if the string ends with the specified suffix, {@code false} otherwise
endsWithIgnoreCase(...) -> boolean
-
Signature:
public static boolean endsWithIgnoreCase(final String str, final String suffix) - Summary: Checks if the given string ends with the specified suffix, ignoring case considerations.
-
Contract:
- Checks if the given string ends with the specified suffix, ignoring case considerations.
- If either the string or the suffix is {@code null} , or if the suffix is longer than the string, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string ends with suffix ignoring case Strings.endsWithIgnoreCase("Hello World", "world"); // returns true Strings.endsWithIgnoreCase("Hello World", "WORLD"); // returns true Strings.endsWithIgnoreCase("test", "TEST"); // returns true Strings.endsWithIgnoreCase("hello", "hello world"); // returns false (suffix too long) Strings.endsWithIgnoreCase(null, "test"); // returns false Strings.endsWithIgnoreCase("test", null); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
suffix(String) — the suffix to be checked
-
- Returns: {@code true} if the string ends with the specified suffix, ignoring case considerations, {@code false} otherwise
endsWithAny(...) -> boolean
-
Signature:
public static boolean endsWithAny(final String str, final String... substrs) - Summary: Checks if the given string ends with any of the specified substrings.
-
Contract:
- Checks if the given string ends with any of the specified substrings.
- If the string is {@code null} or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string ends with any suffix Strings.endsWithAny("hello.txt", ".txt", ".doc"); // returns true Strings.endsWithAny("hello.txt", ".TXT", ".DOC"); // returns false (case-sensitive) Strings.endsWithAny("test", "st", "ing"); // returns true Strings.endsWithAny("test", "ing", "ed"); // returns false Strings.endsWithAny(null, "test"); // returns false Strings.endsWithAny("test"); // returns false (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
substrs(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if the string ends with any of the specified substrings, {@code false} otherwise
endsWithAnyIgnoreCase(...) -> boolean
-
Signature:
public static boolean endsWithAnyIgnoreCase(final String str, final String... substrs) - Summary: Checks if the given string ends with any of the specified substrings, ignoring case considerations.
-
Contract:
- Checks if the given string ends with any of the specified substrings, ignoring case considerations.
- If the string is {@code null} or the substring array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string ends with any suffix ignoring case Strings.endsWithAnyIgnoreCase("hello.txt", ".TXT", ".DOC"); // returns true Strings.endsWithAnyIgnoreCase("HELLO.TXT", ".txt", ".doc"); // returns true Strings.endsWithAnyIgnoreCase("test", "ST", "ING"); // returns true Strings.endsWithAnyIgnoreCase("test", "ING", "ED"); // returns false Strings.endsWithAnyIgnoreCase(null, "test"); // returns false } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} or empty -
substrs(String[]) — the array of substrings to be checked
-
- Returns: {@code true} if the string ends with any of the specified substrings, ignoring case considerations, {@code false} otherwise
equals(...) -> boolean
-
Signature:
public static boolean equals(final String a, final String b) - Summary: Compares two strings for equality.
-
Contract:
- <p> This method checks if two strings are equal, handling {@code null} values safely.
- </p> <p> This method is null-safe and more efficient than using {@link String#equals(Object)} when either string might be {@code null} .
-
Parameters:
-
a(String) — the first string to compare, may be {@code null} -
b(String) — the second string to compare, may be {@code null}
-
- Returns: {@code true} if the strings are equal, {@code false} otherwise
equalsIgnoreCase(...) -> boolean
-
Signature:
public static boolean equalsIgnoreCase(final String a, final String b) - Summary: Compares two strings for equality, ignoring case considerations.
-
Contract:
- <p> This method checks if two strings are equal ignoring their case, handling {@code null} values safely.
-
Parameters:
-
a(String) — the first string to compare, may be {@code null} -
b(String) — the second string to compare, may be {@code null}
-
- Returns: {@code true} if the strings are equal, ignoring case considerations, {@code false} otherwise
equalsAny(...) -> boolean
-
Signature:
public static boolean equalsAny(final String str, final String... searchStrings) - Summary: Checks if the given string is equal to any of the specified search strings.
-
Contract:
- Checks if the given string is equal to any of the specified search strings.
- If the search string array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string equals any value Strings.equalsAny("test", "test", "demo", "sample"); // returns true Strings.equalsAny("test", "Test", "TEST"); // returns false (case-sensitive) Strings.equalsAny(null, "test", null, "demo"); // returns true (null match) Strings.equalsAny("test", "demo", "sample"); // returns false Strings.equalsAny("test"); // returns false (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} -
searchStrings(String[]) — the array of strings to compare against, may be {@code null} or empty
-
- Returns: {@code true} if the string is equal to any of the specified search strings, {@code false} otherwise
equalsAnyIgnoreCase(...) -> boolean
-
Signature:
public static boolean equalsAnyIgnoreCase(final String str, final String... searchStrs) - Summary: Checks if the given string is equal to any of the specified search strings, ignoring case considerations.
-
Contract:
- Checks if the given string is equal to any of the specified search strings, ignoring case considerations.
- If the search string array is {@code null} or empty, the method returns {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if string equals any value ignoring case Strings.equalsAnyIgnoreCase("test", "TEST", "demo"); // returns true Strings.equalsAnyIgnoreCase("Test", "test", "TEST"); // returns true Strings.equalsAnyIgnoreCase(null, "test", null); // returns true (null match) Strings.equalsAnyIgnoreCase("test", "demo", "sample"); // returns false Strings.equalsAnyIgnoreCase("test"); // returns false (empty array) } </pre>
-
Parameters:
-
str(String) — the string to be checked, may be {@code null} -
searchStrs(String[]) — the array of strings to compare against, may be {@code null} or empty
-
- Returns: {@code true} if the string is equal to any of the specified search strings, ignoring case considerations, {@code false} otherwise
compareIgnoreCase(...) -> int
-
Signature:
public static int compareIgnoreCase(final String a, final String b) - Summary: Compares two strings lexicographically, ignoring case considerations.
-
Contract:
- If both strings are {@code null} , they are considered equal (returns 0).
-
Parameters:
-
a(String) — the first string to compare, may be {@code null} -
b(String) — the second string to compare, may be {@code null}
-
- Returns: a negative integer, zero, or a positive integer as the first string is less than, equal to, or greater than the second string, ignoring case considerations
indexOfDifference(...) -> int
-
Signature:
public static int indexOfDifference(final String a, final String b) - Summary: Compares two Strings and returns the index at which the Strings begin to differ.
-
Contract:
- If the strings are equal or both are empty (including {@code null} ), the method returns -1.
- If one string is a prefix of the other, the method returns the length of the shorter string.
-
Parameters:
-
a(String) — the first String, may be {@code null} -
b(String) — the second String, may be {@code null}
-
- Returns: the index where the strings begin to differ, or -1 if they are equal
-
Signature:
public static int indexOfDifference(final String... strs) - Summary: Compares all Strings in an array and returns the index at which the Strings begin to differ.
-
Contract:
- If all strings are equal, the array is empty, has only one element, or all elements are {@code null} /empty, the method returns -1.
- If any string is {@code null} , it's treated as having length 0.
- If all strings are identical up to that point but have different lengths, the method returns the length of the shortest string.
-
Parameters:
-
strs(String[]) — array of Strings, entries may be null
-
- Returns: the index where strings begin to differ, or -1 if all strings are equal or null/empty
lengthOfCommonPrefix(...) -> int
-
Signature:
public static int lengthOfCommonPrefix(final CharSequence a, final CharSequence b) - Summary: Returns the length of the common prefix between two CharSequences.
-
Contract:
- The comparison stops when a mismatch is found or when the end of either CharSequence is reached.
- </p> <p> The method returns 0 if either CharSequence is {@code null} or empty.
-
Parameters:
-
a(CharSequence) — the first CharSequence to compare, may be {@code null} -
b(CharSequence) — the second CharSequence to compare, may be {@code null}
-
- Returns: the length of the common prefix, or 0 if either CharSequence is {@code null} or empty.
- See also: #commonPrefix(CharSequence, CharSequence), #lengthOfCommonSuffix(CharSequence, CharSequence)
lengthOfCommonSuffix(...) -> int
-
Signature:
public static int lengthOfCommonSuffix(final CharSequence a, final CharSequence b) - Summary: Returns the length of the common suffix between two CharSequences.
-
Contract:
- The comparison stops when a mismatch is found or when the beginning of either CharSequence is reached.
- </p> <p> The method returns 0 if either CharSequence is {@code null} or empty.
-
Parameters:
-
a(CharSequence) — the first CharSequence to compare, may be {@code null} -
b(CharSequence) — the second CharSequence to compare, may be {@code null}
-
- Returns: the length of the common suffix, or 0 if either CharSequence is {@code null} or empty.
- See also: #commonSuffix(CharSequence, CharSequence), #lengthOfCommonPrefix(CharSequence, CharSequence)
commonPrefix(...) -> String
-
Signature:
public static String commonPrefix(final CharSequence a, final CharSequence b) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- If {@code a} and {@code b} have no common prefix, returns the empty string.
-
Parameters:
-
a(CharSequence) — the first CharSequence to compare, may be {@code null} -
b(CharSequence) — the second CharSequence to compare, may be {@code null}
-
- Returns: the longest common prefix, or an empty string if there is no common prefix
-
Signature:
public static String commonPrefix(final CharSequence... strs) - Summary: Returns the longest common prefix among an array of CharSequences.
-
Contract:
- </p> <p> The method returns an empty string if the array is empty, {@code null} , any CharSequence is {@code null} or empty, or if there is no common prefix among the CharSequences.
-
Parameters:
-
strs(CharSequence[]) — the array of CharSequences to compare. It can be empty or contain {@code null} elements.
-
- Returns: the longest common prefix among the given CharSequences, or an empty string if no common prefix exists.
- See also: #commonPrefix(CharSequence, CharSequence), #lengthOfCommonPrefix(CharSequence, CharSequence)
commonSuffix(...) -> String
-
Signature:
public static String commonSuffix(final CharSequence a, final CharSequence b) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- If {@code a} and {@code b} have no common suffix, returns the empty string.
-
Parameters:
-
a(CharSequence) — the first CharSequence to compare, may be {@code null} -
b(CharSequence) — the second CharSequence to compare, may be {@code null}
-
- Returns: the longest common suffix, or an empty string if there is no common suffix
-
Signature:
public static String commonSuffix(final CharSequence... strs) - Summary: Returns the longest common suffix among an array of CharSequences.
-
Contract:
- </p> <p> The method returns an empty string if the array is empty, {@code null} , any CharSequence is {@code null} or empty, or if there is no common suffix among the CharSequences.
-
Parameters:
-
strs(CharSequence[]) — the array of CharSequences to compare. It can be empty or contain {@code null} elements.
-
- Returns: the longest common suffix among the given CharSequences, or an empty string if no common suffix exists.
- See also: #commonSuffix(CharSequence, CharSequence), #lengthOfCommonSuffix(CharSequence, CharSequence)
longestCommonSubstring(...) -> String
-
Signature:
public static String longestCommonSubstring(final CharSequence a, final CharSequence b) - Summary: Returns the longest common substring between two given CharSequences.
-
Contract:
- </p> <p> The method returns an empty string if either CharSequence is {@code null} , empty, or if there is no common substring.
-
Parameters:
-
a(CharSequence) — the first CharSequence to compare, may be {@code null} -
b(CharSequence) — the second CharSequence to compare, may be {@code null}
-
- Returns: the longest common substring, or an empty string if no common substring exists.
- See also: #commonPrefix(CharSequence, CharSequence), #commonSuffix(CharSequence, CharSequence)
firstChar(...) -> OptionalChar
-
Signature:
public static OptionalChar firstChar(final String str) - Summary: Returns the first character of the given string as an OptionalChar.
-
Contract:
- If the string is {@code null} or empty, an empty OptionalChar is returned, allowing for safe handling of edge cases without throwing exceptions.
-
Parameters:
-
str(String) — the input string from which to extract the first character, may be {@code null} or empty
-
- Returns: an OptionalChar containing the first character of the string, or an empty OptionalChar if the string is {@code null} or empty.
- See also: #lastChar(String), OptionalChar
lastChar(...) -> OptionalChar
-
Signature:
public static OptionalChar lastChar(final String str) - Summary: Returns the last character of the given string as an OptionalChar.
-
Contract:
- If the string is {@code null} or empty, an empty OptionalChar is returned, allowing for safe handling of edge cases without throwing exceptions.
-
Parameters:
-
str(String) — the input string from which to extract the last character, may be {@code null} or empty
-
- Returns: an OptionalChar containing the last character of the string, or an empty OptionalChar if the string is {@code null} or empty.
- See also: #firstChar(String), OptionalChar
firstChars(...) -> String
-
Signature:
@Beta public static String firstChars(final String str, final int n) throws IllegalArgumentException - Summary: Returns at most the first {@code n} characters of the specified string.
-
Contract:
- If the string length is less than or equal to {@code n} , the entire string is returned.
- If the string is {@code null} or empty, or if {@code n} is 0, an empty string is returned.
-
Parameters:
-
str(String) — the input string from which to extract characters, may be {@code null} or empty -
n(int) — the maximum number of characters to return from the beginning of the string.
-
- Returns: at most the first {@code n} characters of the string, or an empty string if the input is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
- See also: #lastChars(String, int)
lastChars(...) -> String
-
Signature:
@Beta public static String lastChars(final String str, final int n) throws IllegalArgumentException - Summary: Returns at most the last {@code n} characters of the specified string.
-
Contract:
- If the string length is less than or equal to {@code n} , the entire string is returned.
- If the string is {@code null} or empty, or if {@code n} is 0, an empty string is returned.
-
Parameters:
-
str(String) — the input string from which to extract characters, may be {@code null} or empty -
n(int) — the maximum number of characters to return from the end of the string.
-
- Returns: at most the last {@code n} characters of the string, or an empty string if the input is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative.
-
- See also: #firstChars(String, int)
substring(...) -> String
-
Signature:
@MayReturnNull public static String substring(final String str, final int inclusiveBeginIndex) - Summary: Returns a substring from the specified string starting at the given index.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , the index is negative, or the index is greater than the string length.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
inclusiveBeginIndex(int) — the starting index of the substring (inclusive).
-
- Returns: the substring starting from the specified index, or {@code null} if the input is invalid.
- See also: StrUtil#substring(String, int), #substring(String, int, int), #substringAfter(String, char)
-
Signature:
@MayReturnNull public static String substring(final String str, final int inclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns a substring from the specified string between the given indices.
-
Contract:
- If {@code exclusiveEndIndex} exceeds the string length, it is adjusted to the string length.
- </p> <p> The method returns {@code null} if the string is {@code null} , either index is negative, or the begin index is greater than the end index or string length.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
inclusiveBeginIndex(int) — the starting index of the substring (inclusive). -
exclusiveEndIndex(int) — the ending index of the substring (exclusive).
-
- Returns: the substring between the specified indices, or {@code null} if the input is invalid.
- See also: StrUtil#substring(String, int, int)
-
Signature:
@MayReturnNull public static String substring(final String str, final int inclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Returns a substring from the specified string using a function to determine the end index.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , the begin index is negative, or if the function returns a negative end index.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
inclusiveBeginIndex(int) — the starting index of the substring (inclusive). -
funcOfExclusiveEndIndex(IntUnaryOperator) — function that calculates the end index based on the begin index.
-
- Returns: the substring determined by the indices, or {@code null} if the input is invalid.
- See also: StrUtil#substring(String, int, IntUnaryOperator), #substring(String, int, int)
-
Signature:
@MayReturnNull public static String substring(final String str, final IntUnaryOperator funcOfInclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns a substring from the specified string using a function to determine the begin index.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , the end index is negative, or if the function returns a negative begin index.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
funcOfInclusiveBeginIndex(IntUnaryOperator) — function that calculates the begin index based on the end index. -
exclusiveEndIndex(int) — the ending index of the substring (exclusive).
-
- Returns: the substring determined by the indices, or {@code null} if the input is invalid.
- See also: StrUtil#substring(String, IntUnaryOperator, int), #substring(String, int, int)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final char delimiterOfInclusiveBeginIndex) - Summary: Returns a substring starting from the first occurrence of the specified character.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , empty, or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} or empty -
delimiterOfInclusiveBeginIndex(char) — the character marking the start of the substring (inclusive).
-
- Returns: the substring starting from the delimiter, or {@code null} if not found.
- See also: #substringAfter(String, char)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final String delimiterOfInclusiveBeginIndex) - Summary: Returns a substring starting from the first occurrence of the specified delimiter string.
-
Contract:
- If the delimiter is empty, the entire string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfInclusiveBeginIndex(String) — the delimiter string marking the start of the substring (inclusive).
-
- Returns: the substring starting from the delimiter, or {@code null} if not found.
- See also: #substringAfter(String, String)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final int inclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Returns a substring between a starting index and the first occurrence of a delimiter character.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , empty, the begin index is invalid, or if the delimiter is not found after the begin index.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} or empty -
inclusiveBeginIndex(int) — the starting index of the substring (inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (exclusive).
-
- Returns: the substring between the index and delimiter, or {@code null} if not found.
- See also: #substring(String, int, int)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns a substring between a starting index and the first occurrence of a delimiter string.
-
Contract:
- If the delimiter is empty, an empty string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , the begin index is invalid, or if the delimiter is not found after the begin index.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
inclusiveBeginIndex(int) — the starting index of the substring (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring (exclusive).
-
- Returns: the substring between the index and delimiter, or {@code null} if not found.
- See also: #substring(String, int, int)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final char delimiterOfInclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns a substring from the last occurrence of a delimiter character to a specified end index.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , empty, the end index is negative, or if the delimiter is not found before the end index.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} or empty -
delimiterOfInclusiveBeginIndex(char) — the character marking the start of the substring (inclusive). -
exclusiveEndIndex(int) — the ending index of the substring (exclusive).
-
- Returns: the substring from the last delimiter to the end index, or {@code null} if not found.
- See also: #substring(String, int, int)
-
Signature:
@MayReturnNull @Deprecated public static String substring(final String str, final String delimiterOfInclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns a substring from the last occurrence of a delimiter string to a specified end index.
-
Contract:
- If the delimiter is empty, an empty string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , the end index is negative, or if the delimiter is not found before the adjusted search position.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfInclusiveBeginIndex(String) — the delimiter string marking the start of the substring (inclusive). -
exclusiveEndIndex(int) — the ending index of the substring (exclusive).
-
- Returns: the substring from the last delimiter to the end index, or {@code null} if not found.
- See also: #substring(String, int, int)
substringAfter(...) -> String
-
Signature:
@MayReturnNull public static String substringAfter(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the first occurrence of the specified delimiter character.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , empty, or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} or empty -
delimiterOfExclusiveBeginIndex(char) — the character after which to extract the substring.
-
- Returns: the substring after the delimiter, or {@code null} if the delimiter is not found.
- See also: #substringBefore(String, char), #substringAfterLast(String, char)
-
Signature:
@MayReturnNull public static String substringAfter(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the first occurrence of the specified delimiter string.
-
Contract:
- If the delimiter is empty, the entire string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which to extract the substring.
-
- Returns: the substring after the delimiter, or {@code null} if the delimiter is not found.
- See also: #substringBefore(String, String), #substringAfterLast(String, String)
-
Signature:
@MayReturnNull public static String substringAfter(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring after the first occurrence of a delimiter, up to a specified end index.
-
Contract:
- If the delimiter is empty, returns the substring from start to the end index.
- </p> <p> The method returns {@code null} if any input is {@code null} , the end index is negative, the delimiter is not found, or if the delimiter's position would exceed the end index.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which to extract the substring. -
exclusiveEndIndex(int) — the ending index of the substring (exclusive).
-
- Returns: the substring after the delimiter up to the end index, or {@code null} if not found.
- See also: #substringAfter(String, String), #substringBetween(String, String, int)
substringAfterIgnoreCase(...) -> String
-
Signature:
@Beta @MayReturnNull public static String substringAfterIgnoreCase(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the first occurrence of the specified delimiter, ignoring case.
-
Contract:
- If the delimiter is empty, the entire string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found (case-insensitive).
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which to extract the substring.
-
- Returns: the substring after the delimiter (case-insensitive), or {@code null} if not found.
- See also: #substringAfter(String, String), #substringAfterLastIgnoreCase(String, String)
substringAfterLast(...) -> String
-
Signature:
@MayReturnNull public static String substringAfterLast(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the last occurrence of the specified delimiter character.
-
Contract:
- </p> <p> The method returns {@code null} if the string is {@code null} , empty, or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} or empty -
delimiterOfExclusiveBeginIndex(char) — the character after which to extract the substring.
-
- Returns: the substring after the last occurrence of the delimiter, or {@code null} if not found.
- See also: #substringAfter(String, char), #substringBeforeLast(String, char)
-
Signature:
@MayReturnNull public static String substringAfterLast(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the last occurrence of the specified delimiter string.
-
Contract:
- If the delimiter is empty, an empty string is returned.
- </p> <p> The method returns {@code null} if the string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
-
Parameters:
-
str(String) — the input string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which to extract the substring.
-
- Returns: the substring after the last occurrence of the delimiter, or {@code null} if not found.
- See also: #substringAfter(String, String), #substringBeforeLast(String, String)
-
Signature:
@MayReturnNull public static String substringAfterLast(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring after the last occurrence of the specified delimiter within the given range.
-
Contract:
- If found, it returns the substring after the delimiter up to the exclusiveEndIndex.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the exclusiveEndIndex is negative, the delimiter is not found, or if the delimiter occurs at or beyond the exclusiveEndIndex.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter to search for, may be {@code null} -
exclusiveEndIndex(int) — the exclusive end index for the search range.
-
- Returns: the substring after the last occurrence of the delimiter within the range, or {@code null} if not found.
substringAfterLastIgnoreCase(...) -> String
-
Signature:
@Beta @MayReturnNull public static String substringAfterLastIgnoreCase(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the last occurrence of the specified delimiter, ignoring case considerations.
-
Contract:
- If found, it returns the substring after the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
- Returns an empty string if the delimiter is empty.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter to search for, case-insensitive, may be {@code null}
-
- Returns: the substring after the last occurrence of the delimiter (case-insensitive), or {@code null} if not found.
substringAfterAny(...) -> String
-
Signature:
@MayReturnNull public static String substringAfterAny(final String str, final char... delimitersOfExclusiveBeginIndex) throws IllegalArgumentException - Summary: Returns the substring after the first occurrence of any of the specified delimiter characters.
-
Contract:
- When found, it returns the substring after that delimiter character.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiters array is {@code null} or empty, or if none of the delimiter characters are found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimitersOfExclusiveBeginIndex(char[]) — the array of delimiter characters to search for.
-
- Returns: the substring after the first occurrence of any delimiter, or {@code null} if not found.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code delimitersOfExclusiveBeginIndex} contains low-surrogate or high-surrogate code unit.
-
- See also: #substringAfter(String, String)
-
Signature:
@MayReturnNull public static String substringAfterAny(final String str, final String... delimitersOfExclusiveBeginIndex) - Summary: Returns the substring after the first occurrence of any of the specified delimiter strings.
-
Contract:
- When found, it returns the substring after that delimiter string.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiters array is {@code null} or empty, or if none of the delimiter strings are found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimitersOfExclusiveBeginIndex(String[]) — the array of delimiter strings to search for.
-
- Returns: the substring after the first occurrence of any delimiter, or {@code null} if not found.
- See also: #substringAfter(String, String)
substringBefore(...) -> String
-
Signature:
@MayReturnNull public static String substringBefore(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the first occurrence of the specified delimiter character.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} or if the delimiter character is not found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveEndIndex(char) — the delimiter character to search for.
-
- Returns: the substring before the first occurrence of the delimiter, or {@code null} if not found.
-
Signature:
@MayReturnNull public static String substringBefore(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the first occurrence of the specified delimiter string.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
- Returns an empty string if the delimiter is empty.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, may be {@code null}
-
- Returns: the substring before the first occurrence of the delimiter, or {@code null} if not found.
-
Signature:
@MayReturnNull public static String substringBefore(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the first occurrence of the specified delimiter starting from a given index.
-
Contract:
- If found, it returns the substring from inclusiveBeginIndex up to (but not including) the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the inclusiveBeginIndex is negative or greater than the string length, the delimiter is not found, or if the delimiter is empty and inclusiveBeginIndex equals the string length.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
inclusiveBeginIndex(int) — the index to start the substring from (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, may be {@code null}
-
- Returns: the substring from inclusiveBeginIndex to the first occurrence of the delimiter, or {@code null} if not found.
substringBeforeIgnoreCase(...) -> String
-
Signature:
@Beta @MayReturnNull public static String substringBeforeIgnoreCase(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the first occurrence of the specified delimiter, ignoring case considerations.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
- Returns an empty string if the delimiter is empty.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, case-insensitive, may be {@code null}
-
- Returns: the substring before the first occurrence of the delimiter (case-insensitive), or {@code null} if not found.
substringBeforeLast(...) -> String
-
Signature:
@MayReturnNull public static String substringBeforeLast(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified delimiter character.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the last occurrence of the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , empty, or if the delimiter character is not found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} or empty -
delimiterOfExclusiveEndIndex(char) — the delimiter character to search for.
-
- Returns: the substring before the last occurrence of the delimiter, or {@code null} if not found.
-
Signature:
@MayReturnNull public static String substringBeforeLast(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified delimiter string.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the last occurrence of the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
- Returns the original string if the delimiter is empty.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, may be {@code null}
-
- Returns: the substring before the last occurrence of the delimiter, or {@code null} if not found.
-
Signature:
@MayReturnNull public static String substringBeforeLast(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified delimiter starting from a given index.
-
Contract:
- If found and it occurs at or after the inclusiveBeginIndex, it returns the substring from inclusiveBeginIndex up to (but not including) the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the inclusiveBeginIndex is negative or greater than the string length, the delimiter is not found, or if the delimiter is found before the inclusiveBeginIndex.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
inclusiveBeginIndex(int) — the index to start the substring from (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, may be {@code null}
-
- Returns: the substring from inclusiveBeginIndex to the last occurrence of the delimiter, or {@code null} if not found.
substringBeforeLastIgnoreCase(...) -> String
-
Signature:
@Beta @MayReturnNull public static String substringBeforeLastIgnoreCase(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified delimiter, ignoring case considerations.
-
Contract:
- If found, it returns the substring from the beginning of the string up to (but not including) the last occurrence of the delimiter.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , or if the delimiter is not found.
- Returns the original string if the delimiter is empty.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string to search for, case-insensitive, may be {@code null}
-
- Returns: the substring before the last occurrence of the delimiter (case-insensitive), or {@code null} if not found.
substringBeforeAny(...) -> String
-
Signature:
@MayReturnNull public static String substringBeforeAny(final String str, final char... delimitersOfExclusiveEndIndex) throws IllegalArgumentException - Summary: Returns the substring before the first occurrence of any of the specified delimiter characters.
-
Contract:
- When found, it returns the substring from the beginning of the string up to (but not including) that delimiter character.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiters array is {@code null} or empty, or if none of the delimiter characters are found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimitersOfExclusiveEndIndex(char[]) — the array of delimiter characters to search for.
-
- Returns: the substring before the first occurrence of any delimiter, or {@code null} if not found.
-
Throws:
-
java.lang.IllegalArgumentException— if any char in {@code delimitersOfExclusiveEndIndex} contains low-surrogate or high-surrogate code unit.
-
- See also: #substringBefore(String, String)
-
Signature:
@MayReturnNull public static String substringBeforeAny(final String str, final String... delimitersOfExclusiveEndIndex) - Summary: Returns the substring before the first occurrence of any of the specified delimiter strings.
-
Contract:
- When found, it returns the substring from the beginning of the string up to (but not including) that delimiter string.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiters array is {@code null} or empty, or if none of the delimiter strings are found in the string.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimitersOfExclusiveEndIndex(String[]) — the array of delimiter strings to search for.
-
- Returns: the substring before the first occurrence of any delimiter, or {@code null} if not found.
- See also: #substringBefore(String, String)
substringBetween(...) -> String
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final int exclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring between two specified indices.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , exclusiveBeginIndex is less than -1, exclusiveBeginIndex is greater than or equal to exclusiveEndIndex, or exclusiveBeginIndex is greater than or equal to the string length.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
exclusiveBeginIndex(int) — the exclusive beginning index (the character at this index is not included). -
exclusiveEndIndex(int) — the exclusive ending index (the character at this index is not included).
-
- Returns: the substring between the specified indices, or {@code null} if the indices are invalid.
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final int exclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring between a specified index and the first occurrence of a delimiter character.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , exclusiveBeginIndex is less than -1, exclusiveBeginIndex is greater than or equal to the string length, or if the delimiter is not found after the exclusiveBeginIndex.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
exclusiveBeginIndex(int) — the exclusive beginning index (the character at this index is not included). -
delimiterOfExclusiveEndIndex(char) — the delimiter character marking the end of the substring.
-
- Returns: the substring between the index and the delimiter, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final int exclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between a specified index and the first occurrence of a delimiter string.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , exclusiveBeginIndex is less than -1, exclusiveBeginIndex is greater than or equal to the string length, or if the delimiter is not found after the exclusiveBeginIndex.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
exclusiveBeginIndex(int) — the exclusive beginning index (the character at this index is not included). -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, may be {@code null}
-
- Returns: the substring between the index and the delimiter, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final char delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring between the first occurrence of a delimiter character and a specified index.
-
Contract:
- If found and it occurs before the exclusiveEndIndex, it returns the substring starting after the delimiter and ending before the exclusiveEndIndex.
- </p> <p> The method returns {@code null} if the input string is {@code null} , exclusiveEndIndex is less than or equal to 0, the delimiter is not found, or if the delimiter occurs at or after the exclusiveEndIndex.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the delimiter character marking the beginning of the substring. -
exclusiveEndIndex(int) — the exclusive ending index (the character at this index is not included).
-
- Returns: the substring between the delimiter and the index, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring between the first occurrence of a delimiter string and a specified index.
-
Contract:
- If found and it occurs before the exclusiveEndIndex, it returns the substring starting after the delimiter and ending before the exclusiveEndIndex.
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , exclusiveEndIndex is negative, the delimiter is not found, or if the delimiter's end position is greater than the exclusiveEndIndex.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, may be {@code null} -
exclusiveEndIndex(int) — the exclusive ending index (the character at this index is not included).
-
- Returns: the substring between the delimiter and the index, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two occurrences of the same delimiter character.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , the string length is 1 or less, the first delimiter is not found, or the second delimiter is not found after the first one.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the delimiter character marking the beginning of the substring. -
delimiterOfExclusiveEndIndex(char) — the delimiter character marking the end of the substring.
-
- Returns: the substring between the two delimiter occurrences, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final String delimiter) - Summary: Returns the substring between two occurrences of the same delimiter string.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the first delimiter is not found, or the second delimiter is not found after the first one.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiter(String) — the delimiter string marking both the beginning and end of the substring, may be {@code null}
-
- Returns: the substring between two occurrences of the delimiter, or {@code null} if not found or the specified source string is empty or {@code null} .
- See also: #substringBetween(String, String, String)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two different delimiter strings.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, may be {@code null}
-
- Returns: the substring between the two delimiters, or {@code null} if not found.
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final int fromIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two delimiter strings, starting the search from a specified index.
-
Contract:
- If fromIndex is less than or equal to 0, the search starts from the beginning of the string.
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , fromIndex is greater than the string length, the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
fromIndex(int) — the index to start searching from. If less than or equal to 0, search starts from the beginning. -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, may be {@code null}
-
- Returns: the substring between the two delimiters, or {@code null} if not found.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final int exclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Extracts a substring between two exclusive indices, where the end index is calculated by a function.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , if the begin index is less than -1 or greater than or equal to the string length, or if the calculated end index is invalid.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
exclusiveBeginIndex(int) — the exclusive beginning index (the character at this index is not included). -
funcOfExclusiveEndIndex(IntUnaryOperator) — a function that calculates the exclusive end index based on the begin index.
-
- Returns: the substring between the specified indices, or {@code null} if invalid parameters are provided.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final IntUnaryOperator funcOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Extracts a substring between two exclusive indices, where the begin index is calculated by a function.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , if the end index is less than or equal to 0, or if the calculated begin index is invalid.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
funcOfExclusiveBeginIndex(IntUnaryOperator) — a function that calculates the exclusive begin index based on the end index. -
exclusiveEndIndex(int) — the exclusive ending index (the character at this index is not included).
-
- Returns: the substring between the specified indices, or {@code null} if invalid parameters are provided.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Extracts a substring between a delimiter and a calculated end index.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , if the delimiter is {@code null} or not found, if the delimiter length is greater than or equal to the string length, or if the calculated end index is invalid.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter marking the beginning of the substring (non-inclusive). -
funcOfExclusiveEndIndex(IntUnaryOperator) — a function that calculates the exclusive end index based on the start index after the delimiter.
-
- Returns: the substring between the delimiter and calculated end index, or {@code null} if invalid parameters are provided.
- See also: #substringBetween(String, int, int)
-
Signature:
@MayReturnNull public static String substringBetween(final String str, final IntUnaryOperator funcOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Extracts a substring between a calculated begin index and a delimiter.
-
Contract:
- </p> <p> The method returns {@code null} if the input string is {@code null} , if the delimiter is {@code null} or not found, if the delimiter length is greater than or equal to the string length, or if the calculated begin index is invalid.
-
Parameters:
-
str(String) — the input string from which to extract the substring, may be {@code null} -
funcOfExclusiveBeginIndex(IntUnaryOperator) — a function that calculates the exclusive begin index based on the end index of the delimiter. -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (non-inclusive).
-
- Returns: the substring between the calculated begin index and delimiter, or {@code null} if invalid parameters are provided.
- See also: #substringBetween(String, int, int)
substringBetweenIgnoreCase(...) -> String
-
Signature:
@Beta @MayReturnNull public static String substringBetweenIgnoreCase(final String str, final String delimiter) - Summary: Returns the substring between two occurrences of the same delimiter string, ignoring case considerations.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the first delimiter is not found, or the second delimiter is not found after the first one.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiter(String) — the delimiter string marking both the beginning and end of the substring, case-insensitive, may be {@code null}
-
- Returns: the substring between two occurrences of the delimiter (case-insensitive), or {@code null} if not found.
-
Signature:
@Beta @MayReturnNull public static String substringBetweenIgnoreCase(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two different delimiter strings, ignoring case considerations.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, case-insensitive, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, case-insensitive, may be {@code null}
-
- Returns: the substring between the two delimiters (case-insensitive), or {@code null} if not found.
-
Signature:
@Beta @MayReturnNull public static String substringBetweenIgnoreCase(final String str, final int fromIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two delimiter strings, starting the search from a specified index and ignoring case considerations.
-
Contract:
- If fromIndex is less than or equal to 0, the search starts from the beginning of the string.
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , fromIndex is greater than the string length, the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
fromIndex(int) — the index to start searching from. If less than or equal to 0, search starts from the beginning. -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, case-insensitive, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, case-insensitive, may be {@code null}
-
- Returns: the substring between the two delimiters (case-insensitive), or {@code null} if not found.
substringBetweenFirstAndLast(...) -> String
-
Signature:
@MayReturnNull public static String substringBetweenFirstAndLast(final String str, final String delimiter) - Summary: Returns the substring between the first and last occurrences of the same delimiter string.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , the delimiter is {@code null} , the first delimiter is not found, or the last delimiter is not found after the first one.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiter(String) — the delimiter string marking both the beginning and end of the substring, may be {@code null}
-
- Returns: the substring between the first and last occurrences of the delimiter, or {@code null} if not found.
- See also: StrUtil#substringBetweenFirstAndLast(String, String)
-
Signature:
@MayReturnNull public static String substringBetweenFirstAndLast(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two different delimiter strings, using the first occurrence of the beginning delimiter and the last occurrence of the ending delimiter.
-
Contract:
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, may be {@code null}
-
- Returns: the substring between the two delimiters, or {@code null} if not found.
- See also: StrUtil#substringBetweenFirstAndLast(String, String, String)
-
Signature:
@MayReturnNull public static String substringBetweenFirstAndLast(final String str, final int fromIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring between two delimiter strings, using the first occurrence of the beginning delimiter and the last occurrence of the ending delimiter, starting the search from a specified index.
-
Contract:
- If fromIndex is less than or equal to 0, the search starts from the beginning of the string.
- If both are found, it returns the substring between them (exclusive of both delimiters).
- </p> <p> The method returns {@code null} if the input string is {@code null} , either delimiter is {@code null} , fromIndex is greater than the string length, the beginning delimiter is not found, or the ending delimiter is not found after the beginning delimiter.
-
Parameters:
-
str(String) — the string to extract from, may be {@code null} -
fromIndex(int) — the index to start searching from. If less than or equal to 0, search starts from the beginning. -
delimiterOfExclusiveBeginIndex(String) — the delimiter string marking the beginning of the substring, may be {@code null} -
delimiterOfExclusiveEndIndex(String) — the delimiter string marking the end of the substring, may be {@code null}
-
- Returns: the substring between the two delimiters, or {@code null} if not found.
- See also: StrUtil#substringBetweenFirstAndLast(String, int, String, String)
substringsBetween(...) -> List<String>
-
Signature:
public static List<String> substringsBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified character delimiters.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive).
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, String, String, ExtractStrategy)
-
Signature:
public static List<String> substringsBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy) - Summary: Finds all substrings between specified character delimiters using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters.
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, String, String, ExtractStrategy)
-
Signature:
public static List<String> substringsBetween(final String str, final int fromIndex, final int toIndex, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified character delimiters within a given range.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive). -
toIndex(int) — the index to end the search at (exclusive). -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive).
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, String, String, ExtractStrategy)
-
Signature:
public static List<String> substringsBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified string delimiters.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} , or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive).
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, String, String, ExtractStrategy)
-
Signature:
public static List<String> substringsBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy) - Summary: Finds all substrings between specified string delimiters using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} , or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters.
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringsBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<String> substringsBetween(final String str, final int fromIndex, final int toIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified string delimiters within a given range.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} , or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive). -
toIndex(int) — the index to end the search at (exclusive). -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive).
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, String, String, ExtractStrategy)
-
Signature:
public static List<String> substringsBetween(final String str, final int fromIndex, final int toIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy, final int maxCount) - Summary: Finds all substrings between specified string delimiters within a given range using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} , if {@code maxCount} is 0, or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive). -
toIndex(int) — the index to end the search at (exclusive). -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters. -
maxCount(int) — the maximum number of substrings to extract; if {@code Integer.MAX_VALUE} , all matching substrings will be extracted.
-
- Returns: a list of matched substrings, or an empty list if no match is found or the input is {@code null} .
- See also: #substringsBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
substringIndicesBetween(...) -> List<int\[\]>
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified character delimiters and returns their indices.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , empty, or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive).
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy) - Summary: Finds all substrings between specified character delimiters and returns their indices using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} , empty, or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters.
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final int fromIndex, final int toIndex, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) throws IndexOutOfBoundsException - Summary: Finds all substrings between specified character delimiters within a given range and returns their indices.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , empty, or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the starting index to search from (inclusive). -
toIndex(int) — the ending index to search until (exclusive). -
delimiterOfExclusiveBeginIndex(char) — the character marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(char) — the character marking the end of the substring (non-inclusive).
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are invalid.
-
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Finds all substrings between specified string delimiters and returns their indices.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} or empty, or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive).
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy) - Summary: Finds all substrings between specified string delimiters and returns their indices using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} or empty, or if no matches are found.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters.
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
- See also: #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final int fromIndex, final int toIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) throws IndexOutOfBoundsException - Summary: Finds all substrings between specified string delimiters within a given range and returns their indices.
-
Contract:
- </p> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} or empty, or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the starting index to search from (inclusive). -
toIndex(int) — the ending index to search until (exclusive). -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive).
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are invalid.
-
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringIndicesBetween(String, int, int, String, String, ExtractStrategy, int)
-
Signature:
public static List<int[]> substringIndicesBetween(final String str, final int fromIndex, final int toIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex, final ExtractStrategy extractStrategy, final int maxCount) throws IndexOutOfBoundsException - Summary: Finds all substrings between specified string delimiters within a given range and returns their indices using the given extraction strategy.
-
Contract:
- The extraction strategy determines how nested delimiters are handled: <ul> <li> {@code ExtractStrategy.DEFAULT} - Simple sequential matching of begin/end delimiters </li> <li> {@code ExtractStrategy.STACK_BASED} - Stack-based approach that extracts all nested levels </li> <li> {@code ExtractStrategy.IGNORE_NESTED} - Stack-based approach that ignores nested substrings </li> </ul> <p> The method returns an empty list if the input string is {@code null} , if either delimiter is {@code null} or empty, if {@code maxCount} is 0, or if no matches are found within the specified range.
-
Parameters:
-
str(String) — the string to search in, may be {@code null} -
fromIndex(int) — the index to start the search from (inclusive). -
toIndex(int) — the index to end the search at (exclusive). -
delimiterOfExclusiveBeginIndex(String) — the string marking the beginning of the substring (non-inclusive). -
delimiterOfExclusiveEndIndex(String) — the string marking the end of the substring (non-inclusive). -
extractStrategy(ExtractStrategy) — the strategy to use for handling nested delimiters. -
maxCount(int) — the maximum number of matches to find.
-
- Returns: a list of int arrays containing the start and end indices (exclusive of delimiters) of each matching substring, or an empty list if no match is found or the input is {@code null} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the indices are invalid.
-
- See also: #substringIndicesBetween(String, String, String, ExtractStrategy), #substringsBetween(String, int, int, String, String, ExtractStrategy, int)
replaceRange(...) -> String
-
Signature:
@Beta public static String replaceRange(final String str, final int fromIndex, final int toIndex, final String replacement) throws IndexOutOfBoundsException - Summary: Returns a new String with the specified range replaced with the replacement String.
-
Contract:
- If the replacement is {@code null} , it is treated as an empty string.
- </p> <p> The method handles special cases gracefully: if the input string is {@code null} or empty, it returns the replacement string (or empty if replacement is {@code null} ).
- If {@code fromIndex} equals {@code toIndex} and replacement is empty, the original string is returned unchanged.
-
Parameters:
-
str(String) — the original string, may be {@code null} -
fromIndex(int) — the initial index of the range to be replaced, inclusive. It must be > = 0 and < = {@code str.length()} . -
toIndex(int) — the final index of the range to be replaced, exclusive. It must be > = {@code fromIndex} and < = {@code str.length()} . -
replacement(String) — the string to replace the specified range in the original string, may be {@code null}
-
- Returns: a new string with the specified range replaced by the replacement string.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is out of the string bounds or indices are invalid.
-
- See also: N#replaceRange(String, int, int, String)
moveRange(...) -> String
-
Signature:
@Beta public static String moveRange(final String str, final int fromIndex, final int toIndex, final int newPositionAfterMove) throws IndexOutOfBoundsException - Summary: Moves a specified range of characters within a string to a new position.
-
Contract:
- The newPositionAfterMove parameter indicates where the start of the moved range should be positioned in the resulting string.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Moving a range of characters Strings.moveRange("ABCDEFGH", 2, 5, 0); // returns "CDEABFGH" (moves "CDE" to position 0) Strings.moveRange("ABCDEFGH", 2, 5, 5); // returns "ABFGHCDE" (moves "CDE" to position 5) Strings.moveRange("Hello World", 0, 5, 6); // returns " WorldHello" (moves "Hello" to position 6) // Edge cases Strings.moveRange(null, 0, 0, 0); // returns "" Strings.moveRange("", 0, 0, 0); // returns "" Strings.moveRange("ABC", 1, 1, 1); // returns "ABC" (no change when fromIndex == toIndex) Strings.moveRange("ABC", 0, 2, 0); // returns "ABC" (no change when already at position) } </pre>
-
Parameters:
-
str(String) — the original string to be modified -
fromIndex(int) — the starting index (inclusive) of the range to be moved -
toIndex(int) — the ending index (exclusive) of the range to be moved -
newPositionAfterMove(int) — the zero-based index where the first element of the range will be placed after the move; must be between 0 and lengthOfString - lengthOfRange, inclusive.
-
- Returns: a new string with the specified range moved to the new position. An empty String is returned if the specified String is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if any index is out of bounds or if newPositionAfterMove would cause elements to be moved outside the string
-
- See also: N#moveRange(String, int, int, int)
deleteRange(...) -> String
-
Signature:
@Beta public static String deleteRange(final String str, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Deletes a specified range of characters from a string.
-
Contract:
- If the range is empty (fromIndex == toIndex) or starts beyond the string length, the original string is returned.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Deleting a range of characters Strings.deleteRange("ABCDEFGH", 2, 5); // returns "ABFGH" (removes "CDE") Strings.deleteRange("Hello World", 5, 11); // returns "Hello" (removes " World") Strings.deleteRange("Test", 0, 2); // returns "st" (removes "Te") // Edge cases Strings.deleteRange(null, 0, 1); // returns "" Strings.deleteRange("", 0, 0); // returns "" (OK - valid range for empty string) Strings.deleteRange("ABC", 1, 1); // returns "ABC" (no deletion when fromIndex == toIndex) Strings.deleteRange("ABC", 3, 5); // returns "ABC" (no deletion when fromIndex >= length) Strings.deleteRange("ABC", 0, 10); // returns "" (deletes entire string and beyond) } </pre>
-
Parameters:
-
str(String) — the input string from which a range of characters are to be deleted; may be {@code null} -
fromIndex(int) — the initial index of the range to be deleted, inclusive; must be > = 0 and < = {@code str.length()} -
toIndex(int) — the final index of the range to be deleted, exclusive; must be > = {@code fromIndex} and < = {@code str.length()}
-
- Returns: a new string with the specified range of characters deleted. An empty String is returned if the specified String is {@code null} or empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the range is invalid
-
- See also: N#deleteRange(String, int, int), #replaceRange(String, int, int, String)
join(...) -> String
-
Signature:
public static String join(final boolean[] a) - Summary: Joins the elements of a boolean array into a single String using the default element separator.
-
Parameters:
-
a(boolean[]) — the boolean array to join
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(boolean\[\], int, int, String, String, String)
-
Signature:
public static String join(final boolean[] a, final String delimiter) - Summary: Joins the elements of a boolean array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
-
Parameters:
-
a(boolean[]) — the boolean array to join -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(boolean\[\], int, int, String, String, String)
-
Signature:
public static String join(final boolean[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a boolean array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method returns an empty string for {@code null} or empty arrays, or when fromIndex equals toIndex.
-
Parameters:
-
a(boolean[]) — the boolean array to join -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of array bounds
-
- See also: #join(boolean\[\], int, int, String, String, String)
-
Signature:
public static String join(final boolean[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a boolean array into a single String with delimiter, prefix, and suffix.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method handles edge cases gracefully: if the array is null/empty or fromIndex equals toIndex, it returns just the prefix and suffix concatenated (or an empty string if both are empty).
-
Parameters:
-
a(boolean[]) — the array containing the elements to join together. It can be empty. -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final char[] a) - Summary: Joins the elements of a char array into a single String using the default element separator.
-
Parameters:
-
a(char[]) — the char array to join
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(char\[\], int, int, String, String, String)
-
Signature:
public static String join(final char[] a, final String delimiter) - Summary: Joins the elements of a char array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
-
Parameters:
-
a(char[]) — the char array to join -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(char\[\], int, int, String, String, String)
-
Signature:
public static String join(final char[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a char array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method returns an empty string for {@code null} or empty arrays, or when fromIndex equals toIndex.
-
Parameters:
-
a(char[]) — the char array to join -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of array bounds
-
- See also: #join(char\[\], int, int, String, String, String)
-
Signature:
public static String join(final char[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a char array into a single String with delimiter, prefix, and suffix.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method handles edge cases gracefully: if the array is null/empty or fromIndex equals toIndex, it returns just the prefix and suffix concatenated (or an empty string if both are empty).
-
Parameters:
-
a(char[]) — the array containing the elements to join together. It can be empty. -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final byte[] a) - Summary: Joins the elements of a byte array into a single String using the default element separator.
-
Parameters:
-
a(byte[]) — the byte array to join
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(byte\[\], int, int, String, String, String)
-
Signature:
public static String join(final byte[] a, final String delimiter) - Summary: Joins the elements of a byte array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
-
Parameters:
-
a(byte[]) — the byte array to join -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(byte\[\], int, int, String, String, String)
-
Signature:
public static String join(final byte[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a byte array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method returns an empty string for {@code null} or empty arrays, or when fromIndex equals toIndex.
-
Parameters:
-
a(byte[]) — the byte array to join -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of array bounds
-
- See also: #join(byte\[\], int, int, String, String, String)
-
Signature:
public static String join(final byte[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a byte array into a single String with delimiter, prefix, and suffix.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method handles edge cases gracefully: if the array is null/empty or fromIndex equals toIndex, it returns just the prefix and suffix concatenated (or an empty string if both are empty).
-
Parameters:
-
a(byte[]) — the array containing the elements to join together. It can be empty. -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final short[] a) - Summary: Joins the elements of a short array into a single String using the default element separator.
-
Parameters:
-
a(short[]) — the short array to join
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(short\[\], int, int, String, String, String)
-
Signature:
public static String join(final short[] a, final String delimiter) - Summary: Joins the elements of a short array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
-
Parameters:
-
a(short[]) — the short array to join -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(short\[\], int, int, String, String, String)
-
Signature:
public static String join(final short[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins a range of elements from a short array into a single String using the specified string delimiter.
-
Contract:
- If the delimiter is empty, the elements are concatenated without any separator.
- </p> <p> The method returns an empty string for {@code null} or empty arrays, or when fromIndex equals toIndex.
-
Parameters:
-
a(short[]) — the short array to join -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of array bounds
-
-
Signature:
public static String join(final short[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided short array into a single String.
-
Contract:
- </p> <p> If the array is {@code null} or empty, or if {@code fromIndex == toIndex} , the method returns an appropriate combination of prefix and suffix, or an empty string if both are empty.
-
Parameters:
-
a(short[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final int[] a) - Summary: Joins all elements of the provided int array into a single String.
-
Parameters:
-
a(int[]) — the array containing the elements to join together, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(int\[\], int, int, String, String, String)
-
Signature:
public static String join(final int[] a, final String delimiter) - Summary: Joins all elements of the provided int array into a single String using the specified delimiter.
-
Parameters:
-
a(int[]) — the array containing the elements to join together, may be {@code null} or empty -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(int\[\], int, int, String, String, String)
-
Signature:
public static String join(final int[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided int array from the specified range into a single String.
-
Parameters:
-
a(int[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
- See also: #join(int\[\], int, int, String, String, String)
-
Signature:
public static String join(final int[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided int array into a single String with delimiter, prefix, and suffix.
-
Contract:
- </p> <p> If the array is {@code null} or empty, or if {@code fromIndex == toIndex} , the method returns an appropriate combination of prefix and suffix, or an empty string if both are empty.
-
Parameters:
-
a(int[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final long[] a) - Summary: Joins all elements of the provided long array into a single String.
-
Parameters:
-
a(long[]) — the array containing the elements to join together, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(long\[\], int, int, String, String, String)
-
Signature:
public static String join(final long[] a, final String delimiter) - Summary: Joins all elements of the provided long array into a single String using the specified delimiter.
-
Parameters:
-
a(long[]) — the array containing the elements to join together, may be {@code null} or empty -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(long\[\], int, int, String, String, String)
-
Signature:
public static String join(final long[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided long array from the specified range into a single String.
-
Parameters:
-
a(long[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
- See also: #join(long\[\], int, int, String, String, String)
-
Signature:
public static String join(final long[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided long array into a single String with delimiter, prefix, and suffix.
-
Contract:
- </p> <p> If the array is {@code null} or empty, or if {@code fromIndex == toIndex} , the method returns an appropriate combination of prefix and suffix, or an empty string if both are empty.
-
Parameters:
-
a(long[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final float[] a) - Summary: Joins all elements of the provided float array into a single String.
-
Parameters:
-
a(float[]) — the array containing the elements to join together, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(float\[\], int, int, String, String, String)
-
Signature:
public static String join(final float[] a, final String delimiter) - Summary: Joins all elements of the provided float array into a single String using the specified delimiter.
-
Parameters:
-
a(float[]) — the array containing the elements to join together, may be {@code null} or empty -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(float\[\], int, int, String, String, String)
-
Signature:
public static String join(final float[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided float array from the specified range into a single String.
-
Parameters:
-
a(float[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
- See also: #join(float\[\], int, int, String, String, String)
-
Signature:
public static String join(final float[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided float array into a single String with delimiter, prefix, and suffix.
-
Contract:
- </p> <p> If the array is {@code null} or empty, or if {@code fromIndex == toIndex} , the method returns an appropriate combination of prefix and suffix, or an empty string if both are empty.
-
Parameters:
-
a(float[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final double[] a) - Summary: Joins all elements of the provided double array into a single String.
-
Parameters:
-
a(double[]) — the array containing the elements to join together, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(double\[\], int, int, String, String, String)
-
Signature:
public static String join(final double[] a, final String delimiter) - Summary: Joins all elements of the provided double array into a single String using the specified delimiter.
-
Parameters:
-
a(double[]) — the array containing the elements to join together, may be {@code null} or empty -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty.
- See also: #join(double\[\], int, int, String, String, String)
-
Signature:
public static String join(final double[] a, final int fromIndex, final int toIndex, final String delimiter) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided double array from the specified range into a single String.
-
Parameters:
-
a(double[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
- See also: #join(double\[\], int, int, String, String, String)
-
Signature:
public static String join(final double[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided double array into a single String with delimiter, prefix, and suffix.
-
Contract:
- </p> <p> If the array is {@code null} or empty, or if {@code fromIndex == toIndex} , the method returns an appropriate combination of prefix and suffix, or an empty string if both are empty.
-
Parameters:
-
a(double[]) — the array containing the elements to join together, may be {@code null} or empty -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final Object[] a) - Summary: Joins the elements of the provided array into a single String.
-
Contract:
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty.
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null}
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(Object\[\], String, String, String, boolean)
-
Signature:
public static String join(final Object[] a, final String delimiter) - Summary: Joins the elements of the provided array into a single String with the specified delimiter.
-
Contract:
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty.
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter string that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty
- See also: #join(Object\[\], String, String, String, boolean)
-
Signature:
public static String join(final Object[] a, final String delimiter, final String prefix, final String suffix) - Summary: Joins the elements of the provided array into a single String with the specified delimiter, prefix, and suffix.
-
Contract:
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty and both prefix and suffix are empty.
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string with prefix and suffix applied.
- See also: #join(Object\[\], String, String, String, boolean)
-
Signature:
public static String join(final Object[] a, final String delimiter, final String prefix, final String suffix, final boolean trim) - Summary: Joins the elements of the provided array into a single String with the specified delimiter, prefix, suffix, and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty and both prefix and suffix are empty.
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Signature:
public static String join(final Object[] a, final int fromIndex, final int toIndex, final String delimiter) - Summary: Joins the elements of the provided array from the specified range into a single String with the specified delimiter.
-
Contract:
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty, or if {@code fromIndex == toIndex} .
-
Parameters:
-
a(Object[]) — the array containing the elements to join together. -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
- See also: #join(Object\[\], int, int, String, String, String, boolean)
-
Signature:
public static String join(final Object[] a, final int fromIndex, final int toIndex, final String delimiter, final boolean trim) - Summary: Joins the elements of the provided array from the specified range into a single String with the specified delimiter and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty, or if {@code fromIndex == toIndex} .
-
Parameters:
-
a(Object[]) — the array containing the elements to join together. -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty, or {@code fromIndex == toIndex} .
- See also: #join(Object\[\], int, int, String, String, String, boolean)
-
Signature:
public static String join(final Object[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) - Summary: Joins the elements of the provided array from the specified range into a single String with the specified delimiter, prefix, and suffix.
-
Contract:
- </p> <p> The method returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and both prefix and suffix are empty.
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null} -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Signature:
public static String join(final Object[] a, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix, final boolean trim) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided array from the specified range into a single String with the specified delimiter, prefix, suffix, and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
- </p> <p> The method handles edge cases gracefully: if the array is {@code null} or empty, or if {@code fromIndex == toIndex} , it returns just the concatenation of prefix and suffix (or an empty string if both are empty).
-
Parameters:
-
a(Object[]) — the array containing the elements to join together, may be {@code null} -
fromIndex(int) — the start index in the array from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the array up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the array size.
-
-
Signature:
public static String join(final Iterable<?> c) - Summary: Joins the elements of the provided Iterable into a single String.
-
Contract:
- </p> <p> The method returns an empty string if the specified Iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<?>) — the Iterable containing the elements to join together, may be {@code null}
-
- Returns: the concatenated string. Returns an empty string if the specified Iterable is {@code null} or empty
- See also: #join(Iterable, String, String, String, boolean)
-
Signature:
public static String join(final Iterable<?> c, final String delimiter) - Summary: Joins the elements of the provided Iterable into a single String with the specified delimiter.
-
Contract:
- </p> <p> The method returns an empty string if the specified Iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<?>) — the Iterable containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter string that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterable is {@code null} or empty
- See also: #join(Iterable, String, String, String, boolean)
-
Signature:
public static String join(final Iterable<?> c, final String delimiter, final String prefix, final String suffix) - Summary: Joins the elements of the provided Iterable into a single String with the specified delimiter, prefix, and suffix.
-
Contract:
- </p> <p> The method returns just the concatenation of prefix and suffix if the Iterable is {@code null} or empty.
-
Parameters:
-
c(Iterable<?>) — the Iterable containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterable is {@code null} or empty and <i> prefix, suffix </i> are empty.
- See also: #join(Iterable, String, String, String, boolean)
-
Signature:
public static String join(final Iterable<?> c, final String delimiter, final String prefix, final String suffix, final boolean trim) - Summary: Joins the elements of the provided Iterable into a single String with the specified delimiter, prefix, suffix, and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
-
Parameters:
-
c(Iterable<?>) — the Iterable containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterable is {@code null} or empty and <i> prefix, suffix </i> are empty.
-
Signature:
public static String join(final Collection<?> c, final int fromIndex, final int toIndex, final String delimiter) - Summary: Joins the elements of the provided Collection from the specified range into a single String with the specified delimiter.
-
Contract:
- </p> <p> The method returns an empty string if the specified Collection is {@code null} or empty, or if {@code fromIndex == toIndex} .
-
Parameters:
-
c(Collection<?>) — the Collection containing the elements to join together. -
fromIndex(int) — the start index in the collection from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the collection up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified Collection is {@code null} or empty, or {@code fromIndex == toIndex} .
- See also: #join(Collection, int, int, String, String, String, boolean)
-
Signature:
public static String join(final Collection<?> c, final int fromIndex, final int toIndex, final String delimiter, final boolean trim) - Summary: Joins the elements of the provided Collection from the specified range into a single String with the specified delimiter and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
- </p> <p> The method returns an empty string if the specified Collection is {@code null} or empty, or if {@code fromIndex == toIndex} .
-
Parameters:
-
c(Collection<?>) — the Collection containing the elements to join together. -
fromIndex(int) — the start index in the collection from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the collection up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified Collection is {@code null} or empty, or {@code fromIndex == toIndex} .
- See also: #join(Collection, int, int, String, String, String, boolean)
-
Signature:
public static String join(final Collection<?> c, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix) - Summary: Joins the elements of the provided Collection from the specified range into a single String with the specified delimiter, prefix, and suffix.
-
Contract:
- </p> <p> The method returns just the concatenation of prefix and suffix if the collection is {@code null} or empty or {@code fromIndex == toIndex} .
-
Parameters:
-
c(Collection<?>) — the Collection containing the elements to join together, may be {@code null} -
fromIndex(int) — the start index in the Collection from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the Collection up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified Collection is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Signature:
public static String join(final Collection<?> c, final int fromIndex, final int toIndex, final String delimiter, final String prefix, final String suffix, final boolean trim) throws IndexOutOfBoundsException - Summary: Joins the elements of the provided Collection from the specified range into a single String with the specified delimiter, prefix, suffix, and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
- It returns just the concatenation of prefix and suffix if the collection is {@code null} or empty or {@code fromIndex == toIndex} .
-
Parameters:
-
c(Collection<?>) — the Collection containing the elements to join together, may be {@code null} -
fromIndex(int) — the start index in the Collection from which to start joining elements. It must be a non-negative integer. -
toIndex(int) — the end index in the Collection up to which to join elements. It must be a non-negative integer and not less than fromIndex. -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified array is {@code null} or empty or {@code fromIndex == toIndex} and <i> prefix, suffix </i> are empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the fromIndex or toIndex is out of the range of the Collection size.
-
-
Signature:
public static String join(final Iterator<?> iter) - Summary: Joins the elements of the provided Iterator into a single String.
-
Contract:
- </p> <p> The method returns an empty string if the specified Iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<?>) — the Iterator containing the elements to join together, may be {@code null}
-
- Returns: the concatenated string. Returns an empty string if the specified Iterator is {@code null} or empty
- See also: #join(Iterator, String, String, String, boolean)
-
Signature:
public static String join(final Iterator<?> iter, final String delimiter) - Summary: Joins the elements of the provided Iterator into a single String with the specified delimiter.
-
Contract:
- </p> <p> The method returns an empty string if the specified Iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<?>) — the Iterator containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter string that separates each element. It can be empty, in which case the elements are concatenated without any delimiter.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterator is {@code null} or empty
- See also: #join(Iterator, String, String, String, boolean)
-
Signature:
public static String join(final Iterator<?> iter, final String delimiter, final String prefix, final String suffix) - Summary: Joins the elements of the provided Iterator into a single String with the specified delimiter, prefix, and suffix.
-
Contract:
- </p> <p> The method returns just the concatenation of prefix and suffix if the Iterator is {@code null} or has no elements.
-
Parameters:
-
iter(Iterator<?>) — the Iterator containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterator is {@code null} or empty and <i> prefix, suffix </i> are empty.
- See also: #join(Iterator, String, String, String, boolean)
-
Signature:
public static String join(final Iterator<?> iter, final String delimiter, final String prefix, final String suffix, final boolean trim) - Summary: Joins the elements of the provided Iterator into a single String with the specified delimiter, prefix, suffix, and optional trimming.
-
Contract:
- If trim is {@code true} , leading and trailing whitespace is removed from each element's string representation.
-
Parameters:
-
iter(Iterator<?>) — the Iterator containing the elements to join together, may be {@code null} -
delimiter(String) — the delimiter that separates each element. It can be empty, in which case the elements are concatenated without any delimiter. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each element.
-
- Returns: the concatenated string. Returns an empty string if the specified Iterator is {@code null} or empty and <i> prefix, suffix </i> are empty.
joinEntries(...) -> String
-
Signature:
public static String joinEntries(final Map<?, ?> m) - Summary: Joins the entries of the provided Map into a single String.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty
-
- Returns: a string representation of the map entries, or an empty string if the map is {@code null} or empty.
- See also: #joinEntries(Map, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final String entryDelimiter) - Summary: Joins the entries of the provided Map into a single String using the specified entry delimiter.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
entryDelimiter(String) — the delimiter string that separates each entry.
-
- Returns: a string representation of the map entries, or an empty string if the map is {@code null} or empty.
- See also: #joinEntries(Map, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final String entryDelimiter, final String keyValueDelimiter) - Summary: Joins the entries of the provided Map into a single String using specified delimiters.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
entryDelimiter(String) — the delimiter string that separates each entry. -
keyValueDelimiter(String) — the delimiter string that separates the key and value within each entry. It can be empty.
-
- Returns: a string representation of the map entries, or an empty string if the map is {@code null} or empty.
- See also: #joinEntries(Map, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final String entryDelimiter, final String keyValueDelimiter, final String prefix, final String suffix) - Summary: Joins the entries of the provided Map into a single String with specified delimiters and wrapping.
-
Contract:
- </p> <p> If the map is {@code null} or empty, the method returns only the concatenated prefix and suffix (or empty string if both are empty).
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
entryDelimiter(String) — the delimiter string that separates each entry. -
keyValueDelimiter(String) — the delimiter string that separates the key and value within each entry. It can be empty. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string with prefix and suffix, or just prefix+suffix if the map is {@code null} or empty.
- See also: #joinEntries(Map, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final String entryDelimiter, final String keyValueDelimiter, final String prefix, final String suffix, final boolean trim) - Summary: Joins the entries of the provided Map into a single String with full control over formatting.
-
Contract:
- If trim is {@code true} , the string representations of keys and values will be trimmed of leading and trailing whitespace.
- </p> <p> If the map is {@code null} or empty, the method returns only the concatenated prefix and suffix (or empty string if both are empty).
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
entryDelimiter(String) — the delimiter that separates each entry. It can be empty. -
keyValueDelimiter(String) — the delimiter that separates the key and value within each entry. It can be empty. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of each key and value.
-
- Returns: the concatenated string with prefix and suffix, or just prefix+suffix if the map is {@code null} or empty.
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter) - Summary: Joins a subset of entries from the provided Map into a single String.
-
Contract:
- </p> <p> The method returns an empty string if the map is {@code null} , empty, or if fromIndex equals toIndex.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of entries to include. -
toIndex(int) — the ending index (exclusive) of entries to include. -
entryDelimiter(String) — the delimiter string that separates each entry.
-
- Returns: a string representation of the specified range of map entries.
- See also: #joinEntries(Map, int, int, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter, final boolean trim) - Summary: Joins a subset of entries from the provided Map into a single String with optional trimming.
-
Contract:
- If trim is {@code true} , the string representations of keys and values will be trimmed of leading and trailing whitespace.
- </p> <p> The method returns an empty string if the map is {@code null} , empty, or if fromIndex equals toIndex.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of entries to include. -
toIndex(int) — the ending index (exclusive) of entries to include. -
entryDelimiter(String) — the delimiter string that separates each entry. -
trim(boolean) — if {@code true} , trims the string representations of each key and value.
-
- Returns: a string representation of the specified range of map entries.
- See also: #joinEntries(Map, int, int, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter, final String keyValueDelimiter) - Summary: Joins a subset of entries from the provided Map into a single String with specified delimiters.
-
Contract:
- </p> <p> The method returns an empty string if the map is {@code null} , empty, or if fromIndex equals toIndex.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of entries to include. -
toIndex(int) — the ending index (exclusive) of entries to include. -
entryDelimiter(String) — the delimiter string that separates each entry. -
keyValueDelimiter(String) — the delimiter string that separates the key and value within each entry. It can be empty.
-
- Returns: a string representation of the specified range of map entries.
- See also: #joinEntries(Map, int, int, String, String, String, String, boolean)
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter, final String keyValueDelimiter, final boolean trim) - Summary: Joins a subset of entries from the provided Map into a single String with specified delimiters and optional trimming.
-
Contract:
- If trim is {@code true} , the string representations of keys and values will be trimmed of leading and trailing whitespace.
- </p> <p> The method returns an empty string if the map is {@code null} , empty, or if fromIndex equals toIndex.
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of entries to include. -
toIndex(int) — the ending index (exclusive) of entries to include. -
entryDelimiter(String) — the delimiter string that separates each entry. -
keyValueDelimiter(String) — the delimiter string that separates the key and value within each entry. It can be empty. -
trim(boolean) — if {@code true} , leading and trailing whitespace of each key and value will be removed.
-
- Returns: a string representation of the specified range of map entries.
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter, final String keyValueDelimiter, final String prefix, final String suffix) - Summary: Joins a subset of entries from the provided Map into a single String with specified delimiters and wrapping.
-
Contract:
- </p> <p> If the map is {@code null} , empty, or if fromIndex equals toIndex, the method returns only the concatenated prefix and suffix (or empty string if both are empty).
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the starting index (inclusive) of entries to include. -
toIndex(int) — the ending index (exclusive) of entries to include. -
entryDelimiter(String) — the delimiter string that separates each entry. -
keyValueDelimiter(String) — the delimiter string that separates the key and value within each entry. It can be empty. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty.
-
- Returns: the concatenated string with prefix and suffix.
-
Signature:
public static String joinEntries(final Map<?, ?> m, final int fromIndex, final int toIndex, final String entryDelimiter, final String keyValueDelimiter, final String prefix, final String suffix, final boolean trim) throws IndexOutOfBoundsException - Summary: Joins a subset of entries from the provided Map into a single String with full control over formatting.
-
Contract:
- If trim is {@code true} , the string representations of keys and values will be trimmed of leading and trailing whitespace.
- </p> <p> If the map is {@code null} , empty, or if fromIndex equals toIndex, the method returns only the concatenated prefix and suffix (or empty string if both are empty).
-
Parameters:
-
m(Map<?, ?>) — the Map containing the entries to join, may be {@code null} or empty -
fromIndex(int) — the start index in the entry set from which to start joining entries. It should be non-negative and no larger than the size of the map. -
toIndex(int) — the end index in the entry set up to which to join entries. It should be non-negative, no larger than the size of the map, and not less than fromIndex. -
entryDelimiter(String) — the delimiter that separates each entry. It can be empty. -
keyValueDelimiter(String) — the delimiter that separates the key and value within each entry. It can be empty. -
prefix(String) — the prefix to be added at the beginning. It can be empty. -
suffix(String) — the suffix to be added at the end. It can be empty. -
trim(boolean) — if {@code true} , leading and trailing whitespace of each key and value will be removed.
-
- Returns: the concatenated string with prefix and suffix, or just prefix+suffix if the range is empty.
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex is out of range.
-
-
Signature:
public static <T> String joinEntries(final Iterable<? extends T> c, final String entryDelimiter, final String keyValueDelimiter, final Function<? super T, ?> keyExtractor, final Function<? super T, ?> valueExtractor) throws IllegalArgumentException - Summary: Joins the entries of the provided Iterable into a single String using the specified delimiters.
-
Parameters:
-
c(Iterable<? extends T>) — the iterable whose elements are to be joined, may be {@code null} or empty -
entryDelimiter(String) — the delimiter to use between entries -
keyValueDelimiter(String) — the delimiter to use between keys and values -
keyExtractor(Function<? super T, ?>) — function to extract keys from elements. Must not be {@code null} . -
valueExtractor(Function<? super T, ?>) — function to extract values from elements. Must not be {@code null} .
-
- Returns: a string representation of the iterable's elements, or an empty string if the iterable is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or valueExtractor is null
-
-
Signature:
public static <T> String joinEntries(final Iterable<? extends T> c, final String entryDelimiter, final String keyValueDelimiter, final String prefix, final String suffix, final boolean trim, final Function<? super T, ?> keyExtractor, final Function<? super T, ?> valueExtractor) throws IllegalArgumentException - Summary: Joins the entries of the provided Iterable into a single String with full control over formatting.
-
Contract:
- If trim is {@code true} , the string representations of extracted keys and values will be trimmed.
- </p> <p> If the iterable is {@code null} or empty, the method returns only the concatenated prefix and suffix (or empty string if both are empty).
-
Parameters:
-
c(Iterable<? extends T>) — the iterable whose elements are to be joined, may be {@code null} or empty -
entryDelimiter(String) — the delimiter to use between entries -
keyValueDelimiter(String) — the delimiter to use between keys and values -
prefix(String) — the string to place at the start of the result. It can be empty. -
suffix(String) — the string to place at the end of the result. It can be empty. -
trim(boolean) — if {@code true} , trims the string representations of extracted keys and values. -
keyExtractor(Function<? super T, ?>) — function to extract keys from elements. Must not be {@code null} . -
valueExtractor(Function<? super T, ?>) — function to extract values from elements. Must not be {@code null} .
-
- Returns: a string representation of the iterable's elements with prefix and suffix, or just prefix+suffix if the iterable is {@code null} or empty.
-
Throws:
-
java.lang.IllegalArgumentException— if keyExtractor or valueExtractor is null
-
- See also: #join(Iterable), #join(Iterable, String), #joinEntries(Map, String, String)
concat(...) -> String
-
Signature:
public static String concat(final String a, final String b) - Summary: Concatenates two strings into a single string.
-
Contract:
- If either string is {@code null} or empty, it is treated as an empty string before concatenation.
- </p> <p> The method returns an empty string if both input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if both inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c) - Summary: Concatenates three strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d) - Summary: Concatenates four strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d, final String e) - Summary: Concatenates five strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty -
e(String) — the fifth string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d, final String e, final String f) - Summary: Concatenates six strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty -
e(String) — the fifth string to concatenate, may be {@code null} or empty -
f(String) — the sixth string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d, final String e, final String f, final String g) - Summary: Concatenates seven strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty -
e(String) — the fifth string to concatenate, may be {@code null} or empty -
f(String) — the sixth string to concatenate, may be {@code null} or empty -
g(String) — the seventh string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d, final String e, final String f, final String g, final String h) - Summary: Concatenates eight strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty -
e(String) — the fifth string to concatenate, may be {@code null} or empty -
f(String) — the sixth string to concatenate, may be {@code null} or empty -
g(String) — the seventh string to concatenate, may be {@code null} or empty -
h(String) — the eighth string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String a, final String b, final String c, final String d, final String e, final String f, final String g, final String h, final String i) - Summary: Concatenates nine strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all input strings are {@code null} or empty.
-
Parameters:
-
a(String) — the first string to concatenate, may be {@code null} or empty -
b(String) — the second string to concatenate, may be {@code null} or empty -
c(String) — the third string to concatenate, may be {@code null} or empty -
d(String) — the fourth string to concatenate, may be {@code null} or empty -
e(String) — the fifth string to concatenate, may be {@code null} or empty -
f(String) — the sixth string to concatenate, may be {@code null} or empty -
g(String) — the seventh string to concatenate, may be {@code null} or empty -
h(String) — the eighth string to concatenate, may be {@code null} or empty -
i(String) — the ninth string to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if all inputs are {@code null} or empty.
-
Signature:
public static String concat(final String... a) - Summary: Concatenates the given array of strings into a single string.
-
Contract:
- </p> <p> The method returns an empty string if the array is {@code null} , empty, or contains only {@code null} elements.
-
Parameters:
-
a(String[]) — the array of strings to concatenate, may be {@code null} or empty
-
- Returns: the concatenated string. Returns an empty string if the array is {@code null} or empty.
-
Signature:
public static String concat(final Object a, final Object b) - Summary: Concatenates the string representations of two objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if both objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
-
Signature:
public static String concat(final Object a, final Object b, final Object c) - Summary: Concatenates the string representations of three objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d) - Summary: Concatenates the string representations of four objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d, final Object e) - Summary: Concatenates the string representations of five objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null} -
e(Object) — the fifth object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d, final Object e, final Object f) - Summary: Concatenates the string representations of six objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null} -
e(Object) — the fifth object to concatenate, may be {@code null} -
f(Object) — the sixth object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d, final Object e, final Object f, final Object g) - Summary: Concatenates the string representations of seven objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null} -
e(Object) — the fifth object to concatenate, may be {@code null} -
f(Object) — the sixth object to concatenate, may be {@code null} -
g(Object) — the seventh object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d, final Object e, final Object f, final Object g, final Object h) - Summary: Concatenates the string representations of eight objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null} -
e(Object) — the fifth object to concatenate, may be {@code null} -
f(Object) — the sixth object to concatenate, may be {@code null} -
g(Object) — the seventh object to concatenate, may be {@code null} -
h(Object) — the eighth object to concatenate, may be {@code null}
-
- Returns: the concatenated string representation of the objects.
- See also: #concat(Object, Object)
-
Signature:
public static String concat(final Object a, final Object b, final Object c, final Object d, final Object e, final Object f, final Object g, final Object h, final Object i) - Summary: Concatenates the string representations of nine objects into a single string.
-
Contract:
- </p> <p> The method returns an empty string if all objects are {@code null} .
-
Parameters:
-
a(Object) — the first object to concatenate, may be {@code null} -
b(Object) — the second object to concatenate, may be {@code null} -
c(Object) — the third object to concatenate, may be {@code null} -
d(Object) — the fourth object to concatenate, may be {@code null} -
e(Object) — the fifth object to concatenate, may be {@code null} -
f(Object) — the sixth object to concatenate, may be {@code null} -
g(Object) — the seventh object to concatenate, may be {@code null} -
h(Object) — the eighth object to concatenate, may be {@code null} -
i(Object) — the ninth object to concatenate, may be {@code null}
-
- Returns: the concatenated string. Returns an empty string if all input objects are {@code null} or empty.
lenientFormat(...) -> String
-
Signature:
public static String lenientFormat(String template, Object... args) - Summary: <p> Note: It's copied from Google Guava under Apache License 2.0 and may be modified.
-
Contract:
- If there are more placeholders than arguments, the extra placeholders remain unchanged.
- If there are more arguments than placeholders, the extra arguments are appended to the end in square brackets.
-
Parameters:
-
template(String) — a string containing zero or more {@code "%s"} placeholder sequences. {@code null} is treated as the four-character string {@code "null"} . -
args(Object[]) — the arguments to be substituted into the message template. The first argument specified is substituted for the first occurrence of {@code "%s"} in the template, and so forth. A {@code null} argument is converted to the four-character string {@code "null"} ; {@code non-null} values are converted to strings using {@link Object#toString()} .
-
- Returns: the formatted string with placeholders replaced by arguments.
reverse(...) -> String
-
Signature:
public static String reverse(final String str) - Summary: Reverses the characters in the given string.
-
Contract:
- If the input string is {@code null} , empty, or has a length of 1 or less, it is returned unchanged.
-
Parameters:
-
str(String) — the string to be reversed. May be {@code null} or empty.
-
- Returns: a new string with the characters reversed. If the input string is {@code null} or empty or its length < = 1, the input string is returned.
reverseDelimited(...) -> String
-
Signature:
public static String reverseDelimited(final String str, final char delimiter) - Summary: Reverses a string that is delimited by a specific character.
-
Contract:
- </p> <p> If the delimiter is not found in the string, the original string is returned unchanged.
-
Parameters:
-
str(String) — the string to reverse, which may be {@code null} . -
delimiter(char) — the delimiter character to use for splitting and joining.
-
- Returns: the string with its delimited segments reversed. If the input string is {@code null} or empty or its length < = 1, the input string is returned.
-
Signature:
public static String reverseDelimited(final String str, final String delimiter) - Summary: Reverses the order of delimited elements in a string.
-
Contract:
- </p> <p> If the delimiter is not found in the string, the original string is returned unchanged.
-
Parameters:
-
str(String) — the string to be reversed. May be {@code null} or empty. -
delimiter(String) — the delimiter that separates the elements in the string.
-
- Returns: the reversed string. If the input string is {@code null} or empty or its length < = 1, the input string is returned.
sort(...) -> String
-
Signature:
public static String sort(final String str) - Summary: Sorts the characters in the given string in ascending order.
-
Contract:
- </p> <p> If the input string is {@code null} , empty, or has a length of 1 or less, it is returned unchanged.
-
Parameters:
-
str(String) — the string whose characters are to be sorted. May be {@code null} or empty.
-
- Returns: a new sorted string if the specified {@code str} is not {@code null} or empty, otherwise the specified {@code str} is returned. If the input string is {@code null} or empty or its length < = 1, the input string is returned.
rotate(...) -> String
-
Signature:
public static String rotate(final String str, final int shift) - Summary: Rotates (circular shift) a string by the specified number of positions.
-
Parameters:
-
str(String) — the String to rotate, may be {@code null} -
shift(int) — number of time to shift (positive : right shift, negative : left shift)
-
- Returns: the rotated String, or the original String if {@code shift == 0} , or {@code null} if {@code null} String input
shuffle(...) -> String
-
Signature:
public static String shuffle(final String str) - Summary: Shuffles the characters in the given string using a default random number generator.
-
Contract:
- </p> <p> If the input string is {@code null} , empty, or has a length of 1 or less, it is returned unchanged.
-
Parameters:
-
str(String) — the string to be shuffled. May be {@code null} or empty.
-
- Returns: a new string with the characters shuffled. If the input string is {@code null} or empty, the input string is returned.
-
Signature:
public static String shuffle(final String str, final Random rnd) - Summary: Shuffles the characters in the given string using the provided Random instance.
-
Contract:
- This allows for reproducible shuffling when using a Random instance with a fixed seed.
- </p> <p> If the input string is {@code null} , empty, or has a length of 1 or less, it is returned unchanged.
-
Parameters:
-
str(String) — the string to be shuffled. May be {@code null} or empty. -
rnd(Random) — the Random instance used to shuffle the characters.
-
- Returns: a new string with the characters shuffled. If the input string is {@code null} or empty, the input string is returned.
overlay(...) -> String
-
Signature:
@Deprecated public static String overlay(final String str, final String overlay, final int start, final int end) throws IndexOutOfBoundsException - Summary: Overlays part of a String with another String.
-
Contract:
- </p> <p> If the overlay string is {@code null} or empty, the specified portion is simply removed.
-
Parameters:
-
str(String) — the String to do overlaying in, may be {@code null} -
overlay(String) — the String to overlay, may be {@code null} -
start(int) — the position to start overlaying at; must be valid index -
end(int) — the position to stop overlaying before; must be valid
-
- Returns: overlayed String, or {@code overlay} if {@code null} String input
-
Throws:
-
java.lang.IndexOutOfBoundsException— if start or end is negative, or end is greater than the length of str, or indices are invalid
-
- See also: #replaceRange(String, int, int, String), N#replaceRange(String, int, int, String)
parseBoolean(...) -> boolean
-
Signature:
public static boolean parseBoolean(final String str) - Summary: Parses the string argument as a boolean.
-
Contract:
- <p> This method returns {@code true} if and only if the string is not {@code null} , not empty, and is equal, ignoring case, to the string "true".
-
Parameters:
-
str(String) — the string to be parsed. May be {@code null} .
-
- Returns: the boolean represented by the string argument.
- See also: Boolean#parseBoolean(String)
parseChar(...) -> char
-
Signature:
public static char parseChar(final String str) - Summary: Parses the string argument as a char.
-
Contract:
- <p> This method handles three cases: <ul> <li> If the string is {@code null} or empty, returns {@code '\\0'} (the {@code null} character) </li> <li> If the string has exactly one character, returns that character </li> <li> Otherwise, parses the string as an integer and casts it to char </li> </ul> <p> This allows for both direct character representation and numeric character codes.
-
Parameters:
-
str(String) — the string to be parsed. May be {@code null} .
-
- Returns: the char represented by the string argument.
parseByte(...) -> byte
-
Signature:
@Deprecated public static byte parseByte(final String str) throws NumberFormatException - Summary: Returns the value by calling {@code Byte.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code byte} is returned.
-
Contract:
- Returns the value by calling {@code Byte.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code byte} is returned.
-
Parameters:
-
str(String) — the string to parse, may be {@code null}
-
- Returns: the parsed byte value, or 0 if the string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is not a parsable {@code byte} .
-
- See also: Numbers#toByte(String)
parseShort(...) -> short
-
Signature:
@Deprecated public static short parseShort(final String str) throws NumberFormatException - Summary: Returns the value by calling {@code Short.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code short} is returned.
-
Contract:
- Returns the value by calling {@code Short.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code short} is returned.
-
Parameters:
-
str(String) — the string to parse, may be {@code null}
-
- Returns: the parsed short value, or 0 if the string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is not a parsable {@code short} .
-
- See also: Numbers#toShort(String)
parseInt(...) -> int
-
Signature:
@Deprecated public static int parseInt(final String str) throws NumberFormatException - Summary: Converts the given string to an integer value.
-
Contract:
- If the string is {@code null} or empty, default value {@code 0} is returned.
-
Parameters:
-
str(String) — the string to convert. This can be any instance of String.
-
- Returns: the integer representation of the provided string, or {@code 0} if the object is {@code null} or empty.
-
Throws:
-
java.lang.NumberFormatException— if the string cannot be parsed as an integer.
-
- See also: Numbers#toInt(String)
parseLong(...) -> long
-
Signature:
@Deprecated public static long parseLong(final String str) throws NumberFormatException - Summary: Returns the value by calling {@code Long.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code long} is returned.
-
Contract:
- Returns the value by calling {@code Long.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0 for {@code long} is returned.
-
Parameters:
-
str(String) — the string to parse, may be {@code null}
-
- Returns: the parsed long value, or 0 if the string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is not a parsable {@code long} .
-
- See also: Numbers#toLong(String)
parseFloat(...) -> float
-
Signature:
@Deprecated public static float parseFloat(final String str) throws NumberFormatException - Summary: Returns the value by calling {@code Float.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0f for {@code float} is returned.
-
Contract:
- Returns the value by calling {@code Float.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0f for {@code float} is returned.
-
Parameters:
-
str(String) — the string to parse, may be {@code null}
-
- Returns: the parsed float value, or 0f if the string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is not a parsable {@code float} .
-
- See also: Numbers#toFloat(String)
parseDouble(...) -> double
-
Signature:
@Deprecated public static double parseDouble(final String str) throws NumberFormatException - Summary: Returns the value by calling {@code Double.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0d for {@code double} is returned.
-
Contract:
- Returns the value by calling {@code Double.valueOf(String)} if {@code str} is not {@code null} , otherwise, the default value 0d for {@code double} is returned.
-
Parameters:
-
str(String) — the string to parse, may be {@code null}
-
- Returns: the parsed double value, or 0d if the string is {@code null}
-
Throws:
-
java.lang.NumberFormatException— if the string is not a parsable {@code double} .
-
- See also: Numbers#toDouble(String)
base64Encode(...) -> String
-
Signature:
public static String base64Encode(final byte[] binaryData) - Summary: Encodes the given binary data into a Base64 encoded string.
-
Contract:
- </p> <p> If the input byte array is {@code null} or empty, an empty string is returned.
-
Parameters:
-
binaryData(byte[]) — the byte array to be encoded.
-
- Returns: the Base64 encoded string, or an empty String {@code ""} if the input byte array is {@code null} or empty.
base64EncodeString(...) -> String
-
Signature:
public static String base64EncodeString(final String str) - Summary: Encodes the given string into a Base64 encoded string using the platform's default charset.
-
Contract:
- </p> <p> If the input string is {@code null} or empty, an empty string is returned.
-
Parameters:
-
str(String) — the string to be encoded.
-
- Returns: the Base64 encoded string, or an empty String {@code ""} if the input string is {@code null} or empty
-
Signature:
public static String base64EncodeString(final String str, final Charset charset) - Summary: Encodes the given string to a Base64 encoded string using the specified charset.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be encoded. -
charset(Charset) — the charset to be used to encode the input string.
-
- Returns: the Base64 encoded string.
- See also: String#getBytes(Charset)
base64EncodeUtf8String(...) -> String
-
Signature:
public static String base64EncodeUtf8String(final String str) - Summary: Encodes the given string into a Base64 encoded string using UTF-8 encoding.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be encoded.
-
- Returns: the Base64 encoded string, or an empty String {@code ""} if the input string is {@code null} or empty.
- See also: #base64EncodeString(String, Charset)
base64Decode(...) -> byte\[\]
-
Signature:
public static byte[] base64Decode(final String base64String) - Summary: Decodes the given Base64 encoded string to a byte array.
-
Contract:
- </p> <p> The method returns an empty byte array if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 encoded string to be decoded.
-
- Returns: the decoded byte array, or an empty byte array if the input string is {@code null} or empty.
base64DecodeToString(...) -> String
-
Signature:
public static String base64DecodeToString(final String base64String) - Summary: Decodes the given Base64 encoded string to its original string representation.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 encoded string to be decoded.
-
- Returns: the decoded string, or an empty String {@code ""} if the input string is {@code null} or empty.
-
Signature:
public static String base64DecodeToString(final String base64String, final Charset charset) - Summary: Decodes the given Base64 encoded string to a string using the specified charset.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 encoded string to be decoded. -
charset(Charset) — the charset to be used to decode the resulting byte array.
-
- Returns: the decoded string.
- See also: String#String(byte\[\], Charset)
base64DecodeToUtf8String(...) -> String
-
Signature:
public static String base64DecodeToUtf8String(final String base64String) - Summary: Decodes the given Base64 encoded string to a UTF-8 string.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 encoded string to be decoded.
-
- Returns: the decoded UTF-8 string, or an empty String {@code ""} if the input string is {@code null} or empty.
base64UrlEncode(...) -> String
-
Signature:
public static String base64UrlEncode(final byte[] binaryData) - Summary: Encodes the given byte array to a Base64 URL encoded string.
-
Contract:
- </p> <p> The method returns an empty string if the input byte array is {@code null} or empty.
-
Parameters:
-
binaryData(byte[]) — the byte array to be encoded.
-
- Returns: the Base64 URL encoded string, or an empty String {@code ""} if the input byte array is {@code null} or empty.
base64UrlDecode(...) -> byte\[\]
-
Signature:
public static byte[] base64UrlDecode(final String base64String) - Summary: Decodes the given Base64 URL encoded string to a byte array.
-
Contract:
- </p> <p> The method returns an empty byte array if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 URL encoded string to be decoded.
-
- Returns: the decoded byte array, an empty byte array if the input string is {@code null} or empty.
base64UrlDecodeToString(...) -> String
-
Signature:
public static String base64UrlDecodeToString(final String base64String) - Summary: Decodes the given Base64 URL encoded string to a regular string.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 URL encoded string to be decoded.
-
- Returns: the decoded string, or an empty String {@code ""} if the input string is {@code null} or empty.
-
Signature:
public static String base64UrlDecodeToString(final String base64String, final Charset charset) - Summary: Decodes the given Base64 URL encoded string to a string using the specified charset.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 URL encoded string to be decoded. -
charset(Charset) — the charset to be used to decode the based decoded {@code bytes}
-
- Returns: the decoded string, or an empty String {@code ""} if the input string is {@code null} or empty.
base64UrlDecodeToUtf8String(...) -> String
-
Signature:
public static String base64UrlDecodeToUtf8String(final String base64String) - Summary: Decodes the given Base64 URL encoded string to a UTF-8 string.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
base64String(String) — the Base64 URL encoded string to be decoded.
-
- Returns: the decoded UTF-8 string, or an empty String {@code ""} if the input string is {@code null} or empty.
urlEncode(...) -> String
-
Signature:
public static String urlEncode(final Object parameters) - Summary: Encodes the given parameters into a URL-encoded string.
-
Parameters:
-
parameters(Object) — the parameters to be URL-encoded.
-
- Returns: the URL-encoded string representation of the parameters.
- See also: URLEncodedUtil#encode(Object), URLEncoder#encode(String, String)
-
Signature:
public static String urlEncode(final Object parameters, final Charset charset) - Summary: Encodes the given parameters into a URL-encoded string using the specified charset.
-
Contract:
- This is useful when dealing with non-ASCII characters that need to be encoded using a specific character set.
-
Parameters:
-
parameters(Object) — the parameters to be URL-encoded. -
charset(Charset) — the charset to be used for encoding.
-
- Returns: the URL-encoded string representation of the parameters.
- See also: URLEncodedUtil#encode(Object, Charset), URLEncoder#encode(String, Charset)
urlDecode(...) -> Map<String, String>
-
Signature:
public static Map<String, String> urlDecode(final String urlQuery) - Summary: Decodes the given URL query string into a map of key-value pairs.
-
Contract:
- </p> <p> The method returns an empty map if the input is {@code null} or empty.
-
Parameters:
-
urlQuery(String) — the URL query string to be decoded.
-
- Returns: a map containing the decoded key-value pairs from the URL query string.
- See also: URLEncodedUtil#decode(String), URLDecoder#decode(String)
-
Signature:
public static Map<String, String> urlDecode(final String urlQuery, final Charset charset) - Summary: Decodes the given URL query string into a map of key-value pairs using the specified charset.
-
Contract:
- </p> <p> The method returns an empty map if the input is {@code null} or empty.
-
Parameters:
-
urlQuery(String) — the URL query string to be decoded. -
charset(Charset) — the charset to be used for decoding.
-
- Returns: a map containing the decoded key-value pairs from the URL query string.
- See also: URLEncodedUtil#decode(String, Charset), URLDecoder#decode(String, Charset)
-
Signature:
public static <T> T urlDecode(final String urlQuery, final Class<? extends T> targetType) - Summary: Decodes the given URL query string into an object of the specified type.
-
Contract:
- The class should have properties that match the parameter names in the query string.
- </p> <p> The method returns {@code null} if the input is {@code null} or empty.
-
Parameters:
-
urlQuery(String) — the URL query string to be decoded. -
targetType(Class<? extends T>) — the class of the object to be returned.
-
- Returns: an object of the specified type containing the decoded data from the URL query string.
- See also: URLEncodedUtil#decode(String, Class)
-
Signature:
public static <T> T urlDecode(final String urlQuery, final Charset charset, final Class<? extends T> targetType) - Summary: Decodes a URL query string into an object of the specified type.
-
Contract:
- </p> <p> The method returns {@code null} if the input is {@code null} or empty.
-
Parameters:
-
urlQuery(String) — the URL query string to be decoded. -
charset(Charset) — the charset to be used for decoding. -
targetType(Class<? extends T>) — the class of the object to be returned.
-
- Returns: an object of type T that represents the decoded URL query string.
- See also: URLEncodedUtil#decode(String, Charset, Class)
isBase64(...) -> boolean
-
Signature:
public static boolean isBase64(final byte octet) - Summary: Returns whether the {@code octet} is in the base 64 alphabet.
-
Contract:
- <p> This method checks if a given byte value is a valid Base64 character according to the Base64 alphabet.
-
Parameters:
-
octet(byte) — the value to test
-
- Returns: {@code true} if the value is defined in the base 64 alphabet, {@code false} otherwise.
-
Signature:
public static boolean isBase64(final byte[] arrayOctet) - Summary: Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.
-
Contract:
- Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.
-
Parameters:
-
arrayOctet(byte[]) — byte array to test
-
- Returns: {@code true} if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; {@code false} otherwise
-
Signature:
public static boolean isBase64(final String base64) - Summary: Tests a given String to see if it contains only valid characters within the Base64 alphabet.
-
Contract:
- Tests a given String to see if it contains only valid characters within the Base64 alphabet.
-
Parameters:
-
base64(String) — string to test
-
- Returns: {@code true} if all characters in the String are valid characters in the Base64 alphabet or if the String is empty; {@code false} otherwise
findFirstEmailAddress(...) -> String
-
Signature:
@MayReturnNull public static String findFirstEmailAddress(final CharSequence cs) - Summary: Searches for the first occurrence of an email address within the given CharSequence.
-
Contract:
- If an email address is found, it is returned; otherwise, the method returns {@code null} .
-
Parameters:
-
cs(CharSequence) — the CharSequence to be searched, may be {@code null} or empty
-
- Returns: the first email address found in the CharSequence, or {@code null} if no email address is found.
- See also: #isValidEmailAddress(CharSequence), #findAllEmailAddresses(CharSequence)
findAllEmailAddresses(...) -> List<String>
-
Signature:
public static List<String> findAllEmailAddresses(final CharSequence cs) - Summary: Finds all the email addresses in the given CharSequence.
-
Contract:
- If no email address is found, it returns an empty list.
-
Parameters:
-
cs(CharSequence) — the CharSequence to be searched, may be {@code null} or empty
-
- Returns: a list of all found email addresses, or an empty list if no email address is found.
- See also: #isValidEmailAddress(CharSequence), #findFirstEmailAddress(CharSequence)
copyThenTrim(...) -> String\[\]
-
Signature:
@Beta @MayReturnNull public static String[] copyThenTrim(final String[] strs) - Summary: Creates a copy of the given array of strings and trims each string in the array.
-
Contract:
- </p> <p> The method returns {@code null} if the input array is {@code null} .
-
Parameters:
-
strs(String[]) — the array of strings to be copied and trimmed. May be {@code null} .
-
- Returns: a new array with the trimmed strings. Returns {@code null} if the input array is {@code null} .
- See also: N#copyThenReplaceAll(Object\[\], java.util.function.UnaryOperator), Fn#trim(), Fn#trimToEmpty(), Fn#trimToNull()
copyThenStrip(...) -> String\[\]
-
Signature:
@Beta @MayReturnNull public static String[] copyThenStrip(final String[] strs) - Summary: Creates a copy of the given array of strings and strips each string in the array.
-
Contract:
- </p> <p> The method returns {@code null} if the input array is {@code null} .
-
Parameters:
-
strs(String[]) — the array of strings to be copied and stripped, may be {@code null} .
-
- Returns: a new array with the stripped strings. Returns {@code null} if the input array is {@code null} .
- See also: N#copyThenReplaceAll(Object\[\], java.util.function.UnaryOperator), Fn#strip(), Fn#stripToEmpty(), Fn#stripToNull()
extractFirstInteger(...) -> String
-
Signature:
@MayReturnNull public static String extractFirstInteger(final String str) - Summary: Extracts the first occurrence of an integer from the given string.
-
Contract:
- </p> <p> The method returns {@code null} if no integer is found or if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to extract the integer from, may be {@code null} or empty
-
- Returns: the extracted integer as a string, or {@code null} if no integer is found, or the input string is {@code null} or empty.
- See also: #replaceFirstInteger(String, String), Numbers#extractFirstInt(String), Numbers#extractFirstLong(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#INTEGER_FINDER
extractFirstDouble(...) -> String
-
Signature:
public static String extractFirstDouble(final String str) - Summary: Extracts the first occurrence of a double from the given string.
-
Contract:
- </p> <p> The method returns {@code null} if no number is found or the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to extract the double from, may be {@code null} or empty
-
- Returns: the extracted double as a string, or {@code null} if no double is found, or the input string is {@code null} or empty.
- See also: #extractFirstInteger(String), #replaceFirstDouble(String, String), Numbers#extractFirstDouble(String), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
-
Signature:
@MayReturnNull public static String extractFirstDouble(final String str, final boolean includingScientificNumber) - Summary: Extracts the first occurrence of a double from the given string.
-
Contract:
- When scientific notation is enabled, it can extract numbers like "1.23e10" or "5E-3".
- </p> <p> The method returns {@code null} if no number is found or if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to extract the double from, may be {@code null} or empty -
includingScientificNumber(boolean) — if {@code true} , it will also include scientific numbers in the search.
-
- Returns: the extracted double as a string, or {@code null} if no double is found, or the input string is {@code null} or empty.
- See also: #extractFirstInteger(String), #extractFirstDouble(String), #replaceFirstDouble(String, String), Numbers#extractFirstDouble(String, boolean), RegExUtil#findFirst(String, Pattern), RegExUtil#findLast(String, Pattern), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
replaceFirstInteger(...) -> String
-
Signature:
public static String replaceFirstInteger(final String str, final String replacement) - Summary: Replaces the first occurrence of an integer in the given string with the specified replacement string.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be modified, may be {@code null} or empty -
replacement(String) — the string to replace the integer with.
-
- Returns: the modified string with the first integer replaced by the specified replacement string, or an empty string if the input is {@code null} or empty.
- See also: #extractFirstInteger(String), RegExUtil#replaceFirst(String, Pattern, String), RegExUtil#replaceLast(String, Pattern, String), RegExUtil#INTEGER_FINDER
replaceFirstDouble(...) -> String
-
Signature:
public static String replaceFirstDouble(final String str, final String replacement) - Summary: Replaces the first occurrence of a double in the given string with the specified replacement string.
-
Contract:
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be modified, may be {@code null} or empty -
replacement(String) — the string to replace the double with.
-
- Returns: the modified string with the first double replaced by the specified replacement string, or an empty string if the input is {@code null} or empty.
- See also: #extractFirstDouble(String), RegExUtil#replaceFirst(String, Pattern, String), RegExUtil#replaceLast(String, Pattern, String), RegExUtil#NUMBER_FINDER
-
Signature:
public static String replaceFirstDouble(final String str, final String replacement, final boolean includingScientificNumber) - Summary: Replaces the first occurrence of a double in the given string with the specified replacement string.
-
Contract:
- When scientific notation is enabled, it can match and replace numbers in scientific format (e.g., "1.23e10").
- </p> <p> The method returns an empty string if the input is {@code null} or empty.
-
Parameters:
-
str(String) — the string to be modified, may be {@code null} or empty -
replacement(String) — the string to replace the double with. -
includingScientificNumber(boolean) — if {@code true} , it will also include scientific numbers in the search.
-
- Returns: the modified string with the first double replaced by the specified replacement string, or an empty string if the input is {@code null} or empty.
- See also: #extractFirstDouble(String, boolean), RegExUtil#replaceFirst(String, Pattern, String), RegExUtil#replaceLast(String, Pattern, String), RegExUtil#NUMBER_FINDER, RegExUtil#SCIENTIFIC_NUMBER_FINDER
Public Instance Methods
- (none)
Enum ExtractStrategy (com.landawn.abacus.util.Strings.ExtractStrategy)
Enum defining different strategies for extracting substrings between delimiters.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class StrUtil (com.landawn.abacus.util.Strings.StrUtil)
A specialized utility class providing null-safe and {@link Optional} -wrapped string manipulation methods.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
substring(...) -> Optional<String>
-
Signature:
public static Optional<String> substring(final String str, final int inclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the index is negative or greater than or equal to the string length, or if the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring.
-
- Returns: an {@code Optional<String>} containing the substring if valid, otherwise empty.
- See also: Strings#substring(String, int)
-
Signature:
public static Optional<String> substring(final String str, final int inclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the indices are invalid (negative, begin > = end, or out of bounds), or if the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: an {@code Optional<String>} containing the substring if valid, otherwise empty.
- See also: Strings#substring(String, int, int)
-
Signature:
public static Optional<String> substring(final String str, final int inclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the resulting indices are invalid or if the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
funcOfExclusiveEndIndex(IntUnaryOperator) — a function that takes the string length and returns the exclusive end index.
-
- Returns: an {@code Optional<String>} containing the substring if valid, otherwise empty.
- See also: Strings#substring(String, int, IntUnaryOperator)
-
Signature:
public static Optional<String> substring(final String str, final IntUnaryOperator funcOfInclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the resulting indices are invalid or if the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
funcOfInclusiveBeginIndex(IntUnaryOperator) — a function that takes the exclusive end index and returns the inclusive begin index. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: an {@code Optional<String>} containing the substring if valid, otherwise empty.
- See also: Strings#substring(String, IntUnaryOperator, int)
substringOrElse(...) -> String
-
Signature:
@Beta public static String substringOrElse(final String str, final int inclusiveBeginIndex, final String defaultStr) - Summary: Returns the substring if it exists, otherwise returns {@code defaultStr} .
-
Contract:
- Returns the substring if it exists, otherwise returns {@code defaultStr} .
- If the substring cannot be extracted (due to invalid index or {@code null} string), the default string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
defaultStr(String) — the default string to return if substring extraction fails, can be {@code null} .
-
- Returns: the substring if it exists, otherwise {@code defaultStr} .
- See also: Strings#substringAfter(String, char)
-
Signature:
@Beta public static String substringOrElse(final String str, final int inclusiveBeginIndex, final int exclusiveEndIndex, final String defaultStr) - Summary: Returns the substring if it exists, otherwise returns {@code defaultStr} .
-
Contract:
- Returns the substring if it exists, otherwise returns {@code defaultStr} .
- If the substring cannot be extracted (due to invalid indices or {@code null} string), the default string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring. -
defaultStr(String) — the default string to return if substring extraction fails, can be {@code null} .
-
- Returns: the substring if it exists, otherwise {@code defaultStr} .
- See also: Strings#substring(String, int, int)
-
Signature:
@Beta public static String substringOrElse(final String str, final int inclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex, final String defaultStr) - Summary: Returns the substring if it exists, otherwise returns {@code defaultStr} .
-
Contract:
- Returns the substring if it exists, otherwise returns {@code defaultStr} .
- If the substring cannot be extracted, the default string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
funcOfExclusiveEndIndex(IntUnaryOperator) — a function that takes the string length and returns the exclusive end index. -
defaultStr(String) — the default string to return if substring extraction fails, can be {@code null} .
-
- Returns: the substring if it exists, otherwise {@code defaultStr} .
- See also: Strings#substring(String, int, IntUnaryOperator)
-
Signature:
@Beta public static String substringOrElse(final String str, final IntUnaryOperator funcOfInclusiveBeginIndex, final int exclusiveEndIndex, final String defaultStr) - Summary: Returns the substring if it exists, otherwise returns {@code defaultStr} .
-
Contract:
- Returns the substring if it exists, otherwise returns {@code defaultStr} .
- If the substring cannot be extracted, the default string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
funcOfInclusiveBeginIndex(IntUnaryOperator) — a function that takes the exclusive end index and returns the inclusive begin index. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring. -
defaultStr(String) — the default string to return if substring extraction fails, can be {@code null} .
-
- Returns: the substring if it exists, otherwise {@code defaultStr} .
- See also: Strings#substring(String, IntUnaryOperator, int)
substringOrElseItself(...) -> String
-
Signature:
@Beta public static String substringOrElseItself(final String str, final int inclusiveBeginIndex) - Summary: Returns the substring if it exists, otherwise returns {@code str} itself.
-
Contract:
- Returns the substring if it exists, otherwise returns {@code str} itself.
- If the substring cannot be extracted (due to invalid index), the original string is returned.
- If the string is {@code null} , {@code null} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring.
-
- Returns: the substring if it exists, otherwise {@code str} itself.
- See also: Strings#substringAfter(String, char)
-
Signature:
@Beta public static String substringOrElseItself(final String str, final int inclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring if it exists, otherwise returns {@code str} itself.
-
Contract:
- Returns the substring if it exists, otherwise returns {@code str} itself.
- If the substring cannot be extracted (due to invalid indices), the original string is returned.
- If the string is {@code null} , {@code null} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: the substring if it exists, otherwise {@code str} itself.
- See also: Strings#substring(String, int, int)
-
Signature:
@Beta public static String substringOrElseItself(final String str, final int inclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Returns the substring if it exists, otherwise returns {@code str} itself.
-
Contract:
- Returns the substring if it exists, otherwise returns {@code str} itself.
- If the substring cannot be extracted, the original string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
inclusiveBeginIndex(int) — the starting index (inclusive) of the substring. -
funcOfExclusiveEndIndex(IntUnaryOperator) — a function that takes the string length and returns the exclusive end index.
-
- Returns: the substring if it exists, otherwise {@code str} itself.
- See also: Strings#substring(String, int, IntUnaryOperator)
-
Signature:
@Beta public static String substringOrElseItself(final String str, final IntUnaryOperator funcOfInclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring if it exists, otherwise returns {@code str} itself.
-
Contract:
- Returns the substring if it exists, otherwise returns {@code str} itself.
- If the substring cannot be extracted, the original string is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
funcOfInclusiveBeginIndex(IntUnaryOperator) — a function that takes the exclusive end index and returns the inclusive begin index. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: the substring if it exists, otherwise {@code str} itself.
- See also: Strings#substring(String, IntUnaryOperator, int)
substringAfter(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringAfter(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the delimiter character after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the delimiter, or empty if not found.
- See also: Strings#substringAfter(String, char)
-
Signature:
@Beta public static Optional<String> substringAfter(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the delimiter, or empty if not found.
- See also: Strings#substringAfter(String, String)
-
Signature:
@Beta public static Optional<String> substringAfter(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found, the end index is invalid, or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which the substring begins. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: an {@code Optional<String>} containing the substring after the delimiter up to the end index, or empty if not found.
- See also: Strings#substringAfter(String, String, int)
substringAfterLast(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringAfterLast(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the delimiter character after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the last occurrence of the delimiter, or empty if not found.
- See also: Strings#substringAfterLast(String, String)
-
Signature:
@Beta public static Optional<String> substringAfterLast(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the last occurrence of the delimiter, or empty if not found.
- See also: Strings#substringAfterLast(String, String)
-
Signature:
@Beta public static Optional<String> substringAfterLast(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found, the end index is invalid, or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter string after which the substring begins. -
exclusiveEndIndex(int) — the ending index (exclusive) of the substring.
-
- Returns: an {@code Optional<String>} containing the substring after the last delimiter up to the end index, or empty if not found.
- See also: Strings#substringAfterLast(String, String, int)
substringAfterAny(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringAfterAny(final String str, final char... delimitersOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If none of the delimiters are found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimitersOfExclusiveBeginIndex(char[]) — the delimiter characters after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the first found delimiter, or empty if none found.
- See also: Strings#substringAfterAny(String, char\[\])
-
Signature:
@Beta public static Optional<String> substringAfterAny(final String str, final String... delimitersOfExclusiveBeginIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If none of the delimiters are found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimitersOfExclusiveBeginIndex(String[]) — the delimiter strings after which the substring begins.
-
- Returns: an {@code Optional<String>} containing the substring after the first found delimiter, or empty if none found.
- See also: Strings#substringAfterAny(String, String\[\])
substringBefore(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringBefore(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveEndIndex(char) — the delimiter character before which the substring ends.
-
- Returns: an {@code Optional<String>} containing the substring before the delimiter, or empty if not found.
- See also: Strings#substringBefore(String, String)
-
Signature:
@Beta public static Optional<String> substringBefore(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
-
Contract:
- Returns {@code Optional<String>} with value of the substring if it exists, otherwise returns an empty {@code Optional<String>} .
- If the delimiter is not found or the string is {@code null} , an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string from which to extract the substring, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the delimiter string before which the substring ends.
-
- Returns: an {@code Optional<String>} containing the substring before the delimiter, or empty if not found.
- See also: Strings#substringBefore(String, String)
-
Signature:
@Beta public static Optional<String> substringBefore(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before the specified delimiter, starting from the given inclusive begin index.
-
Contract:
- If the delimiter is not found after the specified index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
inclusiveBeginIndex(int) — the index from which to start searching (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBefore(String, int, String)
substringBeforeLast(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringBeforeLast(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before the last occurrence of the specified character delimiter.
-
Contract:
- If the delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(char) — the character delimiter marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBeforeLast(String, String)
-
Signature:
@Beta public static Optional<String> substringBeforeLast(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before the last occurrence of the specified string delimiter.
-
Contract:
- If the delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBeforeLast(String, String)
-
Signature:
@Beta public static Optional<String> substringBeforeLast(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before the last occurrence of the specified delimiter, starting from the given inclusive begin index.
-
Contract:
- If the delimiter is not found after the specified index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
inclusiveBeginIndex(int) — the index from which to start searching (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBeforeLast(String, int, String)
substringBeforeAny(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> substringBeforeAny(final String str, final char... delimitersOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before any of the specified character delimiters.
-
Contract:
- If none of the delimiters are found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimitersOfExclusiveEndIndex(char[]) — the character delimiters marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBeforeAny(String, char\[\])
-
Signature:
@Beta public static Optional<String> substringBeforeAny(final String str, final String... delimitersOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring before any of the specified string delimiters.
-
Contract:
- If none of the delimiters are found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimitersOfExclusiveEndIndex(String[]) — the string delimiters marking the end of the substring (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBeforeAny(String, String\[\])
substringAfterOrElse(...) -> String
-
Signature:
@Beta public static String substringAfterOrElse(final String str, final String delimiterOfExclusiveBeginIndex, final String defaultStr) - Summary: Returns the substring after the specified delimiter if it exists, otherwise returns the default string.
-
Contract:
- Returns the substring after the specified delimiter if it exists, otherwise returns the default string.
- If the delimiter is not found or the input is {@code null} , the default string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter marking the beginning of the substring (exclusive). -
defaultStr(String) — the default string to return if substring is not found.
-
- Returns: the substring after the delimiter if found, otherwise {@code defaultStr} .
- See also: Strings#substringAfter(String, String)
substringAfterLastOrElse(...) -> String
-
Signature:
@Beta public static String substringAfterLastOrElse(final String str, final String delimiterOfExclusiveBeginIndex, final String defaultStr) - Summary: Returns the substring after the last occurrence of the specified delimiter if it exists, otherwise returns the default string.
-
Contract:
- Returns the substring after the last occurrence of the specified delimiter if it exists, otherwise returns the default string.
- If the delimiter is not found or the input is {@code null} , the default string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter marking the beginning of the substring (exclusive). -
defaultStr(String) — the default string to return if substring is not found.
-
- Returns: the substring after the last delimiter if found, otherwise {@code defaultStr} .
- See also: Strings#substringAfterLast(String, String)
substringBeforeOrElse(...) -> String
-
Signature:
@Beta public static String substringBeforeOrElse(final String str, final String delimiterOfExclusiveEndIndex, final String defaultStr) - Summary: Returns the substring before the specified delimiter if it exists, otherwise returns the default string.
-
Contract:
- Returns the substring before the specified delimiter if it exists, otherwise returns the default string.
- If the delimiter is not found or the input is {@code null} , the default string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive). -
defaultStr(String) — the default string to return if substring is not found.
-
- Returns: the substring before the delimiter if found, otherwise {@code defaultStr} .
- See also: Strings#substringBefore(String, String)
substringBeforeLastOrElse(...) -> String
-
Signature:
@Beta public static String substringBeforeLastOrElse(final String str, final String delimiterOfExclusiveEndIndex, final String defaultStr) - Summary: Returns the substring before the last occurrence of the specified delimiter if it exists, otherwise returns the default string.
-
Contract:
- Returns the substring before the last occurrence of the specified delimiter if it exists, otherwise returns the default string.
- If the delimiter is not found or the input is {@code null} , the default string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive). -
defaultStr(String) — the default string to return if substring is not found.
-
- Returns: the substring before the last delimiter if found, otherwise {@code defaultStr} .
- See also: Strings#substringBeforeLast(String, String)
substringAfterOrElseItself(...) -> String
-
Signature:
@Beta public static String substringAfterOrElseItself(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the specified character delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the specified character delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the character delimiter marking the beginning of the substring (exclusive).
-
- Returns: the substring after the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfter(String, char)
-
Signature:
@Beta public static String substringAfterOrElseItself(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the specified string delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the specified string delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning of the substring (exclusive).
-
- Returns: the substring after the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfter(String, String)
-
Signature:
@Beta public static String substringAfterOrElseItself(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring after the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter marking the beginning of the substring (exclusive). -
exclusiveEndIndex(int) — the index marking the end of the substring (exclusive).
-
- Returns: the substring after the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfter(String, String)
substringAfterLastOrElseItself(...) -> String
-
Signature:
@Beta public static String substringAfterLastOrElseItself(final String str, final char delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the last occurrence of the specified character delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the last occurrence of the specified character delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the character delimiter marking the beginning of the substring (exclusive).
-
- Returns: the substring after the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfterLast(String, String)
-
Signature:
@Beta public static String substringAfterLastOrElseItself(final String str, final String delimiterOfExclusiveBeginIndex) - Summary: Returns the substring after the last occurrence of the specified string delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the last occurrence of the specified string delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning of the substring (exclusive).
-
- Returns: the substring after the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfterLast(String, String)
-
Signature:
@Beta public static String substringAfterLastOrElseItself(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns the substring after the last occurrence of the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring after the last occurrence of the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the delimiter marking the beginning of the substring (exclusive). -
exclusiveEndIndex(int) — the index marking the end of the substring (exclusive).
-
- Returns: the substring after the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringAfterLast(String, String)
substringBeforeOrElseItself(...) -> String
-
Signature:
@Beta public static String substringBeforeOrElseItself(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the specified character delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the specified character delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(char) — the character delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBefore(String, String)
-
Signature:
@Beta public static String substringBeforeOrElseItself(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the specified string delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the specified string delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBefore(String, String)
-
Signature:
@Beta public static String substringBeforeOrElseItself(final String str, final int inclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the specified delimiter starting from the given index if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the specified delimiter starting from the given index if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
inclusiveBeginIndex(int) — the index from which to start searching (inclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBefore(String, String)
substringBeforeLastOrElseItself(...) -> String
-
Signature:
@Beta public static String substringBeforeLastOrElseItself(final String str, final char delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified character delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the last occurrence of the specified character delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(char) — the character delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBeforeLast(String, String)
-
Signature:
@Beta public static String substringBeforeLastOrElseItself(final String str, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified string delimiter if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the last occurrence of the specified string delimiter if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBeforeLast(String, String)
-
Signature:
@Beta public static String substringBeforeLastOrElseItself(final String str, final int exclusiveEndIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns the substring before the last occurrence of the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
-
Contract:
- Returns the substring before the last occurrence of the specified delimiter up to the exclusive end index if it exists, otherwise returns the original string itself.
- If the delimiter is not found or the input is {@code null} , the original string is returned.
-
Parameters:
-
str(String) — the string to search in, can be {@code null} . -
exclusiveEndIndex(int) — the index marking the end boundary for searching (exclusive). -
delimiterOfExclusiveEndIndex(String) — the delimiter marking the end of the substring (exclusive).
-
- Returns: the substring before the last delimiter if found, otherwise {@code str} itself.
- See also: Strings#substringBeforeLast(String, String)
substringBetween(...) -> Optional<String>
-
Signature:
public static Optional<String> substringBetween(final String str, final int exclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the specified exclusive begin and end indices.
-
Contract:
- If the indices are invalid (negative, out of bounds, or begin index >= end index), an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
exclusiveBeginIndex(int) — the starting index (exclusive). -
exclusiveEndIndex(int) — the ending index (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if valid indices, otherwise empty.
- See also: Strings#substringBetween(String, int, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final int exclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the specified exclusive begin index and the first occurrence of the character delimiter.
-
Contract:
- If the delimiter is not found after the begin index or indices are invalid, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
exclusiveBeginIndex(int) — the starting index (exclusive). -
delimiterOfExclusiveEndIndex(char) — the character delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, int, char)
-
Signature:
public static Optional<String> substringBetween(final String str, final int exclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the specified exclusive begin index and the first occurrence of the string delimiter.
-
Contract:
- If the delimiter is not found after the begin index or indices are invalid, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
exclusiveBeginIndex(int) — the starting index (exclusive). -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, int, String)
-
Signature:
public static Optional<String> substringBetween(final String str, final char delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrence of the character delimiter and the specified exclusive end index.
-
Contract:
- If the delimiter is not found or indices are invalid, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the character delimiter marking the beginning (exclusive). -
exclusiveEndIndex(int) — the ending index (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, char, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrence of the string delimiter and the specified exclusive end index.
-
Contract:
- If the delimiter is not found or indices are invalid, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
exclusiveEndIndex(int) — the ending index (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, String, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final char delimiterOfExclusiveBeginIndex, final char delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrences of the two specified character delimiters.
-
Contract:
- If either delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(char) — the character delimiter marking the beginning (exclusive). -
delimiterOfExclusiveEndIndex(char) — the character delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, char, char)
-
Signature:
public static Optional<String> substringBetween(final String str, final String tag) - Summary: Returns an {@code Optional<String>} containing the substring between occurrences of the same tag string.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
tag(String) — the tag string marking both the beginning and end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: #substringBetween(String, String, String), #substringBetween(String, int, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrences of the two specified string delimiters.
-
Contract:
- If either delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetween(String, String, String)
-
Signature:
public static Optional<String> substringBetween(final String str, final int fromIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the specified delimiters, starting the search from the given index.
-
Contract:
- If either delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
fromIndex(int) — the index from which to start searching. -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: #substringBetween(String, int, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final int exclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the exclusive begin index and a dynamically calculated exclusive end index.
-
Contract:
- The function receives the begin index and should return the corresponding end index.
- If the function returns an invalid index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
exclusiveBeginIndex(int) — the starting index (exclusive). -
funcOfExclusiveEndIndex(IntUnaryOperator) — function to calculate the ending index based on begin index.
-
- Returns: {@code Optional<String>} containing the substring if valid indices, otherwise empty.
- See also: Strings#substringBetween(String, int, IntUnaryOperator)
-
Signature:
public static Optional<String> substringBetween(final String str, final IntUnaryOperator funcOfExclusiveBeginIndex, final int exclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between a dynamically calculated exclusive begin index and the specified exclusive end index.
-
Contract:
- The function receives the end index and should return the corresponding begin index.
- If the function returns an invalid index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
funcOfExclusiveBeginIndex(IntUnaryOperator) — function to calculate the starting index based on end index. -
exclusiveEndIndex(int) — the ending index (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if valid indices, otherwise empty.
- See also: Strings#substringBetween(String, IntUnaryOperator, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final String delimiterOfExclusiveBeginIndex, final IntUnaryOperator funcOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrence of the delimiter and a dynamically calculated exclusive end index.
-
Contract:
- If the delimiter is not found or the function returns an invalid index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
funcOfExclusiveEndIndex(IntUnaryOperator) — function to calculate the ending index based on delimiter position.
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: #substringBetween(String, int, int)
-
Signature:
public static Optional<String> substringBetween(final String str, final IntUnaryOperator funcOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between a dynamically calculated exclusive begin index and the last occurrence of the delimiter.
-
Contract:
- The function receives the delimiter position and should return the begin index.
- If the delimiter is not found or the function returns an invalid index, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
funcOfExclusiveBeginIndex(IntUnaryOperator) — function to calculate the starting index based on delimiter position. -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: #substringBetween(String, int, int)
substringBetweenFirstAndLast(...) -> Optional<String>
-
Signature:
public static Optional<String> substringBetweenFirstAndLast(final String str, final String delimiter) - Summary: Returns an {@code Optional<String>} containing the substring between the first and last occurrences of the same delimiter.
-
Contract:
- If the delimiter is not found or occurs only once, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiter(String) — the string delimiter marking both the beginning and end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetweenFirstAndLast(String, String, String)
-
Signature:
public static Optional<String> substringBetweenFirstAndLast(final String str, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrence of the begin delimiter and the last occurrence of the end delimiter.
-
Contract:
- If either delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetweenFirstAndLast(String, String, String)
-
Signature:
public static Optional<String> substringBetweenFirstAndLast(final String str, final int fromIndex, final String delimiterOfExclusiveBeginIndex, final String delimiterOfExclusiveEndIndex) - Summary: Returns an {@code Optional<String>} containing the substring between the first occurrence of the begin delimiter and the last occurrence of the end delimiter, starting the search from the given index.
-
Contract:
- If either delimiter is not found, an empty {@code Optional} is returned.
-
Parameters:
-
str(String) — the string to extract from, can be {@code null} . -
fromIndex(int) — the index from which to start searching. -
delimiterOfExclusiveBeginIndex(String) — the string delimiter marking the beginning (exclusive). -
delimiterOfExclusiveEndIndex(String) — the string delimiter marking the end (exclusive).
-
- Returns: {@code Optional<String>} containing the substring if found, otherwise empty.
- See also: Strings#substringBetweenFirstAndLast(String, int, String, String)
createInteger(...) -> u.OptionalInt
-
Signature:
@Beta public static u.OptionalInt createInteger(final String str) - Summary: Attempts to parse the given string as an integer and returns an {@code OptionalInt} .
-
Contract:
- It returns an empty {@code OptionalInt} if the string is blank, {@code null} , or cannot be parsed as a valid integer.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code OptionalInt} containing the parsed integer value, or empty if parsing fails.
- See also: Numbers#createInteger(String)
createLong(...) -> u.OptionalLong
-
Signature:
@Beta public static u.OptionalLong createLong(final String str) - Summary: Attempts to parse the given string as a long and returns an {@code OptionalLong} .
-
Contract:
- It returns an empty {@code OptionalLong} if the string is blank, {@code null} , or cannot be parsed as a valid long.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code OptionalLong} containing the parsed long value, or empty if parsing fails.
- See also: Numbers#createLong(String)
createFloat(...) -> u.OptionalFloat
-
Signature:
@Beta public static u.OptionalFloat createFloat(final String str) - Summary: Attempts to parse the given string as a float and returns an {@code OptionalFloat} .
-
Contract:
- It returns an empty {@code OptionalFloat} if the string is blank, {@code null} , or cannot be parsed as a valid float.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code OptionalFloat} containing the parsed float value, or empty if parsing fails.
- See also: Numbers#createFloat(String)
createDouble(...) -> u.OptionalDouble
-
Signature:
@Beta public static u.OptionalDouble createDouble(final String str) - Summary: Attempts to parse the given string as a double and returns an {@code OptionalDouble} .
-
Contract:
- It returns an empty {@code OptionalDouble} if the string is blank, {@code null} , or cannot be parsed as a valid double.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code OptionalDouble} containing the parsed double value, or empty if parsing fails.
- See also: Numbers#createDouble(String)
createBigInteger(...) -> u.Optional<BigInteger>
-
Signature:
@Beta public static u.Optional<BigInteger> createBigInteger(final String str) - Summary: Attempts to parse the given string as a BigInteger and returns an {@code Optional<BigInteger>} .
-
Contract:
- It returns an empty {@code Optional} if the string is blank, {@code null} , or cannot be parsed as a valid BigInteger.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code Optional<BigInteger>} containing the parsed BigInteger value, or empty if parsing fails.
- See also: Numbers#createBigInteger(String)
createBigDecimal(...) -> u.Optional<BigDecimal>
-
Signature:
@Beta public static u.Optional<BigDecimal> createBigDecimal(final String str) - Summary: Attempts to parse the given string as a BigDecimal and returns an {@code Optional<BigDecimal>} .
-
Contract:
- It returns an empty {@code Optional} if the string is blank, {@code null} , or cannot be parsed as a valid BigDecimal.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code Optional<BigDecimal>} containing the parsed BigDecimal value, or empty if parsing fails.
- See also: Numbers#createBigDecimal(String)
createNumber(...) -> u.Optional<Number>
-
Signature:
@Beta public static u.Optional<Number> createNumber(final String str) - Summary: Attempts to parse the given string as a Number and returns an {@code Optional<Number>} .
-
Contract:
- It returns an empty {@code Optional} if the string is blank, {@code null} , or cannot be parsed as a valid number.
-
Parameters:
-
str(String) — the string to parse, can be {@code null} or blank.
-
- Returns: {@code Optional<Number>} containing the parsed Number value, or empty if parsing fails.
- See also: Numbers#createNumber(String)
Public Instance Methods
- (none)
Class Suppliers (com.landawn.abacus.util.Suppliers)
Utility class providing static methods to create various types of suppliers for collections, maps, arrays, and other commonly used objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Supplier<T>
-
Signature:
@Beta public static <T> Supplier<T> of(final Supplier<T> supplier) - Summary: Returns the provided supplier as is - a shorthand identity method for suppliers.
-
Parameters:
-
supplier(Supplier<T>) — the supplier to return
-
- Returns: the supplier unchanged
- See also: #of(Object, Function), Fn#s(Supplier), Fn#s(Object, Function), Fn#ss(com.landawn.abacus.util.Throwables.Supplier), Fn#ss(Object, com.landawn.abacus.util.Throwables.Function), IntFunctions#of(IntFunction)
-
Signature:
@Beta public static <A, T> Supplier<T> of(final A a, final Function<? super A, ? extends T> func) - Summary: Creates a supplier that always returns the result of applying the provided function to the given value.
-
Contract:
- <p> This method creates a supplier that captures the provided value and function, and when the supplier is called, it applies the function to the value and returns the result.
-
Parameters:
-
a(A) — the value to be processed by the function -
func(Function<? super A, ? extends T>) — the function to apply to the value
-
- Returns: a supplier that will return the result of applying the function to the value
- See also: #of(Supplier), Fn#s(Supplier), Fn#s(Object, Function), Fn#ss(com.landawn.abacus.util.Throwables.Supplier), Fn#ss(Object, com.landawn.abacus.util.Throwables.Function), IntFunctions#of(IntFunction)
ofInstance(...) -> Supplier<T>
-
Signature:
public static <T> Supplier<T> ofInstance(final T instance) - Summary: Returns a supplier that always supplies the same instance.
-
Parameters:
-
instance(T) — the instance to be supplied
-
- Returns: a supplier that always returns the same instance
ofUUID(...) -> Supplier<String>
-
Signature:
public static Supplier<String> ofUUID() - Summary: Returns a supplier that generates UUID strings.
-
Parameters:
- (none)
- Returns: a supplier that generates UUID strings
- See also: #ofGUID()
ofGUID(...) -> Supplier<String>
-
Signature:
public static Supplier<String> ofGUID() - Summary: Returns a supplier that generates GUID strings.
-
Parameters:
- (none)
- Returns: a supplier that generates GUID strings
- See also: #ofUUID()
ofEmptyBooleanArray(...) -> Supplier<boolean\[\]>
-
Signature:
public static Supplier<boolean[]> ofEmptyBooleanArray() - Summary: Returns a supplier that supplies empty boolean arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty boolean array
ofEmptyCharArray(...) -> Supplier<char\[\]>
-
Signature:
public static Supplier<char[]> ofEmptyCharArray() - Summary: Returns a supplier that supplies empty char arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty char array
ofEmptyByteArray(...) -> Supplier<byte\[\]>
-
Signature:
public static Supplier<byte[]> ofEmptyByteArray() - Summary: Returns a supplier that supplies empty byte arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty byte array
ofEmptyShortArray(...) -> Supplier<short\[\]>
-
Signature:
public static Supplier<short[]> ofEmptyShortArray() - Summary: Returns a supplier that supplies empty short arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty short array
ofEmptyIntArray(...) -> Supplier<int\[\]>
-
Signature:
public static Supplier<int[]> ofEmptyIntArray() - Summary: Returns a supplier that supplies empty int arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty int array
ofEmptyLongArray(...) -> Supplier<long\[\]>
-
Signature:
public static Supplier<long[]> ofEmptyLongArray() - Summary: Returns a supplier that supplies empty long arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty long array
ofEmptyFloatArray(...) -> Supplier<float\[\]>
-
Signature:
public static Supplier<float[]> ofEmptyFloatArray() - Summary: Returns a supplier that supplies empty float arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty float array
ofEmptyDoubleArray(...) -> Supplier<double\[\]>
-
Signature:
public static Supplier<double[]> ofEmptyDoubleArray() - Summary: Returns a supplier that supplies empty double arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty double array
ofEmptyStringArray(...) -> Supplier<String\[\]>
-
Signature:
public static Supplier<String[]> ofEmptyStringArray() - Summary: Returns a supplier that supplies empty String arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty String array
ofEmptyObjectArray(...) -> Supplier<Object\[\]>
-
Signature:
public static Supplier<Object[]> ofEmptyObjectArray() - Summary: Returns a supplier that supplies empty Object arrays.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty Object array
ofEmptyString(...) -> Supplier<String>
-
Signature:
public static Supplier<String> ofEmptyString() - Summary: Returns a supplier that supplies empty strings.
-
Parameters:
- (none)
- Returns: a supplier that returns an empty string
ofBooleanList(...) -> Supplier<BooleanList>
-
Signature:
public static Supplier<BooleanList> ofBooleanList() - Summary: Returns a supplier that creates new BooleanList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new BooleanList instances
ofCharList(...) -> Supplier<CharList>
-
Signature:
public static Supplier<CharList> ofCharList() - Summary: Returns a supplier that creates new CharList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new CharList instances
ofByteList(...) -> Supplier<ByteList>
-
Signature:
public static Supplier<ByteList> ofByteList() - Summary: Returns a supplier that creates new ByteList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new ByteList instances
ofShortList(...) -> Supplier<ShortList>
-
Signature:
public static Supplier<ShortList> ofShortList() - Summary: Returns a supplier that creates new ShortList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new ShortList instances
ofIntList(...) -> Supplier<IntList>
-
Signature:
public static Supplier<IntList> ofIntList() - Summary: Returns a supplier that creates new IntList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new IntList instances
ofLongList(...) -> Supplier<LongList>
-
Signature:
public static Supplier<LongList> ofLongList() - Summary: Returns a supplier that creates new LongList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LongList instances
ofFloatList(...) -> Supplier<FloatList>
-
Signature:
public static Supplier<FloatList> ofFloatList() - Summary: Returns a supplier that creates new FloatList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new FloatList instances
ofDoubleList(...) -> Supplier<DoubleList>
-
Signature:
public static Supplier<DoubleList> ofDoubleList() - Summary: Returns a supplier that creates new DoubleList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new DoubleList instances
ofList(...) -> Supplier<List<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<List<T>> ofList() - Summary: Returns a supplier that creates new List instances (ArrayList).
-
Parameters:
- (none)
- Returns: a supplier that creates new ArrayList instances
ofLinkedList(...) -> Supplier<LinkedList<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<LinkedList<T>> ofLinkedList() - Summary: Returns a supplier that creates new LinkedList instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedList instances
ofSet(...) -> Supplier<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Set<T>> ofSet() - Summary: Returns a supplier that creates new Set instances (HashSet).
-
Parameters:
- (none)
- Returns: a supplier that creates new HashSet instances
ofLinkedHashSet(...) -> Supplier<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Set<T>> ofLinkedHashSet() - Summary: Returns a supplier that creates new LinkedHashSet instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedHashSet instances
ofSortedSet(...) -> Supplier<SortedSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<SortedSet<T>> ofSortedSet() - Summary: Returns a supplier that creates new SortedSet instances (TreeSet).
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeSet instances
ofNavigableSet(...) -> Supplier<NavigableSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<NavigableSet<T>> ofNavigableSet() - Summary: Returns a supplier that creates new NavigableSet instances (TreeSet).
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeSet instances
ofTreeSet(...) -> Supplier<TreeSet<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<TreeSet<T>> ofTreeSet() - Summary: Returns a supplier that creates new TreeSet instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeSet instances
ofQueue(...) -> Supplier<Queue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Queue<T>> ofQueue() - Summary: Returns a supplier that creates new Queue instances (LinkedList).
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedList instances as Queue
ofDeque(...) -> Supplier<Deque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Deque<T>> ofDeque() - Summary: Returns a supplier that creates new Deque instances (LinkedList).
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedList instances as Deque
ofArrayDeque(...) -> Supplier<ArrayDeque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<ArrayDeque<T>> ofArrayDeque() - Summary: Returns a supplier that creates new ArrayDeque instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new ArrayDeque instances
ofLinkedBlockingQueue(...) -> Supplier<LinkedBlockingQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<LinkedBlockingQueue<T>> ofLinkedBlockingQueue() - Summary: Returns a supplier that creates new LinkedBlockingQueue instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedBlockingQueue instances
ofLinkedBlockingDeque(...) -> Supplier<LinkedBlockingDeque<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<LinkedBlockingDeque<T>> ofLinkedBlockingDeque() - Summary: Returns a supplier that creates new LinkedBlockingDeque instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedBlockingDeque instances
ofConcurrentLinkedQueue(...) -> Supplier<ConcurrentLinkedQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<ConcurrentLinkedQueue<T>> ofConcurrentLinkedQueue() - Summary: Returns a supplier that creates new ConcurrentLinkedQueue instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new ConcurrentLinkedQueue instances
ofPriorityQueue(...) -> Supplier<PriorityQueue<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<PriorityQueue<T>> ofPriorityQueue() - Summary: Returns a supplier that creates new PriorityQueue instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new PriorityQueue instances
ofMap(...) -> Supplier<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<Map<K, V>> ofMap() - Summary: Returns a supplier that creates new Map instances (HashMap).
-
Parameters:
- (none)
- Returns: a supplier that creates new HashMap instances
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<? extends Map<K, V>> ofMap(final Class<? extends Map> targetType) throws IllegalArgumentException - Summary: Returns a Supplier that creates Map instances of the specified type.
-
Parameters:
-
targetType(Class<? extends Map>) — the Class object representing the desired Map implementation
-
- Returns: a Supplier that creates instances of the specified Map type
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is not a Map class, is abstract and cannot be instantiated, or if no suitable implementation can be found
-
ofLinkedHashMap(...) -> Supplier<Map<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<Map<K, V>> ofLinkedHashMap() - Summary: Returns a supplier that creates new LinkedHashMap instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new LinkedHashMap instances
ofIdentityHashMap(...) -> Supplier<IdentityHashMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<IdentityHashMap<K, V>> ofIdentityHashMap() - Summary: Returns a supplier that creates new IdentityHashMap instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new IdentityHashMap instances
ofSortedMap(...) -> Supplier<SortedMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<SortedMap<K, V>> ofSortedMap() - Summary: Returns a supplier that creates new SortedMap instances (TreeMap).
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeMap instances
ofNavigableMap(...) -> Supplier<NavigableMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<NavigableMap<K, V>> ofNavigableMap() - Summary: Returns a supplier that creates new NavigableMap instances (TreeMap).
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeMap instances
ofTreeMap(...) -> Supplier<TreeMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<TreeMap<K, V>> ofTreeMap() - Summary: Returns a supplier that creates new TreeMap instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new TreeMap instances
ofConcurrentMap(...) -> Supplier<ConcurrentMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<ConcurrentMap<K, V>> ofConcurrentMap() - Summary: Returns a supplier that creates new ConcurrentMap instances (ConcurrentHashMap).
-
Parameters:
- (none)
- Returns: a supplier that creates new ConcurrentHashMap instances
ofConcurrentHashMap(...) -> Supplier<ConcurrentHashMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<ConcurrentHashMap<K, V>> ofConcurrentHashMap() - Summary: Returns a supplier that creates new ConcurrentHashMap instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new ConcurrentHashMap instances
ofConcurrentHashSet(...) -> Supplier<Set<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Set<T>> ofConcurrentHashSet() - Summary: Returns a supplier that creates new concurrent Set instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new concurrent Set instances
ofBiMap(...) -> Supplier<BiMap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Supplier<BiMap<K, V>> ofBiMap() - Summary: Returns a supplier that creates new BiMap instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new BiMap instances
ofMultiset(...) -> Supplier<Multiset<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Multiset<T>> ofMultiset() - Summary: Returns a supplier that creates new Multiset instances.
-
Parameters:
- (none)
- Returns: a supplier that creates new Multiset instances
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<Multiset<T>> ofMultiset(final Class<? extends Map> valueMapType) - Summary: Returns a supplier that creates new Multiset instances with a specific map type.
-
Parameters:
-
valueMapType(Class<? extends Map>) — the class of Map to use for storing element counts
-
- Returns: a supplier that creates new Multiset instances
-
Signature:
public static <T> Supplier<Multiset<T>> ofMultiset(final java.util.function.Supplier<? extends Map<T, ?>> mapSupplier) - Summary: Returns a supplier that creates new Multiset instances with a custom map supplier.
-
Parameters:
-
mapSupplier(java.util.function.Supplier<? extends Map<T, ?>>) — supplier to create the backing Map
-
- Returns: a supplier that creates new Multiset instances
ofListMultimap(...) -> Supplier<ListMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<ListMultimap<K, E>> ofListMultimap() - Summary: Returns a Supplier that creates a new ListMultimap with default backing Map and List implementations.
-
Parameters:
- (none)
- Returns: a Supplier that creates new ListMultimap instances
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<ListMultimap<K, E>> ofListMultimap(final Class<? extends Map> mapType) - Summary: Returns a Supplier that creates a new ListMultimap with the specified Map type and default List implementation.
-
Parameters:
-
mapType(Class<? extends Map>) — the Class object representing the Map implementation to use
-
- Returns: a Supplier that creates new ListMultimap instances with the specified Map type
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<ListMultimap<K, E>> ofListMultimap(final Class<? extends Map> mapType, final Class<? extends List> valueType) - Summary: Returns a Supplier that creates a new ListMultimap with the specified Map and List types.
-
Parameters:
-
mapType(Class<? extends Map>) — the Class object representing the Map implementation to use -
valueType(Class<? extends List>) — the Class object representing the List implementation to use for values
-
- Returns: a Supplier that creates new ListMultimap instances with the specified types
-
Signature:
public static <K, E> Supplier<ListMultimap<K, E>> ofListMultimap(final java.util.function.Supplier<? extends Map<K, List<E>>> mapSupplier, final java.util.function.Supplier<? extends List<E>> valueSupplier) - Summary: Returns a Supplier that creates a new ListMultimap using the provided map and value suppliers.
-
Parameters:
-
mapSupplier(java.util.function.Supplier<? extends Map<K, List<E>>>) — supplier that creates the backing Map instances -
valueSupplier(java.util.function.Supplier<? extends List<E>>) — supplier that creates the List instances for values
-
- Returns: a Supplier that creates new ListMultimap instances using the provided suppliers
ofSetMultimap(...) -> Supplier<SetMultimap<K, E>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<SetMultimap<K, E>> ofSetMultimap() - Summary: Returns a Supplier that creates a new SetMultimap with default backing Map and Set implementations.
-
Parameters:
- (none)
- Returns: a Supplier that creates new SetMultimap instances
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<SetMultimap<K, E>> ofSetMultimap(final Class<? extends Map> mapType) - Summary: Returns a Supplier that creates a new SetMultimap with the specified Map type and default Set implementation.
-
Parameters:
-
mapType(Class<? extends Map>) — the Class object representing the Map implementation to use
-
- Returns: a Supplier that creates new SetMultimap instances with the specified Map type
-
Signature:
@SuppressWarnings("rawtypes") public static <K, E> Supplier<SetMultimap<K, E>> ofSetMultimap(final Class<? extends Map> mapType, final Class<? extends Set> valueType) - Summary: Returns a Supplier that creates a new SetMultimap with the specified Map and Set types.
-
Parameters:
-
mapType(Class<? extends Map>) — the Class object representing the Map implementation to use -
valueType(Class<? extends Set>) — the Class object representing the Set implementation to use for values
-
- Returns: a Supplier that creates new SetMultimap instances with the specified types
-
Signature:
public static <K, E> Supplier<SetMultimap<K, E>> ofSetMultimap(final java.util.function.Supplier<? extends Map<K, Set<E>>> mapSupplier, final java.util.function.Supplier<? extends Set<E>> valueSupplier) - Summary: Returns a Supplier that creates a new SetMultimap using the provided map and value suppliers.
-
Parameters:
-
mapSupplier(java.util.function.Supplier<? extends Map<K, Set<E>>>) — supplier that creates the backing Map instances -
valueSupplier(java.util.function.Supplier<? extends Set<E>>) — supplier that creates the Set instances for values
-
- Returns: a Supplier that creates new SetMultimap instances using the provided suppliers
ofMultimap(...) -> Supplier<Multimap<K, E, V>>
-
Signature:
public static <K, E, V extends Collection<E>> Supplier<Multimap<K, E, V>> ofMultimap(final java.util.function.Supplier<? extends Map<K, V>> mapSupplier, final java.util.function.Supplier<? extends V> valueSupplier) - Summary: Returns a Supplier that creates a new Multimap using the provided map and value collection suppliers.
-
Parameters:
-
mapSupplier(java.util.function.Supplier<? extends Map<K, V>>) — supplier that creates the backing Map instances -
valueSupplier(java.util.function.Supplier<? extends V>) — supplier that creates the Collection instances for values
-
- Returns: a Supplier that creates new Multimap instances using the provided suppliers
ofStringBuilder(...) -> Supplier<StringBuilder>
-
Signature:
public static Supplier<StringBuilder> ofStringBuilder() - Summary: Returns a Supplier that creates new StringBuilder instances.
-
Parameters:
- (none)
- Returns: a Supplier that creates new StringBuilder instances
ofCollection(...) -> Supplier<? extends Collection<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Supplier<? extends Collection<T>> ofCollection(final Class<? extends Collection> targetType) throws IllegalArgumentException - Summary: Returns a Supplier that creates Collection instances of the specified type.
-
Parameters:
-
targetType(Class<? extends Collection>) — the Class object representing the desired Collection implementation
-
- Returns: a Supplier that creates instances of the specified Collection type
-
Throws:
-
java.lang.IllegalArgumentException— if targetType is not a Collection class, is abstract and cannot be instantiated, or if no suitable implementation can be found
-
registerForCollection(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Collection> boolean registerForCollection(final Class<T> targetClass, final java.util.function.Supplier<T> supplier) throws IllegalArgumentException - Summary: Registers a custom Supplier for creating instances of the specified Collection class.
-
Contract:
- Once registered, the supplier will be used by {@link #ofCollection(Class)} when creating instances of the target class.
-
Parameters:
-
targetClass(Class<T>) — the Class object of the Collection implementation to register -
supplier(java.util.function.Supplier<T>) — the Supplier that creates instances of the target class
-
- Returns: {@code true} if the registration was successful, {@code false} if a supplier was already registered for this class
-
Throws:
-
java.lang.IllegalArgumentException— if targetClass or supplier is {@code null} , or if targetClass is a built-in class
-
registerForMap(...) -> boolean
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Map> boolean registerForMap(final Class<T> targetClass, final java.util.function.Supplier<T> supplier) throws IllegalArgumentException - Summary: Registers a custom Supplier for creating instances of the specified Map class.
-
Contract:
- Once registered, the supplier will be used by {@link #ofMap(Class)} when creating instances of the target class.
-
Parameters:
-
targetClass(Class<T>) — the Class object of the Map implementation to register -
supplier(java.util.function.Supplier<T>) — the Supplier that creates instances of the target class
-
- Returns: {@code true} if the registration was successful, {@code false} if a supplier was already registered for this class
-
Throws:
-
java.lang.IllegalArgumentException— if targetClass or supplier is {@code null} , or if targetClass is a built-in class
-
ofImmutableList(...) -> Supplier<ImmutableList<?>>
-
Signature:
@Deprecated public static Supplier<ImmutableList<?>> ofImmutableList() - Summary: Throws UnsupportedOperationException.
-
Parameters:
- (none)
- Returns: never returns normally
ofImmutableSet(...) -> Supplier<ImmutableSet<?>>
-
Signature:
@Deprecated public static Supplier<ImmutableSet<?>> ofImmutableSet() - Summary: Throws UnsupportedOperationException.
-
Parameters:
- (none)
- Returns: never returns normally
ofImmutableMap(...) -> Supplier<ImmutableMap<?, ?>>
-
Signature:
@Deprecated public static Supplier<ImmutableMap<?, ?>> ofImmutableMap() - Summary: Throws UnsupportedOperationException.
-
Parameters:
- (none)
- Returns: never returns normally
newException(...) -> Supplier<Exception>
-
Signature:
@Beta public static Supplier<Exception> newException() - Summary: Returns a Supplier that creates new Exception instances.
-
Parameters:
- (none)
- Returns: a Supplier that creates new Exception instances
newRuntimeException(...) -> Supplier<RuntimeException>
-
Signature:
@Beta public static Supplier<RuntimeException> newRuntimeException() - Summary: Returns a Supplier that creates new RuntimeException instances.
-
Parameters:
- (none)
- Returns: a Supplier that creates new RuntimeException instances
newNoSuchElementException(...) -> Supplier<NoSuchElementException>
-
Signature:
@Beta public static Supplier<NoSuchElementException> newNoSuchElementException() - Summary: Returns a Supplier that creates new NoSuchElementException instances.
-
Parameters:
- (none)
- Returns: a Supplier that creates new NoSuchElementException instances
Public Instance Methods
- (none)
Class Synchronized (com.landawn.abacus.util.Synchronized)
A utility class that provides thread-safe synchronized operations on objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
on(...) -> Synchronized<T>
-
Signature:
public static <T> Synchronized<T> on(final T mutex) throws IllegalArgumentException - Summary: Creates a new Synchronized instance for the provided mutex object.
-
Parameters:
-
mutex(T) — the object on which synchronized operations will be performed. Must not be {@code null} .
-
- Returns: a new Synchronized instance for the provided mutex.
-
Throws:
-
java.lang.IllegalArgumentException— if the provided mutex is null.
-
run(...) -> void
-
Signature:
public static <T, E extends Throwable> void run(final T mutex, final Throwables.Runnable<E> cmd) throws IllegalArgumentException, E - Summary: Executes the provided runnable command in a synchronized block on the specified mutex.
-
Parameters:
-
mutex(T) — the object to synchronize on. Must not be {@code null} . -
cmd(Throwables.Runnable<E>) — the runnable command to execute. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or cmd is null. -
E— if the command throws an exception of type E.
-
call(...) -> R
-
Signature:
public static <T, R, E extends Throwable> R call(final T mutex, final Throwables.Callable<R, E> cmd) throws IllegalArgumentException, E - Summary: Executes the provided callable command in a synchronized block on the specified mutex and returns its result.
-
Parameters:
-
mutex(T) — the object to synchronize on. Must not be {@code null} . -
cmd(Throwables.Callable<R, E>) — the callable command to execute. Must not be {@code null} .
-
- Returns: the result of the callable command.
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or cmd is null. -
E— if the callable throws an exception of type E.
-
test(...) -> boolean
-
Signature:
public static <T, E extends Throwable> boolean test(final T mutex, final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: Tests the provided predicate in a synchronized block on the specified mutex.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass to the predicate. Must not be {@code null} . -
predicate(Throwables.Predicate<? super T, E>) — the predicate to test. Must not be {@code null} .
-
- Returns: the boolean result of the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or predicate is null. -
E— if the predicate throws an exception of type E.
-
-
Signature:
public static <T, U, E extends Throwable> boolean test(final T mutex, final U u, final Throwables.BiPredicate<? super T, ? super U, E> predicate) throws IllegalArgumentException, E - Summary: Tests the provided bi-predicate in a synchronized block on the specified mutex.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass as first argument to the predicate. Must not be {@code null} . -
u(U) — the additional argument to pass as second argument to the predicate. -
predicate(Throwables.BiPredicate<? super T, ? super U, E>) — the bi-predicate to test. Must not be {@code null} .
-
- Returns: the boolean result of the bi-predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or predicate is null. -
E— if the predicate throws an exception of type E.
-
accept(...) -> void
-
Signature:
public static <T, E extends Throwable> void accept(final T mutex, final Throwables.Consumer<? super T, E> consumer) throws IllegalArgumentException, E - Summary: Executes the provided consumer in a synchronized block on the specified mutex.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass to the consumer. Must not be {@code null} . -
consumer(Throwables.Consumer<? super T, E>) — the consumer to execute. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or consumer is null. -
E— if the consumer throws an exception of type E.
-
-
Signature:
public static <T, U, E extends Throwable> void accept(final T mutex, final U u, final Throwables.BiConsumer<? super T, ? super U, E> consumer) throws IllegalArgumentException, E - Summary: Executes the provided bi-consumer in a synchronized block on the specified mutex.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass as first argument to the consumer. Must not be {@code null} . -
u(U) — the additional argument to pass as second argument to the consumer. -
consumer(Throwables.BiConsumer<? super T, ? super U, E>) — the bi-consumer to execute. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or consumer is null. -
E— if the consumer throws an exception of type E.
-
apply(...) -> R
-
Signature:
public static <T, R, E extends Throwable> R apply(final T mutex, final Throwables.Function<? super T, ? extends R, E> function) throws IllegalArgumentException, E - Summary: Applies the provided function in a synchronized block on the specified mutex and returns its result.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass to the function. Must not be {@code null} . -
function(Throwables.Function<? super T, ? extends R, E>) — the function to apply. Must not be {@code null} .
-
- Returns: the result of applying the function.
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or function is null. -
E— if the function throws an exception of type E.
-
-
Signature:
public static <T, U, R, E extends Throwable> R apply(final T mutex, final U u, final Throwables.BiFunction<? super T, ? super U, ? extends R, E> function) throws IllegalArgumentException, E - Summary: Applies the provided bi-function in a synchronized block on the specified mutex and returns its result.
-
Parameters:
-
mutex(T) — the object to synchronize on and pass as first argument to the function. Must not be {@code null} . -
u(U) — the additional argument to pass as second argument to the function. -
function(Throwables.BiFunction<? super T, ? super U, ? extends R, E>) — the bi-function to apply. Must not be {@code null} .
-
- Returns: the result of applying the bi-function.
-
Throws:
-
java.lang.IllegalArgumentException— if either mutex or function is null. -
E— if the function throws an exception of type E.
-
Public Instance Methods
run(...) -> void
-
Signature:
public <E extends Throwable> void run(final Throwables.Runnable<E> cmd) throws IllegalArgumentException, E - Summary: Executes the provided runnable command in a synchronized block on this instance's mutex.
-
Parameters:
-
cmd(Throwables.Runnable<E>) — the runnable command to execute. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is null. -
E— if the command throws an exception of type E.
-
call(...) -> R
-
Signature:
public <R, E extends Throwable> R call(final Throwables.Callable<R, E> cmd) throws IllegalArgumentException, E - Summary: Executes the provided callable command in a synchronized block on this instance's mutex and returns its result.
-
Parameters:
-
cmd(Throwables.Callable<R, E>) — the callable command to execute. Must not be {@code null} .
-
- Returns: the result of the callable command.
-
Throws:
-
java.lang.IllegalArgumentException— if cmd is null. -
E— if the callable throws an exception of type E.
-
test(...) -> boolean
-
Signature:
public <E extends Throwable> boolean test(final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: Tests the provided predicate in a synchronized block on this instance's mutex.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to test with the mutex as argument. Must not be {@code null} .
-
- Returns: the boolean result of the predicate.
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null. -
E— if the predicate throws an exception of type E.
-
accept(...) -> void
-
Signature:
public <E extends Throwable> void accept(final Throwables.Consumer<? super T, E> consumer) throws IllegalArgumentException, E - Summary: Executes the provided consumer in a synchronized block on this instance's mutex.
-
Parameters:
-
consumer(Throwables.Consumer<? super T, E>) — the consumer to execute with the mutex as argument. Must not be {@code null} .
-
-
Throws:
-
java.lang.IllegalArgumentException— if consumer is null. -
E— if the consumer throws an exception of type E.
-
apply(...) -> R
-
Signature:
public <R, E extends Throwable> R apply(final Throwables.Function<? super T, ? extends R, E> function) throws IllegalArgumentException, E - Summary: Applies the provided function in a synchronized block on this instance's mutex and returns its result.
-
Parameters:
-
function(Throwables.Function<? super T, ? extends R, E>) — the function to apply with the mutex as argument. Must not be {@code null} .
-
- Returns: the result of applying the function.
-
Throws:
-
java.lang.IllegalArgumentException— if function is null. -
E— if the function throws an exception of type E.
-
Enum ThreadMode (com.landawn.abacus.util.ThreadMode)
Enumeration representing different threading modes for concurrent operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Throwables (com.landawn.abacus.util.Throwables)
A comprehensive utility class providing exception-handling functional interfaces and utilities for working with checked exceptions in functional programming contexts.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
run(...) -> void
-
Signature:
@Beta public static void run(final Throwables.Runnable<? extends Throwable> cmd) - Summary: Executes the specified runnable command that may throw a checked exception.
-
Contract:
- If the command throws an exception, it will be wrapped in a RuntimeException and rethrown.
-
Parameters:
-
cmd(Throwables.Runnable<? extends Throwable>) — the runnable command to execute that may throw a checked exception
-
- See also: Try#run(Throwables.Runnable)
-
Signature:
@Beta public static void run(final Throwables.Runnable<? extends Throwable> cmd, final java.util.function.Consumer<? super Throwable> actionOnError) - Summary: Executes the specified runnable command that may throw a checked exception.
-
Contract:
- If the command throws an exception, the specified error handler will be invoked with the exception.
-
Parameters:
-
cmd(Throwables.Runnable<? extends Throwable>) — the runnable command to execute that may throw a checked exception -
actionOnError(java.util.function.Consumer<? super Throwable>) — the consumer that will handle any exception thrown by the command
-
- See also: Try#run(Throwables.Runnable, java.util.function.Consumer)
call(...) -> R
-
Signature:
@Beta public static <R> R call(final Throwables.Callable<R, ? extends Throwable> cmd) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception, it will be wrapped in a RuntimeException and rethrown.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception
-
- Returns: the result returned by the callable command
- See also: Try#call(java.util.concurrent.Callable)
-
Signature:
@Beta public static <R> R call(final Throwables.Callable<R, ? extends Throwable> cmd, final java.util.function.Function<? super Throwable, ? extends R> actionOnError) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception, the specified error handler function will be invoked with the exception and its result will be returned instead.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception -
actionOnError(java.util.function.Function<? super Throwable, ? extends R>) — the function that will handle any exception thrown by the command and provide an alternative result
-
- Returns: the result returned by the callable command if successful, or the result of the error handler if an exception occurs
- See also: Try#call(java.util.concurrent.Callable, java.util.function.Function)
-
Signature:
@Beta public static <R> R call(final Throwables.Callable<R, ? extends Throwable> cmd, final java.util.function.Supplier<R> supplier) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception, the result from the specified supplier will be returned instead.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception -
supplier(java.util.function.Supplier<R>) — the supplier that provides an alternative result if the command throws an exception
-
- Returns: the result returned by the callable command if successful, or the result from the supplier if an exception occurs
- See also: Try#call(java.util.concurrent.Callable, java.util.function.Supplier)
-
Signature:
@Beta public static <R extends Comparable<? super R>> R call(final Throwables.Callable<R, ? extends Throwable> cmd, final R defaultValue) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception, the specified default value will be returned instead.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception -
defaultValue(R) — the default value to return if the command throws an exception
-
- Returns: the result returned by the callable command if successful, or the default value if an exception occurs
- See also: #call(Throwables.Callable, java.util.function.Supplier)
-
Signature:
@Beta public static <R> R call(final Throwables.Callable<R, ? extends Throwable> cmd, final java.util.function.Predicate<? super Throwable> predicate, final java.util.function.Supplier<R> supplier) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception and the predicate returns {@code true} for that exception, the result from the supplier will be returned.
- If the predicate returns {@code false} , the exception will be wrapped in a RuntimeException and rethrown.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception -
predicate(java.util.function.Predicate<? super Throwable>) — the predicate that tests whether to handle the exception or rethrow it -
supplier(java.util.function.Supplier<R>) — the supplier that provides an alternative result if the predicate returns true
-
- Returns: the result returned by the callable command if successful, or the result from the supplier if an exception occurs and the predicate returns true
- See also: Try#call(java.util.concurrent.Callable, java.util.function.Predicate, java.util.function.Supplier)
-
Signature:
@Beta public static <R extends Comparable<? super R>> R call(final Throwables.Callable<R, ? extends Throwable> cmd, final java.util.function.Predicate<? super Throwable> predicate, final R defaultValue) - Summary: Executes the specified callable command that may throw a checked exception and returns its result.
-
Contract:
- If the command throws an exception and the predicate returns {@code true} for that exception, the specified default value will be returned.
- If the predicate returns {@code false} , the exception will be wrapped in a RuntimeException and rethrown.
-
Parameters:
-
cmd(Throwables.Callable<R, ? extends Throwable>) — the callable command to execute that may throw a checked exception -
predicate(java.util.function.Predicate<? super Throwable>) — the predicate that tests whether to handle the exception or rethrow it -
defaultValue(R) — the default value to return if the predicate returns true
-
- Returns: the result returned by the callable command if successful, or the default value if an exception occurs and the predicate returns true
- See also: #call(Throwables.Callable, java.util.function.Predicate, java.util.function.Supplier)
Public Instance Methods
- (none)
Class Iterator (com.landawn.abacus.util.Throwables.Iterator)
An iterator that can throw checked exceptions during iteration.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Throwables.Iterator<T, E>
-
Signature:
public static <T, E extends Throwable> Throwables.Iterator<T, E> empty() - Summary: Returns an empty iterator that has no elements and whose hasNext() always returns {@code false} .
-
Parameters:
- (none)
- Returns: an empty iterator
just(...) -> Throwables.Iterator<T, E>
-
Signature:
public static <T, E extends Throwable> Throwables.Iterator<T, E> just(final T val) - Summary: Returns an iterator containing only the specified single element.
-
Parameters:
-
val(T) — the single element to be contained in the iterator
-
- Returns: an iterator containing only the specified element
of(...) -> Throwables.Iterator<T, E>
-
Signature:
@SafeVarargs public static <T, E extends Exception> Throwables.Iterator<T, E> of(final T... a) - Summary: Returns an iterator over the specified array of elements.
-
Parameters:
-
a(T[]) — the array of elements to iterate over
-
- Returns: an iterator over the elements in the array, or an empty iterator if the array is {@code null} or empty
-
Signature:
public static <T, E extends Exception> Throwables.Iterator<T, E> of(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns an iterator over a range of elements in the specified array.
-
Parameters:
-
a(T[]) — the array of elements to iterate over -
fromIndex(int) — the starting index (inclusive) of the range to iterate -
toIndex(int) — the ending index (exclusive) of the range to iterate
-
- Returns: an iterator over the specified range of elements in the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex is negative, toIndex is greater than the array length, or fromIndex is greater than toIndex
-
-
Signature:
public static <T, E extends Throwable> Iterator<T, E> of(final Iterable<? extends T> iterable) - Summary: Returns an iterator over the elements in the specified Iterable.
-
Parameters:
-
iterable(Iterable<? extends T>) — the iterable whose elements are to be iterated over
-
- Returns: an iterator over the elements in the iterable, or an empty iterator if the iterable is null
-
Signature:
public static <T, E extends Exception> Throwables.Iterator<T, E> of(final java.util.Iterator<? extends T> iter) - Summary: Returns a Throwables.Iterator that wraps the specified java.util.Iterator.
-
Parameters:
-
iter(java.util.Iterator<? extends T>) — the java.util.Iterator to wrap
-
- Returns: a Throwables.Iterator wrapping the specified iterator, or an empty iterator if iter is null
defer(...) -> Throwables.Iterator<T, E>
-
Signature:
public static <T, E extends Exception> Throwables.Iterator<T, E> defer(final java.util.function.Supplier<Throwables.Iterator<T, E>> iteratorSupplier) - Summary: Returns a Throwables.Iterator instance that is created lazily using the provided Supplier.
-
Contract:
- The Supplier is responsible for producing the Iterator instance when the Iterator's methods are first called.
- The underlying iterator is only closed if it has been initialized when {@code close()} is called.
-
Parameters:
-
iteratorSupplier(java.util.function.Supplier<Throwables.Iterator<T, E>>) — a Supplier that provides the Throwables.Iterator when needed.
-
- Returns: a Throwables.Iterator that is initialized on the first call to hasNext() or next().
concat(...) -> Throwables.Iterator<T, E>
-
Signature:
@SafeVarargs public static <T, E extends Exception> Throwables.Iterator<T, E> concat(final Throwables.Iterator<? extends T, ? extends E>... a) - Summary: Concatenates multiple iterators into a single iterator that iterates over all elements from all the iterators in sequence.
-
Parameters:
-
a(Throwables.Iterator<? extends T, ? extends E>[]) — the array of iterators to concatenate
-
- Returns: a single iterator that iterates over all elements from all iterators in order
-
Signature:
public static <T, E extends Exception> Throwables.Iterator<T, E> concat(final Collection<? extends Throwables.Iterator<? extends T, ? extends E>> c) - Summary: Concatenates a collection of iterators into a single iterator that iterates over all elements from all the iterators in sequence.
-
Parameters:
-
c(Collection<? extends Throwables.Iterator<? extends T, ? extends E>>) — the collection of iterators to concatenate
-
- Returns: a single iterator that iterates over all elements from all iterators in order, or an empty iterator if the collection is {@code null} or empty
ofLines(...) -> Throwables.Iterator<String, IOException>
-
Signature:
public static Throwables.Iterator<String, IOException> ofLines(final Reader reader) - Summary: Returns an iterator that reads lines from the specified Reader.
-
Contract:
- The iterator wraps the reader in a BufferedReader if it isn't one already.
- When {@code close()} is called, it will close the underlying BufferedReader (and thus the original Reader).
-
Parameters:
-
reader(Reader) — the Reader to read lines from
-
- Returns: an iterator over the lines in the reader, or an empty iterator if the reader is null
Public Instance Methods
hasNext(...) -> boolean
-
Signature:
public abstract boolean hasNext() throws E - Summary: Returns {@code true} if the iterator has more elements to iterate over.
-
Contract:
- Returns {@code true} if the iterator has more elements to iterate over.
-
Parameters:
- (none)
- Returns: {@code true} if there are more elements, {@code false} otherwise
-
Throws:
-
E— if an exception occurs while checking for more elements
-
next(...) -> T
-
Signature:
public abstract T next() throws E - Summary: Returns the next element in the iteration.
-
Parameters:
- (none)
- Returns: the next element in the iteration
-
Throws:
-
E— if an exception occurs while retrieving the next element
-
advance(...) -> void
-
Signature:
public void advance(long n) throws E - Summary: Advances the iterator by skipping the specified number of elements.
-
Contract:
- If n is greater than the number of remaining elements, the iterator will be positioned at the end.
-
Parameters:
-
n(long) — the number of elements to skip, must be non-negative
-
-
Throws:
-
E— if an exception occurs while advancing the iterator
-
count(...) -> long
-
Signature:
public long count() throws E - Summary: Returns the count of remaining elements in the iterator.
-
Parameters:
- (none)
- Returns: the number of remaining elements
-
Throws:
-
E— if an exception occurs while counting the elements
-
close(...) -> void
-
Signature:
@Override public final void close() - Summary: Closes this iterator and releases any resources associated with it.
-
Contract:
- If the iterator is already closed, this method has no effect.
-
Parameters:
- (none)
filter(...) -> Throwables.Iterator<T, E>
-
Signature:
public Throwables.Iterator<T, E> filter(final Throwables.Predicate<? super T, E> predicate) - Summary: Returns a new iterator that contains only elements matching the specified predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to test each element
-
- Returns: a new iterator containing only elements that satisfy the predicate
map(...) -> Throwables.Iterator<U, E>
-
Signature:
public <U> Throwables.Iterator<U, E> map(final Throwables.Function<? super T, U, E> mapper) - Summary: Returns a new iterator that applies the specified mapping function to each element.
-
Parameters:
-
mapper(Throwables.Function<? super T, U, E>) — the function to apply to each element
-
- Returns: a new iterator with the mapping function applied to each element
first(...) -> Nullable<T>
-
Signature:
public Nullable<T> first() throws E - Summary: Returns the first element from this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the first element if present, otherwise an empty Nullable
-
Throws:
-
E— if an exception occurs while retrieving the first element
-
firstNonNull(...) -> u.Optional<T>
-
Signature:
public u.Optional<T> firstNonNull() throws E - Summary: Returns the first {@code non-null} element from this iterator wrapped in an Optional.
-
Contract:
- If no {@code non-null} element is found or the iterator is empty, returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the first {@code non-null} element if present, otherwise an empty Optional
-
Throws:
-
E— if an exception occurs while searching for a {@code non-null} element
-
last(...) -> Nullable<T>
-
Signature:
public Nullable<T> last() throws E - Summary: Returns the last element from this iterator wrapped in a {@code Nullable} .
-
Contract:
- If the iterator is empty, returns an empty {@code Nullable} .
-
Parameters:
- (none)
- Returns: a {@code Nullable} containing the last element if present, otherwise an empty Nullable
-
Throws:
-
E— if an exception occurs while iterating through the elements
-
toArray(...) -> Object\[\]
-
Signature:
public Object[] toArray() throws E - Summary: Returns an array containing all remaining elements in this iterator.
-
Parameters:
- (none)
- Returns: an array containing all remaining elements
-
Throws:
-
E— if an exception occurs while iterating through the elements
-
-
Signature:
public <A> A[] toArray(final A[] a) throws E - Summary: Returns an array containing all remaining elements in this iterator.
-
Contract:
- If the specified array is large enough, the elements are stored in it.
-
Parameters:
-
a(A[]) — the array into which the elements are to be stored, if it is big enough
-
- Returns: an array containing all remaining elements
-
Throws:
-
E— if an exception occurs while iterating through the elements
-
toList(...) -> List<T>
-
Signature:
public List<T> toList() throws E - Summary: Returns a List containing all remaining elements in this iterator.
-
Parameters:
- (none)
- Returns: a List containing all remaining elements
-
Throws:
-
E— if an exception occurs while iterating through the elements
-
forEachRemaining(...) -> void
-
Signature:
public void forEachRemaining(final java.util.function.Consumer<? super T> action) throws E - Summary: Performs the given action for each remaining element in this iterator.
-
Parameters:
-
action(java.util.function.Consumer<? super T>) — the action to be performed for each element
-
-
Throws:
-
E— if an exception occurs while iterating through the elements
-
foreachRemaining(...) -> void
-
Signature:
public <E2 extends Throwable> void foreachRemaining(final Throwables.Consumer<? super T, E2> action) throws E, E2 - Summary: Performs the given action for each remaining element in this iterator.
-
Parameters:
-
action(Throwables.Consumer<? super T, E2>) — the action to be performed for each element
-
-
Throws:
-
E— if an exception occurs while iterating through the elements -
E2— if the action throws an exception
-
foreachIndexed(...) -> void
-
Signature:
public <E2 extends Throwable> void foreachIndexed(final Throwables.IntObjConsumer<? super T, E2> action) throws E, E2 - Summary: Performs the given action for each remaining element in this iterator, providing both the element and its index (starting from 0).
-
Parameters:
-
action(Throwables.IntObjConsumer<? super T, E2>) — the action to be performed for each element with its index
-
-
Throws:
-
E— if an exception occurs while iterating through the elements -
E2— if the action throws an exception
-
Interface Runnable (com.landawn.abacus.util.Throwables.Runnable)
The Interface Runnable.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
run(...) -> void
-
Signature:
void run() throws E - Summary: Executes this runnable operation.
-
Parameters:
- (none)
-
Throws:
-
E— if an exception occurs during execution
-
unchecked(...) -> com.landawn.abacus.util.function.Runnable
-
Signature:
@Beta default com.landawn.abacus.util.function.Runnable unchecked() - Summary: Returns a java.util.function.Runnable that wraps this Throwables.Runnable.
-
Parameters:
- (none)
- Returns: a java.util.function.Runnable that executes this runnable and wraps any checked exceptions
Interface Callable (com.landawn.abacus.util.Throwables.Callable)
The Interface Callable.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
call(...) -> R
-
Signature:
R call() throws E - Summary: Computes a result.
-
Parameters:
- (none)
- Returns: the computed result
-
Throws:
-
E— if an exception occurs during computation
-
unchecked(...) -> com.landawn.abacus.util.function.Callable<R>
-
Signature:
@Beta default com.landawn.abacus.util.function.Callable<R> unchecked() - Summary: Returns a java.util.function.Callable that wraps this Throwables.Callable.
-
Parameters:
- (none)
- Returns: a java.util.function.Callable that executes this callable and wraps any checked exceptions
Interface Supplier (com.landawn.abacus.util.Throwables.Supplier)
The Interface Supplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> T
-
Signature:
T get() throws E - Summary: Gets a result.
-
Parameters:
- (none)
- Returns: the result
-
Throws:
-
E— if an exception occurs while getting the result
-
unchecked(...) -> com.landawn.abacus.util.function.Supplier<T>
-
Signature:
@Beta default com.landawn.abacus.util.function.Supplier<T> unchecked() - Summary: Returns a java.util.function.Supplier that wraps this Throwables.Supplier.
-
Parameters:
- (none)
- Returns: a java.util.function.Supplier that executes this supplier and wraps any checked exceptions
Interface BooleanSupplier (com.landawn.abacus.util.Throwables.BooleanSupplier)
The Interface BooleanSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsBoolean(...) -> boolean
-
Signature:
boolean getAsBoolean() throws E - Summary: Gets a boolean result.
-
Parameters:
- (none)
- Returns: the boolean result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface CharSupplier (com.landawn.abacus.util.Throwables.CharSupplier)
The Interface CharSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsChar(...) -> char
-
Signature:
char getAsChar() throws E - Summary: Gets a char result.
-
Parameters:
- (none)
- Returns: the char result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface ByteSupplier (com.landawn.abacus.util.Throwables.ByteSupplier)
The Interface ByteSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsByte(...) -> byte
-
Signature:
byte getAsByte() throws E - Summary: Gets a byte result.
-
Parameters:
- (none)
- Returns: the byte result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface ShortSupplier (com.landawn.abacus.util.Throwables.ShortSupplier)
The Interface ShortSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsShort(...) -> short
-
Signature:
short getAsShort() throws E - Summary: Gets a short result.
-
Parameters:
- (none)
- Returns: the short result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface IntSupplier (com.landawn.abacus.util.Throwables.IntSupplier)
The Interface IntSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsInt(...) -> int
-
Signature:
int getAsInt() throws E - Summary: Gets an int result.
-
Parameters:
- (none)
- Returns: the int result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface LongSupplier (com.landawn.abacus.util.Throwables.LongSupplier)
The Interface LongSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsLong(...) -> long
-
Signature:
long getAsLong() throws E - Summary: Gets a long result.
-
Parameters:
- (none)
- Returns: the long result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface FloatSupplier (com.landawn.abacus.util.Throwables.FloatSupplier)
The Interface FloatSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsFloat(...) -> float
-
Signature:
float getAsFloat() throws E - Summary: Gets a float result.
-
Parameters:
- (none)
- Returns: the float result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface DoubleSupplier (com.landawn.abacus.util.Throwables.DoubleSupplier)
The Interface DoubleSupplier.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsDouble(...) -> double
-
Signature:
double getAsDouble() throws E - Summary: Gets a double result.
-
Parameters:
- (none)
- Returns: the double result
-
Throws:
-
E— if an exception occurs while getting the result
-
Interface Predicate (com.landawn.abacus.util.Throwables.Predicate)
The Interface Predicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t) throws E - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
t(T) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
negate(...) -> Predicate<T, E>
-
Signature:
default Predicate<T, E> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
unchecked(...) -> com.landawn.abacus.util.function.Predicate<T>
-
Signature:
@Beta default com.landawn.abacus.util.function.Predicate<T> unchecked() - Summary: Returns a java.util.function.Predicate that wraps this Throwables.Predicate.
-
Parameters:
- (none)
- Returns: a java.util.function.Predicate that executes this predicate and wraps any checked exceptions
Interface BiPredicate (com.landawn.abacus.util.Throwables.BiPredicate)
The Interface BiPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, U u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
unchecked(...) -> com.landawn.abacus.util.function.BiPredicate<T, U>
-
Signature:
@Beta default com.landawn.abacus.util.function.BiPredicate<T, U> unchecked() - Summary: Returns a java.util.function.BiPredicate that wraps this Throwables.BiPredicate.
-
Parameters:
- (none)
- Returns: a java.util.function.BiPredicate that executes this predicate and wraps any checked exceptions
Interface TriPredicate (com.landawn.abacus.util.Throwables.TriPredicate)
The Interface TriPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(A a, B b, C c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface QuadPredicate (com.landawn.abacus.util.Throwables.QuadPredicate)
The Interface QuadPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(A a, B b, C c, D d) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument -
d(D) — the fourth input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface Function (com.landawn.abacus.util.Throwables.Function)
The Interface Function.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t) throws E - Summary: Applies this function to the given argument.
-
Parameters:
-
t(T) — the function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
unchecked(...) -> com.landawn.abacus.util.function.Function<T, R>
-
Signature:
@Beta default com.landawn.abacus.util.function.Function<T, R> unchecked() - Summary: Returns a java.util.function.Function that wraps this Throwables.Function.
-
Parameters:
- (none)
- Returns: a java.util.function.Function that executes this function and wraps any checked exceptions
Interface BiFunction (com.landawn.abacus.util.Throwables.BiFunction)
The Interface BiFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, U u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
unchecked(...) -> com.landawn.abacus.util.function.BiFunction<T, U, R>
-
Signature:
@Beta default com.landawn.abacus.util.function.BiFunction<T, U, R> unchecked() - Summary: Returns a java.util.function.BiFunction that wraps this Throwables.BiFunction.
-
Parameters:
- (none)
- Returns: a java.util.function.BiFunction that executes this function and wraps any checked exceptions
Interface TriFunction (com.landawn.abacus.util.Throwables.TriFunction)
The Interface TriFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(A a, B b, C c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface QuadFunction (com.landawn.abacus.util.Throwables.QuadFunction)
The Interface QuadFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(A a, B b, C c, D d) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument -
d(D) — the fourth function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface Consumer (com.landawn.abacus.util.Throwables.Consumer)
The Interface Consumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t) throws E - Summary: Performs this operation on the given argument.
-
Parameters:
-
t(T) — the input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
unchecked(...) -> com.landawn.abacus.util.function.Consumer<T>
-
Signature:
@Beta default com.landawn.abacus.util.function.Consumer<T> unchecked() - Summary: Returns a java.util.function.Consumer that wraps this Throwables.Consumer.
-
Parameters:
- (none)
- Returns: a java.util.function.Consumer that executes this consumer and wraps any checked exceptions
Interface BiConsumer (com.landawn.abacus.util.Throwables.BiConsumer)
The Interface BiConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, U u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
unchecked(...) -> com.landawn.abacus.util.function.BiConsumer<T, U>
-
Signature:
@Beta default com.landawn.abacus.util.function.BiConsumer<T, U> unchecked() - Summary: Returns a java.util.function.BiConsumer that wraps this Throwables.BiConsumer.
-
Parameters:
- (none)
- Returns: a java.util.function.BiConsumer that executes this consumer and wraps any checked exceptions
Interface TriConsumer (com.landawn.abacus.util.Throwables.TriConsumer)
The Interface TriConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(A a, B b, C c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface QuadConsumer (com.landawn.abacus.util.Throwables.QuadConsumer)
The Interface QuadConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(A a, B b, C c, D d) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument -
d(D) — the fourth input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface BooleanConsumer (com.landawn.abacus.util.Throwables.BooleanConsumer)
The Interface BooleanConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(boolean value) throws E - Summary: Performs this operation on the given boolean argument.
-
Parameters:
-
value(boolean) — the boolean input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface BooleanPredicate (com.landawn.abacus.util.Throwables.BooleanPredicate)
The Interface BooleanPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(boolean value) throws E - Summary: Evaluates this predicate on the given boolean argument.
-
Parameters:
-
value(boolean) — the boolean input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface BooleanFunction (com.landawn.abacus.util.Throwables.BooleanFunction)
The Interface BooleanFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(boolean value) throws E - Summary: Applies this function to the given boolean argument.
-
Parameters:
-
value(boolean) — the boolean function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface CharConsumer (com.landawn.abacus.util.Throwables.CharConsumer)
The Interface CharConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(char value) throws E - Summary: Performs this operation on the given char argument.
-
Parameters:
-
value(char) — the char input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface CharPredicate (com.landawn.abacus.util.Throwables.CharPredicate)
The Interface CharPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(char value) throws E - Summary: Evaluates this predicate on the given char argument.
-
Parameters:
-
value(char) — the char input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface CharFunction (com.landawn.abacus.util.Throwables.CharFunction)
The Interface CharFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(char value) throws E - Summary: Applies this function to the given char argument.
-
Parameters:
-
value(char) — the char function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface ByteConsumer (com.landawn.abacus.util.Throwables.ByteConsumer)
The Interface ByteConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(byte value) throws E - Summary: Performs this operation on the given byte argument.
-
Parameters:
-
value(byte) — the byte input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface BytePredicate (com.landawn.abacus.util.Throwables.BytePredicate)
The Interface BytePredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(byte value) throws E - Summary: Evaluates this predicate on the given byte argument.
-
Parameters:
-
value(byte) — the byte input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface ByteFunction (com.landawn.abacus.util.Throwables.ByteFunction)
The Interface ByteFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(byte value) throws E - Summary: Applies this function to the given byte argument.
-
Parameters:
-
value(byte) — the byte function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface ShortConsumer (com.landawn.abacus.util.Throwables.ShortConsumer)
The Interface ShortConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(short value) throws E - Summary: Performs this operation on the given short argument.
-
Parameters:
-
value(short) — the short input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface ShortPredicate (com.landawn.abacus.util.Throwables.ShortPredicate)
The Interface ShortPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(short value) throws E - Summary: Evaluates this predicate on the given short argument.
-
Parameters:
-
value(short) — the short input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface ShortFunction (com.landawn.abacus.util.Throwables.ShortFunction)
The Interface ShortFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(short value) throws E - Summary: Applies this function to the given short argument.
-
Parameters:
-
value(short) — the short function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface IntConsumer (com.landawn.abacus.util.Throwables.IntConsumer)
The Interface IntConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int value) throws E - Summary: Performs this operation on the given int argument.
-
Parameters:
-
value(int) — the int input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface IntPredicate (com.landawn.abacus.util.Throwables.IntPredicate)
The Interface IntPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int value) throws E - Summary: Evaluates this predicate on the given int argument.
-
Parameters:
-
value(int) — the int input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface IntFunction (com.landawn.abacus.util.Throwables.IntFunction)
The Interface IntFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int value) throws E - Summary: Applies this function to the given int argument.
-
Parameters:
-
value(int) — the int function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface IntToLongFunction (com.landawn.abacus.util.Throwables.IntToLongFunction)
The Interface IntToLongFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(int value) throws E - Summary: Applies this function to the given int argument and produces a long result.
-
Parameters:
-
value(int) — the int function argument
-
- Returns: the long function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface IntToDoubleFunction (com.landawn.abacus.util.Throwables.IntToDoubleFunction)
The Interface IntToDoubleFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(int value) throws E - Summary: Applies this function to the given int argument and produces a double result.
-
Parameters:
-
value(int) — the int function argument
-
- Returns: the double function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface LongConsumer (com.landawn.abacus.util.Throwables.LongConsumer)
The Interface LongConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long value) throws E - Summary: Performs this operation on the given long argument.
-
Parameters:
-
value(long) — the long input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface LongPredicate (com.landawn.abacus.util.Throwables.LongPredicate)
The Interface LongPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(long value) throws E - Summary: Evaluates this predicate on the given long argument.
-
Parameters:
-
value(long) — the long input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface LongFunction (com.landawn.abacus.util.Throwables.LongFunction)
The Interface LongFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(long value) throws E - Summary: Applies this function to the given long argument.
-
Parameters:
-
value(long) — the long function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface LongToIntFunction (com.landawn.abacus.util.Throwables.LongToIntFunction)
The Interface LongToIntFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(long value) throws E - Summary: Applies this function to the given long argument and produces an int result.
-
Parameters:
-
value(long) — the long function argument
-
- Returns: the int function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface LongToDoubleFunction (com.landawn.abacus.util.Throwables.LongToDoubleFunction)
The Interface LongToDoubleFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(long value) throws E - Summary: Applies this function to the given long argument and produces a double result.
-
Parameters:
-
value(long) — the long function argument
-
- Returns: the double function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface FloatConsumer (com.landawn.abacus.util.Throwables.FloatConsumer)
The Interface FloatConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(float value) throws E - Summary: Performs this operation on the given float argument.
-
Parameters:
-
value(float) — the float input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface FloatPredicate (com.landawn.abacus.util.Throwables.FloatPredicate)
The Interface FloatPredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(float value) throws E - Summary: Evaluates this predicate on the given float argument.
-
Parameters:
-
value(float) — the float input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface FloatFunction (com.landawn.abacus.util.Throwables.FloatFunction)
The Interface FloatFunction.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(float value) throws E - Summary: Applies this function to the given float argument.
-
Parameters:
-
value(float) — the float function argument
-
- Returns: the function result
-
Throws:
-
E— if an exception occurs during function application
-
Interface DoubleConsumer (com.landawn.abacus.util.Throwables.DoubleConsumer)
The Interface DoubleConsumer.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(double value) throws E - Summary: Performs this operation on the given double argument.
-
Parameters:
-
value(double) — the double input argument
-
-
Throws:
-
E— if an exception occurs during the operation
-
Interface DoublePredicate (com.landawn.abacus.util.Throwables.DoublePredicate)
The Interface DoublePredicate.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(double value) throws E - Summary: Evaluates this predicate on the given double argument.
-
Parameters:
-
value(double) — the double input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise false
-
Throws:
-
E— if an exception occurs during evaluation
-
Interface DoubleFunction (com.landawn.abacus.util.Throwables.DoubleFunction)
Represents a function that accepts a double-valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(double value) throws E - Summary: Applies this function to the given double-valued argument.
-
Parameters:
-
value(double) — the double value to be processed
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface DoubleToIntFunction (com.landawn.abacus.util.Throwables.DoubleToIntFunction)
Represents a function that accepts a double-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(double value) throws E - Summary: Applies this function to the given double value and returns an int result.
-
Parameters:
-
value(double) — the double value to be processed
-
- Returns: the int result
-
Throws:
-
E— if an error occurs during function execution
-
Interface DoubleToLongFunction (com.landawn.abacus.util.Throwables.DoubleToLongFunction)
Represents a function that accepts a double-valued argument and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(double value) throws E - Summary: Applies this function to the given double value and returns a long result.
-
Parameters:
-
value(double) — the double value to be processed
-
- Returns: the long result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToBooleanFunction (com.landawn.abacus.util.Throwables.ToBooleanFunction)
Represents a function that produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(T t) throws E - Summary: Applies this function to the given argument and returns a boolean result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the boolean result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToCharFunction (com.landawn.abacus.util.Throwables.ToCharFunction)
Represents a function that produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(T t) throws E - Summary: Applies this function to the given argument and returns a char result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the char result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToByteFunction (com.landawn.abacus.util.Throwables.ToByteFunction)
Represents a function that produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(T t) throws E - Summary: Applies this function to the given argument and returns a byte result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the byte result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToShortFunction (com.landawn.abacus.util.Throwables.ToShortFunction)
Represents a function that produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(T t) throws E - Summary: Applies this function to the given argument and returns a short result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the short result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToIntFunction (com.landawn.abacus.util.Throwables.ToIntFunction)
Represents a function that produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(T t) throws E - Summary: Applies this function to the given argument and returns an int result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the int result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToLongFunction (com.landawn.abacus.util.Throwables.ToLongFunction)
Represents a function that produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(T t) throws E - Summary: Applies this function to the given argument and returns a long result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the long result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToFloatFunction (com.landawn.abacus.util.Throwables.ToFloatFunction)
Represents a function that produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(T t) throws E - Summary: Applies this function to the given argument and returns a float result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the float result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToDoubleFunction (com.landawn.abacus.util.Throwables.ToDoubleFunction)
Represents a function that produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(T t) throws E - Summary: Applies this function to the given argument and returns a double result.
-
Parameters:
-
t(T) — the input argument
-
- Returns: the double result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToIntBiFunction (com.landawn.abacus.util.Throwables.ToIntBiFunction)
Represents a function that accepts two arguments and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(A a, B b) throws E - Summary: Applies this function to the given arguments and returns an int result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument
-
- Returns: the int result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToLongBiFunction (com.landawn.abacus.util.Throwables.ToLongBiFunction)
Represents a function that accepts two arguments and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(A a, B b) throws E - Summary: Applies this function to the given arguments and returns a long result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument
-
- Returns: the long result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToDoubleBiFunction (com.landawn.abacus.util.Throwables.ToDoubleBiFunction)
Represents a function that accepts two arguments and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(A a, B b) throws E - Summary: Applies this function to the given arguments and returns a double result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument
-
- Returns: the double result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToIntTriFunction (com.landawn.abacus.util.Throwables.ToIntTriFunction)
Represents a function that accepts three arguments and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(A a, B b, C c) throws E - Summary: Applies this function to the given arguments and returns an int result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the int result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToLongTriFunction (com.landawn.abacus.util.Throwables.ToLongTriFunction)
Represents a function that accepts three arguments and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(A a, B b, C c) throws E - Summary: Applies this function to the given arguments and returns a long result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the long result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ToDoubleTriFunction (com.landawn.abacus.util.Throwables.ToDoubleTriFunction)
Represents a function that accepts three arguments and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(A a, B b, C c) throws E - Summary: Applies this function to the given arguments and returns a double result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the double result
-
Throws:
-
E— if an error occurs during function execution
-
Interface UnaryOperator (com.landawn.abacus.util.Throwables.UnaryOperator)
Represents an operation on a single operand that produces a result of the same type as its operand.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface BinaryOperator (com.landawn.abacus.util.Throwables.BinaryOperator)
Represents an operation upon two operands of the same type, producing a result of the same type as the operands.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface TernaryOperator (com.landawn.abacus.util.Throwables.TernaryOperator)
Represents an operation upon three operands of the same type, producing a result of the same type as the operands.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> T
-
Signature:
T apply(T a, T b, T c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(T) — the first operand -
b(T) — the second operand -
c(T) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface BooleanUnaryOperator (com.landawn.abacus.util.Throwables.BooleanUnaryOperator)
Represents an operation on a single boolean-valued operand that produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(boolean operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(boolean) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface CharUnaryOperator (com.landawn.abacus.util.Throwables.CharUnaryOperator)
Represents an operation on a single char-valued operand that produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(char operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(char) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ByteUnaryOperator (com.landawn.abacus.util.Throwables.ByteUnaryOperator)
Represents an operation on a single byte-valued operand that produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(byte operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(byte) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ShortUnaryOperator (com.landawn.abacus.util.Throwables.ShortUnaryOperator)
Represents an operation on a single short-valued operand that produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(short operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(short) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface IntUnaryOperator (com.landawn.abacus.util.Throwables.IntUnaryOperator)
Represents an operation on a single int-valued operand that produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(int operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(int) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface IntObjOperator (com.landawn.abacus.util.Throwables.IntObjOperator)
Represents an operation that accepts an int-valued operand and an object operand, and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(int operand, T obj) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
operand(int) — the int operand -
obj(T) — the object operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface LongUnaryOperator (com.landawn.abacus.util.Throwables.LongUnaryOperator)
Represents an operation on a single long-valued operand that produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(long operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(long) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface FloatUnaryOperator (com.landawn.abacus.util.Throwables.FloatUnaryOperator)
Represents an operation on a single float-valued operand that produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(float operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(float) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface DoubleUnaryOperator (com.landawn.abacus.util.Throwables.DoubleUnaryOperator)
Represents an operation on a single double-valued operand that produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(double operand) throws E - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(double) — the operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface BooleanBinaryOperator (com.landawn.abacus.util.Throwables.BooleanBinaryOperator)
Represents an operation upon two boolean-valued operands and producing a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(boolean left, boolean right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(boolean) — the first operand -
right(boolean) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface CharBinaryOperator (com.landawn.abacus.util.Throwables.CharBinaryOperator)
Represents an operation upon two char-valued operands and producing a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(char left, char right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(char) — the first operand -
right(char) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ByteBinaryOperator (com.landawn.abacus.util.Throwables.ByteBinaryOperator)
Represents an operation upon two byte-valued operands and producing a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(byte left, byte right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(byte) — the first operand -
right(byte) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ShortBinaryOperator (com.landawn.abacus.util.Throwables.ShortBinaryOperator)
Represents an operation upon two short-valued operands and producing a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(short left, short right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(short) — the first operand -
right(short) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface IntBinaryOperator (com.landawn.abacus.util.Throwables.IntBinaryOperator)
Represents an operation upon two int-valued operands and producing an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(int left, int right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(int) — the first operand -
right(int) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface LongBinaryOperator (com.landawn.abacus.util.Throwables.LongBinaryOperator)
Represents an operation upon two long-valued operands and producing a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(long left, long right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(long) — the first operand -
right(long) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface FloatBinaryOperator (com.landawn.abacus.util.Throwables.FloatBinaryOperator)
Represents an operation upon two float-valued operands and producing a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(float left, float right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(float) — the first operand -
right(float) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface DoubleBinaryOperator (com.landawn.abacus.util.Throwables.DoubleBinaryOperator)
Represents an operation upon two double-valued operands and producing a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(double left, double right) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(double) — the first operand -
right(double) — the second operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface BooleanTernaryOperator (com.landawn.abacus.util.Throwables.BooleanTernaryOperator)
Represents an operation upon three boolean-valued operands and producing a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(boolean a, boolean b, boolean c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(boolean) — the first operand -
b(boolean) — the second operand -
c(boolean) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface CharTernaryOperator (com.landawn.abacus.util.Throwables.CharTernaryOperator)
Represents an operation upon three char-valued operands and producing a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(char a, char b, char c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(char) — the first operand -
b(char) — the second operand -
c(char) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ByteTernaryOperator (com.landawn.abacus.util.Throwables.ByteTernaryOperator)
Represents an operation upon three byte-valued operands and producing a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(byte a, byte b, byte c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(byte) — the first operand -
b(byte) — the second operand -
c(byte) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface ShortTernaryOperator (com.landawn.abacus.util.Throwables.ShortTernaryOperator)
Represents an operation upon three short-valued operands and producing a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(short a, short b, short c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(short) — the first operand -
b(short) — the second operand -
c(short) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface IntTernaryOperator (com.landawn.abacus.util.Throwables.IntTernaryOperator)
Represents an operation upon three int-valued operands and producing an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(int a, int b, int c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(int) — the first operand -
b(int) — the second operand -
c(int) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface LongTernaryOperator (com.landawn.abacus.util.Throwables.LongTernaryOperator)
Represents an operation upon three long-valued operands and producing a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(long a, long b, long c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(long) — the first operand -
b(long) — the second operand -
c(long) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface FloatTernaryOperator (com.landawn.abacus.util.Throwables.FloatTernaryOperator)
Represents an operation upon three float-valued operands and producing a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(float a, float b, float c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(float) — the first operand -
b(float) — the second operand -
c(float) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface DoubleTernaryOperator (com.landawn.abacus.util.Throwables.DoubleTernaryOperator)
Represents an operation upon three double-valued operands and producing a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(double a, double b, double c) throws E - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(double) — the first operand -
b(double) — the second operand -
c(double) — the third operand
-
- Returns: the operator result
-
Throws:
-
E— if an error occurs during operator execution
-
Interface BooleanBiPredicate (com.landawn.abacus.util.Throwables.BooleanBiPredicate)
Represents a predicate (boolean-valued function) of two boolean-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(boolean t, boolean u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(boolean) — the first input argument -
u(boolean) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface CharBiPredicate (com.landawn.abacus.util.Throwables.CharBiPredicate)
Represents a predicate (boolean-valued function) of two char-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(char t, char u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(char) — the first input argument -
u(char) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ByteBiPredicate (com.landawn.abacus.util.Throwables.ByteBiPredicate)
Represents a predicate (boolean-valued function) of two byte-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(byte t, byte u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(byte) — the first input argument -
u(byte) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ShortBiPredicate (com.landawn.abacus.util.Throwables.ShortBiPredicate)
Represents a predicate (boolean-valued function) of two short-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(short t, short u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(short) — the first input argument -
u(short) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface IntBiPredicate (com.landawn.abacus.util.Throwables.IntBiPredicate)
Represents a predicate (boolean-valued function) of two int-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int t, int u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(int) — the first input argument -
u(int) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface LongBiPredicate (com.landawn.abacus.util.Throwables.LongBiPredicate)
Represents a predicate (boolean-valued function) of two long-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(long t, long u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(long) — the first input argument -
u(long) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface FloatBiPredicate (com.landawn.abacus.util.Throwables.FloatBiPredicate)
Represents a predicate (boolean-valued function) of two float-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(float t, float u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(float) — the first input argument -
u(float) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface DoubleBiPredicate (com.landawn.abacus.util.Throwables.DoubleBiPredicate)
Represents a predicate (boolean-valued function) of two double-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(double t, double u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(double) — the first input argument -
u(double) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface BooleanBiFunction (com.landawn.abacus.util.Throwables.BooleanBiFunction)
Represents a function that accepts two boolean-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(boolean t, boolean u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(boolean) — the first function argument -
u(boolean) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface CharBiFunction (com.landawn.abacus.util.Throwables.CharBiFunction)
Represents a function that accepts two char-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(char t, char u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(char) — the first function argument -
u(char) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ByteBiFunction (com.landawn.abacus.util.Throwables.ByteBiFunction)
Represents a function that accepts two byte-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(byte t, byte u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(byte) — the first function argument -
u(byte) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ShortBiFunction (com.landawn.abacus.util.Throwables.ShortBiFunction)
Represents a function that accepts two short-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(short t, short u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(short) — the first function argument -
u(short) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface IntBiFunction (com.landawn.abacus.util.Throwables.IntBiFunction)
Represents a function that accepts two int-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int t, int u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(int) — the first function argument -
u(int) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface LongBiFunction (com.landawn.abacus.util.Throwables.LongBiFunction)
Represents a function that accepts two long-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(long t, long u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(long) — the first function argument -
u(long) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface FloatBiFunction (com.landawn.abacus.util.Throwables.FloatBiFunction)
Represents a function that accepts two float-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(float t, float u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(float) — the first function argument -
u(float) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface DoubleBiFunction (com.landawn.abacus.util.Throwables.DoubleBiFunction)
Represents a function that accepts two double-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(double t, double u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(double) — the first function argument -
u(double) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface BooleanBiConsumer (com.landawn.abacus.util.Throwables.BooleanBiConsumer)
Represents an operation that accepts two boolean-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(boolean t, boolean u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(boolean) — the first input argument -
u(boolean) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface CharBiConsumer (com.landawn.abacus.util.Throwables.CharBiConsumer)
Represents an operation that accepts two char-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(char t, char u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(char) — the first input argument -
u(char) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ByteBiConsumer (com.landawn.abacus.util.Throwables.ByteBiConsumer)
Represents an operation that accepts two byte-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(byte t, byte u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(byte) — the first input argument -
u(byte) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ShortBiConsumer (com.landawn.abacus.util.Throwables.ShortBiConsumer)
Represents an operation that accepts two short-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(short t, short u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(short) — the first input argument -
u(short) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntBiConsumer (com.landawn.abacus.util.Throwables.IntBiConsumer)
Represents an operation that accepts two int-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int t, int u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(int) — the first input argument -
u(int) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface LongBiConsumer (com.landawn.abacus.util.Throwables.LongBiConsumer)
Represents an operation that accepts two long-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long t, long u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(long) — the first input argument -
u(long) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface FloatBiConsumer (com.landawn.abacus.util.Throwables.FloatBiConsumer)
Represents an operation that accepts two float-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(float t, float u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(float) — the first input argument -
u(float) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface DoubleBiConsumer (com.landawn.abacus.util.Throwables.DoubleBiConsumer)
Represents an operation that accepts two double-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(double t, double u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(double) — the first input argument -
u(double) — the second input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface BooleanTriPredicate (com.landawn.abacus.util.Throwables.BooleanTriPredicate)
Represents a predicate (boolean-valued function) of three boolean-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(boolean a, boolean b, boolean c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(boolean) — the first input argument -
b(boolean) — the second input argument -
c(boolean) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface CharTriPredicate (com.landawn.abacus.util.Throwables.CharTriPredicate)
Represents a predicate (boolean-valued function) of three char-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(char a, char b, char c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(char) — the first input argument -
b(char) — the second input argument -
c(char) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ByteTriPredicate (com.landawn.abacus.util.Throwables.ByteTriPredicate)
Represents a predicate (boolean-valued function) of three byte-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(byte a, byte b, byte c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(byte) — the first input argument -
b(byte) — the second input argument -
c(byte) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ShortTriPredicate (com.landawn.abacus.util.Throwables.ShortTriPredicate)
Represents a predicate (boolean-valued function) of three short-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(short a, short b, short c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(short) — the first input argument -
b(short) — the second input argument -
c(short) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface IntTriPredicate (com.landawn.abacus.util.Throwables.IntTriPredicate)
Represents a predicate (boolean-valued function) of three int-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int a, int b, int c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(int) — the first input argument -
b(int) — the second input argument -
c(int) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface LongTriPredicate (com.landawn.abacus.util.Throwables.LongTriPredicate)
Represents a predicate (boolean-valued function) of three long-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(long a, long b, long c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(long) — the first input argument -
b(long) — the second input argument -
c(long) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface FloatTriPredicate (com.landawn.abacus.util.Throwables.FloatTriPredicate)
Represents a predicate (boolean-valued function) of three float-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(float a, float b, float c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(float) — the first input argument -
b(float) — the second input argument -
c(float) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface DoubleTriPredicate (com.landawn.abacus.util.Throwables.DoubleTriPredicate)
Represents a predicate (boolean-valued function) of three double-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(double a, double b, double c) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(double) — the first input argument -
b(double) — the second input argument -
c(double) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface BooleanTriFunction (com.landawn.abacus.util.Throwables.BooleanTriFunction)
Represents a function that accepts three boolean-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(boolean a, boolean b, boolean c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(boolean) — the first function argument -
b(boolean) — the second function argument -
c(boolean) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface CharTriFunction (com.landawn.abacus.util.Throwables.CharTriFunction)
Represents a function that accepts three char-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(char a, char b, char c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(char) — the first function argument -
b(char) — the second function argument -
c(char) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ByteTriFunction (com.landawn.abacus.util.Throwables.ByteTriFunction)
Represents a function that accepts three byte-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(byte a, byte b, byte c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(byte) — the first function argument -
b(byte) — the second function argument -
c(byte) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ShortTriFunction (com.landawn.abacus.util.Throwables.ShortTriFunction)
Represents a function that accepts three short-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(short a, short b, short c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(short) — the first function argument -
b(short) — the second function argument -
c(short) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface IntTriFunction (com.landawn.abacus.util.Throwables.IntTriFunction)
Represents a function that accepts three int-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int a, int b, int c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(int) — the first function argument -
b(int) — the second function argument -
c(int) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface LongTriFunction (com.landawn.abacus.util.Throwables.LongTriFunction)
Represents a function that accepts three long-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(long a, long b, long c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(long) — the first function argument -
b(long) — the second function argument -
c(long) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface FloatTriFunction (com.landawn.abacus.util.Throwables.FloatTriFunction)
Represents a function that accepts three float-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(float a, float b, float c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(float) — the first function argument -
b(float) — the second function argument -
c(float) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface DoubleTriFunction (com.landawn.abacus.util.Throwables.DoubleTriFunction)
Represents a function that accepts three double-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(double a, double b, double c) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(double) — the first function argument -
b(double) — the second function argument -
c(double) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface BooleanTriConsumer (com.landawn.abacus.util.Throwables.BooleanTriConsumer)
Represents an operation that accepts three boolean-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(boolean a, boolean b, boolean c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(boolean) — the first input argument -
b(boolean) — the second input argument -
c(boolean) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface CharTriConsumer (com.landawn.abacus.util.Throwables.CharTriConsumer)
Represents an operation that accepts three char-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(char a, char b, char c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(char) — the first input argument -
b(char) — the second input argument -
c(char) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ByteTriConsumer (com.landawn.abacus.util.Throwables.ByteTriConsumer)
Represents an operation that accepts three byte-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(byte a, byte b, byte c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(byte) — the first input argument -
b(byte) — the second input argument -
c(byte) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ShortTriConsumer (com.landawn.abacus.util.Throwables.ShortTriConsumer)
Represents an operation that accepts three short-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(short a, short b, short c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(short) — the first input argument -
b(short) — the second input argument -
c(short) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntTriConsumer (com.landawn.abacus.util.Throwables.IntTriConsumer)
Represents an operation that accepts three int-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int a, int b, int c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(int) — the first input argument -
b(int) — the second input argument -
c(int) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface LongTriConsumer (com.landawn.abacus.util.Throwables.LongTriConsumer)
Represents an operation that accepts three long-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long a, long b, long c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(long) — the first input argument -
b(long) — the second input argument -
c(long) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface FloatTriConsumer (com.landawn.abacus.util.Throwables.FloatTriConsumer)
Represents an operation that accepts three float-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(float a, float b, float c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(float) — the first input argument -
b(float) — the second input argument -
c(float) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface DoubleTriConsumer (com.landawn.abacus.util.Throwables.DoubleTriConsumer)
Represents an operation that accepts three double-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(double a, double b, double c) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(double) — the first input argument -
b(double) — the second input argument -
c(double) — the third input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjBooleanConsumer (com.landawn.abacus.util.Throwables.ObjBooleanConsumer)
Represents an operation that accepts an object and a boolean value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, boolean value) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
value(boolean) — the boolean input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjCharConsumer (com.landawn.abacus.util.Throwables.ObjCharConsumer)
Represents an operation that accepts an object and a char value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, char value) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
value(char) — the char input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjByteConsumer (com.landawn.abacus.util.Throwables.ObjByteConsumer)
Represents an operation that accepts an object and a byte value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, byte value) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
value(byte) — the byte input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjShortConsumer (com.landawn.abacus.util.Throwables.ObjShortConsumer)
Represents an operation that accepts an object and a short value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, short value) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
value(short) — the short input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjIntConsumer (com.landawn.abacus.util.Throwables.ObjIntConsumer)
Represents an operation that accepts an object and an int value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, int u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(int) — the int input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjIntFunction (com.landawn.abacus.util.Throwables.ObjIntFunction)
Represents a function that accepts an object and an int value and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, int u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the object function argument -
u(int) — the int function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ObjIntPredicate (com.landawn.abacus.util.Throwables.ObjIntPredicate)
Represents a predicate (boolean-valued function) of an object and an int value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, int u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(int) — the int input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ObjLongConsumer (com.landawn.abacus.util.Throwables.ObjLongConsumer)
Represents an operation that accepts an object and a long value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, long u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(long) — the long input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjLongFunction (com.landawn.abacus.util.Throwables.ObjLongFunction)
Represents a function that accepts an object and a long value and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, long u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the object function argument -
u(long) — the long function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ObjLongPredicate (com.landawn.abacus.util.Throwables.ObjLongPredicate)
Represents a predicate (boolean-valued function) of an object and a long value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, long u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(long) — the long input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ObjFloatConsumer (com.landawn.abacus.util.Throwables.ObjFloatConsumer)
Represents an operation that accepts an object and a float value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, float value) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
value(float) — the float input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjDoubleConsumer (com.landawn.abacus.util.Throwables.ObjDoubleConsumer)
Represents an operation that accepts an object and a double value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, double u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(double) — the double input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjDoubleFunction (com.landawn.abacus.util.Throwables.ObjDoubleFunction)
Represents a function that accepts an object and a double value and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, double u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the object function argument -
u(double) — the double function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ObjDoublePredicate (com.landawn.abacus.util.Throwables.ObjDoublePredicate)
Represents a predicate (boolean-valued function) of an object and a double value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, double u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
u(double) — the double input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface ObjBiIntConsumer (com.landawn.abacus.util.Throwables.ObjBiIntConsumer)
Represents an operation that accepts an object and two int values and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, int i, int j) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
i(int) — the first int input argument -
j(int) — the second int input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface ObjBiIntFunction (com.landawn.abacus.util.Throwables.ObjBiIntFunction)
Represents a function that accepts an object and two int values and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, int i, int j) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the object function argument -
i(int) — the first int function argument -
j(int) — the second int function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface ObjBiIntPredicate (com.landawn.abacus.util.Throwables.ObjBiIntPredicate)
Represents a predicate (boolean-valued function) of an object and two int values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, int i, int j) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
i(int) — the first int input argument -
j(int) — the second int input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface BiObjIntConsumer (com.landawn.abacus.util.Throwables.BiObjIntConsumer)
Represents an operation that accepts two objects and an int value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, U u, int i) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first object input argument -
u(U) — the second object input argument -
i(int) — the int index argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface BiObjIntFunction (com.landawn.abacus.util.Throwables.BiObjIntFunction)
Represents a function that accepts two objects and an int value and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T e, U u, int i) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
e(T) — the first object function argument -
u(U) — the second object function argument -
i(int) — the int index argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface BiObjIntPredicate (com.landawn.abacus.util.Throwables.BiObjIntPredicate)
Represents a predicate (boolean-valued function) of two objects and an int value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, U u, int i) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first object input argument -
u(U) — the second object input argument -
i(int) — the int index argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface IntObjConsumer (com.landawn.abacus.util.Throwables.IntObjConsumer)
Represents an operation that accepts an int value and an object and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntObjConsumer<T, E>
-
Signature:
static <T, E extends Throwable> IntObjConsumer<T, E> of(final IntObjConsumer<T, E> consumer) - Summary: Returns the given consumer instance.
-
Parameters:
-
consumer(IntObjConsumer<T, E>) — the consumer to return
-
- Returns: the same consumer instance
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int i, T t) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(int) — the int input argument -
t(T) — the object input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntObjFunction (com.landawn.abacus.util.Throwables.IntObjFunction)
Represents a function that accepts an int value and an object and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntObjFunction<T, R, E>
-
Signature:
static <T, R, E extends Throwable> IntObjFunction<T, R, E> of(final IntObjFunction<T, R, E> func) - Summary: Returns the given function as is.
-
Parameters:
-
func(IntObjFunction<T, R, E>) — the function to return
-
- Returns: the same function instance
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int i, T t) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(int) — the int function argument -
t(T) — the object function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface IntObjPredicate (com.landawn.abacus.util.Throwables.IntObjPredicate)
Represents a predicate (boolean-valued function) of an int value and an object.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntObjPredicate<T, E>
-
Signature:
static <T, E extends Throwable> IntObjPredicate<T, E> of(final IntObjPredicate<T, E> predicate) - Summary: Returns the given predicate as is.
-
Parameters:
-
predicate(IntObjPredicate<T, E>) — the predicate to return
-
- Returns: the same predicate instance
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int i, T t) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(int) — the int input argument -
t(T) — the object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface IntBiObjConsumer (com.landawn.abacus.util.Throwables.IntBiObjConsumer)
Represents an operation that accepts an int value and two objects and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int i, T t, U u) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(int) — the int input argument -
t(T) — the first object input argument -
u(U) — the second object input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntBiObjFunction (com.landawn.abacus.util.Throwables.IntBiObjFunction)
Represents a function that accepts an int value and two objects and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int i, T t, U u) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(int) — the int function argument -
t(T) — the first object function argument -
u(U) — the second object function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface IntBiObjPredicate (com.landawn.abacus.util.Throwables.IntBiObjPredicate)
Represents a predicate (boolean-valued function) of an int value and two objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int i, T t, U u) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(int) — the int input argument -
t(T) — the first object input argument -
u(U) — the second object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface BiIntObjConsumer (com.landawn.abacus.util.Throwables.BiIntObjConsumer)
Represents an operation that accepts two int values and an object and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int i, int j, T t) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(int) — the first int input argument -
j(int) — the second int input argument -
t(T) — the object input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface BiIntObjFunction (com.landawn.abacus.util.Throwables.BiIntObjFunction)
Represents a function that accepts two int values and an object and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int i, int j, T t) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(int) — the first int function argument -
j(int) — the second int function argument -
t(T) — the object function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface BiIntObjPredicate (com.landawn.abacus.util.Throwables.BiIntObjPredicate)
Represents a predicate (boolean-valued function) of two int values and an object.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(int i, int j, T t) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(int) — the first int input argument -
j(int) — the second int input argument -
t(T) — the object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface LongObjConsumer (com.landawn.abacus.util.Throwables.LongObjConsumer)
Represents an operation that accepts a long value and an object and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long i, T t) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(long) — the long input argument -
t(T) — the object input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface LongObjFunction (com.landawn.abacus.util.Throwables.LongObjFunction)
Represents a function that accepts a long value and an object and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(long i, T t) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(long) — the long function argument -
t(T) — the object function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface LongObjPredicate (com.landawn.abacus.util.Throwables.LongObjPredicate)
Represents a predicate (boolean-valued function) of a long value and an object.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(long i, T t) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(long) — the long input argument -
t(T) — the object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface DoubleObjConsumer (com.landawn.abacus.util.Throwables.DoubleObjConsumer)
Represents an operation that accepts a double value and an object and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(double i, T t) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(double) — the double input argument -
t(T) — the object input argument
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface DoubleObjFunction (com.landawn.abacus.util.Throwables.DoubleObjFunction)
Represents a function that accepts a double value and an object and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(double i, T t) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(double) — the double function argument -
t(T) — the object function argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
Interface DoubleObjPredicate (com.landawn.abacus.util.Throwables.DoubleObjPredicate)
Represents a predicate (boolean-valued function) of a double value and an object.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(double i, T t) throws E - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(double) — the double input argument -
t(T) — the object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if an error occurs during predicate evaluation
-
Interface BooleanNFunction (com.landawn.abacus.util.Throwables.BooleanNFunction)
Represents a function that accepts a boolean array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(boolean... args) throws E - Summary: Applies this function to the given boolean array.
-
Parameters:
-
args(boolean[]) — the boolean array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> BooleanNFunction<V, E>
-
Signature:
default <V> BooleanNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface CharNFunction (com.landawn.abacus.util.Throwables.CharNFunction)
Represents a function that accepts a char array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(char... args) throws E - Summary: Applies this function to the given char array.
-
Parameters:
-
args(char[]) — the char array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> CharNFunction<V, E>
-
Signature:
default <V> CharNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ByteNFunction (com.landawn.abacus.util.Throwables.ByteNFunction)
Represents a function that accepts a byte array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(byte... args) throws E - Summary: Applies this function to the given byte array.
-
Parameters:
-
args(byte[]) — the byte array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> ByteNFunction<V, E>
-
Signature:
default <V> ByteNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ShortNFunction (com.landawn.abacus.util.Throwables.ShortNFunction)
Represents a function that accepts a short array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(short... args) throws E - Summary: Applies this function to the given short array.
-
Parameters:
-
args(short[]) — the short array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> ShortNFunction<V, E>
-
Signature:
default <V> ShortNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntNFunction (com.landawn.abacus.util.Throwables.IntNFunction)
Represents a function that accepts an int array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(int... args) throws E - Summary: Applies this function to the given int array.
-
Parameters:
-
args(int[]) — the int array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> IntNFunction<V, E>
-
Signature:
default <V> IntNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongNFunction (com.landawn.abacus.util.Throwables.LongNFunction)
Represents a function that accepts a long array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(long... args) throws E - Summary: Applies this function to the given long array.
-
Parameters:
-
args(long[]) — the long array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> LongNFunction<V, E>
-
Signature:
default <V> LongNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface FloatNFunction (com.landawn.abacus.util.Throwables.FloatNFunction)
Represents a function that accepts a float array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(float... args) throws E - Summary: Applies this function to the given float array.
-
Parameters:
-
args(float[]) — the float array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> FloatNFunction<V, E>
-
Signature:
default <V> FloatNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleNFunction (com.landawn.abacus.util.Throwables.DoubleNFunction)
Represents a function that accepts a double array and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(double... args) throws E - Summary: Applies this function to the given double array.
-
Parameters:
-
args(double[]) — the double array argument
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> DoubleNFunction<V, E>
-
Signature:
default <V> DoubleNFunction<V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface NFunction (com.landawn.abacus.util.Throwables.NFunction)
Represents a function that accepts a variable number of arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@SuppressWarnings("unchecked") R apply(T... args) throws E - Summary: Applies this function to the given arguments.
-
Parameters:
-
args(T[]) — the variable arguments of type T
-
- Returns: the function result
-
Throws:
-
E— if an error occurs during function execution
-
andThen(...) -> NFunction<T, V, E>
-
Signature:
default <V> NFunction<T, V, E> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntBooleanConsumer (com.landawn.abacus.util.Throwables.IntBooleanConsumer)
Represents an operation that accepts an int index and a boolean value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, boolean e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(boolean) — the boolean element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntCharConsumer (com.landawn.abacus.util.Throwables.IntCharConsumer)
Represents an operation that accepts an int index and a char value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, char e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(char) — the char element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntByteConsumer (com.landawn.abacus.util.Throwables.IntByteConsumer)
Represents an operation that accepts an int index and a byte value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, byte e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(byte) — the byte element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntShortConsumer (com.landawn.abacus.util.Throwables.IntShortConsumer)
Represents an operation that accepts an int index and a short value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, short e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(short) — the short element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntIntConsumer (com.landawn.abacus.util.Throwables.IntIntConsumer)
Represents an operation that accepts two int values and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, int e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(int) — the int element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntLongConsumer (com.landawn.abacus.util.Throwables.IntLongConsumer)
Represents an operation that accepts an int index and a long value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, long e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(long) — the long element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntFloatConsumer (com.landawn.abacus.util.Throwables.IntFloatConsumer)
Represents an operation that accepts an int index and a float value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, float e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(float) — the float element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Interface IntDoubleConsumer (com.landawn.abacus.util.Throwables.IntDoubleConsumer)
Represents an operation that accepts an int index and a double value and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int idx, double e) throws E - Summary: Performs this operation on the given arguments.
-
Parameters:
-
idx(int) — the index -
e(double) — the double element at the index
-
-
Throws:
-
E— if an error occurs during operation execution
-
Class EE (com.landawn.abacus.util.Throwables.EE)
Utility class containing functional interfaces that can throw two different types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface Runnable (com.landawn.abacus.util.Throwables.EE.Runnable)
Represents a task that returns no result and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
run(...) -> void
-
Signature:
void run() throws E, E2 - Summary: Executes the task.
-
Parameters:
- (none)
-
Throws:
-
E— if the first type of error occurs during execution -
E2— if the second type of error occurs during execution
-
Interface Callable (com.landawn.abacus.util.Throwables.EE.Callable)
Represents a task that returns a result and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
call(...) -> R
-
Signature:
R call() throws E, E2 - Summary: Computes a result.
-
Parameters:
- (none)
- Returns: the computed result
-
Throws:
-
E— if the first type of error occurs during computation -
E2— if the second type of error occurs during computation
-
Interface Supplier (com.landawn.abacus.util.Throwables.EE.Supplier)
Represents a supplier of results that may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> T
-
Signature:
T get() throws E, E2 - Summary: Gets a result.
-
Parameters:
- (none)
- Returns: a result
-
Throws:
-
E— if the first type of error occurs while getting the result -
E2— if the second type of error occurs while getting the result
-
Interface Predicate (com.landawn.abacus.util.Throwables.EE.Predicate)
Represents a predicate (boolean-valued function) of one argument that may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t) throws E, E2 - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
t(T) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation
-
Interface BiPredicate (com.landawn.abacus.util.Throwables.EE.BiPredicate)
Represents a predicate (boolean-valued function) of two arguments that may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, U u) throws E, E2 - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation
-
Interface TriPredicate (com.landawn.abacus.util.Throwables.EE.TriPredicate)
Represents a predicate (boolean-valued function) of three arguments that may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(A a, B b, C c) throws E, E2 - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation
-
Interface Function (com.landawn.abacus.util.Throwables.EE.Function)
Represents a function that accepts one argument and produces a result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t) throws E, E2 - Summary: Applies this function to the given argument.
-
Parameters:
-
t(T) — the function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution
-
Interface BiFunction (com.landawn.abacus.util.Throwables.EE.BiFunction)
Represents a function that accepts two arguments and produces a result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, U u) throws E, E2 - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution
-
Interface TriFunction (com.landawn.abacus.util.Throwables.EE.TriFunction)
Represents a function that accepts three arguments and produces a result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(A a, B b, C c) throws E, E2 - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution
-
Interface Consumer (com.landawn.abacus.util.Throwables.EE.Consumer)
Represents an operation that accepts a single input argument and returns no result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t) throws E, E2 - Summary: Performs this operation on the given argument.
-
Parameters:
-
t(T) — the input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution
-
Interface BiConsumer (com.landawn.abacus.util.Throwables.EE.BiConsumer)
Represents an operation that accepts two input arguments and returns no result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, U u) throws E, E2 - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution
-
Interface TriConsumer (com.landawn.abacus.util.Throwables.EE.TriConsumer)
Represents an operation that accepts three input arguments and returns no result, and may throw two types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(A a, B b, C c) throws E, E2 - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution
-
Class EEE (com.landawn.abacus.util.Throwables.EEE)
Utility class containing functional interfaces that can throw three different types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface Runnable (com.landawn.abacus.util.Throwables.EEE.Runnable)
Represents a task that returns no result and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
run(...) -> void
-
Signature:
void run() throws E, E2, E3 - Summary: Executes the task.
-
Parameters:
- (none)
-
Throws:
-
E— if the first type of error occurs during execution -
E2— if the second type of error occurs during execution -
E3— if the third type of error occurs during execution
-
Interface Callable (com.landawn.abacus.util.Throwables.EEE.Callable)
Represents a task that returns a result and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
call(...) -> R
-
Signature:
R call() throws E, E2, E3 - Summary: Computes a result.
-
Parameters:
- (none)
- Returns: the computed result
-
Throws:
-
E— if the first type of error occurs during computation -
E2— if the second type of error occurs during computation -
E3— if the third type of error occurs during computation
-
Interface Supplier (com.landawn.abacus.util.Throwables.EEE.Supplier)
Represents a supplier of results that may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> T
-
Signature:
T get() throws E, E2, E3 - Summary: Gets a result.
-
Parameters:
- (none)
- Returns: a result
-
Throws:
-
E— if the first type of error occurs while getting the result -
E2— if the second type of error occurs while getting the result -
E3— if the third type of error occurs while getting the result
-
Interface Predicate (com.landawn.abacus.util.Throwables.EEE.Predicate)
Represents a predicate (boolean-valued function) of one argument that may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t) throws E, E2, E3 - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
t(T) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation -
E3— if the third type of error occurs during evaluation
-
Interface BiPredicate (com.landawn.abacus.util.Throwables.EEE.BiPredicate)
Represents a predicate (boolean-valued function) of two arguments that may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(T t, U u) throws E, E2, E3 - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation -
E3— if the third type of error occurs during evaluation
-
Interface TriPredicate (com.landawn.abacus.util.Throwables.EEE.TriPredicate)
Represents a predicate (boolean-valued function) of three arguments that may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
boolean test(A a, B b, C c) throws E, E2, E3 - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
-
Throws:
-
E— if the first type of error occurs during evaluation -
E2— if the second type of error occurs during evaluation -
E3— if the third type of error occurs during evaluation
-
Interface Function (com.landawn.abacus.util.Throwables.EEE.Function)
Represents a function that accepts one argument and produces a result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t) throws E, E2, E3 - Summary: Applies this function to the given argument.
-
Parameters:
-
t(T) — the function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution -
E3— if the third type of error occurs during function execution
-
Interface BiFunction (com.landawn.abacus.util.Throwables.EEE.BiFunction)
Represents a function that accepts two arguments and produces a result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(T t, U u) throws E, E2, E3 - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution -
E3— if the third type of error occurs during function execution
-
Interface TriFunction (com.landawn.abacus.util.Throwables.EEE.TriFunction)
Represents a function that accepts three arguments and produces a result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
R apply(A a, B b, C c) throws E, E2, E3 - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result
-
Throws:
-
E— if the first type of error occurs during function execution -
E2— if the second type of error occurs during function execution -
E3— if the third type of error occurs during function execution
-
Interface Consumer (com.landawn.abacus.util.Throwables.EEE.Consumer)
Represents an operation that accepts a single input argument and returns no result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t) throws E, E2, E3 - Summary: Performs this operation on the given argument.
-
Parameters:
-
t(T) — the input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution -
E3— if the third type of error occurs during operation execution
-
Interface BiConsumer (com.landawn.abacus.util.Throwables.EEE.BiConsumer)
Represents an operation that accepts two input arguments and returns no result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(T t, U u) throws E, E2, E3 - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution -
E3— if the third type of error occurs during operation execution
-
Interface TriConsumer (com.landawn.abacus.util.Throwables.EEE.TriConsumer)
Represents an operation that accepts three input arguments and returns no result, and may throw three types of exceptions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(A a, B b, C c) throws E, E2, E3 - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
-
Throws:
-
E— if the first type of error occurs during operation execution -
E2— if the second type of error occurs during operation execution -
E3— if the third type of error occurs during operation execution
-
Class Ticker (com.landawn.abacus.util.Ticker)
A time source that provides access to the current value of some underlying clock.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
systemTicker(...) -> Ticker
-
Signature:
public static Ticker systemTicker() - Summary: Returns a ticker that reads the current time using {@link System#nanoTime} .
-
Parameters:
- (none)
- Returns: a ticker that uses {@link System#nanoTime} as its time source
Public Instance Methods
read(...) -> long
-
Signature:
public abstract long read() - Summary: Returns the number of nanoseconds elapsed since this ticker's fixed but arbitrary point of reference.
-
Contract:
- </p> <p> <b> Implementation note: </b> Subclasses must ensure that the values returned are monotonically non-decreasing (i.e., later calls never return a smaller value than earlier calls).
-
Parameters:
- (none)
- Returns: the current reading of the ticker, in nanoseconds
Class Timed (com.landawn.abacus.util.Timed)
An immutable container that holds a value paired with a timestamp.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Timed<T>
-
Signature:
public static <T> Timed<T> of(final T value) - Summary: Creates a new Timed instance with the specified value and the current system time.
-
Parameters:
-
value(T) — the value to associate with the current timestamp; can be {@code null} .
-
- Returns: a new Timed instance containing the value and current timestamp.
- See also: #of(Object, long)
-
Signature:
public static <T> Timed<T> of(final T value, final long timeInMillis) - Summary: Creates a new Timed instance with the specified value and timestamp.
-
Parameters:
-
value(T) — the value to associate with the timestamp; can be {@code null} . -
timeInMillis(long) — the timestamp in milliseconds since epoch.
-
- Returns: a new Timed instance containing the value and specified timestamp.
- See also: #of(Object)
Public Instance Methods
timestamp(...) -> long
-
Signature:
public long timestamp() - Summary: Returns the timestamp associated with this timed value.
-
Parameters:
- (none)
- Returns: the timestamp in milliseconds since epoch.
- See also: #value()
value(...) -> T
-
Signature:
public T value() - Summary: Returns the value contained in this timed instance.
-
Contract:
- The returned value may be {@code null} if {@code null} was provided when creating the instance.
-
Parameters:
- (none)
- Returns: the value associated with the timestamp; can be {@code null} .
- See also: #timestamp()
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this timed instance.
-
Contract:
- If the value is {@code null} , its hash code is 0.
-
Parameters:
- (none)
- Returns: a hash code value for this object.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this one.
-
Contract:
- Two Timed instances are considered equal if they have the same timestamp and their values are equal (or both null).
-
Parameters:
-
obj(Object) — the reference object with which to compare.
-
- Returns: {@code true} if this object is equal to the obj argument; {@code false} otherwise.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this timed instance.
-
Parameters:
- (none)
- Returns: a string representation of this timed instance.
Class TriIterator (com.landawn.abacus.util.TriIterator)
The TriIterator class is an abstract class that extends ImmutableIterator.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> TriIterator<A, B, C>
-
Signature:
public static <A, B, C> TriIterator<A, B, C> empty() - Summary: Returns an empty TriIterator.
-
Parameters:
- (none)
- Returns: an empty TriIterator
generate(...) -> TriIterator<A, B, C>
-
Signature:
public static <A, B, C> TriIterator<A, B, C> generate(final Consumer<Triple<A, B, C>> output) - Summary: Generates an infinite {@code TriIterator} instance with the provided output Consumer.
-
Parameters:
-
output(Consumer<Triple<A, B, C>>) — A Consumer that accepts a Triple < A, B, C > and produces the next Triple < A, B, C > on each iteration.
-
- Returns: A TriIterator < A, B, C > that uses the provided output Consumer to generate its elements.
- See also: #generate(BooleanSupplier, Consumer)
-
Signature:
public static <A, B, C> TriIterator<A, B, C> generate(final BooleanSupplier hasNext, final Consumer<Triple<A, B, C>> output) throws IllegalArgumentException - Summary: Generates a TriIterator instance with the provided hasNext BooleanSupplier and output Consumer.
-
Contract:
- The hasNext BooleanSupplier is used to determine if the iterator has more elements.
- The output consumer should populate the provided Triple object with new values on each call.
-
Parameters:
-
hasNext(BooleanSupplier) — A BooleanSupplier that returns {@code true} if the iterator has more elements. -
output(Consumer<Triple<A, B, C>>) — A Consumer that accepts a Triple < A, B, C > and produces the next Triple < A, B, C > on each iteration.
-
- Returns: A TriIterator < A, B, C > that uses the provided hasNext BooleanSupplier and output Consumer to generate its elements.
-
Throws:
-
java.lang.IllegalArgumentException— If hasNext or output is {@code null} .
-
-
Signature:
public static <A, B, C> TriIterator<A, B, C> generate(final int fromIndex, final int toIndex, final IntObjConsumer<Triple<A, B, C>> output) throws IllegalArgumentException, IndexOutOfBoundsException - Summary: Generates a TriIterator instance with the provided fromIndex, toIndex, and output IntObjConsumer.
-
Parameters:
-
fromIndex(int) — The starting index of the iterator (inclusive). -
toIndex(int) — The ending index of the iterator (exclusive). -
output(IntObjConsumer<Triple<A, B, C>>) — An IntObjConsumer that accepts an integer index and a Triple < A, B, C > to populate on each iteration.
-
- Returns: A TriIterator < A, B, C > that uses the provided fromIndex, toIndex, and output IntObjConsumer to generate its elements.
-
Throws:
-
java.lang.IllegalArgumentException— If fromIndex is greater than toIndex. -
java.lang.IndexOutOfBoundsException— If fromIndex or toIndex is out of range.
-
zip(...) -> TriIterator<A, B, C>
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final A[] a, final B[] b, final C[] c) - Summary: Zips three arrays into a TriIterator.
-
Contract:
- If the arrays have different lengths, the resulting TriIterator will have the length of the shortest array.
- If any of arrays is {@code null} , returns an empty TriIterator.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
c(C[]) — the third array
-
- Returns: a TriIterator that iterates over the elements of the three arrays in parallel
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC) - Summary: Zips three arrays into a TriIterator with specified default values for missing elements.
-
Contract:
- If the arrays have different lengths, the resulting TriIterator will continue with the default values for the shorter array until the longest array is exhausted.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
c(C[]) — the third array -
valueForNoneA(A) — the default value for missing elements in the first array -
valueForNoneB(B) — the default value for missing elements in the second array -
valueForNoneC(C) — the default value for missing elements in the third array
-
- Returns: a TriIterator that iterates over the elements of the three arrays in parallel, using default values for missing elements
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c) - Summary: Zips three iterables into a TriIterator.
-
Contract:
- If the iterables have different lengths, the resulting TriIterator will have the length of the shortest iterable.
- If any of iterable is {@code null} , returns an empty TriIterator.
-
Parameters:
-
a(Iterable<A>) — the first iterable -
b(Iterable<B>) — the second iterable -
c(Iterable<C>) — the third iterable
-
- Returns: a TriIterator that iterates over the elements of the three iterables in parallel
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final Iterable<A> a, final Iterable<B> b, final Iterable<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC) - Summary: Zips three iterables into a TriIterator with specified default values for missing elements.
-
Contract:
- If the iterables have different lengths, the resulting TriIterator will continue with the default values for the shorter iterable until the longest iterable is exhausted.
-
Parameters:
-
a(Iterable<A>) — the first iterable -
b(Iterable<B>) — the second iterable -
c(Iterable<C>) — the third iterable -
valueForNoneA(A) — the default value for missing elements in the first iterable -
valueForNoneB(B) — the default value for missing elements in the second iterable -
valueForNoneC(C) — the default value for missing elements in the third iterable
-
- Returns: a TriIterator that iterates over the elements of the three iterables in parallel, using default values for missing elements
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final Iterator<A> iterA, final Iterator<B> iterB, final Iterator<C> iterC) - Summary: Zips three iterators into a TriIterator.
-
Contract:
- If the iterators have different lengths, the resulting TriIterator will have the length of the shortest iterator.
- If any of iterator is {@code null} , returns an empty TriIterator.
-
Parameters:
-
iterA(Iterator<A>) — the first iterator -
iterB(Iterator<B>) — the second iterator -
iterC(Iterator<C>) — the third iterator
-
- Returns: a TriIterator that iterates over the elements of the three iterators in parallel
-
Signature:
public static <A, B, C> TriIterator<A, B, C> zip(final Iterator<A> iterA, final Iterator<B> iterB, final Iterator<C> iterC, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC) - Summary: Zips three iterators into a TriIterator with specified default values for missing elements.
-
Contract:
- If the iterators have different lengths, the resulting TriIterator will continue with the default values for the shorter iterator until the longest iterator is exhausted.
-
Parameters:
-
iterA(Iterator<A>) — the first iterator -
iterB(Iterator<B>) — the second iterator -
iterC(Iterator<C>) — the third iterator -
valueForNoneA(A) — the default value for missing elements in the first iterator -
valueForNoneB(B) — the default value for missing elements in the second iterator -
valueForNoneC(C) — the default value for missing elements in the third iterator
-
- Returns: a TriIterator that iterates over the elements of the three iterators in parallel, using default values for missing elements
unzip(...) -> TriIterator<A, B, C>
-
Signature:
public static <T, A, B, C> TriIterator<A, B, C> unzip(final Iterable<? extends T> iter, final BiConsumer<? super T, Triple<A, B, C>> unzipFunction) - Summary: Unzips an iterable of elements into a TriIterator.
-
Contract:
- If the iterable is {@code null} , an empty TriIterator is returned.
-
Parameters:
-
iter(Iterable<? extends T>) — the input iterable -
unzipFunction(BiConsumer<? super T, Triple<A, B, C>>) — a BiConsumer that accepts an element of type T and a {@code Triple<A, B, C>} and populates the triple with the unzipped values
-
- Returns: a TriIterator that iterates over the unzipped elements
-
Signature:
public static <T, A, B, C> TriIterator<A, B, C> unzip(final Iterator<? extends T> iter, final BiConsumer<? super T, Triple<A, B, C>> unzipFunction) - Summary: Unzips an iterator of elements into a TriIterator.
-
Contract:
- If the iterator is {@code null} , an empty TriIterator is returned.
-
Parameters:
-
iter(Iterator<? extends T>) — the input iterator -
unzipFunction(BiConsumer<? super T, Triple<A, B, C>>) — a BiConsumer that accepts an element of type T and a Triple < A, B, C > and populates the triple with the unzipped values
-
- Returns: a TriIterator that iterates over the unzipped elements
Public Instance Methods
forEachRemaining(...) -> void
-
Signature:
@Deprecated @Override public void forEachRemaining(final Consumer<? super Triple<A, B, C>> action) - Summary: Performs the given action for each remaining element in the iterator until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(Consumer<? super Triple<A, B, C>>) — the action to be performed for each element
-
- See also: #forEachRemaining(TriConsumer)
-
Signature:
public abstract void forEachRemaining(final TriConsumer<? super A, ? super B, ? super C> action) - Summary: Performs the given action for each remaining element in the iterator until all elements have been processed or the action throws an exception.
-
Parameters:
-
action(TriConsumer<? super A, ? super B, ? super C>) — the action to be performed for each element
-
foreachRemaining(...) -> void
-
Signature:
public abstract <E extends Exception> void foreachRemaining(final Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) throws E - Summary: Performs the given action for each remaining element in the iterator until all elements have been processed or the action throws an exception.
-
Contract:
- This is particularly useful when the iteration logic involves I/O operations, database access, or other operations that declare checked exceptions, eliminating the need to wrap exceptions in unchecked RuntimeExceptions.
-
Parameters:
-
action(Throwables.TriConsumer<? super A, ? super B, ? super C, E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
skip(...) -> TriIterator<A, B, C>
-
Signature:
public TriIterator<A, B, C> skip(final long n) throws IllegalArgumentException - Summary: Returns a new TriIterator with <i> n </i> elements skipped from the beginning of this TriIterator.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: A new TriIterator that skips the first <i> n </i> elements.
-
Throws:
-
java.lang.IllegalArgumentException— If <i> n </i> is negative.
-
limit(...) -> TriIterator<A, B, C>
-
Signature:
public TriIterator<A, B, C> limit(final long count) throws IllegalArgumentException - Summary: Returns a new TriIterator with a limited number of elements.
-
Parameters:
-
count(long) — the maximum number of elements to include in the resulting TriIterator
-
- Returns: a new TriIterator that contains at most the specified number of elements
-
Throws:
-
java.lang.IllegalArgumentException— If <i> count </i> is negative.
-
filter(...) -> TriIterator<A, B, C>
-
Signature:
public TriIterator<A, B, C> filter(final TriPredicate<? super A, ? super B, ? super C> predicate) - Summary: Returns a new TriIterator that includes only the elements that satisfy the provided predicate.
-
Parameters:
-
predicate(TriPredicate<? super A, ? super B, ? super C>) — the predicate to apply to each triple of elements
-
- Returns: a new TriIterator containing only the elements that match the predicate
map(...) -> ObjIterator<R>
-
Signature:
public abstract <R> ObjIterator<R> map(final TriFunction<? super A, ? super B, ? super C, ? extends R> mapper) - Summary: Transforms the elements of this TriIterator using the given mapper function.
-
Parameters:
-
mapper(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to apply to each triple of elements
-
- Returns: an ObjIterator containing the elements produced by the mapper function
first(...) -> Optional<Triple<A, B, C>>
-
Signature:
public Optional<Triple<A, B, C>> first() - Summary: Returns an Optional containing the first triple of elements in the iterator.
-
Contract:
- If the iterator is empty, returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the first triple of elements, or an empty Optional if the iterator is empty
last(...) -> Optional<Triple<A, B, C>>
-
Signature:
public Optional<Triple<A, B, C>> last() - Summary: Returns an Optional containing the last triple of elements in the iterator.
-
Contract:
- If the iterator is empty, returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the last triple of elements, or an empty Optional if the iterator is empty
stream(...) -> Stream<R>
-
Signature:
public <R> Stream<R> stream(final TriFunction<? super A, ? super B, ? super C, ? extends R> mapper) - Summary: Returns a Stream of elements produced by applying the given mapper function to each triple of elements in this TriIterator.
-
Parameters:
-
mapper(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to apply to each triple of elements
-
- Returns: a Stream containing the elements produced by the mapper function
toArray(...) -> Triple<A, B, C>\[\]
-
Signature:
@SuppressWarnings("deprecation") public Triple<A, B, C>[] toArray() - Summary: Converts the elements in this TriIterator to an array of Triple objects.
-
Parameters:
- (none)
- Returns: An array containing the remaining triples of elements in this TriIterator.
-
Signature:
@Deprecated public <T> T[] toArray(final T[] a) - Summary: Converts the elements in this TriIterator to an array of the specified type.
-
Parameters:
-
a(T[]) — the array into which the elements of this TriIterator are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
-
- Returns: an array containing the elements of this TriIterator
toList(...) -> List<Triple<A, B, C>>
-
Signature:
public List<Triple<A, B, C>> toList() - Summary: Converts the elements in this TriIterator to a List of Triple objects.
-
Parameters:
- (none)
- Returns: a List containing all triples of elements in this TriIterator
toMultiList(...) -> Triple<List<A>, List<B>, List<C>>
-
Signature:
public Triple<List<A>, List<B>, List<C>> toMultiList(@SuppressWarnings("rawtypes") final Supplier<? extends List> supplier) - Summary: Converts the elements in this TriIterator to three separate lists of type A, B, and C.
-
Parameters:
-
supplier(@SuppressWarnings(value = "rawtypes") Supplier<? extends List>) — a Supplier that provides new instances of List for storing the elements
-
- Returns: a Triple containing three lists of elements of type A, B, and C
toMultiSet(...) -> Triple<Set<A>, Set<B>, Set<C>>
-
Signature:
public Triple<Set<A>, Set<B>, Set<C>> toMultiSet(@SuppressWarnings("rawtypes") final Supplier<? extends Set> supplier) - Summary: Converts the elements in this TriIterator to three separate sets of type A, B, and C.
-
Parameters:
-
supplier(@SuppressWarnings(value = "rawtypes") Supplier<? extends Set>) — a Supplier that provides new instances of Set for storing the elements
-
- Returns: a Triple containing three sets of elements of type A, B, and C
Class Triple (com.landawn.abacus.util.Triple)
A container class that holds three values of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Triple<L, M, R>
-
Signature:
public static <L, M, R> Triple<L, M, R> of(final L leftValue, final M middleValue, final R rightValue) - Summary: Creates a new Triple instance containing the specified left, middle, and right elements.
-
Parameters:
-
leftValue(L) — the left element, may be {@code null} . -
middleValue(M) — the middle element, may be {@code null} . -
rightValue(R) — the right element, may be {@code null} .
-
- Returns: a new Triple instance containing the specified elements.
emptyArray(...) -> Triple<L, M, R>\[\]
-
Signature:
@SuppressWarnings("unchecked") public static <L, M, R> Triple<L, M, R>[] emptyArray() - Summary: Returns a type-safe empty array of Triple instances.
-
Parameters:
- (none)
- Returns: an empty, immutable array of Triple instances.
Public Instance Methods
<init>(...) -> void
-
Signature:
public Triple() - Summary: Constructs an empty Triple with all elements set to {@code null} .
-
Contract:
- This constructor is typically used when the values will be set later using the setter methods.
-
Parameters:
- (none)
left(...) -> L
-
Signature:
public L left() - Summary: Returns the left element of this triple.
-
Parameters:
- (none)
- Returns: the left element of this triple, may be {@code null} .
middle(...) -> M
-
Signature:
public M middle() - Summary: Returns the middle element of this triple.
-
Parameters:
- (none)
- Returns: the middle element of this triple, may be {@code null} .
right(...) -> R
-
Signature:
public R right() - Summary: Returns the right element of this triple.
-
Parameters:
- (none)
- Returns: the right element of this triple, may be {@code null} .
getLeft(...) -> L
-
Signature:
@Deprecated public L getLeft() - Summary: Returns the left element of this Triple.
-
Parameters:
- (none)
- Returns: the left element, may be {@code null} .
- See also: #left()
setLeft(...) -> void
-
Signature:
public void setLeft(final L left) - Summary: Sets the left element of this triple to the specified value.
-
Parameters:
-
left(L) — the new value for the left element, may be {@code null} .
-
getMiddle(...) -> M
-
Signature:
@Deprecated public M getMiddle() - Summary: Returns the middle element of this Triple.
-
Parameters:
- (none)
- Returns: the middle element, may be {@code null} .
- See also: #middle()
setMiddle(...) -> void
-
Signature:
public void setMiddle(final M middle) - Summary: Sets the middle element of this triple to the specified value.
-
Parameters:
-
middle(M) — the new value for the middle element, may be {@code null} .
-
getRight(...) -> R
-
Signature:
@Deprecated public R getRight() - Summary: Returns the right element of this Triple.
-
Parameters:
- (none)
- Returns: the right element, may be {@code null} .
- See also: #right()
setRight(...) -> void
-
Signature:
public void setRight(final R right) - Summary: Sets the right element of this triple to the specified value.
-
Parameters:
-
right(R) — the new value for the right element, may be {@code null} .
-
set(...) -> void
-
Signature:
public void set(final L left, final M middle, final R right) - Summary: Sets all three elements of this Triple to the specified values in a single operation.
-
Parameters:
-
left(L) — the new value for the left element, may be {@code null} . -
middle(M) — the new value for the middle element, may be {@code null} . -
right(R) — the new value for the right element, may be {@code null} .
-
getAndSetLeft(...) -> L
-
Signature:
public L getAndSetLeft(final L newLeft) - Summary: Returns the current value of the left element and then updates it with the specified new value.
-
Contract:
- This method is useful when you need to retrieve the old value while setting a new one in an atomic-like operation.
-
Parameters:
-
newLeft(L) — the new value to set for the left element, may be {@code null} .
-
- Returns: the previous value of the left element, may be {@code null} .
setAndGetLeft(...) -> L
-
Signature:
public L setAndGetLeft(final L newLeft) - Summary: Sets the left element to the specified new value and then returns the new value.
-
Contract:
- This method is useful when you want to set a value and immediately use it in a fluent style or chain of operations.
-
Parameters:
-
newLeft(L) — the new value to set for the left element, may be {@code null} .
-
- Returns: the new value of the left element (same as the parameter), may be {@code null} .
getAndSetMiddle(...) -> M
-
Signature:
public M getAndSetMiddle(final M newMiddle) - Summary: Returns the current value of the middle element and then updates it with the specified new value.
-
Contract:
- This method is useful when you need to retrieve the old value while setting a new one in an atomic-like operation.
-
Parameters:
-
newMiddle(M) — the new value to set for the middle element, may be {@code null} .
-
- Returns: the previous value of the middle element, may be {@code null} .
setAndGetMiddle(...) -> M
-
Signature:
public M setAndGetMiddle(final M newMiddle) - Summary: Sets the middle element to the specified new value and then returns the new value.
-
Contract:
- This method is useful when you want to set a value and immediately use it in a fluent style or chain of operations.
-
Parameters:
-
newMiddle(M) — the new value to set for the middle element, may be {@code null} .
-
- Returns: the new value of the middle element (same as the parameter), may be {@code null} .
getAndSetRight(...) -> R
-
Signature:
public R getAndSetRight(final R newRight) - Summary: Returns the current value of the right element and then updates it with the specified new value.
-
Contract:
- This method is useful when you need to retrieve the old value while setting a new one in an atomic-like operation.
-
Parameters:
-
newRight(R) — the new value to set for the right element, may be {@code null} .
-
- Returns: the previous value of the right element, may be {@code null} .
setAndGetRight(...) -> R
-
Signature:
public R setAndGetRight(final R newRight) - Summary: Sets the right element to the specified new value and then returns the new value.
-
Contract:
- This method is useful when you want to set a value and immediately use it in a fluent style or chain of operations.
-
Parameters:
-
newRight(R) — the new value to set for the right element, may be {@code null} .
-
- Returns: the new value of the right element (same as the parameter), may be {@code null} .
setLeftIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setLeftIf(final Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate, final L newLeft) throws E - Summary: Conditionally sets the left element to the specified new value.
-
Contract:
- If the predicate returns {@code true} , the left element is updated to {@code newLeft} ; otherwise this triple remains unchanged.
- If it throws an exception, the left element is not modified and the exception is propagated to the caller.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super L, ? super M, ? super R, E>) — a tri-predicate evaluated against the current left, middle and right values; if it returns {@code true} , the left element is updated -
newLeft(L) — the new value to assign to the left element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if the left element was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setMiddleIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setMiddleIf(final Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate, final M newMiddle) throws E - Summary: Conditionally sets the middle element to the specified new value.
-
Contract:
- If the predicate returns {@code true} , the middle element is updated to {@code newMiddle} ; otherwise this triple remains unchanged.
- If it throws an exception, the middle element is not modified and the exception is propagated to the caller.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super L, ? super M, ? super R, E>) — a tri-predicate evaluated against the current left, middle and right values; if it returns {@code true} , the middle element is updated -
newMiddle(M) — the new value to assign to the middle element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if the middle element was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setRightIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setRightIf(final Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate, final R newRight) throws E - Summary: Conditionally sets the right element to the specified new value.
-
Contract:
- If the predicate returns {@code true} , the right element is updated to {@code newRight} ; otherwise this triple remains unchanged.
- If it throws an exception, the right element is not modified and the exception is propagated to the caller.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super L, ? super M, ? super R, E>) — a tri-predicate evaluated against the current left, middle and right values; if it returns {@code true} , the right element is updated -
newRight(R) — the new value to assign to the right element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if the right element was updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
setIf(...) -> boolean
-
Signature:
public <E extends Exception> boolean setIf(final Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate, final L newLeft, final M newMiddle, final R newRight) throws E - Summary: Conditionally sets all three elements to the specified new values.
-
Contract:
- If the predicate returns {@code true} , all three elements are updated to {@code newLeft} , {@code newMiddle} and {@code newRight} respectively.
- If the predicate returns {@code false} , this triple remains unchanged.
- If it throws an exception, no element is modified and the exception is propagated to the caller.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super L, ? super M, ? super R, E>) — a tri-predicate evaluated against the current left, middle and right values; if it returns {@code true} , all three elements are updated -
newLeft(L) — the new value to assign to the left element if the predicate passes; may be {@code null} -
newMiddle(M) — the new value to assign to the middle element if the predicate passes; may be {@code null} -
newRight(R) — the new value to assign to the right element if the predicate passes; may be {@code null}
-
- Returns: {@code true} if all three elements were updated, {@code false} otherwise
-
Throws:
-
E— if the predicate throws an exception
-
swap(...) -> Triple<R, M, L>
-
Signature:
@Beta public Triple<R, M, L> swap() - Summary: Creates and returns a new Triple with the left and right elements swapped, while keeping the middle element in the same position.
-
Parameters:
- (none)
- Returns: a new Triple instance with type Triple < R, M, L > where the left and right. elements are swapped
copy(...) -> Triple<L, M, R>
-
Signature:
public Triple<L, M, R> copy() - Summary: Creates and returns a shallow copy of this Triple.
-
Parameters:
- (none)
- Returns: a new Triple instance containing the same elements as this Triple.
toArray(...) -> Object\[\]
-
Signature:
public Object[] toArray() - Summary: Converts this Triple into an array containing the three elements in order: left, middle, right.
-
Parameters:
- (none)
- Returns: a new Object array of length 3 containing the left, middle, and right elements.
-
Signature:
public <A> A[] toArray(A[] a) - Summary: Converts this Triple into an array of the specified type, storing the three elements in order: left, middle, right.
-
Contract:
- If the provided array has a length of at least 3, the elements are stored in it; otherwise, a new array of the same type with length 3 is created and returned.
-
Parameters:
-
a(A[]) — the array into which the elements are to be stored, if it has length > = 3;. otherwise, a new array of the same runtime type is allocated
-
- Returns: an array containing the three elements of this Triple.
forEach(...) -> void
-
Signature:
public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: Applies the given consumer function to each element of this Triple in order: left, middle, then right.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer function to apply to each element; must accept. a common supertype of L, M, and R
-
-
Throws:
-
E— if the consumer throws an exception.
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.TriConsumer<? super L, ? super M, ? super R, E> action) throws E - Summary: Applies the given tri-consumer action to the three elements of this Triple.
-
Parameters:
-
action(Throwables.TriConsumer<? super L, ? super M, ? super R, E>) — the tri-consumer action to apply to the three elements.
-
-
Throws:
-
E— if the action throws an exception.
-
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super Triple<L, M, R>, E> action) throws E - Summary: Applies the given consumer action to this Triple instance as a whole.
-
Parameters:
-
action(Throwables.Consumer<? super Triple<L, M, R>, E>) — the consumer action to apply to this Triple.
-
-
Throws:
-
E— if the action throws an exception.
-
map(...) -> U
-
Signature:
public <U, E extends Exception> U map(final Throwables.TriFunction<? super L, ? super M, ? super R, ? extends U, E> mapper) throws E - Summary: Applies the given tri-function to the three elements of this Triple and returns the result.
-
Parameters:
-
mapper(Throwables.TriFunction<? super L, ? super M, ? super R, ? extends U, E>) — the tri-function to apply to the three elements.
-
- Returns: the result of applying the mapper function, may be {@code null} .
-
Throws:
-
E— if the mapper throws an exception.
-
-
Signature:
public <U, E extends Exception> U map(final Throwables.Function<? super Triple<L, M, R>, ? extends U, E> mapper) throws E - Summary: Applies the given function to this Triple instance as a whole and returns the result.
-
Parameters:
-
mapper(Throwables.Function<? super Triple<L, M, R>, ? extends U, E>) — the function to apply to this Triple.
-
- Returns: the result of applying the mapper function, may be {@code null} .
-
Throws:
-
E— if the mapper throws an exception.
-
filter(...) -> Optional<Triple<L, M, R>>
-
Signature:
public <E extends Exception> Optional<Triple<L, M, R>> filter(final Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate) throws E - Summary: Returns an Optional containing this Triple if the given tri-predicate returns true when applied to the three elements, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this Triple if the given tri-predicate returns true when applied to the three elements, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super L, ? super M, ? super R, E>) — the tri-predicate to test the three elements.
-
- Returns: an Optional containing this Triple if the predicate returns {@code true} ,. otherwise an empty Optional
-
Throws:
-
E— if the predicate throws an exception.
-
-
Signature:
public <E extends Exception> Optional<Triple<L, M, R>> filter(final Throwables.Predicate<? super Triple<L, M, R>, E> predicate) throws E - Summary: Returns an Optional containing this Triple if the given predicate returns true when applied to this Triple instance, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this Triple if the given predicate returns true when applied to this Triple instance, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.Predicate<? super Triple<L, M, R>, E>) — the predicate to test this Triple.
-
- Returns: an Optional containing this Triple if the predicate returns {@code true} ,. otherwise an empty Optional
-
Throws:
-
E— if the predicate throws an exception.
-
toTuple(...) -> Tuple3<L, M, R>
-
Signature:
public Tuple3<L, M, R> toTuple() - Summary: Converts this Triple to a Tuple3 with the same elements.
-
Parameters:
- (none)
- Returns: a new Tuple3 instance containing the same elements as this Triple.
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this Triple.
-
Parameters:
- (none)
- Returns: a hash code value for this Triple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this Triple with the specified object for equality.
-
Contract:
- Returns {@code true} if and only if the specified object is also a Triple and both Triples have equal left, middle, and right elements.
-
Parameters:
-
obj(Object) — the object to compare with this Triple for equality.
-
- Returns: {@code true} if the specified object is a Triple with equal elements, {@code false} otherwise
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this Triple in the format "(left, middle, right)".
-
Parameters:
- (none)
- Returns: a string representation of this Triple.
Class Try (com.landawn.abacus.util.Try)
A utility class that provides enhanced try-with-resources functionality and exception handling mechanisms.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
with(...) -> Try<T>
-
Signature:
public static <T extends AutoCloseable> Try<T> with(final T targetResource) throws IllegalArgumentException - Summary: Creates a new Try instance with the specified AutoCloseable resource.
-
Parameters:
-
targetResource(T) — the resource to be managed by the Try instance.
-
- Returns: a new Try instance managing the specified target resource.
-
Throws:
-
java.lang.IllegalArgumentException— if the targetResource is null.
-
-
Signature:
public static <T extends AutoCloseable> Try<T> with(final T targetResource, final Runnable finalAction) throws IllegalArgumentException - Summary: Creates a new Try instance with the specified resource and a final action to execute after resource cleanup.
-
Parameters:
-
targetResource(T) — the resource to be managed by the Try instance. -
finalAction(Runnable) — the action to be executed after the resource is closed.
-
- Returns: a new Try instance managing the specified target resource and final action.
-
Throws:
-
java.lang.IllegalArgumentException— if the targetResource or finalAction is null.
-
-
Signature:
public static <T extends AutoCloseable> Try<T> with(final Throwables.Supplier<T, ? extends Exception> targetResourceSupplier) throws IllegalArgumentException - Summary: Creates a new Try instance with a supplier that provides the AutoCloseable resource.
-
Contract:
- <p> The resource is created lazily when the operation is executed.
- This is useful when resource creation itself might throw an exception or when you want to delay resource creation until it's actually needed.
-
Parameters:
-
targetResourceSupplier(Throwables.Supplier<T, ? extends Exception>) — the supplier to provide the resource to be managed by the Try instance, must not be null.
-
- Returns: a new Try instance managing the specified target resource supplier.
-
Throws:
-
java.lang.IllegalArgumentException— if the targetResourceSupplier is null.
-
-
Signature:
public static <T extends AutoCloseable> Try<T> with(final Throwables.Supplier<T, ? extends Exception> targetResourceSupplier, final Runnable finalAction) throws IllegalArgumentException - Summary: Creates a new Try instance with a resource supplier and a final action.
-
Contract:
- The resource is created when needed, and the final action is executed after the resource is closed.
-
Parameters:
-
targetResourceSupplier(Throwables.Supplier<T, ? extends Exception>) — the supplier to provide the resource to be managed by the Try instance, must not be null. -
finalAction(Runnable) — the action to be executed after the resource is closed, must not be null.
-
- Returns: a new Try instance managing the specified target resource supplier and final action.
-
Throws:
-
java.lang.IllegalArgumentException— if the targetResourceSupplier or finalAction is null.
-
run(...) -> void
-
Signature:
public static void run(final Throwables.Runnable<? extends Exception> cmd) - Summary: Executes the provided runnable, converting any checked exception to a RuntimeException.
-
Parameters:
-
cmd(Throwables.Runnable<? extends Exception>) — the runnable task that might throw an exception. Must not be {@code null} .
-
- See also: Throwables#run(Throwables.Runnable)
-
Signature:
public static void run(final Throwables.Runnable<? extends Exception> cmd, final Consumer<? super Exception> actionOnError) - Summary: Executes the provided runnable and handles any exception with the specified error handler.
-
Parameters:
-
cmd(Throwables.Runnable<? extends Exception>) — the runnable task that might throw an exception, must not be {@code null} . -
actionOnError(Consumer<? super Exception>) — the consumer to handle any exceptions thrown by the {@code cmd} , must not be {@code null} .
-
- See also: Throwables#run(Throwables.Runnable, Consumer)
call(...) -> R
-
Signature:
public static <R> R call(final java.util.concurrent.Callable<R> cmd) - Summary: Executes the provided callable and returns its result, converting any checked exception to a RuntimeException.
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception and returns a result. Must not be {@code null} .
-
- Returns: the result of the {@code cmd} .
- See also: Throwables#call(Throwables.Callable)
-
Signature:
public static <R> R call(final java.util.concurrent.Callable<R> cmd, final Function<? super Exception, ? extends R> actionOnError) - Summary: Executes the provided callable and returns its result, or applies the error function if an exception occurs.
-
Contract:
- Executes the provided callable and returns its result, or applies the error function if an exception occurs.
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception and returns a result. Must not be {@code null} . -
actionOnError(Function<? super Exception, ? extends R>) — the function to apply to the exception if one is thrown by the {@code cmd} . Must not be {@code null} .
-
- Returns: the result of the {@code cmd} or the result of applying the {@code actionOnError} function to the exception if one is thrown.
- See also: Throwables#call(Throwables.Callable, Function)
-
Signature:
public static <R> R call(final java.util.concurrent.Callable<R> cmd, final Supplier<R> supplier) - Summary: Executes the provided callable and returns its result, or returns the value from the supplier if an exception occurs.
-
Contract:
- Executes the provided callable and returns its result, or returns the value from the supplier if an exception occurs.
- <p> This method allows for lazy evaluation of the fallback value, which is only computed if an exception actually occurs.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Lazy default value computation Config config = Try.call( () -> loadConfigFromFile(), () -> createDefaultConfig() ); // With expensive fallback Data data = Try.call( () -> fetchFromCache(key), () -> fetchFromDatabase(key) // Only called if cache fails ); } </pre>
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception and returns a result. Must not be {@code null} . -
supplier(Supplier<R>) — the supplier to provide a return value when an exception occurs. Must not be {@code null} .
-
- Returns: the result of the {@code cmd} or the result of the {@code supplier} if an exception occurs.
- See also: Throwables#call(Throwables.Callable, Supplier)
-
Signature:
public static <R extends Comparable<? super R>> R call(final java.util.concurrent.Callable<R> cmd, final R defaultValue) - Summary: Executes the provided callable and returns its result, or returns the default value if an exception occurs.
-
Contract:
- Executes the provided callable and returns its result, or returns the default value if an exception occurs.
- <p> This is the simplest form of exception handling with a fallback value, useful when you have a known default that should be used in case of any error.
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception and returns a result. Must not be {@code null} . -
defaultValue(R) — the default value to return if an exception occurs during the execution of the {@code cmd} .
-
- Returns: the result of the {@code cmd} or the default value if an exception occurs.
- See also: #call(java.util.concurrent.Callable, Supplier)
-
Signature:
public static <R> R call(final java.util.concurrent.Callable<R> cmd, final Predicate<? super Exception> predicate, final Supplier<R> supplier) - Summary: Executes the callable with conditional exception handling based on a predicate.
-
Contract:
- <p> If an exception occurs and the predicate returns {@code true} , the supplier provides the return value.
- If the predicate returns {@code false} , the exception is rethrown as a RuntimeException.
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception, must not be {@code null} . -
predicate(Predicate<? super Exception>) — the predicate to test the exception, must not be {@code null} . -
supplier(Supplier<R>) — the supplier to provide a return value when an exception occurs and the {@code predicate} returns {@code true} , must not be {@code null} .
-
- Returns: the result of the {@code cmd} or the result of the {@code supplier} if an exception occurs and the {@code predicate} returns {@code true} .
- See also: Throwables#call(Throwables.Callable, Predicate, Supplier)
-
Signature:
public static <R extends Comparable<? super R>> R call(final java.util.concurrent.Callable<R> cmd, final Predicate<? super Exception> predicate, final R defaultValue) - Summary: Executes the callable with conditional exception handling and a default value.
-
Parameters:
-
cmd(java.util.concurrent.Callable<R>) — the callable task that might throw an exception and returns a result. Must not be {@code null} . -
predicate(Predicate<? super Exception>) — the predicate to test the exception. If it returns {@code true} , the default value is returned. If it returns {@code false} , the exception is rethrown. Must not be {@code null} . -
defaultValue(R) — the default value to return if an exception occurs during the execution of the {@code cmd} and the {@code predicate} returns {@code true} .
-
- Returns: the result of the {@code cmd} or the default value if an exception occurs and the {@code predicate} returns {@code true} .
- See also: #call(java.util.concurrent.Callable, Predicate, Supplier)
Public Instance Methods
run(...) -> void
-
Signature:
public void run(final Throwables.Consumer<? super T, ? extends Exception> cmd) - Summary: Executes the provided consumer with the managed resource.
-
Parameters:
-
cmd(Throwables.Consumer<? super T, ? extends Exception>) — the consumer that operates on the managed resource.
-
-
Signature:
public void run(final Throwables.Consumer<? super T, ? extends Exception> cmd, final Consumer<? super Exception> actionOnError) - Summary: Executes the provided consumer with the managed resource and custom exception handling.
-
Parameters:
-
cmd(Throwables.Consumer<? super T, ? extends Exception>) — the consumer that operates on the managed resource. -
actionOnError(Consumer<? super Exception>) — the error handler for any exceptions that occur.
-
call(...) -> R
-
Signature:
public <R> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd) - Summary: Executes the provided function with the managed resource and returns the result.
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result.
-
- Returns: the result produced by the function.
-
Signature:
public <R> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd, final Function<? super Exception, ? extends R> actionOnError) - Summary: Executes the provided function with the managed resource and custom exception handling.
-
Contract:
- <p> If an exception occurs, the error function is applied to produce a return value instead of throwing an exception.
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result. -
actionOnError(Function<? super Exception, ? extends R>) — the function to transform exceptions into return values.
-
- Returns: the result from the command or from the error handler if an exception occurs.
-
Signature:
public <R> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd, final Supplier<R> supplier) - Summary: Executes the provided function with the managed resource, using a supplier for the fallback value.
-
Contract:
- <p> If an exception occurs, the supplier is invoked to provide a return value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Properties props = Try.with(() -> new FileInputStream("app.properties")) .call( stream -> { Properties p = new Properties(); p.load(stream); return p; }, () -> loadDefaultProperties() // Only called if loading fails ); } </pre>
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result. -
supplier(Supplier<R>) — the supplier to provide a fallback value if an exception occurs.
-
- Returns: the result from the command or from the supplier if an exception occurs.
-
Signature:
public <R extends Comparable<? super R>> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd, final R defaultValue) - Summary: Executes the provided function with the managed resource, returning a default value on exception.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code int lineCount = Try.with(Files.newBufferedReader(path)) .call( reader -> (int) reader.lines().count(), 0 // Default to 0 if file cannot be read ); } </pre>
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result. -
defaultValue(R) — the value to return if an exception occurs.
-
- Returns: the result from the command or the default value if an exception occurs.
- See also: #call(Throwables.Function, Supplier)
-
Signature:
public <R> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd, final Predicate<? super Exception> predicate, final Supplier<R> supplier) - Summary: Executes the function with conditional exception handling based on a predicate.
-
Contract:
- <p> If an exception occurs and the predicate returns {@code true} , the supplier provides the return value.
- If the predicate returns {@code false} , the exception is rethrown as a RuntimeException.
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result. -
predicate(Predicate<? super Exception>) — the predicate to test exceptions. -
supplier(Supplier<R>) — the supplier to provide a fallback value for matching exceptions.
-
- Returns: the result from the command or from the supplier if a matching exception occurs.
-
Signature:
public <R extends Comparable<? super R>> R call(final Throwables.Function<? super T, ? extends R, ? extends Exception> cmd, final Predicate<? super Exception> predicate, final R defaultValue) - Summary: Executes the function with conditional exception handling and a default value.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code String content = Try.with(new FileInputStream(file)) .call( stream -> new String(stream.readAllBytes()), ex -> ex instanceof FileNotFoundException, "" // Return empty string only if file not found ); } </pre>
-
Parameters:
-
cmd(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the function that operates on the managed resource and returns a result. -
predicate(Predicate<? super Exception>) — the predicate to test exceptions. -
defaultValue(R) — the value to return for matching exceptions.
-
- Returns: the result from the command or the default value if a matching exception occurs.
- See also: #call(Throwables.Function, Predicate, Supplier)
Class Tuple (com.landawn.abacus.util.Tuple)
A comprehensive utility class for creating and managing immutable, fixed-size tuples that can contain between 0 and 9 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Tuple1<T1>
-
Signature:
public static <T1> Tuple1<T1> of(final T1 _1) - Summary: Creates a new Tuple1 instance containing the specified element.
-
Parameters:
-
_1(T1) — the first element, may be {@code null} .
-
- Returns: a new Tuple1 instance containing the specified element.
-
Signature:
public static <T1, T2> Tuple2<T1, T2> of(final T1 _1, final T2 _2) - Summary: Creates a new Tuple2 instance containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element, may be {@code null} . -
_2(T2) — the second element, may be {@code null} .
-
- Returns: a new Tuple2 instance containing the specified elements.
-
Signature:
public static <T1, T2, T3> Tuple3<T1, T2, T3> of(final T1 _1, final T2 _2, final T3 _3) - Summary: Creates a new Tuple3 instance containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element, may be {@code null} . -
_2(T2) — the second element, may be {@code null} . -
_3(T3) — the third element, may be {@code null} .
-
- Returns: a new Tuple3 instance containing the specified elements.
-
Signature:
public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4) - Summary: Creates a Tuple4 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple.
-
- Returns: a new Tuple4 containing the specified elements.
-
Signature:
public static <T1, T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4, final T5 _5) - Summary: Creates a Tuple5 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple. -
_5(T5) — the fifth element to be contained in the tuple.
-
- Returns: a new Tuple5 containing the specified elements.
-
Signature:
public static <T1, T2, T3, T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4, final T5 _5, final T6 _6) - Summary: Creates a Tuple6 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple. -
_5(T5) — the fifth element to be contained in the tuple. -
_6(T6) — the sixth element to be contained in the tuple.
-
- Returns: a new Tuple6 containing the specified elements.
-
Signature:
public static <T1, T2, T3, T4, T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4, final T5 _5, final T6 _6, final T7 _7) - Summary: Creates a Tuple7 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple. -
_5(T5) — the fifth element to be contained in the tuple. -
_6(T6) — the sixth element to be contained in the tuple. -
_7(T7) — the seventh element to be contained in the tuple.
-
- Returns: a new Tuple7 containing the specified elements.
-
Signature:
@Deprecated public static <T1, T2, T3, T4, T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4, final T5 _5, final T6 _6, final T7 _7, final T8 _8) - Summary: Creates a Tuple8 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple. -
_5(T5) — the fifth element to be contained in the tuple. -
_6(T6) — the sixth element to be contained in the tuple. -
_7(T7) — the seventh element to be contained in the tuple. -
_8(T8) — the eighth element to be contained in the tuple.
-
- Returns: a new Tuple8 containing the specified elements.
-
Signature:
@Deprecated public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> of(final T1 _1, final T2 _2, final T3 _3, final T4 _4, final T5 _5, final T6 _6, final T7 _7, final T8 _8, final T9 _9) - Summary: Creates a Tuple9 containing the specified elements in order.
-
Parameters:
-
_1(T1) — the first element to be contained in the tuple. -
_2(T2) — the second element to be contained in the tuple. -
_3(T3) — the third element to be contained in the tuple. -
_4(T4) — the fourth element to be contained in the tuple. -
_5(T5) — the fifth element to be contained in the tuple. -
_6(T6) — the sixth element to be contained in the tuple. -
_7(T7) — the seventh element to be contained in the tuple. -
_8(T8) — the eighth element to be contained in the tuple. -
_9(T9) — the ninth element to be contained in the tuple.
-
- Returns: a new Tuple9 containing the specified elements.
create(...) -> Tuple2<K, V>
-
Signature:
@Beta public static <K, V> Tuple2<K, V> create(final Map.Entry<K, V> entry) - Summary: Creates a Tuple2 from a Map.Entry, with the entry's key as the first element and the entry's value as the second element.
-
Parameters:
-
entry(Map.Entry<K, V>) — the map entry to convert to a tuple, must not be null.
-
- Returns: a new Tuple2 containing the key and value from the entry.
-
Signature:
@Beta public static <TP extends Tuple<TP>> TP create(final Object[] a) - Summary: Creates a tuple from an array of objects.
-
Contract:
- The array must contain between 0 and 9 elements.
-
Parameters:
-
a(Object[]) — the array of objects to convert to a tuple, may be {@code null} or empty.
-
- Returns: a tuple containing the array elements in order, or Tuple0.EMPTY if array is {@code null} or empty.
-
Signature:
@Beta public static <TP extends Tuple<TP>> TP create(final Collection<?> c) - Summary: Creates a tuple from a collection of objects.
-
Contract:
- The collection must contain between 0 and 9 elements.
-
Parameters:
-
c(Collection<?>) — the collection of objects to convert to a tuple, may be {@code null} or empty.
-
- Returns: a tuple containing the collection elements in iteration order, or Tuple0.EMPTY if collection is {@code null} or empty.
toList(...) -> List<T>
-
Signature:
@Beta public static <T> List<T> toList(final Tuple1<? extends T> tp) - Summary: Converts a Tuple1 to a List containing its single element.
-
Parameters:
-
tp(Tuple1<? extends T>) — the Tuple1 to convert to a list, must not be null.
-
- Returns: a List containing the single element from the tuple.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple2<? extends T, ? extends T> tp) - Summary: Converts a Tuple2 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple2<? extends T, ? extends T>) — the Tuple2 to convert to a list, must not be null.
-
- Returns: a List containing the two elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple3<? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple3 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple3<? extends T, ? extends T, ? extends T>) — the Tuple3 to convert to a list, must not be null.
-
- Returns: a List containing the three elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple4<? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple4 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple4<? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple4 to convert to a list, must not be null.
-
- Returns: a List containing the four elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple5<? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple5 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple5<? extends T, ? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple5 to convert to a list, must not be null.
-
- Returns: a List containing the five elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple6<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple6 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple6<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple6 to convert to a list, must not be null.
-
- Returns: a List containing the six elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple7<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple7 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple7<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple7 to convert to a list, must not be null.
-
- Returns: a List containing the seven elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList(final Tuple8<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple8 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple8<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple8 to convert to a list, must not be null.
-
- Returns: a List containing the eight elements from the tuple in order.
-
Signature:
@Beta public static <T> List<T> toList( final Tuple9<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) - Summary: Converts a Tuple9 to a List containing its elements in order.
-
Contract:
- <p> All elements must be assignable to the common type T.
-
Parameters:
-
tp(Tuple9<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T>) — the Tuple9 to convert to a list, must not be null.
-
- Returns: a List containing the nine elements from the tuple in order.
flatten(...) -> Tuple3<T1, T2, T3>
-
Signature:
@Beta public static <T1, T2, T3> Tuple3<T1, T2, T3> flatten(final Tuple2<Tuple2<T1, T2>, T3> tp) - Summary: Flattens a nested Tuple2 structure into a Tuple3.
-
Parameters:
-
tp(Tuple2<Tuple2<T1, T2>, T3>) — the nested tuple structure to flatten, must not be null.
-
- Returns: a new Tuple3 containing all three elements in order.
-
Signature:
@Beta public static <T1, T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> flatten(final Tuple3<Tuple3<T1, T2, T3>, T4, T5> tp) - Summary: Flattens a nested Tuple3 structure into a Tuple5.
-
Parameters:
-
tp(Tuple3<Tuple3<T1, T2, T3>, T4, T5>) — the nested tuple structure to flatten, must not be null.
-
- Returns: a new Tuple5 containing all five elements in order.
Public Instance Methods
arity(...) -> int
-
Signature:
public abstract int arity() - Summary: Returns the number of elements in this tuple.
-
Parameters:
- (none)
- Returns: the arity (size) of this tuple, which is the count of elements it contains.
anyNull(...) -> boolean
-
Signature:
public abstract boolean anyNull() - Summary: Checks if any element in this tuple is {@code null} .
-
Contract:
- Checks if any element in this tuple is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if at least one element in this tuple is {@code null} , {@code false} if all elements are non-null.
allNull(...) -> boolean
-
Signature:
public abstract boolean allNull() - Summary: Checks if all elements in this tuple are {@code null} .
-
Contract:
- Checks if all elements in this tuple are {@code null} .
- <p> This method performs a logical AND operation across all elements, returning {@code true} only if every element is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if every element in this tuple is {@code null} , {@code false} if at least one element is non-null.
contains(...) -> boolean
-
Signature:
public abstract boolean contains(final Object valueToFind) - Summary: Checks if this tuple contains the specified value.
-
Contract:
- Checks if this tuple contains the specified value.
-
Parameters:
-
valueToFind(Object) — the value to search for in this tuple, may be {@code null} .
-
- Returns: {@code true} if this tuple contains an element equal to the specified value, {@code false} otherwise.
toArray(...) -> Object\[\]
-
Signature:
public abstract Object[] toArray() - Summary: Returns an array containing all elements of this tuple in their positional order.
-
Parameters:
- (none)
- Returns: a new Object array containing all tuple elements in order.
-
Signature:
public abstract <A> A[] toArray(A[] a) - Summary: Returns an array containing all elements of this tuple, using the specified array type.
-
Contract:
- <p> If the provided array is large enough to hold all elements, it is used directly and the element following the last tuple element (if any) is set to {@code null} .
-
Parameters:
-
a(A[]) — the array into which the elements of this tuple are to be stored, if it is big enough;. otherwise, a new array of the same runtime type is allocated for this purpose
-
- Returns: an array containing all elements of this tuple.
forEach(...) -> void
-
Signature:
public abstract <E extends Exception> void forEach(Throwables.Consumer<?, E> consumer) throws E - Summary: Performs the given action for each element of this tuple in order.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the action to be performed for each element, must not be {@code null} .
-
-
Throws:
-
E— if the consumer throws an exception.
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.Consumer<? super TP, E> action) throws E - Summary: Performs the given action on this tuple as a whole.
-
Parameters:
-
action(Throwables.Consumer<? super TP, E>) — the action to be performed on this tuple, must not be {@code null} .
-
-
Throws:
-
E— if the action throws an exception.
-
map(...) -> R
-
Signature:
public <R, E extends Exception> R map(final Throwables.Function<? super TP, R, E> mapper) throws E - Summary: Applies the given mapping function to this tuple and returns the result.
-
Parameters:
-
mapper(Throwables.Function<? super TP, R, E>) — the mapping function to apply to this tuple, must not be {@code null} .
-
- Returns: the result of applying the mapping function to this tuple.
-
Throws:
-
E— if the mapper throws an exception.
-
filter(...) -> Optional<TP>
-
Signature:
@Beta public <E extends Exception> Optional<TP> filter(final Throwables.Predicate<? super TP, E> predicate) throws E - Summary: Returns an Optional containing this tuple if it matches the given predicate, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this tuple if it matches the given predicate, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.Predicate<? super TP, E>) — the predicate to test this tuple against, must not be {@code null} .
-
- Returns: an Optional containing this tuple if the predicate returns {@code true} , otherwise an empty Optional.
-
Throws:
-
E— if the predicate throws an exception.
-
Class Tuple1 (com.landawn.abacus.util.Tuple.Tuple1)
Represents a tuple with exactly one element.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: Returns the arity (number of elements) of this tuple.
-
Parameters:
- (none)
- Returns: 1, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: Checks if any element in this tuple is {@code null} .
-
Contract:
- Checks if any element in this tuple is {@code null} .
- <p> For Tuple1, this returns {@code true} if and only if the single element is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if the element is {@code null} , {@code false} otherwise.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: Checks if all elements in this tuple are {@code null} .
-
Contract:
- Checks if all elements in this tuple are {@code null} .
- <p> For Tuple1, this returns {@code true} if and only if the single element is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if the element is {@code null} , {@code false} otherwise.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: Checks if this tuple contains the specified value.
-
Contract:
- Checks if this tuple contains the specified value.
- <p> Since this tuple has only one element, this method returns true if and only if the element equals the specified value (including {@code null} equality).
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if the element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Returns an array containing the single element of this tuple.
-
Parameters:
- (none)
- Returns: a new Object array of length 1 containing the element.
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: Returns an array containing this tuple's element, using the specified array type.
-
Parameters:
-
a(A[]) — the array into which the element is to be stored, if it is big enough.
-
- Returns: an array containing the tuple element.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: Performs the given action on the single element of this tuple.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the action to be performed on the element.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this tuple.
-
Parameters:
- (none)
- Returns: a hash code value for this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this tuple is equal to the specified object.
-
Contract:
- Checks if this tuple is equal to the specified object.
- <p> Two Tuple1 instances are equal if they contain equal elements.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple1 with an equal element.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this tuple.
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple2 (com.landawn.abacus.util.Tuple.Tuple2)
Represents a tuple with exactly two elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: Returns the arity (number of elements) of this tuple.
-
Parameters:
- (none)
- Returns: 2, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: Checks if any element in this tuple is {@code null} .
-
Contract:
- Checks if any element in this tuple is {@code null} .
- <p> For Tuple2, this returns {@code true} if either element is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if at least one element is {@code null} , {@code false} otherwise.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: Checks if all elements in this tuple are {@code null} .
-
Contract:
- Checks if all elements in this tuple are {@code null} .
- <p> For Tuple2, this returns {@code true} if both elements are {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if both elements are {@code null} , {@code false} otherwise.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: Checks if this tuple contains the specified value.
-
Contract:
- Checks if this tuple contains the specified value.
- <p> Returns {@code true} if either element equals the specified value.
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if either element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Returns an array containing the two elements of this tuple in order.
-
Parameters:
- (none)
- Returns: a new Object array of length 2 containing the elements.
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: Returns an array containing this tuple's elements, using the specified array type.
-
Parameters:
-
a(A[]) — the array into which the elements are to be stored, if it is big enough.
-
- Returns: an array containing the tuple elements.
toPair(...) -> Pair<T1, T2>
-
Signature:
public Pair<T1, T2> toPair() - Summary: Converts this Tuple2 to a Pair with the same elements.
-
Parameters:
- (none)
- Returns: a new Pair containing the same elements as this tuple.
toEntry(...) -> ImmutableEntry<T1, T2>
-
Signature:
public ImmutableEntry<T1, T2> toEntry() - Summary: Converts this Tuple2 to an ImmutableEntry (Map.Entry) with the same elements.
-
Contract:
- This is useful for creating map entries or when working with APIs that expect Map.Entry objects.
-
Parameters:
- (none)
- Returns: a new ImmutableEntry containing the same elements as this tuple.
reverse(...) -> Tuple2<T2, T1>
-
Signature:
public Tuple2<T2, T1> reverse() - Summary: Creates a new Tuple2 with the elements in reversed order.
-
Contract:
- <p> This is useful when you need to swap the positions of elements, such as converting from (key, value) to (value, key).
-
Parameters:
- (none)
- Returns: a new Tuple2 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: Performs the given action for each element of this tuple.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the action to be performed for each element.
-
-
Throws:
-
E— if the consumer throws an exception.
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.BiConsumer<? super T1, ? super T2, E> action) throws E - Summary: Performs the given bi-consumer action on the two elements of this tuple.
-
Parameters:
-
action(Throwables.BiConsumer<? super T1, ? super T2, E>) — the bi-consumer action to be performed on the tuple elements.
-
-
Throws:
-
E— if the action throws an exception.
-
map(...) -> R
-
Signature:
public <R, E extends Exception> R map(final Throwables.BiFunction<? super T1, ? super T2, ? extends R, E> mapper) throws E - Summary: Applies the given bi-function to the two elements of this tuple and returns the result.
-
Parameters:
-
mapper(Throwables.BiFunction<? super T1, ? super T2, ? extends R, E>) — the bi-function to apply to the tuple elements.
-
- Returns: the result of applying the bi-function to this tuple's elements.
-
Throws:
-
E— if the mapper throws an exception.
-
filter(...) -> Optional<Tuple2<T1, T2>>
-
Signature:
public <E extends Exception> Optional<Tuple2<T1, T2>> filter(final Throwables.BiPredicate<? super T1, ? super T2, E> predicate) throws E - Summary: Returns an Optional containing this tuple if both elements match the given bi-predicate, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this tuple if both elements match the given bi-predicate, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super T1, ? super T2, E>) — the bi-predicate to test the tuple elements against.
-
- Returns: an Optional containing this tuple if the predicate returns {@code true} , empty Optional otherwise.
-
Throws:
-
E— if the predicate throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this tuple.
-
Parameters:
- (none)
- Returns: a hash code value for this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Checks if this tuple is equal to the specified object.
-
Contract:
- Checks if this tuple is equal to the specified object.
- <p> Two Tuple2 instances are equal if they contain equal elements in the same positions.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple2 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this tuple.
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple3 (com.landawn.abacus.util.Tuple.Tuple3)
Represents a tuple with exactly three elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 3, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the three elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all three elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
toTriple(...) -> Triple<T1, T2, T3>
-
Signature:
public Triple<T1, T2, T3> toTriple() - Summary: Converts this Tuple3 to a Triple with the same elements.
-
Parameters:
- (none)
- Returns: a new Triple containing the same elements as this tuple.
reverse(...) -> Tuple3<T3, T2, T1>
-
Signature:
public Tuple3<T3, T2, T1> reverse() - Summary: Creates a new Tuple3 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple3 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1, _2, _3.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
accept(...) -> void
-
Signature:
public <E extends Exception> void accept(final Throwables.TriConsumer<? super T1, ? super T2, ? super T3, E> action) throws E - Summary: Performs the given tri-consumer action on the three elements of this tuple.
-
Parameters:
-
action(Throwables.TriConsumer<? super T1, ? super T2, ? super T3, E>) — the tri-consumer action to be performed on the tuple elements.
-
-
Throws:
-
E— if the action throws an exception.
-
map(...) -> R
-
Signature:
public <R, E extends Exception> R map(final Throwables.TriFunction<? super T1, ? super T2, ? super T3, ? extends R, E> mapper) throws E - Summary: Applies the given tri-function to the three elements of this tuple and returns the result.
-
Parameters:
-
mapper(Throwables.TriFunction<? super T1, ? super T2, ? super T3, ? extends R, E>) — the tri-function to apply to the tuple elements.
-
- Returns: the result of applying the tri-function to this tuple's elements.
-
Throws:
-
E— if the mapper throws an exception.
-
filter(...) -> Optional<Tuple3<T1, T2, T3>>
-
Signature:
public <E extends Exception> Optional<Tuple3<T1, T2, T3>> filter(final Throwables.TriPredicate<? super T1, ? super T2, ? super T3, E> predicate) throws E - Summary: Returns an Optional containing this tuple if all three elements match the given tri-predicate, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing this tuple if all three elements match the given tri-predicate, otherwise returns an empty Optional.
-
Parameters:
-
predicate(Throwables.TriPredicate<? super T1, ? super T2, ? super T3, E>) — the tri-predicate to test the tuple elements against.
-
- Returns: an Optional containing this tuple if the predicate returns {@code true} , empty Optional otherwise.
-
Throws:
-
E— if the predicate throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all three elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple3 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple3 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple3 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple4 (com.landawn.abacus.util.Tuple.Tuple4)
Represents an immutable tuple of 4 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 4, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the four elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all four elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3, _4\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
reverse(...) -> Tuple4<T4, T3, T2, T1>
-
Signature:
public Tuple4<T4, T3, T2, T1> reverse() - Summary: Creates a new Tuple4 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple4 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1, _2, _3, _4.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all four elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple4 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple4 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple4 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3, _4)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple5 (com.landawn.abacus.util.Tuple.Tuple5)
Represents an immutable tuple of 5 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 5, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the five elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all five elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3, _4, _5\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
reverse(...) -> Tuple5<T5, T4, T3, T2, T1>
-
Signature:
public Tuple5<T5, T4, T3, T2, T1> reverse() - Summary: Creates a new Tuple5 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple5 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1, _2, _3, _4, _5.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all five elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple5 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple5 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple5 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3, _4, _5)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple6 (com.landawn.abacus.util.Tuple.Tuple6)
Represents an immutable tuple of 6 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 6, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the six elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all six elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3, _4, _5, _6\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
reverse(...) -> Tuple6<T6, T5, T4, T3, T2, T1>
-
Signature:
public Tuple6<T6, T5, T4, T3, T2, T1> reverse() - Summary: Creates a new Tuple6 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple6 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1, _2, _3, _4, _5, _6.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all six elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple6 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple6 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple6 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3, _4, _5, _6)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple7 (com.landawn.abacus.util.Tuple.Tuple7)
Represents an immutable tuple of 7 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 7, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the seven elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all seven elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3, _4, _5, _6, _7\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
reverse(...) -> Tuple7<T7, T6, T5, T4, T3, T2, T1>
-
Signature:
public Tuple7<T7, T6, T5, T4, T3, T2, T1> reverse() - Summary: Creates a new Tuple7 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple7 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1, _2, _3, _4, _5, _6, _7.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all seven elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple7 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple7 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple7 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3, _4, _5, _6, _7)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple8 (com.landawn.abacus.util.Tuple.Tuple8)
Represents an immutable tuple of 8 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: 8, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if any of the eight elements is null.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: {@code true} if all eight elements are null.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: {@inheritDoc}
-
Parameters:
-
valueToFind(Object) — the value to search for.
-
- Returns: {@code true} if any element equals the specified value.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: {@inheritDoc}
-
Parameters:
- (none)
- Returns: an array containing \[_1, _2, _3, _4, _5, _6, _7, _8\].
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: {@inheritDoc}
-
Parameters:
-
a(A[]) — the array to fill.
-
- Returns: the filled array.
reverse(...) -> Tuple8<T8, T7, T6, T5, T4, T3, T2, T1>
-
Signature:
public Tuple8<T8, T7, T6, T5, T4, T3, T2, T1> reverse() - Summary: Creates a new Tuple8 with the elements in reversed order.
-
Parameters:
- (none)
- Returns: a new Tuple8 with elements in reversed order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: {@inheritDoc} Applies the consumer to each element in order: _1 through _8.
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the consumer to apply.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: {@inheritDoc} Computes hash code based on all eight elements.
-
Parameters:
- (none)
- Returns: the hash code of this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: {@inheritDoc} Two Tuple8 instances are equal if all corresponding elements are equal.
-
Contract:
- {@inheritDoc} Two Tuple8 instances are equal if all corresponding elements are equal.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the specified object is a Tuple8 with equal elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: {@inheritDoc} Returns a string representation in the format "(_1, _2, _3, _4, _5, _6, _7, _8)".
-
Parameters:
- (none)
- Returns: a string representation of this tuple.
Class Tuple9 (com.landawn.abacus.util.Tuple.Tuple9)
Represents an immutable tuple of 9 elements of potentially different types.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
arity(...) -> int
-
Signature:
@Override public int arity() - Summary: Returns the arity (number of elements) of this tuple.
-
Parameters:
- (none)
- Returns: 9, the number of elements in this tuple.
anyNull(...) -> boolean
-
Signature:
@Override public boolean anyNull() - Summary: Checks if any element in this tuple is {@code null} .
-
Contract:
- Checks if any element in this tuple is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if at least one element is {@code null} , {@code false} otherwise.
allNull(...) -> boolean
-
Signature:
@Override public boolean allNull() - Summary: Checks if all elements in this tuple are {@code null} .
-
Contract:
- Checks if all elements in this tuple are {@code null} .
- <p> This method returns {@code true} only when every single element (_1 through _9) is {@code null} .
-
Parameters:
- (none)
- Returns: {@code true} if all 9 elements are {@code null} , {@code false} otherwise.
contains(...) -> boolean
-
Signature:
@Override public boolean contains(final Object valueToFind) - Summary: Checks if this tuple contains the specified value.
-
Contract:
- Checks if this tuple contains the specified value.
-
Parameters:
-
valueToFind(Object) — the value to search for, may be null.
-
- Returns: {@code true} if any element equals the specified value, {@code false} otherwise.
toArray(...) -> Object\[\]
-
Signature:
@Override public Object[] toArray() - Summary: Returns a new array containing all elements of this tuple in order.
-
Parameters:
- (none)
- Returns: a new Object array containing all 9 elements in order.
-
Signature:
@Override public <A> A[] toArray(A[] a) - Summary: Returns an array containing all elements of this tuple, using the provided array if possible.
-
Contract:
- Returns an array containing all elements of this tuple, using the provided array if possible.
- <p> If the provided array has a length of at least 9, it is filled with the tuple elements and returned.
- If the array is larger than 9, the element at index 9 is set to {@code null} .
- If the array is smaller than 9, a new array of the same runtime type with length 9 is created.
-
Parameters:
-
a(A[]) — the array to fill, or whose runtime type to use for creating a new array.
-
- Returns: an array containing all 9 elements of this tuple.
reverse(...) -> Tuple9<T9, T8, T7, T6, T5, T4, T3, T2, T1>
-
Signature:
public Tuple9<T9, T8, T7, T6, T5, T4, T3, T2, T1> reverse() - Summary: Returns a new Tuple9 with all elements in reverse order.
-
Parameters:
- (none)
- Returns: a new Tuple9 with elements in reverse order.
forEach(...) -> void
-
Signature:
@Override public <E extends Exception> void forEach(final Throwables.Consumer<?, E> consumer) throws E - Summary: Performs the given action for each element of this tuple in order.
-
Contract:
- The consumer must handle any type casting if needed.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code Tuple9<String, Integer, Double, Boolean, Character, Long, Float, Short, Byte> t = Tuple.of("A", 1, 2.0, true, 'X', 100L, 3.14f, (short)5, (byte)10); // Print each element t.forEach(System.out::println); // Collect elements into a list List<Object> list = new ArrayList<>(); t.forEach(list::add); // Count non-null elements AtomicInteger count = new AtomicInteger(); t.forEach(e -> { if (e != null) count.incrementAndGet(); }); } </pre>
-
Parameters:
-
consumer(Throwables.Consumer<?, E>) — the action to perform on each element, must not be null.
-
-
Throws:
-
E— if the consumer throws an exception.
-
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns a hash code value for this tuple.
-
Parameters:
- (none)
- Returns: the hash code value for this tuple.
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Compares this tuple to the specified object for equality.
-
Contract:
- <p> Two Tuple9 instances are considered equal if and only if all 9 corresponding elements are equal according to N.equals() (which handles {@code null} values correctly).
- The comparison is type-safe: the object must be exactly a Tuple9 instance.
-
Parameters:
-
obj(Object) — the object to compare with this tuple.
-
- Returns: {@code true} if the specified object is a Tuple9 with all elements equal to this tuple's elements.
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this tuple.
-
Parameters:
- (none)
- Returns: a string representation of this tuple in the format "(e1, e2, e3, e4, e5, e6, e7, e8, e9)".
Class TypeAttrParser (com.landawn.abacus.util.TypeAttrParser)
A parser for type attribute strings that extracts class names, generic type parameters, and constructor parameters from complex type declarations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
parse(...) -> TypeAttrParser
-
Signature:
public static TypeAttrParser parse(final String attr) - Summary: Parses a type attribute string into its component parts: class name, generic type parameters, and constructor parameters.
-
Parameters:
-
attr(String) — the type attribute string to parse
-
- Returns: a TypeAttrParser instance containing the parsed components
newInstance(...) -> T
-
Signature:
public static <T> T newInstance(Class<?> cls, final String attr, final Object... args) - Summary: Reflectively creates a new instance described by the type attribute plus explicit constructor arguments.
-
Contract:
- If no exact match exists and there are multiple constructor parameters from attr, a fallback tries replacing those parameters with a single String\[\] parameter.
-
Parameters:
-
cls(Class<?>) — the target class to instantiate, or {@code null} to derive from attr -
attr(String) — the type attribute string with optional generics and constructor params -
args(Object[]) — alternating pairs of Class and value (must be even length)
-
- Returns: a new instance of the specified class
Public Instance Methods
getClassName(...) -> String
-
Signature:
public String getClassName() - Summary: Returns the parsed class name without generic type parameters or constructor arguments.
-
Parameters:
- (none)
- Returns: the class name portion of the parsed type attribute
getTypeParameters(...) -> String\[\]
-
Signature:
public String[] getTypeParameters() - Summary: Returns the parsed generic type parameters as an array of strings.
-
Contract:
- Returns an empty array if no type parameters were present.
-
Parameters:
- (none)
- Returns: an array of generic type parameter strings, never null
getParameters(...) -> String\[\]
-
Signature:
public String[] getParameters() - Summary: Returns the parsed constructor parameters as an array of strings.
-
Contract:
- Returns an empty array if no constructor parameters were present.
-
Parameters:
- (none)
- Returns: an array of constructor parameter strings, never null
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this parser instance showing all parsed components.
-
Parameters:
- (none)
- Returns: a string representation of the parsed components
Class TypeReference (com.landawn.abacus.util.TypeReference)
A utility class for capturing and representing generic type information at runtime.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
javaType(...) -> java.lang.reflect.Type
-
Signature:
public java.lang.reflect.Type javaType() - Summary: Returns the raw {@link java.lang.reflect.Type} instance representing the captured generic type.
-
Contract:
- extends Number} ) </li> </ul> <p> This raw Type representation is particularly useful when working with reflection-based frameworks, serialization libraries, or any code that needs to introspect generic types at runtime.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Capture complex nested generic type TypeReference<List<Map<String, Integer>>> complexType = new TypeReference<List<Map<String, Integer>>>() {}; java.lang.reflect.Type type = complexType.getType(); // Use with serialization framework Object result = deserializer.deserialize(data, type); // Or inspect the type structure if (type instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) type; System.out.println("Raw type: " + pt.getRawType()); System.out.println("Type arguments: " + Arrays.toString(pt.getActualTypeArguments())); } } </pre>
-
Parameters:
- (none)
- Returns: the raw {@link java.lang.reflect.Type} instance representing the generic type T; never {@code null} (validated during construction).
- See also: #type(), ParameterizedType
type(...) -> Type<T>
-
Signature:
public Type<T> type() - Summary: Returns the {@link Type} instance representing the captured generic type.
-
Parameters:
- (none)
- Returns: the {@link Type} instance representing the generic type T; never {@code null} (validated during construction).
- See also: #javaType(), Type, TypeFactory
Class TypeToken (com.landawn.abacus.util.TypeReference.TypeToken)
An alternative abstract base class for capturing type information at runtime.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class URLEncodedUtil (com.landawn.abacus.util.URLEncodedUtil)
A comprehensive utility class providing high-performance, thread-safe methods for URL encoding and decoding operations, including query parameter encoding, form data processing, and URL component manipulation.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
encode(...) -> String
-
Signature:
public static String encode(final Object parameters) - Summary: Encodes the provided parameters into a URL-encoded query string using the default charset (UTF-8).
-
Contract:
- <p> This method accepts various parameter formats: <ul> <li> {@code Map<String, ?>} : Keys and values are encoded as name=value pairs </li> <li> JavaBean: Bean properties are encoded using camelCase naming </li> <li> {@code Object\[\]} : Pairs of name-value elements (must have even length) </li> <li> {@code String} : If contains "=", treated as encoded parameters; otherwise encoded as-is </li> </ul> Characters are percent-encoded according to application/x-www-form-urlencoded rules, where spaces become '+'.
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} .
-
- Returns: a URL-encoded query string (e.g., "name=John+Doe & age=30"); returns empty string if {@code parameters} is {@code null} .
- See also: #encode(Object, Charset), #encode(Object, Charset, NamingPolicy), URLEncoder#encode(String, String)
-
Signature:
public static String encode(final Object parameters, final Charset charset) - Summary: Encodes the provided parameters into a URL-encoded query string using the specified charset.
-
Contract:
- <p> This method accepts various parameter formats: <ul> <li> {@code Map<String, ?>} : Keys and values are encoded as name=value pairs </li> <li> JavaBean: Bean properties are encoded using camelCase naming (default) </li> <li> {@code Object\[\]} : Pairs of name-value elements (must have even length) </li> <li> {@code String} : If contains "=", treated as encoded parameters; otherwise encoded as-is </li> </ul> Characters are percent-encoded using the specified charset according to application/x-www-form-urlencoded rules.
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8.
-
- Returns: a URL-encoded query string; returns empty string if {@code parameters} is {@code null} .
- See also: #encode(Object), #encode(Object, Charset, NamingPolicy), URLEncoder#encode(String, Charset)
-
Signature:
public static String encode(final Object parameters, final Charset charset, final NamingPolicy namingPolicy) - Summary: Encodes the provided parameters into a URL-encoded query string using the specified charset and naming policy.
-
Contract:
- <p> This method accepts various parameter formats: <ul> <li> {@code Map<String, ?>} : Keys and values are encoded as name=value pairs (keys transformed by naming policy) </li> <li> JavaBean: Bean properties are encoded with names transformed according to the naming policy </li> <li> {@code Object\[\]} : Pairs of name-value elements (must have even length; names transformed by naming policy) </li> <li> {@code String} : If contains "=", treated as encoded parameters; otherwise encoded as-is </li> </ul> Characters are percent-encoded using the specified charset according to application/x-www-form-urlencoded rules.
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8. -
namingPolicy(NamingPolicy) — the naming policy to transform property/key names (e.g., CAMEL_CASE, SCREAMING_SNAKE_CASE); if {@code null} or NO_CHANGE, names are not transformed.
-
- Returns: a URL-encoded query string; returns empty string if {@code parameters} is {@code null} .
- See also: #encode(Object, Charset)
-
Signature:
public static String encode(final String url, final Object parameters) - Summary: Encodes parameters and appends them to a URL as a query string using the default charset (UTF-8).
-
Contract:
- If {@code parameters} is {@code null} or an empty Map, the original URL is returned unchanged.
-
Parameters:
-
url(String) — the base URL to which the query string will be appended (e.g., "http://example.com/path"). -
parameters(Object) — the parameters to encode and append (Map, bean, Object array pairs, or String); may be {@code null} .
-
- Returns: the URL with the encoded query string appended (e.g., "http://example.com/path?name=value"); returns the original URL if {@code parameters} is {@code null} or empty.
- See also: #encode(String, Object, Charset), #encode(Object)
-
Signature:
public static String encode(final String url, final Object parameters, final Charset charset) - Summary: Encodes parameters and appends them to a URL as a query string using the specified charset.
-
Contract:
- If {@code parameters} is {@code null} or an empty Map, the original URL is returned unchanged.
-
Parameters:
-
url(String) — the base URL to which the query string will be appended. -
parameters(Object) — the parameters to encode and append (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8.
-
- Returns: the URL with the encoded query string appended; returns the original URL if {@code parameters} is {@code null} or empty.
- See also: #encode(String, Object), #encode(String, Object, Charset, NamingPolicy)
-
Signature:
@SuppressWarnings("rawtypes") public static String encode(final String url, final Object parameters, final Charset charset, final NamingPolicy namingPolicy) - Summary: Encodes parameters and appends them to a URL as a query string using the specified charset and naming policy.
-
Contract:
- If {@code parameters} is {@code null} or an empty Map, the original URL is returned unchanged.
-
Parameters:
-
url(String) — the base URL to which the query string will be appended. -
parameters(Object) — the parameters to encode and append (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8. -
namingPolicy(NamingPolicy) — the naming policy to transform property/key names (e.g., CAMEL_CASE, SCREAMING_SNAKE_CASE); if {@code null} or NO_CHANGE, names are not transformed.
-
- Returns: the URL with the encoded query string appended; returns the original URL if {@code parameters} is {@code null} or empty.
- See also: #encode(String, Object, Charset)
-
Signature:
public static void encode(final Object parameters, final Appendable output) - Summary: Encodes the provided parameters into a URL-encoded query string and appends the result to an {@code Appendable} using the default charset (UTF-8).
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} . -
output(Appendable) — the {@code Appendable} (e.g., {@code StringBuilder} , {@code Writer} ) to which the encoded query string will be appended.
-
- See also: #encode(Object, Charset, Appendable)
-
Signature:
public static void encode(final Object parameters, final Charset charset, final Appendable output) - Summary: Encodes the provided parameters into a URL-encoded query string and appends the result to an {@code Appendable} using the specified charset.
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8. -
output(Appendable) — the {@code Appendable} to which the encoded query string will be appended.
-
- See also: #encode(Object, Charset, NamingPolicy, Appendable)
-
Signature:
@SuppressWarnings("rawtypes") public static void encode(final Object parameters, final Charset charset, final NamingPolicy namingPolicy, final Appendable output) throws UncheckedIOException - Summary: Encodes the provided parameters into a URL-encoded query string and appends the result to an {@code Appendable} using the specified charset and naming policy.
-
Contract:
- </p> <p> The method accepts various parameter formats: <ul> <li> {@code Map<String, ?>} : Keys and values are encoded as name=value pairs </li> <li> JavaBean: Bean properties are encoded with names transformed by the naming policy </li> <li> {@code Object\[\]} : Pairs of name-value elements (must have even length) </li> <li> {@code String} : If contains "=", treated as pre-encoded parameters; otherwise encoded as-is </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code class User { String firstName; int age; } StringBuilder sb = new StringBuilder(); URLEncodedUtil.encode(new User("John", 30), StandardCharsets.UTF_8, NamingPolicy.SNAKE_CASE, sb); // sb: "first_name=John&age=30" } </pre>
-
Parameters:
-
parameters(Object) — the parameters to encode (Map, bean, Object array pairs, or String); may be {@code null} . -
charset(Charset) — the charset to use for percent-encoding; if {@code null} , defaults to UTF-8. -
namingPolicy(NamingPolicy) — the naming policy to transform property/key names (e.g., CAMEL_CASE, SCREAMING_SNAKE_CASE); if {@code null} or NO_CHANGE, names are not transformed. -
output(Appendable) — the {@code Appendable} to which the encoded query string will be appended.
-
-
Throws:
-
com.landawn.abacus.exception.UncheckedIOException— if an I/O error occurs while appending to the output.
-
- See also: #encode(Object, Charset, Appendable)
decode(...) -> Map<String, String>
-
Signature:
public static Map<String, String> decode(final String urlQuery) - Summary: Decodes a URL-encoded query string into a {@code Map<String, String>} using the default charset (UTF-8).
-
Contract:
- If a parameter appears multiple times, only the last occurrence is retained (use {@link #decodeToMultimap(String)} to preserve all values).
-
Parameters:
-
urlQuery(String) — the URL query string to decode (e.g., "key1=value1 & key2=value2"), may be {@code null} or empty.
-
- Returns: a {@code LinkedHashMap} containing parameter names as keys and decoded parameter values as values; returns an empty map if {@code urlQuery} is {@code null} or empty.
- See also: #decode(String, Charset), #decodeToMultimap(String), URLDecoder#decode(String)
-
Signature:
public static Map<String, String> decode(final String urlQuery, final Charset charset) - Summary: Decodes a URL-encoded query string into a {@code Map<String, String>} using the specified charset.
-
Contract:
- If a parameter appears multiple times, only the last occurrence is retained.
-
Parameters:
-
urlQuery(String) — the URL query string to decode, may be {@code null} or empty. -
charset(Charset) — the charset to use for decoding percent-encoded characters; if {@code null} , defaults to UTF-8.
-
- Returns: a {@code LinkedHashMap} containing parameter names as keys and decoded parameter values as values; returns an empty map if {@code urlQuery} is {@code null} or empty.
- See also: #decode(String), #decode(String, Charset, Supplier), URLDecoder#decode(String, Charset)
-
Signature:
public static <M extends Map<String, String>> M decode(final String urlQuery, final Charset charset, final Supplier<M> mapSupplier) - Summary: Decodes a URL-encoded query string into a custom {@code Map} implementation using the specified charset and map supplier.
-
Contract:
- If a parameter appears multiple times, only the last occurrence is retained.
-
Parameters:
-
urlQuery(String) — the URL query string to decode, may be {@code null} or empty. -
charset(Charset) — the charset to use for decoding percent-encoded characters; if {@code null} , defaults to UTF-8. -
mapSupplier(Supplier<M>) — a supplier that provides an instance of the desired Map implementation.
-
- Returns: a Map of type M containing parameter names as keys and decoded parameter values as values; returns an empty map (from supplier) if {@code urlQuery} is {@code null} or empty.
- See also: #decode(String, Charset)
-
Signature:
public static <T> T decode(final String urlQuery, final Class<? extends T> targetType) - Summary: Decodes a URL-encoded query string into a bean or Map of the specified type using the default charset (UTF-8).
-
Parameters:
-
urlQuery(String) — the URL query string to decode, may be {@code null} or empty. -
targetType(Class<? extends T>) — the class of the bean or Map to create and populate.
-
- Returns: an instance of type T populated with the decoded parameter values; returns an empty instance if {@code urlQuery} is {@code null} or empty.
- See also: #decode(String, Charset, Class)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> T decode(final String urlQuery, final Charset charset, final Class<? extends T> targetType) - Summary: Decodes a URL-encoded query string into a bean or Map of the specified type using the specified charset.
-
Contract:
- </p> <p> If {@code targetType} is a Map class, this method delegates to {@link #decode(String, Charset, Supplier)} .
-
Parameters:
-
urlQuery(String) — the URL query string to decode, may be {@code null} or empty. -
charset(Charset) — the charset to use for decoding percent-encoded characters; if {@code null} , defaults to UTF-8. -
targetType(Class<? extends T>) — the class of the bean or Map to create and populate.
-
- Returns: an instance of type T populated with the decoded parameter values; returns an empty instance if {@code urlQuery} is {@code null} or empty.
- See also: #decode(String, Class)
decodeToMultimap(...) -> ListMultimap<String, String>
-
Signature:
public static ListMultimap<String, String> decodeToMultimap(final String urlQuery) - Summary: Decodes a URL-encoded query string into a {@code ListMultimap<String, String>} using the default charset (UTF-8).
-
Contract:
- Unlike {@link #decode(String)} , this method preserves all values when a parameter appears multiple times in the query string.
-
Parameters:
-
urlQuery(String) — the URL query string to decode (e.g., "color=red & color=blue & size=L"), may be {@code null} or empty.
-
- Returns: a {@code ListMultimap} containing parameter names as keys and lists of decoded parameter values; returns an empty multimap if {@code urlQuery} is {@code null} or empty.
- See also: #decodeToMultimap(String, Charset), #decode(String)
-
Signature:
public static ListMultimap<String, String> decodeToMultimap(final String urlQuery, final Charset charset) - Summary: Decodes a URL-encoded query string into a {@code ListMultimap<String, String>} using the specified charset.
-
Contract:
- Unlike {@link #decode(String, Charset)} , this method preserves all values when a parameter appears multiple times in the query string.
-
Parameters:
-
urlQuery(String) — the URL query string to decode, may be {@code null} or empty. -
charset(Charset) — the charset to use for decoding percent-encoded characters; if {@code null} , defaults to UTF-8.
-
- Returns: a {@code ListMultimap} containing parameter names as keys and lists of decoded parameter values; returns an empty multimap if {@code urlQuery} is {@code null} or empty.
- See also: #decodeToMultimap(String), #decode(String, Charset)
convertToBean(...) -> T
-
Signature:
public static <T> T convertToBean(final Map<String, String[]> parameters, final Class<? extends T> targetType) - Summary: Converts a parameter map (with String array values) into a bean of the specified type.
-
Contract:
- The keys in the map should correspond to bean property names (case-sensitive).
- If a property has multiple values and the target property type is {@code String\[\]} , all values are set.
- </p> <p> If a parameter value is {@code null} , empty, or contains only a single empty string, the property is set to its default value (as determined by the property type).
-
Parameters:
-
parameters(Map<String, String[]>) — the map of parameters to convert, where keys are property names and values are String arrays; may be {@code null} or empty. -
targetType(Class<? extends T>) — the class of the bean to create and populate.
-
- Returns: an instance of type T with properties populated from the parameter map; returns an empty instance if {@code parameters} is {@code null} or empty.
Public Instance Methods
- (none)
Enum UnifiedStatus (com.landawn.abacus.util.UnifiedStatus)
Enumeration representing various status states for entities, services, processes, and operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
fromCode(...) -> UnifiedStatus
-
Signature:
public static UnifiedStatus fromCode(final int code) - Summary: Returns the Status enum constant associated with the specified code.
-
Parameters:
-
code(int) — the numeric code to look up
-
- Returns: the Status associated with the code, or {@code null} if no Status exists for that code
- Performance: This method provides O(1) lookup performance for valid codes.
Public Instance Methods
code(...) -> int
-
Signature:
public int code() - Summary: Returns the numeric code associated with this status.
-
Parameters:
- (none)
- Returns: the numeric code for this status
Class Utf8 (com.landawn.abacus.util.Utf8)
Low-level, high-performance utility methods for working with UTF-8 character encoding.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
encodedLength(...) -> int
-
Signature:
public static int encodedLength(final CharSequence sequence) - Summary: Returns the number of bytes in the UTF-8-encoded form of the given character sequence.
-
Parameters:
-
sequence(CharSequence) — the character sequence to measure
-
- Returns: the number of bytes needed to encode the sequence in UTF-8
isWellFormed(...) -> boolean
-
Signature:
public static boolean isWellFormed(final byte[] bytes) - Summary: Returns {@code true} if the given byte array is a well-formed UTF-8 byte sequence according to Unicode 6.0 standards.
-
Contract:
- Returns {@code true} if the given byte array is a well-formed UTF-8 byte sequence according to Unicode 6.0 standards.
- <p> The validation checks for: </p> <ul> <li> Proper continuation byte sequences </li> <li> No overlong encodings (non-shortest form) </li> <li> No invalid surrogate code points </li> <li> Valid Unicode code point ranges </li> </ul> <p> This method returns {@code true} if and only if {@code Arrays.equals(bytes, new String(bytes, UTF_8).getBytes(UTF_8))} would return {@code true} , but is more efficient in both time and space.
-
Parameters:
-
bytes(byte[]) — the byte array to validate
-
- Returns: {@code true} if the bytes form a valid UTF-8 sequence, {@code false} otherwise
-
Signature:
public static boolean isWellFormed(final byte[] bytes, final int off, final int len) throws IndexOutOfBoundsException - Summary: Returns whether the given byte array slice is a well-formed UTF-8 byte sequence, as defined by {@link #isWellFormed(byte\[\])} .
-
Contract:
- Note that this can return {@code false} even when {@code isWellFormed(bytes)} would return {@code true} if the slice boundaries split a multi-byte character.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code byte\[\] buffer = new byte\[1024\]; int bytesRead = inputStream.read(buffer); if (Utf8.isWellFormed(buffer, 0, bytesRead)) { String text = new String(buffer, 0, bytesRead, StandardCharsets.UTF_8); } } </pre>
-
Parameters:
-
bytes(byte[]) — the input buffer containing the bytes to validate -
off(int) — the offset in the buffer of the first byte to validate -
len(int) — the number of bytes to validate from the buffer
-
- Returns: {@code true} if the specified byte range forms a valid UTF-8 sequence
-
Throws:
-
java.lang.IndexOutOfBoundsException— if offset and length are out of bounds
-
Public Instance Methods
- (none)
Class WD (com.landawn.abacus.util.WD)
A utility class that provides a comprehensive dictionary of commonly used characters and strings, including special characters, operators, SQL keywords, and mathematical functions.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class WSSecurityUtil (com.landawn.abacus.util.WSSecurityUtil)
WS-Security utility methods for cryptographic operations commonly used in web service security.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
generateNonce(...) -> byte\[\]
-
Signature:
public static byte[] generateNonce(final int length) - Summary: Generates a cryptographically secure nonce (number used once) of the specified length using the SHA1PRNG algorithm.
-
Parameters:
-
length(int) — the length of the nonce to be generated in bytes, must be positive
-
- Returns: a byte array containing cryptographically secure random bytes of the specified length
generateDigest(...) -> byte\[\]
-
Signature:
public static byte[] generateDigest(final byte[] inputBytes) - Summary: Generates a SHA-1 digest (hash) of the input bytes.
-
Parameters:
-
inputBytes(byte[]) — the bytes to be digested, must not be null
-
- Returns: a byte array containing the SHA-1 hash of the input bytes (always 20 bytes)
computePasswordDigest(...) -> String
-
Signature:
public static String computePasswordDigest(final byte[] nonce, final byte[] created, final byte[] password) - Summary: Creates a WS-Security compliant password digest by computing the SHA-1 hash of the concatenated nonce, created timestamp, and password, then encoding the result in Base64 format.
-
Contract:
- This order is defined by the WS-Security specification and must be strictly followed for interoperability.
-
Parameters:
-
nonce(byte[]) — the nonce byte array, a cryptographically random value that should only be used once, must not be null -
created(byte[]) — the created timestamp byte array, typically the current timestamp in ISO 8601 format, must not be null -
password(byte[]) — the password byte array to be digested, must not be null
-
- Returns: a Base64-encoded string of the SHA-1 hash of the concatenated inputs
- See also: #computePasswordDigest(String, String, String), #generateNonce(int), #generateDigest(byte\[\])
-
Signature:
public static String computePasswordDigest(final String nonce, final String created, final String password) - Summary: Creates a WS-Security compliant password digest using string inputs.
-
Contract:
- Both parties (client and server) must use the same charset for the digest to match.
-
Parameters:
-
nonce(String) — the nonce string, a cryptographically random value that should only be used once, must not be null -
created(String) — the created timestamp string, typically the current timestamp in ISO 8601 format, must not be null -
password(String) — the password string to be digested, must not be null
-
- Returns: a Base64-encoded string of the SHA-1 hash of the concatenated inputs
- See also: #computePasswordDigest(byte\[\], byte\[\], byte\[\]), #generateNonce(int), #generateDigest(byte\[\])
Public Instance Methods
- (none)
Enum WeekDay (com.landawn.abacus.util.WeekDay)
An enumeration representing the days of the week.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> WeekDay
-
Signature:
public static WeekDay valueOf(final int intValue) - Summary: Returns the WeekDay enum constant corresponding to the specified integer value.
-
Parameters:
-
intValue(int) — the integer value to convert (must be 0-6)
-
- Returns: the WeekDay enum constant corresponding to the integer value
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this weekday.
-
Parameters:
- (none)
- Returns: the integer value of this weekday (0-6)
Class WindowAssigner (com.landawn.abacus.util.WindowAssigner)
An abstract class that defines how elements in a stream should be assigned to windows.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Wrapper (com.landawn.abacus.util.Wrapper)
An immutable wrapper class that provides custom hashCode and equals implementations for wrapped objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> Wrapper<T>
-
Signature:
public static <T> Wrapper<T> of(final T array) - Summary: Creates a new Wrapper instance for the given array with deep equality semantics.
-
Contract:
- The wrapped array should not be modified after wrapping to ensure consistent hash codes.
-
Parameters:
-
array(T) — the array to be wrapped; can be any array type (primitive or object arrays), or {@code null} .
-
- Returns: a Wrapper instance for the given array with deep equality semantics.
-
Signature:
public static <T> Wrapper<T> of(final T value, final ToIntFunction<? super T> hashFunction, final BiPredicate<? super T, ? super T> equalsFunction) throws IllegalArgumentException - Summary: Creates a new Wrapper instance with custom hash and equals functions.
-
Contract:
- This method is useful when the wrapped value's natural hashCode and equals methods are not suitable for use in collections, or when you need to define custom equality semantics based on specific fields or computed values.
-
Parameters:
-
value(T) — the value to be wrapped; can be {@code null} . -
hashFunction(ToIntFunction<? super T>) — the function to calculate the hash code of the wrapped value; must not be {@code null} . -
equalsFunction(BiPredicate<? super T, ? super T>) — the function to compare the wrapped value with other objects; must not be {@code null} .
-
- Returns: a Wrapper instance with the specified custom hash and equals behavior.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code hashFunction} or {@code equalsFunction} is {@code null} .
-
-
Signature:
public static <T> Wrapper<T> of(final T value, final ToIntFunction<? super T> hashFunction, final BiPredicate<? super T, ? super T> equalsFunction, final Function<? super T, String> toStringFunction) throws IllegalArgumentException - Summary: Creates a new Wrapper instance with custom hash, equals, and toString functions.
-
Parameters:
-
value(T) — the value to be wrapped; can be {@code null} . -
hashFunction(ToIntFunction<? super T>) — the function to calculate the hash code of the wrapped value; must not be {@code null} . -
equalsFunction(BiPredicate<? super T, ? super T>) — the function to compare the wrapped value with other objects; must not be {@code null} . -
toStringFunction(Function<? super T, String>) — the function to generate string representation of the wrapped value; must not be {@code null} .
-
- Returns: a Wrapper instance with the specified custom hash, equals, and toString behavior.
-
Throws:
-
java.lang.IllegalArgumentException— if any of the function parameters ( {@code hashFunction} , {@code equalsFunction} , or {@code toStringFunction} ) is {@code null} .
-
Public Instance Methods
value(...) -> T
-
Signature:
public T value() - Summary: Returns the wrapped value.
-
Contract:
- Modifications to the returned value (if mutable) will affect the wrapper's behavior in collections if the modifications change the hash code or equality semantics.
-
Parameters:
- (none)
- Returns: the wrapped value, which may be {@code null} if a {@code null} value was wrapped.
hashCode(...) -> int
-
Signature:
@Override public abstract int hashCode() - Summary: Returns the hash code of the wrapped value.
-
Parameters:
- (none)
- Returns: the hash code of the wrapped value.
equals(...) -> boolean
-
Signature:
@Override public abstract boolean equals(final Object obj) - Summary: Compares this wrapper with another object for equality.
-
Contract:
- Two wrappers are equal if they wrap equal values according to: <ul> <li> For arrays: deep equality comparison via {@link N#deepEquals(Object, Object)} </li> <li> For custom wrappers: the provided equals function </li> </ul> <p> This method provides value-based equality instead of reference equality, making wrapped objects behave correctly in collections.
-
Parameters:
-
obj(Object) — the object to compare with.
-
- Returns: {@code true} if the objects are equal, {@code false} otherwise.
Class XmlMappers (com.landawn.abacus.util.XmlMappers)
A high-performance utility class for XML serialization and deserialization based on Jackson's {@code XmlMapper} .
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
toXml(...) -> String
-
Signature:
public static String toXml(final Object obj) - Summary: Serializes the specified object to an XML string using default configuration.
-
Parameters:
-
obj(Object) — the object to serialize
-
- Returns: the XML string representation of the object
-
Signature:
public static String toXml(final Object obj, final boolean prettyFormat) - Summary: Serializes the specified object to an XML string with optional pretty formatting.
-
Contract:
- When pretty format is enabled, the output XML will be indented for better readability.
-
Parameters:
-
obj(Object) — the object to serialize -
prettyFormat(boolean) — {@code true} to enable pretty printing with indentation, {@code false} for compact output
-
- Returns: the XML string representation of the object
-
Signature:
public static String toXml(final Object obj, final SerializationFeature first, final SerializationFeature... features) - Summary: Serializes the specified object to an XML string with custom serialization features.
-
Parameters:
-
obj(Object) — the object to serialize -
first(SerializationFeature) — the first serialization feature to enable -
features(SerializationFeature[]) — additional serialization features to enable
-
- Returns: the XML string representation of the object
-
Signature:
public static String toXml(final Object obj, final SerializationConfig config) - Summary: Serializes the specified object to an XML string using a custom serialization configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
config(SerializationConfig) — the serialization configuration to use
-
- Returns: the XML string representation of the object
-
Signature:
public static void toXml(final Object obj, final File output) - Summary: Serializes the specified object to an XML file using default configuration.
-
Contract:
- The file will be created if it doesn't exist, or overwritten if it does.
-
Parameters:
-
obj(Object) — the object to serialize -
output(File) — the output file to write the XML to
-
-
Signature:
public static void toXml(final Object obj, final File output, final SerializationConfig config) - Summary: Serializes the specified object to an XML file using a custom serialization configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(File) — the output file to write the XML to -
config(SerializationConfig) — the serialization configuration to use
-
-
Signature:
public static void toXml(final Object obj, final OutputStream output) - Summary: Serializes the specified object to an XML output stream using default configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(OutputStream) — the output stream to write the XML to
-
-
Signature:
public static void toXml(final Object obj, final OutputStream output, final SerializationConfig config) - Summary: Serializes the specified object to an XML output stream using a custom serialization configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(OutputStream) — the output stream to write the XML to -
config(SerializationConfig) — the serialization configuration to use
-
-
Signature:
public static void toXml(final Object obj, final Writer output) - Summary: Serializes the specified object to an XML writer using default configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(Writer) — the writer to write the XML to
-
-
Signature:
public static void toXml(final Object obj, final Writer output, final SerializationConfig config) - Summary: Serializes the specified object to an XML writer using a custom serialization configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(Writer) — the writer to write the XML to -
config(SerializationConfig) — the serialization configuration to use
-
-
Signature:
public static void toXml(final Object obj, final DataOutput output) - Summary: Serializes the specified object to a DataOutput using default configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(DataOutput) — the DataOutput to write the XML to
-
-
Signature:
public static void toXml(final Object obj, final DataOutput output, final SerializationConfig config) - Summary: Serializes the specified object to a DataOutput using a custom serialization configuration.
-
Parameters:
-
obj(Object) — the object to serialize -
output(DataOutput) — the DataOutput to write the XML to -
config(SerializationConfig) — the serialization configuration to use
-
fromXml(...) -> T
-
Signature:
public static <T> T fromXml(final byte[] xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a byte array into an object of the specified type.
-
Parameters:
-
xml(byte[]) — the XML byte array to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final byte[] xml, final int offset, final int len, final Class<? extends T> targetType) - Summary: Deserializes XML from a portion of a byte array into an object of the specified type.
-
Parameters:
-
xml(byte[]) — the XML byte array containing the data -
offset(int) — the start offset in the array -
len(int) — the number of bytes to read -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final Class<? extends T> targetType) - Summary: Deserializes an XML string into an object of the specified type.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final Class<? extends T> targetType, final DeserializationFeature first, final DeserializationFeature... features) - Summary: Deserializes an XML string into an object of the specified type with custom deserialization features.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to -
first(DeserializationFeature) — the first deserialization feature to enable -
features(DeserializationFeature[]) — additional deserialization features to enable
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes an XML string into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a file into an object of the specified type.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a file into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final Class<? extends T> targetType) - Summary: Deserializes XML from an input stream into an object of the specified type.
-
Parameters:
-
xml(InputStream) — the input stream containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from an input stream into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(InputStream) — the input stream containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a reader into an object of the specified type.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a reader into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromXml(final URL xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a URL into an object of the specified type.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromXml(final URL xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a URL into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final DataInput xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a DataInput into an object of the specified type.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final DataInput xml, final Class<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a DataInput into an object of the specified type using a custom deserialization configuration.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final byte[] xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a byte array into an object of the specified generic type.
-
Contract:
- Use this method when deserializing generic types like List < String > or Map < String, Object > .
-
Parameters:
-
xml(byte[]) — the XML byte array to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final byte[] xml, final int offset, final int len, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a portion of a byte array into an object of the specified generic type.
-
Parameters:
-
xml(byte[]) — the XML byte array containing the data -
offset(int) — the start offset in the array -
len(int) — the number of bytes to read -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final TypeReference<? extends T> targetType) - Summary: Deserializes an XML string into an object of the specified generic type.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final TypeReference<? extends T> targetType, final DeserializationFeature first, final DeserializationFeature... features) - Summary: Deserializes an XML string into an object of the specified generic type with custom deserialization features.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type -
first(DeserializationFeature) — the first deserialization feature to enable -
features(DeserializationFeature[]) — additional deserialization features to enable
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final String xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes an XML string into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map} -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a file into an object of the specified generic type.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final File xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a file into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map} -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from an input stream into an object of the specified generic type.
-
Parameters:
-
xml(InputStream) — the input stream containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final InputStream xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from an input stream into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(InputStream) — the input stream containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map} -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a reader into an object of the specified generic type.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final Reader xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a reader into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map} -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromXml(final URL xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a URL into an object of the specified generic type.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public static <T> T fromXml(final URL xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a URL into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final DataInput xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a DataInput into an object of the specified generic type.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public static <T> T fromXml(final DataInput xml, final TypeReference<? extends T> targetType, final DeserializationConfig config) - Summary: Deserializes XML from a DataInput into an object of the specified generic type using a custom deserialization configuration.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type -
config(DeserializationConfig) — the deserialization configuration to use
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
createSerializationConfig(...) -> SerializationConfig
-
Signature:
public static SerializationConfig createSerializationConfig() - Summary: Creates a new SerializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new SerializationConfig instance
createDeserializationConfig(...) -> DeserializationConfig
-
Signature:
public static DeserializationConfig createDeserializationConfig() - Summary: Creates a new DeserializationConfig instance with default settings.
-
Parameters:
- (none)
- Returns: a new DeserializationConfig instance
wrap(...) -> One
-
Signature:
public static One wrap(final XmlMapper xmlMapper) - Summary: Wraps an XmlMapper instance to provide convenient serialization and deserialization methods.
-
Parameters:
-
xmlMapper(XmlMapper) — the XmlMapper instance to wrap
-
- Returns: a One instance wrapping the provided XmlMapper
Public Instance Methods
- (none)
Class One (com.landawn.abacus.util.XmlMappers.One)
A wrapper class that provides convenient instance methods for XML serialization and deserialization using a specific XmlMapper instance.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
toXml(...) -> String
-
Signature:
public String toXml(final Object obj) - Summary: Serializes the specified object to an XML string using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize
-
- Returns: the XML string representation of the object
-
Signature:
public String toXml(final Object obj, final boolean prettyFormat) - Summary: Serializes the specified object to an XML string with optional pretty formatting using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize -
prettyFormat(boolean) — {@code true} to enable pretty printing with indentation
-
- Returns: the XML string representation of the object
-
Signature:
public void toXml(final Object obj, final File output) - Summary: Serializes the specified object to an XML file using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize -
output(File) — the output file to write the XML to
-
-
Signature:
public void toXml(final Object obj, final OutputStream output) - Summary: Serializes the specified object to an output stream using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize -
output(OutputStream) — the output stream to write the XML to
-
-
Signature:
public void toXml(final Object obj, final Writer output) - Summary: Serializes the specified object to a writer using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize -
output(Writer) — the writer to write the XML to
-
-
Signature:
public void toXml(final Object obj, final DataOutput output) - Summary: Serializes the specified object to a DataOutput using the wrapped XmlMapper.
-
Parameters:
-
obj(Object) — the object to serialize -
output(DataOutput) — the DataOutput to write the XML to
-
fromXml(...) -> T
-
Signature:
public <T> T fromXml(final byte[] xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a byte array into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(byte[]) — the XML byte array to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final byte[] xml, final int offset, final int len, final Class<? extends T> targetType) - Summary: Deserializes XML from a portion of a byte array into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(byte[]) — the XML byte array containing the data -
offset(int) — the start offset in the array -
len(int) — the number of bytes to read -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final String xml, final Class<? extends T> targetType) - Summary: Deserializes an XML string into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final File xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a file into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final InputStream xml, final Class<? extends T> targetType) - Summary: Deserializes XML from an input stream into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(InputStream) — the input stream containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final Reader xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a reader into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public <T> T fromXml(final URL xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a URL into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final DataInput xml, final Class<? extends T> targetType) - Summary: Deserializes XML from a DataInput into an object of the specified type using the wrapped XmlMapper.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(Class<? extends T>) — the class of the object to deserialize to
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final byte[] xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a byte array into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(byte[]) — the XML byte array to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final byte[] xml, final int offset, final int len, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a portion of a byte array into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(byte[]) — the XML byte array containing the data -
offset(int) — the start offset in the array -
len(int) — the number of bytes to read -
targetType(TypeReference<? extends T>) — the type reference describing the target type
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final String xml, final TypeReference<? extends T> targetType) - Summary: Deserializes an XML string into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(String) — the XML string to deserialize -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final File xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a file into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(File) — the XML file to read from -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final InputStream xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from an input stream into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(InputStream) — the InputStream containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final Reader xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a reader into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(Reader) — the reader containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
@SuppressWarnings("deprecation") public <T> T fromXml(final URL xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a URL into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(URL) — the URL pointing to XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
-
Signature:
public <T> T fromXml(final DataInput xml, final TypeReference<? extends T> targetType) - Summary: Deserializes XML from a DataInput into an object of the specified generic type using the wrapped XmlMapper.
-
Parameters:
-
xml(DataInput) — the DataInput containing XML data -
targetType(TypeReference<? extends T>) — the type reference describing the target type, can be the {@code Type} of {@code Bean/Array/Collection/Map}
-
- Returns: the deserialized object
- See also: com.fasterxml.jackson.core.type.TypeReference
Class XmlUtil (com.landawn.abacus.util.XmlUtil)
A comprehensive utility class providing various XML processing capabilities including JAXB marshalling/unmarshalling, DOM manipulation, SAX parsing, StAX processing, and XML transformation operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
marshal(...) -> String
-
Signature:
public static String marshal(final Object jaxbBean) - Summary: Marshals the given JAXB bean into an XML string.
-
Parameters:
-
jaxbBean(Object) — The JAXB-annotated bean to be marshaled
-
- Returns: The XML string representation of the JAXB bean
- See also: JAXBContext#newInstance(Class...), Marshaller#marshal(Object, java.io.OutputStream)
unmarshal(...) -> T
-
Signature:
@SuppressWarnings("unchecked") public static <T> T unmarshal(final Class<? extends T> cls, final String xml) - Summary: Unmarshal the given XML string into an object of the specified class.
-
Parameters:
-
cls(Class<? extends T>) — The class of the object to be returned (must be JAXB-annotated) -
xml(String) — The XML string to be unmarshalled
-
- Returns: The unmarshalled object of the specified class
- See also: JAXBContext#newInstance(Class...), Unmarshaller#unmarshal(Reader)
createMarshaller(...) -> Marshaller
-
Signature:
public static Marshaller createMarshaller(final String contextPath) - Summary: Creates a JAXB Marshaller for the given context path.
-
Parameters:
-
contextPath(String) — The context path for which to create the Marshaller (package names separated by ':')
-
- Returns: The created Marshaller
- See also: JAXBContext#newInstance(String), JAXBContext#createMarshaller()
-
Signature:
public static Marshaller createMarshaller(final Class<?> cls) - Summary: Creates a JAXB Marshaller for the given class.
-
Parameters:
-
cls(Class<?>) — The class for which to create the Marshaller (must be JAXB-annotated)
-
- Returns: The created Marshaller
- See also: JAXBContext#newInstance(Class...), JAXBContext#createMarshaller()
createUnmarshaller(...) -> Unmarshaller
-
Signature:
public static Unmarshaller createUnmarshaller(final String contextPath) - Summary: Creates a JAXB Unmarshaller for the given context path.
-
Parameters:
-
contextPath(String) — The context path for which to create the Unmarshaller (package names separated by ':')
-
- Returns: The created Unmarshaller
- See also: JAXBContext#newInstance(String), JAXBContext#createUnmarshaller()
-
Signature:
public static Unmarshaller createUnmarshaller(final Class<?> cls) - Summary: Creates a JAXB Unmarshaller for the given class.
-
Parameters:
-
cls(Class<?>) — The class for which to create the Unmarshaller (must be JAXB-annotated)
-
- Returns: The created Unmarshaller
- See also: JAXBContext#newInstance(Class...), JAXBContext#createUnmarshaller()
createDOMParser(...) -> DocumentBuilder
-
Signature:
public static DocumentBuilder createDOMParser() - Summary: Creates a new instance of {@code DocumentBuilder} with default configuration.
-
Parameters:
- (none)
- Returns: A new instance of {@code DocumentBuilder}
- See also: DocumentBuilderFactory#newDocumentBuilder()
-
Signature:
public static DocumentBuilder createDOMParser(final boolean ignoreComments, final boolean ignoringElementContentWhitespace) - Summary: Creates a new instance of {@code DocumentBuilder} with the specified configuration.
-
Parameters:
-
ignoreComments(boolean) — Whether to ignore comments in the XML -
ignoringElementContentWhitespace(boolean) — Whether to ignore whitespace in element content
-
- Returns: A new instance of {@code DocumentBuilder} with the specified configuration
- See also: DocumentBuilderFactory#newDocumentBuilder()
createContentParser(...) -> DocumentBuilder
-
Signature:
public static DocumentBuilder createContentParser() - Summary: Creates a new instance of {@code DocumentBuilder} optimized for parsing content.
-
Contract:
- <p> Important: Call {@link #recycleContentParser(DocumentBuilder)} when done to return the parser to the pool.
-
Parameters:
- (none)
- Returns: A {@code DocumentBuilder} instance from the pool or newly created
recycleContentParser(...) -> void
-
Signature:
public static void recycleContentParser(final DocumentBuilder docBuilder) - Summary: Recycles the given DocumentBuilder instance by resetting it and adding it back to the pool.
-
Contract:
- This method should be called after using a DocumentBuilder obtained from {@link #createContentParser()} .
-
Parameters:
-
docBuilder(DocumentBuilder) — The DocumentBuilder instance to be recycled (can be null)
-
createSAXParser(...) -> SAXParser
-
Signature:
public static SAXParser createSAXParser() - Summary: Creates a new instance of {@code SAXParser} from a pool or creates a new one if the pool is empty.
-
Contract:
- Creates a new instance of {@code SAXParser} from a pool or creates a new one if the pool is empty.
- <p> Important: Call {@link #recycleSAXParser(SAXParser)} when done to return the parser to the pool.
-
Parameters:
- (none)
- Returns: A new instance of {@code SAXParser}
- See also: SAXParserFactory#newSAXParser()
recycleSAXParser(...) -> void
-
Signature:
public static void recycleSAXParser(final SAXParser saxParser) - Summary: Recycles the given SAXParser instance by resetting it and adding it back to the pool.
-
Contract:
- This method should be called after using a SAXParser obtained from {@link #createSAXParser()} .
-
Parameters:
-
saxParser(SAXParser) — The SAXParser instance to be recycled (can be null)
-
createXMLStreamReader(...) -> XMLStreamReader
-
Signature:
public static XMLStreamReader createXMLStreamReader(final Reader source) - Summary: Creates an XMLStreamReader from the given Reader source.
-
Parameters:
-
source(Reader) — The Reader source from which to create the XMLStreamReader
-
- Returns: The created XMLStreamReader
- See also: XMLInputFactory#createXMLStreamReader(Reader)
-
Signature:
public static XMLStreamReader createXMLStreamReader(final InputStream source) - Summary: Creates an XMLStreamReader from the given InputStream source.
-
Parameters:
-
source(InputStream) — The InputStream source from which to create the XMLStreamReader
-
- Returns: The created XMLStreamReader
- See also: XMLInputFactory#createXMLStreamReader(InputStream)
-
Signature:
public static XMLStreamReader createXMLStreamReader(final InputStream source, final String encoding) - Summary: Creates an XMLStreamReader from the given InputStream source with the specified encoding.
-
Parameters:
-
source(InputStream) — The InputStream source from which to create the XMLStreamReader -
encoding(String) — The character encoding to be used (e.g., "UTF-8", "ISO-8859-1")
-
- Returns: The created XMLStreamReader
- See also: XMLInputFactory#createXMLStreamReader(InputStream, String)
createFilteredStreamReader(...) -> XMLStreamReader
-
Signature:
public static XMLStreamReader createFilteredStreamReader(final XMLStreamReader source, final StreamFilter filter) - Summary: Creates a filtered XMLStreamReader from the given source XMLStreamReader and StreamFilter.
-
Parameters:
-
source(XMLStreamReader) — The source XMLStreamReader to be filtered -
filter(StreamFilter) — The StreamFilter to apply to the source
-
- Returns: The filtered XMLStreamReader
- See also: XMLInputFactory#createFilteredReader(XMLStreamReader, StreamFilter)
createXMLStreamWriter(...) -> XMLStreamWriter
-
Signature:
public static XMLStreamWriter createXMLStreamWriter(final Writer output) - Summary: Creates an XMLStreamWriter from the given Writer output.
-
Parameters:
-
output(Writer) — The Writer output to which the XMLStreamWriter will write
-
- Returns: The created XMLStreamWriter
- See also: XMLOutputFactory#createXMLStreamWriter(Writer)
-
Signature:
public static XMLStreamWriter createXMLStreamWriter(final OutputStream output) - Summary: Creates an XMLStreamWriter from the given OutputStream.
-
Parameters:
-
output(OutputStream) — The OutputStream to which the XMLStreamWriter will write
-
- Returns: The created XMLStreamWriter
- See also: XMLOutputFactory#createXMLStreamWriter(OutputStream)
-
Signature:
public static XMLStreamWriter createXMLStreamWriter(final OutputStream output, final String encoding) - Summary: Creates an XMLStreamWriter from the given OutputStream with the specified encoding.
-
Parameters:
-
output(OutputStream) — The OutputStream to which the XMLStreamWriter will write -
encoding(String) — The character encoding to be used (e.g., "UTF-8", "ISO-8859-1")
-
- Returns: The created XMLStreamWriter
- See also: XMLOutputFactory#createXMLStreamWriter(OutputStream, String)
createXMLTransformer(...) -> Transformer
-
Signature:
public static Transformer createXMLTransformer() - Summary: Creates a new instance of Transformer for XML transformation operations.
-
Parameters:
- (none)
- Returns: A new instance of Transformer
- See also: TransformerFactory#newTransformer()
transform(...) -> void
-
Signature:
public static void transform(final Document source, File output) - Summary: Transforms the given XML Document to the specified output file.
-
Contract:
- The file will be created if it doesn't exist, or overwritten if it does.
-
Parameters:
-
source(Document) — The XML Document to be transformed -
output(File) — The output file where the transformed XML will be written
-
- See also: Transformer#transform(Source, Result)
-
Signature:
public static void transform(final Document source, final OutputStream output) - Summary: Transforms the given XML Document to the specified OutputStream.
-
Parameters:
-
source(Document) — The XML Document to be transformed -
output(OutputStream) — The OutputStream where the transformed XML will be written
-
- See also: Transformer#transform(Source, Result)
-
Signature:
public static void transform(final Document source, final Writer output) - Summary: Transforms the given XML Document to the specified Writer.
-
Parameters:
-
source(Document) — The XML Document to be transformed -
output(Writer) — The Writer where the transformed XML will be written
-
- See also: Transformer#transform(Source, Result)
xmlEncode(...) -> String
-
Signature:
public static String xmlEncode(final Object bean) - Summary: Encodes the given bean object into an XML string using Java's XMLEncoder.
-
Parameters:
-
bean(Object) — The object to be encoded into XML
-
- Returns: The XML string representation of the given object
- See also: XMLEncoder#writeObject(Object)
xmlDecode(...) -> T
-
Signature:
public static <T> T xmlDecode(final String xml) - Summary: Decodes the given XML string into an object using Java's XMLDecoder.
-
Contract:
- This method is the counterpart to {@link #xmlEncode(Object)} and should be used to decode XML created by XMLEncoder.
- The XML format must be compatible with Java's XMLEncoder output.
-
Parameters:
-
xml(String) — The XML string to be decoded
-
- Returns: The decoded object
- See also: XMLDecoder#readObject()
getElementsByTagName(...) -> List<Element>
-
Signature:
public static List<Element> getElementsByTagName(final Element node, final String tagName) - Summary: Gets all direct child elements with the specified tag name from the given parent element.
-
Parameters:
-
node(Element) — The parent element to search within -
tagName(String) — The tag name of the elements to find
-
- Returns: A list of elements with the specified tag name that are direct children of the given node
getNodesByName(...) -> List<Node>
-
Signature:
public static List<Node> getNodesByName(final Node node, final String nodeName) - Summary: Gets all nodes with the specified name from the given node and its descendants.
-
Parameters:
-
node(Node) — The parent node to search within -
nodeName(String) — The name of the nodes to find
-
- Returns: A list of all nodes with the specified name
getNextNodeByName(...) -> Node
-
Signature:
@MayReturnNull public static Node getNextNodeByName(final Node node, final String nodeName) - Summary: Gets the first node with the specified name from the given node or its descendants.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Document doc = parser.parse(xmlFile); Node firstPriceNode = XmlUtil.getNextNodeByName(doc, "price"); if (firstPriceNode != null) { System.out.println("Price: " + firstPriceNode.getTextContent()); } } </pre>
-
Parameters:
-
node(Node) — The parent node to search within -
nodeName(String) — The name of the node to find
-
- Returns: The first node with the specified name, or {@code null} if no such node is found
getAttribute(...) -> String
-
Signature:
@MayReturnNull public static String getAttribute(final Node node, final String attrName) - Summary: Gets the attribute value of the specified attribute name from the given XML node.
-
Parameters:
-
node(Node) — The XML node from which to get the attribute -
attrName(String) — The name of the attribute to retrieve
-
- Returns: The value of the specified attribute, or {@code null} if the attribute does not exist
readAttributes(...) -> Map<String, String>
-
Signature:
public static Map<String, String> readAttributes(final Node node) - Summary: Reads all attributes of the given XML node and returns them as a map.
-
Parameters:
-
node(Node) — The XML node from which to read the attributes
-
- Returns: A map containing the attributes of the given node, where keys are attribute names and values are attribute values
readElement(...) -> Map<String, String>
-
Signature:
public static Map<String, String> readElement(final Element element) - Summary: Reads the given XML element and returns its attributes and text content as a map.
-
Parameters:
-
element(Element) — The XML element to be read
-
- Returns: A map containing the attributes and text content of the given element and its descendants
isTextElement(...) -> boolean
-
Signature:
public static boolean isTextElement(final Node node) - Summary: Checks if the given node is a text element.
-
Contract:
- Checks if the given node is a text element.
-
Parameters:
-
node(Node) — The node to be checked
-
- Returns: {@code true} if the node is a text element, {@code false} otherwise
getTextContent(...) -> String
-
Signature:
public static String getTextContent(final Node node) - Summary: Gets the text content of the given XML node.
-
Parameters:
-
node(Node) — The XML node from which to get the text content
-
- Returns: The text content of the specified node
-
Signature:
public static String getTextContent(final Node node, final boolean ignoreWhiteChar) - Summary: Gets the text content of the given XML node, optionally processing whitespace characters.
-
Contract:
- When ignoreWhiteChar is {@code true} , all whitespace characters (tabs, newlines, etc.) within the text content are normalized to single spaces, and leading/trailing spaces are removed.
-
Parameters:
-
node(Node) — The XML node from which to get the text content -
ignoreWhiteChar(boolean) — Whether to normalize whitespace characters in the text content
-
- Returns: The text content of the specified node, with whitespace processed if requested
writeCharacters(...) -> void
-
Signature:
public static void writeCharacters(final char[] cbuf, final StringBuilder output) throws IOException - Summary: Writes XML-escaped characters from the specified character array to the given StringBuilder.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
output(StringBuilder) — The StringBuilder to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final char[] cbuf, final int off, final int len, final StringBuilder output) throws IOException - Summary: Writes XML-escaped characters from a portion of a character array to the given StringBuilder.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
off(int) — The start offset in the character array -
len(int) — The number of characters to write -
output(StringBuilder) — The StringBuilder to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(String str, final StringBuilder output) throws IOException - Summary: Writes XML-escaped characters from the specified string to the given StringBuilder.
-
Contract:
- If the string is {@code null} , the text "null" is written.
-
Parameters:
-
str(String) — The string containing the characters to be written -
output(StringBuilder) — The StringBuilder to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final String str, final int off, final int len, final StringBuilder output) throws IOException - Summary: Writes XML-escaped characters from a portion of a string to the given StringBuilder.
-
Parameters:
-
str(String) — The string containing the characters to be written -
off(int) — The start offset in the string -
len(int) — The number of characters to write -
output(StringBuilder) — The StringBuilder to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final char[] cbuf, final OutputStream output) throws IOException - Summary: Writes XML-escaped characters from the specified character array to the given OutputStream.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
output(OutputStream) — The OutputStream to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final char[] cbuf, final int off, final int len, final OutputStream output) throws IOException - Summary: Writes XML-escaped characters from a portion of a character array to the given OutputStream.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
off(int) — The start offset in the character array -
len(int) — The number of characters to write -
output(OutputStream) — The OutputStream to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(String str, final OutputStream output) throws IOException - Summary: Writes XML-escaped characters from the specified string to the given OutputStream.
-
Contract:
- If the string is {@code null} , the text "null" is written.
-
Parameters:
-
str(String) — The string containing the characters to be written -
output(OutputStream) — The OutputStream to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final String str, final int off, final int len, final OutputStream output) throws IOException - Summary: Writes XML-escaped characters from a portion of a string to the given OutputStream.
-
Parameters:
-
str(String) — The string containing the characters to be written -
off(int) — The start offset in the string -
len(int) — The number of characters to write -
output(OutputStream) — The OutputStream to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final char[] cbuf, final Writer output) throws IOException - Summary: Writes XML-escaped characters from the specified character array to the given Writer.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
output(Writer) — The Writer to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final char[] cbuf, final int off, final int len, final Writer output) throws IOException - Summary: Writes XML-escaped characters from a portion of a character array to the given Writer.
-
Contract:
- Uses a BufferedXmlWriter for efficient writing if the output is not already a BufferedXmlWriter.
-
Parameters:
-
cbuf(char[]) — The character array containing the characters to be written -
off(int) — The start offset in the character array -
len(int) — The number of characters to write -
output(Writer) — The Writer to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(String str, final Writer output) throws IOException - Summary: Writes XML-escaped characters from the specified string to the given Writer.
-
Contract:
- If the string is {@code null} , the text "null" is written.
-
Parameters:
-
str(String) — The string containing the characters to be written -
output(Writer) — The Writer to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
-
Signature:
public static void writeCharacters(final String str, final int off, final int len, final Writer output) throws IOException - Summary: Writes XML-escaped characters from a portion of a string to the given Writer.
-
Contract:
- Uses a BufferedXmlWriter for efficient writing if the output is not already a BufferedXmlWriter.
-
Parameters:
-
str(String) — The string containing the characters to be written -
off(int) — The start offset in the string -
len(int) — The number of characters to write -
output(Writer) — The Writer to which the escaped characters will be written
-
-
Throws:
-
java.io.IOException— If an I/O error occurs
-
Public Instance Methods
- (none)
Enum YesNo (com.landawn.abacus.util.YesNo)
An enumeration representing binary yes/no values.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
valueOf(...) -> YesNo
-
Signature:
public static YesNo valueOf(final int intValue) - Summary: Returns the YesNo enum constant corresponding to the specified integer value.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Reading from database int dbValue = resultSet.getInt("is_active"); YesNo isActive = YesNo.valueOf(dbValue); if (isActive == YesNo.YES) { // Process active record } } </pre>
-
Parameters:
-
intValue(int) — the integer value to convert (must be 0 or 1)
-
- Returns: NO for 0, YES for 1
Public Instance Methods
intValue(...) -> int
-
Signature:
public int intValue() - Summary: Returns the integer value associated with this YesNo constant.
-
Parameters:
- (none)
- Returns: 0 for NO, 1 for YES
Class cs (com.landawn.abacus.util.cs)
String constants utility class providing commonly used parameter names, field names, and SQL keywords.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class u (com.landawn.abacus.util.u)
A comprehensive utility class providing Optional and Nullable container implementations for all primitive types and objects.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class OptionalBoolean (com.landawn.abacus.util.u.OptionalBoolean)
A container object which may or may not contain a {@code boolean} value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalBoolean
-
Signature:
public static OptionalBoolean empty() - Summary: Returns an empty {@code OptionalBoolean} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalBoolean}
of(...) -> OptionalBoolean
-
Signature:
public static OptionalBoolean of(final boolean value) - Summary: Returns an {@code OptionalBoolean} with the specified value present.
-
Parameters:
-
value(boolean) — the value to describe
-
- Returns: an {@code OptionalBoolean} with the value present
ofNullable(...) -> OptionalBoolean
-
Signature:
public static OptionalBoolean ofNullable(final Boolean value) - Summary: Returns an {@code OptionalBoolean} describing the given value, if {@code non-null} , otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- Returns an {@code OptionalBoolean} describing the given value, if {@code non-null} , otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
value(Boolean) — the possibly-null value to describe
-
- Returns: an {@code OptionalBoolean} with a present value if the specified value is {@code non-null} , otherwise an empty {@code OptionalBoolean}
Public Instance Methods
get(...) -> boolean
-
Signature:
public boolean get() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsBoolean(...) -> boolean
-
Signature:
@Deprecated public boolean getAsBoolean() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: If a value is present, returns {@code true} , otherwise {@code false} .
-
Contract:
- If a value is present, returns {@code true} , otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: If no value is present, returns {@code true} , otherwise {@code false} .
-
Contract:
- If no value is present, returns {@code true} , otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean ifPresent(final Throwables.BooleanConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.BooleanConsumer<E>) — the action to be performed, if a value is present
-
- Returns: this {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalBoolean
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalBoolean ifPresentOrElse(final Throwables.BooleanConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.BooleanConsumer<E>) — the action to be performed, if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed, if no value is present
-
- Returns: this {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean filter(final Throwables.BooleanPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalBoolean} describing the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalBoolean} describing the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
predicate(Throwables.BooleanPredicate<E>) — the predicate to apply to a value, if present
-
- Returns: an {@code OptionalBoolean} describing the value of this {@code OptionalBoolean} , if a value is present and the value matches the given predicate, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean map(final Throwables.BooleanUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalBoolean} describing (as if by {@link #of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, returns an {@code OptionalBoolean} describing (as if by {@link #of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.BooleanUnaryOperator<E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalBoolean} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToChar(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar mapToChar(final Throwables.ToCharFunction<Boolean, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalChar} describing (as if by {@link OptionalChar#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, returns an {@code OptionalChar} describing (as if by {@link OptionalChar#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.ToCharFunction<Boolean, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalChar} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Boolean, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalInt} describing (as if by {@link OptionalInt#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, returns an {@code OptionalInt} describing (as if by {@link OptionalInt#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<Boolean, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalInt} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToLong(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLong(final Throwables.ToLongFunction<Boolean, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalLong} describing (as if by {@link OptionalLong#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- If a value is present, returns an {@code OptionalLong} describing (as if by {@link OptionalLong#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Parameters:
-
mapper(Throwables.ToLongFunction<Boolean, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalLong} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalLong}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<Boolean, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalDouble} describing (as if by {@link OptionalDouble#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, returns an {@code OptionalDouble} describing (as if by {@link OptionalDouble#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<Boolean, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalDouble} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.BooleanFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.BooleanFunction<? extends T, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean flatMap(final Throwables.BooleanFunction<OptionalBoolean, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns the result of applying the given {@code OptionalBoolean} -bearing mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, returns the result of applying the given {@code OptionalBoolean} -bearing mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
- <p> This method is similar to {@link #map(Throwables.BooleanUnaryOperator)} , but the mapping function is one whose result is already an {@code OptionalBoolean} , and if invoked, {@code flatMap} does not wrap it within an additional {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.BooleanFunction<OptionalBoolean, E>) — the mapping function to apply to a value, if present
-
- Returns: the result of applying an {@code OptionalBoolean} -bearing mapping function to the value of this {@code OptionalBoolean} , if a value is present, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
or(...) -> OptionalBoolean
-
Signature:
public OptionalBoolean or(final Supplier<OptionalBoolean> supplier) - Summary: If a value is present, returns this {@code OptionalBoolean} , otherwise returns the {@code OptionalBoolean} produced by the supplying function.
-
Contract:
- If a value is present, returns this {@code OptionalBoolean} , otherwise returns the {@code OptionalBoolean} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalBoolean>) — the supplying function that produces an {@code OptionalBoolean} to be returned
-
- Returns: this {@code OptionalBoolean} , if a value is present, otherwise the {@code OptionalBoolean} produced by the supplying function
orElse(...) -> boolean
-
Signature:
public boolean orElse(final boolean other) - Summary: If a value is present, returns the value, otherwise returns {@code other} .
-
Contract:
- If a value is present, returns the value, otherwise returns {@code other} .
-
Parameters:
-
other(boolean) — the value to be returned, if no value is present
-
- Returns: the value, if present, otherwise {@code other}
orElseGet(...) -> boolean
-
Signature:
public boolean orElseGet(final BooleanSupplier supplier) throws IllegalArgumentException - Summary: If a value is present, returns the value, otherwise returns the result produced by the supplying function.
-
Contract:
- If a value is present, returns the value, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(BooleanSupplier) — a {@code BooleanSupplier} whose result is returned if no value is present
-
- Returns: the value, if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if no value is present and the supplying function is null
-
orElseThrow(...) -> boolean
-
Signature:
public boolean orElseThrow() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public boolean orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Parameters:
-
errorMessage(String) — the message to be used in the exception, if no value is present
-
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public boolean orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameter.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameter.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain a placeholder for the parameter -
param(Object) — the parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public boolean orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
param1(Object) — the first parameter to be used in formatting the error message -
param2(Object) — the second parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public boolean orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
param1(Object) — the first parameter to be used in formatting the error message -
param2(Object) — the second parameter to be used in formatting the error message -
param3(Object) — the third parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public boolean orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
params(Object[]) — the parameters to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalBoolean}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> boolean orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value, if present
-
Throws:
-
java.lang.IllegalArgumentException— if no value is present and the exception supplying function is null -
E— if no value is present
-
stream(...) -> Stream<Boolean>
-
Signature:
public Stream<Boolean> stream() - Summary: If a value is present, returns a sequential {@link Stream} containing only that value, otherwise returns an empty {@code Stream} .
-
Contract:
- If a value is present, returns a sequential {@link Stream} containing only that value, otherwise returns an empty {@code Stream} .
-
Parameters:
- (none)
- Returns: the optional value as a {@code Stream}
toList(...) -> List<Boolean>
-
Signature:
public List<Boolean> toList() - Summary: If a value is present, returns a {@code List} containing only that value, otherwise returns an empty {@code List} .
-
Contract:
- If a value is present, returns a {@code List} containing only that value, otherwise returns an empty {@code List} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty {@code List}
toSet(...) -> Set<Boolean>
-
Signature:
public Set<Boolean> toSet() - Summary: If a value is present, returns a {@code Set} containing only that value, otherwise returns an empty {@code Set} .
-
Contract:
- If a value is present, returns a {@code Set} containing only that value, otherwise returns an empty {@code Set} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty {@code Set}
toImmutableList(...) -> ImmutableList<Boolean>
-
Signature:
public ImmutableList<Boolean> toImmutableList() - Summary: If a value is present, returns an {@code ImmutableList} containing only that value, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- If a value is present, returns an {@code ImmutableList} containing only that value, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<Boolean>
-
Signature:
public ImmutableSet<Boolean> toImmutableSet() - Summary: If a value is present, returns an {@code ImmutableSet} containing only that value, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- If a value is present, returns an {@code ImmutableSet} containing only that value, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
boxed(...) -> Optional<Boolean>
-
Signature:
public Optional<Boolean> boxed() - Summary: If a value is present, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the value if present, otherwise an empty {@code Optional}
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalBoolean optional) - Summary: Compares this {@code OptionalBoolean} to another {@code OptionalBoolean} .
-
Contract:
- If both are non-empty, the contained values are compared using {@link Boolean#compare} .
-
Parameters:
-
optional(OptionalBoolean) — the {@code OptionalBoolean} to compare to
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalBoolean} is less than, equal to, or greater than the specified {@code OptionalBoolean}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalBoolean} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value, if present, otherwise {@code 0} (zero) if no value is present.
-
Contract:
- Returns the hash code of the value, if present, otherwise {@code 0} (zero) if no value is present.
-
Parameters:
- (none)
- Returns: hash code value of the present value or {@code 0} if no value is present
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a non-empty string representation of this {@code OptionalBoolean} suitable for debugging.
-
Contract:
- <p> If a value is present the result must include its string representation in the result.
- Empty and present {@code OptionalBoolean} s must be unambiguously differentiable.
-
Parameters:
- (none)
- Returns: the string representation of this instance
Class OptionalChar (com.landawn.abacus.util.u.OptionalChar)
A container object which may or may not contain a {@code char} value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalChar
-
Signature:
public static OptionalChar empty() - Summary: Returns an empty {@code OptionalChar} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalChar}
of(...) -> OptionalChar
-
Signature:
public static OptionalChar of(final char value) - Summary: Returns an {@code OptionalChar} with the specified value present.
-
Parameters:
-
value(char) — the value to describe
-
- Returns: an {@code OptionalChar} with the value present
ofNullable(...) -> OptionalChar
-
Signature:
public static OptionalChar ofNullable(final Character value) - Summary: Returns an {@code OptionalChar} describing the given value, if {@code non-null} , otherwise returns an empty {@code OptionalChar} .
-
Contract:
- Returns an {@code OptionalChar} describing the given value, if {@code non-null} , otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
value(Character) — the possibly-null value to describe
-
- Returns: an {@code OptionalChar} with a present value if the specified value is {@code non-null} , otherwise an empty {@code OptionalChar}
Public Instance Methods
get(...) -> char
-
Signature:
public char get() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsChar(...) -> char
-
Signature:
@Deprecated public char getAsChar() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: If a value is present, returns {@code true} , otherwise {@code false} .
-
Contract:
- If a value is present, returns {@code true} , otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: If no value is present, returns {@code true} , otherwise {@code false} .
-
Contract:
- If no value is present, returns {@code true} , otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar ifPresent(final Throwables.CharConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.CharConsumer<E>) — the action to be performed, if a value is present
-
- Returns: this {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalChar
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalChar ifPresentOrElse(final Throwables.CharConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.CharConsumer<E>) — the action to be performed, if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed, if no value is present
-
- Returns: this {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar filter(final Throwables.CharPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalChar} describing the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalChar} describing the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — the predicate to apply to a value, if present
-
- Returns: an {@code OptionalChar} describing the value of this {@code OptionalChar} , if a value is present and the value matches the given predicate, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar map(final Throwables.CharUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalChar} describing (as if by {@link #of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, returns an {@code OptionalChar} describing (as if by {@link #of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.CharUnaryOperator<E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalChar} describing the result of applying a mapping function to the value of this {@code OptionalChar} , if a value is present, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToBoolean(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean mapToBoolean(final Throwables.ToBooleanFunction<Character, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalBoolean} describing (as if by {@link OptionalBoolean#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, returns an {@code OptionalBoolean} describing (as if by {@link OptionalBoolean#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.ToBooleanFunction<Character, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalBoolean} describing the result of applying a mapping function to the value of this {@code OptionalChar} , if a value is present, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Character, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalInt} describing (as if by {@link OptionalInt#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, returns an {@code OptionalInt} describing (as if by {@link OptionalInt#of} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<Character, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code OptionalInt} describing the result of applying a mapping function to the value of this {@code OptionalChar} , if a value is present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.CharFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.CharFunction<? extends T, E>) — the mapping function to apply to a value, if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalChar} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar flatMap(final Throwables.CharFunction<OptionalChar, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns the result of applying the given {@code OptionalChar} -bearing mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, returns the result of applying the given {@code OptionalChar} -bearing mapping function to the value, otherwise returns an empty {@code OptionalChar} .
- <p> This method is similar to {@link #map(Throwables.CharUnaryOperator)} , but the mapping function is one whose result is already an {@code OptionalChar} , and if invoked, {@code flatMap} does not wrap it within an additional {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.CharFunction<OptionalChar, E>) — the mapping function to apply to a value, if present
-
- Returns: the result of applying an {@code OptionalChar} -bearing mapping function to the value of this {@code OptionalChar} , if a value is present, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
or(...) -> OptionalChar
-
Signature:
public OptionalChar or(final Supplier<OptionalChar> supplier) - Summary: If a value is present, returns this {@code OptionalChar} , otherwise returns the {@code OptionalChar} produced by the supplying function.
-
Contract:
- If a value is present, returns this {@code OptionalChar} , otherwise returns the {@code OptionalChar} produced by the supplying function.
- <p> This method is useful for chaining alternative {@code OptionalChar} sources, allowing fallback to another optional value when the current one is empty.
-
Parameters:
-
supplier(Supplier<OptionalChar>) — the supplying function that produces an {@code OptionalChar} to be returned
-
- Returns: this {@code OptionalChar} , if a value is present, otherwise the {@code OptionalChar} produced by the supplying function
orElseZero(...) -> char
-
Signature:
public char orElseZero() - Summary: If a value is present, returns the value, otherwise returns zero.
-
Contract:
- If a value is present, returns the value, otherwise returns zero.
-
Parameters:
- (none)
- Returns: the value, if present, otherwise zero
orElse(...) -> char
-
Signature:
public char orElse(final char other) - Summary: If a value is present, returns the value, otherwise returns {@code other} .
-
Contract:
- If a value is present, returns the value, otherwise returns {@code other} .
-
Parameters:
-
other(char) — the value to be returned, if no value is present
-
- Returns: the value, if present, otherwise {@code other}
orElseGet(...) -> char
-
Signature:
public char orElseGet(final CharSupplier supplier) throws IllegalArgumentException - Summary: If a value is present, returns the value, otherwise returns the result produced by the supplying function.
-
Contract:
- If a value is present, returns the value, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(CharSupplier) — a {@code CharSupplier} whose result is returned if no value is present
-
- Returns: the value, if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if no value is present and the supplying function is null
-
orElseThrow(...) -> char
-
Signature:
public char orElseThrow() throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public char orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Parameters:
-
errorMessage(String) — the message to be used in the exception, if no value is present
-
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public char orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameter.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameter.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain a placeholder for the parameter -
param(Object) — the parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public char orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
param1(Object) — the first parameter to be used in formatting the error message -
param2(Object) — the second parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public char orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
param1(Object) — the first parameter to be used in formatting the error message -
param2(Object) — the second parameter to be used in formatting the error message -
param3(Object) — the third parameter to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public char orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with an error message formatted using the given message and parameters.
-
Parameters:
-
errorMessage(String) — the error message template, which can contain placeholders for the parameters -
params(Object[]) — the parameters to be used in formatting the error message
-
- Returns: the value described by this {@code OptionalChar}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> char orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value, if present
-
Throws:
-
java.lang.IllegalArgumentException— if no value is present and the exception supplying function is null -
E— if no value is present
-
stream(...) -> CharStream
-
Signature:
public CharStream stream() - Summary: If a value is present, returns a sequential {@link CharStream} containing only that value, otherwise returns an empty {@code CharStream} .
-
Contract:
- If a value is present, returns a sequential {@link CharStream} containing only that value, otherwise returns an empty {@code CharStream} .
-
Parameters:
- (none)
- Returns: the optional value as a {@code CharStream}
toList(...) -> List<Character>
-
Signature:
public List<Character> toList() - Summary: If a value is present, returns a {@code List} containing only that value, otherwise returns an empty {@code List} .
-
Contract:
- If a value is present, returns a {@code List} containing only that value, otherwise returns an empty {@code List} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty {@code List}
toSet(...) -> Set<Character>
-
Signature:
public Set<Character> toSet() - Summary: If a value is present, returns a {@code Set} containing only that value, otherwise returns an empty {@code Set} .
-
Contract:
- If a value is present, returns a {@code Set} containing only that value, otherwise returns an empty {@code Set} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty {@code Set}
toImmutableList(...) -> ImmutableList<Character>
-
Signature:
public ImmutableList<Character> toImmutableList() - Summary: If a value is present, returns an {@code ImmutableList} containing only that value, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- If a value is present, returns an {@code ImmutableList} containing only that value, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<Character>
-
Signature:
public ImmutableSet<Character> toImmutableSet() - Summary: If a value is present, returns an {@code ImmutableSet} containing only that value, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- If a value is present, returns an {@code ImmutableSet} containing only that value, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
boxed(...) -> Optional<Character>
-
Signature:
public Optional<Character> boxed() - Summary: If a value is present, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
- <p> This method converts the primitive {@code OptionalChar} to an object-based {@code Optional<Character>} , which may be useful when interfacing with APIs that expect the standard Java {@code Optional} type.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the value if present, otherwise an empty {@code Optional}
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalChar optional) - Summary: Compares this {@code OptionalChar} to another {@code OptionalChar} .
-
Contract:
- If both are non-empty, the contained values are compared using {@link Character#compare} .
-
Parameters:
-
optional(OptionalChar) — the {@code OptionalChar} to compare to
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalChar} is less than, equal to, or greater than the specified {@code OptionalChar}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalChar} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value, if present, otherwise {@code 0} (zero) if no value is present.
-
Contract:
- Returns the hash code of the value, if present, otherwise {@code 0} (zero) if no value is present.
-
Parameters:
- (none)
- Returns: hash code value of the present value or {@code 0} if no value is present
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a non-empty string representation of this {@code OptionalChar} suitable for debugging.
-
Contract:
- <p> If a value is present the result must include its string representation in the result.
- Empty and present {@code OptionalChar} s must be unambiguously differentiable.
-
Parameters:
- (none)
- Returns: the string representation of this instance
Class OptionalByte (com.landawn.abacus.util.u.OptionalByte)
A container object which may or may not contain a byte value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalByte
-
Signature:
public static OptionalByte empty() - Summary: Returns an empty {@code OptionalByte} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalByte}
of(...) -> OptionalByte
-
Signature:
public static OptionalByte of(final byte value) - Summary: Returns an {@code OptionalByte} with the specified value present.
-
Parameters:
-
value(byte) — the byte value to be present
-
- Returns: an {@code OptionalByte} with the value present
ofNullable(...) -> OptionalByte
-
Signature:
public static OptionalByte ofNullable(final Byte value) - Summary: Returns an {@code OptionalByte} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalByte} .
-
Contract:
- Returns an {@code OptionalByte} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalByte} .
-
Parameters:
-
value(Byte) — the possibly-null value to describe
-
- Returns: an {@code OptionalByte} with a present value if the specified value is {@code non-null} , otherwise an empty {@code OptionalByte}
Public Instance Methods
get(...) -> byte
-
Signature:
public byte get() throws NoSuchElementException - Summary: Returns the byte value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the byte value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the byte value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsByte(...) -> byte
-
Signature:
@Deprecated public byte getAsByte() throws NoSuchElementException - Summary: Returns the byte value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the byte value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the byte value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code OptionalByte opt = OptionalByte.of((byte) 42); if (opt.isPresent()) { System.out.println("Value: " + opt.get()); } OptionalByte empty = OptionalByte.empty(); if (empty.isPresent()) { // This block will not execute } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
- <p> This method is the negation of {@link #isPresent()} and is provided as a convenience for improved code readability when checking for absent values.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code OptionalByte opt = OptionalByte.empty(); if (opt.isEmpty()) { System.out.println("No value present"); } OptionalByte withValue = OptionalByte.of((byte) 42); if (withValue.isEmpty()) { // This block will not execute } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte ifPresent(final Throwables.ByteConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.ByteConsumer<E>) — the action to be performed if a value is present
-
- Returns: this {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is null -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalByte
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalByte ifPresentOrElse(final Throwables.ByteConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.ByteConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is null -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte filter(final Throwables.BytePredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalByte} describing the value, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalByte} describing the value, otherwise returns an empty {@code OptionalByte} .
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — the predicate to apply to the value, if present
-
- Returns: an {@code OptionalByte} describing the value of this {@code OptionalByte} if a value is present and the value matches the given predicate, otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is null -
E— if the predicate evaluation throws an exception
-
map(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte map(final Throwables.ByteUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided mapping function to it, and returns an {@code OptionalByte} describing the result.
-
Contract:
- If a value is present, applies the provided mapping function to it, and returns an {@code OptionalByte} describing the result.
-
Parameters:
-
mapper(Throwables.ByteUnaryOperator<E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code OptionalByte} describing the result of applying the mapping function to the value of this {@code OptionalByte} , if a value is present, otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Byte, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided {@code byte} -to- {@code int} mapping function to it, and returns an {@code OptionalInt} describing the result.
-
Contract:
- If a value is present, applies the provided {@code byte} -to- {@code int} mapping function to it, and returns an {@code OptionalInt} describing the result.
-
Parameters:
-
mapper(Throwables.ToIntFunction<Byte, E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code OptionalInt} describing the result of applying the mapping function to the value of this {@code OptionalByte} , if a value is present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.ByteFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.ByteFunction<? extends T, E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalByte} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte flatMap(final Throwables.ByteFunction<OptionalByte, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided {@code OptionalByte} -bearing mapping function to it, and returns the result.
-
Contract:
- If a value is present, applies the provided {@code OptionalByte} -bearing mapping function to it, and returns the result.
-
Parameters:
-
mapper(Throwables.ByteFunction<OptionalByte, E>) — the mapping function to apply to the value, if present
-
- Returns: the result of applying an {@code OptionalByte} -bearing mapping function to the value of this {@code OptionalByte} , if a value is present, otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
or(...) -> OptionalByte
-
Signature:
public OptionalByte or(final Supplier<OptionalByte> supplier) - Summary: If no value is present, returns an {@code OptionalByte} produced by the supplying function.
-
Contract:
- If no value is present, returns an {@code OptionalByte} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalByte>) — the supplying function that produces an {@code OptionalByte} to be returned
-
- Returns: this {@code OptionalByte} if a value is present, otherwise an {@code OptionalByte} produced by the supplying function
orElseZero(...) -> byte
-
Signature:
public byte orElseZero() - Summary: Returns the value if present, otherwise returns zero.
-
Contract:
- Returns the value if present, otherwise returns zero.
-
Parameters:
- (none)
- Returns: the value if present, otherwise {@code 0}
orElse(...) -> byte
-
Signature:
public byte orElse(final byte other) - Summary: Returns the value if present, otherwise returns {@code other} .
-
Contract:
- Returns the value if present, otherwise returns {@code other} .
-
Parameters:
-
other(byte) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> byte
-
Signature:
public byte orElseGet(final ByteSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(ByteSupplier) — a supplying function to be invoked to produce a value to be returned
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is null
-
orElseThrow(...) -> byte
-
Signature:
public byte orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public byte orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if no value is present
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public byte orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameter.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameter.
-
Parameters:
-
errorMessage(String) — the error message format string -
param(Object) — the parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public byte orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter to be substituted into the error message -
param2(Object) — the second parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public byte orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter to be substituted into the error message -
param2(Object) — the second parameter to be substituted into the error message -
param3(Object) — the third parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public byte orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
params(Object[]) — the parameters to be substituted into the error message
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> byte orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value held by this {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is null -
E— if no value is present
-
stream(...) -> ByteStream
-
Signature:
public ByteStream stream() - Summary: Returns a {@code ByteStream} containing only the value if present, otherwise returns an empty {@code ByteStream} .
-
Contract:
- Returns a {@code ByteStream} containing only the value if present, otherwise returns an empty {@code ByteStream} .
-
Parameters:
- (none)
- Returns: the optional value as a {@code ByteStream}
toList(...) -> List<Byte>
-
Signature:
public List<Byte> toList() - Summary: Returns a {@code List} containing only the value if present, otherwise returns an empty {@code List} .
-
Contract:
- Returns a {@code List} containing only the value if present, otherwise returns an empty {@code List} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the optional value if present, otherwise an empty list
toSet(...) -> Set<Byte>
-
Signature:
public Set<Byte> toSet() - Summary: Returns a {@code Set} containing only the value if present, otherwise returns an empty {@code Set} .
-
Contract:
- Returns a {@code Set} containing only the value if present, otherwise returns an empty {@code Set} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the optional value if present, otherwise an empty set
toImmutableList(...) -> ImmutableList<Byte>
-
Signature:
public ImmutableList<Byte> toImmutableList() - Summary: Returns an {@code ImmutableList} containing only the value if present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing only the value if present, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the optional value if present, otherwise an empty immutable list
toImmutableSet(...) -> ImmutableSet<Byte>
-
Signature:
public ImmutableSet<Byte> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing only the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing only the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the optional value if present, otherwise an empty immutable set
boxed(...) -> Optional<Byte>
-
Signature:
public Optional<Byte> boxed() - Summary: Returns an {@code Optional} containing the value if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional} containing the value if present, otherwise returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the optional value if present, otherwise an empty {@code Optional}
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalByte optional) - Summary: Compares this {@code OptionalByte} to the specified {@code OptionalByte} .
-
Contract:
- If both are present, the comparison is based on the contained values.
-
Parameters:
-
optional(OptionalByte) — the {@code OptionalByte} to be compared
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalByte} is less than, equal to, or greater than the specified {@code OptionalByte}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalByte} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns {@code 0} (zero) if no value is present.
-
Contract:
- Returns the hash code of the value if present, otherwise returns {@code 0} (zero) if no value is present.
-
Parameters:
- (none)
- Returns: hash code value of the present value or {@code 0} if no value is present
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a non-empty string representation of this {@code OptionalByte} suitable for debugging.
-
Parameters:
- (none)
- Returns: the string representation of this instance
Class OptionalShort (com.landawn.abacus.util.u.OptionalShort)
A container object which may or may not contain a short value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalShort
-
Signature:
public static OptionalShort empty() - Summary: Returns an empty {@code OptionalShort} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalShort}
of(...) -> OptionalShort
-
Signature:
public static OptionalShort of(final short value) - Summary: Returns an {@code OptionalShort} with the specified value present.
-
Parameters:
-
value(short) — the short value to be present
-
- Returns: an {@code OptionalShort} with the value present
ofNullable(...) -> OptionalShort
-
Signature:
public static OptionalShort ofNullable(final Short value) - Summary: Returns an {@code OptionalShort} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalShort} .
-
Contract:
- Returns an {@code OptionalShort} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalShort} .
-
Parameters:
-
value(Short) — the possibly-null value to describe
-
- Returns: an {@code OptionalShort} with a present value if the specified value is {@code non-null} , otherwise an empty {@code OptionalShort}
Public Instance Methods
get(...) -> short
-
Signature:
public short get() throws NoSuchElementException - Summary: Returns the short value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the short value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the short value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsShort(...) -> short
-
Signature:
@Deprecated public short getAsShort() throws NoSuchElementException - Summary: Returns the short value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the short value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the short value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort ifPresent(final Throwables.ShortConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.ShortConsumer<E>) — the action to be performed if a value is present
-
- Returns: this {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is null -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalShort
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalShort ifPresentOrElse(final Throwables.ShortConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.ShortConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is null -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort filter(final Throwables.ShortPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalShort} describing the value, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalShort} describing the value, otherwise returns an empty {@code OptionalShort} .
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — the predicate to apply to the value, if present
-
- Returns: an {@code OptionalShort} describing the value of this {@code OptionalShort} if a value is present and the value matches the given predicate, otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is null -
E— if the predicate evaluation throws an exception
-
map(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort map(final Throwables.ShortUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided mapping function to it, and returns an {@code OptionalShort} describing the result.
-
Contract:
- If a value is present, applies the provided mapping function to it, and returns an {@code OptionalShort} describing the result.
-
Parameters:
-
mapper(Throwables.ShortUnaryOperator<E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code OptionalShort} describing the result of applying the mapping function to the value of this {@code OptionalShort} , if a value is present, otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Short, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided {@code short} -to- {@code int} mapping function to it, and returns an {@code OptionalInt} describing the result.
-
Contract:
- If a value is present, applies the provided {@code short} -to- {@code int} mapping function to it, and returns an {@code OptionalInt} describing the result.
-
Parameters:
-
mapper(Throwables.ToIntFunction<Short, E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code OptionalInt} describing the result of applying the mapping function to the value of this {@code OptionalShort} , if a value is present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.ShortFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.ShortFunction<? extends T, E>) — the mapping function to apply to the value, if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalShort} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort flatMap(final Throwables.ShortFunction<OptionalShort, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the provided {@code OptionalShort} -bearing mapping function to it, and returns the result.
-
Contract:
- If a value is present, applies the provided {@code OptionalShort} -bearing mapping function to it, and returns the result.
-
Parameters:
-
mapper(Throwables.ShortFunction<OptionalShort, E>) — the mapping function to apply to the value, if present
-
- Returns: the result of applying an {@code OptionalShort} -bearing mapping function to the value of this {@code OptionalShort} , if a value is present, otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is null -
E— if the mapping function throws an exception
-
or(...) -> OptionalShort
-
Signature:
public OptionalShort or(final Supplier<OptionalShort> supplier) - Summary: If no value is present, returns an {@code OptionalShort} produced by the supplying function.
-
Contract:
- If no value is present, returns an {@code OptionalShort} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalShort>) — the supplying function that produces an {@code OptionalShort} to be returned
-
- Returns: this {@code OptionalShort} if a value is present, otherwise an {@code OptionalShort} produced by the supplying function
orElseZero(...) -> short
-
Signature:
public short orElseZero() - Summary: Returns the value if present, otherwise returns zero.
-
Contract:
- Returns the value if present, otherwise returns zero.
-
Parameters:
- (none)
- Returns: the value if present, otherwise {@code 0}
orElse(...) -> short
-
Signature:
public short orElse(final short other) - Summary: Returns the value if present, otherwise returns {@code other} .
-
Contract:
- Returns the value if present, otherwise returns {@code other} .
-
Parameters:
-
other(short) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> short
-
Signature:
public short orElseGet(final ShortSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(ShortSupplier) — a supplying function to be invoked to produce a value to be returned
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is null
-
orElseThrow(...) -> short
-
Signature:
public short orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public short orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if no value is present
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public short orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameter.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameter.
-
Parameters:
-
errorMessage(String) — the error message format string -
param(Object) — the parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public short orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter to be substituted into the error message -
param2(Object) — the second parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public short orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter to be substituted into the error message -
param2(Object) — the second parameter to be substituted into the error message -
param3(Object) — the third parameter to be substituted into the error message
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public short orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message formatted with the provided parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
params(Object[]) — the parameters to be substituted into the error message
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> short orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value held by this {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is null -
E— if no value is present
-
stream(...) -> ShortStream
-
Signature:
public ShortStream stream() - Summary: Returns a {@code ShortStream} containing only the value if present, otherwise returns an empty {@code ShortStream} .
-
Contract:
- Returns a {@code ShortStream} containing only the value if present, otherwise returns an empty {@code ShortStream} .
-
Parameters:
- (none)
- Returns: the optional value as a {@code ShortStream}
toList(...) -> List<Short>
-
Signature:
public List<Short> toList() - Summary: Returns a {@code List} containing only the value if present, otherwise returns an empty {@code List} .
-
Contract:
- Returns a {@code List} containing only the value if present, otherwise returns an empty {@code List} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the optional value if present, otherwise an empty list
toSet(...) -> Set<Short>
-
Signature:
public Set<Short> toSet() - Summary: Returns a {@code Set} containing only the value if present, otherwise returns an empty {@code Set} .
-
Contract:
- Returns a {@code Set} containing only the value if present, otherwise returns an empty {@code Set} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the optional value if present, otherwise an empty set
toImmutableList(...) -> ImmutableList<Short>
-
Signature:
public ImmutableList<Short> toImmutableList() - Summary: Returns an {@code ImmutableList} containing only the value if present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing only the value if present, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the optional value if present, otherwise an empty immutable list
toImmutableSet(...) -> ImmutableSet<Short>
-
Signature:
public ImmutableSet<Short> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing only the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing only the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the optional value if present, otherwise an empty immutable set
boxed(...) -> Optional<Short>
-
Signature:
public Optional<Short> boxed() - Summary: Returns an {@code Optional} containing the value if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional} containing the value if present, otherwise returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the optional value if present, otherwise an empty {@code Optional}
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalShort optional) - Summary: Compares this {@code OptionalShort} to the specified {@code OptionalShort} .
-
Contract:
- If both are present, the comparison is based on the contained values.
-
Parameters:
-
optional(OptionalShort) — the {@code OptionalShort} to be compared
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalShort} is less than, equal to, or greater than the specified {@code OptionalShort}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalShort} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns {@code 0} (zero) if no value is present.
-
Contract:
- Returns the hash code of the value if present, otherwise returns {@code 0} (zero) if no value is present.
-
Parameters:
- (none)
- Returns: hash code value of the present value or {@code 0} if no value is present
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a non-empty string representation of this {@code OptionalShort} suitable for debugging.
-
Parameters:
- (none)
- Returns: the string representation of this instance
Class OptionalInt (com.landawn.abacus.util.u.OptionalInt)
A container object which may or may not contain an int value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalInt
-
Signature:
public static OptionalInt empty() - Summary: Returns an empty {@code OptionalInt} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalInt}
of(...) -> OptionalInt
-
Signature:
public static OptionalInt of(final int value) - Summary: Returns an {@code OptionalInt} with the specified value present.
-
Parameters:
-
value(int) — the int value to be present
-
- Returns: an {@code OptionalInt} with the value present
ofNullable(...) -> OptionalInt
-
Signature:
public static OptionalInt ofNullable(final Integer value) - Summary: Returns an {@code OptionalInt} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalInt} .
-
Contract:
- Returns an {@code OptionalInt} describing the specified value, if {@code non-null} , otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
value(Integer) — the possibly-null value to describe
-
- Returns: an {@code OptionalInt} with a present value if the specified value is {@code non-null} , otherwise an empty {@code OptionalInt}
from(...) -> OptionalInt
-
Signature:
public static OptionalInt from(final java.util.OptionalInt optional) - Summary: Returns an {@code OptionalInt} from the specified {@code java.util.OptionalInt} .
-
Parameters:
-
optional(java.util.OptionalInt) — the {@code java.util.OptionalInt} to convert
-
- Returns: an {@code OptionalInt} with a present value if the specified {@code java.util.OptionalInt} is present, otherwise an empty {@code OptionalInt}
Public Instance Methods
get(...) -> int
-
Signature:
public int get() throws NoSuchElementException - Summary: Returns the int value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the int value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the int value held by this {@code OptionalInt}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsInt(...) -> int
-
Signature:
@Deprecated public int getAsInt() throws NoSuchElementException - Summary: Returns the int value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the int value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the int value held by this {@code OptionalInt}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt ifPresent(final Throwables.IntConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.IntConsumer<E>) — the action to be performed if a value is present
-
- Returns: this {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is null -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalInt
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalInt ifPresentOrElse(final Throwables.IntConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.IntConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is null -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt filter(final Throwables.IntPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalInt} describing the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalInt} describing the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — the predicate to apply to the value, if present
-
- Returns: an {@code OptionalInt} describing the value of this {@code OptionalInt} if a value is present and the value matches the given predicate, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is null -
E— if the predicate evaluation throws an exception
-
map(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt map(final Throwables.IntUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalInt containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalInt containing the result.
- If this OptionalInt is empty, returns an empty OptionalInt.
-
Parameters:
-
mapper(Throwables.IntUnaryOperator<E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalInt containing the result of applying the mapper to the value if present, otherwise an empty OptionalInt
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToBoolean(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean mapToBoolean(final Throwables.ToBooleanFunction<Integer, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalBoolean containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalBoolean containing the result.
- If this OptionalInt is empty, returns an empty OptionalBoolean.
-
Parameters:
-
mapper(Throwables.ToBooleanFunction<Integer, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalBoolean containing the result of applying the mapper to the value if present, otherwise an empty OptionalBoolean
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToChar(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar mapToChar(final Throwables.ToCharFunction<Integer, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalChar containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalChar containing the result.
- If this OptionalInt is empty, returns an empty OptionalChar.
-
Parameters:
-
mapper(Throwables.ToCharFunction<Integer, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalChar containing the result of applying the mapper to the value if present, otherwise an empty OptionalChar
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToLong(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLong(final Throwables.ToLongFunction<Integer, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalLong containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalLong containing the result.
- If this OptionalInt is empty, returns an empty OptionalLong.
-
Parameters:
-
mapper(Throwables.ToLongFunction<Integer, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalLong containing the result of applying the mapper to the value if present, otherwise an empty OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToFloat(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat mapToFloat(final Throwables.ToFloatFunction<Integer, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalFloat containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalFloat containing the result.
- If this OptionalInt is empty, returns an empty OptionalFloat.
-
Parameters:
-
mapper(Throwables.ToFloatFunction<Integer, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalFloat containing the result of applying the mapper to the value if present, otherwise an empty OptionalFloat
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<Integer, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalDouble containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalDouble containing the result.
- If this OptionalInt is empty, returns an empty OptionalDouble.
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<Integer, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalDouble containing the result of applying the mapper to the value if present, otherwise an empty OptionalDouble
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.IntFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.IntFunction<? extends T, E>) — the mapper function to apply to the value if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalInt} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt flatMap(final Throwables.IntFunction<OptionalInt, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning the resulting OptionalInt.
-
Contract:
- Applies the given mapper function to the value if present, returning the resulting OptionalInt.
- If this OptionalInt is empty, returns an empty OptionalInt.
- This method is similar to {@code map} , but the mapping function returns an OptionalInt, and if invoked, flatMap does not wrap it within an additional OptionalInt.
-
Parameters:
-
mapper(Throwables.IntFunction<OptionalInt, E>) — the mapper function to apply to the value if present
-
- Returns: the result of applying an OptionalInt-bearing mapping function to the value of this OptionalInt, if a value is present, otherwise an empty OptionalInt
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
or(...) -> OptionalInt
-
Signature:
public OptionalInt or(final Supplier<OptionalInt> supplier) - Summary: Returns this {@code OptionalInt} if a value is present, otherwise returns the {@code OptionalInt} produced by the supplying function.
-
Contract:
- Returns this {@code OptionalInt} if a value is present, otherwise returns the {@code OptionalInt} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalInt>) — the supplying function that produces an {@code OptionalInt} to be returned
-
- Returns: this {@code OptionalInt} if a value is present, otherwise the result of the supplying function
orElseZero(...) -> int
-
Signature:
public int orElseZero() - Summary: Returns the value if present, otherwise returns 0.
-
Contract:
- Returns the value if present, otherwise returns 0.
-
Parameters:
- (none)
- Returns: the value if present, otherwise 0
orElse(...) -> int
-
Signature:
public int orElse(final int other) - Summary: Returns the value if present, otherwise returns the given default value.
-
Contract:
- Returns the value if present, otherwise returns the given default value.
-
Parameters:
-
other(int) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> int
-
Signature:
public int orElseGet(final IntSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result of the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result of the supplying function.
-
Parameters:
-
supplier(IntSupplier) — the supplying function that produces a value to be returned
-
- Returns: the value if present, otherwise the result of the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if other is null
-
orElseThrow(...) -> int
-
Signature:
public int orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public int orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the given error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the given error message.
-
Parameters:
-
errorMessage(String) — the error message to be used in the exception
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public int orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameter.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameter.
-
Parameters:
-
errorMessage(String) — the error message format string -
param(Object) — the parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public int orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter for formatting the error message -
param2(Object) — the second parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public int orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter for formatting the error message -
param2(Object) — the second parameter for formatting the error message -
param3(Object) — the third parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public int orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
params(Object[]) — the parameters for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> int orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplier is null -
E— if no value is present
-
stream(...) -> IntStream
-
Signature:
public IntStream stream() - Summary: Returns an IntStream containing the value if present, otherwise returns an empty IntStream.
-
Contract:
- Returns an IntStream containing the value if present, otherwise returns an empty IntStream.
-
Parameters:
- (none)
- Returns: an IntStream containing the value if present, otherwise an empty IntStream
toList(...) -> List<Integer>
-
Signature:
public List<Integer> toList() - Summary: Returns a List containing the value if present, otherwise returns an empty List.
-
Contract:
- Returns a List containing the value if present, otherwise returns an empty List.
-
Parameters:
- (none)
- Returns: a List containing the value if present, otherwise an empty List
toSet(...) -> Set<Integer>
-
Signature:
public Set<Integer> toSet() - Summary: Returns a Set containing the value if present, otherwise returns an empty Set.
-
Contract:
- Returns a Set containing the value if present, otherwise returns an empty Set.
-
Parameters:
- (none)
- Returns: a Set containing the value if present, otherwise an empty Set
toImmutableList(...) -> ImmutableList<Integer>
-
Signature:
public ImmutableList<Integer> toImmutableList() - Summary: Returns an ImmutableList containing the value if present, otherwise returns an empty ImmutableList.
-
Contract:
- Returns an ImmutableList containing the value if present, otherwise returns an empty ImmutableList.
-
Parameters:
- (none)
- Returns: an ImmutableList containing the value if present, otherwise an empty ImmutableList
toImmutableSet(...) -> ImmutableSet<Integer>
-
Signature:
public ImmutableSet<Integer> toImmutableSet() - Summary: Returns an ImmutableSet containing the value if present, otherwise returns an empty ImmutableSet.
-
Contract:
- Returns an ImmutableSet containing the value if present, otherwise returns an empty ImmutableSet.
-
Parameters:
- (none)
- Returns: an ImmutableSet containing the value if present, otherwise an empty ImmutableSet
boxed(...) -> Optional<Integer>
-
Signature:
public Optional<Integer> boxed() - Summary: Returns an Optional containing the boxed Integer value if present, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing the boxed Integer value if present, otherwise returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the boxed Integer value if present, otherwise an empty Optional
toJdkOptional(...) -> java.util.OptionalInt
-
Signature:
public java.util.OptionalInt toJdkOptional() - Summary: Converts this OptionalInt to a java.util.OptionalInt.
-
Parameters:
- (none)
- Returns: a java.util.OptionalInt containing the value if present, otherwise an empty java.util.OptionalInt
__(...) -> java.util.OptionalInt
-
Signature:
@Deprecated public java.util.OptionalInt __() - Summary: Converts this OptionalInt to a java.util.OptionalInt.
-
Parameters:
- (none)
- Returns: a java.util.OptionalInt containing the value if present, otherwise an empty java.util.OptionalInt
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalInt optional) - Summary: Compares this OptionalInt with another OptionalInt for ordering.
-
Parameters:
-
optional(OptionalInt) — the OptionalInt to be compared
-
- Returns: a negative integer, zero, or a positive integer as this OptionalInt is less than, equal to, or greater than the specified OptionalInt
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this OptionalInt.
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object, otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns a hash code for empty.
-
Contract:
- Returns the hash code of the value if present, otherwise returns a hash code for empty.
-
Parameters:
- (none)
- Returns: hash code value of the present value or a hash code for empty
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this OptionalInt.
-
Contract:
- If a value is present, the result is "OptionalInt\[" + value + "\]".
- If no value is present, the result is "OptionalInt.empty".
-
Parameters:
- (none)
- Returns: a string representation of this OptionalInt
Class OptionalLong (com.landawn.abacus.util.u.OptionalLong)
A container object which may or may not contain a long value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalLong
-
Signature:
public static OptionalLong empty() - Summary: Returns an empty OptionalLong instance.
-
Parameters:
- (none)
- Returns: an empty OptionalLong
of(...) -> OptionalLong
-
Signature:
public static OptionalLong of(final long value) - Summary: Returns an OptionalLong with the specified value present.
-
Parameters:
-
value(long) — the value to be present
-
- Returns: an OptionalLong with the value present
ofNullable(...) -> OptionalLong
-
Signature:
public static OptionalLong ofNullable(final Long value) - Summary: Returns an OptionalLong describing the given value, if {@code non-null} , otherwise returns an empty OptionalLong.
-
Contract:
- Returns an OptionalLong describing the given value, if {@code non-null} , otherwise returns an empty OptionalLong.
-
Parameters:
-
value(Long) — the possibly-null value
-
- Returns: an OptionalLong with a present value if the specified value is {@code non-null} , otherwise an empty OptionalLong
from(...) -> OptionalLong
-
Signature:
public static OptionalLong from(final java.util.OptionalLong optional) - Summary: Returns an OptionalLong with the value from the specified java.util.OptionalLong if present, otherwise returns an empty OptionalLong.
-
Contract:
- Returns an OptionalLong with the value from the specified java.util.OptionalLong if present, otherwise returns an empty OptionalLong.
-
Parameters:
-
optional(java.util.OptionalLong) — the java.util.OptionalLong to convert
-
- Returns: an OptionalLong with the value if present, otherwise an empty OptionalLong
Public Instance Methods
get(...) -> long
-
Signature:
public long get() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsLong(...) -> long
-
Signature:
@Deprecated public long getAsLong() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong ifPresent(final Throwables.LongConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.LongConsumer<E>) — the action to be performed if a value is present
-
- Returns: this OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if action is null -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalLong
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalLong ifPresentOrElse(final Throwables.LongConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.LongConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if action or emptyAction is null -
E— if the action throws an exception -
E2— if the emptyAction throws an exception
-
filter(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong filter(final Throwables.LongPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an OptionalLong describing the value, otherwise returns an empty OptionalLong.
-
Contract:
- If a value is present, and the value matches the given predicate, returns an OptionalLong describing the value, otherwise returns an empty OptionalLong.
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — the predicate to apply to the value if present
-
- Returns: an OptionalLong describing the value of this OptionalLong if a value is present and matches the predicate, otherwise an empty OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if predicate is null -
E— if the predicate throws an exception
-
map(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong map(final Throwables.LongUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalLong containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalLong containing the result.
- If this OptionalLong is empty, returns an empty OptionalLong.
-
Parameters:
-
mapper(Throwables.LongUnaryOperator<E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalLong containing the result of applying the mapper to the value if present, otherwise an empty OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Long, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalInt containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalInt containing the result.
- If this OptionalLong is empty, returns an empty OptionalInt.
-
Parameters:
-
mapper(Throwables.ToIntFunction<Long, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalInt containing the result of applying the mapper to the value if present, otherwise an empty OptionalInt
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<Long, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an OptionalDouble containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an OptionalDouble containing the result.
- If this OptionalLong is empty, returns an empty OptionalDouble.
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<Long, E>) — the mapper function to apply to the value if present
-
- Returns: an OptionalDouble containing the result of applying the mapper to the value if present, otherwise an empty OptionalDouble
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.LongFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.LongFunction<? extends T, E>) — the mapper function to apply to the value if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalLong} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong flatMap(final Throwables.LongFunction<OptionalLong, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning the resulting OptionalLong.
-
Contract:
- Applies the given mapper function to the value if present, returning the resulting OptionalLong.
- If this OptionalLong is empty, returns an empty OptionalLong.
- This method is similar to {@code map} , but the mapping function returns an OptionalLong, and if invoked, flatMap does not wrap it within an additional OptionalLong.
-
Parameters:
-
mapper(Throwables.LongFunction<OptionalLong, E>) — the mapper function to apply to the value if present
-
- Returns: the result of applying an OptionalLong-bearing mapping function to the value of this OptionalLong, if a value is present, otherwise an empty OptionalLong
-
Throws:
-
java.lang.IllegalArgumentException— if mapper is null -
E— if the mapper function throws an exception
-
or(...) -> OptionalLong
-
Signature:
public OptionalLong or(final Supplier<OptionalLong> supplier) - Summary: Returns this {@code OptionalLong} if a value is present, otherwise returns the {@code OptionalLong} produced by the supplying function.
-
Contract:
- Returns this {@code OptionalLong} if a value is present, otherwise returns the {@code OptionalLong} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalLong>) — the supplying function that produces an {@code OptionalLong} to be returned
-
- Returns: this {@code OptionalLong} if a value is present, otherwise the result of the supplying function
orElseZero(...) -> long
-
Signature:
public long orElseZero() - Summary: Returns the value if present, otherwise returns 0.
-
Contract:
- Returns the value if present, otherwise returns 0.
-
Parameters:
- (none)
- Returns: the value if present, otherwise 0
orElse(...) -> long
-
Signature:
public long orElse(final long other) - Summary: Returns the value if present, otherwise returns the given default value.
-
Contract:
- Returns the value if present, otherwise returns the given default value.
-
Parameters:
-
other(long) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> long
-
Signature:
public long orElseGet(final LongSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result of the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result of the supplying function.
-
Parameters:
-
supplier(LongSupplier) — the supplying function that produces a value to be returned
-
- Returns: the value if present, otherwise the result of the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if other is null
-
orElseThrow(...) -> long
-
Signature:
public long orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public long orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the given error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the given error message.
-
Parameters:
-
errorMessage(String) — the error message to be used in the exception
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public long orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameter.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameter.
-
Parameters:
-
errorMessage(String) — the error message format string -
param(Object) — the parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public long orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter for formatting the error message -
param2(Object) — the second parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public long orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
param1(Object) — the first parameter for formatting the error message -
param2(Object) — the second parameter for formatting the error message -
param3(Object) — the third parameter for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public long orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with an error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message format string -
params(Object[]) — the parameters for formatting the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> long orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if exceptionSupplier is null -
E— if no value is present
-
stream(...) -> LongStream
-
Signature:
public LongStream stream() - Summary: Returns a LongStream containing the value if present, otherwise returns an empty LongStream.
-
Contract:
- Returns a LongStream containing the value if present, otherwise returns an empty LongStream.
-
Parameters:
- (none)
- Returns: a LongStream containing the value if present, otherwise an empty LongStream
toList(...) -> List<Long>
-
Signature:
public List<Long> toList() - Summary: Returns a List containing the value if present, otherwise returns an empty List.
-
Contract:
- Returns a List containing the value if present, otherwise returns an empty List.
-
Parameters:
- (none)
- Returns: a List containing the value if present, otherwise an empty List
toSet(...) -> Set<Long>
-
Signature:
public Set<Long> toSet() - Summary: Returns a Set containing the value if present, otherwise returns an empty Set.
-
Contract:
- Returns a Set containing the value if present, otherwise returns an empty Set.
-
Parameters:
- (none)
- Returns: a Set containing the value if present, otherwise an empty Set
toImmutableList(...) -> ImmutableList<Long>
-
Signature:
public ImmutableList<Long> toImmutableList() - Summary: Returns an ImmutableList containing the value if present, otherwise returns an empty ImmutableList.
-
Contract:
- Returns an ImmutableList containing the value if present, otherwise returns an empty ImmutableList.
-
Parameters:
- (none)
- Returns: an ImmutableList containing the value if present, otherwise an empty ImmutableList
toImmutableSet(...) -> ImmutableSet<Long>
-
Signature:
public ImmutableSet<Long> toImmutableSet() - Summary: Returns an ImmutableSet containing the value if present, otherwise returns an empty ImmutableSet.
-
Contract:
- Returns an ImmutableSet containing the value if present, otherwise returns an empty ImmutableSet.
-
Parameters:
- (none)
- Returns: an ImmutableSet containing the value if present, otherwise an empty ImmutableSet
boxed(...) -> Optional<Long>
-
Signature:
public Optional<Long> boxed() - Summary: Returns an Optional containing the boxed Long value if present, otherwise returns an empty Optional.
-
Contract:
- Returns an Optional containing the boxed Long value if present, otherwise returns an empty Optional.
-
Parameters:
- (none)
- Returns: an Optional containing the boxed Long value if present, otherwise an empty Optional
toJdkOptional(...) -> java.util.OptionalLong
-
Signature:
public java.util.OptionalLong toJdkOptional() - Summary: Converts this OptionalLong to a java.util.OptionalLong.
-
Parameters:
- (none)
- Returns: a java.util.OptionalLong containing the value if present, otherwise an empty java.util.OptionalLong
__(...) -> java.util.OptionalLong
-
Signature:
@Deprecated public java.util.OptionalLong __() - Summary: Converts this OptionalLong to a java.util.OptionalLong.
-
Parameters:
- (none)
- Returns: a java.util.OptionalLong containing the value if present, otherwise an empty java.util.OptionalLong
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalLong optional) - Summary: Compares this OptionalLong with another OptionalLong for ordering.
-
Parameters:
-
optional(OptionalLong) — the OptionalLong to be compared
-
- Returns: a negative integer, zero, or a positive integer as this OptionalLong is less than, equal to, or greater than the specified OptionalLong
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this OptionalLong.
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object, otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns a hash code for empty.
-
Contract:
- Returns the hash code of the value if present, otherwise returns a hash code for empty.
-
Parameters:
- (none)
- Returns: hash code value of the present value or a hash code for empty
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this OptionalLong.
-
Contract:
- If a value is present, the result is "OptionalLong\[" + value + "\]".
- If no value is present, the result is "OptionalLong.empty".
-
Parameters:
- (none)
- Returns: a string representation of this OptionalLong
Class OptionalFloat (com.landawn.abacus.util.u.OptionalFloat)
A container object which may or may not contain a float value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalFloat
-
Signature:
public static OptionalFloat empty() - Summary: Returns an empty OptionalFloat instance.
-
Parameters:
- (none)
- Returns: an empty OptionalFloat
of(...) -> OptionalFloat
-
Signature:
public static OptionalFloat of(final float value) - Summary: Returns an OptionalFloat with the specified value present.
-
Parameters:
-
value(float) — the value to be present
-
- Returns: an OptionalFloat with the value present
ofNullable(...) -> OptionalFloat
-
Signature:
public static OptionalFloat ofNullable(final Float value) - Summary: Returns an OptionalFloat describing the given value, if {@code non-null} , otherwise returns an empty OptionalFloat.
-
Contract:
- Returns an OptionalFloat describing the given value, if {@code non-null} , otherwise returns an empty OptionalFloat.
-
Parameters:
-
value(Float) — the possibly-null value
-
- Returns: an OptionalFloat with a present value if the specified value is {@code non-null} , otherwise an empty OptionalFloat
Public Instance Methods
get(...) -> float
-
Signature:
public float get() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsFloat(...) -> float
-
Signature:
@Deprecated public float getAsFloat() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat ifPresent(final Throwables.FloatConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.FloatConsumer<E>) — the action to be performed if a value is present
-
- Returns: this {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalFloat
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalFloat ifPresentOrElse(final Throwables.FloatConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.FloatConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the emptyAction throws an exception
-
filter(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat filter(final Throwables.FloatPredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalFloat} describing the value, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalFloat} describing the value, otherwise returns an empty {@code OptionalFloat} .
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — the predicate to apply to the value if present
-
- Returns: an {@code OptionalFloat} describing the value of this {@code OptionalFloat} if a value is present and matches the predicate, otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat map(final Throwables.FloatUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an {@code OptionalFloat} containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an {@code OptionalFloat} containing the result.
- If this {@code OptionalFloat} is empty, returns an empty {@code OptionalFloat} .
-
Parameters:
-
mapper(Throwables.FloatUnaryOperator<E>) — the mapper function to apply to the value if present
-
- Returns: an {@code OptionalFloat} containing the result of applying the mapper to the value if present, otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Float, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an {@code OptionalInt} containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an {@code OptionalInt} containing the result.
- If this {@code OptionalFloat} is empty, returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<Float, E>) — the mapper function to apply to the value if present
-
- Returns: an {@code OptionalInt} containing the result of applying the mapper to the value if present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<Float, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an {@code OptionalDouble} containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an {@code OptionalDouble} containing the result.
- If this {@code OptionalFloat} is empty, returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<Float, E>) — the mapper function to apply to the value if present
-
- Returns: an {@code OptionalDouble} containing the result of applying the mapper to the value if present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.FloatFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning an {@code Optional} containing the result.
-
Contract:
- Applies the given mapper function to the value if present, returning an {@code Optional} containing the result.
- If this {@code OptionalFloat} is empty, returns an empty {@code Optional} .
-
Parameters:
-
mapper(Throwables.FloatFunction<? extends T, E>) — the mapper function to apply to the value if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalFloat} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat flatMap(final Throwables.FloatFunction<OptionalFloat, E> mapper) throws IllegalArgumentException, E - Summary: Applies the given mapper function to the value if present, returning the resulting {@code OptionalFloat} .
-
Contract:
- Applies the given mapper function to the value if present, returning the resulting {@code OptionalFloat} .
- If this {@code OptionalFloat} is empty, returns an empty {@code OptionalFloat} .
- This method is similar to {@code map} , but the mapping function returns an {@code OptionalFloat} , and if invoked, flatMap does not wrap it within an additional {@code OptionalFloat} .
-
Parameters:
-
mapper(Throwables.FloatFunction<OptionalFloat, E>) — the mapper function to apply to the value if present
-
- Returns: the result of applying an {@code OptionalFloat} -bearing mapping function to the value of this {@code OptionalFloat} , if a value is present, otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
or(...) -> OptionalFloat
-
Signature:
public OptionalFloat or(final Supplier<OptionalFloat> supplier) - Summary: Returns this {@code OptionalFloat} if a value is present, otherwise returns the {@code OptionalFloat} produced by the supplying function.
-
Contract:
- Returns this {@code OptionalFloat} if a value is present, otherwise returns the {@code OptionalFloat} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalFloat>) — the supplying function that produces an {@code OptionalFloat} to be returned
-
- Returns: this {@code OptionalFloat} if a value is present, otherwise the result of the supplying function
orElseZero(...) -> float
-
Signature:
public float orElseZero() - Summary: Returns the value if present, otherwise returns 0.
-
Contract:
- Returns the value if present, otherwise returns 0.
-
Parameters:
- (none)
- Returns: the value if present, otherwise 0
orElse(...) -> float
-
Signature:
public float orElse(final float other) - Summary: Returns the value if present, otherwise returns the given default value.
-
Contract:
- Returns the value if present, otherwise returns the given default value.
-
Parameters:
-
other(float) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> float
-
Signature:
public float orElseGet(final FloatSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(FloatSupplier) — a {@code FloatSupplier} whose result is returned if no value is present
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseThrow(...) -> float
-
Signature:
public float orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public float orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if no value is present
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the specified error message
-
-
Signature:
@Beta public float orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param(Object) — the parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public float orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to be substituted into the error message template -
param2(Object) — the second parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public float orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to be substituted into the error message template -
param2(Object) — the second parameter to be substituted into the error message template -
param3(Object) — the third parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public float orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
params(Object[]) — the parameters to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
public <E extends Throwable> float orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is {@code null} -
E— if no value is present
-
stream(...) -> FloatStream
-
Signature:
public FloatStream stream() - Summary: Returns a {@code FloatStream} containing the value if present, otherwise returns an empty stream.
-
Contract:
- Returns a {@code FloatStream} containing the value if present, otherwise returns an empty stream.
-
Parameters:
- (none)
- Returns: a {@code FloatStream} containing the value if present, otherwise an empty stream
toList(...) -> List<Float>
-
Signature:
public List<Float> toList() - Summary: Returns a {@code List} containing the value if present, otherwise returns an empty list.
-
Contract:
- Returns a {@code List} containing the value if present, otherwise returns an empty list.
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty list
toSet(...) -> Set<Float>
-
Signature:
public Set<Float> toSet() - Summary: Returns a {@code Set} containing the value if present, otherwise returns an empty set.
-
Contract:
- Returns a {@code Set} containing the value if present, otherwise returns an empty set.
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty set
toImmutableList(...) -> ImmutableList<Float>
-
Signature:
public ImmutableList<Float> toImmutableList() - Summary: Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<Float>
-
Signature:
public ImmutableSet<Float> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
boxed(...) -> Optional<Float>
-
Signature:
public Optional<Float> boxed() - Summary: Returns an {@code Optional<Float>} containing the boxed value if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional<Float>} containing the boxed value if present, otherwise returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional<Float>} containing the boxed value if present, otherwise an empty {@code Optional}
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalFloat optional) - Summary: Compares this {@code OptionalFloat} with the specified {@code OptionalFloat} for order.
-
Contract:
- If both are non-empty, their values are compared using {@code Float.compare} .
-
Parameters:
-
optional(OptionalFloat) — the {@code OptionalFloat} to be compared
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalFloat} is less than, equal to, or greater than the specified {@code OptionalFloat}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalFloat} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object, otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns {@code 0} (zero).
-
Contract:
- Returns the hash code of the value if present, otherwise returns {@code 0} (zero).
-
Parameters:
- (none)
- Returns: the hash code of the value if present, otherwise {@code 0}
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code OptionalFloat} .
-
Contract:
- If a value is present, the string representation is "OptionalFloat\[" followed by the value and "\]".
- If no value is present, the string representation is "OptionalFloat.empty".
-
Parameters:
- (none)
- Returns: a string representation of this {@code OptionalFloat}
Class OptionalDouble (com.landawn.abacus.util.u.OptionalDouble)
A container object which may or may not contain a double value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> OptionalDouble
-
Signature:
public static OptionalDouble empty() - Summary: Returns an empty {@code OptionalDouble} instance.
-
Parameters:
- (none)
- Returns: an empty {@code OptionalDouble}
of(...) -> OptionalDouble
-
Signature:
public static OptionalDouble of(final double value) - Summary: Returns an {@code OptionalDouble} containing the specified value.
-
Contract:
- When {@code value} is {@code 0.0} , the same cached instance is returned.
-
Parameters:
-
value(double) — the value to store
-
- Returns: an {@code OptionalDouble} containing the specified value
ofNullable(...) -> OptionalDouble
-
Signature:
public static OptionalDouble ofNullable(final Double value) - Summary: Returns an {@code OptionalDouble} containing the specified {@code Double} value, or an empty {@code OptionalDouble} if the value is {@code null} .
-
Contract:
- Returns an {@code OptionalDouble} containing the specified {@code Double} value, or an empty {@code OptionalDouble} if the value is {@code null} .
-
Parameters:
-
value(Double) — the {@code Double} value to store, possibly {@code null}
-
- Returns: an {@code OptionalDouble} containing the specified value if {@code non-null} , otherwise an empty {@code OptionalDouble}
from(...) -> OptionalDouble
-
Signature:
public static OptionalDouble from(final java.util.OptionalDouble optional) - Summary: Returns an {@code OptionalDouble} containing the value from the specified {@code java.util.OptionalDouble} if present, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- Returns an {@code OptionalDouble} containing the value from the specified {@code java.util.OptionalDouble} if present, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
optional(java.util.OptionalDouble) — the {@code java.util.OptionalDouble} to convert
-
- Returns: an {@code OptionalDouble} containing the value from the specified {@code java.util.OptionalDouble} if present, otherwise an empty {@code OptionalDouble}
Public Instance Methods
get(...) -> double
-
Signature:
public double get() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
getAsDouble(...) -> double
-
Signature:
@Deprecated public double getAsDouble() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
- See also: #get()
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble ifPresent(final Throwables.DoubleConsumer<E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.DoubleConsumer<E>) — the action to be performed if a value is present
-
- Returns: this {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> OptionalDouble
-
Signature:
public <E extends Exception, E2 extends Exception> OptionalDouble ifPresentOrElse(final Throwables.DoubleConsumer<E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.DoubleConsumer<E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble filter(final Throwables.DoublePredicate<E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code OptionalDouble} describing the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code OptionalDouble} describing the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — the predicate to apply to the value if present
-
- Returns: an {@code OptionalDouble} describing the value if present and matching the predicate, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble map(final Throwables.DoubleUnaryOperator<E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalDouble} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, returns an {@code OptionalDouble} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.DoubleUnaryOperator<E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalDouble} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<Double, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalInt} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, returns an {@code OptionalInt} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<Double, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalInt} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToLong(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLong(final Throwables.ToLongFunction<Double, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalLong} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- If a value is present, returns an {@code OptionalLong} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Parameters:
-
mapper(Throwables.ToLongFunction<Double, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalLong} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalLong}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToObj(...) -> Optional<T>
-
Signature:
public <T, E extends Exception> Optional<T> mapToObj(final Throwables.DoubleFunction<? extends T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.DoubleFunction<? extends T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code OptionalDouble} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapper function throws an exception
-
flatMap(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble flatMap(final Throwables.DoubleFunction<OptionalDouble, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns the result of applying the given {@code OptionalDouble} -bearing mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, returns the result of applying the given {@code OptionalDouble} -bearing mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.DoubleFunction<OptionalDouble, E>) — the mapping function to apply to the value if present
-
- Returns: the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
or(...) -> OptionalDouble
-
Signature:
public OptionalDouble or(final Supplier<OptionalDouble> supplier) - Summary: If a value is present, returns this {@code OptionalDouble} , otherwise returns the {@code OptionalDouble} produced by the supplying function.
-
Contract:
- If a value is present, returns this {@code OptionalDouble} , otherwise returns the {@code OptionalDouble} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<OptionalDouble>) — the supplying function that produces an {@code OptionalDouble} to be returned
-
- Returns: this {@code OptionalDouble} if a value is present, otherwise the {@code OptionalDouble} produced by the supplying function
orElseZero(...) -> double
-
Signature:
public double orElseZero() - Summary: Returns the value if present, otherwise returns {@code 0} .
-
Contract:
- Returns the value if present, otherwise returns {@code 0} .
-
Parameters:
- (none)
- Returns: the value if present, otherwise {@code 0}
orElse(...) -> double
-
Signature:
public double orElse(final double other) - Summary: Returns the value if present, otherwise returns the specified default value.
-
Contract:
- Returns the value if present, otherwise returns the specified default value.
-
Parameters:
-
other(double) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> double
-
Signature:
public double orElseGet(final DoubleSupplier supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(DoubleSupplier) — a {@code DoubleSupplier} whose result is returned if no value is present
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseThrow(...) -> double
-
Signature:
public double orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public double orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if no value is present
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the specified error message
-
-
Signature:
@Beta public double orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param(Object) — the parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public double orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to be substituted into the error message template -
param2(Object) — the second parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public double orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to be substituted into the error message template -
param2(Object) — the second parameter to be substituted into the error message template -
param3(Object) — the third parameter to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
@Beta public double orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} with a formatted error message.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
params(Object[]) — the parameters to be substituted into the error message template
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present, with the formatted error message
-
-
Signature:
public <E extends Throwable> double orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is {@code null} -
E— if no value is present
-
stream(...) -> DoubleStream
-
Signature:
public DoubleStream stream() - Summary: Returns a {@code DoubleStream} containing the value if present, otherwise returns an empty stream.
-
Contract:
- Returns a {@code DoubleStream} containing the value if present, otherwise returns an empty stream.
-
Parameters:
- (none)
- Returns: a {@code DoubleStream} containing the value if present, otherwise an empty stream
toList(...) -> List<Double>
-
Signature:
public List<Double> toList() - Summary: Returns a {@code List} containing the value if present, otherwise returns an empty list.
-
Contract:
- Returns a {@code List} containing the value if present, otherwise returns an empty list.
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty list
toSet(...) -> Set<Double>
-
Signature:
public Set<Double> toSet() - Summary: Returns a {@code Set} containing the value if present, otherwise returns an empty set.
-
Contract:
- Returns a {@code Set} containing the value if present, otherwise returns an empty set.
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty set
toImmutableList(...) -> ImmutableList<Double>
-
Signature:
public ImmutableList<Double> toImmutableList() - Summary: Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<Double>
-
Signature:
public ImmutableSet<Double> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
boxed(...) -> Optional<Double>
-
Signature:
public Optional<Double> boxed() - Summary: Returns an {@code Optional<Double>} containing the boxed value if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional<Double>} containing the boxed value if present, otherwise returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional<Double>} containing the boxed value if present, otherwise an empty {@code Optional}
toJdkOptional(...) -> java.util.OptionalDouble
-
Signature:
public java.util.OptionalDouble toJdkOptional() - Summary: Converts this {@code OptionalDouble} to a {@code java.util.OptionalDouble} .
-
Parameters:
- (none)
- Returns: a {@code java.util.OptionalDouble} containing the value if present, otherwise an empty {@code java.util.OptionalDouble}
__(...) -> java.util.OptionalDouble
-
Signature:
@Deprecated public java.util.OptionalDouble __() - Summary: Converts this {@code OptionalDouble} to a {@code java.util.OptionalDouble} .
-
Parameters:
- (none)
- Returns: a {@code java.util.OptionalDouble} containing the value if present, otherwise an empty {@code java.util.OptionalDouble}
- See also: #toJdkOptional()
compareTo(...) -> int
-
Signature:
@Override public int compareTo(final OptionalDouble optional) - Summary: Compares this {@code OptionalDouble} with the specified {@code OptionalDouble} for order.
-
Contract:
- If both are non-empty, their values are compared using {@code Double.compare} .
-
Parameters:
-
optional(OptionalDouble) — the {@code OptionalDouble} to be compared
-
- Returns: a negative integer, zero, or a positive integer as this {@code OptionalDouble} is less than, equal to, or greater than the specified {@code OptionalDouble}
equals(...) -> boolean
-
Signature:
@SuppressFBWarnings @Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code OptionalDouble} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object, otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value if present, otherwise returns {@code 0} (zero).
-
Contract:
- Returns the hash code of the value if present, otherwise returns {@code 0} (zero).
-
Parameters:
- (none)
- Returns: the hash code of the value if present, otherwise {@code 0}
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code OptionalDouble} .
-
Contract:
- If a value is present, the string representation is "OptionalDouble\[" followed by the value and "\]".
- If no value is present, the string representation is "OptionalDouble.empty".
-
Parameters:
- (none)
- Returns: a string representation of this {@code OptionalDouble}
Class Optional (com.landawn.abacus.util.u.Optional)
A container object which may or may not contain a {@code non-null} value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Optional<T>
-
Signature:
public static <T> Optional<T> empty() - Summary: Returns an empty {@code Optional} instance.
-
Parameters:
- (none)
- Returns: an empty {@code Optional}
of(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> of(final String value) throws NullPointerException - Summary: Returns an {@code Optional} containing the specified {@code non-null} value.
-
Parameters:
-
value(String) — the {@code non-null} value to store
-
- Returns: an {@code Optional} containing the specified value
-
Throws:
-
java.lang.NullPointerException— if value is null
-
-
Signature:
public static <T> Optional<T> of(final T value) throws NullPointerException - Summary: Returns an {@code Optional} containing the specified {@code non-null} value.
-
Parameters:
-
value(T) — the {@code non-null} value to store
-
- Returns: an {@code Optional} containing the specified value
-
Throws:
-
java.lang.NullPointerException— if value is null
-
ofNullable(...) -> Optional<String>
-
Signature:
@Beta public static Optional<String> ofNullable(final String value) - Summary: Returns an {@code Optional} containing the specified {@code String} value if {@code non-null} , otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional} containing the specified {@code String} value if {@code non-null} , otherwise returns an empty {@code Optional} .
-
Parameters:
-
value(String) — the possibly-null value to store
-
- Returns: an {@code Optional} containing the specified value if {@code non-null} , otherwise an empty {@code Optional}
-
Signature:
public static <T> Optional<T> ofNullable(final T value) - Summary: Returns an {@code Optional} containing the specified value if {@code non-null} , otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional} containing the specified value if {@code non-null} , otherwise returns an empty {@code Optional} .
-
Parameters:
-
value(T) — the possibly-null value to store
-
- Returns: an {@code Optional} containing the specified value if {@code non-null} , otherwise an empty {@code Optional}
from(...) -> Optional<T>
-
Signature:
public static <T> Optional<T> from(final java.util.Optional<T> optional) - Summary: Returns an {@code Optional} containing the value from the specified {@code java.util.Optional} if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns an {@code Optional} containing the value from the specified {@code java.util.Optional} if present, otherwise returns an empty {@code Optional} .
-
Parameters:
-
optional(java.util.Optional<T>) — the {@code java.util.Optional} to convert, possibly {@code null}
-
- Returns: an {@code Optional} containing the value from the specified {@code java.util.Optional} if present, otherwise an empty {@code Optional}
Public Instance Methods
get(...) -> T
-
Signature:
public T get() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
public boolean isEmpty() - Summary: Returns {@code true} if no value is present, otherwise {@code false} .
-
Contract:
- Returns {@code true} if no value is present, otherwise {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
ifPresent(...) -> Optional<T>
-
Signature:
public <E extends Exception> Optional<T> ifPresent(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a value is present
-
- Returns: this {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> Optional<T>
-
Signature:
public <E extends Exception, E2 extends Exception> Optional<T> ifPresentOrElse(final Throwables.Consumer<? super T, E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> Optional<T>
-
Signature:
public <E extends Exception> Optional<T> filter(final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: If a value is present, and the value matches the given predicate, returns an {@code Optional} describing the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, and the value matches the given predicate, returns an {@code Optional} describing the value, otherwise returns an empty {@code Optional} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to the value if present
-
- Returns: an {@code Optional} describing the value if present and matching the predicate, otherwise an empty {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> Optional<U>
-
Signature:
public <U, E extends Exception> Optional<U> map(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} describing (as if by {@link Optional#ofNullable} ) the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code Optional} describing the result of applying a mapping function to the value of this {@code Optional} , if a value is present, otherwise an empty {@code Optional} . If the mapping function returns a {@code null} result, an empty {@code Optional} is returned.
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToBoolean(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean mapToBoolean(final Throwables.ToBooleanFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalBoolean} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, returns an {@code OptionalBoolean} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.ToBooleanFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalBoolean} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToChar(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar mapToChar(final Throwables.ToCharFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalChar} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, returns an {@code OptionalChar} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.ToCharFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalChar} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToByte(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte mapToByte(final Throwables.ToByteFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalByte} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- If a value is present, returns an {@code OptionalByte} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Parameters:
-
mapper(Throwables.ToByteFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalByte} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToShort(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort mapToShort(final Throwables.ToShortFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalShort} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- If a value is present, returns an {@code OptionalShort} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Parameters:
-
mapper(Throwables.ToShortFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalShort} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalInt} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, returns an {@code OptionalInt} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalInt} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToLong(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLong(final Throwables.ToLongFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalLong} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- If a value is present, returns an {@code OptionalLong} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Parameters:
-
mapper(Throwables.ToLongFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalLong} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalLong}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToFloat(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat mapToFloat(final Throwables.ToFloatFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalFloat} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- If a value is present, returns an {@code OptionalFloat} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Parameters:
-
mapper(Throwables.ToFloatFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalFloat} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalDouble} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, returns an {@code OptionalDouble} describing the result of applying the given mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalDouble} describing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
flatMap(...) -> Optional<U>
-
Signature:
public <U, E extends Exception> Optional<U> flatMap(final Throwables.Function<? super T, Optional<U>, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns the result of applying the given {@code Optional} -bearing mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns the result of applying the given {@code Optional} -bearing mapping function to the value, otherwise returns an empty {@code Optional} .
-
Parameters:
-
mapper(Throwables.Function<? super T, Optional<U>, E>) — the mapping function to apply to the value if present
-
- Returns: the result of applying the mapping function to the value if present, otherwise an empty {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
contains(...) -> boolean
-
Signature:
public boolean contains(final T valueToFind) - Summary: Returns {@code true} if a value is present and the value equals the specified value, otherwise {@code false} .
-
Contract:
- Returns {@code true} if a value is present and the value equals the specified value, otherwise {@code false} .
-
Parameters:
-
valueToFind(T) — the value to check for equality
-
- Returns: {@code true} if a value is present and equals the specified value, otherwise {@code false}
or(...) -> Optional<T>
-
Signature:
public Optional<T> or(final Supplier<? extends Optional<? extends T>> supplier) throws IllegalArgumentException - Summary: If a value is present, returns this {@code Optional} , otherwise returns the {@code Optional} produced by the supplying function.
-
Contract:
- If a value is present, returns this {@code Optional} , otherwise returns the {@code Optional} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends Optional<? extends T>>) — the supplying function that produces an {@code Optional} to be returned
-
- Returns: this {@code Optional} if a value is present, otherwise the {@code Optional} produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException
-
orElseNull(...) -> T
-
Signature:
@Beta public T orElseNull() - Summary: Returns the value if present, otherwise returns {@code null} .
-
Contract:
- Returns the value if present, otherwise returns {@code null} .
-
Parameters:
- (none)
- Returns: the value if present, otherwise {@code null}
orElse(...) -> T
-
Signature:
public T orElse(final T other) - Summary: Returns the value if present, otherwise returns the specified default value.
-
Contract:
- Returns the value if present, otherwise returns the specified default value.
-
Parameters:
-
other(T) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise {@code other}
orElseGet(...) -> T
-
Signature:
public T orElseGet(final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends T>) — the supplying function that produces a value to be returned
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseThrow(...) -> T
-
Signature:
public T orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Contract:
- If a value is present, returns the value, otherwise throws {@code NoSuchElementException} with the given error message.
-
Parameters:
-
errorMessage(String) — the message to be used in the exception, if no value is present
-
- Returns: the value described by this {@code Optional}
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param(Object) — the parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message -
param3(Object) — the third parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
params(Object[]) — the parameters to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> T orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is {@code null} -
E— if no value is present
-
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Returns a {@code Stream} containing only the value if present, otherwise returns an empty {@code Stream} .
-
Contract:
- Returns a {@code Stream} containing only the value if present, otherwise returns an empty {@code Stream} .
-
Parameters:
- (none)
- Returns: a {@code Stream} containing the value if present, otherwise an empty {@code Stream}
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Returns a {@code List} containing the value if present, otherwise returns an empty {@code List} .
-
Contract:
- Returns a {@code List} containing the value if present, otherwise returns an empty {@code List} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty {@code List}
toSet(...) -> Set<T>
-
Signature:
public Set<T> toSet() - Summary: Returns a {@code Set} containing the value if present, otherwise returns an empty {@code Set} .
-
Contract:
- Returns a {@code Set} containing the value if present, otherwise returns an empty {@code Set} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty {@code Set}
toImmutableList(...) -> ImmutableList<T>
-
Signature:
public ImmutableList<T> toImmutableList() - Summary: Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing the value if present, otherwise returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<T>
-
Signature:
public ImmutableSet<T> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing the value if present, otherwise returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
toJdkOptional(...) -> java.util.Optional<T>
-
Signature:
public java.util.Optional<T> toJdkOptional() - Summary: Converts this {@code Optional} to a {@code java.util.Optional} .
-
Contract:
- Returns a {@code java.util.Optional} containing the value if present, otherwise returns an empty {@code java.util.Optional} .
-
Parameters:
- (none)
- Returns: a {@code java.util.Optional} containing the value if present, otherwise an empty {@code java.util.Optional}
__(...) -> java.util.Optional<T>
-
Signature:
@Deprecated public java.util.Optional<T> __() - Summary: Converts this {@code Optional} to a {@code java.util.Optional} .
-
Parameters:
- (none)
- Returns: a {@code java.util.Optional} containing the value if present, otherwise an empty {@code java.util.Optional}
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code Optional} .
-
Parameters:
-
obj(Object) — an object to be tested for equality
-
- Returns: {@code true} if the other object is "equal to" this object otherwise {@code false}
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of the value, if present, otherwise 0 (zero) if no value is present.
-
Contract:
- Returns the hash code of the value, if present, otherwise 0 (zero) if no value is present.
-
Parameters:
- (none)
- Returns: hash code value of the present value or 0 if no value is present
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a non-empty string representation of this {@code Optional} suitable for debugging.
-
Parameters:
- (none)
- Returns: the string representation of this instance
Class Nullable (com.landawn.abacus.util.u.Nullable)
A container object that may hold either a {@code null} or {@code non-null} value.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> empty() - Summary: Returns an empty {@code Nullable} instance.
-
Parameters:
- (none)
- Returns: an empty {@code Nullable}
of(...) -> Nullable<String>
-
Signature:
public static Nullable<String> of(final String value) - Summary: Returns a {@code Nullable} containing the specified {@code String} value.
-
Parameters:
-
value(String) — the value to be present, which may be {@code null}
-
- Returns: a {@code Nullable} containing the value
-
Signature:
public static <T> Nullable<T> of(final T value) - Summary: Returns a {@code Nullable} containing the specified value.
-
Parameters:
-
value(T) — the value to be present, which may be {@code null}
-
- Returns: a {@code Nullable} containing the value
from(...) -> Nullable<T>
-
Signature:
public static <T> Nullable<T> from(final Optional<T> optional) - Summary: Returns a {@code Nullable} containing the value from the specified {@code Optional} if present, otherwise returns an empty {@code Nullable} .
-
Contract:
- Returns a {@code Nullable} containing the value from the specified {@code Optional} if present, otherwise returns an empty {@code Nullable} .
-
Parameters:
-
optional(Optional<T>) — the {@code Optional} to convert
-
- Returns: a {@code Nullable} containing the value if present in the {@code Optional} , otherwise an empty {@code Nullable}
-
Signature:
public static <T> Nullable<T> from(final java.util.Optional<T> optional) - Summary: Returns a {@code Nullable} containing the value from the specified {@code java.util.Optional} if present, otherwise returns an empty {@code Nullable} .
-
Contract:
- Returns a {@code Nullable} containing the value from the specified {@code java.util.Optional} if present, otherwise returns an empty {@code Nullable} .
-
Parameters:
-
optional(java.util.Optional<T>) — the {@code java.util.Optional} to convert, must not be {@code null}
-
- Returns: a {@code Nullable} containing the value if present in the {@code java.util.Optional} , otherwise an empty {@code Nullable}
Public Instance Methods
get(...) -> T
-
Signature:
public T get() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
isPresent(...) -> boolean
-
Signature:
public boolean isPresent() - Summary: Returns {@code true} if a value has been set (even if {@code null} ), otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if a value has been set (even if {@code null} ), otherwise returns {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a value is present, otherwise {@code false}
isNotPresent(...) -> boolean
-
Signature:
public boolean isNotPresent() - Summary: Returns {@code true} if no value has been set, otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if no value has been set, otherwise returns {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
isEmpty(...) -> boolean
-
Signature:
@Deprecated public boolean isEmpty() - Summary: Returns {@code true} if no value has been set, otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if no value has been set, otherwise returns {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if no value is present, otherwise {@code false}
isNull(...) -> boolean
-
Signature:
public boolean isNull() - Summary: Returns {@code true} if no value is present or the value is present but is {@code null} , otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if no value is present or the value is present but is {@code null} , otherwise returns {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if the value is {@code null} or not present, otherwise {@code false}
isNotNull(...) -> boolean
-
Signature:
public boolean isNotNull() - Summary: Returns {@code true} if a value is present and it is not {@code null} , otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if a value is present and it is not {@code null} , otherwise returns {@code false} .
-
Parameters:
- (none)
- Returns: {@code true} if a {@code non-null} value is present, otherwise {@code false}
ifPresent(...) -> Nullable<T>
-
Signature:
public <E extends Exception> Nullable<T> ifPresent(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: If a value is present, performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present, performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a value is present
-
- Returns: this {@code Nullable} instance
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifPresentOrElse(...) -> Nullable<T>
-
Signature:
public <E extends Exception, E2 extends Exception> Nullable<T> ifPresentOrElse(final Throwables.Consumer<? super T, E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if no value is present
-
- Returns: this {@code Nullable} instance
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
ifNotNull(...) -> Nullable<T>
-
Signature:
public <E extends Exception> Nullable<T> ifNotNull(final Throwables.Consumer<? super T, E> action) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , performs the given action with the value, otherwise does nothing.
-
Contract:
- If a value is present and is not {@code null} , performs the given action with the value, otherwise does nothing.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a {@code non-null} value is present
-
- Returns: this {@code Nullable} instance
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} is {@code null} -
E— if the action throws an exception
-
ifNotNullOrElse(...) -> Nullable<T>
-
Signature:
public <E extends Exception, E2 extends Exception> Nullable<T> ifNotNullOrElse(final Throwables.Consumer<? super T, E> action, final Throwables.Runnable<E2> emptyAction) throws IllegalArgumentException, E, E2 - Summary: If a value is present and is not {@code null} , performs the given action with the value, otherwise performs the given empty-based action.
-
Contract:
- If a value is present and is not {@code null} , performs the given action with the value, otherwise performs the given empty-based action.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed if a {@code non-null} value is present -
emptyAction(Throwables.Runnable<E2>) — the empty-based action to be performed if the value is {@code null} or not present
-
- Returns: this {@code Nullable} instance
-
Throws:
-
java.lang.IllegalArgumentException— if {@code action} or {@code emptyAction} is {@code null} -
E— if the action throws an exception -
E2— if the empty action throws an exception
-
filter(...) -> Nullable<T>
-
Signature:
public <E extends Exception> Nullable<T> filter(final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: If a value is present and matches the given predicate, returns this {@code Nullable} , otherwise returns an empty {@code Nullable} .
-
Contract:
- If a value is present and matches the given predicate, returns this {@code Nullable} , otherwise returns an empty {@code Nullable} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to the value if present
-
- Returns: this {@code Nullable} if the value is present and matches the predicate, otherwise an empty {@code Nullable}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
filterIfNotNull(...) -> Optional<T>
-
Signature:
public <E extends Exception> Optional<T> filterIfNotNull(final Throwables.Predicate<? super T, E> predicate) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , and matches the given predicate, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present and is not {@code null} , and matches the given predicate, returns an {@code Optional} containing the value, otherwise returns an empty {@code Optional} .
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to the value if it is not {@code null}
-
- Returns: an {@code Optional} containing the value if it is not {@code null} and matches the predicate, otherwise an empty {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code predicate} is {@code null} -
E— if the predicate throws an exception
-
map(...) -> Nullable<U>
-
Signature:
public <U, E extends Exception> Nullable<U> map(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns a {@code Nullable} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Nullable} .
-
Contract:
- If a value is present, returns a {@code Nullable} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Nullable} .
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value if present
-
- Returns: a {@code Nullable} containing the result of applying the mapping function to the value if present, otherwise an empty {@code Nullable}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToNonNull(...) -> Optional<U>
-
Signature:
public <U, E extends Exception> Optional<U> mapToNonNull(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, NullPointerException, E - Summary: If a value is present, returns an {@code Optional} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present, returns an {@code Optional} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- The mapping function must not return {@code null} .
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value if present, must not return {@code null}
-
- Returns: an {@code Optional} containing the result of applying the mapping function to the value if present, otherwise an empty {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
java.lang.NullPointerException— if the mapping function returns {@code null} -
E— if the mapping function throws an exception
-
mapToBoolean(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean mapToBoolean(final Throwables.ToBooleanFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalBoolean} containing the result of applying the given boolean-valued mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present, returns an {@code OptionalBoolean} containing the result of applying the given boolean-valued mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.ToBooleanFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalBoolean} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToChar(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar mapToChar(final Throwables.ToCharFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalChar} containing the result of applying the given char-valued mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present, returns an {@code OptionalChar} containing the result of applying the given char-valued mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.ToCharFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalChar} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToByte(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte mapToByte(final Throwables.ToByteFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalByte} containing the result of applying the given byte-valued mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- If a value is present, returns an {@code OptionalByte} containing the result of applying the given byte-valued mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Parameters:
-
mapper(Throwables.ToByteFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalByte} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToShort(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort mapToShort(final Throwables.ToShortFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalShort} containing the result of applying the given short-valued mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- If a value is present, returns an {@code OptionalShort} containing the result of applying the given short-valued mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Parameters:
-
mapper(Throwables.ToShortFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalShort} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToInt(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToInt(final Throwables.ToIntFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalInt} containing the result of applying the given int-valued mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present, returns an {@code OptionalInt} containing the result of applying the given int-valued mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalInt} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToLong(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLong(final Throwables.ToLongFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalLong} containing the result of applying the given long-valued mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- If a value is present, returns an {@code OptionalLong} containing the result of applying the given long-valued mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Parameters:
-
mapper(Throwables.ToLongFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalLong} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalLong}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToFloat(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat mapToFloat(final Throwables.ToFloatFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalFloat} containing the result of applying the given float-valued mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- If a value is present, returns an {@code OptionalFloat} containing the result of applying the given float-valued mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Parameters:
-
mapper(Throwables.ToFloatFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalFloat} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToDouble(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDouble(final Throwables.ToDoubleFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, returns an {@code OptionalDouble} containing the result of applying the given double-valued mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present, returns an {@code OptionalDouble} containing the result of applying the given double-valued mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<? super T, E>) — the mapping function to apply to the value if present
-
- Returns: an {@code OptionalDouble} containing the result of applying the mapping function to the value if present, otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapIfNotNull(...) -> Nullable<U>
-
Signature:
public <U, E extends Exception> Nullable<U> mapIfNotNull(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns a {@code Nullable} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Nullable} .
-
Contract:
- If a value is present and is not {@code null} , returns a {@code Nullable} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Nullable} .
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: a {@code Nullable} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code Nullable}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToNonNullIfNotNull(...) -> Optional<U>
-
Signature:
public <U, E extends Exception> Optional<U> mapToNonNullIfNotNull(final Throwables.Function<? super T, ? extends U, E> mapper) throws IllegalArgumentException, NullPointerException, E - Summary: If a value is present and is not {@code null} , returns an {@code Optional} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code Optional} containing the result of applying the given mapping function to the value, otherwise returns an empty {@code Optional} .
- The mapping function must not return {@code null} .
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends U, E>) — the mapping function to apply to the value if it is not {@code null} , must not return {@code null}
-
- Returns: an {@code Optional} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
java.lang.NullPointerException— if the mapping function returns {@code null} -
E— if the mapping function throws an exception
-
mapToBooleanIfNotNull(...) -> OptionalBoolean
-
Signature:
public <E extends Exception> OptionalBoolean mapToBooleanIfNotNull(final Throwables.ToBooleanFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalBoolean} containing the result of applying the given boolean-valued mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalBoolean} containing the result of applying the given boolean-valued mapping function to the value, otherwise returns an empty {@code OptionalBoolean} .
-
Parameters:
-
mapper(Throwables.ToBooleanFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalBoolean} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalBoolean}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToCharIfNotNull(...) -> OptionalChar
-
Signature:
public <E extends Exception> OptionalChar mapToCharIfNotNull(final Throwables.ToCharFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalChar} containing the result of applying the given char-valued mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalChar} containing the result of applying the given char-valued mapping function to the value, otherwise returns an empty {@code OptionalChar} .
-
Parameters:
-
mapper(Throwables.ToCharFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalChar} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalChar}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToByteIfNotNull(...) -> OptionalByte
-
Signature:
public <E extends Exception> OptionalByte mapToByteIfNotNull(final Throwables.ToByteFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalByte} containing the result of applying the given byte-valued mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalByte} containing the result of applying the given byte-valued mapping function to the value, otherwise returns an empty {@code OptionalByte} .
-
Parameters:
-
mapper(Throwables.ToByteFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalByte} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalByte}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToShortIfNotNull(...) -> OptionalShort
-
Signature:
public <E extends Exception> OptionalShort mapToShortIfNotNull(final Throwables.ToShortFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalShort} containing the result of applying the given short-valued mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalShort} containing the result of applying the given short-valued mapping function to the value, otherwise returns an empty {@code OptionalShort} .
-
Parameters:
-
mapper(Throwables.ToShortFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalShort} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalShort}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToIntIfNotNull(...) -> OptionalInt
-
Signature:
public <E extends Exception> OptionalInt mapToIntIfNotNull(final Throwables.ToIntFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalInt} containing the result of applying the given int-valued mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalInt} containing the result of applying the given int-valued mapping function to the value, otherwise returns an empty {@code OptionalInt} .
-
Parameters:
-
mapper(Throwables.ToIntFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalInt} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalInt}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToLongIfNotNull(...) -> OptionalLong
-
Signature:
public <E extends Exception> OptionalLong mapToLongIfNotNull(final Throwables.ToLongFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalLong} containing the result of applying the given long-valued mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalLong} containing the result of applying the given long-valued mapping function to the value, otherwise returns an empty {@code OptionalLong} .
-
Parameters:
-
mapper(Throwables.ToLongFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalLong} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalLong}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToFloatIfNotNull(...) -> OptionalFloat
-
Signature:
public <E extends Exception> OptionalFloat mapToFloatIfNotNull(final Throwables.ToFloatFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalFloat} containing the result of applying the given float-valued mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalFloat} containing the result of applying the given float-valued mapping function to the value, otherwise returns an empty {@code OptionalFloat} .
-
Parameters:
-
mapper(Throwables.ToFloatFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalFloat} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalFloat}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
mapToDoubleIfNotNull(...) -> OptionalDouble
-
Signature:
public <E extends Exception> OptionalDouble mapToDoubleIfNotNull(final Throwables.ToDoubleFunction<? super T, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , returns an {@code OptionalDouble} containing the result of applying the given double-valued mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- If a value is present and is not {@code null} , returns an {@code OptionalDouble} containing the result of applying the given double-valued mapping function to the value, otherwise returns an empty {@code OptionalDouble} .
-
Parameters:
-
mapper(Throwables.ToDoubleFunction<? super T, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: an {@code OptionalDouble} containing the result of applying the mapping function to the value if it is not {@code null} , otherwise an empty {@code OptionalDouble}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
flatMap(...) -> Nullable<U>
-
Signature:
public <U, E extends Exception> Nullable<U> flatMap(final Throwables.Function<? super T, Nullable<U>, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present, applies the {@code Nullable} -bearing mapping function to it, and returns that result, otherwise returns an empty {@code Nullable} .
-
Contract:
- If a value is present, applies the {@code Nullable} -bearing mapping function to it, and returns that result, otherwise returns an empty {@code Nullable} .
- This method is similar to {@link #map(Throwables.Function)} , but the mapping function is one whose result is already a {@code Nullable} , and if invoked, {@code flatMap} does not wrap it within an additional {@code Nullable} .
-
Parameters:
-
mapper(Throwables.Function<? super T, Nullable<U>, E>) — the mapping function to apply to the value if present
-
- Returns: the result of applying a {@code Nullable} -bearing mapping function to the value of this {@code Nullable} , if a value is present, otherwise an empty {@code Nullable}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
flatMapIfNotNull(...) -> Nullable<U>
-
Signature:
public <U, E extends Exception> Nullable<U> flatMapIfNotNull(final Throwables.Function<? super T, Nullable<U>, E> mapper) throws IllegalArgumentException, E - Summary: If a value is present and is not {@code null} , applies the {@code Nullable} -bearing mapping function to it, and returns that result, otherwise returns an empty {@code Nullable} .
-
Contract:
- If a value is present and is not {@code null} , applies the {@code Nullable} -bearing mapping function to it, and returns that result, otherwise returns an empty {@code Nullable} .
- This method is similar to {@link #mapIfNotNull(Throwables.Function)} , but the mapping function is one whose result is already a {@code Nullable} , and if invoked, {@code flatMapIfNotNull} does not wrap it within an additional {@code Nullable} .
-
Parameters:
-
mapper(Throwables.Function<? super T, Nullable<U>, E>) — the mapping function to apply to the value if it is not {@code null}
-
- Returns: the result of applying a {@code Nullable} -bearing mapping function to the value of this {@code Nullable} , if the value is not {@code null} , otherwise an empty {@code Nullable}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code mapper} is {@code null} -
E— if the mapping function throws an exception
-
contains(...) -> boolean
-
Signature:
public boolean contains(final T valueToFind) - Summary: Returns {@code true} if a value is present and equals the specified value, otherwise returns {@code false} .
-
Contract:
- Returns {@code true} if a value is present and equals the specified value, otherwise returns {@code false} .
-
Parameters:
-
valueToFind(T) — the value to check for equality
-
- Returns: {@code true} if a value is present and equals the specified value, otherwise {@code false}
or(...) -> Nullable<T>
-
Signature:
public Nullable<T> or(final Supplier<? extends Nullable<? extends T>> supplier) throws IllegalArgumentException - Summary: Returns this {@code Nullable} if a value is present, otherwise returns the {@code Nullable} produced by the supplying function.
-
Contract:
- Returns this {@code Nullable} if a value is present, otherwise returns the {@code Nullable} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends Nullable<? extends T>>) — the supplying function that produces a {@code Nullable} to be returned
-
- Returns: this {@code Nullable} if a value is present, otherwise the {@code Nullable} produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException
-
orIfNull(...) -> Nullable<T>
-
Signature:
public Nullable<T> orIfNull(final Supplier<? extends Nullable<? extends T>> supplier) throws IllegalArgumentException - Summary: Returns this {@code Nullable} if the value is not {@code null} , otherwise returns the {@code Nullable} produced by the supplying function.
-
Contract:
- Returns this {@code Nullable} if the value is not {@code null} , otherwise returns the {@code Nullable} produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends Nullable<? extends T>>) — the supplying function that produces a {@code Nullable} to be returned
-
- Returns: this {@code Nullable} if the value is not {@code null} , otherwise the {@code Nullable} produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseNull(...) -> T
-
Signature:
@Beta public T orElseNull() - Summary: Returns the value if present, otherwise returns {@code null} .
-
Contract:
- Returns the value if present, otherwise returns {@code null} .
-
Parameters:
- (none)
- Returns: the value if present, otherwise {@code null}
- See also: #orElse(Object)
orElse(...) -> T
-
Signature:
public T orElse(final T other) - Summary: Returns the value if present, otherwise returns the specified default value.
-
Contract:
- Returns the value if present, otherwise returns the specified default value.
-
Parameters:
-
other(T) — the value to be returned if no value is present
-
- Returns: the value if present, otherwise the specified default value
orElseIfNull(...) -> T
-
Signature:
public T orElseIfNull(final T other) - Summary: Returns the value if it is not {@code null} , otherwise returns the specified default value.
-
Contract:
- Returns the value if it is not {@code null} , otherwise returns the specified default value.
-
Parameters:
-
other(T) — the value to be returned if the value is {@code null}
-
- Returns: the value if it is not {@code null} , otherwise the specified default value
orElseGet(...) -> T
-
Signature:
public T orElseGet(final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Returns the value if present, otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if present, otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends T>) — the supplying function that produces a value to be returned
-
- Returns: the value if present, otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseGetIfNull(...) -> T
-
Signature:
public T orElseGetIfNull(final Supplier<? extends T> supplier) throws IllegalArgumentException - Summary: Returns the value if it is not {@code null} , otherwise returns the result produced by the supplying function.
-
Contract:
- Returns the value if it is not {@code null} , otherwise returns the result produced by the supplying function.
-
Parameters:
-
supplier(Supplier<? extends T>) — the supplying function that produces a value to be returned
-
- Returns: the value if it is not {@code null} , otherwise the result produced by the supplying function
-
Throws:
-
java.lang.IllegalArgumentException— if {@code supplier} is {@code null}
-
orElseThrow(...) -> T
-
Signature:
public T orElseThrow() throws NoSuchElementException - Summary: Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if present, otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if no value is present
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param(Object) — the parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message -
param3(Object) — the third parameter to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
@Beta public T orElseThrow(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if present, otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if no value is present -
params(Object[]) — the parameters to format into the error message
-
- Returns: the value if present
-
Throws:
-
java.util.NoSuchElementException— if no value is present
-
-
Signature:
public <E extends Throwable> T orElseThrow(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if present, otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if present
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is {@code null} -
E— if no value is present
-
orElseThrowIfNull(...) -> T
-
Signature:
public T orElseThrowIfNull() throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} .
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws {@code NoSuchElementException} .
-
Parameters:
- (none)
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message.
-
Parameters:
-
errorMessage(String) — the error message to use if the value is {@code null}
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameter.
-
Parameters:
-
errorMessage(String) — the error message template to use if the value is {@code null} -
param(Object) — the parameter to format into the error message
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param1, final Object param2) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if the value is {@code null} -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object param1, final Object param2, final Object param3) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if the value is {@code null} -
param1(Object) — the first parameter to format into the error message -
param2(Object) — the second parameter to format into the error message -
param3(Object) — the third parameter to format into the error message
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
@Beta public T orElseThrowIfNull(final String errorMessage, final Object... params) throws NoSuchElementException - Summary: Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws a {@code NoSuchElementException} with the specified error message formatted with the given parameters.
-
Parameters:
-
errorMessage(String) — the error message template to use if the value is {@code null} -
params(Object[]) — the parameters to format into the error message
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.util.NoSuchElementException— if the value is {@code null}
-
-
Signature:
public <E extends Throwable> T orElseThrowIfNull(final Supplier<? extends E> exceptionSupplier) throws IllegalArgumentException, E - Summary: Returns the value if it is not {@code null} , otherwise throws an exception produced by the exception supplying function.
-
Contract:
- Returns the value if it is not {@code null} , otherwise throws an exception produced by the exception supplying function.
-
Parameters:
-
exceptionSupplier(Supplier<? extends E>) — the supplying function that produces an exception to be thrown
-
- Returns: the value if it is not {@code null}
-
Throws:
-
java.lang.IllegalArgumentException— if {@code exceptionSupplier} is {@code null} -
E— if the value is {@code null}
-
stream(...) -> Stream<T>
-
Signature:
public Stream<T> stream() - Summary: Returns a {@code Stream} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code Stream} .
-
Contract:
- Returns a {@code Stream} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code Stream} .
- If the {@code Nullable} is empty (not present), an empty stream is returned.
- If the {@code Nullable} contains a value (including {@code null} ), a stream containing that single value is returned.
-
Parameters:
- (none)
- Returns: a {@code Stream} containing the value if present, otherwise an empty {@code Stream}
streamIfNotNull(...) -> Stream<T>
-
Signature:
public Stream<T> streamIfNotNull() - Summary: Returns a {@code Stream} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code Stream} .
-
Contract:
- Returns a {@code Stream} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code Stream} .
- <p> This method differs from {@link #stream()} in that it returns an empty stream both when the {@code Nullable} is empty and when it contains a {@code null} value.
- A stream with the value is only returned when the {@code Nullable} contains a {@code non-null} value.
-
Parameters:
- (none)
- Returns: a {@code Stream} containing the value if not {@code null} , otherwise an empty {@code Stream}
toList(...) -> List<T>
-
Signature:
public List<T> toList() - Summary: Returns a {@code List} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code List} .
-
Contract:
- Returns a {@code List} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code List} .
- <p> If the {@code Nullable} contains a value (including {@code null} ), returns a list containing that single value.
- If the {@code Nullable} is empty (not present), returns an empty {@code ArrayList} .
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if present, otherwise an empty {@code List}
toListIfNotNull(...) -> List<T>
-
Signature:
public List<T> toListIfNotNull() - Summary: Returns a {@code List} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code List} .
-
Contract:
- Returns a {@code List} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code List} .
- <p> This method differs from {@link #toList()} in that it returns an empty list both when the {@code Nullable} is empty and when it contains a {@code null} value.
- A list with the value is only returned when the {@code Nullable} contains a {@code non-null} value.
-
Parameters:
- (none)
- Returns: a {@code List} containing the value if not {@code null} , otherwise an empty {@code List}
toSet(...) -> Set<T>
-
Signature:
public Set<T> toSet() - Summary: Returns a {@code Set} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code Set} .
-
Contract:
- Returns a {@code Set} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code Set} .
- <p> If the {@code Nullable} contains a value (including {@code null} ), returns a set containing that single value.
- If the {@code Nullable} is empty (not present), returns an empty {@code HashSet} .
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if present, otherwise an empty {@code Set}
toSetIfNotNull(...) -> Set<T>
-
Signature:
public Set<T> toSetIfNotNull() - Summary: Returns a {@code Set} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code Set} .
-
Contract:
- Returns a {@code Set} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code Set} .
- <p> This method differs from {@link #toSet()} in that it returns an empty set both when the {@code Nullable} is empty and when it contains a {@code null} value.
- A set with the value is only returned when the {@code Nullable} contains a {@code non-null} value.
-
Parameters:
- (none)
- Returns: a {@code Set} containing the value if not {@code null} , otherwise an empty {@code Set}
toImmutableList(...) -> ImmutableList<T>
-
Signature:
public ImmutableList<T> toImmutableList() - Summary: Returns an {@code ImmutableList} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code ImmutableList} .
- <p> If the {@code Nullable} contains a value (including {@code null} ), returns an immutable list containing that single value.
- If the {@code Nullable} is empty (not present), returns an empty {@code ImmutableList} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if present, otherwise an empty {@code ImmutableList}
toImmutableListIfNotNull(...) -> ImmutableList<T>
-
Signature:
public ImmutableList<T> toImmutableListIfNotNull() - Summary: Returns an {@code ImmutableList} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code ImmutableList} .
-
Contract:
- Returns an {@code ImmutableList} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code ImmutableList} .
- <p> This method differs from {@link #toImmutableList()} in that it returns an empty immutable list both when the {@code Nullable} is empty and when it contains a {@code null} value.
- An immutable list with the value is only returned when the {@code Nullable} contains a {@code non-null} value.
-
Parameters:
- (none)
- Returns: an {@code ImmutableList} containing the value if not {@code null} , otherwise an empty {@code ImmutableList}
toImmutableSet(...) -> ImmutableSet<T>
-
Signature:
public ImmutableSet<T> toImmutableSet() - Summary: Returns an {@code ImmutableSet} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing the value of this {@code Nullable} if a value is present, otherwise returns an empty {@code ImmutableSet} .
- <p> If the {@code Nullable} contains a value (including {@code null} ), returns an immutable set containing that single value.
- If the {@code Nullable} is empty (not present), returns an empty {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if present, otherwise an empty {@code ImmutableSet}
toImmutableSetIfNotNull(...) -> ImmutableSet<T>
-
Signature:
public ImmutableSet<T> toImmutableSetIfNotNull() - Summary: Returns an {@code ImmutableSet} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code ImmutableSet} .
-
Contract:
- Returns an {@code ImmutableSet} containing the value of this {@code Nullable} if the value is not {@code null} , otherwise returns an empty {@code ImmutableSet} .
- <p> This method differs from {@link #toImmutableSet()} in that it returns an empty immutable set both when the {@code Nullable} is empty and when it contains a {@code null} value.
- An immutable set with the value is only returned when the {@code Nullable} contains a {@code non-null} value.
-
Parameters:
- (none)
- Returns: an {@code ImmutableSet} containing the value if not {@code null} , otherwise an empty {@code ImmutableSet}
toOptional(...) -> Optional<T>
-
Signature:
public Optional<T> toOptional() - Summary: Converts this {@code Nullable} to an {@code Optional} .
-
Contract:
- <p> If this {@code Nullable} contains a {@code non-null} value, returns an {@code Optional} containing that value.
- If this {@code Nullable} is empty or contains a {@code null} value, returns an empty {@code Optional} .
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the value if present and not {@code null} , otherwise an empty {@code Optional}
toJdkOptional(...) -> java.util.Optional<T>
-
Signature:
public java.util.Optional<T> toJdkOptional() - Summary: Converts this {@code Nullable} to a {@code java.util.Optional} .
-
Contract:
- <p> If this {@code Nullable} contains a {@code non-null} value, returns a {@code java.util.Optional} containing that value.
- If this {@code Nullable} is empty or contains a {@code null} value, returns an empty {@code java.util.Optional} .
-
Parameters:
- (none)
- Returns: a {@code java.util.Optional} containing the value if present and not {@code null} , otherwise an empty {@code java.util.Optional}
equals(...) -> boolean
-
Signature:
@Override public boolean equals(final Object obj) - Summary: Indicates whether some other object is "equal to" this {@code Nullable} .
-
Parameters:
-
obj(Object) — the object to be tested for equality
-
- Returns: {@code true} if the other object is a {@code Nullable} and both instances have the same presence state and equal values; {@code false} otherwise
hashCode(...) -> int
-
Signature:
@Override public int hashCode() - Summary: Returns the hash code of this {@code Nullable} .
-
Contract:
- If the {@code Nullable} is empty, the hash code is based only on the presence state.
- If the {@code Nullable} contains a value (including {@code null} ), the hash code combines the presence state and the value's hash code.
-
Parameters:
- (none)
- Returns: the hash code value for this {@code Nullable}
toString(...) -> String
-
Signature:
@Override public String toString() - Summary: Returns a string representation of this {@code Nullable} .
-
Contract:
- <p> The string representation varies based on the state: <ul> <li> If empty (not present): returns "Nullable.empty" </li> <li> If present with {@code null} value: returns "Nullable\[null\]" </li> <li> If present with {@code non-null} value: returns "Nullable\[value\]" where value is the string representation of the contained value </li> </ul>
-
Parameters:
- (none)
- Returns: a string representation of this {@code Nullable}
com.landawn.abacus.util.function
Interface BiConsumer (com.landawn.abacus.util.function.BiConsumer)
Represents an operation that accepts two input arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, U u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
andThen(...) -> BiConsumer<T, U>
-
Signature:
@Override default BiConsumer<T, U> andThen(final java.util.function.BiConsumer<? super T, ? super U> after) - Summary: Returns a composed {@code BiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code BiConsumer<String, Integer> logger = (name, value) -> System.out.println("Logging: " + name + " = " + value); BiConsumer<String, Integer> validator = (name, value) -> { if (value < 0) throw new IllegalArgumentException(); }; BiConsumer<String, Integer> combined = logger.andThen(validator); combined.accept("score", 85); // Logs then validates } </pre>
-
Parameters:
-
after(java.util.function.BiConsumer<? super T, ? super U>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BiConsumer} that performs in sequence this operation followed by the {@code after} operation
toThrowable(...) -> Throwables.BiConsumer<T, U, E>
-
Signature:
default <E extends Throwable> Throwables.BiConsumer<T, U, E> toThrowable() - Summary: Converts this {@code BiConsumer} to a {@code Throwables.BiConsumer} that can throw a checked exception.
-
Parameters:
- (none)
- Returns: a {@code Throwables.BiConsumer} view of this consumer that can throw exceptions of type {@code E}
Interface BiFunction (com.landawn.abacus.util.function.BiFunction)
Represents a function that accepts two arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, U u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result
andThen(...) -> BiFunction<T, U, V>
-
Signature:
@Override default <V> BiFunction<T, U, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed {@code BiFunction} that first applies this function and then applies the {@code after} function
toThrowable(...) -> Throwables.BiFunction<T, U, R, E>
-
Signature:
default <E extends Throwable> Throwables.BiFunction<T, U, R, E> toThrowable() - Summary: Converts this {@code BiFunction} to a {@code Throwables.BiFunction} that can throw a checked exception.
-
Parameters:
- (none)
- Returns: a {@code Throwables.BiFunction} view of this function that can throw exceptions of type {@code E}
Interface BiIntObjConsumer (com.landawn.abacus.util.function.BiIntObjConsumer)
Represents an operation that accepts two {@code int} -valued arguments and a single object-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int i, int j, T t) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(int) — the first input argument (int value) -
j(int) — the second input argument (int value) -
t(T) — the third input argument (object value)
-
andThen(...) -> BiIntObjConsumer<T>
-
Signature:
default BiIntObjConsumer<T> andThen(final BiIntObjConsumer<? super T> after) - Summary: Returns a composed {@code BiIntObjConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(BiIntObjConsumer<? super T>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BiIntObjConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BiIntObjFunction (com.landawn.abacus.util.function.BiIntObjFunction)
Represents a function that accepts two {@code int} -valued arguments and a single object-valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int i, int j, T t) - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(int) — the first function argument (int value) -
j(int) — the second function argument (int value) -
t(T) — the third function argument (object value)
-
- Returns: the function result
andThen(...) -> BiIntObjFunction<T, V>
-
Signature:
default <V> BiIntObjFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BiIntObjPredicate (com.landawn.abacus.util.function.BiIntObjPredicate)
Represents a predicate (boolean-valued function) of two {@code int} -valued arguments and a single object-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int i, int j, T t) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
i(int) — the first input argument (int value) -
j(int) — the second input argument (int value) -
t(T) — the third input argument (object value)
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> BiIntObjPredicate<T>
-
Signature:
default BiIntObjPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BiIntObjPredicate<T>
-
Signature:
default BiIntObjPredicate<T> and(final BiIntObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BiIntObjPredicate<T>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BiIntObjPredicate<T>
-
Signature:
default BiIntObjPredicate<T> or(final BiIntObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BiIntObjPredicate<T>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface BiObjIntConsumer (com.landawn.abacus.util.function.BiObjIntConsumer)
Represents an operation that accepts two object-valued arguments and a single {@code int} -valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, U u, int i) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument (object value) -
u(U) — the second input argument (object value) -
i(int) — the third input argument (int value)
-
andThen(...) -> BiObjIntConsumer<T, U>
-
Signature:
default BiObjIntConsumer<T, U> andThen(final BiObjIntConsumer<? super T, ? super U> after) - Summary: Returns a composed {@code BiObjIntConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(BiObjIntConsumer<? super T, ? super U>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BiObjIntConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BiObjIntFunction (com.landawn.abacus.util.function.BiObjIntFunction)
Represents a function that accepts two object-valued arguments and a single {@code int} -valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, U u, int i) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument (object value) -
u(U) — the second function argument (object value) -
i(int) — the third function argument (int value)
-
- Returns: the function result
andThen(...) -> BiObjIntFunction<T, U, V>
-
Signature:
default <V> BiObjIntFunction<T, U, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BiObjIntPredicate (com.landawn.abacus.util.function.BiObjIntPredicate)
Represents a predicate (boolean-valued function) of two object-valued arguments and a single {@code int} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, U u, int i) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first input argument (object value) -
u(U) — the second input argument (object value) -
i(int) — the third input argument (int value)
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> BiObjIntPredicate<T, U>
-
Signature:
default BiObjIntPredicate<T, U> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BiObjIntPredicate<T, U>
-
Signature:
default BiObjIntPredicate<T, U> and(final BiObjIntPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BiObjIntPredicate<? super T, ? super U>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BiObjIntPredicate<T, U>
-
Signature:
default BiObjIntPredicate<T, U> or(final BiObjIntPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BiObjIntPredicate<? super T, ? super U>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface BiPredicate (com.landawn.abacus.util.function.BiPredicate)
Represents a predicate (boolean-valued function) of two arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, U u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
u(U) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> BiPredicate<T, U>
-
Signature:
@Override default BiPredicate<T, U> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BiPredicate<T, U>
-
Signature:
@Override default BiPredicate<T, U> and(final java.util.function.BiPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.BiPredicate<? super T, ? super U>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed {@code BiPredicate} that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BiPredicate<T, U>
-
Signature:
@Override default BiPredicate<T, U> or(final java.util.function.BiPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.BiPredicate<? super T, ? super U>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed {@code BiPredicate} that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
toThrowable(...) -> Throwables.BiPredicate<T, U, E>
-
Signature:
default <E extends Throwable> Throwables.BiPredicate<T, U, E> toThrowable() - Summary: Converts this {@code BiPredicate} to a {@code Throwables.BiPredicate} that can throw a checked exception.
-
Parameters:
- (none)
- Returns: a {@code Throwables.BiPredicate} view of this predicate that can throw exceptions of type {@code E}
Interface BinaryOperator (com.landawn.abacus.util.function.BinaryOperator)
Represents an operation upon two operands of the same type, producing a result of the same type as the operands.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> T
-
Signature:
@Override T apply(T t, T u) - Summary: Applies this operator to the given operands.
-
Parameters:
-
t(T) — the first operand -
u(T) — the second operand
-
- Returns: the operator result
toThrowable(...) -> Throwables.BinaryOperator<T, E>
-
Signature:
@Override default <E extends Throwable> Throwables.BinaryOperator<T, E> toThrowable() - Summary: Converts this {@code BinaryOperator} to a {@code Throwables.BinaryOperator} that can throw a checked exception.
-
Parameters:
- (none)
- Returns: a {@code Throwables.BinaryOperator} view of this operator that can throw exceptions of type {@code E}
Interface BooleanBiConsumer (com.landawn.abacus.util.function.BooleanBiConsumer)
Represents an operation that accepts two {@code boolean} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(boolean t, boolean u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(boolean) — the first input argument (boolean value) -
u(boolean) — the second input argument (boolean value)
-
andThen(...) -> BooleanBiConsumer
-
Signature:
default BooleanBiConsumer andThen(final BooleanBiConsumer after) - Summary: Returns a composed {@code BooleanBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(BooleanBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BooleanBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BooleanBiFunction (com.landawn.abacus.util.function.BooleanBiFunction)
Represents a function that accepts two {@code boolean} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(boolean t, boolean u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(boolean) — the first function argument (boolean value) -
u(boolean) — the second function argument (boolean value)
-
- Returns: the function result
andThen(...) -> BooleanBiFunction<V>
-
Signature:
default <V> BooleanBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BooleanBiPredicate (com.landawn.abacus.util.function.BooleanBiPredicate)
Represents a predicate (boolean-valued function) of two {@code boolean} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(boolean t, boolean u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(boolean) — the first input argument -
u(boolean) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> BooleanBiPredicate
-
Signature:
default BooleanBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BooleanBiPredicate
-
Signature:
default BooleanBiPredicate and(final BooleanBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanBiPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BooleanBiPredicate
-
Signature:
default BooleanBiPredicate or(final BooleanBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanBiPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface BooleanBinaryOperator (com.landawn.abacus.util.function.BooleanBinaryOperator)
Represents an operation upon two {@code boolean} operands and producing a {@code boolean} result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
@Override boolean applyAsBoolean(boolean left, boolean right) - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(boolean) — the first operand -
right(boolean) — the second operand
-
- Returns: the operator result
Interface BooleanConsumer (com.landawn.abacus.util.function.BooleanConsumer)
Represents an operation that accepts a single {@code boolean} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(boolean value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(boolean) — the input argument
-
andThen(...) -> BooleanConsumer
-
Signature:
default BooleanConsumer andThen(final BooleanConsumer after) - Summary: Returns a composed {@code BooleanConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code BooleanConsumer logger = value -> System.out.println("Value: " + value); BooleanConsumer validator = value -> { if (!value) throw new IllegalArgumentException(); }; BooleanConsumer combined = logger.andThen(validator); combined.accept(true); // Logs then validates } </pre>
-
Parameters:
-
after(BooleanConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BooleanConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BooleanFunction (com.landawn.abacus.util.function.BooleanFunction)
Represents a function that accepts a {@code boolean} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> BooleanFunction<Boolean>
-
Signature:
static BooleanFunction<Boolean> identity() - Summary: Returns a function that always returns its input argument.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(boolean value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(boolean) — the function argument
-
- Returns: the function result
andThen(...) -> BooleanFunction<V>
-
Signature:
default <V> BooleanFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BooleanNConsumer (com.landawn.abacus.util.function.BooleanNConsumer)
Represents an operation that accepts a variable number of {@code boolean} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(boolean... args) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
args(boolean[]) — the input arguments as a variable-length array of {@code boolean} values. May be empty but must not be {@code null} .
-
andThen(...) -> BooleanNConsumer
-
Signature:
default BooleanNConsumer andThen(final BooleanNConsumer after) - Summary: Returns a composed {@code BooleanNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(BooleanNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BooleanNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BooleanNFunction (com.landawn.abacus.util.function.BooleanNFunction)
Represents a function that accepts a variable number of {@code boolean} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(boolean... args) - Summary: Applies this function to the given arguments.
-
Parameters:
-
args(boolean[]) — the function arguments as a variable-length array of {@code boolean} values. May be empty but must not be {@code null} .
-
- Returns: the function result
andThen(...) -> BooleanNFunction<V>
-
Signature:
@Override default <V> BooleanNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BooleanPredicate (com.landawn.abacus.util.function.BooleanPredicate)
Represents a predicate (boolean-valued function) of one {@code boolean} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BooleanPredicate
-
Signature:
static BooleanPredicate of(final BooleanPredicate predicate) - Summary: Returns the specified predicate instance.
-
Parameters:
-
predicate(BooleanPredicate) — the predicate to return
-
- Returns: the specified predicate
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(boolean value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(boolean) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, otherwise {@code false}
negate(...) -> BooleanPredicate
-
Signature:
default BooleanPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BooleanPredicate
-
Signature:
default BooleanPredicate and(final BooleanPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BooleanPredicate
-
Signature:
default BooleanPredicate or(final BooleanPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface BooleanSupplier (com.landawn.abacus.util.function.BooleanSupplier)
Represents a supplier of {@code boolean} -valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsBoolean(...) -> boolean
-
Signature:
@Override boolean getAsBoolean() - Summary: Gets a result.
-
Parameters:
- (none)
- Returns: a {@code boolean} value
Interface BooleanTernaryOperator (com.landawn.abacus.util.function.BooleanTernaryOperator)
Represents an operation on three {@code boolean} operands that produces a {@code boolean} result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
@Override boolean applyAsBoolean(boolean a, boolean b, boolean c) - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(boolean) — the first operand -
b(boolean) — the second operand -
c(boolean) — the third operand
-
- Returns: the operator result
Interface BooleanToByteFunction (com.landawn.abacus.util.function.BooleanToByteFunction)
Represents a function that accepts a {@code boolean} -valued argument and produces a {@code byte} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(boolean value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(boolean) — the function argument
-
- Returns: the function result as a {@code byte}
Interface BooleanToCharFunction (com.landawn.abacus.util.function.BooleanToCharFunction)
Represents a function that accepts a {@code boolean} -valued argument and produces a {@code char} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(boolean value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(boolean) — the function argument
-
- Returns: the function result as a {@code char}
Interface BooleanToIntFunction (com.landawn.abacus.util.function.BooleanToIntFunction)
Represents a function that accepts a {@code boolean} -valued argument and produces an {@code int} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(boolean value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(boolean) — the function argument
-
- Returns: the function result as an {@code int}
Interface BooleanTriConsumer (com.landawn.abacus.util.function.BooleanTriConsumer)
Represents an operation that accepts three {@code boolean} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(boolean a, boolean b, boolean c) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(boolean) — the first input argument -
b(boolean) — the second input argument -
c(boolean) — the third input argument
-
andThen(...) -> BooleanTriConsumer
-
Signature:
default BooleanTriConsumer andThen(final BooleanTriConsumer after) - Summary: Returns a composed {@code BooleanTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(BooleanTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code BooleanTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface BooleanTriFunction (com.landawn.abacus.util.function.BooleanTriFunction)
Represents a function that accepts three {@code boolean} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(boolean a, boolean b, boolean c) - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(boolean) — the first function argument -
b(boolean) — the second function argument -
c(boolean) — the third function argument
-
- Returns: the function result
andThen(...) -> BooleanTriFunction<V>
-
Signature:
default <V> BooleanTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BooleanTriPredicate (com.landawn.abacus.util.function.BooleanTriPredicate)
Represents a predicate (boolean-valued function) of three {@code boolean} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(boolean a, boolean b, boolean c) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(boolean) — the first input argument -
b(boolean) — the second input argument -
c(boolean) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> BooleanTriPredicate
-
Signature:
default BooleanTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BooleanTriPredicate
-
Signature:
default BooleanTriPredicate and(final BooleanTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BooleanTriPredicate
-
Signature:
default BooleanTriPredicate or(final BooleanTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(BooleanTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface BooleanUnaryOperator (com.landawn.abacus.util.function.BooleanUnaryOperator)
Represents an operation on a single {@code boolean} -valued operand that produces a {@code boolean} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> BooleanUnaryOperator
-
Signature:
static BooleanUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
@Override boolean applyAsBoolean(boolean operand) - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(boolean) — the operand
-
- Returns: the operator result
compose(...) -> BooleanUnaryOperator
-
Signature:
default BooleanUnaryOperator compose(final BooleanUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(BooleanUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(BooleanUnaryOperator)
andThen(...) -> BooleanUnaryOperator
-
Signature:
default BooleanUnaryOperator andThen(final BooleanUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(BooleanUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(BooleanUnaryOperator)
Interface ByteBiConsumer (com.landawn.abacus.util.function.ByteBiConsumer)
Represents an operation that accepts two {@code byte} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(byte t, byte u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(byte) — the first input argument -
u(byte) — the second input argument
-
andThen(...) -> ByteBiConsumer
-
Signature:
default ByteBiConsumer andThen(final ByteBiConsumer after) - Summary: Returns a composed {@code ByteBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ByteBiConsumer logger = (a, b) -> System.out.println("Values: " + a + ", " + b); ByteBiConsumer validator = (a, b) -> { if (a < 0 || b < 0) throw new IllegalArgumentException(); }; ByteBiConsumer combined = logger.andThen(validator); combined.accept((byte) 5, (byte) 10); // Logs then validates } </pre>
-
Parameters:
-
after(ByteBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ByteBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ByteBiFunction (com.landawn.abacus.util.function.ByteBiFunction)
Represents a function that accepts two {@code byte} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(byte t, byte u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(byte) — the first function argument -
u(byte) — the second function argument
-
- Returns: the function result
andThen(...) -> ByteBiFunction<V>
-
Signature:
default <V> ByteBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ByteBiPredicate (com.landawn.abacus.util.function.ByteBiPredicate)
Represents a predicate (boolean-valued function) of two {@code byte} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(byte t, byte u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(byte) — the first input argument -
u(byte) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> ByteBiPredicate
-
Signature:
default ByteBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ByteBiPredicate
-
Signature:
default ByteBiPredicate and(final ByteBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ByteBiPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ByteBiPredicate
-
Signature:
default ByteBiPredicate or(final ByteBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ByteBiPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ByteBinaryOperator (com.landawn.abacus.util.function.ByteBinaryOperator)
Represents an operation upon two {@code byte} operands and producing a {@code byte} result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
@Override byte applyAsByte(byte left, byte right) - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(byte) — the first operand -
right(byte) — the second operand
-
- Returns: the operator result
Interface ByteConsumer (com.landawn.abacus.util.function.ByteConsumer)
Represents an operation that accepts a single {@code byte} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(byte value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(byte) — the input argument
-
andThen(...) -> ByteConsumer
-
Signature:
default ByteConsumer andThen(final ByteConsumer after) - Summary: Returns a composed {@code ByteConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ByteConsumer logger = value -> System.out.println("Processing: " + value); ByteConsumer validator = value -> { if (value < 0) throw new IllegalArgumentException(); }; ByteConsumer combined = logger.andThen(validator); combined.accept((byte) 5); // Logs then validates } </pre>
-
Parameters:
-
after(ByteConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ByteConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ByteFunction (com.landawn.abacus.util.function.ByteFunction)
Represents a function that accepts a {@code byte} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> ByteFunction<Byte>
-
Signature:
static ByteFunction<Byte> identity() - Summary: Returns a function that always returns its input argument unchanged as a {@link Byte} object.
-
Contract:
- It is useful when a {@code ByteFunction<Byte>} is required but no transformation is needed.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument as a Byte
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(byte value) - Summary: Applies this function to the given byte-valued argument and produces a result.
-
Parameters:
-
value(byte) — the function argument
-
- Returns: the function result
andThen(...) -> ByteFunction<V>
-
Signature:
default <V> ByteFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ByteNConsumer (com.landawn.abacus.util.function.ByteNConsumer)
Represents an operation that accepts a variable number of byte-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(byte... args) - Summary: Performs this operation on the given byte array arguments.
-
Parameters:
-
args(byte[]) — the byte array input arguments. Can be empty but not {@code null} .
-
andThen(...) -> ByteNConsumer
-
Signature:
default ByteNConsumer andThen(final ByteNConsumer after) - Summary: Returns a composed {@code ByteNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
after(ByteNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ByteNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ByteNFunction (com.landawn.abacus.util.function.ByteNFunction)
Represents a function that accepts a variable number of byte-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(byte... args) - Summary: Applies this function to the given byte array arguments.
-
Parameters:
-
args(byte[]) — the byte array input arguments. Can be empty but not {@code null} .
-
- Returns: the function result of type R
andThen(...) -> ByteNFunction<V>
-
Signature:
@Override default <V> ByteNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface BytePredicate (com.landawn.abacus.util.function.BytePredicate)
Represents a predicate (boolean-valued function) of one {@code byte} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> BytePredicate
-
Signature:
static BytePredicate of(final BytePredicate predicate) - Summary: Returns the specified BytePredicate instance.
-
Contract:
- This method is useful for type inference or when you need to explicitly cast a lambda expression.
-
Parameters:
-
predicate(BytePredicate) — the predicate to return
-
- Returns: the same predicate instance
equal(...) -> BytePredicate
-
Signature:
static BytePredicate equal(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is equal to the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is equal to {@code targetByte}
notEqual(...) -> BytePredicate
-
Signature:
static BytePredicate notEqual(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is not equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is not equal to the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is not equal to {@code targetByte}
greaterThan(...) -> BytePredicate
-
Signature:
static BytePredicate greaterThan(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is greater than the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is greater than the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetByte}
greaterEqual(...) -> BytePredicate
-
Signature:
static BytePredicate greaterEqual(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is greater than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is greater than or equal to the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetByte}
lessThan(...) -> BytePredicate
-
Signature:
static BytePredicate lessThan(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is less than the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is less than the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetByte}
lessEqual(...) -> BytePredicate
-
Signature:
static BytePredicate lessEqual(final byte targetByte) - Summary: Returns a predicate that tests if the byte value is less than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the byte value is less than or equal to the specified target value.
-
Parameters:
-
targetByte(byte) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetByte}
between(...) -> BytePredicate
-
Signature:
static BytePredicate between(final byte minValue, final byte maxValue) - Summary: Returns a predicate that tests if the byte value is between the specified minimum and maximum values (exclusive).
-
Contract:
- Returns a predicate that tests if the byte value is between the specified minimum and maximum values (exclusive).
- The test returns {@code true} if the value is greater than {@code minValue} AND less than {@code maxValue} .
-
Parameters:
-
minValue(byte) — the exclusive lower bound -
maxValue(byte) — the exclusive upper bound
-
- Returns: a predicate that tests if the input is between {@code minValue} and {@code maxValue} (exclusive)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(byte value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(byte) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> BytePredicate
-
Signature:
default BytePredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> BytePredicate
-
Signature:
default BytePredicate and(final BytePredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(BytePredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> BytePredicate
-
Signature:
default BytePredicate or(final BytePredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(BytePredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ByteSupplier (com.landawn.abacus.util.function.ByteSupplier)
Represents a supplier of byte-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsByte(...) -> byte
-
Signature:
@Override byte getAsByte() - Summary: Gets a byte result.
-
Parameters:
- (none)
- Returns: a byte value
Interface ByteTernaryOperator (com.landawn.abacus.util.function.ByteTernaryOperator)
Represents an operation upon three byte-valued operands and producing a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
@Override byte applyAsByte(byte a, byte b, byte c) - Summary: Applies this operator to the given byte operands.
-
Parameters:
-
a(byte) — the first byte operand -
b(byte) — the second byte operand -
c(byte) — the third byte operand
-
- Returns: the byte result of applying this operator to the three operands
Interface ByteToBooleanFunction (com.landawn.abacus.util.function.ByteToBooleanFunction)
Represents a function that accepts a byte-valued argument and produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(byte value) - Summary: Applies this function to the given byte argument and returns a boolean result.
-
Parameters:
-
value(byte) — the byte function argument
-
- Returns: the boolean function result
Interface ByteToIntFunction (com.landawn.abacus.util.function.ByteToIntFunction)
Represents a function that accepts a byte-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(byte value) - Summary: Applies this function to the given byte argument and returns an int result.
-
Parameters:
-
value(byte) — the byte function argument
-
- Returns: the int function result
Interface ByteTriConsumer (com.landawn.abacus.util.function.ByteTriConsumer)
Represents an operation that accepts three byte-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(byte a, byte b, byte c) - Summary: Performs this operation on the given byte arguments.
-
Parameters:
-
a(byte) — the first byte input argument -
b(byte) — the second byte input argument -
c(byte) — the third byte input argument
-
andThen(...) -> ByteTriConsumer
-
Signature:
default ByteTriConsumer andThen(final ByteTriConsumer after) - Summary: Returns a composed {@code ByteTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ByteTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ByteTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ByteTriFunction (com.landawn.abacus.util.function.ByteTriFunction)
Represents a function that accepts three byte-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(byte a, byte b, byte c) - Summary: Applies this function to the given byte arguments.
-
Parameters:
-
a(byte) — the first byte function argument -
b(byte) — the second byte function argument -
c(byte) — the third byte function argument
-
- Returns: the function result of type R
andThen(...) -> ByteTriFunction<V>
-
Signature:
default <V> ByteTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ByteTriPredicate (com.landawn.abacus.util.function.ByteTriPredicate)
Represents a predicate (boolean-valued function) of three byte-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(byte a, byte b, byte c) - Summary: Evaluates this predicate on the given byte arguments.
-
Parameters:
-
a(byte) — the first byte input argument -
b(byte) — the second byte input argument -
c(byte) — the third byte input argument
-
- Returns: {@code true} if the three input arguments match the predicate, otherwise {@code false}
negate(...) -> ByteTriPredicate
-
Signature:
default ByteTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ByteTriPredicate
-
Signature:
default ByteTriPredicate and(final ByteTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(ByteTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ByteTriPredicate
-
Signature:
default ByteTriPredicate or(final ByteTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(ByteTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ByteUnaryOperator (com.landawn.abacus.util.function.ByteUnaryOperator)
Represents an operation on a single byte-valued operand that produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> ByteUnaryOperator
-
Signature:
static ByteUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
@Override byte applyAsByte(byte operand) - Summary: Applies this operator to the given byte operand.
-
Parameters:
-
operand(byte) — the byte operand
-
- Returns: the byte result of applying this operator to the operand
compose(...) -> ByteUnaryOperator
-
Signature:
default ByteUnaryOperator compose(final ByteUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(ByteUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(ByteUnaryOperator)
andThen(...) -> ByteUnaryOperator
-
Signature:
default ByteUnaryOperator andThen(final ByteUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(ByteUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(ByteUnaryOperator)
Interface Callable (com.landawn.abacus.util.function.Callable)
A task that returns a result and may throw a RuntimeException.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
call(...) -> R
-
Signature:
@Override R call() - Summary: Computes a result, or throws a RuntimeException if unable to do so.
-
Contract:
- Computes a result, or throws a RuntimeException if unable to do so.
-
Parameters:
- (none)
- Returns: the computed result
toRunnable(...) -> Runnable
-
Signature:
default Runnable toRunnable() - Summary: Converts this Callable to a Runnable that executes the call() method but discards the result.
-
Contract:
- The returned Runnable will execute this Callable when run, ignoring any return value.
-
Parameters:
- (none)
- Returns: a Runnable that executes this Callable and discards the result
toThrowable(...) -> Throwables.Callable<R, E>
-
Signature:
default <E extends Throwable> Throwables.Callable<R, E> toThrowable() - Summary: Converts this Callable to a Throwables.Callable with a specified exception type.
-
Contract:
- This method performs an unchecked cast and is useful when you need to adapt this Callable to a context that expects a different exception type.
-
Parameters:
- (none)
- Returns: a Throwables.Callable that is functionally equivalent to this Callable
Interface CharBiConsumer (com.landawn.abacus.util.function.CharBiConsumer)
Represents an operation that accepts two char-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(char t, char u) - Summary: Performs this operation on the given char arguments.
-
Parameters:
-
t(char) — the first char input argument -
u(char) — the second char input argument
-
andThen(...) -> CharBiConsumer
-
Signature:
default CharBiConsumer andThen(final CharBiConsumer after) - Summary: Returns a composed {@code CharBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code CharBiConsumer logger = (c1, c2) -> System.out.println("Processing: " + c1 + ", " + c2); CharBiConsumer validator = (c1, c2) -> { if (!Character.isLetter(c1)) throw new IllegalArgumentException(); }; CharBiConsumer combined = logger.andThen(validator); combined.accept('A', 'B'); // Logs then validates } </pre>
-
Parameters:
-
after(CharBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code CharBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface CharBiFunction (com.landawn.abacus.util.function.CharBiFunction)
Represents a function that accepts two char-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(char t, char u) - Summary: Applies this function to the given char arguments.
-
Parameters:
-
t(char) — the first char function argument -
u(char) — the second char function argument
-
- Returns: the function result of type R
andThen(...) -> CharBiFunction<V>
-
Signature:
default <V> CharBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface CharBiPredicate (com.landawn.abacus.util.function.CharBiPredicate)
Represents a predicate (boolean-valued function) of two char-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(char t, char u) - Summary: Evaluates this predicate on the given char arguments.
-
Parameters:
-
t(char) — the first char input argument -
u(char) — the second char input argument
-
- Returns: {@code true} if the two input arguments match the predicate, otherwise {@code false}
negate(...) -> CharBiPredicate
-
Signature:
default CharBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> CharBiPredicate
-
Signature:
default CharBiPredicate and(final CharBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(CharBiPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> CharBiPredicate
-
Signature:
default CharBiPredicate or(final CharBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(CharBiPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface CharBinaryOperator (com.landawn.abacus.util.function.CharBinaryOperator)
Represents an operation upon two char-valued operands and producing a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
@Override char applyAsChar(char left, char right) - Summary: Applies this operator to the given char operands.
-
Parameters:
-
left(char) — the first char operand -
right(char) — the second char operand
-
- Returns: the char result of applying this operator to the two operands
Interface CharConsumer (com.landawn.abacus.util.function.CharConsumer)
Represents an operation that accepts a single {@code char} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(char value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(char) — the input argument
-
andThen(...) -> CharConsumer
-
Signature:
default CharConsumer andThen(final CharConsumer after) - Summary: Returns a composed {@code CharConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code CharConsumer logger = c -> System.out.println("Processing: " + c); CharConsumer validator = c -> { if (!Character.isLetter(c)) throw new IllegalArgumentException(); }; CharConsumer combined = logger.andThen(validator); combined.accept('A'); // Logs then validates } </pre>
-
Parameters:
-
after(CharConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code CharConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface CharFunction (com.landawn.abacus.util.function.CharFunction)
Represents a function that accepts a {@code char} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> CharFunction<Character>
-
Signature:
static CharFunction<Character> identity() - Summary: Returns a function that always returns its input argument unchanged as a {@link Character} object.
-
Contract:
- It is useful when a {@code CharFunction<Character>} is required but no transformation is needed.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument as a Character
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(char value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(char) — the function argument
-
- Returns: the function result
andThen(...) -> CharFunction<V>
-
Signature:
default <V> CharFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface CharNConsumer (com.landawn.abacus.util.function.CharNConsumer)
Represents an operation that accepts a variable number of char-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(char... args) - Summary: Performs this operation on the given char array arguments.
-
Parameters:
-
args(char[]) — the char array input arguments. Can be empty but not {@code null} .
-
andThen(...) -> CharNConsumer
-
Signature:
default CharNConsumer andThen(final CharNConsumer after) - Summary: Returns a composed {@code CharNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
after(CharNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code CharNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface CharNFunction (com.landawn.abacus.util.function.CharNFunction)
Represents a function that accepts a variable number of char-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(char... args) - Summary: Applies this function to the given char array arguments.
-
Parameters:
-
args(char[]) — the char array input arguments. Can be empty but not {@code null} .
-
- Returns: the function result of type R
andThen(...) -> CharNFunction<V>
-
Signature:
@Override default <V> CharNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface CharPredicate (com.landawn.abacus.util.function.CharPredicate)
Represents a predicate (boolean-valued function) of one {@code char} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> CharPredicate
-
Signature:
static CharPredicate of(final CharPredicate predicate) - Summary: Returns the specified CharPredicate instance.
-
Contract:
- This method is useful for type inference or when you need to explicitly cast a lambda expression.
-
Parameters:
-
predicate(CharPredicate) — the predicate to return
-
- Returns: the same predicate instance
equal(...) -> CharPredicate
-
Signature:
static CharPredicate equal(final char targetChar) - Summary: Returns a predicate that tests if the char value is equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is equal to the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is equal to {@code targetChar}
notEqual(...) -> CharPredicate
-
Signature:
static CharPredicate notEqual(final char targetChar) - Summary: Returns a predicate that tests if the char value is not equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is not equal to the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is not equal to {@code targetChar}
greaterThan(...) -> CharPredicate
-
Signature:
static CharPredicate greaterThan(final char targetChar) - Summary: Returns a predicate that tests if the char value is greater than the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is greater than the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetChar}
greaterEqual(...) -> CharPredicate
-
Signature:
static CharPredicate greaterEqual(final char targetChar) - Summary: Returns a predicate that tests if the char value is greater than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is greater than or equal to the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetChar}
lessThan(...) -> CharPredicate
-
Signature:
static CharPredicate lessThan(final char targetChar) - Summary: Returns a predicate that tests if the char value is less than the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is less than the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetChar}
lessEqual(...) -> CharPredicate
-
Signature:
static CharPredicate lessEqual(final char targetChar) - Summary: Returns a predicate that tests if the char value is less than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the char value is less than or equal to the specified target value.
-
Parameters:
-
targetChar(char) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetChar}
between(...) -> CharPredicate
-
Signature:
static CharPredicate between(final char minValue, final char maxValue) - Summary: Returns a predicate that tests if the char value is between the specified minimum and maximum values (exclusive).
-
Contract:
- Returns a predicate that tests if the char value is between the specified minimum and maximum values (exclusive).
- The test returns {@code true} if the value is greater than {@code minValue} AND less than {@code maxValue} .
-
Parameters:
-
minValue(char) — the exclusive lower bound -
maxValue(char) — the exclusive upper bound
-
- Returns: a predicate that tests if the input is between {@code minValue} and {@code maxValue} (exclusive)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(char value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(char) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> CharPredicate
-
Signature:
default CharPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> CharPredicate
-
Signature:
default CharPredicate and(final CharPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(CharPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> CharPredicate
-
Signature:
default CharPredicate or(final CharPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(CharPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface CharSupplier (com.landawn.abacus.util.function.CharSupplier)
Represents a supplier of char-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsChar(...) -> char
-
Signature:
@Override char getAsChar() - Summary: Gets a char result.
-
Parameters:
- (none)
- Returns: a char value
Interface CharTernaryOperator (com.landawn.abacus.util.function.CharTernaryOperator)
Represents an operation upon three char-valued operands and producing a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
@Override char applyAsChar(char a, char b, char c) - Summary: Applies this operator to the given char operands.
-
Parameters:
-
a(char) — the first char operand -
b(char) — the second char operand -
c(char) — the third char operand
-
- Returns: the char result of applying this operator to the three operands
Interface CharToBooleanFunction (com.landawn.abacus.util.function.CharToBooleanFunction)
Represents a function that accepts a char-valued argument and produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(char value) - Summary: Applies this function to the given char argument and returns a boolean result.
-
Parameters:
-
value(char) — the char function argument
-
- Returns: the boolean function result
Interface CharToIntFunction (com.landawn.abacus.util.function.CharToIntFunction)
Represents a function that accepts a char-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(char value) - Summary: Applies this function to the given char argument and returns an int result.
-
Parameters:
-
value(char) — the char function argument
-
- Returns: the int function result, typically the Unicode code point value of the char
Interface CharTriConsumer (com.landawn.abacus.util.function.CharTriConsumer)
Represents an operation that accepts three char-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(char a, char b, char c) - Summary: Performs this operation on the given char arguments.
-
Parameters:
-
a(char) — the first char input argument -
b(char) — the second char input argument -
c(char) — the third char input argument
-
andThen(...) -> CharTriConsumer
-
Signature:
default CharTriConsumer andThen(final CharTriConsumer after) - Summary: Returns a composed {@code CharTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code CharTriConsumer logger = (a, b, c) -> System.out.println("Chars: " + a + ", " + b + ", " + c); CharTriConsumer validator = (a, b, c) -> { if (!Character.isLetter(a)) throw new IllegalArgumentException(); }; CharTriConsumer combined = logger.andThen(validator); combined.accept('A', 'B', 'C'); // Logs then validates } </pre>
-
Parameters:
-
after(CharTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code CharTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface CharTriFunction (com.landawn.abacus.util.function.CharTriFunction)
Represents a function that accepts three char-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(char a, char b, char c) - Summary: Applies this function to the given char arguments.
-
Parameters:
-
a(char) — the first char function argument -
b(char) — the second char function argument -
c(char) — the third char function argument
-
- Returns: the function result of type R
andThen(...) -> CharTriFunction<V>
-
Signature:
default <V> CharTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface CharTriPredicate (com.landawn.abacus.util.function.CharTriPredicate)
Represents a predicate (boolean-valued function) of three char-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(char a, char b, char c) - Summary: Evaluates this predicate on the given char arguments.
-
Parameters:
-
a(char) — the first char input argument -
b(char) — the second char input argument -
c(char) — the third char input argument
-
- Returns: {@code true} if the three input arguments match the predicate, otherwise {@code false}
negate(...) -> CharTriPredicate
-
Signature:
default CharTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> CharTriPredicate
-
Signature:
default CharTriPredicate and(final CharTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(CharTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> CharTriPredicate
-
Signature:
default CharTriPredicate or(final CharTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(CharTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface CharUnaryOperator (com.landawn.abacus.util.function.CharUnaryOperator)
Represents an operation on a single char-valued operand that produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> CharUnaryOperator
-
Signature:
static CharUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
@Override char applyAsChar(char operand) - Summary: Applies this operator to the given char operand.
-
Parameters:
-
operand(char) — the char operand
-
- Returns: the char result of applying this operator to the operand
compose(...) -> CharUnaryOperator
-
Signature:
default CharUnaryOperator compose(final CharUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(CharUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(CharUnaryOperator)
andThen(...) -> CharUnaryOperator
-
Signature:
default CharUnaryOperator andThen(final CharUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(CharUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(CharUnaryOperator)
Interface Consumer (com.landawn.abacus.util.function.Consumer)
Represents an operation that accepts a single input argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t) - Summary: Performs this operation on the given argument.
-
Parameters:
-
t(T) — the input argument
-
andThen(...) -> Consumer<T>
-
Signature:
@Override default Consumer<T> andThen(final java.util.function.Consumer<? super T> after) - Summary: Returns a composed {@code Consumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Consumer<String> logger = s -> System.out.println("Processing: " + s); Consumer<String> validator = s -> { if (s.isEmpty()) throw new IllegalArgumentException(); }; Consumer<String> combined = logger.andThen(validator); combined.accept("data"); // Logs then validates } </pre>
-
Parameters:
-
after(java.util.function.Consumer<? super T>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code Consumer} that performs in sequence this operation followed by the {@code after} operation
toThrowable(...) -> Throwables.Consumer<T, E>
-
Signature:
default <E extends Throwable> Throwables.Consumer<T, E> toThrowable() - Summary: Converts this Consumer to a Throwables.Consumer with a specified exception type.
-
Contract:
- This method performs an unchecked cast and is useful when you need to adapt this Consumer to a context that expects a different exception type.
-
Parameters:
- (none)
- Returns: a Throwables.Consumer that is functionally equivalent to this Consumer
Interface DoubleBiConsumer (com.landawn.abacus.util.function.DoubleBiConsumer)
Represents an operation that accepts two double-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(double t, double u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(double) — the first double input argument -
u(double) — the second double input argument
-
andThen(...) -> DoubleBiConsumer
-
Signature:
default DoubleBiConsumer andThen(final DoubleBiConsumer after) - Summary: Returns a composed {@code DoubleBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleBiConsumer logger = (x, y) -> System.out.println("Values: " + x + ", " + y); DoubleBiConsumer validator = (x, y) -> { if (x < 0 || y < 0) throw new IllegalArgumentException(); }; DoubleBiConsumer combined = logger.andThen(validator); combined.accept(1.5, 2.5); // Logs then validates } </pre>
-
Parameters:
-
after(DoubleBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code DoubleBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface DoubleBiFunction (com.landawn.abacus.util.function.DoubleBiFunction)
Represents a function that accepts two double-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(double t, double u) - Summary: Applies this function to the given {@code double} -valued arguments and produces a result.
-
Parameters:
-
t(double) — the first double input argument -
u(double) — the second double input argument
-
- Returns: the function result
andThen(...) -> DoubleBiFunction<V>
-
Signature:
default <V> DoubleBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleBiPredicate (com.landawn.abacus.util.function.DoubleBiPredicate)
Represents a predicate (boolean-valued function) of two double-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(double t, double u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(double) — the first double input argument -
u(double) — the second double input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> DoubleBiPredicate
-
Signature:
default DoubleBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> DoubleBiPredicate
-
Signature:
default DoubleBiPredicate and(final DoubleBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(DoubleBiPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> DoubleBiPredicate
-
Signature:
default DoubleBiPredicate or(final DoubleBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(DoubleBiPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface DoubleBinaryOperator (com.landawn.abacus.util.function.DoubleBinaryOperator)
Represents an operation upon two double-valued operands and producing a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(double left, double right) - Summary: Applies this operator to the given {@code double} -valued operands and produces a {@code double} -valued result.
-
Parameters:
-
left(double) — the first operand -
right(double) — the second operand
-
- Returns: the operator result
Interface DoubleConsumer (com.landawn.abacus.util.function.DoubleConsumer)
Represents an operation that accepts a single {@code double} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(double value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(double) — the input argument
-
andThen(...) -> DoubleConsumer
-
Signature:
@Override default DoubleConsumer andThen(final java.util.function.DoubleConsumer after) - Summary: Returns a composed {@code DoubleConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleConsumer logger = d -> System.out.println("Processing: " + d); DoubleConsumer validator = d -> { if (d < 0) throw new IllegalArgumentException(); }; DoubleConsumer combined = logger.andThen(validator); combined.accept(5.5); // Logs then validates } </pre>
-
Parameters:
-
after(java.util.function.DoubleConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code DoubleConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface DoubleFunction (com.landawn.abacus.util.function.DoubleFunction)
Represents a function that accepts a double-valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> DoubleFunction<Double>
-
Signature:
static DoubleFunction<Double> identity() - Summary: Returns a function that always returns its input argument unchanged as a {@link Double} object.
-
Contract:
- It is useful when a {@code DoubleFunction<Double>} is required but no transformation is needed.
-
Parameters:
- (none)
- Returns: a function that always returns its double input argument as a {@link Double}
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(double value) - Summary: Applies this function to the given double-valued argument and produces a result.
-
Parameters:
-
value(double) — the double function argument
-
- Returns: the function result
andThen(...) -> DoubleFunction<V>
-
Signature:
default <V> DoubleFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleMapMultiConsumer (com.landawn.abacus.util.function.DoubleMapMultiConsumer)
Represents an operation that accepts a double-valued argument and a DoubleConsumer, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(double value, java.util.function.DoubleConsumer consumer) - Summary: Performs a one-to-many transformation on the given double value.
-
Parameters:
-
value(double) — the input double value to be transformed -
consumer(java.util.function.DoubleConsumer) — the consumer that accepts the transformed values. The implementation should call {@code consumer.accept(double)} for each output value. May be called zero or more times
-
Interface DoubleNConsumer (com.landawn.abacus.util.function.DoubleNConsumer)
Represents an operation that accepts a variable number of double-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(double... args) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
args(double[]) — the double input arguments as a varargs array
-
andThen(...) -> DoubleNConsumer
-
Signature:
default DoubleNConsumer andThen(final DoubleNConsumer after) - Summary: Returns a composed {@code DoubleNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(DoubleNConsumer) — the operation to perform after this operation
-
- Returns: a composed {@code DoubleNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface DoubleNFunction (com.landawn.abacus.util.function.DoubleNFunction)
Represents a function that accepts a variable number of double-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(double... args) - Summary: Applies this function to the given arguments.
-
Contract:
- <p> Common use cases include: <ul> <li> Computing statistical measures (mean, median, standard deviation, etc.) </li> <li> Performing numerical analysis on datasets </li> <li> Converting arrays of double values into formatted outputs </li> <li> Implementing variadic mathematical functions </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleNFunction<Double> average = args -> { if (args.length == 0) return 0.0; double sum = 0.0; for (double value : args) sum += value; return sum / args.length; }; Double avg = average.apply(1.5, 2.5, 3.5); // Returns 2.5 } </pre>
-
Parameters:
-
args(double[]) — the double input arguments as a varargs array. Can be empty, contain a single value, or multiple values
-
- Returns: the function result
andThen(...) -> DoubleNFunction<V>
-
Signature:
@Override default <V> DoubleNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleObjConsumer (com.landawn.abacus.util.function.DoubleObjConsumer)
Represents an operation that accepts a double-valued argument and an object-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(double i, T t) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(double) — the double input argument -
t(T) — the object input argument
-
andThen(...) -> DoubleObjConsumer<T>
-
Signature:
default DoubleObjConsumer<T> andThen(final DoubleObjConsumer<? super T> after) - Summary: Returns a composed {@code DoubleObjConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleObjConsumer<String> logger = (val, msg) -> System.out.println(msg + ": " + val); DoubleObjConsumer<String> validator = (val, msg) -> { if (val < 0) throw new IllegalArgumentException(msg); }; DoubleObjConsumer<String> combined = logger.andThen(validator); combined.accept(5.5, "value"); // Logs then validates } </pre>
-
Parameters:
-
after(DoubleObjConsumer<? super T>) — the operation to perform after this operation
-
- Returns: a composed {@code DoubleObjConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface DoubleObjFunction (com.landawn.abacus.util.function.DoubleObjFunction)
Represents a function that accepts a double-valued argument and an object-valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(double t, T u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(double) — the double input argument -
u(T) — the object input argument
-
- Returns: the function result
andThen(...) -> DoubleObjFunction<T, V>
-
Signature:
default <V> DoubleObjFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleObjPredicate (com.landawn.abacus.util.function.DoubleObjPredicate)
Represents a predicate (boolean-valued function) of a double-valued argument and an object-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(double t, T u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(double) — the double input argument -
u(T) — the object input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> DoubleObjPredicate<T>
-
Signature:
default DoubleObjPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> DoubleObjPredicate<T>
-
Signature:
default DoubleObjPredicate<T> and(final DoubleObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(DoubleObjPredicate<T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> DoubleObjPredicate<T>
-
Signature:
default DoubleObjPredicate<T> or(final DoubleObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
-
Parameters:
-
other(DoubleObjPredicate<T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface DoublePredicate (com.landawn.abacus.util.function.DoublePredicate)
Represents a predicate (boolean-valued function) of one {@code double} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> DoublePredicate
-
Signature:
static DoublePredicate of(final DoublePredicate predicate) - Summary: Returns the specified {@code DoublePredicate} instance.
-
Parameters:
-
predicate(DoublePredicate) — the predicate to return
-
- Returns: the specified predicate
equal(...) -> DoublePredicate
-
Signature:
static DoublePredicate equal(final double targetDouble) - Summary: Returns a predicate that tests if a double value is equal to the target value using {@link N#equals(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is equal to the target value using {@link N#equals(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is equal to {@code targetDouble}
notEqual(...) -> DoublePredicate
-
Signature:
static DoublePredicate notEqual(final double targetDouble) - Summary: Returns a predicate that tests if a double value is not equal to the target value using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is not equal to the target value using {@link N#compare(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is not equal to {@code targetDouble}
greaterThan(...) -> DoublePredicate
-
Signature:
static DoublePredicate greaterThan(final double targetDouble) - Summary: Returns a predicate that tests if a double value is greater than the target value using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is greater than the target value using {@link N#compare(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetDouble}
greaterEqual(...) -> DoublePredicate
-
Signature:
static DoublePredicate greaterEqual(final double targetDouble) - Summary: Returns a predicate that tests if a double value is greater than or equal to the target value using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is greater than or equal to the target value using {@link N#compare(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetDouble}
lessThan(...) -> DoublePredicate
-
Signature:
static DoublePredicate lessThan(final double targetDouble) - Summary: Returns a predicate that tests if a double value is less than the target value using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is less than the target value using {@link N#compare(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetDouble}
lessEqual(...) -> DoublePredicate
-
Signature:
static DoublePredicate lessEqual(final double targetDouble) - Summary: Returns a predicate that tests if a double value is less than or equal to the target value using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is less than or equal to the target value using {@link N#compare(double, double)} .
-
Parameters:
-
targetDouble(double) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetDouble}
between(...) -> DoublePredicate
-
Signature:
static DoublePredicate between(final double minValue, final double maxValue) - Summary: Returns a predicate that tests if a double value is between two values (exclusive) using {@link N#compare(double, double)} .
-
Contract:
- Returns a predicate that tests if a double value is between two values (exclusive) using {@link N#compare(double, double)} .
- The predicate returns {@code true} if the value is greater than {@code minValue} and less than {@code maxValue} .
-
Parameters:
-
minValue(double) — the lower bound (exclusive) -
maxValue(double) — the upper bound (exclusive)
-
- Returns: a predicate that tests if the input is between {@code minValue} and {@code maxValue}
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(double value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(double) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> DoublePredicate
-
Signature:
@Override default DoublePredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> DoublePredicate
-
Signature:
@Override default DoublePredicate and(final java.util.function.DoublePredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(java.util.function.DoublePredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> DoublePredicate
-
Signature:
@Override default DoublePredicate or(final java.util.function.DoublePredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(java.util.function.DoublePredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface DoubleSupplier (com.landawn.abacus.util.function.DoubleSupplier)
Represents a supplier of double-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsDouble(...) -> double
-
Signature:
@Override double getAsDouble() - Summary: Gets a double result.
-
Parameters:
- (none)
- Returns: a double value
Interface DoubleTernaryOperator (com.landawn.abacus.util.function.DoubleTernaryOperator)
Represents an operation upon three double-valued operands and producing a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(double a, double b, double c) - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(double) — the first operand -
b(double) — the second operand -
c(double) — the third operand
-
- Returns: the operator result
Interface DoubleToFloatFunction (com.landawn.abacus.util.function.DoubleToFloatFunction)
Represents a function that accepts a double-valued argument and produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(double value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(double) — the double function argument
-
- Returns: the float function result
Interface DoubleToIntFunction (com.landawn.abacus.util.function.DoubleToIntFunction)
Represents a function that accepts a double-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(double value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(double) — the double function argument
-
- Returns: the int function result
Interface DoubleToLongFunction (com.landawn.abacus.util.function.DoubleToLongFunction)
Represents a function that accepts a double-valued argument and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(double value) - Summary: Applies this function to the given double-valued argument and returns a long result.
-
Parameters:
-
value(double) — the double value to be converted to long
-
- Returns: the long result of applying this function to the input value
Interface DoubleTriConsumer (com.landawn.abacus.util.function.DoubleTriConsumer)
Represents an operation that accepts three double-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(double a, double b, double c) - Summary: Performs this operation on the given three double arguments.
-
Parameters:
-
a(double) — the first double argument -
b(double) — the second double argument -
c(double) — the third double argument
-
andThen(...) -> DoubleTriConsumer
-
Signature:
default DoubleTriConsumer andThen(final DoubleTriConsumer after) - Summary: Returns a composed {@code DoubleTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(DoubleTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code DoubleTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface DoubleTriFunction (com.landawn.abacus.util.function.DoubleTriFunction)
Represents a function that accepts three double-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(double a, double b, double c) - Summary: Applies this function to the given three double arguments and produces a result.
-
Parameters:
-
a(double) — the first double argument -
b(double) — the second double argument -
c(double) — the third double argument
-
- Returns: the function result of type {@code R}
andThen(...) -> DoubleTriFunction<V>
-
Signature:
default <V> DoubleTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface DoubleTriPredicate (com.landawn.abacus.util.function.DoubleTriPredicate)
Represents a predicate (boolean-valued function) of three double-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(double a, double b, double c) - Summary: Evaluates this predicate on the given three double arguments.
-
Contract:
- </p> <p> Common use cases include: </p> <ul> <li> Validating three-dimensional coordinates (e.g., checking if a point is within bounds) </li> <li> Testing mathematical relationships (e.g., triangle inequality: a + b > c) </li> <li> Checking color values (e.g., RGB values within valid range) </li> <li> Validating measurement constraints </li> </ul>
-
Parameters:
-
a(double) — the first double argument to test -
b(double) — the second double argument to test -
c(double) — the third double argument to test
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> DoubleTriPredicate
-
Signature:
default DoubleTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> DoubleTriPredicate
-
Signature:
default DoubleTriPredicate and(final DoubleTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(DoubleTriPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> DoubleTriPredicate
-
Signature:
default DoubleTriPredicate or(final DoubleTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(DoubleTriPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface DoubleUnaryOperator (com.landawn.abacus.util.function.DoubleUnaryOperator)
Represents an operation on a single double-valued operand that produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> DoubleUnaryOperator
-
Signature:
static DoubleUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument unchanged.
-
Contract:
- <p> This method is useful in scenarios where a {@code DoubleUnaryOperator} is required but no transformation should be performed on the input value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleUnaryOperator identity = DoubleUnaryOperator.identity(); double result = identity.applyAsDouble(42.5); // Returns 42.5 // Useful in conditional operations DoubleUnaryOperator operation = shouldTransform ?
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(double operand) - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(double) — the operand to which the operation is applied
-
- Returns: the result of applying this operator to the operand
compose(...) -> DoubleUnaryOperator
-
Signature:
@Override default DoubleUnaryOperator compose(final java.util.function.DoubleUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(java.util.function.DoubleUnaryOperator) — the operator to apply before this operator is applied
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(java.util.function.DoubleUnaryOperator)
andThen(...) -> DoubleUnaryOperator
-
Signature:
@Override default DoubleUnaryOperator andThen(final java.util.function.DoubleUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(java.util.function.DoubleUnaryOperator) — the operator to apply after this operator is applied
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(java.util.function.DoubleUnaryOperator)
Interface FloatBiConsumer (com.landawn.abacus.util.function.FloatBiConsumer)
Represents an operation that accepts two float-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(float t, float u) - Summary: Performs this operation on the given two float arguments.
-
Parameters:
-
t(float) — the first float argument -
u(float) — the second float argument
-
andThen(...) -> FloatBiConsumer
-
Signature:
default FloatBiConsumer andThen(final FloatBiConsumer after) - Summary: Returns a composed {@code FloatBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(FloatBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code FloatBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface FloatBiFunction (com.landawn.abacus.util.function.FloatBiFunction)
Represents a function that accepts two float-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(float t, float u) - Summary: Applies this function to the given two float arguments and produces a result.
-
Parameters:
-
t(float) — the first float argument -
u(float) — the second float argument
-
- Returns: the function result of type {@code R}
andThen(...) -> FloatBiFunction<V>
-
Signature:
default <V> FloatBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface FloatBiPredicate (com.landawn.abacus.util.function.FloatBiPredicate)
Represents a predicate (boolean-valued function) of two float-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(float t, float u) - Summary: Evaluates this predicate on the given two float arguments.
-
Contract:
- </p> <p> Common use cases include: </p> <ul> <li> Comparing two float values for equality or ordering </li> <li> Checking if two values are within a certain range of each other </li> <li> Testing mathematical relationships between two values </li> <li> Validating constraints on pairs of measurements </li> </ul>
-
Parameters:
-
t(float) — the first float argument to test -
u(float) — the second float argument to test
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> FloatBiPredicate
-
Signature:
default FloatBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> FloatBiPredicate
-
Signature:
default FloatBiPredicate and(final FloatBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(FloatBiPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> FloatBiPredicate
-
Signature:
default FloatBiPredicate or(final FloatBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(FloatBiPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface FloatBinaryOperator (com.landawn.abacus.util.function.FloatBinaryOperator)
Represents an operation upon two float-valued operands and producing a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
@Override float applyAsFloat(float left, float right) - Summary: Applies this operator to the given operands and returns the float result.
-
Parameters:
-
left(float) — the first operand (left-hand side of the operation) -
right(float) — the second operand (right-hand side of the operation)
-
- Returns: the result of applying this operator to the operands
Interface FloatConsumer (com.landawn.abacus.util.function.FloatConsumer)
Represents an operation that accepts a single {@code float} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(float value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(float) — the input argument
-
andThen(...) -> FloatConsumer
-
Signature:
default FloatConsumer andThen(final FloatConsumer after) - Summary: Returns a composed {@code FloatConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code FloatConsumer logger = value -> System.out.println("Processing: " + value); FloatConsumer validator = value -> { if (value < 0) throw new IllegalArgumentException(); }; FloatConsumer combined = logger.andThen(validator); combined.accept(5.5f); // Logs then validates } </pre>
-
Parameters:
-
after(FloatConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code FloatConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface FloatFunction (com.landawn.abacus.util.function.FloatFunction)
Represents a function that accepts a {@code float} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> FloatFunction<Float>
-
Signature:
static FloatFunction<Float> identity() - Summary: Returns a function that always returns its input argument as a {@link Float} object.
-
Contract:
- <p> This method is useful when you need a {@code FloatFunction<Float>} that performs no transformation other than boxing the primitive value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code FloatFunction<Float> identity = FloatFunction.identity(); Float result = identity.apply(42.0f); // Returns Float.valueOf(42.0f) // Useful in conditional operations FloatFunction<Float> processor = shouldProcess ?
-
Parameters:
- (none)
- Returns: a function that always returns its input argument as a boxed Float
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(float value) - Summary: Applies this function to the given float-valued argument and produces a result.
-
Parameters:
-
value(float) — the float value to be processed
-
- Returns: the function result of type {@code R}
andThen(...) -> FloatFunction<V>
-
Signature:
default <V> FloatFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface FloatNConsumer (com.landawn.abacus.util.function.FloatNConsumer)
Represents an operation that accepts a variable number of float-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(float... args) - Summary: Performs this operation on the given float arguments.
-
Parameters:
-
args(float[]) — the float values to be processed. May be empty, in which case the consumer should handle the empty array appropriately.
-
andThen(...) -> FloatNConsumer
-
Signature:
default FloatNConsumer andThen(final FloatNConsumer after) - Summary: Returns a composed {@code FloatNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(FloatNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code FloatNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface FloatNFunction (com.landawn.abacus.util.function.FloatNFunction)
Represents a function that accepts a variable number of float-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(float... args) - Summary: Applies this function to the given float arguments.
-
Contract:
- <p> The function implementation should define how the variable number of float arguments are processed to produce the result.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code FloatNFunction<Float> average = args -> { if (args.length == 0) return 0.0f; float sum = 0; for (float f : args) sum += f; return sum / args.length; }; Float avg = average.apply(1.0f, 2.0f, 3.0f); // Returns 2.0f } </pre>
-
Parameters:
-
args(float[]) — the float values to be processed. May be empty, in which case the function should handle the empty array appropriately.
-
- Returns: the function result
andThen(...) -> FloatNFunction<V>
-
Signature:
@Override default <V> FloatNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface FloatPredicate (com.landawn.abacus.util.function.FloatPredicate)
Represents a predicate (boolean-valued function) of one {@code float} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> FloatPredicate
-
Signature:
static FloatPredicate of(final FloatPredicate predicate) - Summary: Returns the specified predicate instance.
-
Parameters:
-
predicate(FloatPredicate) — the predicate to return
-
- Returns: the specified predicate
equal(...) -> FloatPredicate
-
Signature:
static FloatPredicate equal(final float targetFloat) - Summary: Returns a predicate that tests if the float value is equal to the target value.
-
Contract:
- Returns a predicate that tests if the float value is equal to the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is equal to {@code targetFloat}
notEqual(...) -> FloatPredicate
-
Signature:
static FloatPredicate notEqual(final float targetFloat) - Summary: Returns a predicate that tests if the float value is not equal to the target value.
-
Contract:
- Returns a predicate that tests if the float value is not equal to the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is not equal to {@code targetFloat}
greaterThan(...) -> FloatPredicate
-
Signature:
static FloatPredicate greaterThan(final float targetFloat) - Summary: Returns a predicate that tests if the float value is greater than the target value.
-
Contract:
- Returns a predicate that tests if the float value is greater than the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetFloat}
greaterEqual(...) -> FloatPredicate
-
Signature:
static FloatPredicate greaterEqual(final float targetFloat) - Summary: Returns a predicate that tests if the float value is greater than or equal to the target value.
-
Contract:
- Returns a predicate that tests if the float value is greater than or equal to the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetFloat}
lessThan(...) -> FloatPredicate
-
Signature:
static FloatPredicate lessThan(final float targetFloat) - Summary: Returns a predicate that tests if the float value is less than the target value.
-
Contract:
- Returns a predicate that tests if the float value is less than the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetFloat}
lessEqual(...) -> FloatPredicate
-
Signature:
static FloatPredicate lessEqual(final float targetFloat) - Summary: Returns a predicate that tests if the float value is less than or equal to the target value.
-
Contract:
- Returns a predicate that tests if the float value is less than or equal to the target value.
-
Parameters:
-
targetFloat(float) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetFloat}
between(...) -> FloatPredicate
-
Signature:
static FloatPredicate between(final float minValue, final float maxValue) - Summary: Returns a predicate that tests if the float value is strictly between the specified bounds.
-
Contract:
- Returns a predicate that tests if the float value is strictly between the specified bounds.
- The test is exclusive, meaning the value must be greater than {@code minValue} and less than {@code maxValue} .
-
Parameters:
-
minValue(float) — the exclusive lower bound -
maxValue(float) — the exclusive upper bound
-
- Returns: a predicate that tests if the input is between {@code minValue} and {@code maxValue}
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(float value) - Summary: Evaluates this predicate on the given float value.
-
Parameters:
-
value(float) — the float value to test
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> FloatPredicate
-
Signature:
default FloatPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> FloatPredicate
-
Signature:
default FloatPredicate and(final FloatPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(FloatPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> FloatPredicate
-
Signature:
default FloatPredicate or(final FloatPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(FloatPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface FloatSupplier (com.landawn.abacus.util.function.FloatSupplier)
Represents a supplier of float-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsFloat(...) -> float
-
Signature:
@Override float getAsFloat() - Summary: Gets a float result.
-
Parameters:
- (none)
- Returns: a float value
Interface FloatTernaryOperator (com.landawn.abacus.util.function.FloatTernaryOperator)
Represents an operation on three float-valued operands that produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
@Override float applyAsFloat(float a, float b, float c) - Summary: Applies this operator to the given float operands.
-
Parameters:
-
a(float) — the first float operand -
b(float) — the second float operand -
c(float) — the third float operand
-
- Returns: the float result of applying this operator to the given operands
Interface FloatToDoubleFunction (com.landawn.abacus.util.function.FloatToDoubleFunction)
Represents a function that accepts a float-valued argument and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
double applyAsDouble(float value) - Summary: Applies this function to the given float argument.
-
Contract:
- <p> The implementation should define how the float value is transformed into a double value.
-
Parameters:
-
value(float) — the float function argument
-
- Returns: the double function result
Interface FloatToIntFunction (com.landawn.abacus.util.function.FloatToIntFunction)
Represents a function that accepts a float-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(float value) - Summary: Applies this function to the given float argument.
-
Contract:
- <p> The implementation should define how the float value is transformed into an int value.
-
Parameters:
-
value(float) — the float function argument
-
- Returns: the int function result
Interface FloatToLongFunction (com.landawn.abacus.util.function.FloatToLongFunction)
Represents a function that accepts a float-valued argument and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
long applyAsLong(float value) - Summary: Applies this function to the given float argument.
-
Contract:
- <p> The implementation should define how the float value is transformed into a long value.
-
Parameters:
-
value(float) — the float function argument
-
- Returns: the long function result
Interface FloatTriConsumer (com.landawn.abacus.util.function.FloatTriConsumer)
Represents an operation that accepts three float-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(float a, float b, float c) - Summary: Performs this operation on the given float arguments.
-
Parameters:
-
a(float) — the first float input argument -
b(float) — the second float input argument -
c(float) — the third float input argument
-
andThen(...) -> FloatTriConsumer
-
Signature:
default FloatTriConsumer andThen(final FloatTriConsumer after) - Summary: Returns a composed {@code FloatTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(FloatTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code FloatTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface FloatTriFunction (com.landawn.abacus.util.function.FloatTriFunction)
Represents a function that accepts three float-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(float a, float b, float c) - Summary: Applies this function to the given float arguments.
-
Contract:
- <p> The function implementation should define how the three float arguments are processed to produce the result.
-
Parameters:
-
a(float) — the first float function argument -
b(float) — the second float function argument -
c(float) — the third float function argument
-
- Returns: the function result
andThen(...) -> FloatTriFunction<V>
-
Signature:
default <V> FloatTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface FloatTriPredicate (com.landawn.abacus.util.function.FloatTriPredicate)
Represents a predicate (boolean-valued function) of three float-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(float a, float b, float c) - Summary: Evaluates this predicate on the given float arguments.
-
Contract:
- <p> The implementation should define the condition under which the three float arguments satisfy this predicate.
-
Parameters:
-
a(float) — the first float input argument -
b(float) — the second float input argument -
c(float) — the third float input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> FloatTriPredicate
-
Signature:
default FloatTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> FloatTriPredicate
-
Signature:
default FloatTriPredicate and(final FloatTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(FloatTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> FloatTriPredicate
-
Signature:
default FloatTriPredicate or(final FloatTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(FloatTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface FloatUnaryOperator (com.landawn.abacus.util.function.FloatUnaryOperator)
Represents an operation on a single float-valued operand that produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> FloatUnaryOperator
-
Signature:
static FloatUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument unchanged.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
@Override float applyAsFloat(float operand) - Summary: Applies this operator to the given float operand.
-
Contract:
- <p> The implementation should define how the float value is transformed.
-
Parameters:
-
operand(float) — the float operand
-
- Returns: the float result of applying this operator
compose(...) -> FloatUnaryOperator
-
Signature:
default FloatUnaryOperator compose(final FloatUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(FloatUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(FloatUnaryOperator)
andThen(...) -> FloatUnaryOperator
-
Signature:
default FloatUnaryOperator andThen(final FloatUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(FloatUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(FloatUnaryOperator)
Interface Function (com.landawn.abacus.util.function.Function)
Represents a function that accepts one argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> Function<T, T>
-
Signature:
static <T> Function<T, T> identity() - Summary: Returns a function that always returns its input argument unchanged.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument
Public Instance Methods
compose(...) -> Function<V, R>
-
Signature:
@Override default <V> Function<V, R> compose(final java.util.function.Function<? super V, ? extends T> before) - Summary: Returns a composed function that first applies the {@code before} function to its input, and then applies this function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
before(java.util.function.Function<? super V, ? extends T>) — the function to apply before this function is applied. Must not be {@code null} .
-
- Returns: a composed {@code Function} that first applies the {@code before} function and then applies this function
- See also: #andThen(java.util.function.Function)
andThen(...) -> Function<T, V>
-
Signature:
@Override default <V> Function<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed {@code Function} that first applies this function and then applies the {@code after} function
- See also: #compose(java.util.function.Function)
toThrowable(...) -> Throwables.Function<T, R, E>
-
Signature:
default <E extends Throwable> Throwables.Function<T, R, E> toThrowable() - Summary: Converts this function to a {@link Throwables.Function} that can throw checked exceptions.
-
Parameters:
- (none)
- Returns: a {@code Throwables.Function} view of this function
Interface IntBiConsumer (com.landawn.abacus.util.function.IntBiConsumer)
Represents an operation that accepts two {@code int} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int t, int u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(int) — the first {@code int} argument -
u(int) — the second {@code int} argument
-
andThen(...) -> IntBiConsumer
-
Signature:
default IntBiConsumer andThen(final IntBiConsumer after) - Summary: Returns a composed {@code IntBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code IntBiConsumer logger = (x, y) -> System.out.println("Processing: " + x + ", " + y); IntBiConsumer validator = (x, y) -> { if (x < 0 || y < 0) throw new IllegalArgumentException(); }; IntBiConsumer combined = logger.andThen(validator); combined.accept(10, 20); // Logs then validates } </pre>
-
Parameters:
-
after(IntBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code IntBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntBiFunction (com.landawn.abacus.util.function.IntBiFunction)
Represents a function that accepts two {@code int} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int t, int u) - Summary: Applies this function to the given {@code int} -valued arguments and produces a result.
-
Parameters:
-
t(int) — the first {@code int} argument -
u(int) — the second {@code int} argument
-
- Returns: the function result
andThen(...) -> IntBiFunction<V>
-
Signature:
default <V> IntBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntBiObjConsumer (com.landawn.abacus.util.function.IntBiObjConsumer)
Represents an operation that accepts one {@code int} -valued argument and two object-valued arguments, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int i, T t, U u) - Summary: Performs this operation on the given arguments.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Setting a value in a map at a specific index IntBiObjConsumer<Map<String, String>, String> mapSetter = (index, map, value) -> map.put("key" + index, value); Map<String, String> map = new HashMap<>(); mapSetter.accept(1, map, "firstValue"); // map now contains {"key1": "firstValue"} // Updating a list element at an index IntBiObjConsumer<List<String>, String> listUpdater = (index, list, value) -> { if (index < list.size()) list.set(index, value); }; List<String> list = Arrays.asList("a", "b", "c"); listUpdater.accept(1, list, "updated"); // list is now \["a", "updated", "c"\] } </pre>
-
Parameters:
-
i(int) — the {@code int} argument -
t(T) — the first object argument -
u(U) — the second object argument
-
andThen(...) -> IntBiObjConsumer<T, U>
-
Signature:
default IntBiObjConsumer<T, U> andThen(final IntBiObjConsumer<? super T, ? super U> after) - Summary: Returns a composed {@code IntBiObjConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(IntBiObjConsumer<? super T, ? super U>) — the operation to perform after this operation
-
- Returns: a composed {@code IntBiObjConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntBiObjFunction (com.landawn.abacus.util.function.IntBiObjFunction)
Represents a function that accepts one {@code int} -valued argument and two object-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int i, T t, U u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
i(int) — the {@code int} argument -
t(T) — the first object argument -
u(U) — the second object argument
-
- Returns: the function result
andThen(...) -> IntBiObjFunction<T, U, V>
-
Signature:
default <V> IntBiObjFunction<T, U, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed {@code IntBiObjFunction} that first applies this function and then applies the {@code after} function
Interface IntBiObjPredicate (com.landawn.abacus.util.function.IntBiObjPredicate)
Represents a predicate (boolean-valued function) of one {@code int} -valued and two object-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int i, T t, U u) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if an index is within bounds and string matches pattern IntBiObjPredicate<List<String>, String> isValidUpdate = (index, list, value) -> index >= 0 && index < list.size() && value != null; List<String> list = Arrays.asList("a", "b", "c"); boolean canUpdate = isValidUpdate.test(1, list, "newValue"); // returns true boolean invalid = isValidUpdate.test(5, list, "newValue"); // returns false (out of bounds) // Check if a map contains a key and value matches condition IntBiObjPredicate<Map<String, String>, String> hasKeyAndValueLength = (minLength, map, key) -> map.containsKey(key) && map.get(key) != null && map.get(key).length() >= minLength; Map<String, String> map = Map.of("user1", "Alice", "user2", "Bob"); boolean result = hasKeyAndValueLength.test(3, map, "user1"); // returns true ("Alice".length() >= 3) } </pre>
-
Parameters:
-
i(int) — the {@code int} argument -
t(T) — the first object argument -
u(U) — the second object argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> IntBiObjPredicate<T, U>
-
Signature:
default IntBiObjPredicate<T, U> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> IntBiObjPredicate<T, U>
-
Signature:
default IntBiObjPredicate<T, U> and(final IntBiObjPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntBiObjPredicate<? super T, ? super U>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> IntBiObjPredicate<T, U>
-
Signature:
default IntBiObjPredicate<T, U> or(final IntBiObjPredicate<? super T, ? super U> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntBiObjPredicate<? super T, ? super U>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface IntBiPredicate (com.landawn.abacus.util.function.IntBiPredicate)
Represents a predicate (boolean-valued function) of two {@code int} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int t, int u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(int) — the first {@code int} argument -
u(int) — the second {@code int} argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> IntBiPredicate
-
Signature:
default IntBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> IntBiPredicate
-
Signature:
default IntBiPredicate and(final IntBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntBiPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> IntBiPredicate
-
Signature:
default IntBiPredicate or(final IntBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntBiPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface IntBinaryOperator (com.landawn.abacus.util.function.IntBinaryOperator)
Represents an operation upon two {@code int} -valued operands and producing an {@code int} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(int left, int right) - Summary: Applies this operator to the given {@code int} -valued operands and produces an {@code int} -valued result.
-
Parameters:
-
left(int) — the first operand -
right(int) — the second operand
-
- Returns: the operator result
Interface IntConsumer (com.landawn.abacus.util.function.IntConsumer)
Represents an operation that accepts a single {@code int} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(int) — the input argument
-
andThen(...) -> IntConsumer
-
Signature:
@Override default IntConsumer andThen(final java.util.function.IntConsumer after) - Summary: Returns a composed {@code IntConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code IntConsumer logger = value -> System.out.println("Processing: " + value); IntConsumer validator = value -> { if (value < 0) throw new IllegalArgumentException(); }; IntConsumer combined = logger.andThen(validator); combined.accept(100); // Logs then validates } </pre>
-
Parameters:
-
after(java.util.function.IntConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code IntConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntFunction (com.landawn.abacus.util.function.IntFunction)
Represents a function that accepts an {@code int} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> IntFunction<Integer>
-
Signature:
static IntFunction<Integer> identity() - Summary: Returns a function that always returns its input argument as an {@link Integer} .
-
Parameters:
- (none)
- Returns: a function that always returns its input argument boxed as an {@link Integer}
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(int) — the function argument
-
- Returns: the function result
andThen(...) -> IntFunction<V>
-
Signature:
default <V> IntFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntMapMultiConsumer (com.landawn.abacus.util.function.IntMapMultiConsumer)
Represents an operation that accepts an int-valued argument and an IntConsumer, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int value, java.util.function.IntConsumer consumer) - Summary: Performs a one-to-many transformation on the given int value.
-
Parameters:
-
value(int) — the input int value to be transformed -
consumer(java.util.function.IntConsumer) — the consumer that accepts the transformed values. The implementation should call {@code consumer.accept(int)} for each output value. May be called zero or more times
-
Interface IntNConsumer (com.landawn.abacus.util.function.IntNConsumer)
Represents an operation that accepts a variable number of {@code int} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(int... args) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
args(int[]) — the input arguments as a variable-length array of {@code int} values
-
andThen(...) -> IntNConsumer
-
Signature:
default IntNConsumer andThen(final IntNConsumer after) - Summary: Returns a composed {@code IntNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(IntNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code IntNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntNFunction (com.landawn.abacus.util.function.IntNFunction)
Represents a function that accepts a variable number of {@code int} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int... args) - Summary: Applies this function to the given arguments.
-
Parameters:
-
args(int[]) — the function arguments as a variable-length array of {@code int} values. Can be empty, contain a single value, or multiple values
-
- Returns: the function result
andThen(...) -> IntNFunction<V>
-
Signature:
@Override default <V> IntNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntObjConsumer (com.landawn.abacus.util.function.IntObjConsumer)
Represents an operation that accepts an {@code int} -valued and an object-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int i, T t) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
i(int) — the {@code int} argument -
t(T) — the object argument
-
andThen(...) -> IntObjConsumer<T>
-
Signature:
default IntObjConsumer<T> andThen(final IntObjConsumer<? super T> after) - Summary: Returns a composed {@code IntObjConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(IntObjConsumer<? super T>) — the operation to perform after this operation
-
- Returns: a composed {@code IntObjConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntObjFunction (com.landawn.abacus.util.function.IntObjFunction)
Represents a function that accepts an {@code int} -valued and an object-valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int t, T u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(int) — the {@code int} argument -
u(T) — the object argument
-
- Returns: the function result
andThen(...) -> IntObjFunction<T, V>
-
Signature:
default <V> IntObjFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntObjOperator (com.landawn.abacus.util.function.IntObjOperator)
Represents an operation upon an {@code int} -valued operand and an object-valued operand which produces an {@code int} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(int operand, T obj) - Summary: Applies this operator to the given operands.
-
Parameters:
-
operand(int) — the {@code int} operand -
obj(T) — the object operand
-
- Returns: the operator result
Interface IntObjPredicate (com.landawn.abacus.util.function.IntObjPredicate)
Represents a predicate (boolean-valued function) of an {@code int} -valued and an object-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int t, T u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(int) — the {@code int} argument -
u(T) — the object argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> IntObjPredicate<T>
-
Signature:
default IntObjPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> IntObjPredicate<T>
-
Signature:
default IntObjPredicate<T> and(final IntObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntObjPredicate<T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> IntObjPredicate<T>
-
Signature:
default IntObjPredicate<T> or(final IntObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntObjPredicate<T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface IntPredicate (com.landawn.abacus.util.function.IntPredicate)
Represents a predicate (boolean-valued function) of one {@code int} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> IntPredicate
-
Signature:
static IntPredicate of(final IntPredicate predicate) - Summary: Returns the specified {@code IntPredicate} instance.
-
Parameters:
-
predicate(IntPredicate) — the predicate to return
-
- Returns: the specified predicate
equal(...) -> IntPredicate
-
Signature:
static IntPredicate equal(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is equal to the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is equal to the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is equal to {@code targetInt}
notEqual(...) -> IntPredicate
-
Signature:
static IntPredicate notEqual(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is not equal to the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is not equal to the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is not equal to {@code targetInt}
greaterThan(...) -> IntPredicate
-
Signature:
static IntPredicate greaterThan(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is greater than the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is greater than the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is greater than {@code targetInt}
greaterEqual(...) -> IntPredicate
-
Signature:
static IntPredicate greaterEqual(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is greater than or equal to the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is greater than or equal to the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is greater than or equal to {@code targetInt}
lessThan(...) -> IntPredicate
-
Signature:
static IntPredicate lessThan(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is less than the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is less than the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is less than {@code targetInt}
lessEqual(...) -> IntPredicate
-
Signature:
static IntPredicate lessEqual(final int targetInt) - Summary: Returns a predicate that tests if an {@code int} value is less than or equal to the target value.
-
Contract:
- Returns a predicate that tests if an {@code int} value is less than or equal to the target value.
-
Parameters:
-
targetInt(int) — the value to compare against
-
- Returns: a predicate that tests if an {@code int} value is less than or equal to {@code targetInt}
between(...) -> IntPredicate
-
Signature:
static IntPredicate between(final int minValue, final int maxValue) - Summary: Returns a predicate that tests if an {@code int} value is between two values (exclusive).
-
Contract:
- Returns a predicate that tests if an {@code int} value is between two values (exclusive).
- The value must be strictly greater than {@code minValue} and strictly less than {@code maxValue} .
-
Parameters:
-
minValue(int) — the lower bound (exclusive) -
maxValue(int) — the upper bound (exclusive)
-
- Returns: a predicate that tests if an {@code int} value is between {@code minValue} and {@code maxValue}
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(int) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> IntPredicate
-
Signature:
@Override default IntPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> IntPredicate
-
Signature:
@Override default IntPredicate and(final java.util.function.IntPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.IntPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> IntPredicate
-
Signature:
@Override default IntPredicate or(final java.util.function.IntPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.IntPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface IntSupplier (com.landawn.abacus.util.function.IntSupplier)
Represents a supplier of {@code int} -valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsInt(...) -> int
-
Signature:
@Override int getAsInt() - Summary: Gets a result.
-
Parameters:
- (none)
- Returns: an {@code int} value
Interface IntTernaryOperator (com.landawn.abacus.util.function.IntTernaryOperator)
Represents an operation upon three {@code int} -valued operands and producing an {@code int} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(int a, int b, int c) - Summary: Applies this operator to the given operands.
-
Parameters:
-
a(int) — the first operand -
b(int) — the second operand -
c(int) — the third operand
-
- Returns: the operator result
Interface IntToBooleanFunction (com.landawn.abacus.util.function.IntToBooleanFunction)
Represents a function that accepts an {@code int} -valued argument and produces a {@code boolean} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(int value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(int) — the function argument
-
- Returns: the {@code boolean} result
Interface IntToByteFunction (com.landawn.abacus.util.function.IntToByteFunction)
Represents a function that accepts an int-valued argument and produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(int value) - Summary: Applies this function to the given argument.
-
Contract:
- Implementations should be aware that converting from {@code int} to {@code byte} may result in loss of precision, as {@code byte} can only represent values from -128 to 127, while {@code int} can represent values from -2,147,483,648 to 2,147,483,647.
- <p> <b> Usage Examples: </b> </p> <pre> {@code IntToByteFunction toByte = value -> (byte) value; byte result1 = toByte.applyAsByte(65); // Returns 65 (ASCII 'A') byte result2 = toByte.applyAsByte(255); // Returns -1 (overflow) IntToByteFunction clampToByte = value -> { if (value > 127) return 127; if (value < -128) return -128; return (byte) value; }; byte result3 = clampToByte.applyAsByte(200); // Returns 127 (clamped) } </pre>
-
Parameters:
-
value(int) — the function argument, an int value to be converted to byte
-
- Returns: the function result as a byte value. If the input value is outside the range of byte (-128 to 127), the result will be the lower 8 bits of the input value (equivalent to {@code (byte) value} )
Interface IntToCharFunction (com.landawn.abacus.util.function.IntToCharFunction)
Represents a function that accepts an int-valued argument and produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(int value) - Summary: Applies this function to the given argument.
-
Contract:
- If the input int value is outside this range, only the lower 16 bits will be used for the conversion.
-
Parameters:
-
value(int) — the function argument, an int value to be converted to char. This is typically a Unicode code point value
-
- Returns: the function result as a char value. If the input value is outside the valid char range (0 to 65,535), the result will be the lower 16 bits of the input value (equivalent to {@code (char) value} )
Interface IntToDoubleFunction (com.landawn.abacus.util.function.IntToDoubleFunction)
Represents a function that accepts an int-valued argument and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(int value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(int) — the function argument, an int value to be converted to double
-
- Returns: the function result as a double value, which exactly represents the input int value
Interface IntToFloatFunction (com.landawn.abacus.util.function.IntToFloatFunction)
Represents a function that accepts an int-valued argument and produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(int value) - Summary: Applies this function to the given argument.
-
Contract:
- <p> Important considerations: <ul> <li> Float values have approximately 7 decimal digits of precision </li> <li> Int values larger than 2^24 (16,777,216) may lose precision when converted to float </li> <li> The sign of the int value is always preserved </li> <li> Special int values like Integer.MAX_VALUE and Integer.MIN_VALUE will be approximated as float values </li> </ul>
-
Parameters:
-
value(int) — the function argument, an int value to be converted to float
-
- Returns: the function result as a float value. For int values with magnitude greater than 2^24, the result may be an approximation of the input value
Interface IntToLongFunction (com.landawn.abacus.util.function.IntToLongFunction)
Represents a function that accepts an int-valued argument and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(int value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(int) — the function argument, an int value to be converted to long
-
- Returns: the function result as a long value, which exactly represents the input int value with the same sign and magnitude
Interface IntToShortFunction (com.landawn.abacus.util.function.IntToShortFunction)
Represents a function that accepts an int-valued argument and produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(int value) - Summary: Applies this function to the given argument.
-
Contract:
- <p> Conversion behavior: <ul> <li> If the int value is within the short range (-32,768 to 32,767), the value is preserved exactly </li> <li> If the int value is outside the short range, only the lower 16 bits of the int value are retained, which may produce unexpected results </li> <li> For example, 32,768 converts to -32,768, and 65,536 converts to 0 </li> </ul>
-
Parameters:
-
value(int) — the function argument, an int value to be converted to short
-
- Returns: the function result as a short value. If the input value is outside the range of short (-32,768 to 32,767), the result will be the lower 16 bits of the input value (equivalent to {@code (short) value} )
Interface IntTriConsumer (com.landawn.abacus.util.function.IntTriConsumer)
Represents an operation that accepts three {@code int} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(int a, int b, int c) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(int) — the first input argument -
b(int) — the second input argument -
c(int) — the third input argument
-
andThen(...) -> IntTriConsumer
-
Signature:
default IntTriConsumer andThen(final IntTriConsumer after) - Summary: Returns a composed {@code IntTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(IntTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code IntTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface IntTriFunction (com.landawn.abacus.util.function.IntTriFunction)
Represents a function that accepts three {@code int} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(int a, int b, int c) - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(int) — the first function argument -
b(int) — the second function argument -
c(int) — the third function argument
-
- Returns: the function result of type R
andThen(...) -> IntTriFunction<V>
-
Signature:
default <V> IntTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface IntTriPredicate (com.landawn.abacus.util.function.IntTriPredicate)
Represents a predicate (boolean-valued function) of three {@code int} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(int a, int b, int c) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- Common use cases include: <ul> <li> Validating three-dimensional coordinates (e.g., checking if a point is within bounds) </li> <li> Testing relationships between three values (e.g., triangle inequality) </li> <li> Checking RGB color values for validity </li> <li> Verifying conditions on three indices or counters </li> <li> Implementing three-way comparison logic </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code IntTriPredicate isValidTriangle = (a, b, c) -> a + b > c && a + c > b && b + c > a; boolean result = isValidTriangle.test(3, 4, 5); // Returns true } </pre>
-
Parameters:
-
a(int) — the first input argument -
b(int) — the second input argument -
c(int) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> IntTriPredicate
-
Signature:
default IntTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> If this predicate returns {@code true} for given inputs, the negated predicate will return {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> IntTriPredicate
-
Signature:
default IntTriPredicate and(final IntTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> IntTriPredicate
-
Signature:
default IntTriPredicate or(final IntTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(IntTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface IntUnaryOperator (com.landawn.abacus.util.function.IntUnaryOperator)
Represents an operation on a single {@code int} -valued operand that produces an {@code int} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> IntUnaryOperator
-
Signature:
static IntUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Contract:
- <p> This is useful as a default operator or when an operator is required but no transformation is needed.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(int operand) - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(int) — the operand to which the operation is applied
-
- Returns: the operator result
compose(...) -> IntUnaryOperator
-
Signature:
@Override default IntUnaryOperator compose(final java.util.function.IntUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(java.util.function.IntUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(java.util.function.IntUnaryOperator)
andThen(...) -> IntUnaryOperator
-
Signature:
@Override default IntUnaryOperator andThen(final java.util.function.IntUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(java.util.function.IntUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(java.util.function.IntUnaryOperator)
Interface LongBiConsumer (com.landawn.abacus.util.function.LongBiConsumer)
Represents an operation that accepts two {@code long} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(long t, long u) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(long) — the first input argument -
u(long) — the second input argument
-
andThen(...) -> LongBiConsumer
-
Signature:
default LongBiConsumer andThen(final LongBiConsumer after) - Summary: Returns a composed {@code LongBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(LongBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code LongBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface LongBiFunction (com.landawn.abacus.util.function.LongBiFunction)
Represents a function that accepts two {@code long} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(long t, long u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(long) — the first function argument -
u(long) — the second function argument
-
- Returns: the function result of type R
andThen(...) -> LongBiFunction<V>
-
Signature:
default <V> LongBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongBiPredicate (com.landawn.abacus.util.function.LongBiPredicate)
Represents a predicate (boolean-valued function) of two {@code long} -valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(long t, long u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(long) — the first input argument -
u(long) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> LongBiPredicate
-
Signature:
default LongBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> If this predicate returns {@code true} for given inputs, the negated predicate will return {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> LongBiPredicate
-
Signature:
default LongBiPredicate and(final LongBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongBiPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> LongBiPredicate
-
Signature:
default LongBiPredicate or(final LongBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongBiPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface LongBinaryOperator (com.landawn.abacus.util.function.LongBinaryOperator)
Represents an operation upon two {@code long} -valued operands and producing a {@code long} -valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(long left, long right) - Summary: Applies this operator to the given operands.
-
Parameters:
-
left(long) — the first operand, typically the accumulator in reduction operations -
right(long) — the second operand, typically the next element in reduction operations
-
- Returns: the operator result, a long value computed from the two operands
Interface LongConsumer (com.landawn.abacus.util.function.LongConsumer)
Represents an operation that accepts a single {@code long} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(long value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(long) — the input argument
-
andThen(...) -> LongConsumer
-
Signature:
@Override default LongConsumer andThen(final java.util.function.LongConsumer after) - Summary: Returns a composed {@code LongConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code LongConsumer logger = value -> System.out.println("Processing: " + value); LongConsumer validator = value -> { if (value < 0) throw new IllegalArgumentException(); }; LongConsumer combined = logger.andThen(validator); combined.accept(100L); // Logs then validates } </pre>
-
Parameters:
-
after(java.util.function.LongConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code LongConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface LongFunction (com.landawn.abacus.util.function.LongFunction)
Represents a function that accepts a {@code long} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> LongFunction<Long>
-
Signature:
static LongFunction<Long> identity() - Summary: Returns a function that always returns its input argument.
-
Contract:
- <p> This identity function is useful in several scenarios: <ul> <li> As a default transformation when no change is needed </li> <li> In stream operations where the long values should pass through unchanged </li> <li> For testing or as a placeholder in function compositions </li> <li> When conditionally applying transformations </li> </ul> <p> Note that this returns a Long object (boxed value), not a primitive long.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument as a Long object
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(long value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(long) — the function argument, a long value to be transformed
-
- Returns: the function result of type R
andThen(...) -> LongFunction<V>
-
Signature:
default <V> LongFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongMapMultiConsumer (com.landawn.abacus.util.function.LongMapMultiConsumer)
Represents an operation that accepts a long-valued argument and a LongConsumer, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(long value, java.util.function.LongConsumer consumer) - Summary: Performs a one-to-many transformation on the given long value.
-
Parameters:
-
value(long) — the input long value to be transformed -
consumer(java.util.function.LongConsumer) — the consumer that accepts the transformed values. The implementation should call {@code consumer.accept(long)} for each output value. May be called zero or more times
-
Interface LongNConsumer (com.landawn.abacus.util.function.LongNConsumer)
Represents an operation that accepts a variable number of {@code long} -valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long... args) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
args(long[]) — the input arguments as a varargs array. Can be empty, contain a single value, or multiple values. The array should not be modified by the implementation
-
andThen(...) -> LongNConsumer
-
Signature:
default LongNConsumer andThen(final LongNConsumer after) - Summary: Returns a composed {@code LongNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(LongNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code LongNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface LongNFunction (com.landawn.abacus.util.function.LongNFunction)
Represents a function that accepts a variable number of {@code long} -valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(long... args) - Summary: Applies this function to the given arguments.
-
Contract:
- <p> Common use cases include: <ul> <li> Aggregating multiple long values into a single result (sum, average, etc.) </li> <li> Creating objects from arrays of long values </li> <li> Computing statistics from groups of long values </li> <li> Transforming arrays of long values into other representations </li> <li> Implementing variadic mathematical functions </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code LongNFunction<Double> average = args -> { if (args.length == 0) return 0.0; long sum = 0; for (long value : args) { sum += value; } return (double) sum / args.length; }; Double avg = average.apply(10L, 20L, 30L, 40L); // Returns 25.0 } </pre>
-
Parameters:
-
args(long[]) — the function arguments as a varargs array. Can be empty, contain a single value, or multiple values. The array should not be modified by the implementation
-
- Returns: the function result of type R
andThen(...) -> LongNFunction<V>
-
Signature:
@Override default <V> LongNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongObjConsumer (com.landawn.abacus.util.function.LongObjConsumer)
Represents an operation that accepts a {@code long} -valued and an object-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(long i, T t) - Summary: Performs this operation on the given arguments.
-
Contract:
- This is particularly useful when you need to process a primitive long value alongside an object without boxing the long value.
-
Parameters:
-
i(long) — the first input argument (long value) -
t(T) — the second input argument (object of type T)
-
andThen(...) -> LongObjConsumer<T>
-
Signature:
default LongObjConsumer<T> andThen(final LongObjConsumer<? super T> after) - Summary: Returns a composed {@code LongObjConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(LongObjConsumer<? super T>) — the operation to perform after this operation. Must not be {@code null} . Note that the type parameter must be {@code ? super T} to ensure type safety when composing consumers
-
- Returns: a composed {@code LongObjConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface LongObjFunction (com.landawn.abacus.util.function.LongObjFunction)
Represents a function that accepts a long-valued argument and an object argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(long t, T u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(long) — the long-valued first argument -
u(T) — the object second argument of type T
-
- Returns: the function result of type R
andThen(...) -> LongObjFunction<T, V>
-
Signature:
default <V> LongObjFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- <p> If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongObjPredicate (com.landawn.abacus.util.function.LongObjPredicate)
Represents a predicate (boolean-valued function) of a long-valued argument and an object argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(long t, T u) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
t(long) — the long-valued first argument -
u(T) — the object second argument of type T
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> LongObjPredicate<T>
-
Signature:
default LongObjPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> LongObjPredicate<T>
-
Signature:
default LongObjPredicate<T> and(final LongObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongObjPredicate<T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> LongObjPredicate<T>
-
Signature:
default LongObjPredicate<T> or(final LongObjPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongObjPredicate<T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface LongPredicate (com.landawn.abacus.util.function.LongPredicate)
Represents a predicate (boolean-valued function) of one {@code long} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> LongPredicate
-
Signature:
static LongPredicate of(final LongPredicate predicate) - Summary: Returns the specified predicate instance.
-
Parameters:
-
predicate(LongPredicate) — the predicate to return
-
- Returns: the specified predicate
equal(...) -> LongPredicate
-
Signature:
static LongPredicate equal(final long targetLong) - Summary: Returns a predicate that tests if the input value is equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is equal to the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input equals {@code targetLong}
notEqual(...) -> LongPredicate
-
Signature:
static LongPredicate notEqual(final long targetLong) - Summary: Returns a predicate that tests if the input value is not equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is not equal to the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input does not equal {@code targetLong}
greaterThan(...) -> LongPredicate
-
Signature:
static LongPredicate greaterThan(final long targetLong) - Summary: Returns a predicate that tests if the input value is greater than the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is greater than the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetLong}
greaterEqual(...) -> LongPredicate
-
Signature:
static LongPredicate greaterEqual(final long targetLong) - Summary: Returns a predicate that tests if the input value is greater than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is greater than or equal to the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetLong}
lessThan(...) -> LongPredicate
-
Signature:
static LongPredicate lessThan(final long targetLong) - Summary: Returns a predicate that tests if the input value is less than the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is less than the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetLong}
lessEqual(...) -> LongPredicate
-
Signature:
static LongPredicate lessEqual(final long targetLong) - Summary: Returns a predicate that tests if the input value is less than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if the input value is less than or equal to the specified target value.
-
Parameters:
-
targetLong(long) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetLong}
between(...) -> LongPredicate
-
Signature:
static LongPredicate between(final long minValue, final long maxValue) - Summary: Returns a predicate that tests if the input value is between the specified minimum and maximum values (exclusive).
-
Contract:
- Returns a predicate that tests if the input value is between the specified minimum and maximum values (exclusive).
- <p> The predicate returns {@code true} if the input value is strictly greater than {@code minValue} and strictly less than {@code maxValue} .
-
Parameters:
-
minValue(long) — the exclusive lower bound -
maxValue(long) — the exclusive upper bound
-
- Returns: a predicate that tests if the input is between {@code minValue} and {@code maxValue} (exclusive)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(long value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(long) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> LongPredicate
-
Signature:
@Override default LongPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> LongPredicate
-
Signature:
@Override default LongPredicate and(final java.util.function.LongPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(java.util.function.LongPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> LongPredicate
-
Signature:
@Override default LongPredicate or(final java.util.function.LongPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
-
Parameters:
-
other(java.util.function.LongPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface LongSupplier (com.landawn.abacus.util.function.LongSupplier)
Represents a supplier of long-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsLong(...) -> long
-
Signature:
@Override long getAsLong() - Summary: Gets a result as a long value.
-
Contract:
- <p> This method should be implemented to provide the long value when called.
-
Parameters:
- (none)
- Returns: a long value
Interface LongTernaryOperator (com.landawn.abacus.util.function.LongTernaryOperator)
Represents an operation on three long-valued operands that produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(long a, long b, long c) - Summary: Applies this operator to the given operands.
-
Contract:
- <p> Common implementations might include: <ul> <li> Mathematical operations (sum, product, average) </li> <li> Conditional operations (min, max, median) </li> <li> Bitwise operations </li> <li> Custom business logic involving three long values </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Sum of three values LongTernaryOperator sum = (a, b, c) -> a + b + c; long total = sum.applyAsLong(10L, 20L, 30L); // returns 60L // Average of three values LongTernaryOperator average = (a, b, c) -> (a + b + c) / 3; long avg = average.applyAsLong(10L, 20L, 30L); // returns 20L // Find middle value (median) LongTernaryOperator median = (a, b, c) -> { if ((a >= b && a <= c) || (a <= b && a >= c)) return a; if ((b >= a && b <= c) || (b <= a && b >= c)) return b; return c; }; long mid = median.applyAsLong(5L, 15L, 10L); // returns 10L } </pre>
-
Parameters:
-
a(long) — the first operand -
b(long) — the second operand -
c(long) — the third operand
-
- Returns: the operator result as a long value
Interface LongToDoubleFunction (com.landawn.abacus.util.function.LongToDoubleFunction)
Represents a function that accepts a long-valued argument and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(long value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(long) — the function argument as a long
-
- Returns: the function result as a double
Interface LongToFloatFunction (com.landawn.abacus.util.function.LongToFloatFunction)
Represents a function that accepts a long-valued argument and produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(long value) - Summary: Applies this function to the given argument.
-
Contract:
- The specific conversion logic depends on the implementation, but common use cases include: <ul> <li> Simple type conversion (casting) </li> <li> Mathematical transformations with float precision </li> <li> Scaling operations where float precision is sufficient </li> <li> Custom business logic requiring float output </li> </ul> <p> Important: When converting from long to float, be aware that float has only 24 bits of precision for the significand, which means that long values requiring more than 24 bits of precision will lose accuracy in the conversion.
-
Parameters:
-
value(long) — the function argument as a long
-
- Returns: the function result as a float
Interface LongToIntFunction (com.landawn.abacus.util.function.LongToIntFunction)
Represents a function that accepts a long-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(long value) - Summary: Applies this function to the given argument.
-
Contract:
- The specific conversion logic depends on the implementation, but common use cases include: <ul> <li> Narrowing conversion with overflow handling </li> <li> Extracting specific bits or bit ranges </li> <li> Hash code generation from long values </li> <li> Index calculations where the result must be an int </li> <li> Custom business logic requiring int output </li> </ul> <p> Important: When converting from long to int, be aware that: <ul> <li> Values outside the int range will be truncated </li> <li> The sign of the result may differ from the original </li> <li> Information about the magnitude may be lost </li> </ul>
-
Parameters:
-
value(long) — the function argument as a long
-
- Returns: the function result as an int
Interface LongTriConsumer (com.landawn.abacus.util.function.LongTriConsumer)
Represents an operation that accepts three long-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(long a, long b, long c) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(long) — the first input argument -
b(long) — the second input argument -
c(long) — the third input argument
-
andThen(...) -> LongTriConsumer
-
Signature:
default LongTriConsumer andThen(final LongTriConsumer after) - Summary: Returns a composed {@code LongTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- <p> If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(LongTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code LongTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface LongTriFunction (com.landawn.abacus.util.function.LongTriFunction)
Represents a function that accepts three long-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(long a, long b, long c) - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(long) — the first argument -
b(long) — the second argument -
c(long) — the third argument
-
- Returns: the function result of type R
andThen(...) -> LongTriFunction<V>
-
Signature:
default <V> LongTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- <p> If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface LongTriPredicate (com.landawn.abacus.util.function.LongTriPredicate)
Represents a predicate (boolean-valued function) of three long-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(long a, long b, long c) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- <p> Common use cases include: <ul> <li> Validating relationships between three values </li> <li> Checking if three values form a valid triangle </li> <li> Testing if three coordinates are within bounds </li> <li> Verifying business rules involving three numeric parameters </li> </ul>
-
Parameters:
-
a(long) — the first input argument -
b(long) — the second input argument -
c(long) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> LongTriPredicate
-
Signature:
default LongTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> LongTriPredicate
-
Signature:
default LongTriPredicate and(final LongTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongTriPredicate) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> LongTriPredicate
-
Signature:
default LongTriPredicate or(final LongTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(LongTriPredicate) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface LongUnaryOperator (com.landawn.abacus.util.function.LongUnaryOperator)
Represents an operation on a single long-valued operand that produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> LongUnaryOperator
-
Signature:
static LongUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Contract:
- x -> x * 2 : LongUnaryOperator.identity(); long result = op.applyAsLong(5L); // returns 10L if condition is true, 5L otherwise } </pre>
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(long operand) - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(long) — the operand
-
- Returns: the operator result
compose(...) -> LongUnaryOperator
-
Signature:
@Override default LongUnaryOperator compose(final java.util.function.LongUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- <p> If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(java.util.function.LongUnaryOperator) — the operator to apply before this operator is applied
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(java.util.function.LongUnaryOperator)
andThen(...) -> LongUnaryOperator
-
Signature:
@Override default LongUnaryOperator andThen(final java.util.function.LongUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- <p> If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(java.util.function.LongUnaryOperator) — the operator to apply after this operator is applied
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(java.util.function.LongUnaryOperator)
Interface NConsumer (com.landawn.abacus.util.function.NConsumer)
Represents an operation that accepts a variable number of arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@SuppressWarnings("unchecked") void accept(T... args) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
args(T[]) — the input arguments as a varargs array
-
andThen(...) -> NConsumer<T>
-
Signature:
default NConsumer<T> andThen(final NConsumer<? super T> after) - Summary: Returns a composed {@code NConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- <p> If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(NConsumer<? super T>) — the operation to perform after this operation
-
- Returns: a composed {@code NConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface NFunction (com.landawn.abacus.util.function.NFunction)
Represents a function that accepts a variable number of arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@SuppressWarnings("unchecked") @Override R apply(T... args) - Summary: Applies this function to the given arguments.
-
Parameters:
-
args(T[]) — the function arguments as a varargs array
-
- Returns: the function result of type R
andThen(...) -> NFunction<T, V>
-
Signature:
@Override default <V> NFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- <p> If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface NPredicate (com.landawn.abacus.util.function.NPredicate)
Represents a predicate (boolean-valued function) of a variable number of arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") boolean test(T... args) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- <p> Common use cases include: <ul> <li> Validating multiple values against a condition </li> <li> Checking if all/any/none of the arguments meet certain criteria </li> <li> Implementing complex multi-argument validation rules </li> <li> Testing relationships between multiple values </li> </ul> <p> Note: The {@code @SuppressWarnings("unchecked")} annotation is used because varargs with generics can generate unchecked warnings at the call site.
-
Parameters:
-
args(T[]) — the input arguments as a varargs array
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> NPredicate<T>
-
Signature:
default NPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code NPredicate<Integer> allEven = args -> { for (Integer n : args) { if (n % 2 != 0) return false; } return true; }; NPredicate<Integer> notAllEven = allEven.negate(); notAllEven.test(2, 4, 5); // returns {@code true} (not all are even) } </pre>
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> NPredicate<T>
-
Signature:
default NPredicate<T> and(final NPredicate<? super T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code NPredicate<Integer> allPositive = args -> { for (Integer n : args) { if (n <= 0) return false; } return true; }; NPredicate<Integer> sumLessThan100 = args -> { int sum = 0; for (Integer n : args) { sum += n; } return sum < 100; }; NPredicate<Integer> combined = allPositive.and(sumLessThan100); combined.test(10, 20, 30); // returns {@code true} (all positive AND sum < 100) } </pre>
-
Parameters:
-
other(NPredicate<? super T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> NPredicate<T>
-
Signature:
default NPredicate<T> or(final NPredicate<? super T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code NPredicate<String> anyEmpty = args -> { for (String s : args) { if (s.isEmpty()) return true; } return false; }; NPredicate<String> anyNull = args -> { for (String s : args) { if (s == null) return true; } return false; }; NPredicate<String> anyInvalid = anyEmpty.or(anyNull); anyInvalid.test("hello", "", "world"); // returns {@code true} (one is empty) } </pre>
-
Parameters:
-
other(NPredicate<? super T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ObjBiIntConsumer (com.landawn.abacus.util.function.ObjBiIntConsumer)
Represents an operation that accepts an object-valued argument and two int-valued arguments, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, int i, int j) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the object input argument -
i(int) — the first int input argument -
j(int) — the second int input argument
-
andThen(...) -> ObjBiIntConsumer<T>
-
Signature:
default ObjBiIntConsumer<T> andThen(final ObjBiIntConsumer<? super T> after) - Summary: Returns a composed {@code ObjBiIntConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- <p> If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ObjBiIntConsumer<? super T>) — the operation to perform after this operation
-
- Returns: a composed {@code ObjBiIntConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ObjBiIntFunction (com.landawn.abacus.util.function.ObjBiIntFunction)
Represents a function that accepts an object-valued argument and two int-valued arguments, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, int i, int j) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the object first argument -
i(int) — the first int argument (often used as start index, row, or x-coordinate) -
j(int) — the second int argument (often used as end index, column, or y-coordinate)
-
- Returns: the function result of type R
andThen(...) -> ObjBiIntFunction<T, V>
-
Signature:
default <V> ObjBiIntFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- <p> If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ObjBiIntPredicate (com.landawn.abacus.util.function.ObjBiIntPredicate)
Represents a predicate (boolean-valued function) of an object-valued argument and two int-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, int i, int j) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- <p> Common use cases include: <ul> <li> Validating array or collection bounds with start/end indices </li> <li> Checking if coordinates are valid in two-dimensional data structures </li> <li> Testing if a range is valid for a given object </li> <li> Verifying business rules involving an object and two numeric parameters </li> <li> Implementing access control based on object state and numeric conditions </li> </ul>
-
Parameters:
-
t(T) — the object input argument -
i(int) — the first int input argument (often used as start index, row, or x-coordinate) -
j(int) — the second int input argument (often used as end index, column, or y-coordinate)
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false}
negate(...) -> ObjBiIntPredicate<T>
-
Signature:
default ObjBiIntPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and {@code false} when this predicate returns {@code true} .
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ObjBiIntPredicate<T>
-
Signature:
default ObjBiIntPredicate<T> and(final ObjBiIntPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjBiIntPredicate<T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ObjBiIntPredicate<T>
-
Signature:
default ObjBiIntPredicate<T> or(final ObjBiIntPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- <p> When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjBiIntPredicate<List<?>> isEmpty = (list, from, to) -> list.isEmpty(); ObjBiIntPredicate<List<?>> isFullRange = (list, from, to) -> from == 0 && to == list.size(); ObjBiIntPredicate<List<?>> specialCase = isEmpty.or(isFullRange); // Returns true if list is empty OR if range covers entire list } </pre>
-
Parameters:
-
other(ObjBiIntPredicate<T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ObjBooleanConsumer (com.landawn.abacus.util.function.ObjBooleanConsumer)
Represents an operation that accepts an object-valued argument and a boolean-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, boolean value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
value(boolean) — the second input argument
-
Interface ObjByteConsumer (com.landawn.abacus.util.function.ObjByteConsumer)
Represents an operation that accepts an object-valued argument and a byte-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, byte value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
value(byte) — the second input argument
-
Interface ObjCharConsumer (com.landawn.abacus.util.function.ObjCharConsumer)
Represents an operation that accepts an object-valued argument and a char-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, char value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument -
value(char) — the second input argument
-
Interface ObjDoubleConsumer (com.landawn.abacus.util.function.ObjDoubleConsumer)
A functional interface that represents an operation that accepts an object-valued argument and a double-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, double value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument of type T -
value(double) — the second input argument, a primitive double value
-
andThen(...) -> ObjDoubleConsumer<T>
-
Signature:
default ObjDoubleConsumer<T> andThen(final ObjDoubleConsumer<? super T> after) - Summary: Returns a composed {@code ObjDoubleConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ObjDoubleConsumer<? super T>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ObjDoubleConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ObjDoubleFunction (com.landawn.abacus.util.function.ObjDoubleFunction)
A functional interface that represents a function that accepts an object-valued argument and a double-valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, double u) - Summary: Applies this function to the given arguments.
-
Contract:
- The function should be deterministic, meaning that for the same inputs, it should always produce the same output.
-
Parameters:
-
t(T) — the first function argument of type T -
u(double) — the second function argument, a primitive double value
-
- Returns: the function result of type R
andThen(...) -> ObjDoubleFunction<T, V>
-
Signature:
default <V> ObjDoubleFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ObjDoublePredicate (com.landawn.abacus.util.function.ObjDoublePredicate)
A functional interface that represents a predicate (boolean-valued function) of an object-valued argument and a double-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, double u) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- It should return {@code true} if the input arguments match the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
t(T) — the first input argument of type T -
u(double) — the second input argument, a primitive double value
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> ObjDoublePredicate<T>
-
Signature:
default ObjDoublePredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjDoublePredicate<Product> isPriceAbove = (product, threshold) -> product.getPrice() > threshold; ObjDoublePredicate<Product> isPriceNotAbove = isPriceAbove.negate(); // isPriceNotAbove tests if price <= threshold } </pre>
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ObjDoublePredicate<T>
-
Signature:
default ObjDoublePredicate<T> and(final ObjDoublePredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjDoublePredicate<T>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ObjDoublePredicate<T>
-
Signature:
default ObjDoublePredicate<T> or(final ObjDoublePredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjDoublePredicate<T>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ObjFloatConsumer (com.landawn.abacus.util.function.ObjFloatConsumer)
A functional interface that represents an operation that accepts an object-valued argument and a float-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, float value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument of type T -
value(float) — the second input argument, a primitive float value
-
Interface ObjIntConsumer (com.landawn.abacus.util.function.ObjIntConsumer)
A functional interface that represents an operation that accepts an object-valued argument and an int-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, int value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument of type T -
value(int) — the second input argument, a primitive int value
-
andThen(...) -> ObjIntConsumer<T>
-
Signature:
default ObjIntConsumer<T> andThen(final ObjIntConsumer<? super T> after) - Summary: Returns a composed {@code ObjIntConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ObjIntConsumer<? super T>) — the operation to perform after this operation
-
- Returns: a composed {@code ObjIntConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ObjIntFunction (com.landawn.abacus.util.function.ObjIntFunction)
A functional interface that represents a function that accepts an object-valued argument and an int-valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, int u) - Summary: Applies this function to the given arguments.
-
Contract:
- The function should be deterministic, meaning that for the same inputs, it should always produce the same output.
-
Parameters:
-
t(T) — the first function argument of type T -
u(int) — the second function argument, a primitive int value
-
- Returns: the function result of type R
andThen(...) -> ObjIntFunction<T, V>
-
Signature:
default <V> ObjIntFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ObjIntPredicate (com.landawn.abacus.util.function.ObjIntPredicate)
A functional interface that represents a predicate (boolean-valued function) of an object-valued argument and an int-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, int u) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- It should return {@code true} if the input arguments match the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
t(T) — the first input argument of type T -
u(int) — the second input argument, a primitive int value
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> ObjIntPredicate<T>
-
Signature:
default ObjIntPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjIntPredicate<String> hasMinLength = (str, minLen) -> str.length() >= minLen; ObjIntPredicate<String> tooShort = hasMinLength.negate(); // tooShort tests if string length < minLen } </pre>
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ObjIntPredicate<T>
-
Signature:
default ObjIntPredicate<T> and(final ObjIntPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjIntPredicate<T>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ObjIntPredicate<T>
-
Signature:
default ObjIntPredicate<T> or(final ObjIntPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjIntPredicate<T>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ObjLongConsumer (com.landawn.abacus.util.function.ObjLongConsumer)
A functional interface that represents an operation that accepts an object-valued argument and a long-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, long value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument of type T -
value(long) — the second input argument, a primitive long value
-
andThen(...) -> ObjLongConsumer<T>
-
Signature:
default ObjLongConsumer<T> andThen(final ObjLongConsumer<? super T> after) - Summary: Returns a composed {@code ObjLongConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ObjLongConsumer<? super T>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ObjLongConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ObjLongFunction (com.landawn.abacus.util.function.ObjLongFunction)
A functional interface that represents a function that accepts an object-valued argument and a long-valued argument, and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(T t, long u) - Summary: Applies this function to the given arguments.
-
Contract:
- The function should be deterministic, meaning that for the same inputs, it should always produce the same output.
-
Parameters:
-
t(T) — the first function argument of type T -
u(long) — the second function argument, a primitive long value
-
- Returns: the function result of type R
andThen(...) -> ObjLongFunction<T, V>
-
Signature:
default <V> ObjLongFunction<T, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ObjLongPredicate (com.landawn.abacus.util.function.ObjLongPredicate)
A functional interface that represents a predicate (boolean-valued function) of an object-valued argument and a long-valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T t, long u) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- It should return {@code true} if the input arguments match the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
t(T) — the first input argument of type T -
u(long) — the second input argument, a primitive long value
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> ObjLongPredicate<T>
-
Signature:
default ObjLongPredicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjLongPredicate<Event> isAfter = (event, timestamp) -> event.getTimestamp() > timestamp; ObjLongPredicate<Event> isNotAfter = isAfter.negate(); // isNotAfter tests if event timestamp <= timestamp } </pre>
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ObjLongPredicate<T>
-
Signature:
default ObjLongPredicate<T> and(final ObjLongPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ObjLongPredicate<T>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ObjLongPredicate<T>
-
Signature:
default ObjLongPredicate<T> or(final ObjLongPredicate<T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ObjLongPredicate<Session> isExpired = (session, currentTime) -> session.getExpiryTime() < currentTime; ObjLongPredicate<Session> isInvalid = (session, ignored) -> !session.isValid(); ObjLongPredicate<Session> shouldRemove = isExpired.or(isInvalid); } </pre>
-
Parameters:
-
other(ObjLongPredicate<T>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ObjShortConsumer (com.landawn.abacus.util.function.ObjShortConsumer)
A functional interface that represents an operation that accepts an object-valued and a short-valued argument, and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(T t, short value) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
t(T) — the first input argument of type T -
value(short) — the second input argument, a primitive short value
-
Interface Predicate (com.landawn.abacus.util.function.Predicate)
A functional interface that represents a predicate (boolean-valued function) of one argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(T value) - Summary: Evaluates this predicate on the given argument.
-
Contract:
- It should return {@code true} if the input argument matches the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
value(T) — the input argument to be tested
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> Predicate<T>
-
Signature:
@Override default Predicate<T> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> Predicate<T>
-
Signature:
@Override default Predicate<T> and(final java.util.function.Predicate<? super T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.Predicate<? super T>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed {@code Predicate} that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> Predicate<T>
-
Signature:
@Override default Predicate<T> or(final java.util.function.Predicate<? super T> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(java.util.function.Predicate<? super T>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed {@code Predicate} that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
toThrowable(...) -> Throwables.Predicate<T, E>
-
Signature:
default <E extends Throwable> Throwables.Predicate<T, E> toThrowable() - Summary: Converts this predicate to a {@link Throwables.Predicate} that can throw checked exceptions.
-
Parameters:
- (none)
- Returns: a {@link Throwables.Predicate} version of this predicate
Interface QuadConsumer (com.landawn.abacus.util.function.QuadConsumer)
A functional interface that represents an operation that accepts four input arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(A a, B b, C c, D d) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument -
d(D) — the fourth input argument
-
andThen(...) -> QuadConsumer<A, B, C, D>
-
Signature:
default QuadConsumer<A, B, C, D> andThen(final QuadConsumer<? super A, ? super B, ? super C, ? super D> after) - Summary: Returns a composed {@code QuadConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(QuadConsumer<? super A, ? super B, ? super C, ? super D>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code QuadConsumer} that performs in sequence this operation followed by the {@code after} operation
toThrowable(...) -> Throwables.QuadConsumer<A, B, C, D, E>
-
Signature:
default <E extends Throwable> Throwables.QuadConsumer<A, B, C, D, E> toThrowable() - Summary: Converts this QuadConsumer to a Throwables.QuadConsumer that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this consumer in a context that expects a Throwables.QuadConsumer with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.QuadConsumer that wraps this consumer
Interface QuadFunction (com.landawn.abacus.util.function.QuadFunction)
A functional interface that represents a function that accepts four arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(A a, B b, C c, D d) - Summary: Applies this function to the given arguments.
-
Contract:
- The function should be deterministic, meaning that for the same inputs, it should always produce the same output.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument -
d(D) — the fourth function argument
-
- Returns: the function result
andThen(...) -> QuadFunction<A, B, C, D, V>
-
Signature:
default <V> QuadFunction<A, B, C, D, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
toThrowable(...) -> Throwables.QuadFunction<A, B, C, D, R, E>
-
Signature:
default <E extends Throwable> Throwables.QuadFunction<A, B, C, D, R, E> toThrowable() - Summary: Converts this QuadFunction to a Throwables.QuadFunction that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this function in a context that expects a Throwables.QuadFunction with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.QuadFunction that wraps this function
Interface QuadPredicate (com.landawn.abacus.util.function.QuadPredicate)
A functional interface that represents a predicate (boolean-valued function) of four arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(A a, B b, C c, D d) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- It should return {@code true} if the input arguments match the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument -
d(D) — the fourth input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> QuadPredicate<A, B, C, D>
-
Signature:
default QuadPredicate<A, B, C, D> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> QuadPredicate<A, B, C, D>
-
Signature:
default QuadPredicate<A, B, C, D> and(final QuadPredicate<? super A, ? super B, ? super C, ? super D> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(QuadPredicate<? super A, ? super B, ? super C, ? super D>) — a predicate that will be logically-ANDed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> QuadPredicate<A, B, C, D>
-
Signature:
default QuadPredicate<A, B, C, D> or(final QuadPredicate<? super A, ? super B, ? super C, ? super D> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(QuadPredicate<? super A, ? super B, ? super C, ? super D>) — a predicate that will be logically-ORed with this predicate
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
toThrowable(...) -> Throwables.QuadPredicate<A, B, C, D, E>
-
Signature:
default <E extends Throwable> Throwables.QuadPredicate<A, B, C, D, E> toThrowable() - Summary: Converts this QuadPredicate to a Throwables.QuadPredicate that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this predicate in a context that expects a Throwables.QuadPredicate with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.QuadPredicate that wraps this predicate
Interface Runnable (com.landawn.abacus.util.function.Runnable)
A functional interface that represents a task to be executed without arguments and without returning a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
run(...) -> void
-
Signature:
@Override void run() - Summary: Executes this runnable task.
-
Contract:
- <p> When an object implementing interface {@code Runnable} is used to create a thread, starting the thread causes the object's {@code run} method to be called in that separately executing thread.
-
Parameters:
- (none)
- See also: java.lang.Thread#run()
toCallable(...) -> Callable<Void>
-
Signature:
default Callable<Void> toCallable() - Summary: Converts this {@code Runnable} to a {@code Callable<Void>} .
-
Contract:
- This is useful when you need to submit a runnable task to an {@link java.util.concurrent.ExecutorService} that only accepts {@link Callable} tasks, or when you need to obtain a {@link java.util.concurrent.Future} for a task that doesn't produce a result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Runnable task = () -> System.out.println("Executing task"); Callable<Void> callable = task.toCallable(); ExecutorService executor = Executors.newSingleThreadExecutor(); Future<Void> future = executor.submit(callable); // Wait for completion future.get(); // Returns null when task completes } </pre>
-
Parameters:
- (none)
- Returns: a {@code Callable<Void>} that executes this runnable and returns {@code null}
- See also: Callable, java.util.concurrent.Executors#callable(java.lang.Runnable)
toThrowable(...) -> Throwables.Runnable<E>
-
Signature:
default <E extends Throwable> Throwables.Runnable<E> toThrowable() - Summary: Converts this runnable to a {@link Throwables.Runnable} that can throw checked exceptions.
-
Parameters:
- (none)
- Returns: a {@link Throwables.Runnable} version of this runnable
Interface ShortBiConsumer (com.landawn.abacus.util.function.ShortBiConsumer)
A functional interface that represents an operation that accepts two short-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(short t, short u) - Summary: Performs this operation on the given short arguments.
-
Parameters:
-
t(short) — the first input argument -
u(short) — the second input argument
-
andThen(...) -> ShortBiConsumer
-
Signature:
default ShortBiConsumer andThen(final ShortBiConsumer after) - Summary: Returns a composed {@code ShortBiConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ShortBiConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ShortBiConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ShortBiFunction (com.landawn.abacus.util.function.ShortBiFunction)
A functional interface that represents a function that accepts two short-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(short t, short u) - Summary: Applies this function to the given short arguments.
-
Contract:
- The function should be deterministic, meaning that for the same inputs, it should always produce the same output.
-
Parameters:
-
t(short) — the first function argument -
u(short) — the second function argument
-
- Returns: the function result
andThen(...) -> ShortBiFunction<V>
-
Signature:
default <V> ShortBiFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ShortBiPredicate (com.landawn.abacus.util.function.ShortBiPredicate)
Represents a predicate (boolean-valued function) of two short-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(short t, short u) - Summary: Evaluates this predicate on the given arguments.
-
Contract:
- It returns {@code true} if the arguments match the predicate's criteria, {@code false} otherwise.
-
Parameters:
-
t(short) — the first input argument -
u(short) — the second input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> ShortBiPredicate
-
Signature:
default ShortBiPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Contract:
- <p> The returned predicate will return {@code true} when this predicate returns {@code false} , and vice versa.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ShortBiPredicate
-
Signature:
default ShortBiPredicate and(final ShortBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortBiPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ShortBiPredicate
-
Signature:
default ShortBiPredicate or(final ShortBiPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortBiPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ShortBinaryOperator (com.landawn.abacus.util.function.ShortBinaryOperator)
A functional interface that represents an operation upon two short-valued operands and producing a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
@Override short applyAsShort(short left, short right) - Summary: Applies this operator to the given short operands.
-
Contract:
- The operator should be associative and stateless for use in parallel operations.
-
Parameters:
-
left(short) — the first operand -
right(short) — the second operand
-
- Returns: the operator result
Interface ShortConsumer (com.landawn.abacus.util.function.ShortConsumer)
Represents an operation that accepts a single {@code short} -valued argument and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(short value) - Summary: Performs this operation on the given argument.
-
Parameters:
-
value(short) — the input argument
-
andThen(...) -> ShortConsumer
-
Signature:
default ShortConsumer andThen(final ShortConsumer after) - Summary: Returns a composed {@code ShortConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code ShortConsumer logger = value -> System.out.println("Processing: " + value); ShortConsumer validator = value -> { if (value < 0) throw new IllegalArgumentException(); }; ShortConsumer combined = logger.andThen(validator); combined.accept((short) 10); // Logs then validates } </pre>
-
Parameters:
-
after(ShortConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ShortConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ShortFunction (com.landawn.abacus.util.function.ShortFunction)
Represents a function that accepts a {@code short} -valued argument and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> ShortFunction<Short>
-
Signature:
static ShortFunction<Short> identity() - Summary: Returns a function that always returns its input argument.
-
Parameters:
- (none)
- Returns: a function that always returns its input argument as a Short object
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(short value) - Summary: Applies this function to the given argument.
-
Contract:
- The function should be deterministic, meaning that for the same input, it should always produce the same output.
-
Parameters:
-
value(short) — the function argument
-
- Returns: the function result
andThen(...) -> ShortFunction<V>
-
Signature:
default <V> ShortFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ShortNConsumer (com.landawn.abacus.util.function.ShortNConsumer)
Represents an operation that accepts a variable number of short-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(short... args) - Summary: Performs this operation on the given arguments.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ShortNConsumer sumPrinter = args -> { int sum = 0; for (short value : args) sum += value; System.out.println("Sum: " + sum); }; sumPrinter.accept((short) 1, (short) 2, (short) 3); // Prints "Sum: 6" ShortNConsumer minMaxPrinter = args -> { if (args.length == 0) return; short min = args\[0\], max = args\[0\]; for (short v : args) { if (v < min) min = v; if (v > max) max = v; } System.out.println("Min: " + min + ", Max: " + max); }; minMaxPrinter.accept((short) 5, (short) 2, (short) 8, (short) 1); } </pre>
-
Parameters:
-
args(short[]) — the input arguments as a variable-length array of short values
-
andThen(...) -> ShortNConsumer
-
Signature:
default ShortNConsumer andThen(final ShortNConsumer after) - Summary: Returns a composed {@code ShortNConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
- <p> Note that both operations will receive the same array reference, so if either operation modifies the array, the changes will be visible to the other operation.
-
Parameters:
-
after(ShortNConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ShortNConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ShortNFunction (com.landawn.abacus.util.function.ShortNFunction)
Represents a function that accepts a variable number of short-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(short... args) - Summary: Applies this function to the given arguments.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ShortNFunction<Integer> sum = args -> { int total = 0; for (short value : args) total += value; return total; }; Integer result1 = sum.apply((short) 1, (short) 2, (short) 3); // returns 6 ShortNFunction<Short> max = args -> { if (args.length == 0) return 0; short maxVal = args\[0\]; for (short v : args) if (v > maxVal) maxVal = v; return maxVal; }; Short result2 = max.apply((short) 5, (short) 2, (short) 8, (short) 1); // returns 8 } </pre>
-
Parameters:
-
args(short[]) — the function arguments as a variable-length array of short values
-
- Returns: the function result
andThen(...) -> ShortNFunction<V>
-
Signature:
@Override default <V> ShortNFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ShortPredicate (com.landawn.abacus.util.function.ShortPredicate)
Represents a predicate (boolean-valued function) of one {@code short} -valued argument.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> ShortPredicate
-
Signature:
static ShortPredicate of(final ShortPredicate predicate) - Summary: Returns the specified predicate instance.
-
Parameters:
-
predicate(ShortPredicate) — the predicate to return
-
- Returns: the specified predicate
equal(...) -> ShortPredicate
-
Signature:
static ShortPredicate equal(final short targetShort) - Summary: Returns a predicate that tests if a short value is equal to the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is equal to the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is equal to {@code targetShort}
notEqual(...) -> ShortPredicate
-
Signature:
static ShortPredicate notEqual(final short targetShort) - Summary: Returns a predicate that tests if a short value is not equal to the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is not equal to the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is not equal to {@code targetShort}
greaterThan(...) -> ShortPredicate
-
Signature:
static ShortPredicate greaterThan(final short targetShort) - Summary: Returns a predicate that tests if a short value is greater than the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is greater than the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than {@code targetShort}
greaterEqual(...) -> ShortPredicate
-
Signature:
static ShortPredicate greaterEqual(final short targetShort) - Summary: Returns a predicate that tests if a short value is greater than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is greater than or equal to the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is greater than or equal to {@code targetShort}
lessThan(...) -> ShortPredicate
-
Signature:
static ShortPredicate lessThan(final short targetShort) - Summary: Returns a predicate that tests if a short value is less than the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is less than the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is less than {@code targetShort}
lessEqual(...) -> ShortPredicate
-
Signature:
static ShortPredicate lessEqual(final short targetShort) - Summary: Returns a predicate that tests if a short value is less than or equal to the specified target value.
-
Contract:
- Returns a predicate that tests if a short value is less than or equal to the specified target value.
-
Parameters:
-
targetShort(short) — the value to compare against
-
- Returns: a predicate that tests if the input is less than or equal to {@code targetShort}
between(...) -> ShortPredicate
-
Signature:
static ShortPredicate between(final short minValue, final short maxValue) - Summary: Returns a predicate that tests if a short value is between the specified minimum and maximum values (exclusive).
-
Contract:
- Returns a predicate that tests if a short value is between the specified minimum and maximum values (exclusive).
- The predicate returns {@code true} if and only if {@code minValue < value < maxValue} .
-
Parameters:
-
minValue(short) — the exclusive lower bound -
maxValue(short) — the exclusive upper bound
-
- Returns: a predicate that tests if the input is strictly between {@code minValue} and {@code maxValue}
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(short value) - Summary: Evaluates this predicate on the given argument.
-
Parameters:
-
value(short) — the input argument
-
- Returns: {@code true} if the input argument matches the predicate, {@code false} otherwise
negate(...) -> ShortPredicate
-
Signature:
default ShortPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ShortPredicate
-
Signature:
default ShortPredicate and(final ShortPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ShortPredicate
-
Signature:
default ShortPredicate or(final ShortPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ShortSupplier (com.landawn.abacus.util.function.ShortSupplier)
Represents a supplier of short-valued results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
getAsShort(...) -> short
-
Signature:
@Override short getAsShort() - Summary: Gets a result as a short value.
-
Parameters:
- (none)
- Returns: a short value
Interface ShortTernaryOperator (com.landawn.abacus.util.function.ShortTernaryOperator)
Represents an operation upon three short-valued operands and producing a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
@Override short applyAsShort(short a, short b, short c) - Summary: Applies this operator to the given operands.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ShortTernaryOperator sum = (a, b, c) -> (short) (a + b + c); short result1 = sum.applyAsShort((short) 10, (short) 20, (short) 30); // returns 60 ShortTernaryOperator median = (a, b, c) -> { if (a >= b && a <= c || a >= c && a <= b) return a; if (b >= a && b <= c || b >= c && b <= a) return b; return c; }; short result2 = median.applyAsShort((short) 5, (short) 2, (short) 8); // returns 5 ShortTernaryOperator clamp = (value, min, max) -> (short) Math.max(min, Math.min(max, value)); short result3 = clamp.applyAsShort((short) 150, (short) 0, (short) 100); // returns 100 } </pre>
-
Parameters:
-
a(short) — the first operand -
b(short) — the second operand -
c(short) — the third operand
-
- Returns: the operator result as a short value
Interface ShortToIntFunction (com.landawn.abacus.util.function.ShortToIntFunction)
Represents a function that accepts a short-valued argument and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
int applyAsInt(short value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(short) — the function argument as a short value
-
- Returns: the function result as an int value
Interface ShortTriConsumer (com.landawn.abacus.util.function.ShortTriConsumer)
Represents an operation that accepts three short-valued arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(short a, short b, short c) - Summary: Performs this operation on the given arguments.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code ShortTriConsumer sumPrinter = (a, b, c) -> System.out.println("Sum: " + (a + b + c)); sumPrinter.accept((short) 10, (short) 20, (short) 30); // Prints "Sum: 60" ShortTriConsumer rangeSetter = (min, max, value) -> { if (value < min || value > max) { throw new IllegalArgumentException("Value out of range"); } config.setValue(value); }; rangeSetter.accept((short) 0, (short) 100, (short) 50); // Sets value to 50 } </pre>
-
Parameters:
-
a(short) — the first input argument -
b(short) — the second input argument -
c(short) — the third input argument
-
andThen(...) -> ShortTriConsumer
-
Signature:
default ShortTriConsumer andThen(final ShortTriConsumer after) - Summary: Returns a composed {@code ShortTriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(ShortTriConsumer) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code ShortTriConsumer} that performs in sequence this operation followed by the {@code after} operation
Interface ShortTriFunction (com.landawn.abacus.util.function.ShortTriFunction)
Represents a function that accepts three short-valued arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(short a, short b, short c) - Summary: Applies this function to the given arguments.
-
Parameters:
-
a(short) — the first function argument -
b(short) — the second function argument -
c(short) — the third function argument
-
- Returns: the function result
andThen(...) -> ShortTriFunction<V>
-
Signature:
default <V> ShortTriFunction<V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the {@code after} function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the {@code after} function
Interface ShortTriPredicate (com.landawn.abacus.util.function.ShortTriPredicate)
Represents a predicate (boolean-valued function) of three short-valued arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(short a, short b, short c) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(short) — the first input argument -
b(short) — the second input argument -
c(short) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, otherwise {@code false} if the predicate evaluation fails
negate(...) -> ShortTriPredicate
-
Signature:
default ShortTriPredicate negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> ShortTriPredicate
-
Signature:
default ShortTriPredicate and(final ShortTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortTriPredicate) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the {@code other} predicate
or(...) -> ShortTriPredicate
-
Signature:
default ShortTriPredicate or(final ShortTriPredicate other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the {@code other} predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the {@code other} predicate will not be evaluated.
-
Parameters:
-
other(ShortTriPredicate) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the {@code other} predicate
Interface ShortUnaryOperator (com.landawn.abacus.util.function.ShortUnaryOperator)
Represents an operation on a single short-valued operand that produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> ShortUnaryOperator
-
Signature:
static ShortUnaryOperator identity() - Summary: Returns a unary operator that always returns its input argument.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
@Override short applyAsShort(short operand) - Summary: Applies this operator to the given operand.
-
Parameters:
-
operand(short) — the operand
-
- Returns: the operator result
compose(...) -> ShortUnaryOperator
-
Signature:
default ShortUnaryOperator compose(final ShortUnaryOperator before) - Summary: Returns a composed operator that first applies the {@code before} operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(ShortUnaryOperator) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the {@code before} operator and then applies this operator
- See also: #andThen(ShortUnaryOperator)
andThen(...) -> ShortUnaryOperator
-
Signature:
default ShortUnaryOperator andThen(final ShortUnaryOperator after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the {@code after} operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(ShortUnaryOperator) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the {@code after} operator
- See also: #compose(ShortUnaryOperator)
Interface Supplier (com.landawn.abacus.util.function.Supplier)
Represents a supplier of results.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
get(...) -> T
-
Signature:
@Override T get() - Summary: Gets a result.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Supplier<String> helloSupplier = () -> "Hello, World!"; String greeting = helloSupplier.get(); // returns "Hello, World!" Supplier<LocalDateTime> timestampSupplier = LocalDateTime::now; LocalDateTime now = timestampSupplier.get(); // returns current date-time Supplier<UUID> uuidSupplier = UUID::randomUUID; UUID id = uuidSupplier.get(); // returns a random UUID // Lazy initialization pattern Supplier<ExpensiveObject> lazyInit = () -> new ExpensiveObject(); ExpensiveObject obj = lazyInit.get(); // creates object only when needed } </pre>
-
Parameters:
- (none)
- Returns: a result
toThrowable(...) -> Throwables.Supplier<T, E>
-
Signature:
default <E extends Throwable> Throwables.Supplier<T, E> toThrowable() - Summary: Converts this supplier to a throwable supplier that can throw checked exceptions.
-
Parameters:
- (none)
- Returns: a throwable supplier that wraps this supplier
Interface ToBooleanBiFunction (com.landawn.abacus.util.function.ToBooleanBiFunction)
Represents a function that accepts two arguments and produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
boolean applyAsBoolean(T t, U u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a boolean value
Interface ToBooleanFunction (com.landawn.abacus.util.function.ToBooleanFunction)
Represents a function that produces a boolean-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsBoolean(...) -> boolean
-
Signature:
@Override boolean applyAsBoolean(T value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a boolean value
Interface ToByteBiFunction (com.landawn.abacus.util.function.ToByteBiFunction)
Represents a function that accepts two arguments and produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
byte applyAsByte(T t, U u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a byte value
Interface ToByteFunction (com.landawn.abacus.util.function.ToByteFunction)
Represents a function that produces a byte-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsByte(...) -> byte
-
Signature:
@Override byte applyAsByte(T value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a byte value
Interface ToCharBiFunction (com.landawn.abacus.util.function.ToCharBiFunction)
Represents a function that accepts two arguments and produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
char applyAsChar(T t, U u) - Summary: Applies this function to the given arguments.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a char value
Interface ToCharFunction (com.landawn.abacus.util.function.ToCharFunction)
Represents a function that produces a char-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsChar(...) -> char
-
Signature:
@Override char applyAsChar(T value) - Summary: Applies this function to the given argument.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a char value
Interface ToDoubleBiFunction (com.landawn.abacus.util.function.ToDoubleBiFunction)
Represents a function that accepts two arguments and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(T t, U u) - Summary: Applies this function to the given arguments and returns a double result.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a primitive double
Interface ToDoubleFunction (com.landawn.abacus.util.function.ToDoubleFunction)
Represents a function that produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(T value) - Summary: Applies this function to the given argument and returns a double result.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a primitive double
Interface ToDoubleTriFunction (com.landawn.abacus.util.function.ToDoubleTriFunction)
Represents a function that accepts three arguments and produces a double-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsDouble(...) -> double
-
Signature:
@Override double applyAsDouble(A a, B b, C c) - Summary: Applies this function to the given arguments and returns a double result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result as a primitive double
Interface ToFloatBiFunction (com.landawn.abacus.util.function.ToFloatBiFunction)
Represents a function that accepts two arguments and produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
float applyAsFloat(T t, U u) - Summary: Applies this function to the given arguments and returns a float result.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a primitive float
Interface ToFloatFunction (com.landawn.abacus.util.function.ToFloatFunction)
Represents a function that produces a float-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsFloat(...) -> float
-
Signature:
@Override float applyAsFloat(T value) - Summary: Applies this function to the given argument and returns a float result.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a primitive float
Interface ToIntBiFunction (com.landawn.abacus.util.function.ToIntBiFunction)
Represents a function that accepts two arguments and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(T t, U u) - Summary: Applies this function to the given arguments and returns an int result.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a primitive int
Interface ToIntFunction (com.landawn.abacus.util.function.ToIntFunction)
Represents a function that produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(T value) - Summary: Applies this function to the given argument and returns an int result.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a primitive int
Interface ToIntTriFunction (com.landawn.abacus.util.function.ToIntTriFunction)
Represents a function that accepts three arguments and produces an int-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsInt(...) -> int
-
Signature:
@Override int applyAsInt(A a, B b, C c) - Summary: Applies this function to the given arguments and returns an int result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result as a primitive int
Interface ToLongBiFunction (com.landawn.abacus.util.function.ToLongBiFunction)
Represents a function that accepts two arguments and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(T t, U u) - Summary: Applies this function to the given arguments and returns a long result.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a primitive long
Interface ToLongFunction (com.landawn.abacus.util.function.ToLongFunction)
Represents a function that produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(T value) - Summary: Applies this function to the given argument and returns a long result.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a primitive long
Interface ToLongTriFunction (com.landawn.abacus.util.function.ToLongTriFunction)
Represents a function that accepts three arguments and produces a long-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsLong(...) -> long
-
Signature:
@Override long applyAsLong(A a, B b, C c) - Summary: Applies this function to the given arguments and returns a long result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result as a primitive long
Interface ToShortBiFunction (com.landawn.abacus.util.function.ToShortBiFunction)
Represents a function that accepts two arguments and produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
short applyAsShort(T t, U u) - Summary: Applies this function to the given arguments and returns a short result.
-
Contract:
- <p> Note: Care should be taken to ensure the result fits within the short range (-32,768 to 32,767) to avoid overflow.
-
Parameters:
-
t(T) — the first function argument -
u(U) — the second function argument
-
- Returns: the function result as a primitive short
Interface ToShortFunction (com.landawn.abacus.util.function.ToShortFunction)
Represents a function that produces a short-valued result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
applyAsShort(...) -> short
-
Signature:
@Override short applyAsShort(T value) - Summary: Applies this function to the given argument and returns a short result.
-
Parameters:
-
value(T) — the function argument
-
- Returns: the function result as a primitive short
Interface TriConsumer (com.landawn.abacus.util.function.TriConsumer)
Represents an operation that accepts three input arguments and returns no result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
@Override void accept(A a, B b, C c) - Summary: Performs this operation on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
andThen(...) -> TriConsumer<A, B, C>
-
Signature:
default TriConsumer<A, B, C> andThen(final TriConsumer<? super A, ? super B, ? super C> after) - Summary: Returns a composed {@code TriConsumer} that performs, in sequence, this operation followed by the {@code after} operation.
-
Contract:
- If performing either operation throws an exception, it is relayed to the caller of the composed operation.
- If performing this operation throws an exception, the {@code after} operation will not be performed.
-
Parameters:
-
after(TriConsumer<? super A, ? super B, ? super C>) — the operation to perform after this operation. Must not be {@code null} .
-
- Returns: a composed {@code TriConsumer} that performs in sequence this operation followed by the {@code after} operation
toThrowable(...) -> Throwables.TriConsumer<A, B, C, E>
-
Signature:
default <E extends Throwable> Throwables.TriConsumer<A, B, C, E> toThrowable() - Summary: Converts this TriConsumer to a Throwables.TriConsumer that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this consumer in a context that expects a Throwables.TriConsumer with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.TriConsumer that wraps this consumer
Interface TriFunction (com.landawn.abacus.util.function.TriFunction)
Represents a function that accepts three arguments and produces a result.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
apply(...) -> R
-
Signature:
@Override R apply(A a, B b, C c) - Summary: Applies this function to the given arguments and returns the result.
-
Parameters:
-
a(A) — the first function argument -
b(B) — the second function argument -
c(C) — the third function argument
-
- Returns: the function result
andThen(...) -> TriFunction<A, B, C, V>
-
Signature:
default <V> TriFunction<A, B, C, V> andThen(final java.util.function.Function<? super R, ? extends V> after) - Summary: Returns a composed function that first applies this function to its input, and then applies the after function to the result.
-
Contract:
- If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
-
Parameters:
-
after(java.util.function.Function<? super R, ? extends V>) — the function to apply after this function is applied. Must not be {@code null} .
-
- Returns: a composed function that first applies this function and then applies the after function
toThrowable(...) -> Throwables.TriFunction<A, B, C, R, E>
-
Signature:
default <E extends Throwable> Throwables.TriFunction<A, B, C, R, E> toThrowable() - Summary: Converts this TriFunction to a Throwables.TriFunction that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this function in a context that expects a Throwables.TriFunction with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.TriFunction that wraps this function
Interface TriPredicate (com.landawn.abacus.util.function.TriPredicate)
Represents a predicate (boolean-valued function) of three arguments.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
test(...) -> boolean
-
Signature:
@Override boolean test(A a, B b, C c) - Summary: Evaluates this predicate on the given arguments.
-
Parameters:
-
a(A) — the first input argument -
b(B) — the second input argument -
c(C) — the third input argument
-
- Returns: {@code true} if the input arguments match the predicate, {@code false} otherwise
negate(...) -> TriPredicate<A, B, C>
-
Signature:
default TriPredicate<A, B, C> negate() - Summary: Returns a predicate that represents the logical negation of this predicate.
-
Parameters:
- (none)
- Returns: a predicate that represents the logical negation of this predicate
and(...) -> TriPredicate<A, B, C>
-
Signature:
default TriPredicate<A, B, C> and(final TriPredicate<? super A, ? super B, ? super C> other) - Summary: Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code false} , then the other predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.
-
Parameters:
-
other(TriPredicate<? super A, ? super B, ? super C>) — a predicate that will be logically-ANDed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate
or(...) -> TriPredicate<A, B, C>
-
Signature:
default TriPredicate<A, B, C> or(final TriPredicate<? super A, ? super B, ? super C> other) - Summary: Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
-
Contract:
- When evaluating the composed predicate, if this predicate is {@code true} , then the other predicate is not evaluated.
- <p> Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.
-
Parameters:
-
other(TriPredicate<? super A, ? super B, ? super C>) — a predicate that will be logically-ORed with this predicate. Must not be {@code null} .
-
- Returns: a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate
toThrowable(...) -> Throwables.TriPredicate<A, B, C, E>
-
Signature:
default <E extends Throwable> Throwables.TriPredicate<A, B, C, E> toThrowable() - Summary: Converts this TriPredicate to a Throwables.TriPredicate that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this predicate in a context that expects a Throwables.TriPredicate with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.TriPredicate that wraps this predicate
Interface UnaryOperator (com.landawn.abacus.util.function.UnaryOperator)
Represents an operation on a single operand that produces a result of the same type as its operand.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
identity(...) -> UnaryOperator<T>
-
Signature:
static <T> UnaryOperator<T> identity() - Summary: Returns a unary operator that always returns its input argument unchanged.
-
Parameters:
- (none)
- Returns: a unary operator that always returns its input argument
Public Instance Methods
compose(...) -> UnaryOperator<T>
-
Signature:
default UnaryOperator<T> compose(final java.util.function.UnaryOperator<T> before) - Summary: Returns a composed operator that first applies the before operator to its input, and then applies this operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
before(java.util.function.UnaryOperator<T>) — the operator to apply before this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies the before operator and then applies this operator
- See also: #andThen(java.util.function.UnaryOperator)
andThen(...) -> UnaryOperator<T>
-
Signature:
default UnaryOperator<T> andThen(final java.util.function.UnaryOperator<T> after) - Summary: Returns a composed operator that first applies this operator to its input, and then applies the after operator to the result.
-
Contract:
- If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.
-
Parameters:
-
after(java.util.function.UnaryOperator<T>) — the operator to apply after this operator is applied. Must not be {@code null} .
-
- Returns: a composed operator that first applies this operator and then applies the after operator
- See also: #compose(java.util.function.UnaryOperator)
toThrowable(...) -> Throwables.UnaryOperator<T, E>
-
Signature:
@Override default <E extends Throwable> Throwables.UnaryOperator<T, E> toThrowable() - Summary: Converts this UnaryOperator to a Throwables.UnaryOperator that can throw checked exceptions.
-
Contract:
- This method is useful when you need to use this operator in a context that expects a Throwables.UnaryOperator with a specific exception type.
-
Parameters:
- (none)
- Returns: a Throwables.UnaryOperator that wraps this operator
com.landawn.abacus.util.stream
Interface BaseStream (com.landawn.abacus.util.stream.BaseStream)
The base interface for all stream types in the abacus-common library, providing a foundation for functional-style operations on sequences of elements.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
filter(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp S filter(P predicate) - Summary: Returns a new stream consisting of the elements of this stream that match the given predicate.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: #filter(Object, Object), #takeWhile(Object), #dropWhile(Object)
-
Signature:
@Beta @ParallelSupported @IntermediateOp S filter(P predicate, C onDrop) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- If an element doesn't match the predicate, the provided action {@code onDrop} is applied to that element.
- The implementation should ensure the action is thread-safe when used with parallel streams.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine if it should be included -
onDrop(C) — the action to perform on elements that don't match the predicate; this action is only applied to elements that don't match the predicate and are pulled by downstream operations
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: #filter(Object), #takeWhile(Object), #dropWhile(Object), #dropWhile(Object, Object)
takeWhile(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp S takeWhile(P predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: #dropWhile(Object), #filter(Object), #skipUntil(Object)
dropWhile(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp S dropWhile(P predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: #dropWhile(Object, Object), #takeWhile(Object), #filter(Object), #skipUntil(Object)
-
Signature:
@Beta @ParallelSupported @IntermediateOp S dropWhile(P predicate, C onDrop) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
- The implementation should ensure the action is thread-safe when used with parallel streams.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements -
onDrop(C) — the action to perform on elements that are dropped; this action is only applied to elements that are dropped and are pulled by downstream operations
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: #dropWhile(Object), #filter(Object, Object), #takeWhile(Object)
skipUntil(...) -> S
-
Signature:
@Beta @ParallelSupported @IntermediateOp S skipUntil(P predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements until the given predicate evaluates to {@code true} .
-
Contract:
- This can produce results that appear unintuitive when the stream does not define an encounter order.
-
Parameters:
-
predicate(P) — a non-interfering, stateless predicate that tests each element to determine when to start including elements
-
- Returns: a new stream consisting of the elements starting from the first element that matches the given predicate
- See also: #dropWhile(Object), #takeWhile(Object), #filter(Object)
distinct(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S distinct() - Summary: Returns a stream consisting of the distinct elements of this stream.
-
Parameters:
- (none)
- Returns: a new stream consisting of the distinct elements of this stream
- See also: #filter(Object), #sorted()
intersection(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S intersection(Collection<?> c) - Summary: Returns a stream consisting of the elements that are present in both this stream and the specified collection, For elements that appear multiple times, the intersection contains the lesser number of occurrences.
-
Parameters:
-
c(Collection<?>) — the collection to find common elements with this stream
-
- Returns: a new stream containing elements present in both this stream and the specified collection, considering the minimum number of occurrences in either source
- See also: #difference(Collection), #symmetricDifference(Collection), N#intersection(Collection, Collection), N#intersection(int\[\], int\[\]), Collection#retainAll(Collection)
difference(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S difference(Collection<?> c) - Summary: Returns a stream consisting of the elements of this stream that are not present in the specified collection, considering the number of occurrences of each element.
-
Parameters:
-
c(Collection<?>) — the collection to compare against this stream
-
- Returns: a new stream containing the elements that are present in this stream but not in the specified collection, considering the number of occurrences.
- See also: #symmetricDifference(Collection), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), N#excludeAll(Collection, Collection), Difference#of(Collection, Collection)
symmetricDifference(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S symmetricDifference(Collection<T> c) - Summary: Returns a stream consisting of elements that are present in either this stream or the specified collection, but not in both.
-
Parameters:
-
c(Collection<T>) — the collection to compare with this stream for symmetric difference
-
- Returns: a new stream containing elements that are present in either this stream or the collection, but not in both, considering the number of occurrences
- See also: #intersection(Collection), #difference(Collection), N#symmetricDifference(Collection, Collection), N#symmetricDifference(int\[\], int\[\]), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), Iterables#symmetricDifference(Set, Set)
reversed(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered S reversed() - Summary: Returns a stream consisting of the elements of this stream in reverse order.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
- For example, if the original stream contains \[1, 2, 3\], the reversed stream will contain \[3, 2, 1\].
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream in reverse order
- See also: #sorted(), #shuffled(), #rotated(int)
rotated(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered S rotated(int distance) - Summary: Returns a stream consisting of the elements of this stream rotated by the specified distance.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
-
Parameters:
-
distance(int) — the number of positions to rotate the elements; positive values rotate elements to the right, negative values rotate elements to the left
-
- Returns: a new stream consisting of the elements of this stream rotated by the specified distance
- See also: #reversed(), #shuffled(), #sorted(), Collections#rotate(List, int)
shuffled(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered S shuffled() - Summary: Returns a stream consisting of the elements of this stream in a random order.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream in a random order
- See also: #shuffled(Random), #reversed(), #sorted(), #rotated(int), Collections#shuffle(List)
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered S shuffled(Random rnd) - Summary: Returns a stream consisting of the elements of this stream in a random order determined by the provided Random instance.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
- Unlike {@link #shuffled()} , this method allows specifying a custom Random instance, which is useful when deterministic shuffling with a specific seed is required.
-
Parameters:
-
rnd(Random) — the Random instance to use for shuffling elements
-
- Returns: a new stream consisting of the elements of this stream in a random order determined by the provided Random
- See also: #shuffled(), #reversed(), #sorted(), #rotated(int), Collections#shuffle(List, Random)
sorted(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered S sorted() - Summary: Returns a stream consisting of the elements of this stream in sorted order.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
- Elements must be comparable to be sorted with this method.
- If the elements are not comparable, a {@code ClassCastException} will be thrown.
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream in sorted order
- See also: #reverseSorted(), #reversed(), #shuffled(), #rotated(int)
reverseSorted(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered S reverseSorted() - Summary: Returns a stream consisting of the elements of this stream in reverse sorted order.
-
Contract:
- This is an intermediate operation that loads all elements into memory when called.
- Elements must be comparable to be sorted with this method.
- If the elements are not comparable, a {@code ClassCastException} will be thrown.
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream in reverse sorted order
- See also: #sorted(), #reversed(), #shuffled(), #rotated(int)
cycled(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S cycled() - Summary: Returns a stream consisting of the elements of this stream, repeating indefinitely.
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream repeated indefinitely
- See also: #cycled(long), #sorted(), #reversed(), #limit(long), #takeWhile(Object)
-
Signature:
@SequentialOnly @IntermediateOp S cycled(long rounds) - Summary: Returns a stream consisting of the elements of this stream, repeating for the specified number of rounds.
-
Parameters:
-
rounds(long) — the number of times to repeat the elements of this stream
-
- Returns: a new stream consisting of the elements of this stream repeated for the specified number of rounds
- See also: #cycled(), #sorted(), #reversed()
indexed(...) -> Stream<IT>
-
Signature:
@SequentialOnly @IntermediateOp Stream<IT> indexed() - Summary: Returns a stream consisting of the elements of this stream, each paired with its index in the stream.
-
Parameters:
- (none)
- Returns: a new stream consisting of the elements of this stream paired with their indices
skip(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S skip(long n) throws IllegalArgumentException - Summary: Returns a stream consisting of the remaining elements of this stream after skipping the first n elements.
-
Contract:
- If the stream contains fewer than n elements, an empty stream will be returned.
-
Parameters:
-
n(long) — the number of leading elements to skip
-
- Returns: a new stream consisting of the remaining elements of this stream after discarding the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative
-
- See also: #limit(long), #skipUntil(Object), #dropWhile(Object), #filter(Object)
-
Signature:
@Beta @ParallelSupported @IntermediateOp S skip(long n, C onSkip) throws IllegalArgumentException - Summary: Returns a stream consisting of the remaining elements of this stream after skipping the first n elements, applying the provided action to each skipped element.
-
Contract:
- If the stream contains fewer than n elements, an empty stream will be returned and the action will be applied to all available elements.
- <p> This method is marked with {@code @ParallelSupported} , meaning the {@code onSkip} may be performed concurrently for multiple skipped elements when used in a parallel stream.
- The implementation should ensure the action is thread-safe in such cases.
-
Parameters:
-
n(long) — the number of leading elements to skip -
onSkip(C) — the action to perform on each skipped element
-
- Returns: a new stream consisting of the remaining elements of this stream after skipping the first n elements
-
Throws:
-
java.lang.IllegalArgumentException— if {@code n} is negative
-
- See also: #skip(long), #filter(Object, Object), #limit(long), #dropWhile(Object, Object)
limit(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S limit(long maxSize) throws IllegalArgumentException - Summary: Returns a stream consisting of the first maxSize elements of this stream.
-
Contract:
- If the original stream contains fewer than maxSize elements, the entire stream is returned.
-
Parameters:
-
maxSize(long) — the maximum number of elements to include in the new stream
-
- Returns: a new stream consisting of at most maxSize elements from this stream
-
Throws:
-
java.lang.IllegalArgumentException— if {@code maxSize} is negative
-
- See also: #skip(long), #takeWhile(Object), #step(long), #limit(long), java.util.stream.Stream#limit(long)
-
Signature:
@SequentialOnly @IntermediateOp S limit(long offset, long maxSize) throws IllegalArgumentException - Summary: Returns a stream consisting of elements from this stream, starting after skipping the first {@code offset} elements and containing at most {@code maxSize} elements.
-
Contract:
- <p> Example usage: <pre> {@code // Get elements 3, 4, 5 from a stream of 1-10 Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .limit(2, 3) .toList(); // Returns \[3, 4, 5\] // Pagination: get page 3 with page size 10 (elements 21-30) Stream.rangeClosed(1, 100) .limit(20, 10) .toList(); // Returns \[21, 22, 23, 24, 25, 26, 27, 28, 29, 30\] // If offset exceeds stream size, returns empty stream Stream.of(1, 2, 3) .limit(5, 10) .toList(); // Returns \[\] // If fewer elements available than maxSize, returns remaining elements Stream.of(1, 2, 3, 4, 5) .limit(3, 10) .toList(); // Returns \[4, 5\] } </pre> <p> This is an intermediate operation that only runs sequentially, even in parallel streams, as noted by the {@code @SequentialOnly} annotation.
-
Parameters:
-
offset(long) — the number of leading elements to skip before starting to include elements -
maxSize(long) — the maximum number of elements to include in the new stream
-
- Returns: a new stream consisting of at most {@code maxSize} elements after skipping the first {@code offset} elements from this stream
-
Throws:
-
java.lang.IllegalArgumentException— if {@code offset} or {@code maxSize} is negative
-
- See also: #skip(long), #limit(long), #step(long)
step(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S step(long step) throws IllegalArgumentException - Summary: Returns a stream consisting of every 'step'th element of this stream.
-
Parameters:
-
step(long) — the interval between selected elements, must be positive (greater than 0)
-
- Returns: a new stream consisting of every 'step'th element of this stream
-
Throws:
-
java.lang.IllegalArgumentException— if {@code step} is negative or zero
-
- See also: #limit(long), #skip(long), #filter(Object)
rateLimited(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp default S rateLimited(final double permitsPerSecond) - Summary: Returns a stream with a rate limit applied.
-
Contract:
- This is useful for throttling operations when working with rate-limited resources or when you need to control the pace of processing.
-
Parameters:
-
permitsPerSecond(double) — the rate limit, specified as permits per second. Must be positive.
-
- Returns: a new Stream with the rate limit applied.
- See also: #rateLimited(RateLimiter), RateLimiter#create(double)
-
Signature:
@SequentialOnly @IntermediateOp S rateLimited(RateLimiter rateLimiter) - Summary: Returns a stream with a rate limit applied.
-
Parameters:
-
rateLimiter(RateLimiter) — the RateLimiter instance to use for controlling the rate of element emission
-
- Returns: a new Stream with the rate limit applied.
- See also: #rateLimited(double), RateLimiter, RateLimiter#acquire()
delay(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S delay(Duration duration) - Summary: Delay each element in this {@code Stream} by a given {@link Duration} except the first element.
-
Parameters:
-
duration(Duration) — the duration to delay each element in the stream (except the first element). Must not be {@code null} .
-
- Returns: a new Stream with the delay applied to each element.
- See also: #rateLimited(double), #rateLimited(RateLimiter)
-
Signature:
@SequentialOnly @IntermediateOp default S delay(java.time.Duration duration) - Summary: Delay each element in this {@code Stream} by a given {@link Duration} except the first element.
-
Parameters:
-
duration(java.time.Duration) — the duration to delay each element in the stream (except the first element). Must not be {@code null} .
-
- Returns: a new Stream with the delay applied to each element.
- See also: #delay(Duration), #rateLimited(double), #rateLimited(RateLimiter)
debounce(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S debounce(int maxWindowSize, Duration duration) - Summary: Returns a stream that limits the number of elements emitted within a sliding time window.
-
Contract:
- When the elapsed time exceeds the duration, the window slides forward and the element counter resets, allowing a new burst of elements.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Allow at most 5 elements per second Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .debounce(5, Duration.ofSeconds(1)) .forEach(System.out::println); // Only first 5 elements pass through immediately // Throttle log messages to at most 10 per minute logMessageStream .debounce(10, Duration.ofMinutes(1)) .forEach(msg -> logger.info(msg)); // Limit API requests to 100 per hour requestStream .debounce(100, Duration.ofHours(1)) .forEach(request -> processRequest(request)); } </pre> <p> <b> Behavior Details: </b> </p> <ul> <li> The time window starts when the first element is processed </li> <li> Elements within the limit are emitted immediately without delay </li> <li> Elements exceeding the limit within the window are silently dropped (filtered out) </li> <li> When the current time exceeds the window duration, the window advances and the counter resets </li> <li> The implementation uses {@link System#currentTimeMillis()} for time tracking </li> </ul> <p> This method only runs sequentially, even in parallel streams, as noted by the {@code @SequentialOnly} annotation.
-
Parameters:
-
maxWindowSize(int) — the maximum number of elements to allow within each time window. Must be positive. -
duration(Duration) — the length of each time window. Must not be {@code null} and must have a positive millisecond value.
-
- Returns: a new Stream that limits elements to {@code maxWindowSize} per {@code duration} window.
- See also: #rateLimited(double), #rateLimited(RateLimiter), #delay(Duration)
onEach(...) -> S
-
Signature:
@Beta @ParallelSupported @IntermediateOp S onEach(C action) - Summary: Performs the given action on the elements pulled by downstream/terminal operation.
-
Parameters:
-
action(C) — the action to be performed on the elements pulled by downstream/terminal operation
-
- Returns: a new Stream consisting of the elements of this stream with the provided action applied to each element.
- See also: #peek(Object)
peek(...) -> S
-
Signature:
@ParallelSupported @IntermediateOp default S peek(final C action) - Summary: Performs the provided action on each element as it is consumed from the stream by downstream/terminal operations.
-
Parameters:
-
action(C) — the action to be performed on the elements pulled by downstream/terminal operation
-
- Returns: a new Stream consisting of the elements of this stream with the provided action applied to each element.
- See also: #onEach(Object)
prepend(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S prepend(S stream) - Summary: Prepends the elements of the provided stream to this stream.
-
Parameters:
-
stream(S) — the stream whose elements should be prepended to this stream.
-
- Returns: a new Stream consisting of the elements of the provided stream followed by the elements of this stream.
-
Signature:
@SequentialOnly @IntermediateOp S prepend(OT op) - Summary: Prepends the element of the provided optional to this stream.
-
Contract:
- If the optional is present, its element will appear before the elements of this stream in the resulting stream.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Prepend a default value if available Optional<String> defaultValue = Optional.of("Default"); Stream<String> data = Stream.of("A", "B", "C"); data.prepend(defaultValue).toList(); // Returns \["Default", "A", "B", "C"\] // Empty optional has no effect Optional<Integer> empty = Optional.empty(); Stream<Integer> numbers = Stream.of(1, 2, 3); numbers.prepend(empty).toList(); // Returns \[1, 2, 3\] } </pre>
-
Parameters:
-
op(OT) — the optional whose element should be prepended to this stream.
-
- Returns: a new Stream consisting of the element of the provided optional (if present) followed by the elements of this stream.
append(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S append(S stream) - Summary: Appends the elements of the provided stream to this stream.
-
Parameters:
-
stream(S) — the stream whose elements should be appended to this stream.
-
- Returns: a new Stream consisting of the elements of this stream followed by the elements of the provided stream.
-
Signature:
@SequentialOnly @IntermediateOp S append(OT op) - Summary: Appends the element of the provided optional to this stream.
-
Contract:
- If the optional is present, its element will appear after the elements of this stream in the resulting stream.
-
Parameters:
-
op(OT) — the optional whose element should be appended to this stream.
-
- Returns: a new Stream consisting of the elements of this stream followed by the element of the provided optional (if present).
appendIfEmpty(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S appendIfEmpty(Supplier<? extends S> supplier) - Summary: Returns the stream from the provided supplier if this stream is empty.
-
Contract:
- Returns the stream from the provided supplier if this stream is empty.
- If this stream is empty, the elements from the supplied stream will be returned instead.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Provide default values when stream is empty Stream.<String>empty() .appendIfEmpty(() -> Stream.of("default1", "default2")) .toList(); // Returns \["default1", "default2"\] // Non-empty stream - supplier is not called Stream.of("A", "B") .appendIfEmpty(() -> Stream.of("default1", "default2")) .toList(); // Returns \["A", "B"\] // Use with filtering to ensure results Stream.of(1, 2, 3, 4) .filter(n -> n > 10) // No elements match .appendIfEmpty(() -> Stream.of(0)) .toList(); // Returns \[0\] } </pre>
-
Parameters:
-
supplier(Supplier<? extends S>) — the supplier that provides an alternative stream if this stream is empty.
-
- Returns: a new Stream consisting of the elements of this stream if not empty, or the elements from the supplied stream if this stream was empty.
- See also: #defaultIfEmpty(Supplier)
defaultIfEmpty(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp default S defaultIfEmpty(final Supplier<? extends S> supplier) - Summary: Returns the stream from the provided supplier if this stream is empty.
-
Contract:
- Returns the stream from the provided supplier if this stream is empty.
- If this stream is empty, the elements from the supplied stream will be returned instead.
- If this stream has any elements, the supplier is not called and the stream remains unchanged.
- {@code defaultIfEmpty} emphasizes providing default values, while {@code appendIfEmpty} emphasizes appending elements when empty.
- It is particularly useful when you want to ensure a stream always produces results, or when working with optional data that needs default values.
- The supplier is invoked lazily - only when a terminal operation is executed and the stream is actually empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Empty stream gets default values List<String> result = Stream.<String>empty() .defaultIfEmpty(() -> Stream.of("default1", "default2")) .toList(); // result = \["default1", "default2"\] // Non-empty stream - supplier is not called List<String> result = Stream.of("A", "B") .defaultIfEmpty(() -> Stream.of("default")) .toList(); // result = \["A", "B"\] // Use with filtering to ensure results List<Integer> result = Stream.of(1, 2, 3, 4) .filter(n -> n > 10) // No elements match .defaultIfEmpty(() -> Stream.of(0)) .toList(); // result = \[0\] // Provide multiple defaults List<Integer> numbers = Stream.of(1, 2, 3) .filter(n -> n > 100) .defaultIfEmpty(() -> Stream.of(-1, -2, -3)) .toList(); // If no data > 100, returns \[-1, -2, -3\] // Database query with fallback List<Product> products = productStream .filter(p -> p.getCategory().equals("Electronics")) .defaultIfEmpty(() -> Stream.of(Product.getDefaultProduct())) .toList(); // Returns Electronics products if available, otherwise default product } </pre>
-
Parameters:
-
supplier(Supplier<? extends S>) — the supplier that provides an alternative stream if this stream is empty. Must not be {@code null} .
-
- Returns: a new Stream consisting of the elements of this stream if not empty, or the elements from the supplied stream if this stream was empty.
- See also: #appendIfEmpty(Supplier)
throwIfEmpty(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S throwIfEmpty() - Summary: Throws a {@code NoSuchElementException} in the executed terminal operation if this {@code Stream} is empty.
-
Contract:
- Throws a {@code NoSuchElementException} in the executed terminal operation if this {@code Stream} is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Ensure stream has elements before processing Stream.of(1, 2, 3) .filter(n -> n > 5) .throwIfEmpty() // Throws NoSuchElementException because no elements match .toList(); // Valid when stream has elements Stream.of(1, 2, 3) .filter(n -> n > 1) .throwIfEmpty() // No exception - stream has elements .toList(); // Returns \[2, 3\] } </pre>
-
Parameters:
- (none)
- Returns: the current Stream.
-
Signature:
@SequentialOnly @IntermediateOp S throwIfEmpty(Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Throws a custom exception provided by the specified {@code exceptionSupplier} in the executed terminal operation if this {@code Stream} is empty.
-
Contract:
- Throws a custom exception provided by the specified {@code exceptionSupplier} in the executed terminal operation if this {@code Stream} is empty.
-
Parameters:
-
exceptionSupplier(Supplier<? extends RuntimeException>) — the supplier of the exception to be thrown if this stream is empty.
-
- Returns: the current Stream.
ifEmpty(...) -> S
-
Signature:
@Beta @SequentialOnly @IntermediateOp S ifEmpty(Runnable action) - Summary: Executes the given action if the stream is empty.
-
Contract:
- Executes the given action if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Log when stream is empty Stream.of(data) .filter(item -> item.isValid()) .ifEmpty(() -> System.out.println("No valid items found")) .forEach(this::process); // Track empty results AtomicBoolean isEmpty = new AtomicBoolean(false); Stream.of(1, 2, 3) .filter(n -> n > 10) .ifEmpty(() -> isEmpty.set(true)) .toList(); // isEmpty.get() == true } </pre>
-
Parameters:
-
action(Runnable) — the action to be executed if the stream is empty
-
- Returns: the current stream
join(...) -> String
-
Signature:
@SequentialOnly @TerminalOp default String join(final CharSequence delimiter) - Summary: Joins the elements of this stream into a single String, separated by the specified delimiter.
-
Parameters:
-
delimiter(CharSequence) — the sequence of characters to be used as a delimiter between each element in the resulting String.
-
- Returns: a String consisting of the elements of this stream, separated by the specified delimiter.
- See also: #join(CharSequence, CharSequence, CharSequence)
-
Signature:
@SequentialOnly @TerminalOp String join(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix) - Summary: Joins the elements of this stream into a single String, separated by the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(CharSequence) — the sequence of characters to be used as a delimiter between each element in the resulting String. -
prefix(CharSequence) — the sequence of characters to be added at the beginning of the resulting String. -
suffix(CharSequence) — the sequence of characters to be added at the end of the resulting String.
-
- Returns: a String consisting of the elements of this stream, separated by the specified delimiter, and surrounded by the specified prefix and suffix.
- See also: #join(CharSequence), #joinTo(Joiner)
joinTo(...) -> Joiner
-
Signature:
@SequentialOnly @TerminalOp Joiner joinTo(final Joiner joiner) - Summary: Joins the elements of this stream into a single String using the provided Joiner.
-
Parameters:
-
joiner(Joiner) — the Joiner specifying how to join the elements of the stream.
-
- Returns: the provided Joiner after appending all elements of the stream.
- See also: Joiner, #join(CharSequence, CharSequence, CharSequence)
percentiles(...) -> Optional<Map<Percentage, T>>
-
Signature:
@SequentialOnly @TerminalOp Optional<Map<Percentage, T>> percentiles() - Summary: Calculates the percentiles of the elements in the stream.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: an Optional containing a Map of Percentages to elements if the stream is not empty, otherwise an empty Optional.
- See also: N#percentilesOfSorted(int\[\]), Percentage
count(...) -> long
-
Signature:
@SequentialOnly @TerminalOp long count() - Summary: Counts the number of elements in the stream.
-
Contract:
- <p> <b> Performance Note: </b> DO NOT use {@code stream.count() > 0} to check if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code long count = Stream.of(1, 2, 3, 4, 5).count(); // Returns 5 // \\u274c Inefficient - processes entire stream if (stream.count() > 0) { ...
- } // \\u2705 Efficient - stops at first element if (stream.first().isPresent()) { ...
-
Parameters:
- (none)
- Returns: the count of elements in the stream as a long value. Returns 0 if the stream is empty.
- See also: #first()
first(...) -> OT
-
Signature:
@SequentialOnly @TerminalOp OT first() - Summary: Returns the first element of the stream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Get first element from non-empty stream Optional<String> first = Stream.of("apple", "banana", "cherry").first(); // first.get() returns "apple" // Empty stream returns empty Optional Optional<Integer> empty = Stream.<Integer>empty().first(); // empty.isEmpty() is true // Find first matching element (more efficient than filter + first) Optional<Integer> firstEven = Stream.of(1, 3, 4, 5, 6).filter(n -> n % 2 == 0).first(); // firstEven.get() returns 4 // Check if stream has elements (efficient alternative to count() > 0) boolean hasElements = Stream.of(data).first().isPresent(); } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the first element of the stream if it exists, otherwise an empty Optional.
- See also: #last(), #elementAt(long)
last(...) -> OT
-
Signature:
@SequentialOnly @TerminalOp OT last() - Summary: Returns the last element of the stream.
-
Contract:
- Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Get last element from non-empty stream Optional<String> last = Stream.of("apple", "banana", "cherry").last(); // last.get() returns "cherry" // Empty stream returns empty Optional Optional<Integer> empty = Stream.<Integer>empty().last(); // empty.isEmpty() is true // Find last matching element Optional<Integer> lastEven = Stream.of(1, 2, 3, 4, 5, 6).filter(n -> n % 2 == 0).last(); // lastEven.get() returns 6 // More efficient alternative when order matters Optional<Integer> result = Stream.of(1, 2, 3, 4, 5, 6) .reversed() .filter(n -> n % 2 == 0) .first(); // Finds last even number more efficiently } </pre>
-
Parameters:
- (none)
- Returns: an Optional containing the last element of the stream if it exists, otherwise an empty Optional.
- See also: #first(), #elementAt(long)
elementAt(...) -> OT
-
Signature:
@Beta @SequentialOnly @TerminalOp OT elementAt(long position) - Summary: Returns the element at the specified position in this stream.
-
Parameters:
-
position(long) — the position of the element to return.
-
- Returns: an Optional containing the element at the specified position in this stream if it exists, otherwise an empty Optional.
- See also: #first(), #last()
onlyOne(...) -> OT
-
Signature:
@SequentialOnly @TerminalOp OT onlyOne() throws TooManyElementsException - Summary: Returns an {@code Optional} containing the only element of this stream if it contains exactly one element, or an empty {@code Optional} if the stream is empty If the stream contains more than one element, an exception is thrown.
-
Contract:
- Returns an {@code Optional} containing the only element of this stream if it contains exactly one element, or an empty {@code Optional} if the stream is empty If the stream contains more than one element, an exception is thrown.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Stream with exactly one element Optional<String> single = Stream.of("only").onlyOne(); // single.get() returns "only" // Empty stream returns empty Optional Optional<Integer> empty = Stream.<Integer>empty().onlyOne(); // empty.isEmpty() is true // Stream with multiple elements throws exception try { Stream.of("a", "b", "c").onlyOne(); // Throws TooManyElementsException } catch (TooManyElementsException e) { // Handle error } // Useful for validation when expecting single result Optional<User> user = Stream.of(users) .filter(u -> u.getId().equals(targetId)) .onlyOne(); // Ensures at most one user with that ID } </pre>
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the only element of this stream, or an empty {@code Optional} if the stream is empty
-
Throws:
-
com.landawn.abacus.exception.TooManyElementsException— if the stream contains more than one element
-
- See also: #first(), #last()
toArray(...) -> A
-
Signature:
@SequentialOnly @TerminalOp A toArray() - Summary: Collects the elements of this stream into an array.
-
Parameters:
- (none)
- Returns: an array containing the elements of this stream
- See also: #toList(), #toSet()
toList(...) -> List<T>
-
Signature:
@SequentialOnly @TerminalOp List<T> toList() - Summary: Collects the elements of this stream into a modifiable List.
-
Parameters:
- (none)
- Returns: a modifiable List containing the elements of this stream.
- See also: #toSet(), #toImmutableList(), #toArray()
toSet(...) -> Set<T>
-
Signature:
@SequentialOnly @TerminalOp Set<T> toSet() - Summary: Collects the elements of this stream into a modifiable Set.
-
Parameters:
- (none)
- Returns: a modifiable Set containing the unique elements of this stream.
- See also: #toList(), #toImmutableSet(), #distinct()
toImmutableList(...) -> ImmutableList<T>
-
Signature:
@SequentialOnly @TerminalOp ImmutableList<T> toImmutableList() - Summary: Collects the elements of this stream into an ImmutableList.
-
Parameters:
- (none)
- Returns: an ImmutableList containing the elements of this stream.
- See also: #toList()
toImmutableSet(...) -> ImmutableSet<T>
-
Signature:
@SequentialOnly @TerminalOp ImmutableSet<T> toImmutableSet() - Summary: Collects the elements of this stream into an ImmutableSet.
-
Parameters:
- (none)
- Returns: an ImmutableSet containing the unique elements of this stream.
- See also: #toSet()
toCollection(...) -> CC
-
Signature:
@SequentialOnly @TerminalOp <CC extends Collection<T>> CC toCollection(Supplier<? extends CC> supplier) - Summary: Collects the elements of this stream into a Collection.
-
Parameters:
-
supplier(Supplier<? extends CC>) — a supplier function that provides a new, empty Collection of the desired type.
-
- Returns: a Collection of the desired type containing the elements of this stream.
- See also: #toList(), #toSet()
toMultiset(...) -> Multiset<T>
-
Signature:
@SequentialOnly @TerminalOp Multiset<T> toMultiset() - Summary: Collects the elements of this stream into a Multiset.
-
Parameters:
- (none)
- Returns: a Multiset containing the elements of this stream with their occurrence counts.
- See also: #toMultiset(Supplier), Multiset
-
Signature:
@SequentialOnly @TerminalOp Multiset<T> toMultiset(Supplier<? extends Multiset<T>> supplier) - Summary: Collects the elements of this stream into a Multiset.
-
Parameters:
-
supplier(Supplier<? extends Multiset<T>>) — a supplier function that provides a new, empty Multiset of the desired type.
-
- Returns: a Multiset of the desired type containing the elements of this stream.
println(...) -> void
-
Signature:
@Beta @SequentialOnly @TerminalOp void println() - Summary: Prints at most the first thousand elements of this stream to the standard output in a formatted manner.
-
Contract:
- If there are more than a thousand elements, only the first thousand will be printed followed by an ellipsis (...).
- If this stream is empty, it will print {@code \[\]} .
-
Parameters:
- (none)
- See also: #join(CharSequence, CharSequence, CharSequence), System#out
iterator(...) -> ITER
-
Signature:
@Deprecated @SequentialOnly ITER iterator() - Summary: Returns an iterator for the elements of this stream.
-
Contract:
- <p> <b> Warning: </b> Remember to close this Stream after the iteration is done, if needed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Using try-finally (not recommended) Stream<String> stream = Stream.of("a", "b", "c"); try { Iterator<String> iter = stream.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } } finally { stream.close(); // Must explicitly close the stream } // Using try-with-resources (better approach if you must use iterator) try (Stream<String> stream = Stream.of("a", "b", "c")) { Iterator<String> iter = stream.iterator(); while (iter.hasNext()) { process(iter.next()); } } // Stream automatically closed } </pre>
-
Parameters:
- (none)
- Returns: an iterator for the elements of this stream.
- See also: #toList(), #close()
isParallel(...) -> boolean
-
Signature:
boolean isParallel() - Summary: Checks if the stream is running in parallel mode.
-
Contract:
- Checks if the stream is running in parallel mode.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check default sequential stream Stream<Integer> seq = Stream.of(1, 2, 3); boolean isParallel = seq.isParallel(); // isParallel is false // Check parallel stream Stream<Integer> par = Stream.of(1, 2, 3).parallel(); boolean isParallelNow = par.isParallel(); // isParallelNow is true // Conditionally apply parallel processing Stream<String> stream = Stream.of(data); if (data.size() > 10000) { stream = stream.parallel(8); } // Later check if parallelized if (stream.isParallel()) { System.out.println("Processing in parallel mode"); } } </pre>
-
Parameters:
- (none)
- Returns: {@code true} if the stream is running in parallel mode, {@code false} otherwise.
- See also: #sequential(), #parallel()
sequential(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S sequential() - Summary: Switches the stream to sequential mode.
-
Parameters:
- (none)
- Returns: a new Stream that is identical to this stream, but in sequential mode.
- See also: #parallel(), #isParallel()
parallel(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S parallel() - Summary: Switches the stream to parallel mode.
-
Contract:
- <br/> Consider using {@code sps(int, Function)} if only next operation need to be parallelized.
- For example: <p> <b> Usage Examples: </b> </p> <pre> {@code stream.parallel(maxThreadNum).map(f).filter(p)...; // Replace above line of code with "sps" if only "f" need to be parallelized.
- stream.parallel(maxThreadNum).map(f).sequential().filter(p)...; } </pre> When to use parallel Streams?
- <ul> <li> First, do NOT and should NOT use parallel Streams if you don't have any problem with sequential Streams, because using parallel Streams has extra cost.
- </li> <li> Consider using parallel Streams only when <a href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html"> N(the number of elements) * Q(cost per element of F, the per-element function (usually a lambda)) is big enough(e.g., IO involved.
- </i> <table> <caption> Performance Benchmark Results (milliseconds) </caption> <tr> <th> </th> <th> m = 1 </th> <th> m = 10 </th> <th> m = 50 </th> <th> m = 100 </th> <th> m = 500 </th> <th> m = 1000 </th> </tr> <tr> <td> Q </td> <td> 0.00002 </td> <td> 0.0002 </td> <td> 0.001 </td> <td> 0.002 </td> <td> 0.01 </td> <td> 0.02 </td> </tr> <tr> <td> For Loop </td> <td> 0.23 </td> <td> 2.3 </td> <td> 11 </td> <td> 22 </td> <td> 110 </td> <td> 219 </td> </tr> <tr> <td> JDK Sequential </td> <td> 0.28 </td> <td> 2.3 </td> <td> 11 </td> <td> 22 </td> <td> 114 </td> <td> 212 </td> </tr> <tr> <td> JDK Parallel </td> <td> 0.22 </td> <td> 1.3 </td> <td> 6 </td> <td> 12 </td> <td> 66 </td> <td> 122 </td> </tr> <tr> <td> Abacus Sequential </td> <td> 0.3 </td> <td> 2 </td> <td> 11 </td> <td> 22 </td> <td> 112 </td> <td> 212 </td> </tr> <tr> <td> Abacus Parallel </td> <td> 11 </td> <td> 11 </td> <td> 11 </td> <td> 16 </td> <td> 77 </td> <td> 128 </td> </tr> </table> <b> Comparison: </b> <ul> <li> Again, do NOT and should NOT use parallel Streams if you don't have any performance problem with sequential Streams, because using parallel Streams has extra cost.
- </li> <li> Again, consider using parallel Streams only when <a href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html"> N(the number of elements) * Q(cost per element of F, the per-element function (usually a lambda)) is big enough </a> .
- </li> <li> The implementation of parallel Streams in abacus-common is more than 10 times, slower than parallel Streams in JDK when Q is tiny (here is less than 0.0002 milliseconds by the test): <ul> <li> The implementation of parallel Streams in JDK 8 still can beat the sequential/for loop when Q is tiny (Here is 0.00002 milliseconds by the test).
- But it starts to be faster than sequential Streams when Q is big enough (Here is 0.001 milliseconds by the test) and starts to catch the parallel Streams in JDK when Q is bigger (Here is 0.01 milliseconds by the test).
- </li> <li> Consider using the parallel Streams in abacus-common when Q is big enough, specially when IO involved in F.
- It's fair to say that the parallel Streams in abacus-common are high efficient, may same as or faster than the parallel Streams in JDK when Q is big enough, except F is a heavy cpu-used operation.
- It's {@code true} when Q and F is VERY, VERY tiny, like <code> f = (int a, int b) -> a + b; </code> .
- But if we look into the samples in the article and think about it, it just takes less than 1 millisecond to get the max value in 100k numbers.
- There is a potential performance issue only if the "get the max value in 100K numbers" call many, many times in your API or single request.
- Usually we meet performance issue only if Q and F is big enough.
- However, the performance of Lambdas/Streams APIs is closed to for loop when Q and F is big enough.
- No matter in which scenario, We don't need and should not concern the performance of Lambdas/Stream APIs.
- Because the sequential way is as fast, or even faster than the parallel way for some methods, or is pretty challenging, if not possible, to implement the method by parallel approach.
-
Parameters:
- (none)
- Returns: a parallel stream
- See also: #sps(Function), #sps(int, Function), #parallel(int), #parallel(Executor), #parallel(int, Executor), com.landawn.abacus.util.Profiler#run(int, int, int, com.landawn.abacus.util.Throwables.Runnable), <a href="https://www.infoq.com/presentations/parallel-java-se-8#downloadPdf">,Understanding Parallel Stream Performance in Java SE 8,</a>, <a href="https://www.baeldung.com/java-when-to-use-parallel-stream">,When to Use a Parallel Stream in Java,</a>, <a href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">,When to use parallel Streams,</a>
-
Signature:
@SequentialOnly @IntermediateOp S parallel(int maxThreadNum) - Summary: Switches the stream to parallel mode with a specified maximum thread number.
-
Contract:
- <p> Consider using {@code sps(int, Function)} if only the next operation needs to be parallelized.
- For example: <p> <b> Usage Examples: </b> </p> <pre> {@code stream.parallel(maxThreadNum).map(f).filter(p)...; // Replace above line of code with "sps" if only "f" needs to be parallelized, and "p" is fast enough to be executed in sequential Stream.
- If the specified value is bigger than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ), the maximum allowed thread number per operation will be used.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations. If the specified value is bigger than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ), maximum allowed thread number per operation will be used.
-
- Returns: a new stream configured for parallel execution with the specified maximum thread count
- See also: #sps(Function), #sps(int, Function), #parallel(), #parallel(Executor), #parallel(int, Executor)
-
Signature:
@SequentialOnly @IntermediateOp S parallel(Executor executor) - Summary: Switches the stream to parallel mode with a specified Executor.
-
Contract:
- <p> Consider using {@code sps(int, Function)} if only the next operation needs to be parallelized.
- For example: <p> <b> Usage Examples: </b> </p> <pre> {@code stream.parallel(executor).map(f).filter(p)...; // Replace above line of code with "sps" if only "f" needs to be parallelized, and "p" is fast enough to be executed in sequential Stream.
- stream.parallel(executor).map(f).sequential().filter(p)...; } </pre> <p> <b> Usage Examples: </b> </p> <pre> {@code // Use a custom thread pool ExecutorService customExecutor = Executors.newFixedThreadPool(10); Stream.of(data) .parallel(customExecutor) .map(expensiveOperation) .toList(); // Use a cached thread pool for IO operations ExecutorService ioExecutor = Executors.newCachedThreadPool(); Stream.of(files) .parallel(ioExecutor) .map(file -> readFile(file)) .toList(); } </pre> <p> <b> Warning: </b> The call could be hanged if this executor is created by {@code Executors.newVirtualThreadPerTaskExecutor()} and used by multiple calls in this stream.
-
Parameters:
-
executor(Executor) — the Executor to use for parallel operations. {@code Executor} can be specified for bigger thread number than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ) or virtual thread.
-
- Returns: a new stream configured for parallel execution with the specified executor
- See also: #sps(Function), #sps(int, Function), #parallel(), #parallel(int), #parallel(int, Executor)
-
Signature:
@SequentialOnly @IntermediateOp S parallel(int maxThreadNum, Executor executor) - Summary: Switches the stream to parallel mode with specified maximum thread number and Executor.
-
Contract:
- <p> Consider using {@code sps(int, Function)} if only the next operation needs to be parallelized.
- For example: <p> <b> Usage Examples: </b> </p> <pre> {@code stream.parallel(maxThreadNum, executor).map(f).filter(p)...; // Replace above line of code with "sps" if only "f" needs to be parallelized, and "p" is fast enough to be executed in sequential Stream.
- stream.parallel(maxThreadNum, executor).map(f).sequential().filter(p)...; } </pre> <p> If the specified maxThreadNum is bigger than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ) and {@code executor} is not specified with a {@code non-null} value, maximum allowed thread number per operation will be used.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Use a custom executor with limited parallelism ExecutorService executor = Executors.newFixedThreadPool(20); Stream.of(data) .parallel(10, executor) // Use at most 10 threads from the pool .map(expensiveOperation) .toList(); } </pre> <p> <b> Warning: </b> The call could be hanged if this executor is created by {@code Executors.newVirtualThreadPerTaskExecutor()} and used by multiple calls in this stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations. If the specified value is bigger than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ) and {@code executor} is not specified with a {@code non-null} value, maximum allowed thread number per operation will be used. -
executor(Executor) — the Executor to use for parallel operations. {@code Executor} can be specified for bigger thread number than the maximum allowed thread number per operation ( {@code min(64, cpu_cores * 8)} ) or virtual thread.
-
- Returns: a new stream configured for parallel execution with the specified parameters
- See also: #sps(Function), #sps(int, Function), #parallel(), #parallel(int), #parallel(Executor)
-
Signature:
@Beta @SequentialOnly @IntermediateOp S parallel(ParallelSettings ps) - Summary: Switches the stream to parallel mode with the specified parallel settings.
-
Contract:
- <p> Consider using {@code sps(int, Function)} if only the next operation needs to be parallelized.
- For example: <p> <b> Usage Examples: </b> </p> <pre> {@code stream.parallel(ps).map(f).filter(p)...; // Replace above line of code with "sps" if only "f" needs to be parallelized, and "p" is fast enough to be executed in sequential Stream.
-
Parameters:
-
ps(ParallelSettings) — the ParallelSettings object containing configuration for parallel execution, including maximum thread number, splitor strategy, and executor
-
- Returns: a new stream configured for parallel execution with the specified settings
- See also: #sps(Function), #sps(int, Function), #parallel(), #parallel(int), #parallel(Executor), #parallel(int, Executor), ParallelSettings
sps(...) -> SS
-
Signature:
@Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") <SS extends BaseStream> SS sps(Function<? super S, ? extends SS> ops) - Summary: Temporarily switches the stream to parallel mode for the specified operation and then switches back to sequential mode.
-
Contract:
- This is useful when you want to parallelize only a specific operation in a stream pipeline.
-
Parameters:
-
ops(Function<? super S, ? extends SS>) — the function that defines the operations to be performed in parallel mode
-
- Returns: a new stream with the operations applied in parallel mode, then switched back to sequential
- See also: #sps(int, Function), #sps(int, Executor, Function), #parallel(), #parallel(Executor), #parallel(int, Executor)
-
Signature:
@Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") <SS extends BaseStream> SS sps(int maxThreadNum, Function<? super S, ? extends SS> ops) - Summary: Temporarily switches the stream to parallel mode with specified thread count for the specified operation and then switches back to sequential mode.
-
Contract:
- This is useful when you want to parallelize only a specific operation with controlled parallelism.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for the parallel operation -
ops(Function<? super S, ? extends SS>) — the function that defines the operations to be performed in parallel mode
-
- Returns: a new stream with the operations applied in parallel mode, then switched back to sequential
- See also: #sps(Function), #sps(int, Executor, Function), #parallel(), #parallel(Executor), #parallel(int, Executor)
-
Signature:
@Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") <SS extends BaseStream> SS sps(int maxThreadNum, Executor executor, Function<? super S, ? extends SS> ops) - Summary: Temporarily switches the stream to parallel mode with specified thread count and executor for the specified operation and then switches back to sequential mode.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for the parallel operation -
executor(Executor) — the executor to use for the parallel operation -
ops(Function<? super S, ? extends SS>) — the function that defines the operations to be performed in parallel mode
-
- Returns: a new stream with the operations applied in parallel mode, then switched back to sequential
- See also: #sps(Function), #sps(int, Function), #parallel(), #parallel(Executor), #parallel(int, Executor)
psp(...) -> SS
-
Signature:
@Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") <SS extends BaseStream> SS psp(Function<? super S, ? extends SS> ops) - Summary: Temporarily switches the stream to sequential mode for the specified operation and then switches back to parallel mode with the same configuration (maxThreadNum/splitor/asyncExecutor).
-
Contract:
- This is useful when you have a parallel stream but want to execute a specific operation sequentially.
-
Parameters:
-
ops(Function<? super S, ? extends SS>) — the function that defines the operations to be performed in sequential mode
-
- Returns: a new stream with the operations applied in sequential mode, then switched back to parallel with the same parallel configuration
- See also: #parallel(), #parallel(Executor), #parallel(int, Executor)
transform(...) -> RS
-
Signature:
@Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") <RS extends BaseStream> RS transform(Function<? super S, ? extends RS> transfer) - Summary: Transforms the current stream into a new stream using the provided transformation function.
-
Parameters:
-
transfer(Function<? super S, ? extends RS>) — the transformation function that takes the current stream and returns a new stream
-
- Returns: a new stream transformed by the provided function
__(...) -> RS
-
Signature:
@Deprecated @Beta @SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") default <RS extends BaseStream> RS __(final Function<? super S, ? extends RS> transfer) - Summary: Transforms the current stream into a new stream using the provided transformation function.
-
Parameters:
-
transfer(Function<? super S, ? extends RS>) — the transformation function that takes the current stream and returns a new stream
-
- Returns: a new stream transformed by the provided function
- See also: #transform(Function)
applyIfNotEmpty(...) -> u.Optional<R>
-
Signature:
@SequentialOnly @TerminalOp <R, E extends Exception> u.Optional<R> applyIfNotEmpty(Throwables.Function<? super S, ? extends R, E> func) throws E - Summary: Applies the provided function to the stream if it is not empty.
-
Contract:
- Applies the provided function to the stream if it is not empty.
- <p> If the stream contains at least one element, the function is applied to the entire stream.
- If the stream is empty, an empty Optional is returned without invoking the function.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average only if stream is not empty Optional<Double> average = Stream.of(1, 2, 3, 4, 5) .applyIfNotEmpty(s -> s.mapToDouble(i -> i).average().orElse(0.0)); // Returns Optional.of(3.0) // Empty stream returns empty Optional Optional<String> result = Stream.<String>empty() .applyIfNotEmpty(s -> s.collect(Collectors.joining(", "))); // Returns Optional.empty() } </pre>
-
Parameters:
-
func(Throwables.Function<? super S, ? extends R, E>) — the function to be applied to the stream if it's not empty
-
- Returns: an Optional containing the result of the function if the stream is not empty, or an empty Optional if the stream is empty
-
Throws:
-
E— if the function throws an exception
-
acceptIfNotEmpty(...) -> OrElse
-
Signature:
@SequentialOnly @TerminalOp <E extends Exception> OrElse acceptIfNotEmpty(Throwables.Consumer<? super S, E> action) throws E - Summary: Applies the provided consumer to the stream if it is not empty.
-
Contract:
- Applies the provided consumer to the stream if it is not empty.
- <p> If the stream contains at least one element, the consumer is applied to the entire stream.
- The returned OrElse object can be used to specify an alternative action if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Process stream if not empty, otherwise perform alternative action Stream.of(1, 2, 3) .acceptIfNotEmpty(s -> System.out.println("Sum: " + s.mapToInt(i -> i).sum())) .orElse(() -> System.out.println("Stream was empty")); // Prints: Sum: 6 // Empty stream triggers orElse action Stream.<Integer>empty() .acceptIfNotEmpty(s -> System.out.println("Processing: " + s.toList())) .orElse(() -> System.out.println("No data to process")); // Prints: No data to process } </pre>
-
Parameters:
-
action(Throwables.Consumer<? super S, E>) — the consumer to be applied to the stream if it's not empty
-
- Returns: an OrElse instance which can be used to perform further actions if the stream is empty
-
Throws:
-
E— if the consumer throws an exception
-
onClose(...) -> S
-
Signature:
@SequentialOnly @IntermediateOp S onClose(Runnable closeHandler) - Summary: Registers a close handler to be invoked when the stream is closed.
-
Contract:
- Registers a close handler to be invoked when the stream is closed.
- The handlers will be invoked when the stream is closed, either explicitly by calling {@link #close()} or implicitly when a terminal operation completes.
-
Parameters:
-
closeHandler(Runnable) — the Runnable to be invoked when the stream is closed
-
- Returns: a stream with the close handler registered. This may be the same stream instance.
close(...) -> void
-
Signature:
@Override void close() - Summary: Closes the stream, releasing any system resources associated with it.
-
Contract:
- If the stream is already closed, then invoking this method has no effect.
- <p> Streams are automatically closed when a terminal operation completes, so explicit closing is typically not necessary.
- However, if a stream may be abandoned before a terminal operation (e.g., due to an exception), it should be closed explicitly to ensure proper resource cleanup.
- </p> <p> All registered close handlers (added via {@link #onClose(Runnable)} ) are invoked when this method is called, in the order they were registered.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Using try-with-resources for automatic closing try (Stream<String> stream = Stream.of(data)) { stream.map(s -> s.toUpperCase()) .filter(s -> s.length() > 5) .toList(); } // Stream is automatically closed here // Manual closing when stream might not reach terminal operation Stream<String> stream = Stream.of(data); try { // Some operations that might throw exception } finally { stream.close(); // Ensure stream is closed } } </pre>
-
Parameters:
- (none)
Enum Splitor (com.landawn.abacus.util.stream.BaseStream.Splitor)
Enum defining strategies for splitting stream elements among parallel threads.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class ParallelSettings (com.landawn.abacus.util.stream.BaseStream.ParallelSettings)
Configuration class for parallel stream execution.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
<init>(...) -> void
-
Signature:
public ParallelSettings() - Summary: Constructs a new ParallelSettings instance with default values.
-
Parameters:
- (none)
- See also: PS#create(int), PS#create(Executor)
Class PS (com.landawn.abacus.util.stream.BaseStream.ParallelSettings.PS)
Factory class for creating {@link ParallelSettings} instances.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> ParallelSettings
-
Signature:
public static ParallelSettings create(final int maxThreadNum) - Summary: Creates a ParallelSettings instance with the specified maximum thread number.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations
-
- Returns: a new ParallelSettings instance configured with the specified thread count
-
Signature:
@Deprecated public static ParallelSettings create(final Splitor splitor) - Summary: Creates a ParallelSettings instance with the specified splitor strategy.
-
Parameters:
-
splitor(Splitor) — the strategy for splitting work among parallel threads
-
- Returns: a new ParallelSettings instance configured with the specified splitor
-
Signature:
public static ParallelSettings create(final Executor executor) - Summary: Creates a ParallelSettings instance with the specified executor.
-
Parameters:
-
executor(Executor) — the executor to use for parallel operations
-
- Returns: a new ParallelSettings instance configured with the specified executor
-
Signature:
@Deprecated public static ParallelSettings create(final int maxThreadNum, final Splitor splitor) - Summary: Creates a ParallelSettings instance with the specified maximum thread number and splitor strategy.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations -
splitor(Splitor) — the strategy for splitting work among parallel threads
-
- Returns: a new ParallelSettings instance configured with the specified parameters
-
Signature:
public static ParallelSettings create(final int maxThreadNum, final Executor executor) - Summary: Creates a ParallelSettings instance with the specified maximum thread number and executor.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations -
executor(Executor) — the executor to use for parallel operations
-
- Returns: a new ParallelSettings instance configured with the specified parameters
-
Signature:
@Deprecated public static ParallelSettings create(final Splitor splitor, final Executor executor) - Summary: Creates a ParallelSettings instance with the specified splitor strategy and executor.
-
Parameters:
-
splitor(Splitor) — the strategy for splitting work among parallel threads -
executor(Executor) — the executor to use for parallel operations
-
- Returns: a new ParallelSettings instance configured with the specified parameters
-
Signature:
@Deprecated public static ParallelSettings create(final int maxThreadNum, final Splitor splitor, final Executor executor) - Summary: Creates a ParallelSettings instance with all configuration parameters.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to use for parallel operations -
splitor(Splitor) — the strategy for splitting work among parallel threads -
executor(Executor) — the executor to use for parallel operations
-
- Returns: a new ParallelSettings instance configured with all specified parameters
Public Instance Methods
- (none)
Class ByteIteratorEx (com.landawn.abacus.util.stream.ByteIteratorEx)
An extended iterator over primitive byte values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ByteIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static ByteIteratorEx empty() - Summary: Returns an empty ByteIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty ByteIteratorEx instance
of(...) -> ByteIteratorEx
-
Signature:
public static ByteIteratorEx of(final byte... a) - Summary: Creates a ByteIteratorEx from the given byte array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(byte[]) — the byte array to iterate over (can be {@code null} or empty)
-
- Returns: a ByteIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static ByteIteratorEx of(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a ByteIteratorEx from a portion of the given byte array.
-
Parameters:
-
a(byte[]) — the byte array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a ByteIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static ByteIteratorEx of(final ByteIterator iter) - Summary: Wraps a ByteIterator as a ByteIteratorEx.
-
Contract:
- If the iterator is already a ByteIteratorEx, it is returned as-is.
-
Parameters:
-
iter(ByteIterator) — the ByteIterator to wrap (can be null)
-
- Returns: a ByteIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> ByteIteratorEx
-
Signature:
public static ByteIteratorEx from(final Iterator<Byte> iter) - Summary: Creates a ByteIteratorEx from an Iterator of Byte objects.
-
Parameters:
-
iter(Iterator<Byte>) — the Iterator of Byte objects (can be null)
-
- Returns: a ByteIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class ByteStream (com.landawn.abacus.util.stream.ByteStream)
A specialized stream implementation for processing sequences of byte values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ByteStream
-
Signature:
public static ByteStream empty() - Summary: Returns an empty ByteStream with no elements.
-
Parameters:
- (none)
- Returns: an empty ByteStream
- See also: #ofNullable(Byte)
defer(...) -> ByteStream
-
Signature:
public static ByteStream defer(final Supplier<ByteStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
-
Parameters:
-
supplier(Supplier<ByteStream>) — the supplier that provides the ByteStream
-
- Returns: a new ByteStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
ofNullable(...) -> ByteStream
-
Signature:
public static ByteStream ofNullable(final Byte e) - Summary: Returns a ByteStream containing a single element if the provided element is {@code non-null} , otherwise returns an empty ByteStream.
-
Contract:
- Returns a ByteStream containing a single element if the provided element is {@code non-null} , otherwise returns an empty ByteStream.
-
Parameters:
-
e(Byte) — the element, possibly null
-
- Returns: a ByteStream containing the element if {@code non-null} , otherwise an empty stream
- See also: #empty(), #of(byte...)
of(...) -> ByteStream
-
Signature:
public static ByteStream of(final byte... a) - Summary: Returns a ByteStream whose elements are the specified values.
-
Parameters:
-
a(byte[]) — the elements of the new stream
-
- Returns: a new ByteStream consisting of the specified elements
-
Signature:
public static ByteStream of(final byte[] a, final int fromIndex, final int toIndex) - Summary: Returns a ByteStream whose elements are the specified values from the array between fromIndex (inclusive) and toIndex (exclusive).
-
Parameters:
-
a(byte[]) — the array containing the elements -
fromIndex(int) — the starting index, inclusive -
toIndex(int) — the ending index, exclusive
-
- Returns: a ByteStream containing the specified range of elements
-
Signature:
public static ByteStream of(final Byte[] a) - Summary: Returns a ByteStream whose elements are the unboxed values from the specified Byte array.
-
Parameters:
-
a(Byte[]) — the array of Byte objects
-
- Returns: a new ByteStream containing the unboxed values from the array
-
Signature:
public static ByteStream of(final Byte[] a, final int fromIndex, final int toIndex) - Summary: Returns a ByteStream whose elements are the unboxed values from the specified Byte array between fromIndex (inclusive) and toIndex (exclusive).
-
Parameters:
-
a(Byte[]) — the array of Byte objects -
fromIndex(int) — the starting index, inclusive -
toIndex(int) — the ending index, exclusive
-
- Returns: a new ByteStream containing the unboxed values from the specified array range
-
Signature:
public static ByteStream of(final Collection<Byte> c) - Summary: Returns a ByteStream whose elements are the unboxed values from the specified collection.
-
Parameters:
-
c(Collection<Byte>) — the collection of Byte objects
-
- Returns: a new ByteStream containing the unboxed values from the collection
-
Signature:
public static ByteStream of(final ByteIterator iterator) - Summary: Returns a ByteStream whose elements are provided by the specified ByteIterator.
-
Parameters:
-
iterator(ByteIterator) — the iterator providing the elements
-
- Returns: a new ByteStream backed by the iterator
-
Signature:
public static ByteStream of(final ByteBuffer buf) - Summary: Returns a ByteStream whose elements are the bytes from the specified ByteBuffer between its current position and limit.
-
Parameters:
-
buf(ByteBuffer) — the ByteBuffer containing the elements
-
- Returns: a new ByteStream consisting of bytes from the ByteBuffer between its current position and limit
-
Signature:
public static ByteStream of(final File file) - Summary: Returns a ByteStream reading bytes from the specified file.
-
Contract:
- The stream will automatically close the underlying file input stream when the stream is closed.
-
Parameters:
-
file(File) — the file to read from
-
- Returns: a new ByteStream consisting of bytes read from the specified file
-
Signature:
public static ByteStream of(final InputStream is) - Summary: Returns a ByteStream reading bytes from the specified InputStream.
-
Contract:
- The input stream will not be closed when the ByteStream is closed.
-
Parameters:
-
is(InputStream) — the input stream to read from
-
- Returns: a new ByteStream consisting of bytes read from the specified InputStream
-
Signature:
public static ByteStream of(final InputStream is, final boolean closeInputStreamWhenStreamIsClosed) - Summary: Returns a ByteStream reading bytes from the specified InputStream with configurable auto-close behavior.
-
Contract:
- This is a static factory method that allows control over whether the underlying input stream should be automatically closed when the ByteStream is closed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Auto-close the input stream when ByteStream is closed try (InputStream is = new FileInputStream("data.bin"); ByteStream stream = ByteStream.of(is, true)) { byte\[\] bytes = stream.toArray(); } // Input stream is automatically closed // Keep input stream open after ByteStream is closed InputStream sharedStream = getSharedInputStream(); ByteStream stream = ByteStream.of(sharedStream, false); byte\[\] bytes = stream.toArray(); // sharedStream is still open for other operations } </pre>
-
Parameters:
-
is(InputStream) — the input stream to read from -
closeInputStreamWhenStreamIsClosed(boolean) — if {@code true} , the input stream will be closed when the ByteStream is closed; if {@code false} , the input stream remains open
-
- Returns: a new ByteStream consisting of bytes read from the specified InputStream
- See also: #of(InputStream), #of(File)
flatten(...) -> ByteStream
-
Signature:
public static ByteStream flatten(final byte[][] a) - Summary: Returns a ByteStream whose elements are all the elements from the input two-dimensional array, flattened in row-major order.
-
Parameters:
-
a(byte[][]) — the two-dimensional array to flatten
-
- Returns: a new ByteStream containing all elements from the two-dimensional array
-
Signature:
public static ByteStream flatten(final byte[][] a, final boolean vertically) - Summary: Returns a ByteStream whose elements are all the elements from the input two-dimensional array, flattened either in row-major order (vertically = false) or column-major order (vertically = true).
-
Parameters:
-
a(byte[][]) — the two-dimensional array to flatten -
vertically(boolean) — if {@code true} , elements are read column by column; if {@code false} , row by row
-
- Returns: a new ByteStream containing all elements from the two-dimensional array
-
Signature:
public static ByteStream flatten(final byte[][] a, final byte valueForAlignment, final boolean vertically) - Summary: Returns a ByteStream whose elements are all the elements from the input two-dimensional array, flattened either in row-major order (vertically = false) or column-major order (vertically = true).
-
Contract:
- If rows have different lengths, the valueForAlignment is used to pad shorter rows.
-
Parameters:
-
a(byte[][]) — the two-dimensional array to flatten -
valueForAlignment(byte) — element to append, so there is the same size of elements in all rows/columns -
vertically(boolean) — if {@code true} , elements are read column by column; if {@code false} , row by row
-
- Returns: a new ByteStream containing all elements from the two-dimensional array with alignment padding
-
Signature:
public static ByteStream flatten(final byte[][][] a) - Summary: Returns a ByteStream whose elements are all the elements from the input three-dimensional array, flattened in row-major order.
-
Parameters:
-
a(byte[][][]) — the three-dimensional array to flatten
-
- Returns: a new ByteStream containing all elements from the three-dimensional array
range(...) -> ByteStream
-
Signature:
public static ByteStream range(final byte startInclusive, final byte endExclusive) - Summary: Returns a ByteStream whose elements are the values from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1.
-
Contract:
- <p> An empty stream is returned if startInclusive is greater than or equal to endExclusive.
-
Parameters:
-
startInclusive(byte) — the (inclusive) initial value -
endExclusive(byte) — the exclusive upper bound
-
- Returns: a new ByteStream consisting of values from startInclusive (inclusive) to endExclusive (exclusive)
-
Signature:
public static ByteStream range(final byte startInclusive, final byte endExclusive, final byte by) - Summary: Returns a ByteStream whose elements are the values from startInclusive (inclusive) to endExclusive (exclusive) by the specified incremental step.
-
Contract:
- <p> An empty stream is returned if startInclusive is equal to endExclusive or if the range and step have opposing signs.
-
Parameters:
-
startInclusive(byte) — the (inclusive) initial value -
endExclusive(byte) — the exclusive upper bound -
by(byte) — the incremental step
-
- Returns: a new ByteStream consisting of values from startInclusive (inclusive) to endExclusive (exclusive) by the specified step
rangeClosed(...) -> ByteStream
-
Signature:
public static ByteStream rangeClosed(final byte startInclusive, final byte endInclusive) - Summary: Returns a ByteStream whose elements are the values from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step of 1.
-
Contract:
- <p> An empty stream is returned if startInclusive is greater than endInclusive.
-
Parameters:
-
startInclusive(byte) — the (inclusive) initial value -
endInclusive(byte) — the inclusive upper bound
-
- Returns: a new ByteStream consisting of values from startInclusive (inclusive) to endInclusive (inclusive)
-
Signature:
public static ByteStream rangeClosed(final byte startInclusive, final byte endInclusive, final byte by) - Summary: Returns a ByteStream whose elements are the values from startInclusive (inclusive) to endInclusive (inclusive) by the specified incremental step.
-
Contract:
- <p> An empty stream is returned if the range and step have opposing signs.
-
Parameters:
-
startInclusive(byte) — the (inclusive) initial value -
endInclusive(byte) — the inclusive upper bound -
by(byte) — the incremental step
-
- Returns: a new ByteStream consisting of values from startInclusive (inclusive) to endInclusive (inclusive) by the specified step
repeat(...) -> ByteStream
-
Signature:
public static ByteStream repeat(final byte element, final long n) throws IllegalArgumentException - Summary: Returns a sequential ByteStream where each element is equal to the supplied value, repeated n times.
-
Parameters:
-
element(byte) — the element to repeat -
n(long) — the number of times to repeat the element
-
- Returns: a new ByteStream consisting of the element repeated n times
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> ByteStream
-
Signature:
public static ByteStream random() - Summary: Returns an infinite sequential unordered stream where each element is randomly generated.
-
Parameters:
- (none)
- Returns: the new infinite stream of random bytes
iterate(...) -> ByteStream
-
Signature:
public static ByteStream iterate(final BooleanSupplier hasNext, final ByteSupplier next) throws IllegalArgumentException - Summary: Creates a stream that iterates using the given <i> hasNext </i> and <i> next </i> suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(ByteSupplier) — a ByteSupplier that provides the next byte in the iteration
-
- Returns: a ByteStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> next </i> is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static ByteStream iterate(final byte init, final BooleanSupplier hasNext, final ByteUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(byte) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(ByteUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a ByteStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, BooleanSupplier, UnaryOperator)
-
Signature:
public static ByteStream iterate(final byte init, final BytePredicate hasNext, final ByteUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(byte) — the initial value -
hasNext(BytePredicate) — determinate if the returned stream has next by hasNext.test(init) for the first time and hasNext.test(f.apply(previous)) for remaining. -
f(ByteUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a ByteStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, Predicate, UnaryOperator)
-
Signature:
public static ByteStream iterate(final byte init, final ByteUnaryOperator f) throws IllegalArgumentException - Summary: Creates an infinite stream that iterates from an initial value, applying a function to generate subsequent values.
-
Parameters:
-
init(byte) — the initial value -
f(ByteUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an infinite ByteStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> f </i> is null
-
- See also: Stream#iterate(Object, UnaryOperator)
generate(...) -> ByteStream
-
Signature:
public static ByteStream generate(final ByteSupplier s) throws IllegalArgumentException - Summary: Generates an infinite ByteStream using the provided ByteSupplier.
-
Parameters:
-
s(ByteSupplier) — the ByteSupplier that provides the elements of the stream
-
- Returns: an infinite ByteStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> ByteStream
-
Signature:
public static ByteStream concat(final byte[]... a) - Summary: Concatenates multiple arrays of bytes into a single ByteStream.
-
Parameters:
-
a(byte[][]) — the arrays of bytes to concatenate
-
- Returns: a ByteStream containing all the bytes from the input arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static ByteStream concat(final ByteIterator... a) - Summary: Concatenates multiple ByteIterators into a single ByteStream.
-
Parameters:
-
a(ByteIterator[]) — the arrays of ByteIterator to concatenate
-
- Returns: a ByteStream containing all the bytes from the input ByteIterators
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static ByteStream concat(final ByteStream... a) - Summary: Concatenates multiple ByteStreams into a single ByteStream.
-
Parameters:
-
a(ByteStream[]) — the arrays of ByteStream to concatenate
-
- Returns: a ByteStream containing all the bytes from the input ByteStreams
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static ByteStream concat(final List<byte[]> c) - Summary: Concatenates a list of byte array into a single ByteStream.
-
Parameters:
-
c(List<byte[]>) — the list of byte array to concatenate
-
- Returns: a ByteStream containing all the bytes from the input list of a byte array
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static ByteStream concat(final Collection<? extends ByteStream> streams) - Summary: Concatenates a collection of ByteStream into a single ByteStream.
-
Parameters:
-
streams(Collection<? extends ByteStream>) — the collection of ByteStream to concatenate
-
- Returns: a ByteStream containing all the bytes from the input collection of ByteStream
- See also: Stream#concat(Collection)
concatIterators(...) -> ByteStream
-
Signature:
@Beta public static ByteStream concatIterators(final Collection<? extends ByteIterator> byteIterators) - Summary: Concatenates a collection of ByteIterator into a single ByteStream.
-
Parameters:
-
byteIterators(Collection<? extends ByteIterator>) — the collection of ByteIterator to concatenate
-
- Returns: a ByteStream containing all the bytes from the input collection of ByteIterator
- See also: Stream#concatIterators(Collection)
zip(...) -> ByteStream
-
Signature:
public static ByteStream zip(final byte[] a, final byte[] b, final ByteBinaryOperator zipFunction) - Summary: Zips two byte arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when either array runs out of values, even if the other array has remaining elements.
-
Parameters:
-
a(byte[]) — the first byte array. Must be {@code non-null} . -
b(byte[]) — the second byte array. Must be {@code non-null} . -
zipFunction(ByteBinaryOperator) — the function to combine elements from both arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static ByteStream zip(final byte[] a, final byte[] b, final byte[] c, final ByteTernaryOperator zipFunction) - Summary: Zips three byte arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when any array runs out of values, even if the other arrays have remaining elements.
-
Parameters:
-
a(byte[]) — the first byte array. Must be {@code non-null} . -
b(byte[]) — the second byte array. Must be {@code non-null} . -
c(byte[]) — the third byte array. Must be {@code non-null} . -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static ByteStream zip(final ByteIterator a, final ByteIterator b, final ByteBinaryOperator zipFunction) - Summary: Zips two byte iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when either iterator runs out of values, even if the other iterator has remaining elements.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator. Must be {@code non-null} . -
b(ByteIterator) — the second ByteIterator. Must be {@code non-null} . -
zipFunction(ByteBinaryOperator) — the function to combine elements from both iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static ByteStream zip(final ByteIterator a, final ByteIterator b, final ByteIterator c, final ByteTernaryOperator zipFunction) - Summary: Zips three byte iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when any iterator runs out of values, even if the other iterators have remaining elements.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator. Must be {@code non-null} . -
b(ByteIterator) — the second ByteIterator. Must be {@code non-null} . -
c(ByteIterator) — the third ByteIterator. Must be {@code non-null} . -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static ByteStream zip(final ByteStream a, final ByteStream b, final ByteBinaryOperator zipFunction) - Summary: Zips two byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when either stream runs out of values, even if the other stream has remaining elements.
-
Parameters:
-
a(ByteStream) — the first ByteStream. Must be {@code non-null} . -
b(ByteStream) — the second ByteStream. Must be {@code non-null} . -
zipFunction(ByteBinaryOperator) — the function to combine elements from both streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, BiFunction)
-
Signature:
public static ByteStream zip(final ByteStream a, final ByteStream b, final ByteStream c, final ByteTernaryOperator zipFunction) - Summary: Zips three byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when any stream runs out of values, even if the other streams have remaining elements.
-
Parameters:
-
a(ByteStream) — the first ByteStream. Must be {@code non-null} . -
b(ByteStream) — the second ByteStream. Must be {@code non-null} . -
c(ByteStream) — the third ByteStream. Must be {@code non-null} . -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, TriFunction)
-
Signature:
public static ByteStream zip(final Collection<? extends ByteStream> streams, final ByteNFunction<Byte> zipFunction) - Summary: Zips multiple byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The resulting stream ends when any stream runs out of values, even if the other streams have remaining elements.
-
Parameters:
-
streams(Collection<? extends ByteStream>) — the collection of ByteStream instances to zip. Must be {@code non-null} . -
zipFunction(ByteNFunction<Byte>) — the function to combine elements from all streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, Function)
-
Signature:
public static ByteStream zip(final byte[] a, final byte[] b, final byte valueForNoneA, final byte valueForNoneB, final ByteBinaryOperator zipFunction) - Summary: Zips two byte arrays into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all arrays run out of values.
- If one array runs out before the others, the specified default value is used for the exhausted array.
-
Parameters:
-
a(byte[]) — the first byte array. Must be {@code non-null} . -
b(byte[]) — the second byte array. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first array is shorter -
valueForNoneB(byte) — the default value to use if the second array is shorter -
zipFunction(ByteBinaryOperator) — the function to combine elements from both arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static ByteStream zip(final byte[] a, final byte[] b, final byte[] c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTernaryOperator zipFunction) - Summary: Zips three byte arrays into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all arrays run out of values.
- If one array runs out before the others, the specified default value is used for the exhausted array.
-
Parameters:
-
a(byte[]) — the first byte array. Must be {@code non-null} . -
b(byte[]) — the second byte array. Must be {@code non-null} . -
c(byte[]) — the third byte array. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first array is shorter -
valueForNoneB(byte) — the default value to use if the second array is shorter -
valueForNoneC(byte) — the default value to use if the third array is shorter -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static ByteStream zip(final ByteIterator a, final ByteIterator b, final byte valueForNoneA, final byte valueForNoneB, final ByteBinaryOperator zipFunction) - Summary: Zips two byte iterators into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all iterators run out of values.
- If one iterator runs out before the others, the specified default value is used for the exhausted iterator.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator. Must be {@code non-null} . -
b(ByteIterator) — the second ByteIterator. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first iterator is shorter -
valueForNoneB(byte) — the default value to use if the second iterator is shorter -
zipFunction(ByteBinaryOperator) — the function to combine elements from both iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static ByteStream zip(final ByteIterator a, final ByteIterator b, final ByteIterator c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTernaryOperator zipFunction) - Summary: Zips three byte iterators into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all iterators run out of values.
- If one iterator runs out before the others, the specified default value is used for the exhausted iterator.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator. Must be {@code non-null} . -
b(ByteIterator) — the second ByteIterator. Must be {@code non-null} . -
c(ByteIterator) — the third ByteIterator. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first iterator is shorter -
valueForNoneB(byte) — the default value to use if the second iterator is shorter -
valueForNoneC(byte) — the default value to use if the third iterator is shorter -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, Object, Object, Object, TriFunction)
-
Signature:
public static ByteStream zip(final ByteStream a, final ByteStream b, final byte valueForNoneA, final byte valueForNoneB, final ByteBinaryOperator zipFunction) - Summary: Zips two byte streams into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all streams run out of values.
- If one stream runs out before the others, the specified default value is used for the exhausted stream.
-
Parameters:
-
a(ByteStream) — the first ByteStream. Must be {@code non-null} . -
b(ByteStream) — the second ByteStream. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first stream is shorter -
valueForNoneB(byte) — the default value to use if the second stream is shorter -
zipFunction(ByteBinaryOperator) — the function to combine elements from both streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static ByteStream zip(final ByteStream a, final ByteStream b, final ByteStream c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTernaryOperator zipFunction) - Summary: Zips three byte streams into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all streams run out of values.
- If one stream runs out before the others, the specified default value is used for the exhausted stream.
-
Parameters:
-
a(ByteStream) — the first ByteStream. Must be {@code non-null} . -
b(ByteStream) — the second ByteStream. Must be {@code non-null} . -
c(ByteStream) — the third ByteStream. Must be {@code non-null} . -
valueForNoneA(byte) — the default value to use if the first stream is shorter -
valueForNoneB(byte) — the default value to use if the second stream is shorter -
valueForNoneC(byte) — the default value to use if the third stream is shorter -
zipFunction(ByteTernaryOperator) — the function to combine elements from all three streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, Object, Object, Object, TriFunction)
-
Signature:
public static ByteStream zip(final Collection<? extends ByteStream> streams, final byte[] valuesForNone, final ByteNFunction<Byte> zipFunction) - Summary: Zips multiple byte streams into a single stream until all of them run out of values.
-
Contract:
- <p> The resulting stream ends when all streams run out of values.
- If one stream runs out before the others, the specified default value is used for the exhausted stream.
-
Parameters:
-
streams(Collection<? extends ByteStream>) — the collection of ByteStream instances to zip. Must be {@code non-null} . -
valuesForNone(byte[]) — the default values to use for exhausted streams. Must be {@code non-null} . -
zipFunction(ByteNFunction<Byte>) — the function to combine elements from all streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, List, Function)
merge(...) -> ByteStream
-
Signature:
public static ByteStream merge(final byte[] a, final byte[] b, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges two byte arrays into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the two input arrays
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static ByteStream merge(final byte[] a, final byte[] b, final byte[] c, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges three byte arrays into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
c(byte[]) — the third byte array -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the three input arrays
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static ByteStream merge(final ByteIterator a, final ByteIterator b, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges two ByteIterators into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator -
b(ByteIterator) — the second ByteIterator -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the two input iterators
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static ByteStream merge(final ByteIterator a, final ByteIterator b, final ByteIterator c, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges three ByteIterators into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(ByteIterator) — the first ByteIterator -
b(ByteIterator) — the second ByteIterator -
c(ByteIterator) — the third ByteIterator -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the three input iterators
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static ByteStream merge(final ByteStream a, final ByteStream b, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges two ByteStreams into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(ByteStream) — the first ByteStream -
b(ByteStream) — the second ByteStream -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the two input streams
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static ByteStream merge(final ByteStream a, final ByteStream b, final ByteStream c, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges three ByteStreams into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
a(ByteStream) — the first ByteStream -
b(ByteStream) — the second ByteStream -
c(ByteStream) — the third ByteStream -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the three input streams
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static ByteStream merge(final Collection<? extends ByteStream> streams, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of ByteStream into a single ByteStream based on the provided nextSelector function.
-
Parameters:
-
streams(Collection<? extends ByteStream>) — the collection of ByteStream instances to merge -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ByteStream containing the merged elements from the input ByteStreams
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract ByteStream filter(final BytePredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(BytePredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract ByteStream takeWhile(final BytePredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(BytePredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract ByteStream dropWhile(final BytePredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(BytePredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream map(ByteUnaryOperator mapper) - Summary: Returns a ByteStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteUnaryOperator) — a non-interfering, stateless function that transforms each element from byte to byte
-
- Returns: a new ByteStream consisting of the results of applying the mapper function to each element
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(ByteToIntFunction mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteToIntFunction) — a non-interfering, stateless function that transforms each element from byte to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element
- See also: #map(ByteUnaryOperator), #mapToObj(ByteFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(ByteFunction<? extends T> mapper) - Summary: Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<? extends T>) — a non-interfering, stateless function that transforms each element from byte to T
-
- Returns: a new Stream of objects resulting from applying the mapper function to each element
- See also: #map(ByteUnaryOperator), #mapToInt(ByteToIntFunction)
flatMap(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream flatMap(ByteFunction<? extends ByteStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<? extends ByteStream>) — a non-interfering, stateless function that transforms each element from byte to ByteStream
-
- Returns: the new stream
- See also: #flatmap(ByteFunction), #flatMapToInt(ByteFunction), #flatMapToObj(ByteFunction)
flatmap(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream flatmap(ByteFunction<byte[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<byte[]>) — a non-interfering, stateless function that transforms each element from byte to byte\[\]
-
- Returns: the new stream
- See also: #flatMap(ByteFunction), #flatMapToInt(ByteFunction), #flatMapToObj(ByteFunction)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(ByteFunction<? extends IntStream> mapper) - Summary: Returns an IntStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element from byte to IntStream
-
- Returns: the new stream
- See also: #flatMap(ByteFunction), #flatMapToObj(ByteFunction)
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(ByteFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element from byte to Stream < T >
-
- Returns: the new stream
- See also: #flatMap(ByteFunction), #flatMapToInt(ByteFunction)
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(ByteFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a collection produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element from byte to Collection < T >
-
- Returns: the new stream
- See also: #flatMapToObj(ByteFunction), #flattmapToObj(ByteFunction)
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(ByteFunction<T[]> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of an array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ByteFunction<T[]>) — a non-interfering, stateless function that transforms each element from byte to T\[\]
-
- Returns: the new stream
- See also: #flatMapToObj(ByteFunction), #flatmapToObj(ByteFunction)
mapPartial(...) -> ByteStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract ByteStream mapPartial(ByteFunction<OptionalByte> mapper) - Summary: Returns a stream consisting of the results of applying the given function to the elements of this stream, and only including non-empty results.
-
Parameters:
-
mapper(ByteFunction<OptionalByte>) — a non-interfering, stateless function that transforms each element from byte to OptionalByte
-
- Returns: a new ByteStream containing only values from non-empty OptionalByte results
- See also: #filter(BytePredicate), #map(ByteUnaryOperator)
rangeMap(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream rangeMap(final ByteBiPredicate sameRange, final ByteBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(ByteBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(ByteBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final ByteBiPredicate sameRange, final ByteBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(ByteBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(ByteBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<ByteList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<ByteList> collapse(final ByteBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(ByteBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream collapse(final ByteBiPredicate collapsible, final ByteBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(ByteBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(ByteBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream collapse(final ByteTriPredicate collapsible, final ByteBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements satisfy a three-element predicate.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements satisfy a three-element predicate.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 3, 6, 10, 15, 16\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[10, 10, 31\].
-
Parameters:
-
collapsible(ByteTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(ByteBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
scan(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream scan(final ByteBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(ByteBinaryOperator) — a {@code ByteBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ByteStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream scan(final byte init, final ByteBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(byte) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(ByteBinaryOperator) — a {@code ByteBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ByteStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream scan(final byte init, final boolean initIncluded, final ByteBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(byte) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(ByteBinaryOperator) — a {@code ByteBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ByteStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream prepend(final byte... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(byte[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream append(final byte... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(byte[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream appendIfEmpty(final byte... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
-
Parameters:
-
a(byte[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
toByteList(...) -> ByteList
-
Signature:
@SequentialOnly @TerminalOp public abstract ByteList toByteList() - Summary: Collects all elements of this stream into a ByteList.
-
Parameters:
- (none)
- Returns: a ByteList containing all elements of this stream
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.ByteFunction<? extends K, E> keyMapper, Throwables.ByteFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.ByteFunction<? extends V, E2>) — a function to produce values for the map
-
- Returns: a Map whose keys and values are the result of applying the provided mapping functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.ByteFunction<? extends K, E> keyMapper, Throwables.ByteFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.ByteFunction<? extends V, E2>) — a function to produce values for the map -
mapFactory(Supplier<? extends M>) — a function which returns a new, empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying the provided mapping functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.ByteFunction<? extends K, E> keyMapper, Throwables.ByteFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Contract:
- If the mapped keys contain duplicates, the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.ByteFunction<? extends V, E2>) — a function to produce values for the map -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a Map whose keys and values are the result of applying the provided mapping functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.ByteFunction<? extends K, E> keyMapper, Throwables.ByteFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Contract:
- If the mapped keys contain duplicates, the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.ByteFunction<? extends V, E2>) — a function to produce values for the map -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a function which returns a new, empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying the provided mapping functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.ByteFunction<? extends K, E> keyMapper, final Collector<? super Byte, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function, and returns the results in a Map where the keys are produced by the classification function and the mapped values are Lists containing the input elements which map to the associated key.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Byte, ?, D>) — a Collector implementing the downstream reduction
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classifier function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.ByteFunction<? extends K, E> keyMapper, final Collector<? super Byte, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function, and returns the results in a Map where the keys are produced by the classification function and the mapped values are Lists containing the input elements which map to the associated key.
-
Parameters:
-
keyMapper(Throwables.ByteFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Byte, ?, D>) — a Collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a function which, when called, produces a new empty Map of the desired type
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classifier function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> byte
-
Signature:
@ParallelSupported @TerminalOp public abstract byte reduce(byte identity, ByteBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(byte) — the initial value of the reduction operation -
accumulator(ByteBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalByte reduce(ByteBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
accumulator(ByteBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: an OptionalByte describing the result of the reduction. If the stream is empty, an empty {@code OptionalByte} is returned.
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjByteConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjByteConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjByteConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <br/> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjByteConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjByteConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(Throwables.ByteConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.ByteConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntByteConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, passing the element's index as well.
-
Parameters:
-
action(Throwables.IntByteConsumer<E>) — a non-interfering action to perform on the elements, where the first parameter is the index and the second is the element
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code false} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalByte
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalByte findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalByte} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalByte} containing the first element of the stream, or an empty {@code OptionalByte} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.BytePredicate), #findAny(Throwables.BytePredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalByte findFirst(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns an {@link OptionalByte} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
-
Contract:
- Returns an {@link OptionalByte} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalByte} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalByte
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalByte findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalByte} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalByte} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalByte} containing some element of the stream, or an empty {@code OptionalByte} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.BytePredicate), #findAny(Throwables.BytePredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalByte findAny(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns an {@link OptionalByte} describing some element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
-
Contract:
- Returns an {@link OptionalByte} describing some element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalByte} describing some element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalByte
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalByte findLast(final Throwables.BytePredicate<E> predicate) throws E - Summary: Returns an {@link OptionalByte} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
-
Contract:
- Returns an {@link OptionalByte} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists.
- <p> Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.BytePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalByte} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalByte} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalByte
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalByte min() - Summary: Returns an {@link OptionalByte} describing the minimum element of this stream, or an empty {@code OptionalByte} if this stream is empty.
-
Contract:
- Returns an {@link OptionalByte} describing the minimum element of this stream, or an empty {@code OptionalByte} if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalByte} containing the minimum element of this stream, or an empty {@code OptionalByte} if the stream is empty
max(...) -> OptionalByte
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalByte max() - Summary: Returns an {@link OptionalByte} describing the maximum element of this stream, or an empty {@code OptionalByte} if this stream is empty.
-
Contract:
- Returns an {@link OptionalByte} describing the maximum element of this stream, or an empty {@code OptionalByte} if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalByte} containing the maximum element of this stream, or an empty {@code OptionalByte} if the stream is empty
kthLargest(...) -> OptionalByte
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalByte kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty {@code OptionalByte} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element ByteStream.of((byte) 10, (byte) 30, (byte) 20, (byte) 50, (byte) 40).kthLargest(2); // Returns OptionalByte\[40\] // Find the largest element (same as max) ByteStream.of((byte) 5, (byte) 2, (byte) 8, (byte) 1).kthLargest(1); // Returns OptionalByte\[8\] // When k exceeds stream size ByteStream.of((byte) 1, (byte) 2, (byte) 3).kthLargest(5); // Returns OptionalByte.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an {@code OptionalByte} containing the k-th largest element, or an empty {@code OptionalByte} if the stream is empty or the count of elements is less than k
sum(...) -> int
-
Signature:
@SequentialOnly @TerminalOp public abstract int sum() - Summary: Returns the sum of all elements in this stream as an int.
-
Parameters:
- (none)
- Returns: the sum of elements in this stream as an int. Returns 0 if the stream is empty.
- See also: #average(), #reduce(byte, ByteBinaryOperator)
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> ByteSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract ByteSummaryStatistics summaryStatistics() - Summary: Returns statistics about the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code ByteSummaryStatistics} describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<ByteSummaryStatistics, Optional<Map<Percentage, Byte>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<ByteSummaryStatistics, Optional<Map<Percentage, Byte>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of ByteSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of ByteSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: a {@code Pair} containing a {@code ByteSummaryStatistics} describing various summary data and an {@code Optional<Map<Percentage, Byte>>} containing percentile values
mergeWith(...) -> ByteStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ByteStream mergeWith(final ByteStream b, final ByteBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream, selecting elements based on the provided selector function.
-
Parameters:
-
b(ByteStream) — the stream to merge with -
nextSelector(ByteBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: the merged stream
zipWith(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream zipWith(ByteStream b, ByteBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(ByteStream) — the ByteStream to be combined with the current ByteStream. Must be {@code non-null} . -
zipFunction(ByteBinaryOperator) — a ByteBinaryOperator that determines the combination of elements in the combined ByteStream. Must be {@code non-null} .
-
- Returns: a new ByteStream that is the result of combining the current ByteStream with the given ByteStream
- See also: #zipWith(ByteStream, byte, byte, ByteBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream zipWith(ByteStream b, ByteStream c, ByteTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(ByteStream) — the second ByteStream to be combined with the current ByteStream. Will be closed along with this ByteStream. -
c(ByteStream) — the third ByteStream to be combined with the current ByteStream. Will be closed along with this ByteStream. -
zipFunction(ByteTernaryOperator) — a ByteTernaryOperator that determines the combination of elements in the combined ByteStream. Must be {@code non-null} .
-
- Returns: a new ByteStream that is the result of combining the current ByteStream with the given ByteStreams
- See also: #zipWith(ByteStream, ByteStream, byte, byte, byte, ByteTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream zipWith(ByteStream b, byte valueForNoneA, byte valueForNoneB, ByteBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(ByteStream) — the ByteStream to be combined with the current ByteStream. Will be closed along with this ByteStream. -
valueForNoneA(byte) — the default value to use for the current ByteStream when it runs out of elements -
valueForNoneB(byte) — the default value to use for the given ByteStream when it runs out of elements -
zipFunction(ByteBinaryOperator) — a ByteBinaryOperator that determines the combination of elements in the combined ByteStream. Must be {@code non-null} .
-
- Returns: a new ByteStream that is the result of combining the current ByteStream with the given ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream zipWith(ByteStream b, ByteStream c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(ByteStream) — the second ByteStream to be combined with the current ByteStream. Will be closed along with this ByteStream. -
c(ByteStream) — the third ByteStream to be combined with the current ByteStream. Will be closed along with this ByteStream. -
valueForNoneA(byte) — the default value to use for the current ByteStream when it runs out of elements -
valueForNoneB(byte) — the default value to use for the second ByteStream when it runs out of elements -
valueForNoneC(byte) — the default value to use for the third ByteStream when it runs out of elements -
zipFunction(ByteTernaryOperator) — a ByteTernaryOperator that determines the combination of elements in the combined ByteStream. Must be {@code non-null} .
-
- Returns: a new ByteStream that is the result of combining the current ByteStream with the given ByteStreams
asIntStream(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream asIntStream() - Summary: Converts this ByteStream to an IntStream by widening each byte value to an int.
-
Parameters:
- (none)
- Returns: an IntStream consisting of the elements of this stream, converted to int
boxed(...) -> Stream<Byte>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Byte> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Byte.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Byte
Class ByteStreamEx (com.landawn.abacus.util.stream.ByteStream.ByteStreamEx)
Abstract base class for extended ByteStream implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class CharIteratorEx (com.landawn.abacus.util.stream.CharIteratorEx)
An extended iterator over primitive char values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> CharIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static CharIteratorEx empty() - Summary: Returns an empty CharIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty CharIteratorEx instance
of(...) -> CharIteratorEx
-
Signature:
public static CharIteratorEx of(final char... a) - Summary: Creates a CharIteratorEx from the given char array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(char[]) — the char array to iterate over (can be {@code null} or empty)
-
- Returns: a CharIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static CharIteratorEx of(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a CharIteratorEx from a portion of the given char array.
-
Parameters:
-
a(char[]) — the char array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a CharIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static CharIteratorEx of(final CharIterator iter) - Summary: Wraps a CharIterator as a CharIteratorEx.
-
Contract:
- If the iterator is already a CharIteratorEx, it is returned as-is.
-
Parameters:
-
iter(CharIterator) — the CharIterator to wrap (can be null)
-
- Returns: a CharIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> CharIteratorEx
-
Signature:
public static CharIteratorEx from(final Iterator<Character> iter) - Summary: Creates a CharIteratorEx from an Iterator of Character objects.
-
Parameters:
-
iter(Iterator<Character>) — the Iterator of Character objects (can be null)
-
- Returns: a CharIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class CharStream (com.landawn.abacus.util.stream.CharStream)
A specialized stream implementation for processing sequences of character values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> CharStream
-
Signature:
public static CharStream empty() - Summary: Returns an empty sequential {@code CharStream} with no elements.
-
Contract:
- <p> The empty stream is stateless and can be safely reused multiple times if needed, though it's generally recommended to create new empty streams as needed.
-
Parameters:
- (none)
- Returns: an empty sequential {@code CharStream}
- See also: #of(char...), #ofNullable(Character)
defer(...) -> CharStream
-
Signature:
public static CharStream defer(final Supplier<CharStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
-
Parameters:
-
supplier(Supplier<CharStream>) — the supplier that provides the CharStream
-
- Returns: a new CharStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
ofNullable(...) -> CharStream
-
Signature:
public static CharStream ofNullable(final Character e) - Summary: Returns a sequential {@code CharStream} containing a single element if the specified value is non-null, otherwise returns an empty stream.
-
Contract:
- Returns a sequential {@code CharStream} containing a single element if the specified value is non-null, otherwise returns an empty stream.
- It's particularly useful when working with nullable {@code Character} objects that need to be safely converted to a stream without explicit null checks.
- If the input is null, an empty stream is returned instead of throwing a {@code NullPointerException} .
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Handle potentially null Character Character ch = getOptionalCharacter(); // May return null CharStream.ofNullable(ch) .forEach(System.out::print); // Prints nothing if ch is null // Use in stream operations CharStream.ofNullable(nullableChar) .map(Character::toUpperCase) .findFirst() .ifPresent(System.out::println); // Chaining with other streams CharStream.concat( CharStream.of("hello"), CharStream.ofNullable(separatorChar), CharStream.of("world") ).forEach(System.out::print); // Conditional processing CharStream.ofNullable(optionalChar) .filter(c -> c >= 'a' && c <= 'z') .count(); // Returns 0 or 1 } </pre>
-
Parameters:
-
e(Character) — the {@code Character} element to include in the stream, may be null
-
- Returns: a {@code CharStream} containing the unboxed char value if the element is non-null, otherwise an empty {@code CharStream}
- See also: #empty(), #of(char...), java.util.Optional#ofNullable(Object)
of(...) -> CharStream
-
Signature:
public static CharStream of(final char... a) - Summary: Returns a sequential {@code CharStream} whose elements are the specified char values.
-
Contract:
- If the array is null or empty, an empty stream is returned.
-
Parameters:
-
a(char[]) — the char elements of the new stream (varargs or array)
-
- Returns: a new sequential {@code CharStream} containing the specified elements, or an empty stream if the array is null or empty
- See also: #of(char\[\], int, int), #of(CharSequence), #empty()
-
Signature:
public static CharStream of(final char[] a, final int fromIndex, final int toIndex) - Summary: Returns a sequential {@code CharStream} whose elements are the specified values from the given array between {@code fromIndex} (inclusive) and {@code toIndex} (exclusive).
-
Contract:
- <p> If the array is null or empty and the indices are both zero (empty range), an empty stream is returned.
-
Parameters:
-
a(char[]) — the array containing the elements -
fromIndex(int) — the starting index (inclusive), must be non-negative -
toIndex(int) — the ending index (exclusive), must be less than or equal to array length
-
- Returns: a CharStream containing the specified range of elements
- See also: #of(char...), #of(CharSequence, int, int)
-
Signature:
public static CharStream of(final CharSequence str) - Summary: Returns a sequential {@code CharStream} containing all characters from the specified {@code CharSequence} .
-
Contract:
- <p> If the {@code CharSequence} is null or empty, an empty stream is returned.
-
Parameters:
-
str(CharSequence) — the {@code CharSequence} containing the characters; may be null
-
- Returns: a new sequential {@code CharStream} containing all characters from the {@code CharSequence} , or an empty stream if the sequence is null or empty
- See also: #of(CharSequence, int, int), #of(char...), CharSequence, String
-
Signature:
public static CharStream of(final CharSequence str, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a sequential {@code CharStream} containing characters from a subsequence of the specified {@code CharSequence} between {@code fromIndex} (inclusive) and {@code toIndex} (exclusive).
-
Contract:
- <p> If the {@code CharSequence} is null or empty, an empty stream is returned.
-
Parameters:
-
str(CharSequence) — the {@code CharSequence} containing the characters; may be null -
fromIndex(int) — the starting index (inclusive), must be non-negative -
toIndex(int) — the ending index (exclusive), must be less than or equal to sequence length
-
- Returns: a new sequential {@code CharStream} containing the specified range of characters
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the {@code CharSequence} length, or {@code fromIndex} is greater than {@code toIndex}
-
- See also: #of(CharSequence), #of(char\[\], int, int), CharSequence#charAt(int)
-
Signature:
public static CharStream of(final Character[] a) - Summary: Returns a sequential {@code CharStream} containing the unboxed char values from an array of {@code Character} objects.
-
Contract:
- <p> <b> Important: </b> Null elements in the array will cause a {@code NullPointerException} when the stream operations attempt to unbox them.
-
Parameters:
-
a(Character[]) — the array of {@code Character} objects; may be null or empty
-
- Returns: a new sequential {@code CharStream} containing the unboxed char values, or an empty stream if the array is null or empty
- See also: #of(char...), #of(Character\[\], int, int), #of(Collection)
-
Signature:
public static CharStream of(final Character[] a, final int fromIndex, final int toIndex) - Summary: Returns a sequential {@code CharStream} containing the unboxed char values from a range of a {@code Character} array between {@code fromIndex} (inclusive) and {@code toIndex} (exclusive).
-
Contract:
- <p> <b> Important: </b> Null elements in the array will cause a {@code NullPointerException} when the stream operations attempt to unbox them.
-
Parameters:
-
a(Character[]) — the array of {@code Character} objects -
fromIndex(int) — the starting index (inclusive), must be non-negative -
toIndex(int) — the ending index (exclusive), must be less than or equal to array length
-
- Returns: a new sequential {@code CharStream} containing the unboxed char values from the specified range
- See also: #of(Character\[\]), #of(char\[\], int, int)
-
Signature:
public static CharStream of(final Collection<Character> c) - Summary: Returns a sequential {@code CharStream} containing the unboxed char values from a {@code Collection} of {@code Character} objects.
-
Contract:
- <p> <b> Important: </b> Null elements in the collection will cause a {@code NullPointerException} when the stream operations attempt to unbox them.
-
Parameters:
-
c(Collection<Character>) — the {@code Collection} of {@code Character} objects; may be null or empty
-
- Returns: a new sequential {@code CharStream} containing the unboxed char values, or an empty stream if the collection is null or empty
- See also: #of(Character\[\]), #of(char...), Stream#of(Collection)
-
Signature:
public static CharStream of(final CharIterator iterator) - Summary: Returns a sequential {@code CharStream} containing the elements provided by the specified {@code CharIterator} .
-
Contract:
- <p> If the iterator is null, an empty stream is returned.
- <p> <b> Note: </b> The iterator should not be used after being passed to this method, as the stream will consume it during processing.
-
Parameters:
-
iterator(CharIterator) — the {@code CharIterator} providing the elements; may be null
-
- Returns: a new sequential {@code CharStream} containing the elements from the iterator, or an empty stream if the iterator is null
- See also: CharIterator, #of(char...), #of(CharSequence)
-
Signature:
public static CharStream of(final CharBuffer buf) - Summary: Returns a sequential {@code CharStream} containing characters from the specified {@code CharBuffer} from its current position to its limit.
-
Contract:
- <p> If the buffer is null, an empty stream is returned.
- However, the buffer should not be modified concurrently during stream processing to ensure consistent behavior.
-
Parameters:
-
buf(CharBuffer) — the {@code CharBuffer} to read from; may be null
-
- Returns: a new sequential {@code CharStream} containing characters from the buffer's current position to its limit, or an empty stream if the buffer is null
- See also: CharBuffer, #of(char...), #of(CharSequence)
-
Signature:
public static CharStream of(final File file) - Summary: Returns a sequential {@code CharStream} containing characters read from the specified {@code File} .
-
Contract:
- The file is opened when the stream is created and should be properly closed after use, preferably using a try-with-resources statement.
- <p> The returned stream is automatically configured to close the underlying {@code FileReader} when the stream is closed, ensuring proper resource cleanup.
-
Parameters:
-
file(File) — the {@code File} to read from; must not be null
-
- Returns: a new sequential {@code CharStream} containing the characters from the file
- See also: #of(Reader), #of(Reader, boolean), java.io.FileReader
-
Signature:
public static CharStream of(final Reader reader) - Summary: Returns a sequential {@code CharStream} containing characters read from the specified {@code Reader} .
-
Contract:
- The reader will <b> NOT </b> be automatically closed when the stream is closed or consumed.
- <p> If you want the reader to be automatically closed when the stream is closed, use {@link #of(Reader, boolean)} with {@code true} as the second parameter.
- <p> If the reader is null, an empty stream is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Read from a reader that will be managed separately Reader reader = new StringReader("Hello World"); CharStream.of(reader) .filter(Character::isLetter) .forEach(System.out::print); // Output: HelloWorld reader.close(); // Caller must close the reader // Process characters from InputStreamReader Reader inputReader = new InputStreamReader(inputStream); CharStream.of(inputReader) .map(Character::toLowerCase) .toArray(); inputReader.close(); // Manual cleanup required // Read from BufferedReader BufferedReader bufferedReader = new BufferedReader(new FileReader("file.txt")); long charCount = CharStream.of(bufferedReader).count(); bufferedReader.close(); // Must close manually // Null reader produces empty stream CharStream.of((Reader) null) .findAny(); // Returns OptionalChar.empty() } </pre>
-
Parameters:
-
reader(Reader) — the {@code Reader} to read from; may be null
-
- Returns: a new sequential {@code CharStream} containing the characters from the reader, or an empty stream if the reader is null
- See also: #of(Reader, boolean), #of(File), java.io.Reader
-
Signature:
public static CharStream of(final Reader reader, final boolean closeReaderWhenStreamIsClosed) - Summary: Returns a sequential {@code CharStream} containing characters read from the specified {@code Reader} , with an option to automatically close the reader when the stream is closed.
-
Contract:
- Returns a sequential {@code CharStream} containing characters read from the specified {@code Reader} , with an option to automatically close the reader when the stream is closed.
- If {@code closeReaderWhenStreamIsClosed} is {@code true} , the reader will be automatically closed when the stream's {@link #close()} method is called or when a terminal operation completes.
- This is useful when you want the stream to manage the reader's lifecycle.
- <p> If {@code closeReaderWhenStreamIsClosed} is {@code false} , the reader will remain open after the stream is closed, and the caller is responsible for closing it.
- <p> If the reader is null, an empty stream is returned.
- <p> <b> Recommended: </b> When {@code closeReaderWhenStreamIsClosed} is {@code true} , use try-with-resources to ensure proper resource cleanup even if exceptions occur.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Automatic reader cleanup with try-with-resources try (CharStream chars = CharStream.of(new FileReader("data.txt"), true)) { chars.filter(Character::isDigit) .forEach(System.out::print); } // Reader is automatically closed // Manual reader management Reader reader = new StringReader("Hello"); CharStream chars = CharStream.of(reader, false); chars.forEach(System.out::print); chars.close(); // Stream closed, but reader remains open reader.close(); // Must close reader manually // Process multiple streams from the same reader BufferedReader bufferedReader = new BufferedReader(new FileReader("file.txt")); // First pass - don't close reader CharStream.of(bufferedReader, false) .filter(Character::isLetter) .count(); // Second pass - now close reader CharStream.of(bufferedReader, true) .filter(Character::isDigit) .count(); // Reader is closed after second stream completes // Read from InputStreamReader with automatic cleanup try (CharStream chars = CharStream.of( new InputStreamReader(new FileInputStream("input.txt")), true)) { char\[\] data = chars.limit(1000).toArray(); } // InputStreamReader is automatically closed // Null reader produces empty stream try (CharStream chars = CharStream.of(null, true)) { chars.findAny(); // Returns OptionalChar.empty() } } </pre>
-
Parameters:
-
reader(Reader) — the {@code Reader} to read from; may be null -
closeReaderWhenStreamIsClosed(boolean) — if {@code true} , the reader will be automatically closed when the stream is closed; if {@code false} , the caller must close the reader manually
-
- Returns: a new sequential {@code CharStream} containing the characters from the reader, or an empty stream if the reader is null
- See also: #of(Reader), #of(File), java.io.Reader
flatten(...) -> CharStream
-
Signature:
public static CharStream flatten(final char[][] a) - Summary: Returns a sequential {@code CharStream} containing all characters from a two-dimensional char array, flattened in row-major order (left to right, top to bottom).
-
Contract:
- <p> If the input array is null or empty, an empty stream is returned.
-
Parameters:
-
a(char[][]) — the two-dimensional char array to flatten; may be null or empty
-
- Returns: a sequential {@code CharStream} containing all characters from the array in row-major order, or an empty stream if the array is null or empty
- See also: #flatten(char\[\]\[\], boolean), #flatten(char\[\]\[\], char, boolean), #flatten(char\[\]\[\]\[\])
-
Signature:
public static CharStream flatten(final char[][] a, final boolean vertically) - Summary: Returns a sequential {@code CharStream} containing all characters from a two-dimensional char array, flattened either horizontally (row by row) or vertically (column by column).
-
Contract:
- <p> This factory method flattens a 2D char array into a single stream, with the order determined by the {@code vertically} parameter: <ul> <li> If {@code vertically} is {@code false} : elements are read row by row, left to right, top to bottom (row-major order) </li> <li> If {@code vertically} is {@code true} : elements are read column by column, top to bottom, left to right (column-major order) </li> </ul> <p> If the input array is null or empty, an empty stream is returned.
-
Parameters:
-
a(char[][]) — the two-dimensional char array to flatten; may be null or empty -
vertically(boolean) — if {@code true} , flatten column by column (column-major order); if {@code false} , flatten row by row (row-major order)
-
- Returns: a sequential {@code CharStream} containing all characters from the array in the specified order, or an empty stream if the array is null or empty
- See also: #flatten(char\[\]\[\]), #flatten(char\[\]\[\], char, boolean)
-
Signature:
public static CharStream flatten(final char[][] a, final char valueForAlignment, final boolean vertically) - Summary: Returns a sequential {@code CharStream} containing all characters from a two-dimensional char array, flattened either horizontally or vertically with alignment padding for jagged arrays.
-
Contract:
- The flattening order is determined by the {@code vertically} parameter: <ul> <li> If {@code vertically} is {@code false} : flatten row by row, padding short rows to match the longest row length </li> <li> If {@code vertically} is {@code true} : flatten column by column, padding short columns to match the longest column length </li> </ul> <p> The resulting stream will have {@code rows maxRowLength} elements (or {@code maxColumnLength columns} for vertical flattening), where missing positions are filled with {@code valueForAlignment} .
-
Parameters:
-
a(char[][]) — the two-dimensional char array to flatten; may be null or empty -
valueForAlignment(char) — the char value to use for padding when rows/columns have different lengths -
vertically(boolean) — if {@code true} , flatten column by column with vertical padding; if {@code false} , flatten row by row with horizontal padding
-
- Returns: a sequential {@code CharStream} containing all characters from the array with padding, or an empty stream if the array is null or empty
- See also: #flatten(char\[\]\[\]), #flatten(char\[\]\[\], boolean)
-
Signature:
public static CharStream flatten(final char[][][] a) - Summary: Returns a sequential {@code CharStream} containing all characters from a three-dimensional char array, flattened in natural order (depth-first, then row-major order).
-
Contract:
- <p> If the input array is null or empty, an empty stream is returned.
-
Parameters:
-
a(char[][][]) — the three-dimensional char array to flatten; may be null or empty
-
- Returns: a sequential {@code CharStream} containing all characters from the array in natural order, or an empty stream if the array is null or empty
- See also: #flatten(char\[\]\[\]), #flatten(char\[\]\[\], boolean)
range(...) -> CharStream
-
Signature:
public static CharStream range(final char startInclusive, final char endExclusive) - Summary: Returns a sequential ordered {@code CharStream} from {@code startInclusive} (inclusive) to {@code endExclusive} (exclusive) by an incremental step of {@code 1} .
-
Contract:
- If {@code startInclusive} is greater than or equal to {@code endExclusive} , an empty stream is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate lowercase letters a-z CharStream.range('a', 'z' + 1) .forEach(System.out::print); // Output: abcdefghijklmnopqrstuvwxyz // Generate first 5 digits CharStream.range('0', '5') .forEach(System.out::print); // Output: 01234 // Create character array range char\[\] chars = CharStream.range('A', 'F') .toArray(); // Returns \['A', 'B', 'C', 'D', 'E'\] // Count characters in range long count = CharStream.range('a', 'z' + 1) .count(); // Returns 26 // Empty stream when start >= end CharStream.range('z', 'a') .count(); // Returns 0 // Generate and transform String uppercase = CharStream.range('a', 'f') .map(Character::toUpperCase) .mapToObj(String::valueOf) .collect(Collectors.joining()); // Result: "ABCDE" // Use with ASCII values CharStream.range((char) 65, (char) 70) .forEach(System.out::print); // Output: ABCDE } </pre>
-
Parameters:
-
startInclusive(char) — the starting character (inclusive) -
endExclusive(char) — the ending character (exclusive)
-
- Returns: a sequential ordered {@code CharStream} from {@code startInclusive} to {@code endExclusive} , incrementing by 1, or an empty stream if {@code startInclusive >= endExclusive}
- See also: #range(char, char, int), #rangeClosed(char, char), IntStream#range(int, int)
-
Signature:
public static CharStream range(final char startInclusive, final char endExclusive, final int by) - Summary: Creates a CharStream of characters from startInclusive (inclusive) to endExclusive (exclusive) by the specified incremental step.
-
Parameters:
-
startInclusive(char) — the starting character (inclusive) -
endExclusive(char) — the ending character (exclusive) -
by(int) — the incremental step. Must not be zero.
-
- Returns: a CharStream of characters from startInclusive to endExclusive with the specified step
rangeClosed(...) -> CharStream
-
Signature:
public static CharStream rangeClosed(final char startInclusive, final char endInclusive) - Summary: Returns a sequential ordered {@code CharStream} from {@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by an incremental step of {@code 1} .
-
Contract:
- If {@code startInclusive} is greater than {@code endInclusive} , an empty stream is returned.
- If they are equal, a stream with a single element is returned.
- This method is similar to {@link #range(char, char)} but includes the end character, making it more intuitive for ranges where the endpoint should be included.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate lowercase letters a-z (inclusive) CharStream.rangeClosed('a', 'z') .forEach(System.out::print); // Output: abcdefghijklmnopqrstuvwxyz // Generate digits 0-9 (inclusive) CharStream.rangeClosed('0', '9') .forEach(System.out::print); // Output: 0123456789 // Create character array from A to E char\[\] chars = CharStream.rangeClosed('A', 'E') .toArray(); // Returns \['A', 'B', 'C', 'D', 'E'\] // Single character stream when start == end CharStream.rangeClosed('x', 'x') .count(); // Returns 1 // Empty stream when start > end CharStream.rangeClosed('z', 'a') .count(); // Returns 0 // Generate vowels String vowels = CharStream.rangeClosed('a', 'e') .filter(c -> "aeiou".indexOf(c) >= 0) .mapToObj(String::valueOf) .collect(Collectors.joining()); // Result: "ae" // Count letters in range long count = CharStream.rangeClosed('A', 'Z') .count(); // Returns 26 } </pre>
-
Parameters:
-
startInclusive(char) — the starting character (inclusive) -
endInclusive(char) — the ending character (inclusive)
-
- Returns: a sequential ordered {@code CharStream} from {@code startInclusive} to {@code endInclusive} , incrementing by 1, or an empty stream if {@code startInclusive > endInclusive}
- See also: #rangeClosed(char, char, int), #range(char, char), IntStream#rangeClosed(int, int)
-
Signature:
public static CharStream rangeClosed(final char startInclusive, final char endInclusive, final int by) - Summary: Returns a sequential ordered {@code CharStream} from {@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by the specified incremental step.
-
Contract:
- The last element will be the largest value that does not exceed {@code endInclusive} when incrementing (or the smallest value when decrementing with a negative step).
- <p> The {@code by} parameter can be positive (ascending) or negative (descending), but must not be zero.
- If the direction of {@code by} is inconsistent with the relationship between {@code startInclusive} and {@code endInclusive} , an empty stream is returned.
- CharStream.rangeClosed('a', 'j', 2) .forEach(System.out::print); // Output: acegi // Descending range with negative step CharStream.rangeClosed('z', 'u', -2) .forEach(System.out::print); // Output: zxv // Generate every third digit CharStream.rangeClosed('0', '9', 3) .toArray(); // Returns \['0', '3', '6', '9'\] // Single element when start == end CharStream.rangeClosed('x', 'x', 5) .count(); // Returns 1 // Empty stream with inconsistent direction CharStream.rangeClosed('a', 'z', -1) .count(); // Returns 0 (start < end but step is negative) // Reverse alphabet by 3s CharStream.rangeClosed('z', 'a', -3) .mapToObj(String::valueOf) .collect(Collectors.joining()); // Result: "zwt qnkhe\\u05d1" // Step larger than range CharStream.rangeClosed('a', 'c', 10) .toArray(); // Returns \['a'\] (only start is within range) } </pre>
-
Parameters:
-
startInclusive(char) — the starting character (inclusive) -
endInclusive(char) — the ending character (inclusive) -
by(int) — the incremental step; must not be zero; can be negative for descending sequences
-
- Returns: a sequential ordered {@code CharStream} from {@code startInclusive} to {@code endInclusive} with the specified step, or an empty stream if the direction is inconsistent
- See also: #rangeClosed(char, char), #range(char, char, int)
repeat(...) -> CharStream
-
Signature:
public static CharStream repeat(final char element, final long n) throws IllegalArgumentException - Summary: Creates a CharStream that repeats the specified element for the given number of times.
-
Parameters:
-
element(char) — the character to repeat -
n(long) — the number of times to repeat the element
-
- Returns: a CharStream containing n copies of the specified element
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> CharStream
-
Signature:
public static CharStream random() - Summary: Creates an infinite CharStream of random characters.
-
Parameters:
- (none)
- Returns: an infinite CharStream of random characters
-
Signature:
public static CharStream random(final char startInclusive, final char endExclusive) - Summary: Creates an infinite CharStream of random characters within the specified range.
-
Parameters:
-
startInclusive(char) — the lower bound (inclusive) of the random character range -
endExclusive(char) — the upper bound (exclusive) of the random character range
-
- Returns: an infinite CharStream of random characters within the specified range
-
Signature:
public static CharStream random(final char[] candidates) - Summary: Creates an infinite CharStream of random characters selected from the given candidates.
-
Parameters:
-
candidates(char[]) — the array of candidate characters to randomly select from
-
- Returns: an infinite CharStream of random characters from the candidates array
iterate(...) -> CharStream
-
Signature:
public static CharStream iterate(final BooleanSupplier hasNext, final CharSupplier next) throws IllegalArgumentException - Summary: Creates a CharStream that iterates using the given hasNext and next suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(CharSupplier) — a CharSupplier that provides the next char in the iteration
-
- Returns: a CharStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or next is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static CharStream iterate(final char init, final BooleanSupplier hasNext, final CharUnaryOperator f) throws IllegalArgumentException - Summary: Creates a CharStream that starts with an initial value and iterates by applying a function, continuing as long as the hasNext supplier returns {@code true} .
-
Parameters:
-
init(char) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(CharUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a CharStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, BooleanSupplier, UnaryOperator)
-
Signature:
public static CharStream iterate(final char init, final CharPredicate hasNext, final CharUnaryOperator f) throws IllegalArgumentException - Summary: Creates a CharStream that starts with an initial value and iterates by applying a function, continuing as long as the hasNext predicate returns {@code true} for the current value.
-
Parameters:
-
init(char) — the initial value -
hasNext(CharPredicate) — predicate to test if the iteration should continue. Tested with init for the first element, then with the result of applying f to the previous element for subsequent elements. -
f(CharUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a CharStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, Predicate, UnaryOperator)
-
Signature:
public static CharStream iterate(final char init, final CharUnaryOperator f) throws IllegalArgumentException - Summary: Creates an infinite CharStream that starts with an initial value and generates subsequent values by applying the given function to the previous value.
-
Parameters:
-
init(char) — the initial value -
f(CharUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an infinite CharStream of elements generated by iterative application of f
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
- See also: Stream#iterate(Object, UnaryOperator)
generate(...) -> CharStream
-
Signature:
public static CharStream generate(final CharSupplier s) throws IllegalArgumentException - Summary: Creates an infinite CharStream where each element is generated by the provided CharSupplier.
-
Parameters:
-
s(CharSupplier) — the CharSupplier that provides the elements of the stream
-
- Returns: an infinite CharStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> CharStream
-
Signature:
public static CharStream concat(final char[]... a) - Summary: Concatenates multiple char arrays into a single CharStream.
-
Parameters:
-
a(char[][]) — the arrays of chars to concatenate
-
- Returns: a CharStream containing all the chars from the input arrays in order
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static CharStream concat(final CharIterator... a) - Summary: Concatenates multiple CharIterators into a single CharStream.
-
Parameters:
-
a(CharIterator[]) — the CharIterators to concatenate
-
- Returns: a CharStream containing all the chars from the input iterators in order
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static CharStream concat(final CharStream... a) - Summary: Concatenates multiple CharStreams into a single CharStream.
-
Parameters:
-
a(CharStream[]) — the CharStreams to concatenate
-
- Returns: a CharStream containing all the chars from the input streams in order
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static CharStream concat(final List<char[]> c) - Summary: Concatenates a list of char arrays into a single CharStream.
-
Parameters:
-
c(List<char[]>) — the list of char arrays to concatenate
-
- Returns: a CharStream containing all the chars from the input arrays in order
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static CharStream concat(final Collection<? extends CharStream> streams) - Summary: Concatenates a collection of CharStreams into a single CharStream.
-
Parameters:
-
streams(Collection<? extends CharStream>) — the collection of CharStreams to concatenate
-
- Returns: a CharStream containing all the chars from the input streams in order
- See also: Stream#concat(Collection)
concatIterators(...) -> CharStream
-
Signature:
@Beta public static CharStream concatIterators(final Collection<? extends CharIterator> charIterators) - Summary: Concatenates a collection of CharIterators into a single CharStream.
-
Parameters:
-
charIterators(Collection<? extends CharIterator>) — the collection of CharIterators to concatenate
-
- Returns: a CharStream containing all the chars from the input iterators in order
- See also: Stream#concatIterators(Collection)
zip(...) -> CharStream
-
Signature:
public static CharStream zip(final char[] a, final char[] b, final CharBinaryOperator zipFunction) - Summary: Zips two char arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shorter array runs out of values.
-
Parameters:
-
a(char[]) — the first char array. Must be {@code non-null} . -
b(char[]) — the second char array. Must be {@code non-null} . -
zipFunction(CharBinaryOperator) — the function to combine elements from both arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static CharStream zip(final char[] a, final char[] b, final char[] c, final CharTernaryOperator zipFunction) - Summary: Zips three char arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shortest array runs out of values.
-
Parameters:
-
a(char[]) — the first char array. Must be {@code non-null} . -
b(char[]) — the second char array. Must be {@code non-null} . -
c(char[]) — the third char array. Must be {@code non-null} . -
zipFunction(CharTernaryOperator) — the function to combine elements from all three arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final CharIterator a, final CharIterator b, final CharBinaryOperator zipFunction) - Summary: Zips two char iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when either iterator runs out of values.
-
Parameters:
-
a(CharIterator) — the first char iterator. Must be {@code non-null} . -
b(CharIterator) — the second char iterator. Must be {@code non-null} . -
zipFunction(CharBinaryOperator) — the function to combine elements from both iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static CharStream zip(final CharIterator a, final CharIterator b, final CharIterator c, final CharTernaryOperator zipFunction) - Summary: Zips three char iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when any iterator runs out of values.
-
Parameters:
-
a(CharIterator) — the first char iterator. Must be {@code non-null} . -
b(CharIterator) — the second char iterator. Must be {@code non-null} . -
c(CharIterator) — the third char iterator. Must be {@code non-null} . -
zipFunction(CharTernaryOperator) — the function to combine elements from all three iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final CharStream a, final CharStream b, final CharBinaryOperator zipFunction) - Summary: Zips two char streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when either stream runs out of values.
-
Parameters:
-
a(CharStream) — the first char stream. Must be {@code non-null} . -
b(CharStream) — the second char stream. Must be {@code non-null} . -
zipFunction(CharBinaryOperator) — the function to combine elements from both streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, BiFunction)
-
Signature:
public static CharStream zip(final CharStream a, final CharStream b, final CharStream c, final CharTernaryOperator zipFunction) - Summary: Zips three char streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when any stream runs out of values.
-
Parameters:
-
a(CharStream) — the first char stream. Must be {@code non-null} . -
b(CharStream) — the second char stream. Must be {@code non-null} . -
c(CharStream) — the third char stream. Must be {@code non-null} . -
zipFunction(CharTernaryOperator) — the function to combine elements from all three streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final Collection<? extends CharStream> streams, final CharNFunction<Character> zipFunction) - Summary: Zips multiple char streams into a single stream until any of them runs out of values.
-
Contract:
- The stream ends when any stream runs out of values.
-
Parameters:
-
streams(Collection<? extends CharStream>) — the collection of char streams to zip. Must be {@code non-null} . -
zipFunction(CharNFunction<Character>) — the function to combine elements from all streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, Function)
-
Signature:
public static CharStream zip(final char[] a, final char[] b, final char valueForNoneA, final char valueForNoneB, final CharBinaryOperator zipFunction) - Summary: Zips two char arrays into a single stream until all of them run out of values, padding shorter arrays with default values.
-
Contract:
- The stream ends when the longer array runs out of values.
- When one array runs out of values, the provided default value is used for that array.
-
Parameters:
-
a(char[]) — the first char array. Must be {@code non-null} . -
b(char[]) — the second char array. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first array runs out of values -
valueForNoneB(char) — the default value to use when the second array runs out of values -
zipFunction(CharBinaryOperator) — the function to combine elements from both arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static CharStream zip(final char[] a, final char[] b, final char[] c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTernaryOperator zipFunction) - Summary: Zips three char arrays into a single stream until all of them run out of values, padding shorter arrays with default values.
-
Contract:
- The stream ends when the longest array runs out of values.
- When an array runs out of values, the provided default value is used for that array.
-
Parameters:
-
a(char[]) — the first char array. Must be {@code non-null} . -
b(char[]) — the second char array. Must be {@code non-null} . -
c(char[]) — the third char array. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first array runs out of values -
valueForNoneB(char) — the default value to use when the second array runs out of values -
valueForNoneC(char) — the default value to use when the third array runs out of values -
zipFunction(CharTernaryOperator) — the function to combine elements from all three arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final CharIterator a, final CharIterator b, final char valueForNoneA, final char valueForNoneB, final CharBinaryOperator zipFunction) - Summary: Zips two char iterators into a single stream until all of them run out of values, padding with default values.
-
Contract:
- The stream ends when both iterators run out of values.
- When an iterator runs out of values, the provided default value is used for that iterator.
-
Parameters:
-
a(CharIterator) — the first char iterator. Must be {@code non-null} . -
b(CharIterator) — the second char iterator. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first iterator runs out of values -
valueForNoneB(char) — the default value to use when the second iterator runs out of values -
zipFunction(CharBinaryOperator) — the function to combine elements from both iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static CharStream zip(final CharIterator a, final CharIterator b, final CharIterator c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTernaryOperator zipFunction) - Summary: Zips three char iterators into a single stream until all of them run out of values, padding with default values.
-
Contract:
- The stream ends when all iterators run out of values.
- When an iterator runs out of values, the provided default value is used for that iterator.
-
Parameters:
-
a(CharIterator) — the first char iterator. Must be {@code non-null} . -
b(CharIterator) — the second char iterator. Must be {@code non-null} . -
c(CharIterator) — the third char iterator. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first iterator runs out of values -
valueForNoneB(char) — the default value to use when the second iterator runs out of values -
valueForNoneC(char) — the default value to use when the third iterator runs out of values -
zipFunction(CharTernaryOperator) — the function to combine elements from all three iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final CharStream a, final CharStream b, final char valueForNoneA, final char valueForNoneB, final CharBinaryOperator zipFunction) - Summary: Zips two char streams into a single stream until all of them run out of values, padding with default values.
-
Contract:
- The stream ends when both streams run out of values.
- When a stream runs out of values, the provided default value is used for that stream.
-
Parameters:
-
a(CharStream) — the first char stream. Must be {@code non-null} . -
b(CharStream) — the second char stream. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first stream runs out of values -
valueForNoneB(char) — the default value to use when the second stream runs out of values -
zipFunction(CharBinaryOperator) — the function to combine elements from both streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static CharStream zip(final CharStream a, final CharStream b, final CharStream c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTernaryOperator zipFunction) - Summary: Zips three char streams into a single stream until all of them run out of values, padding with default values.
-
Contract:
- The stream ends when all streams run out of values.
- When a stream runs out of values, the provided default value is used for that stream.
-
Parameters:
-
a(CharStream) — the first char stream. Must be {@code non-null} . -
b(CharStream) — the second char stream. Must be {@code non-null} . -
c(CharStream) — the third char stream. Must be {@code non-null} . -
valueForNoneA(char) — the default value to use when the first stream runs out of values -
valueForNoneB(char) — the default value to use when the second stream runs out of values -
valueForNoneC(char) — the default value to use when the third stream runs out of values -
zipFunction(CharTernaryOperator) — the function to combine elements from all three streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static CharStream zip(final Collection<? extends CharStream> streams, final char[] valuesForNone, final CharNFunction<Character> zipFunction) - Summary: Zips multiple char streams into a single stream until all of them run out of values, padding with default values.
-
Contract:
- The stream ends when all streams run out of values.
- When a stream runs out of values, the corresponding default value is used for that stream.
-
Parameters:
-
streams(Collection<? extends CharStream>) — the collection of char streams to zip. Must be {@code non-null} . -
valuesForNone(char[]) — array of default values to use when the corresponding stream runs out of values -
zipFunction(CharNFunction<Character>) — the function to combine elements from all streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, List, Function)
merge(...) -> CharStream
-
Signature:
public static CharStream merge(final char[] a, final char[] b, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges two char arrays into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when both arrays have remaining elements.
-
Parameters:
-
a(char[]) — the first char array -
b(char[]) — the second char array -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next. Returns MergeResult.TAKE_FIRST to select from the first array, or MergeResult.TAKE_SECOND to select from the second array.
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static CharStream merge(final char[] a, final char[] b, final char[] c, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges three char arrays into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when multiple arrays have remaining elements.
-
Parameters:
-
a(char[]) — the first char array -
b(char[]) — the second char array -
c(char[]) — the third char array -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static CharStream merge(final CharIterator a, final CharIterator b, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges two CharIterators into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when both iterators have remaining elements.
-
Parameters:
-
a(CharIterator) — the first CharIterator -
b(CharIterator) — the second CharIterator -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next. Returns MergeResult.TAKE_FIRST to select from the first iterator, or MergeResult.TAKE_SECOND to select from the second iterator.
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static CharStream merge(final CharIterator a, final CharIterator b, final CharIterator c, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges three CharIterators into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when multiple iterators have remaining elements.
-
Parameters:
-
a(CharIterator) — the first CharIterator -
b(CharIterator) — the second CharIterator -
c(CharIterator) — the third CharIterator -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static CharStream merge(final CharStream a, final CharStream b, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges two CharStreams into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when both streams have remaining elements.
-
Parameters:
-
a(CharStream) — the first CharStream -
b(CharStream) — the second CharStream -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next. Returns MergeResult.TAKE_FIRST to select from the first stream, or MergeResult.TAKE_SECOND to select from the second stream.
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static CharStream merge(final CharStream a, final CharStream b, final CharStream c, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges three CharStreams into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when multiple streams have remaining elements.
-
Parameters:
-
a(CharStream) — the first CharStream -
b(CharStream) — the second CharStream -
c(CharStream) — the third CharStream -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static CharStream merge(final Collection<? extends CharStream> streams, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of CharStreams into a single CharStream based on a selector function.
-
Contract:
- The selector determines which element to choose when multiple streams have remaining elements.
-
Parameters:
-
streams(Collection<? extends CharStream>) — the collection of CharStreams to merge -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected next. Takes two elements from different streams and returns MergeResult.TAKE_FIRST to select the first element, or MergeResult.TAKE_SECOND to select the second.
-
- Returns: a CharStream containing the merged elements
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract CharStream filter(final CharPredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(CharPredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract CharStream takeWhile(final CharPredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(CharPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract CharStream dropWhile(final CharPredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(CharPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream map(CharUnaryOperator mapper) - Summary: Returns a CharStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(CharUnaryOperator) — a non-interfering, stateless function that transforms each element from char to char
-
- Returns: a new CharStream consisting of the results of applying the mapper function to the elements of this stream
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(CharToIntFunction mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(CharToIntFunction) — a non-interfering, stateless function that transforms each element from char to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element
- See also: #map(CharUnaryOperator), #mapToObj(CharFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(CharFunction<? extends T> mapper) - Summary: Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(CharFunction<? extends T>) — a non-interfering, stateless function that transforms each element from char to T
-
- Returns: a new Stream of objects resulting from applying the mapper function to each element
- See also: #map(CharUnaryOperator), #mapToInt(CharToIntFunction)
flatMap(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream flatMap(CharFunction<? extends CharStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(CharFunction<? extends CharStream>) — a non-interfering, stateless function that transforms each element to a CharStream
-
- Returns: the new stream
- See also: Stream#flatMap(Function)
flatmap(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream flatmap(CharFunction<char[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the char array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(CharFunction<char[]>) — a non-interfering, stateless function that transforms each element to a char array
-
- Returns: the new stream
- See also: #flatMap(CharFunction), #flatMapToInt(CharFunction), #flatMapToObj(CharFunction)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(CharFunction<? extends IntStream> mapper) - Summary: Returns an IntStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(CharFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element to an IntStream
-
- Returns: the new stream
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(CharFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(CharFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element to a Stream
-
- Returns: the new stream
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(CharFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a collection produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(CharFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element to a Collection
-
- Returns: the new stream
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(CharFunction<T[]> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of an array produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(CharFunction<T[]>) — a non-interfering, stateless function that transforms each element to an array
-
- Returns: the new stream
mapPartial(...) -> CharStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract CharStream mapPartial(CharFunction<OptionalChar> mapper) - Summary: Returns a stream consisting of the results of applying the given function to the elements of this stream, where the function returns an OptionalChar.
-
Parameters:
-
mapper(CharFunction<OptionalChar>) — a <a href="package-summary.html#NonInterference"> non-interfering </a> , <a href="package-summary.html#Statelessness"> stateless </a> function to apply to each element which returns an OptionalChar
-
- Returns: a new stream containing only the values from non-empty OptionalChar results
rangeMap(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream rangeMap(final CharBiPredicate sameRange, final CharBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(CharBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(CharBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final CharBiPredicate sameRange, final CharBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(CharBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(CharBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<CharList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<CharList> collapse(final CharBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(CharBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream collapse(final CharBiPredicate collapsible, final CharBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(CharBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(CharBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream collapse(final CharTriPredicate collapsible, final CharBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(CharTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(CharBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream scan(final CharBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(CharBinaryOperator) — a {@code CharBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code CharStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream scan(final char init, final CharBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(char) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(CharBinaryOperator) — a {@code CharBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code CharStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream scan(final char init, final boolean initIncluded, final CharBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(char) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(CharBinaryOperator) — a {@code CharBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code CharStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream prepend(final char... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(char[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream append(final char... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(char[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream appendIfEmpty(final char... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
-
Parameters:
-
a(char[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
toCharList(...) -> CharList
-
Signature:
@SequentialOnly @TerminalOp public abstract CharList toCharList() - Summary: Returns a CharList containing all elements of this stream.
-
Parameters:
- (none)
- Returns: a CharList containing all elements of this stream
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.CharFunction<? extends K, E> keyMapper, Throwables.CharFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a Map whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.CharFunction<? extends V, E2>) — a mapping function to produce values
-
- Returns: a Map whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.CharFunction<? extends K, E> keyMapper, Throwables.CharFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.CharFunction<? extends V, E2>) — a mapping function to produce values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.CharFunction<? extends K, E> keyMapper, Throwables.CharFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a Map whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.CharFunction<? extends V, E2>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a Map whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.CharFunction<? extends K, E> keyMapper, Throwables.CharFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.CharFunction<? extends V, E2>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.CharFunction<? extends K, E> keyMapper, final Collector<? super Character, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function and performs a reduction operation on the values associated with each key using the specified downstream Collector.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Character, ?, D>) — a Collector implementing the downstream reduction
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.CharFunction<? extends K, E> keyMapper, final Collector<? super Character, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function and performs a reduction operation on the values associated with each key using the specified downstream Collector.
-
Parameters:
-
keyMapper(Throwables.CharFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Character, ?, D>) — a Collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty Map into which the results will be inserted
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> char
-
Signature:
@ParallelSupported @TerminalOp public abstract char reduce(char identity, CharBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value.
-
Parameters:
-
identity(char) — the identity value for the accumulating function -
accumulator(CharBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalChar reduce(CharBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalChar describing the reduced value, if any.
-
Contract:
- Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalChar describing the reduced value, if any.
-
Parameters:
-
accumulator(CharBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: an OptionalChar describing the result of the reduction
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjCharConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector-like pattern with supplier, accumulator, and combiner functions.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjCharConsumer<? super R>) — an associative, non-interfering, stateless function that must fold an element into a result container -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function that accepts two result containers and merges their contents, which must be compatible with the accumulator function. The combiner function must fold the elements from the second result container into the first result container.
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjCharConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using only a supplier and an accumulator function.
-
Contract:
- This is a simplified collect operation for use when the result container type has a built-in combining operation.
- <p> Only call this method when the returned type {@code R} is one of these types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjCharConsumer<? super R>) — an associative, non-interfering, stateless function that must fold an element into a result container
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjCharConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.CharConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.CharConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntCharConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, passing the element's index (0-based position in the stream) as well as the element itself to the action.
-
Parameters:
-
action(Throwables.IntCharConsumer<E>) — a non-interfering action to perform on the elements, taking both index and element
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code false} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any character is uppercase boolean hasUpper = CharStream.of("Hello World") .anyMatch(Character::isUpperCase); // Returns true // Check if any character is a digit boolean hasDigit = CharStream.of("abc") .anyMatch(Character::isDigit); // Returns false // Empty stream returns false boolean result = CharStream.empty() .anyMatch(c -> c == 'a'); // Returns false } </pre>
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all characters are lowercase boolean allLower = CharStream.of("hello") .allMatch(Character::isLowerCase); // Returns true // Check if all characters are letters boolean allLetters = CharStream.of("Hello123") .allMatch(Character::isLetter); // Returns false // Empty stream returns true boolean result = CharStream.empty() .allMatch(c -> c == 'a'); // Returns true // Validate all characters are within a range boolean inRange = CharStream.of("abc") .allMatch(c -> c >= 'a' && c <= 'z'); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalChar
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalChar findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalChar} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing the first element of the stream, or an empty {@code OptionalChar} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.CharPredicate), #findAny(Throwables.CharPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalChar findFirst(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns an {@link OptionalChar} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
-
Contract:
- Returns an {@link OptionalChar} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
- <p> If the stream is empty or no element matches the predicate, then an empty {@code OptionalChar} is returned.
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalChar} describing the first element that matches the predicate, or an empty {@code OptionalChar} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalChar
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalChar findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalChar} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalChar} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing some element of the stream, or an empty {@code OptionalChar} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.CharPredicate), #findAny(Throwables.CharPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalChar findAny(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns an {@link OptionalChar} describing some element of the stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
-
Contract:
- Returns an {@link OptionalChar} describing some element of the stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalChar} describing some element that matches the predicate, or an empty {@code OptionalChar} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalChar
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalChar findLast(final Throwables.CharPredicate<E> predicate) throws E - Summary: Returns an {@link OptionalChar} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
-
Contract:
- Returns an {@link OptionalChar} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalChar} if no such element exists.
- <p> Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.CharPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalChar} describing the last element that matches the predicate, or an empty {@code OptionalChar} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalChar
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalChar min() - Summary: Returns an {@code OptionalChar} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalChar} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing the minimum element of this stream, or an empty {@code OptionalChar} if the stream is empty
max(...) -> OptionalChar
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalChar max() - Summary: Returns an {@code OptionalChar} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalChar} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalChar} containing the maximum element of this stream, or an empty {@code OptionalChar} if the stream is empty
kthLargest(...) -> OptionalChar
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalChar kthLargest(int k) - Summary: Returns the k-th largest element in the stream.
-
Contract:
- If the stream contains fewer than k elements, an empty {@code OptionalChar} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element CharStream.of('j', 'z', 'p', 'b', 'x').kthLargest(2); // Returns OptionalChar\['x'\] // Find the largest element (same as max) CharStream.of('e', 'b', 'h', 'a').kthLargest(1); // Returns OptionalChar\['h'\] // When k exceeds stream size CharStream.of('a', 'b', 'c').kthLargest(5); // Returns OptionalChar.empty() } </pre>
-
Parameters:
-
k(int) — the position of the element to find (1-based, so k=1 returns the largest element, k=2 returns the second-largest, etc.)
-
- Returns: an {@code OptionalChar} containing the k-th largest element, or an empty {@code OptionalChar} if the stream contains fewer than k elements
sum(...) -> int
-
Signature:
@SequentialOnly @TerminalOp public abstract int sum() - Summary: Returns the sum of elements in this stream.
-
Parameters:
- (none)
- Returns: the sum of elements in this stream
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> CharSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract CharSummaryStatistics summaryStatistics() - Summary: Returns statistics about the elements of this stream, including count, sum, min, max, and average.
-
Parameters:
- (none)
- Returns: a CharSummaryStatistics describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<CharSummaryStatistics, Optional<Map<Percentage, Character>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<CharSummaryStatistics, Optional<Map<Percentage, Character>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of CharSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of CharSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: a Pair containing CharSummaryStatistics and an Optional map of percentile values. The map's keys are Percentage values and the values are the corresponding percentile values. The Optional is empty if the stream is empty.
mergeWith(...) -> CharStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract CharStream mergeWith(final CharStream b, final CharBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream, selecting elements based on the provided selector function.
-
Contract:
- The selector function determines which stream's the next element to choose when both streams have elements available.
-
Parameters:
-
b(CharStream) — the other stream to merge with -
nextSelector(CharBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. Takes elements from both streams and returns {@code MergeResult.TAKE_FIRST} to select the element from this stream, or {@code MergeResult.TAKE_SECOND} to select from stream b
-
- Returns: a new stream containing elements merged from both streams
zipWith(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream zipWith(CharStream b, CharBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(CharStream) — the CharStream to be combined with the current CharStream. Must be {@code non-null} . -
zipFunction(CharBinaryOperator) — a CharBinaryOperator that determines the combination of elements in the combined CharStream. Must be {@code non-null} .
-
- Returns: a new CharStream that is the result of combining the current CharStream with the given CharStream
- See also: #zipWith(CharStream, char, char, CharBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream zipWith(CharStream b, CharStream c, CharTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(CharStream) — the second CharStream to be combined with the current CharStream. Will be closed along with this CharStream. -
c(CharStream) — the third CharStream to be combined with the current CharStream. Will be closed along with this CharStream. -
zipFunction(CharTernaryOperator) — a CharTernaryOperator that determines the combination of elements in the combined CharStream. Must be {@code non-null} .
-
- Returns: a new CharStream that is the result of combining the current CharStream with the given CharStreams
- See also: #zipWith(CharStream, CharStream, char, char, char, CharTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream zipWith(CharStream b, char valueForNoneA, char valueForNoneB, CharBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Zip with default values when streams have different lengths CharStream.of('a', 'b', 'c') .zipWith(CharStream.of('x'), '\\0', '\\0', (a, b) -> (char)(a + b)) .toCharList(); // Returns \[(char)('a'+'x'), (char)('b'+'\\0'), (char)('c'+'\\0')\] } </pre>
-
Parameters:
-
b(CharStream) — the CharStream to be combined with the current CharStream. Will be closed along with this CharStream. -
valueForNoneA(char) — the default value to use for the current CharStream when it runs out of elements -
valueForNoneB(char) — the default value to use for the given CharStream when it runs out of elements -
zipFunction(CharBinaryOperator) — a CharBinaryOperator that determines the combination of elements in the combined CharStream. Must be {@code non-null} .
-
- Returns: a new CharStream that is the result of combining the current CharStream with the given CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream zipWith(CharStream b, CharStream c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(CharStream) — the second CharStream to be combined with the current CharStream. Will be closed along with this CharStream. -
c(CharStream) — the third CharStream to be combined with the current CharStream. Will be closed along with this CharStream. -
valueForNoneA(char) — the default value to use for the current CharStream when it runs out of elements -
valueForNoneB(char) — the default value to use for the second CharStream when it runs out of elements -
valueForNoneC(char) — the default value to use for the third CharStream when it runs out of elements -
zipFunction(CharTernaryOperator) — a CharTernaryOperator that determines the combination of elements in the combined CharStream. Must be {@code non-null} .
-
- Returns: a new CharStream that is the result of combining the current CharStream with the given CharStreams
asIntStream(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream asIntStream() - Summary: Converts this CharStream to an IntStream.
-
Parameters:
- (none)
- Returns: an IntStream consisting of the elements of this stream converted to int
boxed(...) -> Stream<Character>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Character> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Character.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Character
Class CharStreamEx (com.landawn.abacus.util.stream.CharStream.CharStreamEx)
An extension class for CharStream to provide additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Collectors (com.landawn.abacus.util.stream.Collectors)
A comprehensive factory utility class providing static methods for creating {@link Collector} instances for use with Java Streams.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
create(...) -> Collector<T, R, R>
-
Signature:
public static <T, R> Collector<T, R, R> create(final Supplier<? extends R> supplier, final BiConsumer<? super R, ? super T> accumulator, final BinaryOperator<R> combiner, final Characteristics... characteristics) - Summary: Creates a new {@code Collector} with the specified supplier, accumulator, and combiner.
-
Parameters:
-
supplier(Supplier<? extends R>) — the supplier function that provides a new mutable result container -
accumulator(BiConsumer<? super R, ? super T>) — the accumulator function that folds a value into a mutable result container -
combiner(BinaryOperator<R>) — the combiner function that merges two result containers -
characteristics(Characteristics[]) — optional characteristics of the collector
-
- Returns: a new {@code Collector} with the specified supplier, accumulator, and combiner
- See also: Collector#of(Supplier, BiConsumer, BinaryOperator, Characteristics...)
-
Signature:
public static <T, R> Collector<T, R, R> create(final Supplier<? extends R> supplier, final BiConsumer<? super R, ? super T> accumulator, final BinaryOperator<R> combiner, final Collection<Characteristics> characteristics) - Summary: Creates a new {@code Collector} with the specified supplier, accumulator, and combiner.
-
Parameters:
-
supplier(Supplier<? extends R>) — the supplier function that provides a new mutable result container -
accumulator(BiConsumer<? super R, ? super T>) — the accumulator function that folds a value into a mutable result container -
combiner(BinaryOperator<R>) — the combiner function that merges two result containers -
characteristics(Collection<Characteristics>) — optional characteristics of the collector
-
- Returns: a new {@code Collector} with the specified supplier, accumulator, and combiner
- See also: Collector#of(Supplier, BiConsumer, BinaryOperator, Characteristics...)
-
Signature:
public static <T, A, R> Collector<T, A, R> create(final Supplier<? extends A> supplier, final BiConsumer<? super A, ? super T> accumulator, final BinaryOperator<A> combiner, final Function<? super A, ? extends R> finisher, final Characteristics... characteristics) - Summary: Creates a new {@code Collector} with the specified supplier, accumulator, combiner, and finisher.
-
Parameters:
-
supplier(Supplier<? extends A>) — the supplier function that provides a new mutable result container -
accumulator(BiConsumer<? super A, ? super T>) — the accumulator function that folds a value into a mutable result container -
combiner(BinaryOperator<A>) — the combiner function that merges two result containers -
finisher(Function<? super A, ? extends R>) — the function that transforms the intermediate result to the final result -
characteristics(Characteristics[]) — optional characteristics of the collector
-
- Returns: a new {@code Collector} with the specified components
- See also: Collector#of(Supplier, BiConsumer, BinaryOperator, Function, Characteristics...)
-
Signature:
public static <T, A, R> Collector<T, A, R> create(final Supplier<? extends A> supplier, final BiConsumer<? super A, ? super T> accumulator, final BinaryOperator<A> combiner, final Function<? super A, ? extends R> finisher, final Collection<Characteristics> characteristics) - Summary: Creates a new {@code Collector} with the specified supplier, accumulator, combiner, and finisher.
-
Parameters:
-
supplier(Supplier<? extends A>) — the supplier function that provides a new mutable result container -
accumulator(BiConsumer<? super A, ? super T>) — the accumulator function that folds a value into a mutable result container -
combiner(BinaryOperator<A>) — the combiner function that merges two result containers -
finisher(Function<? super A, ? extends R>) — the function that transforms the intermediate result to the final result -
characteristics(Collection<Characteristics>) — optional characteristics of the collector
-
- Returns: a new {@code Collector} with the specified components
- See also: Collector#of(Supplier, BiConsumer, BinaryOperator, Function, Characteristics...)
toCollection(...) -> Collector<T, ?, C>
-
Signature:
public static <T, C extends Collection<T>> Collector<T, ?, C> toCollection(final Supplier<? extends C> collectionFactory) - Summary: Returns a {@code Collector} that accumulates the input elements into a new collection, created by the provided factory function.
-
Contract:
- <p> This collector is useful when you need to collect elements into a specific type of collection that is not covered by the standard collectors (like {@code toList()} , {@code toSet()} , etc.).
- The collection factory should return a new, empty collection instance each time it's called.
- </p> <p> <b> Null Handling: </b> The collector allows null elements if the underlying collection supports null values.
- When used with parallel streams, partial results are combined using the larger collection as the target for better performance.
-
Parameters:
-
collectionFactory(Supplier<? extends C>) — a supplier providing a new empty collection into which the results will be inserted
-
- Returns: a {@code Collector} which collects all input elements into a collection, in encounter order
- See also: #toCollection(int, Supplier), #toCollection(Supplier, BiConsumer), #toList(), #toSet()
-
Signature:
public static <T, C extends Collection<T>> Collector<T, ?, C> toCollection(final int atMostSize, final Supplier<? extends C> collectionFactory) - Summary: Returns a {@code Collector} that accumulates the input elements into a new collection, created by the provided factory function, limiting the collection to at most the specified number of elements.
-
Contract:
- <p> This collector is particularly useful when you want to collect only a limited number of elements from a potentially large stream.
- </p> <p> When combining collections in parallel processing, if the target collection is a {@code List} , the combiner uses {@code subList} for efficiency.
- </p> <p> <b> Null Handling: </b> The collector allows null elements if the underlying collection supports null values.
-
Parameters:
-
atMostSize(int) — the maximum number of elements to collect -
collectionFactory(Supplier<? extends C>) — a supplier providing a new empty collection into which the results will be inserted
-
- Returns: a {@code Collector} which collects at most the specified number of input elements into a collection, in encounter order
- See also: #toCollection(Supplier), #first(int), #toList(int)
-
Signature:
public static <T, C extends Collection<T>> Collector<T, ?, C> toCollection(final Supplier<? extends C> supplier, final BiConsumer<C, T> accumulator) - Summary: Returns a {@code Collector} that accumulates the input elements into a new collection, created by the provided factory function, using a custom accumulator.
-
Contract:
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Collect only even numbers List<Integer> evens = Stream.of(1, 2, 3, 4, 5, 6) .collect(Collectors.toCollection(ArrayList::new, (list, n) -> { if (n % 2 == 0) list.add(n); })); // Result: \[2, 4, 6\] } </pre>
-
Parameters:
-
supplier(Supplier<? extends C>) — a supplier providing a new empty collection into which the results will be inserted -
accumulator(BiConsumer<C, T>) — a function for incorporating a new element into a collection
-
- Returns: a {@code Collector} which collects input elements into a collection using the specified accumulator
- See also: #toCollection(Supplier, BiConsumer, BinaryOperator), #toCollection(Supplier)
-
Signature:
public static <T, C extends Collection<T>> Collector<T, ?, C> toCollection(final Supplier<? extends C> supplier, final BiConsumer<C, T> accumulator, final BinaryOperator<C> combiner) - Summary: Returns a {@code Collector} that accumulates the input elements into a new collection, created by the provided factory function, using custom accumulator and combiner functions.
-
Parameters:
-
supplier(Supplier<? extends C>) — a supplier providing a new empty collection into which the results will be inserted -
accumulator(BiConsumer<C, T>) — a function for incorporating a new element into a collection -
combiner(BinaryOperator<C>) — a function for combining two collections into one
-
- Returns: a {@code Collector} which collects input elements into a collection using the specified accumulator and combiner
- See also: #toCollection(Supplier, BiConsumer), #toCollection(Supplier), #create(Supplier, BiConsumer, BinaryOperator, Characteristics...)
toList(...) -> Collector<T, ?, List<T>>
-
Signature:
public static <T> Collector<T, ?, List<T>> toList() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code List} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code List} , in encounter order
- See also: #toLinkedList(), #toImmutableList(), #toUnmodifiableList(), #toList(int)
-
Signature:
public static <T> Collector<T, ?, List<T>> toList(final int atMostSize) - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code List} , limiting the list to at most the specified number of elements.
-
Contract:
- <p> This collector is useful when you want to collect only a limited number of elements into a list.
-
Parameters:
-
atMostSize(int) — the maximum number of elements to collect
-
- Returns: a {@code Collector} which collects at most the specified number of input elements into a {@code List} , in encounter order
toLinkedList(...) -> Collector<T, ?, LinkedList<T>>
-
Signature:
public static <T> Collector<T, ?, LinkedList<T>> toLinkedList() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code LinkedList} .
-
Contract:
- <p> This collector is useful when you specifically need a {@code LinkedList} implementation, for example when you need efficient insertion and removal at both ends of the list.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code LinkedList} , in encounter order
- See also: #toList(), #toDeque()
toImmutableList(...) -> Collector<T, ?, ImmutableList<T>>
-
Signature:
public static <T> Collector<T, ?, ImmutableList<T>> toImmutableList() - Summary: Returns a {@code Collector} that accumulates the input elements into an {@code ImmutableList} .
-
Contract:
- </p> <p> This is useful when you need to ensure that the collected data cannot be accidentally modified after collection.
- </p> <p> <b> Null Handling: </b> This collector accepts null elements if they are present in the stream.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into an {@code ImmutableList} , in encounter order
- See also: #toList(), #toUnmodifiableList(), #toImmutableSet()
toUnmodifiableList(...) -> Collector<T, ?, List<T>>
-
Signature:
public static <T> Collector<T, ?, List<T>> toUnmodifiableList() - Summary: Returns a {@code Collector} that accumulates the input elements into an unmodifiable {@code List} .
-
Contract:
- If the stream contains any null values, a {@code NullPointerException} will be thrown.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into an unmodifiable {@code List}
- See also: java.util.stream.Collectors#toUnmodifiableList
toSet(...) -> Collector<T, ?, Set<T>>
-
Signature:
public static <T> Collector<T, ?, Set<T>> toSet() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Set} .
-
Contract:
- </p> <p> <b> Null Handling: </b> This collector accepts null elements if the underlying set implementation supports null values.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code Set}
- See also: #toLinkedHashSet(), #toImmutableSet(), #toUnmodifiableSet(), #toSet(int)
-
Signature:
public static <T> Collector<T, ?, Set<T>> toSet(final int atMostSize) - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Set} , limiting the set to at most the specified number of elements.
-
Contract:
- <p> This collector is useful when you want to collect only a limited number of unique elements into a set.
- </p> <p> Note that due to the nature of sets removing duplicates, the final size may be less than {@code atMostSize} if the stream contains duplicate elements.
-
Parameters:
-
atMostSize(int) — the maximum number of elements to collect
-
- Returns: a {@code Collector} which collects at most the specified number of unique input elements into a {@code Set}
toLinkedHashSet(...) -> Collector<T, ?, Set<T>>
-
Signature:
public static <T> Collector<T, ?, Set<T>> toLinkedHashSet() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code LinkedHashSet} .
-
Contract:
- This is useful when you need both the uniqueness guarantee of a set and predictable iteration order.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code LinkedHashSet}
toImmutableSet(...) -> Collector<T, ?, ImmutableSet<T>>
-
Signature:
public static <T> Collector<T, ?, ImmutableSet<T>> toImmutableSet() - Summary: Returns a {@code Collector} that accumulates the input elements into an {@code ImmutableSet} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into an {@code ImmutableSet}
toUnmodifiableSet(...) -> Collector<T, ?, Set<T>>
-
Signature:
public static <T> Collector<T, ?, Set<T>> toUnmodifiableSet() - Summary: Returns a {@code Collector} that accumulates the input elements into an unmodifiable {@code Set} .
-
Contract:
- If the stream contains any null values, a {@code NullPointerException} will be thrown.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into an unmodifiable {@code Set}
- See also: java.util.stream.Collectors#toUnmodifiableSet
toQueue(...) -> Collector<T, ?, Queue<T>>
-
Signature:
public static <T> Collector<T, ?, Queue<T>> toQueue() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Queue} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code Queue}
toDeque(...) -> Collector<T, ?, Deque<T>>
-
Signature:
public static <T> Collector<T, ?, Deque<T>> toDeque() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Deque} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code Deque}
toMultiset(...) -> Collector<T, ?, Multiset<T>>
-
Signature:
public static <T> Collector<T, ?, Multiset<T>> toMultiset() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Multiset} .
-
Contract:
- </p> <p> This collector is useful for frequency counting and when you need to know not just which elements are present, but how many times each appears.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code Multiset} , maintaining counts of duplicate elements
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Multiset<T>> toMultiset(final Supplier<Multiset<T>> supplier) - Summary: Returns a {@code Collector} that accumulates the input elements into a {@code Multiset} created by the provided factory function.
-
Parameters:
-
supplier(Supplier<Multiset<T>>) — a supplier providing a new empty {@code Multiset} into which the results will be inserted
-
- Returns: a {@code Collector} which collects all input elements into a {@code Multiset}
toArray(...) -> Collector<T, ?, Object\[\]>
-
Signature:
public static <T> Collector<T, ?, Object[]> toArray() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Object} array.
-
Contract:
- This is useful when you need the result as an array rather than a collection.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into an {@code Object\[\]} , in encounter order
-
Signature:
public static <T, A> Collector<T, ?, A[]> toArray(final Supplier<A[]> arraySupplier) - Summary: Returns a {@code Collector} that accumulates the input elements into an array created by the provided array supplier.
-
Contract:
- The array supplier should provide an array of the desired type and size.
- If the supplied array is large enough to hold all elements, it will be used; otherwise, a new array of the same type will be created.
- This method uses reflection to create arrays of the appropriate type when necessary.
-
Parameters:
-
arraySupplier(Supplier<A[]>) — a supplier providing an array of the desired type
-
- Returns: a {@code Collector} which collects all input elements into an array
-
Signature:
public static <T, A> Collector<T, ?, A[]> toArray(final IntFunction<A[]> arraySupplier) - Summary: Returns a {@code Collector} that accumulates the input elements into an array created by the provided array factory function.
-
Contract:
- The {@code IntFunction} receives the size of the collection and should return an array of that size.
- This is the preferred method when you know the component type of the array at compile time.
-
Parameters:
-
arraySupplier(IntFunction<A[]>) — a function which produces a new array of the desired type and the provided length
-
- Returns: a {@code Collector} which collects all input elements into an array
toBooleanList(...) -> Collector<Boolean, ?, BooleanList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Boolean, ?, BooleanList> toBooleanList() - Summary: Returns a {@code Collector} that accumulates {@code Boolean} elements into a {@code BooleanList} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Boolean} elements into a {@code BooleanList}
toBooleanArray(...) -> Collector<Boolean, ?, boolean\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Boolean, ?, boolean[]> toBooleanArray() - Summary: Returns a {@code Collector} that accumulates {@code Boolean} elements into a primitive {@code boolean} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Boolean} elements into a {@code boolean\[\]}
toCharList(...) -> Collector<Character, ?, CharList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Character, ?, CharList> toCharList() - Summary: Returns a {@code Collector} that accumulates {@code Character} elements into a {@code CharList} .
-
Contract:
- This is particularly useful when working with character data that needs to be processed as a list.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Character} elements into a {@code CharList}
toCharArray(...) -> Collector<Character, ?, char\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Character, ?, char[]> toCharArray() - Summary: Returns a {@code Collector} that accumulates {@code Character} elements into a primitive {@code char} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Character} elements into a {@code char\[\]}
toByteList(...) -> Collector<Byte, ?, ByteList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Byte, ?, ByteList> toByteList() - Summary: Returns a {@code Collector} that accumulates {@code Byte} elements into a {@code ByteList} .
-
Contract:
- This is particularly useful when working with binary data or byte-oriented operations.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Byte} elements into a {@code ByteList}
toByteArray(...) -> Collector<Byte, ?, byte\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Byte, ?, byte[]> toByteArray() - Summary: Returns a {@code Collector} that accumulates {@code Byte} elements into a primitive {@code byte} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Byte} elements into a {@code byte\[\]}
toShortList(...) -> Collector<Short, ?, ShortList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Short, ?, ShortList> toShortList() - Summary: Returns a {@code Collector} that accumulates {@code Short} elements into a {@code ShortList} .
-
Contract:
- This is useful when working with numeric data that fits within the short range (-32,768 to 32,767).
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Short} elements into a {@code ShortList}
toShortArray(...) -> Collector<Short, ?, short\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Short, ?, short[]> toShortArray() - Summary: Returns a {@code Collector} that accumulates {@code Short} elements into a primitive {@code short} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Short} elements into a {@code short\[\]}
toIntList(...) -> Collector<Integer, ?, IntList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Integer, ?, IntList> toIntList() - Summary: Returns a {@code Collector} that accumulates {@code Integer} elements into an {@code IntList} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Integer} elements into an {@code IntList}
toIntArray(...) -> Collector<Integer, ?, int\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Integer, ?, int[]> toIntArray() - Summary: Returns a {@code Collector} that accumulates {@code Integer} elements into a primitive {@code int} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Integer} elements into an {@code int\[\]}
toLongList(...) -> Collector<Long, ?, LongList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Long, ?, LongList> toLongList() - Summary: Returns a {@code Collector} that accumulates {@code Long} elements into a {@code LongList} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Long} elements into a {@code LongList}
toLongArray(...) -> Collector<Long, ?, long\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Long, ?, long[]> toLongArray() - Summary: Returns a {@code Collector} that accumulates {@code Long} elements into a primitive {@code long} array.
-
Contract:
- This is important for memory efficiency when working with large datasets.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Long} elements into a {@code long\[\]}
toFloatList(...) -> Collector<Float, ?, FloatList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Float, ?, FloatList> toFloatList() - Summary: Returns a {@code Collector} that accumulates {@code Float} elements into a {@code FloatList} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Float} elements into a {@code FloatList}
toFloatArray(...) -> Collector<Float, ?, float\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Float, ?, float[]> toFloatArray() - Summary: Returns a {@code Collector} that accumulates {@code Float} elements into a primitive {@code float} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Float} elements into a {@code float\[\]}
toDoubleList(...) -> Collector<Double, ?, DoubleList>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Double, ?, DoubleList> toDoubleList() - Summary: Returns a {@code Collector} that accumulates {@code Double} elements into a {@code DoubleList} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Double} elements into a {@code DoubleList}
toDoubleArray(...) -> Collector<Double, ?, double\[\]>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Double, ?, double[]> toDoubleArray() - Summary: Returns a {@code Collector} that accumulates {@code Double} elements into a primitive {@code double} array.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Double} elements into a {@code double\[\]}
onlyOne(...) -> Collector<T, ?, Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> onlyOne() - Summary: Returns a {@code Collector} that expects exactly one element and returns it wrapped in an {@code Optional} .
-
Contract:
- <p> This collector throws a {@code TooManyElementsException} if more than one element is encountered in the stream.
- It returns an empty {@code Optional} if the stream is empty.
- </p> <p> This collector enforces uniqueness and is suitable for queries that should return a single result or no result at all.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the only element matching a condition Optional<String> result = list.stream() .filter(s -> s.startsWith("unique")) .collect(Collectors.onlyOne()); // Throws TooManyElementsException if multiple matches found } </pre>
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects the single element into an {@code Optional}
-
Signature:
public static <T> Collector<T, ?, Optional<T>> onlyOne(final Predicate<? super T> predicate) - Summary: Returns a {@code Collector} that expects exactly one element matching the given predicate and returns it wrapped in an {@code Optional} .
-
Contract:
- It throws a {@code TooManyElementsException} if more than one element matches the predicate.
- It returns an empty {@code Optional} if no elements match.
-
Parameters:
-
predicate(Predicate<? super T>) — a predicate to apply to elements
-
- Returns: a {@code Collector} which collects the single matching element into an {@code Optional}
first(...) -> Collector<T, ?, Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> first() - Summary: Returns a {@code Collector} that collects the first element of a sequential stream into an {@code Optional} .
-
Contract:
- If the stream is empty, it returns an empty {@code Optional} .
- This collector is designed for sequential streams only and will throw an {@code UnsupportedOperationException} if used with parallel streams.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects the first element into an {@code Optional}
-
Signature:
public static <T> Collector<T, ?, List<T>> first(final int n) throws IllegalArgumentException - Summary: Returns a {@code Collector} that collects the first n elements of a sequential stream into a {@code List} .
-
Contract:
- If the stream contains fewer than n elements, all elements are collected.
- This collector is designed for sequential streams only and will throw an {@code UnsupportedOperationException} if used with parallel streams.
- </p> <p> The collector stops accumulating once n elements have been collected, making it efficient for large streams when you only need the first few elements.
-
Parameters:
-
n(int) — the maximum number of elements to collect
-
- Returns: a {@code Collector} which collects the first n elements into a {@code List}
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
last(...) -> Collector<T, ?, Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> last() - Summary: Returns a {@code Collector} that collects the last element of a sequential stream into an {@code Optional} .
-
Contract:
- If the stream is empty, it returns an empty {@code Optional} .
- This collector is designed for sequential streams only and will throw an {@code UnsupportedOperationException} if used with parallel streams.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects the last element into an {@code Optional}
-
Signature:
public static <T> Collector<T, ?, List<T>> last(final int n) throws IllegalArgumentException - Summary: Returns a {@code Collector} that collects the last n elements of a sequential stream into a {@code List} .
-
Contract:
- </p> <p> This collector is designed for sequential streams only and will throw an {@code UnsupportedOperationException} if used with parallel streams.
-
Parameters:
-
n(int) — the maximum number of elements to collect
-
- Returns: a {@code Collector} which collects the last n elements into a {@code List}
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
joining(...) -> Collector<Object, ?, String>
-
Signature:
public static Collector<Object, ?, String> joining() - Summary: Returns a {@code Collector} that concatenates the input elements into a {@code String} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which concatenates CharSequence elements into a {@code String}
-
Signature:
public static Collector<Object, ?, String> joining(final CharSequence delimiter) - Summary: Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, into a {@code String} .
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each element
-
- Returns: a {@code Collector} which concatenates CharSequence elements, separated by the specified delimiter, into a {@code String}
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static Collector<Object, ?, String> joining(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix) - Summary: Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, with the specified prefix and suffix, into a {@code String} .
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each element -
prefix(CharSequence) — the sequence of characters to be used at the beginning -
suffix(CharSequence) — the sequence of characters to be used at the end
-
- Returns: a {@code Collector} which concatenates CharSequence elements, separated by the specified delimiter, into a {@code String} with the specified prefix and suffix
filtering(...) -> Collector<T, ?, R>
-
Signature:
public static <T, A, R> Collector<T, ?, R> filtering(final Predicate<? super T> predicate, final Collector<? super T, A, R> downstream) - Summary: Returns a {@code Collector} which passes only those elements to the specified downstream collector which match the given predicate.
-
Contract:
- </p> <p> If the downstream collector is short-circuiting, this method returns a short-circuiting collector as well.
-
Parameters:
-
predicate(Predicate<? super T>) — a filter function to be applied to the input elements -
downstream(Collector<? super T, A, R>) — a collector which will accept filtered values
-
- Returns: a collector which applies the predicate to the input elements and provides the elements for which predicate returned {@code true} to the downstream collector
- See also: MoreCollectors#combine(Collector, Collector, BiFunction)
filteringToList(...) -> Collector<T, ?, List<T>>
-
Signature:
@Beta public static <T> Collector<T, ?, List<T>> filteringToList(final Predicate<? super T> predicate) - Summary: Returns a {@code Collector} which filters input elements by the supplied predicate, collecting them to a {@code List} .
-
Parameters:
-
predicate(Predicate<? super T>) — a filter function to be applied to the input elements
-
- Returns: a collector which applies the predicate to the input elements and collects the elements for which predicate returned {@code true} to the {@code List}
- See also: #filtering(Predicate, Collector)
mapping(...) -> Collector<T, ?, R>
-
Signature:
public static <T, U, A, R> Collector<T, ?, R> mapping(final Function<? super T, ? extends U> mapper, final Collector<? super U, A, R> downstream) - Summary: Returns a {@code Collector} that applies a mapping function to each input element before accumulation by the downstream collector.
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — a function to be applied to the input elements -
downstream(Collector<? super U, A, R>) — a collector which will accept mapped values
-
- Returns: a collector which applies the mapping function to the input elements and provides the mapped results to the downstream collector
mappingToList(...) -> Collector<T, ?, List<U>>
-
Signature:
@Beta public static <T, U> Collector<T, ?, List<U>> mappingToList(final Function<? super T, ? extends U> mapper) - Summary: Returns a {@code Collector} that applies a mapping function to each input element and collects the results to a {@code List} .
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — a function to be applied to the input elements
-
- Returns: a collector which applies the mapping function to the input elements and collects the mapped results to a {@code List}
flatMapping(...) -> Collector<T, ?, R>
-
Signature:
public static <T, U, A, R> Collector<T, ?, R> flatMapping(final Function<? super T, ? extends Stream<? extends U>> mapper, final Collector<? super U, A, R> downstream) - Summary: Returns a {@code Collector} that applies a flat mapping function to each input element and accumulates the elements of the resulting streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Stream<? extends U>>) — a function to be applied to the input elements, which returns a stream of results -
downstream(Collector<? super U, A, R>) — a collector which will accept elements of the streams returned by mapper
-
- Returns: a collector which applies the flat mapping function to the input elements and provides the elements of the resulting streams to the downstream collector
flatMappingToList(...) -> Collector<T, ?, List<U>>
-
Signature:
@Beta public static <T, U> Collector<T, ?, List<U>> flatMappingToList(final Function<? super T, ? extends Stream<? extends U>> mapper) - Summary: Returns a {@code Collector} that applies a flat mapping function to each input element and collects all resulting elements to a {@code List} .
-
Parameters:
-
mapper(Function<? super T, ? extends Stream<? extends U>>) — a function to be applied to the input elements, which returns a stream of results
-
- Returns: a collector which applies the flat mapping function to the input elements and collects all resulting elements to a {@code List}
flatmapping(...) -> Collector<T, ?, R>
-
Signature:
public static <T, U, A, R> Collector<T, ?, R> flatmapping(final Function<? super T, ? extends Collection<? extends U>> mapper, // NOSONAR final Collector<? super U, A, R> downstream) - Summary: Returns a {@code Collector} that applies a flat mapping function returning collections to each input element and accumulates all elements from the resulting collections.
-
Contract:
- This can be more efficient when the mapper function already returns collections, avoiding the overhead of stream creation.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends U>>) — a function to be applied to the input elements, which returns a collection of results -
downstream(Collector<? super U, A, R>) — a collector which will accept elements of the collections returned by mapper
-
- Returns: a collector which applies the flat mapping function to the input elements and provides the elements of the resulting collections to the downstream collector
flatmappingToList(...) -> Collector<T, ?, List<U>>
-
Signature:
@Beta public static <T, U> Collector<T, ?, List<U>> flatmappingToList(final Function<? super T, ? extends Collection<? extends U>> mapper) - Summary: Returns a {@code Collector} that applies a flat mapping function returning collections and collects all resulting elements to a {@code List} .
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends U>>) — a function to be applied to the input elements, which returns a collection of results
-
- Returns: a collector which applies the flat mapping function to the input elements and collects all resulting elements to a {@code List}
collectingAndThen(...) -> Collector<T, A, RR>
-
Signature:
public static <T, A, R, RR> Collector<T, A, RR> collectingAndThen(final Collector<T, A, R> downstream, final Function<? super R, RR> finisher) throws IllegalArgumentException - Summary: Returns a {@code Collector} that performs an additional finishing transformation on the results of another collector.
-
Contract:
- </p> <p> The characteristics of the returned collector are derived from the downstream collector, with {@code IDENTITY_FINISH} removed if present.
-
Parameters:
-
downstream(Collector<T, A, R>) — a collector -
finisher(Function<? super R, RR>) — a function to be applied to the final result of the downstream collector
-
- Returns: a collector which performs the action of the downstream collector, followed by an additional finishing step
-
Throws:
-
java.lang.IllegalArgumentException— if downstream or finisher is null
-
collectingOrEmpty(...) -> Collector<T, A, Optional<R>>
-
Signature:
@Beta public static <T, A, R> Collector<T, A, Optional<R>> collectingOrEmpty(final Collector<T, A, R> collector) throws IllegalArgumentException - Summary: Returns a {@code Collector} that wraps the result in an {@code Optional} , returning an empty {@code Optional} if no elements were collected.
-
Contract:
- Returns a {@code Collector} that wraps the result in an {@code Optional} , returning an empty {@code Optional} if no elements were collected.
- <p> This collector tracks whether any elements were accumulated and returns an empty {@code Optional} if the stream was empty, or an {@code Optional} containing the collected result otherwise.
- This is useful when you want to distinguish between an empty collection result and no elements being processed.
-
Parameters:
-
collector(Collector<T, A, R>) — the downstream collector
-
- Returns: a collector which returns an {@code Optional} of the collected result, or empty if no elements were collected
-
Throws:
-
java.lang.IllegalArgumentException— if collector is null
-
collectingOrDefaultIfEmpty(...) -> Collector<T, A, R>
-
Signature:
@Beta public static <T, A, R> Collector<T, A, R> collectingOrDefaultIfEmpty(final Collector<T, A, R> collector, final R defaultForEmpty) - Summary: Returns a {@code Collector} that uses a default value when no elements are collected.
-
Contract:
- Returns a {@code Collector} that uses a default value when no elements are collected.
- If no elements were collected, it returns the specified default value instead of the collector's normal empty result.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Returns default list when stream is empty List<String> result = Stream.<String>empty() .collect(Collectors.collectingOrDefaultIfEmpty( Collectors.toList(), Arrays.asList("default"))); // Result: \["default"\] } </pre>
-
Parameters:
-
collector(Collector<T, A, R>) — the downstream collector -
defaultForEmpty(R) — the default value to return if no elements are collected
-
- Returns: a collector which returns the collected result, or the default value if no elements were collected
collectingOrElseGetIfEmpty(...) -> Collector<T, A, R>
-
Signature:
@Beta public static <T, A, R> Collector<T, A, R> collectingOrElseGetIfEmpty(final Collector<T, A, R> collector, final Supplier<? extends R> defaultForEmpty) throws IllegalArgumentException - Summary: Returns a {@code Collector} that uses a supplier to provide a default value when no elements are collected.
-
Contract:
- Returns a {@code Collector} that uses a supplier to provide a default value when no elements are collected.
- If no elements were collected, it calls the supplier to get a default value instead of the collector's normal empty result.
- The supplier is only called if needed, allowing for lazy evaluation of the default.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Compute default only if needed List<String> result = Stream.<String>empty() .collect(Collectors.collectingOrElseGetIfEmpty( Collectors.toList(), () -> loadDefaultsFromDatabase())); // loadDefaultsFromDatabase() is only called because stream was empty } </pre>
-
Parameters:
-
collector(Collector<T, A, R>) — the downstream collector -
defaultForEmpty(Supplier<? extends R>) — a supplier for the default value if no elements are collected
-
- Returns: a collector which returns the collected result, or the supplied default value if no elements were collected
-
Throws:
-
java.lang.IllegalArgumentException— if collector is null
-
collectingOrElseThrowIfEmpty(...) -> Collector<T, A, R>
-
Signature:
@Beta public static <T, A, R> Collector<T, A, R> collectingOrElseThrowIfEmpty(final Collector<T, A, R> collector) - Summary: Returns a {@code Collector} that throws {@code NoSuchElementException} when no elements are collected.
-
Contract:
- Returns a {@code Collector} that throws {@code NoSuchElementException} when no elements are collected.
- If no elements were collected, it throws a {@code NoSuchElementException} .
- This is useful when an empty result is an error condition.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Throws if no elements match List<String> result = Stream.of("a", "b", "c") .filter(s -> s.length() > 5) .collect(Collectors.collectingOrElseThrowIfEmpty(Collectors.toList())); // Throws NoSuchElementException } </pre>
-
Parameters:
-
collector(Collector<T, A, R>) — the downstream collector
-
- Returns: a collector which returns the collected result, or throws if no elements were collected
-
Signature:
@Beta public static <T, A, R> Collector<T, A, R> collectingOrElseThrowIfEmpty(final Collector<T, A, R> collector, final Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a {@code Collector} that throws a custom exception when no elements are collected.
-
Contract:
- Returns a {@code Collector} that throws a custom exception when no elements are collected.
- If no elements were collected, it throws the exception provided by the supplier.
- This allows for custom error handling when empty results are not acceptable.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Throws custom exception if no valid data found List<Data> result = dataStream .filter(Data::isValid) .collect(Collectors.collectingOrElseThrowIfEmpty( Collectors.toList(), () -> new DataNotFoundException("No valid data found"))); } </pre>
-
Parameters:
-
collector(Collector<T, A, R>) — the downstream collector -
exceptionSupplier(Supplier<? extends RuntimeException>) — supplier for the exception to throw if no elements are collected
-
- Returns: a collector which returns the collected result, or throws if no elements were collected
distinctByToList(...) -> Collector<T, ?, List<T>>
-
Signature:
public static <T> Collector<T, ?, List<T>> distinctByToList(final Function<? super T, ?> keyMapper) - Summary: Returns a {@code Collector} which collects distinct elements into a {@code List} based on a key extraction function.
-
Contract:
- Elements are considered distinct if their extracted keys are equal according to {@code Object.equals()} .
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Keep first person of each age List<Person> distinctByAge = people.stream() .collect(Collectors.distinctByToList(Person::getAge)); // If multiple people have the same age, only the first is kept } </pre>
-
Parameters:
-
keyMapper(Function<? super T, ?>) — a function which classifies input elements
-
- Returns: a collector which collects distinct elements to the {@code List}
distinctByToCollection(...) -> Collector<T, ?, C>
-
Signature:
public static <T, C extends Collection<T>> Collector<T, ?, C> distinctByToCollection(final Function<? super T, ?> keyMapper, final Supplier<? extends C> supplier) - Summary: Returns a {@code Collector} which collects distinct elements into a collection based on a key extraction function.
-
Parameters:
-
keyMapper(Function<? super T, ?>) — a function which classifies input elements -
supplier(Supplier<? extends C>) — a supplier providing a new empty collection into which the distinct elements will be inserted
-
- Returns: a collector which collects distinct elements to the specified collection type
distinctByToCounting(...) -> Collector<T, ?, Integer>
-
Signature:
public static <T> Collector<T, ?, Integer> distinctByToCounting(final Function<? super T, ?> keyMapper) - Summary: Returns a {@code Collector} which counts the number of distinct values produced by the mapper function.
-
Parameters:
-
keyMapper(Function<? super T, ?>) — a function which classifies input elements
-
- Returns: a collector which counts the number of distinct classes the mapper function returns for the stream elements
counting(...) -> Collector<T, ?, Long>
-
Signature:
public static <T> Collector<T, ?, Long> counting() - Summary: Returns a {@code Collector} that counts the number of input elements.
-
Parameters:
- (none)
- Returns: a {@code Collector} that counts the input elements
countingToInt(...) -> Collector<T, ?, Integer>
-
Signature:
public static <T> Collector<T, ?, Integer> countingToInt() - Summary: Returns a {@code Collector} that counts the number of input elements as an {@code Integer} .
-
Contract:
- This is useful when you know the count will fit in an integer range and want to avoid the overhead of {@code Long} .
-
Parameters:
- (none)
- Returns: a {@code Collector} that counts the input elements as an {@code Integer}
min(...) -> Collector<T, ?, Optional<T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, Optional<T>> min() - Summary: Returns a {@code Collector} that finds the minimum element according to the natural ordering.
-
Contract:
- The result is wrapped in an {@code Optional} which is empty if the stream is empty.
- </p> <p> Elements must implement {@code Comparable} .
-
Parameters:
- (none)
- Returns: a {@code Collector} that produces the minimal element, wrapped in an {@code Optional}
-
Signature:
public static <T> Collector<T, ?, Optional<T>> min(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the minimum element according to a given {@code Comparator} .
-
Contract:
- The result is wrapped in an {@code Optional} which is empty if the stream is empty.
- The comparator is used for all comparisons, including handling of {@code null} values if present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements
-
- Returns: a {@code Collector} that produces the minimal element according to the comparator, wrapped in an {@code Optional}
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
minOrElse(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> minOrElse(final T defaultForEmpty) - Summary: Returns a {@code Collector} that finds the minimum element with a default value for empty streams.
-
Contract:
- If the stream is empty, it returns the specified default value instead of an empty {@code Optional} .
- This is useful when you always need a value.
-
Parameters:
-
defaultForEmpty(T) — the default value to return if the stream is empty
-
- Returns: a {@code Collector} that produces the minimal element, or the default value if no elements are present
-
Signature:
public static <T> Collector<T, ?, T> minOrElse(final Comparator<? super T> comparator, final T defaultForEmpty) - Summary: Returns a {@code Collector} that finds the minimum element according to a comparator, with a default value for empty streams.
-
Contract:
- If the stream is empty, it returns the specified default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find shortest string with default String shortest = emptyStream .collect(Collectors.minOrElse( Comparator.comparing(String::length), "NO_DATA")); // Result: "NO_DATA" if stream is empty } </pre>
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
defaultForEmpty(T) — the default value to return if the stream is empty
-
- Returns: a {@code Collector} that produces the minimal element according to the comparator, or the default value if no elements are present
minOrElseGet(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> minOrElseGet(final Supplier<? extends T> supplierForEmpty) - Summary: Returns a {@code Collector} that finds the minimum element according to the natural order, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element according to the natural order, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
- <p> This collector is useful when you need a default value instead of dealing with an empty {@code Optional} .
- The elements must be {@code Comparable} .
-
Parameters:
-
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the minimum element or returns the default value
-
Signature:
public static <T> Collector<T, ?, T> minOrElseGet(final Comparator<? super T> comparator, final Supplier<? extends T> supplierForEmpty) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the minimum element according to the provided comparator, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element according to the provided comparator, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements -
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the minimum element or returns the default value
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
minOrElseThrow(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> minOrElseThrow() - Summary: Returns a {@code Collector} that finds the minimum element according to the natural order, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element according to the natural order, throwing a {@code NoSuchElementException} if no elements are present.
- <p> This collector is useful when the absence of elements should be treated as an exceptional condition.
- The elements must be {@code Comparable} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds the minimum element or throws if empty
-
Signature:
public static <T> Collector<T, ?, T> minOrElseThrow(final Comparator<? super T> comparator) - Summary: Returns a {@code Collector} that finds the minimum element according to the provided comparator, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element according to the provided comparator, throwing a {@code NoSuchElementException} if no elements are present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements
-
- Returns: a {@code Collector} which finds the minimum element or throws if empty
-
Signature:
public static <T> Collector<T, ?, T> minOrElseThrow(final Comparator<? super T> comparator, final Supplier<? extends RuntimeException> exceptionSupplier) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the minimum element according to the provided comparator, throwing a custom exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element according to the provided comparator, throwing a custom exception if no elements are present.
- <p> This collector allows you to specify both the comparison logic and the exception to throw when the stream is empty, providing maximum flexibility.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier providing the exception to throw if no elements are present
-
- Returns: a {@code Collector} which finds the minimum element or throws a custom exception
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
minBy(...) -> Collector<T, ?, Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> minBy(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, returning an {@code Optional} .
-
Contract:
- <p> This collector is useful when you want to find the minimum element based on a specific property.
- The key extractor function should return a {@code Comparable} value.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element
-
- Returns: a {@code Collector} which finds the element with the minimum key
minByOrElseGet(...) -> Collector<T, ?, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> minByOrElseGet(final Function<? super T, ? extends Comparable> keyMapper, final Supplier<? extends T> supplierForEmpty) - Summary: Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element -
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the element with the minimum key or returns default
minByOrElseThrow(...) -> Collector<T, ?, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> minByOrElseThrow(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, throwing a {@code NoSuchElementException} if no elements are present.
- <p> This collector is useful when you need to find the minimum based on a property and want to treat empty streams as exceptional cases.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element
-
- Returns: a {@code Collector} which finds the element with the minimum key or throws
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> minByOrElseThrow(final Function<? super T, ? extends Comparable> keyMapper, final Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, throwing a custom exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the minimum element by extracting a {@code Comparable} key from each element, throwing a custom exception if no elements are present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier providing the exception to throw if no elements are present
-
- Returns: a {@code Collector} which finds the element with the minimum key or throws
max(...) -> Collector<T, ?, Optional<T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, Optional<T>> max() - Summary: Returns a {@code Collector} that finds the maximum element according to the natural order, returning an {@code Optional} .
-
Contract:
- The elements must be {@code Comparable} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds the maximum element
-
Signature:
public static <T> Collector<T, ?, Optional<T>> max(final Comparator<? super T> comparator) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the maximum element according to the provided comparator, returning an {@code Optional} .
-
Contract:
- If multiple elements are considered equal according to the comparator, the first encountered element is returned.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements
-
- Returns: a {@code Collector} which finds the maximum element
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
maxOrElse(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> maxOrElse(final T defaultForEmpty) - Summary: Returns a {@code Collector} that finds the maximum element according to the natural order, or returns the specified default value if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the natural order, or returns the specified default value if no elements are present.
-
Parameters:
-
defaultForEmpty(T) — the default value to return if no elements are present
-
- Returns: a {@code Collector} which finds the maximum element or returns the default
-
Signature:
public static <T> Collector<T, ?, T> maxOrElse(final Comparator<? super T> comparator, final T defaultForEmpty) - Summary: Returns a {@code Collector} that finds the maximum element according to the provided comparator, or returns the specified default value if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the provided comparator, or returns the specified default value if no elements are present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements -
defaultForEmpty(T) — the default value to return if no elements are present
-
- Returns: a {@code Collector} which finds the maximum element or returns the default
maxOrElseGet(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> maxOrElseGet(final Supplier<? extends T> supplierForEmpty) - Summary: Returns a {@code Collector} that finds the maximum element according to the natural order, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the natural order, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
- <p> This collector is useful when you need a default value instead of dealing with an empty {@code Optional} .
- The elements must be {@code Comparable} .
-
Parameters:
-
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the maximum element or returns the default
-
Signature:
public static <T> Collector<T, ?, T> maxOrElseGet(final Comparator<? super T> comparator, final Supplier<? extends T> supplierForEmpty) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the maximum element according to the provided comparator, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the provided comparator, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements -
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the maximum element or returns the default
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
maxOrElseThrow(...) -> Collector<T, ?, T>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, T> maxOrElseThrow() - Summary: Returns a {@code Collector} that finds the maximum element according to the natural order, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the natural order, throwing a {@code NoSuchElementException} if no elements are present.
- <p> This collector is useful when the absence of elements should be treated as an exceptional condition.
- The elements must be {@code Comparable} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds the maximum element or throws if empty
-
Signature:
public static <T> Collector<T, ?, T> maxOrElseThrow(final Comparator<? super T> comparator) - Summary: Returns a {@code Collector} that finds the maximum element according to the provided comparator, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the provided comparator, throwing a {@code NoSuchElementException} if no elements are present.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements
-
- Returns: a {@code Collector} which finds the maximum element or throws if empty
-
Signature:
public static <T> Collector<T, ?, T> maxOrElseThrow(final Comparator<? super T> comparator, final Supplier<? extends RuntimeException> exceptionSupplier) throws IllegalArgumentException - Summary: Returns a {@code Collector} that finds the maximum element according to the provided comparator, throwing a custom exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element according to the provided comparator, throwing a custom exception if no elements are present.
- <p> This collector allows you to specify both the comparison logic and the exception to throw when the stream is empty.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} for comparing elements -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier providing the exception to throw if no elements are present
-
- Returns: a {@code Collector} which finds the maximum element or throws a custom exception
-
Throws:
-
java.lang.IllegalArgumentException— if the comparator is null
-
maxBy(...) -> Collector<T, ?, Optional<T>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> maxBy(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, returning an {@code Optional} .
-
Contract:
- <p> This collector is useful when you want to find the maximum element based on a specific property.
- The key extractor function should return a {@code Comparable} value.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element
-
- Returns: a {@code Collector} which finds the element with the maximum key
maxByOrElseGet(...) -> Collector<T, ?, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> maxByOrElseGet(final Function<? super T, ? extends Comparable> keyMapper, final Supplier<? extends T> supplierForEmpty) - Summary: Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, or returns the value supplied by {@code supplierForEmpty} if no elements are present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element -
supplierForEmpty(Supplier<? extends T>) — a supplier providing the default value if no elements are present
-
- Returns: a {@code Collector} which finds the element with the maximum key or returns default
maxByOrElseThrow(...) -> Collector<T, ?, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> maxByOrElseThrow(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, throwing a {@code NoSuchElementException} if no elements are present.
- <p> This collector is useful when you need to find the maximum based on a property and want to treat empty streams as exceptional cases.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element
-
- Returns: a {@code Collector} which finds the element with the maximum key or throws
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> maxByOrElseThrow(final Function<? super T, ? extends Comparable> keyMapper, final Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, throwing a custom exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that finds the maximum element by extracting a {@code Comparable} key from each element, throwing a custom exception if no elements are present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function extracting a {@code Comparable} key from each element -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier providing the exception to throw if no elements are present
-
- Returns: a {@code Collector} which finds the element with the maximum key or throws
minAll(...) -> Collector<T, ?, List<T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, List<T>> minAll() - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds all the minimal elements and collects them to the {@code List} .
- See also: #minAll(Comparator), #minAll(Collector)
-
Signature:
public static <T> Collector<T, ?, List<T>> minAll(final Comparator<? super T> comparator) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements
-
- Returns: a {@code Collector} which finds all the minimal elements and collects them to the {@code List} .
- See also: #minAll(Comparator, Collector), #minAll()
-
Signature:
public static <T> Collector<T, ?, List<T>> minAll(final Comparator<? super T> comparator, final int atMostSize) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and smaller than any other element according to the specified {@link Comparator} , collecting at most the specified number of elements.
-
Contract:
- <p> This collector is useful when you want to find all minimal elements but limit the result size for memory efficiency.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
atMostSize(int) — the maximum number of minimal elements to collect
-
- Returns: a {@code Collector} which finds at most the specified number of minimal elements
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable, A, R> Collector<T, ?, R> minAll(final Collector<T, A, R> downstream) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
downstream(Collector<T, A, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds all the minimal elements.
- See also: #minAll(Comparator, Collector), #minAll(Comparator), #minAll()
-
Signature:
public static <T, A, R> Collector<T, ?, R> minAll(final Comparator<? super T> comparator, final Collector<T, A, R> downstream) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<T, A, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds all the minimal elements.
- See also: #minAll(Comparator), #minAll(Collector), #minAll()
minAlll(...) -> Collector<T, ?, Optional<Pair<T, R>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable, R> Collector<T, ?, Optional<Pair<T, R>>> minAlll(final Collector<T, ?, R> downstream) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and smaller than any other element according to the natural order, returning an {@code Optional} containing the minimum element and the result of the downstream collector.
-
Contract:
- <p> This collector is useful when you need both the minimum element and some aggregation of all minimum elements.
-
Parameters:
-
downstream(Collector<T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds the minimum element and applies downstream
-
Signature:
public static <T, R> Collector<T, ?, Optional<Pair<T, R>>> minAlll(final Comparator<? super T> comparator, final Collector<? super T, ?, R> downstream) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and smaller than any other element according to the specified {@link Comparator} , returning an {@code Optional} containing the minimum element and the result of the downstream collector.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<? super T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds the minimum element and applies downstream
-
Signature:
public static <T, R, RR> Collector<T, ?, RR> minAlll(final Comparator<? super T> comparator, final Collector<? super T, ?, R> downstream, final Function<Optional<Pair<T, R>>, RR> finisher) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and smaller than any other element according to the specified {@link Comparator} , applies a downstream collector, and then applies a finisher function to the result.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<? super T, ?, R>) — a {@code Collector} implementing the downstream reduction -
finisher(Function<Optional<Pair<T, R>>, RR>) — a function to apply to the final result
-
- Returns: a {@code Collector} which finds the minimum and transforms the result
maxAll(...) -> Collector<T, ?, List<T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, List<T>> maxAll() - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds all the maximal elements and collects them to the {@code List} .
- See also: #maxAll(Comparator), #maxAll(Collector)
-
Signature:
public static <T> Collector<T, ?, List<T>> maxAll(final Comparator<? super T> comparator) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements
-
- Returns: a {@code Collector} which finds all the maximal elements and collects them to the {@code List} .
- See also: #maxAll(Comparator, Collector), #maxAll()
-
Signature:
public static <T> Collector<T, ?, List<T>> maxAll(final Comparator<? super T> comparator, final int atMostSize) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the specified {@link Comparator} , collecting at most the specified number of elements.
-
Contract:
- <p> This collector is useful when you want to find all maximal elements but limit the result size for memory efficiency.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
atMostSize(int) — the maximum number of maximal elements to collect
-
- Returns: a {@code Collector} which finds at most the specified number of maximal elements
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable, R> Collector<T, ?, R> maxAll(final Collector<T, ?, R> downstream) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
downstream(Collector<T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds all the maximal elements.
- See also: #maxAll(Comparator, Collector), #maxAll(Comparator), #maxAll()
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R> Collector<T, ?, R> maxAll(final Comparator<? super T> comparator, final Collector<? super T, ?, R> downstream) - Summary: It's copied from StreamEx: <a href="https://github.com/amaembo/streamex"> StreamEx </a> under Apache License v2 and may be modified.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<? super T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds all the maximal elements.
- See also: #maxAll(Comparator), #maxAll(Collector), #maxAll()
maxAlll(...) -> Collector<T, ?, Optional<Pair<T, R>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable, R> Collector<T, ?, Optional<Pair<T, R>>> maxAlll(final Collector<T, ?, R> downstream) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the natural order, returning an {@code Optional} containing the maximum element and the result of the downstream collector.
-
Contract:
- <p> This collector is useful when you need both the maximum element and some aggregation of all maximum elements.
-
Parameters:
-
downstream(Collector<T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds the maximum element and applies downstream
-
Signature:
public static <T, R> Collector<T, ?, Optional<Pair<T, R>>> maxAlll(final Comparator<? super T> comparator, final Collector<? super T, ?, R> downstream) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the specified {@link Comparator} , returning an {@code Optional} containing the maximum element and the result of the downstream collector.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<? super T, ?, R>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Collector} which finds the maximum element and applies downstream
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R, RR> Collector<T, ?, RR> maxAlll(final Comparator<? super T> comparator, final Collector<? super T, ?, R> downstream, final Function<Optional<Pair<T, R>>, RR> finisher) - Summary: Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the specified {@link Comparator} , applies a downstream collector, and then applies a finisher function to the result.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code Comparator} to compare the elements -
downstream(Collector<? super T, ?, R>) — a {@code Collector} implementing the downstream reduction -
finisher(Function<Optional<Pair<T, R>>, RR>) — a function to apply to the final result
-
- Returns: a {@code Collector} which finds the maximum and transforms the result
minMax(...) -> Collector<T, ?, Optional<Pair<T, T>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T extends Comparable> Collector<T, ?, Optional<Pair<T, T>>> minMax() - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements from a stream of {@code Comparable} elements.
-
Contract:
- If the stream is empty, an empty {@code Optional} is returned.
- </p> <p> The collector produces a stable result for ordered streams: if several minimal or maximal elements appear, the collector always selects the first encountered.
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds the minimum and maximum elements, wrapped in an {@code Optional<Pair>}
-
Signature:
public static <T> Collector<T, ?, Optional<Pair<T, T>>> minMax(final Comparator<? super T> comparator) - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements from a stream according to the specified comparator.
-
Contract:
- If the stream is empty, an empty {@code Optional} is returned.
- </p> <p> The collector produces a stable result for ordered streams: if several minimal or maximal elements appear, the collector always selects the first encountered.
-
Parameters:
-
comparator(Comparator<? super T>) — comparator used to compare elements
-
- Returns: a {@code Collector} which finds the minimum and maximum elements, wrapped in an {@code Optional<Pair>}
- See also: #minMax(Comparator, BiFunction)
-
Signature:
public static <T, R> Collector<T, ?, Optional<R>> minMax(final Comparator<? super T> comparator, final BiFunction<? super T, ? super T, ? extends R> finisher) - Summary: Returns a {@code Collector} which finds the minimal and maximal element according to the supplied comparator, then applies finisher function to them producing the final result.
-
Contract:
- <p> This collector is useful when you need to perform a custom operation on the minimum and maximum elements found.
- The finisher function is only called if the stream contains at least one element.
- </p> <p> This collector produces a stable result for ordered stream: if several minimal or maximal elements appear, the collector always selects the first encountered.
- </p> <p> If there are no input elements, the finisher method is not called and empty {@code Optional} is returned.
-
Parameters:
-
comparator(Comparator<? super T>) — comparator which is used to find the minimal and maximal elements -
finisher(BiFunction<? super T, ? super T, ? extends R>) — a {@link BiFunction} which takes the minimal and maximal elements and produces the final result
-
- Returns: a {@code Collector} which finds minimal and maximal elements
minMaxBy(...) -> Collector<T, ?, Optional<Pair<T, T>>>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<Pair<T, T>>> minMaxBy(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements from a stream by comparing the results of applying the given key extraction function.
-
Contract:
- <p> This collector is useful when you want to find the elements with the minimum and maximum values based on a specific property.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — function to extract a {@code Comparable} key from elements
-
- Returns: a {@code Collector} which finds the elements with minimum and maximum keys, wrapped in an {@code Optional<Pair>}
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R> Collector<T, ?, Optional<R>> minMaxBy(final Function<? super T, ? extends Comparable> keyMapper, final BiFunction<? super T, ? super T, ? extends R> finisher) - Summary: Returns a {@code Collector} that finds the elements with minimum and maximum keys according to the provided key mapper, then applies a finisher function to produce a final result.
-
Contract:
- The finisher is only called if the stream contains at least one element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — function to extract a {@code Comparable} key from elements -
finisher(BiFunction<? super T, ? super T, ? extends R>) — a {@link BiFunction} which takes the elements with minimum and maximum keys and produces the final result
-
- Returns: a {@code Collector} which finds elements with minimum and maximum keys and applies the finisher function
minMaxOrElseGet(...) -> Collector<T, ?, Pair<T, T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, Pair<T, T>> minMaxOrElseGet( final Supplier<Pair<? extends T, ? extends T>> supplierForEmpty) - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements from a stream of {@code Comparable} elements, returning a default value if the stream is empty.
-
Contract:
- Returns a {@code Collector} that finds both the minimum and maximum elements from a stream of {@code Comparable} elements, returning a default value if the stream is empty.
- <p> This collector is similar to {@link #minMax()} , but instead of returning an {@code Optional} , it returns the result of the supplier function when the stream is empty.
- This is useful when you want to avoid dealing with {@code Optional} and have a sensible default value.
-
Parameters:
-
supplierForEmpty(Supplier<Pair<? extends T, ? extends T>>) — supplier that provides a default {@code Pair} when stream is empty
-
- Returns: a {@code Collector} which finds the minimum and maximum elements, or returns the supplied default if stream is empty
-
Signature:
public static <T> Collector<T, ?, Pair<T, T>> minMaxOrElseGet(final Comparator<? super T> comparator, final Supplier<Pair<? extends T, ? extends T>> supplierForEmpty) - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements according to the specified comparator, returning a default value if the stream is empty.
-
Contract:
- Returns a {@code Collector} that finds both the minimum and maximum elements according to the specified comparator, returning a default value if the stream is empty.
- If the stream is empty, the supplier function is called to provide a default result.
-
Parameters:
-
comparator(Comparator<? super T>) — comparator used to compare elements -
supplierForEmpty(Supplier<Pair<? extends T, ? extends T>>) — supplier that provides a default {@code Pair} when stream is empty
-
- Returns: a {@code Collector} which finds the minimum and maximum elements, or returns the supplied default if stream is empty
minMaxOrElseThrow(...) -> Collector<T, ?, Pair<T, T>>
-
Signature:
public static <T extends Comparable<? super T>> Collector<T, ?, Pair<T, T>> minMaxOrElseThrow() - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements from a stream of {@code Comparable} elements, throwing an exception if the stream is empty.
-
Contract:
- Returns a {@code Collector} that finds both the minimum and maximum elements from a stream of {@code Comparable} elements, throwing an exception if the stream is empty.
- <p> This collector is useful when an empty stream represents an error condition in your application logic.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // This will throw NoSuchElementException if stream is empty Pair<Integer, Integer> result = Stream.of(5, 2, 8, 1, 9) .collect(Collectors.minMaxOrElseThrow()); // Result: Pair(1, 9) } </pre>
-
Parameters:
- (none)
- Returns: a {@code Collector} which finds the minimum and maximum elements
-
Signature:
public static <T> Collector<T, ?, Pair<T, T>> minMaxOrElseThrow(final Comparator<? super T> comparator) - Summary: Returns a {@code Collector} that finds both the minimum and maximum elements according to the specified comparator, throwing an exception if the stream is empty.
-
Contract:
- Returns a {@code Collector} that finds both the minimum and maximum elements according to the specified comparator, throwing an exception if the stream is empty.
- If the stream is empty, a {@code NoSuchElementException} is thrown.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find shortest and longest strings (throws if empty) Pair<String, String> result = Stream.of("a", "abc", "ab") .collect(Collectors.minMaxOrElseThrow( Comparator.comparing(String::length))); // Result: Pair(a, abc) } </pre>
-
Parameters:
-
comparator(Comparator<? super T>) — comparator used to compare elements
-
- Returns: a {@code Collector} which finds the minimum and maximum elements
summingInt(...) -> Collector<T, ?, Integer>
-
Signature:
public static <T> Collector<T, ?, Integer> summingInt(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the sum of an integer-valued function applied to the input elements.
-
Contract:
- If no elements are present, the result is 0.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — function to extract an integer value from an element
-
- Returns: a {@code Collector} that produces the sum of the extracted values
summingIntToLong(...) -> Collector<T, ?, Long>
-
Signature:
public static <T> Collector<T, ?, Long> summingIntToLong(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the sum of an integer-valued function applied to the input elements, with the result as a {@code Long} .
-
Contract:
- <p> This collector is similar to {@link #summingInt(ToIntFunction)} but returns a {@code Long} result to avoid integer overflow issues when summing large numbers of elements or large values.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — function to extract an integer value from an element
-
- Returns: a {@code Collector} that produces the sum as a {@code Long}
summingLong(...) -> Collector<T, ?, Long>
-
Signature:
public static <T> Collector<T, ?, Long> summingLong(final ToLongFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the sum of a long-valued function applied to the input elements.
-
Contract:
- If no elements are present, the result is 0L.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — function to extract a long value from an element
-
- Returns: a {@code Collector} that produces the sum of the extracted values
summingDouble(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> summingDouble(final ToDoubleFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the sum of a double-valued function applied to the input elements.
-
Contract:
- If no elements are present, the result is 0.0.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — function to extract a double value from an element
-
- Returns: a {@code Collector} that produces the sum of the extracted values
summingBigInteger(...) -> Collector<T, ?, BigInteger>
-
Signature:
public static <T> Collector<T, ?, BigInteger> summingBigInteger(final Function<? super T, BigInteger> mapper) - Summary: Returns a {@code Collector} that produces the sum of {@code BigInteger} values extracted from the input elements.
-
Contract:
- If no elements are present, the result is {@code BigInteger.ZERO} .
-
Parameters:
-
mapper(Function<? super T, BigInteger>) — function to extract a {@code BigInteger} value from an element
-
- Returns: a {@code Collector} that produces the sum of the extracted values
summingBigDecimal(...) -> Collector<T, ?, BigDecimal>
-
Signature:
public static <T> Collector<T, ?, BigDecimal> summingBigDecimal(final Function<? super T, BigDecimal> mapper) - Summary: Returns a {@code Collector} that produces the sum of {@code BigDecimal} values extracted from the input elements.
-
Contract:
- If no elements are present, the result is {@code BigDecimal.ZERO} .
-
Parameters:
-
mapper(Function<? super T, BigDecimal>) — function to extract a {@code BigDecimal} value from an element
-
- Returns: a {@code Collector} that produces the sum of the extracted values
averagingInt(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingInt(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of an integer-valued function applied to the input elements.
-
Contract:
- If no elements are present in the stream, the result is 0.0.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — a function extracting an integer value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted integer values as a {@code Double}
- See also: #averagingIntOrEmpty(ToIntFunction), #averagingIntOrElseThrow(ToIntFunction), java.util.stream.Collectors#averagingInt(ToIntFunction)
averagingIntOrEmpty(...) -> Collector<T, ?, OptionalDouble>
-
Signature:
public static <T> Collector<T, ?, OptionalDouble> averagingIntOrEmpty(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of an integer-valued function applied to the input elements, wrapped in an {@code OptionalDouble} .
-
Contract:
- Unlike {@link #averagingInt(ToIntFunction)} , this method returns an {@code OptionalDouble} which will be empty if no elements are present in the stream.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — a function extracting an integer value from each input element
-
- Returns: a {@code Collector} that produces an {@code OptionalDouble} containing the arithmetic mean, or an empty {@code OptionalDouble} if no elements were present
- See also: #averagingInt(ToIntFunction), #averagingIntOrElseThrow(ToIntFunction)
averagingIntOrElseThrow(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingIntOrElseThrow(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of an integer-valued function applied to the input elements, throwing an exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that produces the arithmetic mean of an integer-valued function applied to the input elements, throwing an exception if no elements are present.
- Unlike {@link #averagingInt(ToIntFunction)} which returns 0.0 for empty streams and {@link #averagingIntOrEmpty(ToIntFunction)} which returns an empty Optional, this method throws a {@code NoSuchElementException} if the stream is empty.
- This is useful when an empty stream represents an error condition and you want to fail fast rather than return a default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average age (throws if no people) List<Person> people = Arrays.asList( new Person("Alice", 25), new Person("Bob", 30) ); Double avgAge = people.stream() .collect(Collectors.averagingIntOrElseThrow(Person::getAge)); // Result: 27.5 // Empty stream throws exception try { Double avg = Stream.<Person>empty() .collect(Collectors.averagingIntOrElseThrow(Person::getAge)); } catch (NoSuchElementException e) { System.out.println("Cannot compute average of empty stream"); } // Using with filtering - throws if no elements match Double avgAdultAge = people.stream() .filter(p -> p.getAge() >= 18) .collect(Collectors.averagingIntOrElseThrow(Person::getAge)); } </pre>
-
Parameters:
-
mapper(ToIntFunction<? super T>) — a function extracting an integer value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted integer values as a {@code Double}
- See also: #averagingInt(ToIntFunction), #averagingIntOrEmpty(ToIntFunction)
averagingLong(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingLong(final ToLongFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a long-valued function applied to the input elements.
-
Contract:
- If no elements are present in the stream, the result is 0.0.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — a function extracting a long value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted long values as a {@code Double}
- See also: #averagingLongOrEmpty(ToLongFunction), #averagingLongOrElseThrow(ToLongFunction), java.util.stream.Collectors#averagingLong(ToLongFunction)
averagingLongOrEmpty(...) -> Collector<T, ?, OptionalDouble>
-
Signature:
public static <T> Collector<T, ?, OptionalDouble> averagingLongOrEmpty(final ToLongFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a long-valued function applied to the input elements, wrapped in an {@code OptionalDouble} .
-
Contract:
- Unlike {@link #averagingLong(ToLongFunction)} , this method returns an {@code OptionalDouble} which will be empty if no elements are present in the stream.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — a function extracting a long value from each input element
-
- Returns: a {@code Collector} that produces an {@code OptionalDouble} containing the arithmetic mean, or an empty {@code OptionalDouble} if no elements were present
- See also: #averagingLong(ToLongFunction), #averagingLongOrElseThrow(ToLongFunction)
averagingLongOrElseThrow(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingLongOrElseThrow(final ToLongFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a long-valued function applied to the input elements, throwing an exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that produces the arithmetic mean of a long-valued function applied to the input elements, throwing an exception if no elements are present.
- Unlike {@link #averagingLong(ToLongFunction)} which returns 0.0 for empty streams and {@link #averagingLongOrEmpty(ToLongFunction)} which returns an empty Optional, this method throws a {@code NoSuchElementException} if the stream is empty.
- This is useful when an empty stream represents an error condition and you want to fail fast rather than return a default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average processing time (throws if no data) List<Record> records = getRecords(); Double avgTime = records.stream() .collect(Collectors.averagingLongOrElseThrow(Record::getProcessingTime)); // Empty stream throws exception try { Double avg = Stream.<Record>empty() .collect(Collectors.averagingLongOrElseThrow(Record::getProcessingTime)); } catch (NoSuchElementException e) { System.out.println("Cannot compute average of empty stream"); } // Using with filtering - throws if no elements match Double avgLargeFileSize = files.stream() .filter(f -> f.length() > 1000000) .collect(Collectors.averagingLongOrElseThrow(File::length)); } </pre>
-
Parameters:
-
mapper(ToLongFunction<? super T>) — a function extracting a long value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted long values as a {@code Double}
- See also: #averagingLong(ToLongFunction), #averagingLongOrEmpty(ToLongFunction)
averagingDouble(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingDouble(final ToDoubleFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a double-valued function applied to the input elements.
-
Contract:
- If no elements are present in the stream, the result is 0.0.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — a function extracting a double value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted double values as a {@code Double}
- See also: #averagingDoubleOrEmpty(ToDoubleFunction), #averagingDoubleOrElseThrow(ToDoubleFunction), java.util.stream.Collectors#averagingDouble(ToDoubleFunction)
averagingDoubleOrEmpty(...) -> Collector<T, ?, OptionalDouble>
-
Signature:
public static <T> Collector<T, ?, OptionalDouble> averagingDoubleOrEmpty(final ToDoubleFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a double-valued function applied to the input elements, wrapped in an {@code OptionalDouble} .
-
Contract:
- Unlike {@link #averagingDouble(ToDoubleFunction)} , this method returns an {@code OptionalDouble} which will be empty if no elements are present in the stream.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — a function extracting a double value from each input element
-
- Returns: a {@code Collector} that produces an {@code OptionalDouble} containing the arithmetic mean, or an empty {@code OptionalDouble} if no elements were present
- See also: #averagingDouble(ToDoubleFunction), #averagingDoubleOrElseThrow(ToDoubleFunction)
averagingDoubleOrElseThrow(...) -> Collector<T, ?, Double>
-
Signature:
public static <T> Collector<T, ?, Double> averagingDoubleOrElseThrow(final ToDoubleFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of a double-valued function applied to the input elements, throwing an exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that produces the arithmetic mean of a double-valued function applied to the input elements, throwing an exception if no elements are present.
- Unlike {@link #averagingDouble(ToDoubleFunction)} which returns 0.0 for empty streams and {@link #averagingDoubleOrEmpty(ToDoubleFunction)} which returns an empty Optional, this method throws a {@code NoSuchElementException} if the stream is empty.
- This is useful when an empty stream represents an error condition and you want to fail fast rather than return a default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average score (throws if no scores) List<Student> students = Arrays.asList( new Student("Alice", 85.5), new Student("Bob", 92.0), new Student("Charlie", 78.3) ); Double avgScore = students.stream() .collect(Collectors.averagingDoubleOrElseThrow(Student::getScore)); // Result: 85.26666666666667 // Empty stream throws exception try { Double avg = Stream.<Student>empty() .collect(Collectors.averagingDoubleOrElseThrow(Student::getScore)); } catch (NoSuchElementException e) { System.out.println("Cannot compute average of empty stream"); } // Using with filtering - throws if no elements match Double avgHighScore = students.stream() .filter(s -> s.getScore() >= 90.0) .collect(Collectors.averagingDoubleOrElseThrow(Student::getScore)); } </pre>
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — a function extracting a double value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean of the extracted double values as a {@code Double}
- See also: #averagingDouble(ToDoubleFunction), #averagingDoubleOrEmpty(ToDoubleFunction)
averagingBigInteger(...) -> Collector<T, ?, BigDecimal>
-
Signature:
public static <T> Collector<T, ?, BigDecimal> averagingBigInteger(final Function<? super T, BigInteger> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigInteger} values extracted from the input elements.
-
Contract:
- The average is calculated as a {@code BigDecimal} to preserve precision, which is essential when working with arbitrary-precision integers.
- If no elements are present in the stream, the result is {@code BigDecimal.ZERO} .
- </p> <p> This collector is particularly useful when dealing with very large integer values that exceed the capacity of primitive types (int, long) or when precision is critical.
-
Parameters:
-
mapper(Function<? super T, BigInteger>) — a function extracting a {@code BigInteger} value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean as a {@code BigDecimal}
- See also: #averagingBigIntegerOrEmpty(Function), #averagingBigIntegerOrElseThrow(Function), java.util.stream.Collectors#averagingDouble(ToDoubleFunction)
averagingBigIntegerOrEmpty(...) -> Collector<T, ?, Optional<BigDecimal>>
-
Signature:
public static <T> Collector<T, ?, Optional<BigDecimal>> averagingBigIntegerOrEmpty(final Function<? super T, BigInteger> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigInteger} values extracted from the input elements, wrapped in an {@code Optional<BigDecimal>} .
-
Contract:
- Unlike {@link #averagingBigInteger(Function)} , this method returns an {@code Optional<BigDecimal>} which will be empty if no elements are present in the stream.
-
Parameters:
-
mapper(Function<? super T, BigInteger>) — a function extracting a {@code BigInteger} value from each input element
-
- Returns: a {@code Collector} that produces an {@code Optional<BigDecimal>} containing the arithmetic mean, or an empty {@code Optional} if no elements were present
- See also: #averagingBigInteger(Function), #averagingBigIntegerOrElseThrow(Function)
averagingBigIntegerOrElseThrow(...) -> Collector<T, ?, BigDecimal>
-
Signature:
public static <T> Collector<T, ?, BigDecimal> averagingBigIntegerOrElseThrow(final Function<? super T, BigInteger> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigInteger} values extracted from the input elements, throwing an exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that produces the arithmetic mean of {@code BigInteger} values extracted from the input elements, throwing an exception if no elements are present.
- Unlike {@link #averagingBigInteger(Function)} which returns {@code BigDecimal.ZERO} for empty streams and {@link #averagingBigIntegerOrEmpty(Function)} which returns an empty Optional, this method throws a {@code NoSuchElementException} if the stream is empty.
- This is useful when an empty stream represents an error condition and you want to fail fast rather than return a default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average balance (throws if no accounts) List<Account> accounts = getAccounts(); BigDecimal avgBalance = accounts.stream() .collect(Collectors.averagingBigIntegerOrElseThrow(Account::getBalanceBigInt)); // Empty stream throws exception try { BigDecimal avg = Stream.<Account>empty() .collect(Collectors.averagingBigIntegerOrElseThrow(Account::getBalanceBigInt)); } catch (NoSuchElementException e) { System.out.println("Cannot compute average of empty stream"); } // Using with filtering - throws if no elements match BigDecimal avgLargeBalance = accounts.stream() .filter(a -> a.getBalanceBigInt().compareTo(BigInteger.valueOf(1000000)) > 0) .collect(Collectors.averagingBigIntegerOrElseThrow(Account::getBalanceBigInt)); } </pre>
-
Parameters:
-
mapper(Function<? super T, BigInteger>) — a function extracting a {@code BigInteger} value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean as a {@code BigDecimal}
- See also: #averagingBigInteger(Function), #averagingBigIntegerOrEmpty(Function)
averagingBigDecimal(...) -> Collector<T, ?, BigDecimal>
-
Signature:
public static <T> Collector<T, ?, BigDecimal> averagingBigDecimal(final Function<? super T, BigDecimal> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigDecimal} values extracted from the input elements.
-
Contract:
- If no elements are present in the stream, the result is {@code BigDecimal.ZERO} .
-
Parameters:
-
mapper(Function<? super T, BigDecimal>) — a function extracting a {@code BigDecimal} value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean as a {@code BigDecimal}
- See also: #averagingBigDecimalOrEmpty(Function), #averagingBigDecimalOrElseThrow(Function), java.util.stream.Collectors#averagingDouble(ToDoubleFunction)
averagingBigDecimalOrEmpty(...) -> Collector<T, ?, Optional<BigDecimal>>
-
Signature:
public static <T> Collector<T, ?, Optional<BigDecimal>> averagingBigDecimalOrEmpty(final Function<? super T, BigDecimal> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigDecimal} values extracted from the input elements, wrapped in an {@code Optional<BigDecimal>} .
-
Contract:
- Unlike {@link #averagingBigDecimal(Function)} , this method returns an {@code Optional<BigDecimal>} which will be empty if no elements are present in the stream.
-
Parameters:
-
mapper(Function<? super T, BigDecimal>) — a function extracting a {@code BigDecimal} value from each input element
-
- Returns: a {@code Collector} that produces an {@code Optional<BigDecimal>} containing the arithmetic mean, or an empty {@code Optional} if no elements were present
- See also: #averagingBigDecimal(Function), #averagingBigDecimalOrElseThrow(Function)
averagingBigDecimalOrElseThrow(...) -> Collector<T, ?, BigDecimal>
-
Signature:
public static <T> Collector<T, ?, BigDecimal> averagingBigDecimalOrElseThrow(final Function<? super T, BigDecimal> mapper) - Summary: Returns a {@code Collector} that produces the arithmetic mean of {@code BigDecimal} values extracted from the input elements, throwing an exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that produces the arithmetic mean of {@code BigDecimal} values extracted from the input elements, throwing an exception if no elements are present.
- Unlike {@link #averagingBigDecimal(Function)} which returns {@code BigDecimal.ZERO} for empty streams and {@link #averagingBigDecimalOrEmpty(Function)} which returns an empty Optional, this method throws a {@code NoSuchElementException} if the stream is empty.
- This is useful when an empty stream represents an error condition and you want to fail fast rather than return a default value.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Calculate average price (throws if no items) List<Item> items = getItems(); BigDecimal avgPrice = items.stream() .collect(Collectors.averagingBigDecimalOrElseThrow(Item::getPrice)); // Empty stream throws exception try { BigDecimal avg = Stream.<Item>empty() .collect(Collectors.averagingBigDecimalOrElseThrow(Item::getPrice)); } catch (NoSuchElementException e) { System.out.println("Cannot compute average of empty stream"); } // Using with filtering - throws if no elements match BigDecimal avgExpensivePrice = items.stream() .filter(i -> i.getPrice().compareTo(new BigDecimal("100")) > 0) .collect(Collectors.averagingBigDecimalOrElseThrow(Item::getPrice)); } </pre>
-
Parameters:
-
mapper(Function<? super T, BigDecimal>) — a function extracting a {@code BigDecimal} value from each input element
-
- Returns: a {@code Collector} that produces the arithmetic mean as a {@code BigDecimal}
- See also: #averagingBigDecimal(Function), #averagingBigDecimalOrEmpty(Function)
summarizingChar(...) -> Collector<T, ?, CharSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, CharSummaryStatistics> summarizingChar(final ToCharFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for char values extracted from the input elements.
-
Parameters:
-
mapper(ToCharFunction<? super T>) — a function extracting a char value from each input element
-
- Returns: a {@code Collector} that produces {@code CharSummaryStatistics} containing comprehensive statistics
summarizingByte(...) -> Collector<T, ?, ByteSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, ByteSummaryStatistics> summarizingByte(final ToByteFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for byte values extracted from the input elements.
-
Parameters:
-
mapper(ToByteFunction<? super T>) — a function extracting a byte value from each input element
-
- Returns: a {@code Collector} that produces {@code ByteSummaryStatistics} containing comprehensive statistics
summarizingShort(...) -> Collector<T, ?, ShortSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, ShortSummaryStatistics> summarizingShort(final ToShortFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for short values extracted from the input elements.
-
Parameters:
-
mapper(ToShortFunction<? super T>) — a function extracting a short value from each input element
-
- Returns: a {@code Collector} that produces {@code ShortSummaryStatistics} containing comprehensive statistics
summarizingInt(...) -> Collector<T, ?, IntSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, IntSummaryStatistics> summarizingInt(final ToIntFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for integer values extracted from the input elements.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — a function extracting an integer value from each input element
-
- Returns: a {@code Collector} that produces {@code IntSummaryStatistics} containing comprehensive statistics
summarizingLong(...) -> Collector<T, ?, LongSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, LongSummaryStatistics> summarizingLong(final ToLongFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for long values extracted from the input elements.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — a function extracting a long value from each input element
-
- Returns: a {@code Collector} that produces {@code LongSummaryStatistics} containing comprehensive statistics
summarizingFloat(...) -> Collector<T, ?, FloatSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, FloatSummaryStatistics> summarizingFloat(final ToFloatFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for float values extracted from the input elements.
-
Parameters:
-
mapper(ToFloatFunction<? super T>) — a function extracting a float value from each input element
-
- Returns: a {@code Collector} that produces {@code FloatSummaryStatistics} containing comprehensive statistics
summarizingDouble(...) -> Collector<T, ?, DoubleSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, DoubleSummaryStatistics> summarizingDouble(final ToDoubleFunction<? super T> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for double values extracted from the input elements.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — a function extracting a double value from each input element
-
- Returns: a {@code Collector} that produces {@code DoubleSummaryStatistics} containing comprehensive statistics
summarizingBigInteger(...) -> Collector<T, ?, BigIntegerSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, BigIntegerSummaryStatistics> summarizingBigInteger(final Function<? super T, BigInteger> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for {@code BigInteger} values extracted from the input elements.
-
Parameters:
-
mapper(Function<? super T, BigInteger>) — a function extracting a {@code BigInteger} value from each input element
-
- Returns: a {@code Collector} that produces {@code BigIntegerSummaryStatistics} containing comprehensive statistics
summarizingBigDecimal(...) -> Collector<T, ?, BigDecimalSummaryStatistics>
-
Signature:
@SuppressWarnings("UnnecessaryLocalVariable") public static <T> Collector<T, ?, BigDecimalSummaryStatistics> summarizingBigDecimal(final Function<? super T, BigDecimal> mapper) - Summary: Returns a {@code Collector} that produces summary statistics for {@code BigDecimal} values extracted from the input elements.
-
Parameters:
-
mapper(Function<? super T, BigDecimal>) — a function extracting a {@code BigDecimal} value from each input element
-
- Returns: a {@code Collector} that produces {@code BigDecimalSummaryStatistics} containing comprehensive statistics
reducing(...) -> Collector<T, ?, T>
-
Signature:
public static <T> Collector<T, ?, T> reducing(final T identity, final BinaryOperator<T> op) - Summary: Returns a {@code Collector} that performs a reduction on the input elements using the provided identity value and binary operator.
-
Contract:
- The identity value serves as both the initial accumulation value and the result when no elements are present.
- The identity must be an identity for the combiner function, meaning {@code op.apply(identity, x)} must equal {@code x} for any value {@code x} .
- </p> <p> The reduction operation is equivalent to: <pre> {@code T result = identity; for (T element : stream) result = op.apply(result, element); return result; } </pre> <p> The collector is unordered, allowing for efficient parallel processing when the binary operator is associative.
-
Parameters:
-
identity(T) — the identity value for the reduction operation (also returned when no elements are present) -
op(BinaryOperator<T>) — an associative, stateless binary operator for combining two values
-
- Returns: a {@code Collector} that reduces the input elements using the binary operator
- See also: #reducing(BinaryOperator), #reducing(Object, Function, BinaryOperator), java.util.stream.Collectors#reducing(Object, BinaryOperator)
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, Optional<T>> reducing(final BinaryOperator<T> op) - Summary: Returns a {@code Collector} that performs a reduction on the input elements using the provided binary operator, with no identity value.
-
Contract:
- </p> <p> If the stream is empty, an empty {@code Optional} is returned.
- </p> <p> The collector is unordered, allowing for efficient parallel processing when the binary operator is associative.
-
Parameters:
-
op(BinaryOperator<T>) — an associative, stateless binary operator for combining two values
-
- Returns: a {@code Collector} that reduces the input elements into an {@code Optional} containing the reduced value, or an empty {@code Optional} if no elements were present
- See also: #reducing(Object, BinaryOperator), #reducingOrElseGet(BinaryOperator, Supplier), #reducingOrElseThrow(BinaryOperator), java.util.stream.Collectors#reducing(BinaryOperator)
-
Signature:
public static <T, R> Collector<T, ?, R> reducing(final R identity, final Function<? super T, ? extends R> mapper, final BinaryOperator<R> op) - Summary: Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, with an identity value.
-
Contract:
- The identity value is used as the initial accumulation value and should be the identity for the binary operator.
-
Parameters:
-
identity(R) — the identity value for the reduction (also the value returned when there are no elements) -
mapper(Function<? super T, ? extends R>) — a function to map input elements to the type used for reduction -
op(BinaryOperator<R>) — a binary operator used to reduce the mapped values
-
- Returns: a {@code Collector} which reduces the input elements
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R> Collector<T, ?, Optional<R>> reducing(final Function<? super T, ? extends R> mapper, final BinaryOperator<R> op) - Summary: Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, returning an {@code Optional} describing the result.
-
Contract:
- If no elements are present, an empty {@code Optional} is returned.
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a function to map input elements to the type used for reduction -
op(BinaryOperator<R>) — a binary operator used to reduce the mapped values
-
- Returns: a {@code Collector} which reduces the input elements into an {@code Optional}
reducingOrElseGet(...) -> Collector<T, ?, T>
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> reducingOrElseGet(final BinaryOperator<T> op, final Supplier<? extends T> supplierForEmpty) - Summary: Returns a {@code Collector} that performs a reduction on the elements using the provided binary operator, returning a default value if the stream is empty.
-
Contract:
- Returns a {@code Collector} that performs a reduction on the elements using the provided binary operator, returning a default value if the stream is empty.
- <p> This collector is similar to {@link #reducing(BinaryOperator)} but returns the result of the supplier function instead of an empty {@code Optional} when the stream is empty.
- </p> <p> The collector is unordered, allowing for efficient parallel processing when the binary operator is associative.
-
Parameters:
-
op(BinaryOperator<T>) — binary operator used to reduce elements -
supplierForEmpty(Supplier<? extends T>) — supplier that provides a default value when stream is empty
-
- Returns: a {@code Collector} that reduces elements or returns the supplied default
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R> Collector<T, ?, R> reducingOrElseGet(final Function<? super T, ? extends R> mapper, final BinaryOperator<R> op, final Supplier<? extends R> supplierForEmpty) - Summary: Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, returning a default value if no elements are present.
-
Contract:
- Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, returning a default value if no elements are present.
- If no elements are present, the value from the supplier is returned.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Get the product of all values, or 1 if empty Integer product = Stream.<Integer>empty() .collect(Collectors.reducingOrElseGet( i -> i, (a, b) -> a * b, () -> 1 )); // Result: 1 } </pre>
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a function to map input elements to the type used for reduction -
op(BinaryOperator<R>) — a binary operator used to reduce the mapped values -
supplierForEmpty(Supplier<? extends R>) — a supplier that provides the value to return when no elements are present
-
- Returns: a {@code Collector} which reduces the input elements
reducingOrElseThrow(...) -> Collector<T, ?, T>
-
Signature:
public static <T> Collector<T, ?, T> reducingOrElseThrow(final BinaryOperator<T> op) - Summary: Returns a {@code Collector} that performs a reduction on the elements using the provided binary operator, throwing an exception if the stream is empty.
-
Contract:
- Returns a {@code Collector} that performs a reduction on the elements using the provided binary operator, throwing an exception if the stream is empty.
- <p> This collector is useful when an empty stream represents an error condition.
- </p> <p> The collector is unordered, allowing for efficient parallel processing when the binary operator is associative.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find minimum (throws if empty) Integer min = Stream.of(5, 2, 8, 1) .collect(Collectors.reducingOrElseThrow(Integer::min)); // Result: 1 } </pre>
-
Parameters:
-
op(BinaryOperator<T>) — binary operator used to reduce elements
-
- Returns: a {@code Collector} that reduces elements or throws if empty
-
Signature:
@SuppressWarnings("rawtypes") public static <T> Collector<T, ?, T> reducingOrElseThrow(final BinaryOperator<T> op, final Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a {@code Collector} that reduces the input elements using the provided binary operator, throwing a specified exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that reduces the input elements using the provided binary operator, throwing a specified exception if no elements are present.
- <p> This collector is useful when you need to reduce elements and want to handle the empty case with a custom exception.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the maximum value, throw if empty Integer max = Stream.of(3, 1, 4, 1, 5) .collect(Collectors.reducingOrElseThrow( Integer::max, () -> new IllegalStateException("No elements") )); // Result: 5 } </pre>
-
Parameters:
-
op(BinaryOperator<T>) — a binary operator used to reduce the input elements -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier that provides the exception to throw when no elements are present
-
- Returns: a {@code Collector} which reduces the input elements using the binary operator
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R> Collector<T, ?, R> reducingOrElseThrow(final Function<? super T, ? extends R> mapper, final BinaryOperator<R> op, final Supplier<? extends RuntimeException> exceptionSupplier) - Summary: Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, throwing a specified exception if no elements are present.
-
Contract:
- Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, throwing a specified exception if no elements are present.
- If no elements are present, the exception from the supplier is thrown.
- </p> <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the minimum after mapping, throw if empty Integer minLength = Stream.of("apple", "pie", "banana") .collect(Collectors.reducingOrElseThrow( String::length, Integer::min, () -> new NoSuchElementException("No strings found") )); // Result: 3 } </pre>
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a function to map input elements to the type used for reduction -
op(BinaryOperator<R>) — a binary operator used to reduce the mapped values -
exceptionSupplier(Supplier<? extends RuntimeException>) — a supplier that provides the exception to throw when no elements are present
-
- Returns: a {@code Collector} which reduces the input elements
-
Signature:
public static <T, R> Collector<T, ?, R> reducingOrElseThrow(final Function<? super T, ? extends R> mapper, final BinaryOperator<R> op) - Summary: Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, throwing a {@code NoSuchElementException} if no elements are present.
-
Contract:
- Returns a {@code Collector} that reduces the input elements using the provided mapper function and binary operator, throwing a {@code NoSuchElementException} if no elements are present.
- If no elements are present, a {@code NoSuchElementException} is thrown.
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a function to map input elements to the type used for reduction -
op(BinaryOperator<R>) — a binary operator used to reduce the mapped values
-
- Returns: a {@code Collector} which reduces the input elements
commonPrefix(...) -> Collector<CharSequence, ?, String>
-
Signature:
public static Collector<CharSequence, ?, String> commonPrefix() - Summary: Returns a {@code Collector} that computes the common prefix of input {@code CharSequence} objects, returning the result as a {@code String} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which computes the common prefix of input sequences
commonSuffix(...) -> Collector<CharSequence, ?, String>
-
Signature:
public static Collector<CharSequence, ?, String> commonSuffix() - Summary: Returns a {@code Collector} that computes the common suffix of input {@code CharSequence} objects, returning the result as a {@code String} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which computes the common suffix of input sequences
groupingBy(...) -> Collector<T, ?, Map<K, List<T>>>
-
Signature:
public static <T, K> Collector<T, ?, Map<K, List<T>>> groupingBy(final Function<? super T, ? extends K> keyMapper) - Summary: Returns a {@code Collector} that groups input elements by a classifier function, collecting the elements in each group into a {@code List} .
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys
-
- Returns: a {@code Collector} implementing the group-by operation
-
Signature:
public static <T, K, M extends Map<K, List<T>>> Collector<T, ?, M> groupingBy(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that groups input elements by a classifier function, collecting the elements in each group into a {@code List} and storing them in a map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} implementing the group-by operation
-
Signature:
public static <T, K, A, D> Collector<T, ?, Map<K, D>> groupingBy(final Function<? super T, ? extends K> keyMapper, final Collector<? super T, A, D> downstream) - Summary: Returns a {@code Collector} that groups input elements by a classifier function, and then performs a reduction operation on the values in each group using the specified downstream collector.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
downstream(Collector<? super T, A, D>) — a collector implementing the downstream reduction
-
- Returns: a {@code Collector} implementing the cascaded group-by operation
-
Signature:
public static <T, K, A, D, M extends Map<K, D>> Collector<T, ?, M> groupingBy(final Function<? super T, ? extends K> keyMapper, final Collector<? super T, A, D> downstream, final Supplier<? extends M> mapFactory) throws IllegalArgumentException - Summary: Returns a {@code Collector} that groups input elements by a classifier function, performs a reduction operation on the values in each group using the specified downstream collector, and stores the results in a map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
downstream(Collector<? super T, A, D>) — a collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} implementing the cascaded group-by operation
-
Throws:
-
java.lang.IllegalArgumentException
-
- See also: java.util.stream.Collectors#groupingBy(Function, Supplier, Collector)
groupingByConcurrent(...) -> Collector<T, ?, ConcurrentMap<K, List<T>>>
-
Signature:
public static <T, K> Collector<T, ?, ConcurrentMap<K, List<T>>> groupingByConcurrent(final Function<? super T, ? extends K> keyMapper) - Summary: Returns a concurrent {@code Collector} that groups input elements by a classifier function, collecting the elements in each group into a {@code List} .
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys
-
- Returns: a concurrent {@code Collector} implementing the group-by operation
-
Signature:
public static <T, K, M extends ConcurrentMap<K, List<T>>> Collector<T, ?, M> groupingByConcurrent(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a concurrent {@code Collector} that groups input elements by a classifier function, collecting the elements in each group into a {@code List} and storing them in a concurrent map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty concurrent map into which the results will be inserted
-
- Returns: a concurrent {@code Collector} implementing the group-by operation
-
Signature:
public static <T, K, A, D> Collector<T, ?, ConcurrentMap<K, D>> groupingByConcurrent(final Function<? super T, ? extends K> keyMapper, final Collector<? super T, A, D> downstream) - Summary: Returns a concurrent {@code Collector} that groups input elements by a classifier function, and then performs a reduction operation on the values in each group using the specified downstream collector.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
downstream(Collector<? super T, A, D>) — a collector implementing the downstream reduction
-
- Returns: a concurrent {@code Collector} implementing the cascaded group-by operation
-
Signature:
public static <T, K, A, D, M extends ConcurrentMap<K, D>> Collector<T, ?, M> groupingByConcurrent(final Function<? super T, ? extends K> keyMapper, final Collector<? super T, A, D> downstream, final Supplier<? extends M> mapFactory) throws IllegalArgumentException - Summary: Returns a concurrent {@code Collector} that groups input elements by a classifier function, performs a reduction operation on the values in each group using the specified downstream collector, and stores the results in a concurrent map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
downstream(Collector<? super T, A, D>) — a collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty concurrent map into which the results will be inserted
-
- Returns: a concurrent {@code Collector} implementing the cascaded group-by operation
-
Throws:
-
java.lang.IllegalArgumentException
-
- See also: java.util.stream.Collectors#groupingByConcurrent(Function, Supplier, Collector)
partitioningBy(...) -> Collector<T, ?, Map<Boolean, List<T>>>
-
Signature:
public static <T> Collector<T, ?, Map<Boolean, List<T>>> partitioningBy(final Predicate<? super T> predicate) - Summary: Returns a {@code Collector} that partitions the input elements according to a predicate, collecting the elements in each partition into a {@code List} .
-
Parameters:
-
predicate(Predicate<? super T>) — a predicate used for classifying input elements
-
- Returns: a {@code Collector} implementing the partitioning operation
-
Signature:
public static <T, D, A> Collector<T, ?, Map<Boolean, D>> partitioningBy(final Predicate<? super T> predicate, final Collector<? super T, A, D> downstream) - Summary: Returns a {@code Collector} that partitions the input elements according to a predicate, and then performs a reduction operation on the values in each partition using the specified downstream collector.
-
Parameters:
-
predicate(Predicate<? super T>) — a predicate used for classifying input elements -
downstream(Collector<? super T, A, D>) — a collector implementing the downstream reduction
-
- Returns: a {@code Collector} implementing the cascaded partitioning operation
countingBy(...) -> Collector<T, ?, Map<K, Long>>
-
Signature:
public static <T, K> Collector<T, ?, Map<K, Long>> countingBy(final Function<? super T, ? extends K> keyMapper) - Summary: Returns a {@code Collector} that counts the number of input elements grouped by a classifier function, storing the counts as {@code Long} values.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys
-
- Returns: a {@code Collector} implementing the counting operation
-
Signature:
public static <T, K, M extends Map<K, Long>> Collector<T, ?, M> countingBy(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that counts the number of input elements grouped by a classifier function, storing the counts as {@code Long} values in a map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} implementing the counting operation
countingToIntBy(...) -> Collector<T, ?, Map<K, Integer>>
-
Signature:
public static <T, K> Collector<T, ?, Map<K, Integer>> countingToIntBy(final Function<? super T, ? extends K> keyMapper) - Summary: Returns a {@code Collector} that counts the number of input elements grouped by a classifier function, storing the counts as {@code Integer} values.
-
Contract:
- This is useful when you know the counts will not exceed {@code Integer.MAX_VALUE} .
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys
-
- Returns: a {@code Collector} implementing the counting operation with integer results
-
Signature:
public static <T, K, M extends Map<K, Integer>> Collector<T, ?, M> countingToIntBy(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that counts the number of input elements grouped by a classifier function, storing the counts as {@code Integer} values in a map created by the provided factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a classifier function mapping input elements to keys -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} implementing the counting operation with integer results
toMap(...) -> Collector<Map.Entry<K, V>, ?, Map<K, V>>
-
Signature:
public static <K, V> Collector<Map.Entry<K, V>, ?, Map<K, V>> toMap() - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code Map} .
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
- </p> <p> <b> Null Handling: </b> Both null keys and null values are supported if the underlying map implementation allows them.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code Map}
- See also: #toMap(BinaryOperator), #toMap(Supplier), #toMap(Function, Function)
-
Signature:
public static <K, V> Collector<Map.Entry<K, V>, ?, Map<K, V>> toMap(final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code Map} , using the provided merge function to resolve collisions between values associated with the same key.
-
Contract:
- When duplicate keys are encountered, the merge function is used to combine the values.
- </p> <p> <b> Null Handling: </b> Both null keys and null values are supported if the underlying map implementation allows them.
- The merge function must handle null values if they may be present.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a merge function used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code Map}
- See also: #toMap(), #toMap(BinaryOperator, Supplier), #toMap(Function, Function, BinaryOperator)
-
Signature:
public static <K, V, M extends Map<K, V>> Collector<Map.Entry<K, V>, ?, M> toMap(final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code Map} created by the provided factory.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code Map}
-
Signature:
public static <K, V, M extends Map<K, V>> Collector<Map.Entry<K, V>, ?, M> toMap(final BinaryOperator<V> mergeFunction, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code Map} created by the provided factory, using the provided merge function to resolve collisions between values associated with the same key.
-
Contract:
- When duplicate keys are encountered, the merge function is used to combine the values.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a merge function used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty map into which the results will be inserted
-
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code Map}
-
Signature:
public static <T, K, V> Collector<T, ?, Map<K, V>> toMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates, an {@code IllegalStateException} is thrown when the collection operation is performed.
- </p> <p> <b> Null Handling: </b> Both null keys and null values are supported if the underlying map implementation allows them.
- The key and value mapper functions must handle null input elements appropriately.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into a {@code Map}
- See also: #toMap(Function, Function, BinaryOperator), #toMap(Function, Function, Supplier), #toMap(Function, Function, BinaryOperator, Supplier)
-
Signature:
public static <T, K, V> Collector<T, ?, Map<K, V>> toMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- The merge function is used to combine the existing value with the new value when duplicate keys are encountered.
- </p> <p> <b> Null Handling: </b> Both null keys and null values are supported if the underlying map implementation allows them.
- The key and value mapper functions as well as the merge function must handle null values if they may be present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
- See also: #toMap(Function, Function), #toMap(Function, Function, Supplier), #toMap(Function, Function, BinaryOperator, Supplier)
-
Signature:
public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates, an {@code IllegalStateException} is thrown when the collection operation is performed.
- </p> <p> <b> Null Handling: </b> Null keys and values are supported if the map implementation created by the factory allows them.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
- See also: #toMap(Function, Function), #toMap(Function, Function, BinaryOperator, Supplier)
-
Signature:
public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- </p> <p> <b> Null Handling: </b> Null keys and values are supported if the map implementation created by the factory allows them.
- The key mapper, value mapper, and merge function must handle null values appropriately if they may be present.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
- See also: #toMap(Function, Function), #toMap(Function, Function, BinaryOperator), #toMap(Function, Function, Supplier), #toLinkedHashMap(Function, Function, BinaryOperator), #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
toImmutableMap(...) -> Collector<Map.Entry<K, V>, ?, ImmutableMap<K, V>>
-
Signature:
public static <K, V> Collector<Map.Entry<K, V>, ?, ImmutableMap<K, V>> toImmutableMap() - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into an {@code ImmutableMap} .
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into an {@code ImmutableMap}
-
Signature:
public static <K, V> Collector<Map.Entry<K, V>, ?, ImmutableMap<K, V>> toImmutableMap(final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into an {@code ImmutableMap} with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the provided merge function is used to combine the values.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into an {@code ImmutableMap}
-
Signature:
public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into an {@code ImmutableMap} whose keys and values are the result of applying the provided mapping functions.
-
Contract:
- <p> If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into an {@code ImmutableMap}
-
Signature:
public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into an {@code ImmutableMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys.
-
Contract:
- <p> When duplicate keys are encountered, the provided merge function is used to combine the values.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into an {@code ImmutableMap}
toUnmodifiableMap(...) -> Collector<T, ?, Map<K, U>>
-
Signature:
public static <T, K, U> Collector<T, ?, Map<K, U>> toUnmodifiableMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends U> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into an unmodifiable {@code Map} whose keys and values are the result of applying the provided mapping functions.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends U>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into an unmodifiable {@code Map}
- See also: java.util.stream.Collectors#toUnmodifiableMap(Function, Function)
-
Signature:
public static <T, K, U> Collector<T, ?, Map<K, U>> toUnmodifiableMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends U> valueMapper, final BinaryOperator<U> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into an unmodifiable {@code Map} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the provided merge function is used to combine values.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends U>) — a mapping function to produce values -
mergeFunction(BinaryOperator<U>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into an unmodifiable {@code Map}
- See also: java.util.stream.Collectors#toUnmodifiableMap(Function, Function, BinaryOperator)
toLinkedHashMap(...) -> Collector<T, ?, Map<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, Map<K, V>> toLinkedHashMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code LinkedHashMap} whose keys and values are the result of applying the provided mapping functions.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into a {@code LinkedHashMap}
- See also: #toMap(Function, Function)
-
Signature:
public static <T, K, V> Collector<T, ?, Map<K, V>> toLinkedHashMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into a {@code LinkedHashMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the provided merge function is used to combine the values.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into a {@code LinkedHashMap}
- See also: #toMap(Function, Function, BinaryOperator)
toConcurrentMap(...) -> Collector<T, ?, ConcurrentMap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, ConcurrentMap<K, V>> toConcurrentMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ConcurrentMap} whose keys and values are the result of applying the provided mapping functions.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into a {@code ConcurrentMap}
-
Signature:
public static <T, K, V, M extends ConcurrentMap<K, V>> Collector<T, ?, M> toConcurrentMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ConcurrentMap} whose keys and values are the result of applying the provided mapping functions, using the specified map factory.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code ConcurrentMap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code ConcurrentMap}
-
Signature:
public static <T, K, V> Collector<T, ?, ConcurrentMap<K, V>> toConcurrentMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ConcurrentMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys.
-
Contract:
- When duplicate keys are encountered, the provided merge function is used to combine the values.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into a {@code ConcurrentMap}
-
Signature:
public static <T, K, V, M extends ConcurrentMap<K, V>> Collector<T, ?, M> toConcurrentMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ConcurrentMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys and a specified map factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code ConcurrentMap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code ConcurrentMap}
toBiMap(...) -> Collector<T, ?, BiMap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, BiMap<K, V>> toBiMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code BiMap} whose keys and values are the result of applying the provided mapping functions.
-
Contract:
- If duplicate keys or values are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into a {@code BiMap}
-
Signature:
public static <T, K, V> Collector<T, ?, BiMap<K, V>> toBiMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final Supplier<BiMap<K, V>> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code BiMap} whose keys and values are the result of applying the provided mapping functions, using the specified map factory.
-
Contract:
- If duplicate keys or values are encountered, an {@code IllegalStateException} is thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mapFactory(Supplier<BiMap<K, V>>) — a supplier providing a new empty {@code BiMap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code BiMap}
-
Signature:
public static <T, K, V> Collector<T, ?, BiMap<K, V>> toBiMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Collector} that accumulates elements into a {@code BiMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys.
-
Contract:
- <p> When duplicate keys are encountered, the provided merge function is used to combine the values.
- Note that the resulting value must still be unique across the map, or an {@code IllegalStateException} will be thrown.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Collector} which collects elements into a {@code BiMap}
-
Signature:
public static <T, K, V> Collector<T, ?, BiMap<K, V>> toBiMap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final BinaryOperator<V> mergeFunction, final Supplier<BiMap<K, V>> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code BiMap} whose keys and values are the result of applying the provided mapping functions, with a merge function to handle duplicate keys and a specified map factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<BiMap<K, V>>) — a supplier providing a new empty {@code BiMap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code BiMap}
toMultimap(...) -> Collector<Map.Entry<K, V>, ?, ListMultimap<K, V>>
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V> Collector<Map.Entry<K, V>, ?, ListMultimap<K, V>> toMultimap() - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code ListMultimap} .
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code ListMultimap}
-
Signature:
@SuppressWarnings("rawtypes") public static <K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<Map.Entry<K, V>, ?, M> toMultimap( final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates {@code Map.Entry} elements into a {@code Multimap} using the specified map factory.
-
Parameters:
-
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects {@code Map.Entry} elements into a {@code Multimap}
-
Signature:
public static <T, K> Collector<T, ?, ListMultimap<K, T>> toMultimap(final Function<? super T, ? extends K> keyMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} whose keys are the result of applying the provided mapping function to the input elements.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap}
-
Signature:
public static <T, K, C extends Collection<T>, M extends Multimap<K, T, C>> Collector<T, ?, M> toMultimap(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Multimap} whose keys are the result of applying the provided mapping function to the input elements, using the specified map factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Multimap}
-
Signature:
public static <T, K, V> Collector<T, ?, ListMultimap<K, V>> toMultimap(final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap}
-
Signature:
public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T, ?, M> toMultimap( final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Multimap} whose keys and values are the result of applying the provided mapping functions to the input elements, using the specified map factory.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — a mapping function to produce keys -
valueMapper(Function<? super T, ? extends V>) — a mapping function to produce values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Multimap}
flatMappingValueToMultimap(...) -> Collector<T, ?, ListMultimap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, ListMultimap<K, V>> flatMappingValueToMultimap(final Function<? super T, K> keyMapper, final Function<? super T, ? extends Stream<? extends V>> flatValueExtractor) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} by applying a key mapping function and a flat mapping function that produces multiple values for each input element.
-
Contract:
- <p> This collector is useful when each input element needs to be mapped to multiple values for the same key.
- The flat value extractor should return a {@code Stream} of values for each input element.
-
Parameters:
-
keyMapper(Function<? super T, K>) — a mapping function to produce keys -
flatValueExtractor(Function<? super T, ? extends Stream<? extends V>>) — a function that returns a stream of values for each element
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap}
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T, ?, M> flatMappingValueToMultimap( final Function<? super T, K> keyMapper, final Function<? super T, ? extends Stream<? extends V>> flatValueExtractor, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Multimap} by applying a key mapping function and a flat mapping function that produces multiple values for each input element, using the specified map factory.
-
Contract:
- The flat value extractor should return a {@code Stream} of values for each input element.
-
Parameters:
-
keyMapper(Function<? super T, K>) — a mapping function to produce keys -
flatValueExtractor(Function<? super T, ? extends Stream<? extends V>>) — a function that returns a stream of values for each element -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Multimap}
- See also: Collectors#toMultimap(Function, Function, Supplier)
flatmappingValueToMultimap(...) -> Collector<T, ?, ListMultimap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, ListMultimap<K, V>> flatmappingValueToMultimap(final Function<? super T, K> keyMapper, // NOSONAR final Function<? super T, ? extends Collection<? extends V>> flatValueExtractor) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} by applying a key mapping function and a flat mapping function that produces a collection of values for each input element.
-
Parameters:
-
keyMapper(Function<? super T, K>) — a mapping function to produce keys -
flatValueExtractor(Function<? super T, ? extends Collection<? extends V>>) — a function that returns a collection of values for each element
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap}
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T, ?, M> flatmappingValueToMultimap( // NOSONAR final Function<? super T, K> keyMapper, final Function<? super T, ? extends Collection<? extends V>> flatValueExtractor, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a {@code Multimap} by applying a key mapping function and a flat mapping function that produces a collection of values for each input element, using the specified map factory.
-
Parameters:
-
keyMapper(Function<? super T, K>) — a mapping function to produce keys -
flatValueExtractor(Function<? super T, ? extends Collection<? extends V>>) — a function that returns a collection of values for each element -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a {@code Multimap}
- See also: Collectors#toMultimap(Function, Function, Supplier)
flatMappingKeyToMultimap(...) -> Collector<T, ?, ListMultimap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, ListMultimap<K, V>> flatMappingKeyToMultimap(final Function<? super T, Stream<? extends K>> flatKeyExtractor, final Function<? super T, V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} by extracting multiple keys from each element using a flat mapping function.
-
Contract:
- <p> This collector is useful when each input element can be associated with multiple keys.
- </p> <p> For parallel streams, the sequential processing of keys ensures thread safety when populating the multimap.
-
Parameters:
-
flatKeyExtractor(Function<? super T, Stream<? extends K>>) — a function that extracts a stream of keys from each element -
valueMapper(Function<? super T, V>) — a function to produce values for the multimap
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap} using flat key extraction
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T, ?, M> flatMappingKeyToMultimap( final Function<? super T, Stream<? extends K>> flatKeyExtractor, final Function<? super T, V> valueMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a custom {@code Multimap} implementation by extracting multiple keys from each element using a flat mapping function.
-
Contract:
- </p> <p> For parallel streams, the sequential processing of keys ensures thread safety when populating the multimap.
-
Parameters:
-
flatKeyExtractor(Function<? super T, Stream<? extends K>>) — a function that extracts a stream of keys from each element -
valueMapper(Function<? super T, V>) — a function to produce values for the multimap -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty multimap into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a multimap using flat key extraction
- See also: Collectors#toMultimap(Function, Function, Supplier)
flatmappingKeyToMultimap(...) -> Collector<T, ?, ListMultimap<K, V>>
-
Signature:
public static <T, K, V> Collector<T, ?, ListMultimap<K, V>> flatmappingKeyToMultimap( // NOSONAR final Function<? super T, ? extends Collection<? extends K>> flatKeyExtractor, final Function<? super T, V> valueMapper) - Summary: Returns a {@code Collector} that accumulates elements into a {@code ListMultimap} by extracting multiple keys from each element using a collection-based mapping function.
-
Contract:
- This can be more convenient when the keys are already available as a collection.
-
Parameters:
-
flatKeyExtractor(Function<? super T, ? extends Collection<? extends K>>) — a function that extracts a collection of keys from each element -
valueMapper(Function<? super T, V>) — a function to produce values for the multimap
-
- Returns: a {@code Collector} which collects elements into a {@code ListMultimap} using collection-based key extraction
- See also: Collectors#toMultimap(Function, Function)
-
Signature:
public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T, ?, M> flatmappingKeyToMultimap( // NOSONAR final Function<? super T, ? extends Collection<? extends K>> flatKeyExtractor, final Function<? super T, V> valueMapper, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Collector} that accumulates elements into a custom {@code Multimap} implementation by extracting multiple keys from each element using a collection-based mapping function.
-
Parameters:
-
flatKeyExtractor(Function<? super T, ? extends Collection<? extends K>>) — a function that extracts a collection of keys from each element -
valueMapper(Function<? super T, V>) — a function to produce values for the multimap -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty multimap into which the results will be inserted
-
- Returns: a {@code Collector} which collects elements into a multimap using collection-based key extraction
- See also: Collectors#toMultimap(Function, Function, Supplier)
teeing(...) -> Collector<T, ?, R>
-
Signature:
public static <T, R1, R2, R> Collector<T, ?, R> teeing(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final BiFunction<? super R1, ? super R2, R> merger) - Summary: Returns a {@code Collector} that performs a reduction of its input elements under two specified downstream collectors, then merges their results using the provided merger function.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first downstream collector -
downstream2(Collector<? super T, ?, R2>) — the second downstream collector -
merger(BiFunction<? super R1, ? super R2, R>) — a function to merge the results of the two downstream collectors
-
- Returns: a {@code Collector} which performs the reduction of its input elements under the two downstream collectors and merges the results
Public Instance Methods
- (none)
Class MoreCollectors (com.landawn.abacus.util.stream.Collectors.MoreCollectors)
Extended collector factory providing advanced collectors for multi-value operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
summingInt(...) -> Collector<T, ?, Tuple2<Integer, Integer>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Integer, Integer>> summingInt(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two integer-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple integer sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to sum -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums
-
Signature:
public static <T> Collector<T, ?, Tuple3<Integer, Integer, Integer>> summingInt(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper, final ToIntFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three integer-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple integer sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to sum -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to sum -
thirdMapper(ToIntFunction<? super T>) — a function extracting the third integer property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums
summingIntToLong(...) -> Collector<T, ?, Tuple2<Long, Long>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Long, Long>> summingIntToLong(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two integer-valued functions applied to the input elements, with the results widened to {@code long} .
-
Contract:
- This is particularly useful when summing values that might exceed the range of {@code int} .
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to sum -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums as longs
-
Signature:
public static <T> Collector<T, ?, Tuple3<Long, Long, Long>> summingIntToLong(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper, final ToIntFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three integer-valued functions applied to the input elements, with the results widened to {@code long} .
-
Contract:
- This is particularly useful when summing values that might exceed the range of {@code int} .
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to sum -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to sum -
thirdMapper(ToIntFunction<? super T>) — a function extracting the third integer property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums as longs
summingLong(...) -> Collector<T, ?, Tuple2<Long, Long>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Long, Long>> summingLong(final ToLongFunction<? super T> firstMapper, final ToLongFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two long-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple long sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToLongFunction<? super T>) — a function extracting the first long property to sum -
secondMapper(ToLongFunction<? super T>) — a function extracting the second long property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums
-
Signature:
public static <T> Collector<T, ?, Tuple3<Long, Long, Long>> summingLong(final ToLongFunction<? super T> firstMapper, final ToLongFunction<? super T> secondMapper, final ToLongFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three long-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple long sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToLongFunction<? super T>) — a function extracting the first long property to sum -
secondMapper(ToLongFunction<? super T>) — a function extracting the second long property to sum -
thirdMapper(ToLongFunction<? super T>) — a function extracting the third long property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums
summingDouble(...) -> Collector<T, ?, Tuple2<Double, Double>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Double, Double>> summingDouble(final ToDoubleFunction<? super T> firstMapper, final ToDoubleFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two double-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple double sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToDoubleFunction<? super T>) — a function extracting the first double property to sum -
secondMapper(ToDoubleFunction<? super T>) — a function extracting the second double property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums
-
Signature:
public static <T> Collector<T, ?, Tuple3<Double, Double, Double>> summingDouble(final ToDoubleFunction<? super T> firstMapper, final ToDoubleFunction<? super T> secondMapper, final ToDoubleFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three double-valued functions applied to the input elements.
-
Contract:
- This is useful when you need to calculate multiple double sums from the same stream in a single pass.
-
Parameters:
-
firstMapper(ToDoubleFunction<? super T>) — a function extracting the first double property to sum -
secondMapper(ToDoubleFunction<? super T>) — a function extracting the second double property to sum -
thirdMapper(ToDoubleFunction<? super T>) — a function extracting the third double property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums
summingBigInteger(...) -> Collector<T, ?, Tuple2<BigInteger, BigInteger>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<BigInteger, BigInteger>> summingBigInteger(final Function<? super T, BigInteger> firstMapper, final Function<? super T, BigInteger> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two {@code BigInteger} -valued functions applied to the input elements.
-
Parameters:
-
firstMapper(Function<? super T, BigInteger>) — a function extracting the first BigInteger property to sum -
secondMapper(Function<? super T, BigInteger>) — a function extracting the second BigInteger property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums
-
Signature:
public static <T> Collector<T, ?, Tuple3<BigInteger, BigInteger, BigInteger>> summingBigInteger(final Function<? super T, BigInteger> firstMapper, final Function<? super T, BigInteger> secondMapper, final Function<? super T, BigInteger> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three {@code BigInteger} -valued functions applied to the input elements.
-
Parameters:
-
firstMapper(Function<? super T, BigInteger>) — a function extracting the first BigInteger property to sum -
secondMapper(Function<? super T, BigInteger>) — a function extracting the second BigInteger property to sum -
thirdMapper(Function<? super T, BigInteger>) — a function extracting the third BigInteger property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums
summingBigDecimal(...) -> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>> summingBigDecimal(final Function<? super T, BigDecimal> firstMapper, final Function<? super T, BigDecimal> secondMapper) - Summary: Returns a {@code Collector} that computes the sum of two {@code BigDecimal} -valued functions applied to the input elements.
-
Parameters:
-
firstMapper(Function<? super T, BigDecimal>) — a function extracting the first BigDecimal property to sum -
secondMapper(Function<? super T, BigDecimal>) — a function extracting the second BigDecimal property to sum
-
- Returns: a {@code Collector} that produces a tuple of the two sums
-
Signature:
public static <T> Collector<T, ?, Tuple3<BigDecimal, BigDecimal, BigDecimal>> summingBigDecimal(final Function<? super T, BigDecimal> firstMapper, final Function<? super T, BigDecimal> secondMapper, final Function<? super T, BigDecimal> thirdMapper) - Summary: Returns a {@code Collector} that computes the sum of three {@code BigDecimal} -valued functions applied to the input elements.
-
Parameters:
-
firstMapper(Function<? super T, BigDecimal>) — a function extracting the first BigDecimal property to sum -
secondMapper(Function<? super T, BigDecimal>) — a function extracting the second BigDecimal property to sum -
thirdMapper(Function<? super T, BigDecimal>) — a function extracting the third BigDecimal property to sum
-
- Returns: a {@code Collector} that produces a tuple of the three sums
averagingInt(...) -> Collector<T, ?, Tuple2<Double, Double>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Double, Double>> averagingInt(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of two integer-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, both averages will be 0.0.
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to average -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to average
-
- Returns: a {@code Collector} that produces a tuple of the two averages
-
Signature:
public static <T> Collector<T, ?, Tuple3<Double, Double, Double>> averagingInt(final ToIntFunction<? super T> firstMapper, final ToIntFunction<? super T> secondMapper, final ToIntFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of three integer-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, all averages will be 0.0.
-
Parameters:
-
firstMapper(ToIntFunction<? super T>) — a function extracting the first integer property to average -
secondMapper(ToIntFunction<? super T>) — a function extracting the second integer property to average -
thirdMapper(ToIntFunction<? super T>) — a function extracting the third integer property to average
-
- Returns: a {@code Collector} that produces a tuple of the three averages
averagingLong(...) -> Collector<T, ?, Tuple2<Double, Double>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Double, Double>> averagingLong(final ToLongFunction<? super T> firstMapper, final ToLongFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of two long-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, both averages will be 0.0.
-
Parameters:
-
firstMapper(ToLongFunction<? super T>) — a function extracting the first long property to average -
secondMapper(ToLongFunction<? super T>) — a function extracting the second long property to average
-
- Returns: a {@code Collector} that produces a tuple of the two averages
-
Signature:
public static <T> Collector<T, ?, Tuple3<Double, Double, Double>> averagingLong(final ToLongFunction<? super T> firstMapper, final ToLongFunction<? super T> secondMapper, final ToLongFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of three long-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, all averages will be 0.0.
-
Parameters:
-
firstMapper(ToLongFunction<? super T>) — a function extracting the first long property to average -
secondMapper(ToLongFunction<? super T>) — a function extracting the second long property to average -
thirdMapper(ToLongFunction<? super T>) — a function extracting the third long property to average
-
- Returns: a {@code Collector} that produces a tuple of the three averages
averagingDouble(...) -> Collector<T, ?, Tuple2<Double, Double>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<Double, Double>> averagingDouble(final ToDoubleFunction<? super T> firstMapper, final ToDoubleFunction<? super T> secondMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of two double-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, both averages will be 0.0.
-
Parameters:
-
firstMapper(ToDoubleFunction<? super T>) — a function extracting the first double property to average -
secondMapper(ToDoubleFunction<? super T>) — a function extracting the second double property to average
-
- Returns: a {@code Collector} that produces a tuple of the two averages
-
Signature:
public static <T> Collector<T, ?, Tuple3<Double, Double, Double>> averagingDouble(final ToDoubleFunction<? super T> firstMapper, final ToDoubleFunction<? super T> secondMapper, final ToDoubleFunction<? super T> thirdMapper) - Summary: Returns a {@code Collector} that computes the arithmetic mean of three double-valued functions applied to the input elements.
-
Contract:
- If no elements are collected, all averages will be 0.0.
-
Parameters:
-
firstMapper(ToDoubleFunction<? super T>) — a function extracting the first double property to average -
secondMapper(ToDoubleFunction<? super T>) — a function extracting the second double property to average -
thirdMapper(ToDoubleFunction<? super T>) — a function extracting the third double property to average
-
- Returns: a {@code Collector} that produces a tuple of the three averages
averagingBigInteger(...) -> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>> averagingBigInteger(final Function<? super T, BigInteger> firstMapper, final Function<? super T, BigInteger> secondMapper) - Summary: Returns a {@code Collector} that calculates the average of {@code BigInteger} values extracted by two mapping functions from the input elements.
-
Contract:
- <p> This collector is useful when you need to compute averages of very large integer values that might exceed the range of primitive types.
- If no elements are collected, all averages will be BigDecimal.ZERO.
-
Parameters:
-
firstMapper(Function<? super T, BigInteger>) — a function extracting the first {@code BigInteger} value from an element -
secondMapper(Function<? super T, BigInteger>) — a function extracting the second {@code BigInteger} value from an element
-
- Returns: a {@code Collector} which calculates the averages of the extracted values as a {@code Tuple2<BigDecimal, BigDecimal>}
-
Signature:
public static <T> Collector<T, ?, Tuple3<BigDecimal, BigDecimal, BigDecimal>> averagingBigInteger(final Function<? super T, BigInteger> firstMapper, final Function<? super T, BigInteger> secondMapper, final Function<? super T, BigInteger> thirdMapper) - Summary: Returns a {@code Collector} that calculates the average of {@code BigInteger} values extracted by three mapping functions from the input elements.
-
Contract:
- <p> This collector is useful when you need to compute averages of very large integer values for multiple properties simultaneously.
- If no elements are collected, all averages will be BigDecimal.ZERO.
-
Parameters:
-
firstMapper(Function<? super T, BigInteger>) — a function extracting the first {@code BigInteger} value from an element -
secondMapper(Function<? super T, BigInteger>) — a function extracting the second {@code BigInteger} value from an element -
thirdMapper(Function<? super T, BigInteger>) — a function extracting the third {@code BigInteger} value from an element
-
- Returns: a {@code Collector} which calculates the averages of the extracted values as a {@code Tuple3<BigDecimal, BigDecimal, BigDecimal>}
averagingBigDecimal(...) -> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>>
-
Signature:
public static <T> Collector<T, ?, Tuple2<BigDecimal, BigDecimal>> averagingBigDecimal(final Function<? super T, BigDecimal> firstMapper, final Function<? super T, BigDecimal> secondMapper) - Summary: Returns a {@code Collector} that calculates the average of {@code BigDecimal} values extracted by two mapping functions from the input elements.
-
Contract:
- <p> This collector is useful when you need to compute averages of decimal values with arbitrary precision.
- If no elements are collected, all averages will be BigDecimal.ZERO.
-
Parameters:
-
firstMapper(Function<? super T, BigDecimal>) — a function extracting the first {@code BigDecimal} value from an element -
secondMapper(Function<? super T, BigDecimal>) — a function extracting the second {@code BigDecimal} value from an element
-
- Returns: a {@code Collector} which calculates the averages of the extracted values as a {@code Tuple2<BigDecimal, BigDecimal>}
-
Signature:
public static <T> Collector<T, ?, Tuple3<BigDecimal, BigDecimal, BigDecimal>> averagingBigDecimal(final Function<? super T, BigDecimal> firstMapper, final Function<? super T, BigDecimal> secondMapper, final Function<? super T, BigDecimal> thirdMapper) - Summary: Returns a {@code Collector} that calculates the average of {@code BigDecimal} values extracted by three mapping functions from the input elements.
-
Contract:
- <p> This collector is useful when you need to compute averages of decimal values for multiple properties simultaneously with arbitrary precision.
- If no elements are collected, all averages will be BigDecimal.ZERO.
-
Parameters:
-
firstMapper(Function<? super T, BigDecimal>) — a function extracting the first {@code BigDecimal} value from an element -
secondMapper(Function<? super T, BigDecimal>) — a function extracting the second {@code BigDecimal} value from an element -
thirdMapper(Function<? super T, BigDecimal>) — a function extracting the third {@code BigDecimal} value from an element
-
- Returns: a {@code Collector} which calculates the averages of the extracted values as a {@code Tuple3<BigDecimal, BigDecimal, BigDecimal>}
combine(...) -> Collector<T, ?, Tuple2<R1, R2>>
-
Signature:
public static <T, R1, R2> Collector<T, ?, Tuple2<R1, R2>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2) - Summary: Returns a {@code Collector} that combines the results of two component collectors into a {@code Tuple2} .
-
Contract:
- <p> This collector is useful when you need to perform two different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector
-
- Returns: a {@code Collector} which combines the results of two component collectors into a {@code Tuple2<R1, R2>}
-
Signature:
public static <T, R1, R2, R3> Collector<T, ?, Tuple3<R1, R2, R3>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3) - Summary: Returns a {@code Collector} that combines the results of three component collectors into a {@code Tuple3} .
-
Contract:
- <p> This collector is useful when you need to perform three different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector
-
- Returns: a {@code Collector} which combines the results of three component collectors into a {@code Tuple3<R1, R2, R3>}
-
Signature:
public static <T, R1, R2, R3, R4> Collector<T, ?, Tuple4<R1, R2, R3, R4>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final Collector<? super T, ?, R4> downstream4) - Summary: Returns a {@code Collector} that combines the results of four component collectors into a {@code Tuple4} .
-
Contract:
- <p> This collector is useful when you need to perform four different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
downstream4(Collector<? super T, ?, R4>) — the fourth component collector
-
- Returns: a {@code Collector} which combines the results of four component collectors into a {@code Tuple4<R1, R2, R3, R4>}
-
Signature:
public static <T, R1, R2, R3, R4, R5> Collector<T, ?, Tuple5<R1, R2, R3, R4, R5>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final Collector<? super T, ?, R4> downstream4, final Collector<? super T, ?, R5> downstream5) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of five component collectors into a {@code Tuple5} .
-
Contract:
- <p> This collector is useful when you need to perform five different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
downstream4(Collector<? super T, ?, R4>) — the fourth component collector -
downstream5(Collector<? super T, ?, R5>) — the fifth component collector
-
- Returns: a {@code Collector} which combines the results of five component collectors into a {@code Tuple5<R1, R2, R3, R4, R5>}
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector is null
-
-
Signature:
public static <T, R1, R2, R3, R4, R5, R6> Collector<T, ?, Tuple6<R1, R2, R3, R4, R5, R6>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final Collector<? super T, ?, R4> downstream4, final Collector<? super T, ?, R5> downstream5, final Collector<? super T, ?, R6> downstream6) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of six component collectors into a {@code Tuple6} .
-
Contract:
- <p> This collector is useful when you need to perform six different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
downstream4(Collector<? super T, ?, R4>) — the fourth component collector -
downstream5(Collector<? super T, ?, R5>) — the fifth component collector -
downstream6(Collector<? super T, ?, R6>) — the sixth component collector
-
- Returns: a {@code Collector} which combines the results of six component collectors into a {@code Tuple6<R1, R2, R3, R4, R5, R6>}
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector is null
-
-
Signature:
public static <T, R1, R2, R3, R4, R5, R6, R7> Collector<T, ?, Tuple7<R1, R2, R3, R4, R5, R6, R7>> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final Collector<? super T, ?, R4> downstream4, final Collector<? super T, ?, R5> downstream5, final Collector<? super T, ?, R6> downstream6, final Collector<? super T, ?, R7> downstream7) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of seven component collectors into a {@code Tuple7} .
-
Contract:
- <p> This collector is useful when you need to perform seven different collection operations on the same stream of elements in a single pass.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
downstream4(Collector<? super T, ?, R4>) — the fourth component collector -
downstream5(Collector<? super T, ?, R5>) — the fifth component collector -
downstream6(Collector<? super T, ?, R6>) — the sixth component collector -
downstream7(Collector<? super T, ?, R7>) — the seventh component collector
-
- Returns: a {@code Collector} which combines the results of seven component collectors into a {@code Tuple7<R1, R2, R3, R4, R5, R6, R7>}
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector is null
-
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R1, R2, R> Collector<T, ?, R> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final BiFunction<? super R1, ? super R2, R> merger) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of two component collectors using a specified merger function.
-
Contract:
- <p> This collector is useful when you need to perform two different collection operations on the same stream of elements and combine their results in a custom way.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
merger(BiFunction<? super R1, ? super R2, R>) — a function to merge the results of the two component collectors
-
- Returns: a {@code Collector} which combines the results of two component collectors using the merger function
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector or merger is null
-
-
Signature:
@SuppressWarnings("rawtypes") public static <T, R1, R2, R3, R> Collector<T, ?, R> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final TriFunction<? super R1, ? super R2, ? super R3, R> merger) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of three component collectors using a specified merger function.
-
Contract:
- <p> This collector is useful when you need to perform three different collection operations on the same stream of elements and combine their results in a custom way.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
merger(TriFunction<? super R1, ? super R2, ? super R3, R>) — a function to merge the results of the three component collectors
-
- Returns: a {@code Collector} which combines the results of three component collectors using the merger function
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector or merger is null
-
-
Signature:
public static <T, R1, R2, R3, R4, R> Collector<T, ?, R> combine(final Collector<? super T, ?, R1> downstream1, final Collector<? super T, ?, R2> downstream2, final Collector<? super T, ?, R3> downstream3, final Collector<? super T, ?, R4> downstream4, final QuadFunction<? super R1, ? super R2, ? super R3, ? super R4, R> merger) throws IllegalArgumentException - Summary: Returns a {@code Collector} that combines the results of four component collectors using a specified merger function.
-
Contract:
- <p> This collector is useful when you need to perform four different collection operations on the same stream of elements and combine their results in a custom way.
-
Parameters:
-
downstream1(Collector<? super T, ?, R1>) — the first component collector -
downstream2(Collector<? super T, ?, R2>) — the second component collector -
downstream3(Collector<? super T, ?, R3>) — the third component collector -
downstream4(Collector<? super T, ?, R4>) — the fourth component collector -
merger(QuadFunction<? super R1, ? super R2, ? super R3, ? super R4, R>) — a function to merge the results of the four component collectors
-
- Returns: a {@code Collector} which combines the results of four component collectors using the merger function
-
Throws:
-
java.lang.IllegalArgumentException— if any component collector or merger is null
-
-
Signature:
public static <T, R> Collector<T, ?, R> combine(final Collection<? extends Collector<? super T, ?, ?>> downstreams, final Function<Object[], R> merger) - Summary: Returns a {@code Collector} that combines the results of multiple component collectors using a specified merger function.
-
Contract:
- <p> This collector is useful when you need to perform multiple different collection operations on the same stream of elements and combine their results in a custom way.
-
Parameters:
-
downstreams(Collection<? extends Collector<? super T, ?, ?>>) — a collection of component collectors to combine -
merger(Function<Object[], R>) — a function to merge the results array from all component collectors
-
- Returns: a {@code Collector} which combines the results of multiple component collectors using the merger function
toDataset(...) -> Collector<T, ?, Dataset>
-
Signature:
public static <T> Collector<T, ?, Dataset> toDataset() - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Dataset} .
-
Contract:
- <p> This collector is useful when you need to convert a stream of elements into a {@code Dataset} structure.
-
Parameters:
- (none)
- Returns: a {@code Collector} which collects all input elements into a {@code Dataset}
-
Signature:
public static <T> Collector<T, ?, Dataset> toDataset(final List<String> columnNames) - Summary: Returns a {@code Collector} that accumulates the input elements into a new {@code Dataset} with specified column names.
-
Contract:
- <p> This collector is useful when you need to convert a stream of elements into a {@code Dataset} structure with explicitly specified column names.
- If column names are not provided (null), they will be auto-generated based on the element structure.
-
Parameters:
-
columnNames(List<String>) — the names of columns for the resulting {@code Dataset} , or {@code null} for auto-generated names
-
- Returns: a {@code Collector} which collects all input elements into a {@code Dataset} with the specified column names
Public Instance Methods
- (none)
Class DoubleIteratorEx (com.landawn.abacus.util.stream.DoubleIteratorEx)
An extended iterator over primitive double values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> DoubleIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static DoubleIteratorEx empty() - Summary: Returns an empty DoubleIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty DoubleIteratorEx instance
of(...) -> DoubleIteratorEx
-
Signature:
public static DoubleIteratorEx of(final double... a) - Summary: Creates a DoubleIteratorEx from the given double array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(double[]) — the double array to iterate over (can be {@code null} or empty)
-
- Returns: a DoubleIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static DoubleIteratorEx of(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a DoubleIteratorEx from a portion of the given double array.
-
Parameters:
-
a(double[]) — the double array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a DoubleIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static DoubleIteratorEx of(final DoubleIterator iter) - Summary: Wraps a DoubleIterator as a DoubleIteratorEx.
-
Contract:
- If the iterator is already a DoubleIteratorEx, it is returned as-is.
-
Parameters:
-
iter(DoubleIterator) — the DoubleIterator to wrap (can be null)
-
- Returns: a DoubleIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> DoubleIteratorEx
-
Signature:
public static DoubleIteratorEx from(final Iterator<Double> iter) - Summary: Creates a DoubleIteratorEx from an Iterator of Double objects.
-
Parameters:
-
iter(Iterator<Double>) — the Iterator of Double objects (can be null)
-
- Returns: a DoubleIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class DoubleStream (com.landawn.abacus.util.stream.DoubleStream)
A specialized stream implementation for processing sequences of double values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> DoubleStream
-
Signature:
public static DoubleStream empty() - Summary: Returns an empty DoubleStream.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleStream empty = DoubleStream.empty(); empty.count(); // Returns 0 // Use as default when no data available DoubleStream stream = hasData ?
-
Parameters:
- (none)
- Returns: an empty DoubleStream
defer(...) -> DoubleStream
-
Signature:
public static DoubleStream defer(final Supplier<DoubleStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Defer expensive computation until needed DoubleStream deferred = DoubleStream.defer(() -> { // This code only runs when stream is consumed double\[\] expensiveData = loadDataFromDatabase(); return DoubleStream.of(expensiveData); }); // Conditional stream creation DoubleStream conditionalStream = DoubleStream.defer(() -> useCache ?
-
Parameters:
-
supplier(Supplier<DoubleStream>) — the supplier that provides the DoubleStream
-
- Returns: a new DoubleStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
from(...) -> DoubleStream
-
Signature:
public static DoubleStream from(final java.util.stream.DoubleStream stream) - Summary: Creates a DoubleStream from a java.util.stream.DoubleStream.
-
Contract:
- The input stream will be closed when the returned stream is closed.
-
Parameters:
-
stream(java.util.stream.DoubleStream) — the java.util.stream.DoubleStream to convert
-
- Returns: a new DoubleStream containing the same elements, or empty stream if input is null
ofNullable(...) -> DoubleStream
-
Signature:
public static DoubleStream ofNullable(final Double e) - Summary: Creates a DoubleStream containing the specified {@code nullable} Double element.
-
Contract:
- If the element is {@code null} , an empty stream is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Non-null value creates single element stream DoubleStream.ofNullable(5.5).count(); // Returns 1 // Null value creates empty stream DoubleStream.ofNullable(null).count(); // Returns 0 // Use when value might be null Double value = getValue(); // May return null DoubleStream.ofNullable(value) .forEach(System.out::println); // Only prints if value is non-null } </pre>
-
Parameters:
-
e(Double) — the {@code nullable} Double element
-
- Returns: a DoubleStream containing the element if {@code non-null} , otherwise an empty stream
of(...) -> DoubleStream
-
Signature:
public static DoubleStream of(final double... a) - Summary: Creates a DoubleStream from the specified double array.
-
Parameters:
-
a(double[]) — the double array
-
- Returns: a DoubleStream containing the elements of the array, or empty stream if array is {@code null} or empty
-
Signature:
public static DoubleStream of(final double[] a, final int fromIndex, final int toIndex) - Summary: Creates a DoubleStream from a portion of the specified double array.
-
Parameters:
-
a(double[]) — the double array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a DoubleStream containing the specified range of elements
-
Signature:
public static DoubleStream of(final Double[] a) - Summary: Creates a DoubleStream from the specified Double array.
-
Parameters:
-
a(Double[]) — the Double array
-
- Returns: a DoubleStream containing the unboxed elements of the array
-
Signature:
public static DoubleStream of(final Double[] a, final int fromIndex, final int toIndex) - Summary: Creates a DoubleStream from a portion of the specified Double array.
-
Parameters:
-
a(Double[]) — the Double array -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a DoubleStream containing the unboxed elements from the specified range
-
Signature:
public static DoubleStream of(final Collection<Double> c) - Summary: Creates a DoubleStream from the specified Collection of Double.
-
Parameters:
-
c(Collection<Double>) — the Collection of Double
-
- Returns: a DoubleStream containing the unboxed elements of the collection
-
Signature:
public static DoubleStream of(final DoubleIterator iterator) - Summary: Creates a DoubleStream from the specified DoubleIterator.
-
Parameters:
-
iterator(DoubleIterator) — the DoubleIterator
-
- Returns: a DoubleStream containing the elements from the iterator, or empty stream if iterator is null
-
Signature:
@Deprecated public static DoubleStream of(final java.util.stream.DoubleStream stream) - Summary: Creates a DoubleStream from a java.util.stream.DoubleStream.
-
Parameters:
-
stream(java.util.stream.DoubleStream) — the java.util.stream.DoubleStream to convert
-
- Returns: a new DoubleStream containing the same elements
-
Signature:
public static DoubleStream of(final DoubleBuffer buf) - Summary: Creates a DoubleStream from the specified DoubleBuffer.
-
Parameters:
-
buf(DoubleBuffer) — the DoubleBuffer
-
- Returns: a DoubleStream containing the elements from the buffer, or empty stream if buffer is null
-
Signature:
public static DoubleStream of(final OptionalDouble op) - Summary: Creates a DoubleStream from the specified OptionalDouble.
-
Parameters:
-
op(OptionalDouble) — the OptionalDouble
-
- Returns: a DoubleStream containing the value if present, otherwise an empty stream
-
Signature:
public static DoubleStream of(final java.util.OptionalDouble op) - Summary: Creates a DoubleStream from the specified java.util.OptionalDouble.
-
Parameters:
-
op(java.util.OptionalDouble) — the java.util.OptionalDouble
-
- Returns: a DoubleStream containing the value if present, otherwise an empty stream
flatten(...) -> DoubleStream
-
Signature:
public static DoubleStream flatten(final double[][] a) - Summary: Flattens a two-dimensional double array into a single DoubleStream.
-
Parameters:
-
a(double[][]) — the two-dimensional double array
-
- Returns: a DoubleStream containing all elements from the array
-
Signature:
public static DoubleStream flatten(final double[][] a, final boolean vertically) - Summary: Flattens a two-dimensional double array into a single DoubleStream.
-
Parameters:
-
a(double[][]) — the two-dimensional double array -
vertically(boolean) — if {@code true} , reads elements column by column; if {@code false} , reads row by row
-
- Returns: a DoubleStream containing all elements from the array
-
Signature:
public static DoubleStream flatten(final double[][] a, final double valueForAlignment, final boolean vertically) - Summary: Flattens a two-dimensional double array into a single DoubleStream with alignment.
-
Contract:
- When arrays have different lengths, shorter arrays are padded with the specified value.
-
Parameters:
-
a(double[][]) — the two-dimensional double array -
valueForAlignment(double) — the value to use for padding shorter arrays -
vertically(boolean) — if {@code true} , reads elements column by column; if {@code false} , reads row by row
-
- Returns: a DoubleStream containing all elements from the array with alignment
-
Signature:
public static DoubleStream flatten(final double[][][] a) - Summary: Flattens a three-dimensional double array into a single DoubleStream.
-
Parameters:
-
a(double[][][]) — the three-dimensional double array
-
- Returns: a DoubleStream containing all elements from the array
repeat(...) -> DoubleStream
-
Signature:
public static DoubleStream repeat(final double element, final long n) throws IllegalArgumentException - Summary: Creates a DoubleStream that repeats the specified element for the given number of times.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Repeat a value 5 times DoubleStream.repeat(3.14, 5) .toArray(); // Returns \[3.14, 3.14, 3.14, 3.14, 3.14\] // Create array of zeros DoubleStream.repeat(0.0, 10) .sum(); // Returns 0.0 // Use in calculations DoubleStream.repeat(2.5, 100) .limit(50) .sum(); // Returns 125.0 (2.5 * 50) // Empty stream when n is 0 DoubleStream.repeat(1.0, 0) .count(); // Returns 0 } </pre>
-
Parameters:
-
element(double) — the element to repeat -
n(long) — the number of times to repeat
-
- Returns: a DoubleStream containing n copies of the element
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> DoubleStream
-
Signature:
public static DoubleStream random() - Summary: Creates an infinite DoubleStream of random double values between 0.0 (inclusive) and 1.0 (exclusive).
-
Parameters:
- (none)
- Returns: an infinite DoubleStream of random double values
iterate(...) -> DoubleStream
-
Signature:
public static DoubleStream iterate(final BooleanSupplier hasNext, final DoubleSupplier next) throws IllegalArgumentException - Summary: Creates a DoubleStream that generates elements using the provided hasNext and next suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(DoubleSupplier) — a DoubleSupplier that provides the next double in the iteration
-
- Returns: a DoubleStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or next is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static DoubleStream iterate(final double init, final BooleanSupplier hasNext, final DoubleUnaryOperator f) throws IllegalArgumentException - Summary: Creates a DoubleStream that starts with an initial value and generates subsequent values by applying a function.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate powers of 2 up to 1000 final double\[\] limit = {1.0}; DoubleStream.iterate(2.0, () -> limit\[0\] <= 1000, d -> { limit\[0\] = d 2; return d 2; }).toArray(); // Returns \[2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0\] // Countdown with external condition final boolean\[\] shouldContinue = {true}; DoubleStream.iterate(10.0, () -> shouldContinue\[0\], d -> d - 1) .limit(5) .toArray(); // Returns \[10.0, 9.0, 8.0, 7.0, 6.0\] // Generate sequence with dynamic termination final AtomicInteger count = new AtomicInteger(0); DoubleStream.iterate(1.0, () -> count.get() < 5, d -> { count.incrementAndGet(); return d * 1.5; }).sum(); } </pre>
-
Parameters:
-
init(double) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(DoubleUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a DoubleStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, BooleanSupplier, java.util.function.UnaryOperator)
-
Signature:
public static DoubleStream iterate(final double init, final DoublePredicate hasNext, final DoubleUnaryOperator f) throws IllegalArgumentException - Summary: Creates a DoubleStream that starts with an initial value and generates subsequent values by applying a function.
-
Parameters:
-
init(double) — the initial value -
hasNext(DoublePredicate) — predicate to test the current value; stream continues while this returns true -
f(DoubleUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a DoubleStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, java.util.function.Predicate, java.util.function.UnaryOperator)
-
Signature:
public static DoubleStream iterate(final double init, final DoubleUnaryOperator f) throws IllegalArgumentException - Summary: Creates an infinite DoubleStream that starts with an initial value and generates subsequent values by applying a function.
-
Parameters:
-
init(double) — the initial value -
f(DoubleUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an infinite DoubleStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
- See also: Stream#iterate(Object, java.util.function.UnaryOperator)
generate(...) -> DoubleStream
-
Signature:
public static DoubleStream generate(final DoubleSupplier s) throws IllegalArgumentException - Summary: Creates an infinite DoubleStream that generates elements using the provided DoubleSupplier.
-
Parameters:
-
s(DoubleSupplier) — the DoubleSupplier that provides the elements of the stream
-
- Returns: an infinite DoubleStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> DoubleStream
-
Signature:
public static DoubleStream concat(final double[]... a) - Summary: Concatenates multiple double arrays into a single DoubleStream.
-
Parameters:
-
a(double[][]) — the arrays of doubles to concatenate
-
- Returns: a DoubleStream containing all elements from the input arrays in order
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static DoubleStream concat(final DoubleIterator... a) - Summary: Concatenates multiple DoubleIterators into a single DoubleStream.
-
Parameters:
-
a(DoubleIterator[]) — the DoubleIterators to concatenate
-
- Returns: a DoubleStream containing all elements from the input iterators in order
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static DoubleStream concat(final DoubleStream... a) - Summary: Concatenates multiple DoubleStreams into a single DoubleStream.
-
Contract:
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream[]) — the DoubleStreams to concatenate
-
- Returns: a DoubleStream containing all elements from the input streams in order
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static DoubleStream concat(final List<double[]> c) - Summary: Concatenates a list of double arrays into a single DoubleStream.
-
Parameters:
-
c(List<double[]>) — the list of double arrays to concatenate
-
- Returns: a DoubleStream containing all elements from the input arrays in order
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static DoubleStream concat(final Collection<? extends DoubleStream> streams) - Summary: Concatenates a collection of DoubleStreams into a single DoubleStream.
-
Contract:
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
streams(Collection<? extends DoubleStream>) — the collection of DoubleStreams to concatenate
-
- Returns: a DoubleStream containing all elements from the input streams in order
- See also: Stream#concat(Collection)
concatIterators(...) -> DoubleStream
-
Signature:
@Beta public static DoubleStream concatIterators(final Collection<? extends DoubleIterator> doubleIterators) - Summary: Concatenates a collection of DoubleIterators into a single DoubleStream.
-
Parameters:
-
doubleIterators(Collection<? extends DoubleIterator>) — the collection of DoubleIterators to concatenate
-
- Returns: a DoubleStream containing all elements from the input iterators in order
- See also: Stream#concatIterators(Collection), #concat(DoubleIterator...)
zip(...) -> DoubleStream
-
Signature:
public static DoubleStream zip(final double[] a, final double[] b, final DoubleBinaryOperator zipFunction) - Summary: Zips two double arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either array runs out of values.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static DoubleStream zip(final double[] a, final double[] b, final double[] c, final DoubleTernaryOperator zipFunction) - Summary: Zips three double arrays into a single stream until any of them runs out of values.
-
Contract:
- <p> The operation stops when any array runs out of values.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
c(double[]) — the third double array -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static DoubleStream zip(final DoubleIterator a, final DoubleIterator b, final DoubleBinaryOperator zipFunction) - Summary: Zips two double iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either iterator runs out of values.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static DoubleStream zip(final DoubleIterator a, final DoubleIterator b, final DoubleIterator c, final DoubleTernaryOperator zipFunction) - Summary: Zips three double iterators into a single stream until any of them runs out of values.
-
Contract:
- <p> The operation stops when any iterator runs out of values.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
c(DoubleIterator) — the third double iterator -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static DoubleStream zip(final DoubleStream a, final DoubleStream b, final DoubleBinaryOperator zipFunction) - Summary: Zips two double streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either stream runs out of values.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, BiFunction)
-
Signature:
public static DoubleStream zip(final DoubleStream a, final DoubleStream b, final DoubleStream c, final DoubleTernaryOperator zipFunction) - Summary: Zips three double streams into a single stream until any of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
c(DoubleStream) — the third double stream -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, TriFunction)
-
Signature:
public static DoubleStream zip(final Collection<? extends DoubleStream> streams, final DoubleNFunction<Double> zipFunction) - Summary: Zips multiple double streams into a single stream until any of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
streams(Collection<? extends DoubleStream>) — the collection of double streams to zip -
zipFunction(DoubleNFunction<Double>) — the function to combine values from all the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, Function)
-
Signature:
public static DoubleStream zip(final double[] a, final double[] b, final double valueForNoneA, final double valueForNoneB, final DoubleBinaryOperator zipFunction) - Summary: Zips two double arrays into a single stream until all of them run out of values.
-
Contract:
- When an array runs out of values, the corresponding default value is used for the remaining iterations.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
valueForNoneA(double) — the default value to use when array a runs out of values -
valueForNoneB(double) — the default value to use when array b runs out of values -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static DoubleStream zip(final double[] a, final double[] b, final double[] c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTernaryOperator zipFunction) - Summary: Zips three double arrays into a single stream until all of them run out of values.
-
Contract:
- When an array runs out of values, the corresponding default value is used for the remaining iterations.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
c(double[]) — the third double array -
valueForNoneA(double) — the default value to use when array a runs out of values -
valueForNoneB(double) — the default value to use when array b runs out of values -
valueForNoneC(double) — the default value to use when array c runs out of values -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static DoubleStream zip(final DoubleIterator a, final DoubleIterator b, final double valueForNoneA, final double valueForNoneB, final DoubleBinaryOperator zipFunction) - Summary: Zips two double iterators into a single stream until all of them run out of values.
-
Contract:
- When an iterator runs out of values, the corresponding default value is used for the remaining iterations.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
valueForNoneA(double) — the default value to use when iterator a runs out of values -
valueForNoneB(double) — the default value to use when iterator b runs out of values -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static DoubleStream zip(final DoubleIterator a, final DoubleIterator b, final DoubleIterator c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTernaryOperator zipFunction) - Summary: Zips three double iterators into a single stream until all of them run out of values.
-
Contract:
- When an iterator runs out of values, the corresponding default value is used for the remaining iterations.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
c(DoubleIterator) — the third double iterator -
valueForNoneA(double) — the default value to use when iterator a runs out of values -
valueForNoneB(double) — the default value to use when iterator b runs out of values -
valueForNoneC(double) — the default value to use when iterator c runs out of values -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, Object, Object, Object, TriFunction)
-
Signature:
public static DoubleStream zip(final DoubleStream a, final DoubleStream b, final double valueForNoneA, final double valueForNoneB, final DoubleBinaryOperator zipFunction) - Summary: Zips two double streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the corresponding default value is used for the remaining iterations.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
valueForNoneA(double) — the default value to use when stream a runs out of values -
valueForNoneB(double) — the default value to use when stream b runs out of values -
zipFunction(DoubleBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static DoubleStream zip(final DoubleStream a, final DoubleStream b, final DoubleStream c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTernaryOperator zipFunction) - Summary: Zips three double streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the corresponding default value is used for the remaining iterations.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
c(DoubleStream) — the third double stream -
valueForNoneA(double) — the default value to use when stream a runs out of values -
valueForNoneB(double) — the default value to use when stream b runs out of values -
valueForNoneC(double) — the default value to use when stream c runs out of values -
zipFunction(DoubleTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, Object, Object, Object, TriFunction)
-
Signature:
public static DoubleStream zip(final Collection<? extends DoubleStream> streams, final double[] valuesForNone, final DoubleNFunction<Double> zipFunction) - Summary: Zips multiple double streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the corresponding default value from the valuesForNone array is used for the remaining iterations.
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
streams(Collection<? extends DoubleStream>) — the collection of double streams to zip -
valuesForNone(double[]) — the array of default values to use when streams run out of values -
zipFunction(DoubleNFunction<Double>) — the function to combine values from all the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, List, Function)
merge(...) -> DoubleStream
-
Signature:
public static DoubleStream merge(final double[] a, final double[] b, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges two double arrays into a single DoubleStream based on a selector function.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select from array a, otherwise selects from array b
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static DoubleStream merge(final double[] a, final double[] b, final double[] c, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges three double arrays into a single DoubleStream based on a selector function.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
c(double[]) — the third double array -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select the first parameter, otherwise selects the second
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static DoubleStream merge(final DoubleIterator a, final DoubleIterator b, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges two DoubleIterators into a single DoubleStream based on a selector function.
-
Parameters:
-
a(DoubleIterator) — the first DoubleIterator -
b(DoubleIterator) — the second DoubleIterator -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select from iterator a, otherwise selects from iterator b
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static DoubleStream merge(final DoubleIterator a, final DoubleIterator b, final DoubleIterator c, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges three DoubleIterators into a single DoubleStream based on a selector function.
-
Parameters:
-
a(DoubleIterator) — the first DoubleIterator -
b(DoubleIterator) — the second DoubleIterator -
c(DoubleIterator) — the third DoubleIterator -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select the first parameter, otherwise selects the second
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static DoubleStream merge(final DoubleStream a, final DoubleStream b, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges two DoubleStreams into a single DoubleStream based on a selector function.
-
Contract:
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first DoubleStream -
b(DoubleStream) — the second DoubleStream -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select from stream a, otherwise selects from stream b
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static DoubleStream merge(final DoubleStream a, final DoubleStream b, final DoubleStream c, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges three DoubleStreams into a single DoubleStream based on a selector function.
-
Contract:
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
a(DoubleStream) — the first DoubleStream -
b(DoubleStream) — the second DoubleStream -
c(DoubleStream) — the third DoubleStream -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select the first parameter, otherwise selects the second
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static DoubleStream merge(final Collection<? extends DoubleStream> streams, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of DoubleStreams into a single DoubleStream based on a selector function.
-
Contract:
- The input streams will be closed when the returned stream is closed.
-
Parameters:
-
streams(Collection<? extends DoubleStream>) — the collection of DoubleStreams to merge -
nextSelector(DoubleBiFunction<MergeResult>) — a function that determines which element should be selected next. Returns MergeResult.TAKE_FIRST to select the first parameter, otherwise selects the second
-
- Returns: a DoubleStream containing the merged elements
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract DoubleStream filter(final DoublePredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(DoublePredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract DoubleStream takeWhile(final DoublePredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(DoublePredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract DoubleStream dropWhile(final DoublePredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(DoublePredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream map(DoubleUnaryOperator mapper) - Summary: Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleUnaryOperator) — a non-interfering, stateless function that transforms each element from double to double. Must be {@code non-null} .
-
- Returns: a new DoubleStream consisting of the results of applying the mapper function to the elements of this stream
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(DoubleToIntFunction mapper) - Summary: Returns an {@code IntStream} consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleToIntFunction) — a non-interfering, stateless function that transforms each element from double to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to the elements of this stream
- See also: #mapToLong(DoubleToLongFunction), #mapToFloat(DoubleToFloatFunction), #mapToObj(DoubleFunction)
mapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream mapToLong(DoubleToLongFunction mapper) - Summary: Returns a {@code LongStream} consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleToLongFunction) — a non-interfering, stateless function that transforms each element from double to long
-
- Returns: a new LongStream consisting of the results of applying the mapper function to the elements of this stream
- See also: #mapToInt(DoubleToIntFunction), #mapToFloat(DoubleToFloatFunction), #mapToObj(DoubleFunction)
mapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(DoubleToFloatFunction mapper) - Summary: Returns a {@code FloatStream} consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleToFloatFunction) — a non-interfering, stateless function that transforms each element from double to float
-
- Returns: a new FloatStream consisting of the results of applying the mapper function to the elements of this stream
- See also: #mapToInt(DoubleToIntFunction), #mapToLong(DoubleToLongFunction), #mapToObj(DoubleFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(DoubleFunction<? extends T> mapper) - Summary: Returns an object-valued {@code Stream} consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends T>) — a non-interfering, stateless function that transforms each element from double to T
-
- Returns: a new Stream consisting of the results of applying the mapper function to the elements of this stream
- See also: #mapToInt(DoubleToIntFunction), #mapToLong(DoubleToLongFunction), #mapToFloat(DoubleToFloatFunction), #boxed()
flatMap(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends DoubleStream>) — a non-interfering, stateless function that transforms each element to a DoubleStream
-
- Returns: a new DoubleStream consisting of the flattened contents of all mapped streams
- See also: #flatmap(DoubleFunction), #flatMapToInt(DoubleFunction), #flatMapToLong(DoubleFunction), #flatMapToObj(DoubleFunction)
flatmap(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatmap(DoubleFunction<double[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<double[]>) — a non-interfering, stateless function that transforms each element to a double array
-
- Returns: a new DoubleStream consisting of the flattened contents of all mapped arrays
- See also: #flatMap(DoubleFunction), #flatMapToInt(DoubleFunction), #flatMapToLong(DoubleFunction)
flattMap(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream flattMap(DoubleFunction<? extends java.util.stream.DoubleStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped JDK DoubleStream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
- This method is useful when integrating with standard Java Stream API.
-
Parameters:
-
mapper(DoubleFunction<? extends java.util.stream.DoubleStream>) — a non-interfering, stateless function that transforms each element to a JDK DoubleStream
-
- Returns: a new DoubleStream consisting of the flattened contents of all mapped JDK streams
- See also: #flatMap(DoubleFunction), #flatmap(DoubleFunction)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(DoubleFunction<? extends IntStream> mapper) - Summary: Returns an {@code IntStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element to an IntStream
-
- Returns: a new IntStream consisting of the flattened contents of all mapped streams
- See also: #flatMapToLong(DoubleFunction), #flatMapToFloat(DoubleFunction), #flatMapToObj(DoubleFunction)
flatMapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(DoubleFunction<? extends LongStream> mapper) - Summary: Returns a {@code LongStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends LongStream>) — a non-interfering, stateless function that transforms each element to a LongStream
-
- Returns: a new LongStream consisting of the flattened contents of all mapped streams
- See also: #flatMapToInt(DoubleFunction), #flatMapToFloat(DoubleFunction), #flatMapToObj(DoubleFunction)
flatMapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(DoubleFunction<? extends FloatStream> mapper) - Summary: Returns a {@code FloatStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends FloatStream>) — a non-interfering, stateless function that transforms each element to a FloatStream
-
- Returns: a new FloatStream consisting of the flattened contents of all mapped streams
- See also: #flatMapToInt(DoubleFunction), #flatMapToLong(DoubleFunction), #flatMapToObj(DoubleFunction)
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(DoubleFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued {@code Stream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element to a Stream
-
- Returns: a new Stream consisting of the flattened contents of all mapped streams
- See also: #flatMapToInt(DoubleFunction), #flatMapToLong(DoubleFunction), #flatmapToObj(DoubleFunction), #mapToObj(DoubleFunction)
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(DoubleFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued {@code Stream} consisting of the results of replacing each element of this stream with the contents of a mapped collection produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element to a Collection
-
- Returns: a new Stream consisting of the flattened contents of all mapped collections
- See also: #flatMapToObj(DoubleFunction), #flattmapToObj(DoubleFunction), #mapToObj(DoubleFunction)
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(DoubleFunction<T[]> mapper) - Summary: Returns an object-valued {@code Stream} consisting of the results of replacing each element of this stream with the contents of a mapped array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(DoubleFunction<T[]>) — a non-interfering, stateless function that transforms each element to a double array
-
- Returns: a new Stream consisting of the flattened contents of all mapped arrays
- See also: #flatMapToObj(DoubleFunction), #flatmapToObj(DoubleFunction), #mapToObj(DoubleFunction)
mapMulti(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream mapMulti(DoubleMapMultiConsumer mapper) - Summary: Returns a stream consisting of the results of applying the given multi-mapping function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
- <p> <b> Usage Examples: </b> </p> <pre> {@code DoubleStream.of(1.0, 2.0, 3.0) .mapMulti((d, consumer) -> { consumer.accept(d); consumer.accept(d 2); }) .toArray(); // Returns \[1.0, 2.0, 2.0, 4.0, 3.0, 6.0\] // Conditional multi-mapping DoubleStream.of(1.5, 2.5, 3.5) .mapMulti((d, consumer) -> { consumer.accept(d); if (d > 2.0) { consumer.accept(d 10); } }) .toArray(); // Returns \[1.5, 2.5, 25.0, 3.5, 35.0\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(DoubleMapMultiConsumer) — a non-interfering, stateless function that generates zero or more output values for each input value
-
- Returns: a new DoubleStream consisting of the results of applying the mapper function
- See also: #flatMap(DoubleFunction), #flatmap(DoubleFunction)
mapPartial(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartial(DoubleFunction<OptionalDouble> mapper) - Summary: Returns a stream consisting of the non-empty results of applying the given function to the elements of this stream.
-
Contract:
- If the mapper function returns an empty {@code OptionalDouble} for an element, that element is not included in the result stream.
-
Parameters:
-
mapper(DoubleFunction<OptionalDouble>) — a non-interfering, stateless function that transforms each element to an OptionalDouble
-
- Returns: a new stream containing only the values from non-empty OptionalDoubles
mapPartialJdk(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartialJdk(DoubleFunction<java.util.OptionalDouble> mapper) - Summary: Returns a stream consisting of the non-empty results of applying the given function to the elements of this stream.
-
Contract:
- If the mapper function returns an empty {@code OptionalDouble} for an element, that element is not included in the result stream.
-
Parameters:
-
mapper(DoubleFunction<java.util.OptionalDouble>) — a non-interfering, stateless function that transforms each element to a JDK OptionalDouble
-
- Returns: a new stream containing only the values from non-empty OptionalDoubles
rangeMap(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream rangeMap(final DoubleBiPredicate sameRange, final DoubleBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(DoubleBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(DoubleBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final DoubleBiPredicate sameRange, final DoubleBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(DoubleBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(DoubleBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<DoubleList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<DoubleList> collapse(final DoubleBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(DoubleBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream collapse(final DoubleBiPredicate collapsible, final DoubleBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(DoubleBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(DoubleBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream collapse(final DoubleTriPredicate collapsible, final DoubleBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(DoubleTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(DoubleBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream scan(final DoubleBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(DoubleBinaryOperator) — a {@code DoubleBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code DoubleStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream scan(final double init, final DoubleBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(double) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(DoubleBinaryOperator) — a {@code DoubleBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code DoubleStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream scan(final double init, final boolean initIncluded, final DoubleBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(double) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(DoubleBinaryOperator) — a {@code DoubleBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code DoubleStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream prepend(final double... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(double[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream append(final double... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(double[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream appendIfEmpty(final double... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Non-empty stream remains unchanged DoubleStream.of(1.0, 2.0, 3.0) .appendIfEmpty(99.0) .toArray(); // Returns \[1.0, 2.0, 3.0\] // Empty stream gets default values DoubleStream.empty() .appendIfEmpty(0.0, 0.0) .toArray(); // Returns \[0.0, 0.0\] // Provide fallback data DoubleStream.of(dataArray) .filter(d -> d > 0) .appendIfEmpty(-1.0) // -1.0 if no positive values .forEach(System.out::println); } </pre>
-
Parameters:
-
a(double[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
top(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to select
-
- Returns: a new stream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream top(final int n, Comparator<? super Double> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to select -
comparator(Comparator<? super Double>) — a non-interfering, stateless comparator to compare elements of this stream
-
- Returns: a new stream
toDoubleList(...) -> DoubleList
-
Signature:
@SequentialOnly @TerminalOp public abstract DoubleList toDoubleList() - Summary: Returns a {@code DoubleList} containing all the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code DoubleList} containing all the elements of this stream
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.DoubleFunction<? extends K, E> keyMapper, Throwables.DoubleFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a {@code Map} where the keys and values are the results of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
- If the mapped keys may have duplicates, use {@link #toMap(Throwables.DoubleFunction, Throwables.DoubleFunction, BinaryOperator)} instead.
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to derive the key -
valueMapper(Throwables.DoubleFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to derive the value
-
- Returns: a {@code Map} whose keys and values are the results of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.DoubleFunction<? extends K, E> keyMapper, Throwables.DoubleFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} where the keys and values are the results of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
- If the mapped keys may have duplicates, use {@link #toMap(Throwables.DoubleFunction, Throwables.DoubleFunction, BinaryOperator, Supplier)} instead.
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to derive the key -
valueMapper(Throwables.DoubleFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to derive the value -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the results of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.DoubleFunction<? extends K, E> keyMapper, Throwables.DoubleFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a {@code Map} where the keys and values are the results of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the values are merged using the provided merging function.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Group by category (rounded value) and sum duplicates Map<Integer, Double> sumByCategory = DoubleStream.of(1.5, 1.7, 2.3, 2.8, 3.1) .toMap(d -> (int) d, d -> d, Double::sum); // Result: {1=3.2, 2=5.1, 3=3.1} // Keep first value when duplicates occur Map<String, Double> firstValues = DoubleStream.of(85.5, 92.3, 85.7, 78.9) .toMap(d -> "Range-" + ((int) d / 10) * 10, d -> d, (v1, v2) -> v1); // Result: {Range-80=85.5, Range-90=92.3, Range-70=78.9} // Keep maximum value for duplicates Map<Integer, Double> maxValues = DoubleStream.of(1.5, 1.9, 2.3, 1.2) .toMap(d -> (int) d, d -> d, Math::max); // Result: {1=1.9, 2=2.3} } </pre>
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to derive the key -
valueMapper(Throwables.DoubleFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to derive the value -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Map} whose keys and values are the results of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.DoubleFunction<? extends K, E> keyMapper, Throwables.DoubleFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} where the keys and values are the results of applying the provided mapping functions to the input elements.
-
Contract:
- <p> If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the values are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to derive the key -
valueMapper(Throwables.DoubleFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to derive the value -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the results of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.DoubleFunction<? extends K, E> keyMapper, final Collector<? super Double, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function and collects the results using the specified downstream collector.
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to be used for classifying elements -
downstream(Collector<? super Double, ?, D>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Map} containing the results of the group-by operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.DoubleFunction<? extends K, E> keyMapper, final Collector<? super Double, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function and collects the results using the specified downstream collector into the specified map factory.
-
Parameters:
-
keyMapper(Throwables.DoubleFunction<? extends K, E>) — a non-interfering, stateless function to be used for classifying elements -
downstream(Collector<? super Double, ?, D>) — a {@code Collector} implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} containing the results of the group-by operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> double
-
Signature:
@ParallelSupported @TerminalOp public abstract double reduce(double identity, DoubleBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(double) — the initial value of the reduction operation -
accumulator(DoubleBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalDouble reduce(DoubleBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
accumulator(DoubleBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: an OptionalDouble describing the result of the reduction. If the stream is empty, an empty {@code OptionalDouble} is returned.
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjDoubleConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <br/> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjDoubleConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjDoubleConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
foreach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public void foreach(final DoubleConsumer action) - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(DoubleConsumer) — a non-interfering action to perform on the elements
-
- See also: #forEach(Throwables.DoubleConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.DoubleConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.DoubleConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntDoubleConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, providing access to both the element and its index.
-
Parameters:
-
action(Throwables.IntDoubleConsumer<E>) — a non-interfering action to perform on the elements, accepting the index and the element
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any element is greater than 5 boolean hasLarge = DoubleStream.of(1.5, 2.7, 3.2, 4.9) .anyMatch(d -> d > 5.0); // Returns false // Check if any element is negative boolean hasNegative = DoubleStream.of(1.5, -2.7, 3.2) .anyMatch(d -> d < 0); // Returns true (short-circuits at -2.7) // Empty stream always returns false boolean anyInEmpty = DoubleStream.empty() .anyMatch(d -> true); // Returns false // Check if any grade is passing boolean hasPassing = DoubleStream.of(45.5, 55.3, 68.9) .anyMatch(grade -> grade >= 60.0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all elements are positive boolean allPositive = DoubleStream.of(1.5, 2.7, 3.2, 4.9) .allMatch(d -> d > 0); // Returns true // Check if all elements are greater than 5 boolean allLarge = DoubleStream.of(1.5, 6.7, 3.2) .allMatch(d -> d > 5.0); // Returns false (short-circuits at 1.5) // Empty stream always returns true boolean allInEmpty = DoubleStream.empty() .allMatch(d -> false); // Returns true // Check if all grades are passing boolean allPassing = DoubleStream.of(85.5, 92.3, 78.9, 88.7) .allMatch(grade -> grade >= 60.0); // Returns true // Validate all values are within range boolean inRange = DoubleStream.of(0.5, 0.7, 0.9) .allMatch(d -> d >= 0.0 && d <= 1.0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no elements are negative boolean noNegatives = DoubleStream.of(1.5, 2.7, 3.2, 4.9) .noneMatch(d -> d < 0); // Returns true // Check if no elements are greater than 10 boolean noneAboveTen = DoubleStream.of(1.5, 2.7, 11.2) .noneMatch(d -> d > 10.0); // Returns false (short-circuits at 11.2) // Empty stream always returns true boolean noneInEmpty = DoubleStream.empty() .noneMatch(d -> true); // Returns true // Validate no grades are failing boolean noFailures = DoubleStream.of(85.5, 92.3, 78.9, 88.7) .noneMatch(grade -> grade < 60.0); // Returns true // Check no NaN values present boolean noNaN = DoubleStream.of(1.5, 2.7, 3.2) .noneMatch(Double::isNaN); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalDouble
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalDouble findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalDouble} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing the first element of the stream, or an empty {@code OptionalDouble} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.DoublePredicate), #findAny(Throwables.DoublePredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalDouble findFirst(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns an {@code OptionalDouble} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
-
Contract:
- Returns an {@code OptionalDouble} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalDouble} describing the first element that matches the predicate, or an empty {@code OptionalDouble} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalDouble
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalDouble findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalDouble} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalDouble} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing some element of the stream, or an empty {@code OptionalDouble} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.DoublePredicate), #findAny(Throwables.DoublePredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalDouble findAny(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns an {@code OptionalDouble} describing any element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
-
Contract:
- Returns an {@code OptionalDouble} describing any element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalDouble} describing any element that matches the predicate, or an empty {@code OptionalDouble} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalDouble
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalDouble findLast(final Throwables.DoublePredicate<E> predicate) throws E - Summary: Returns an {@code OptionalDouble} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
-
Contract:
- Returns an {@code OptionalDouble} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalDouble} if no such element exists.
- <p> Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.DoublePredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalDouble} describing the last element that matches the predicate, or an empty {@code OptionalDouble} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble min() - Summary: Returns an {@code OptionalDouble} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalDouble} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing the minimum element of this stream, or an empty optional if the stream is empty
max(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble max() - Summary: Returns an {@code OptionalDouble} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalDouble} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalDouble} containing the maximum element of this stream, or an empty optional if the stream is empty
kthLargest(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty {@code OptionalDouble} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element DoubleStream.of(10.5, 30.2, 20.8, 50.1, 40.7).kthLargest(2); // Returns OptionalDouble\[40.7\] // Find the largest element (same as max) DoubleStream.of(5.5, 2.3, 8.1, 1.7).kthLargest(1); // Returns OptionalDouble\[8.1\] // When k exceeds stream size DoubleStream.of(1.5, 2.3, 3.8).kthLargest(5); // Returns OptionalDouble.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an {@code OptionalDouble} containing the k-th largest element, or an empty {@code OptionalDouble} if the stream is empty or the count of elements is less than k
sum(...) -> double
-
Signature:
@SequentialOnly @TerminalOp public abstract double sum() - Summary: Returns the sum of elements in this stream.
-
Parameters:
- (none)
- Returns: the sum of elements in this stream
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> DoubleSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract DoubleSummaryStatistics summaryStatistics() - Summary: Returns a {@code DoubleSummaryStatistics} describing various summary data about the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code DoubleSummaryStatistics} describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<DoubleSummaryStatistics, Optional<Map<Percentage, Double>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<DoubleSummaryStatistics, Optional<Map<Percentage, Double>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of DoubleSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of DoubleSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Pair<DoubleSummaryStatistics, Optional<Map<Percentage, Double>>> result = DoubleStream.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) .summaryStatisticsAndPercentiles(); DoubleSummaryStatistics stats = result.left; System.out.println("Count: " + stats.getCount()); // 10 System.out.println("Average: " + stats.getAverage()); // 5.5 result.right.ifPresent(percentiles -> { // Access percentile data if available percentiles.forEach((pct, val) -> System.out.println(pct + ": " + val)); }); } </pre>
-
Parameters:
- (none)
- Returns: a {@code Pair} containing the {@code DoubleSummaryStatistics} and an optional map of percentile values
mergeWith(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream mergeWith(final DoubleStream b, final DoubleBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream according to the provided {@code nextSelector} function.
-
Parameters:
-
b(DoubleStream) — the other stream to merge with this stream -
nextSelector(DoubleBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: the new merged stream
zipWith(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream zipWith(DoubleStream b, DoubleBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(DoubleStream) — the DoubleStream to be combined with the current DoubleStream. Must be {@code non-null} . -
zipFunction(DoubleBinaryOperator) — a DoubleBinaryOperator that determines the combination of elements in the combined DoubleStream. Must be {@code non-null} .
-
- Returns: a new DoubleStream that is the result of combining the current DoubleStream with the given DoubleStream
- See also: #zipWith(DoubleStream, double, double, DoubleBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream zipWith(DoubleStream b, DoubleStream c, DoubleTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(DoubleStream) — the second DoubleStream to be combined with the current DoubleStream. Will be closed along with this DoubleStream. -
c(DoubleStream) — the third DoubleStream to be combined with the current DoubleStream. Will be closed along with this DoubleStream. -
zipFunction(DoubleTernaryOperator) — a DoubleTernaryOperator that determines the combination of elements in the combined DoubleStream. Must be {@code non-null} .
-
- Returns: a new DoubleStream that is the result of combining the current DoubleStream with the given DoubleStreams
- See also: #zipWith(DoubleStream, DoubleStream, double, double, double, DoubleTernaryOperator), #zipWith(DoubleStream, DoubleBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream zipWith(DoubleStream b, double valueForNoneA, double valueForNoneB, DoubleBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(DoubleStream) — the DoubleStream to be combined with the current DoubleStream. Will be closed along with this DoubleStream. -
valueForNoneA(double) — the default value to use for the current DoubleStream when it runs out of elements -
valueForNoneB(double) — the default value to use for the given DoubleStream when it runs out of elements -
zipFunction(DoubleBinaryOperator) — a DoubleBinaryOperator that determines the combination of elements in the combined DoubleStream. Must be {@code non-null} .
-
- Returns: a new DoubleStream that is the result of combining the current DoubleStream with the given DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream zipWith(DoubleStream b, DoubleStream c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(DoubleStream) — the second DoubleStream to be combined with the current DoubleStream. Will be closed along with this DoubleStream. -
c(DoubleStream) — the third DoubleStream to be combined with the current DoubleStream. Will be closed along with this DoubleStream. -
valueForNoneA(double) — the default value to use for the current DoubleStream when it runs out of elements -
valueForNoneB(double) — the default value to use for the second DoubleStream when it runs out of elements -
valueForNoneC(double) — the default value to use for the third DoubleStream when it runs out of elements -
zipFunction(DoubleTernaryOperator) — a DoubleTernaryOperator that determines the combination of elements in the combined DoubleStream. Must be {@code non-null} .
-
- Returns: a new DoubleStream that is the result of combining the current DoubleStream with the given DoubleStreams
boxed(...) -> Stream<Double>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Double> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Double.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Double
toJdkStream(...) -> java.util.stream.DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract java.util.stream.DoubleStream toJdkStream() - Summary: Converts this stream to a JDK {@code DoubleStream} .
-
Parameters:
- (none)
- Returns: a JDK {@code DoubleStream} consisting of the elements of this stream
transformB(...) -> DoubleStream
-
Signature:
@Beta @SequentialOnly @IntermediateOp public DoubleStream transformB(final Function<? super java.util.stream.DoubleStream, ? extends java.util.stream.DoubleStream> transfer) - Summary: Transforms this stream using the provided transfer function that operates on the JDK stream representation.
-
Contract:
- <p> This is useful when you need to leverage specific JDK DoubleStream operations that are not directly available in this stream implementation, or when integrating with third-party libraries that work with JDK streams.
-
Parameters:
-
transfer(Function<? super java.util.stream.DoubleStream, ? extends java.util.stream.DoubleStream>) — the function to transform the JDK stream. Must not be {@code null} .
-
- Returns: the transformed stream as a DoubleStream
- See also: #transformB(Function, boolean), #toJdkStream()
-
Signature:
@Beta @SequentialOnly @IntermediateOp public DoubleStream transformB(final Function<? super java.util.stream.DoubleStream, ? extends java.util.stream.DoubleStream> transfer, final boolean deferred) throws IllegalStateException, IllegalArgumentException - Summary: Transforms this stream using the provided transfer function that operates on the JDK stream representation.
-
Contract:
- <p> This is useful when you need to leverage specific JDK DoubleStream operations that are not directly available in this stream implementation.
- <p> <b> Deferred vs Immediate Execution: </b> <ul> <li> If {@code deferred = false} : The transfer function is applied immediately when this method is called </li> <li> If {@code deferred = true} : The transfer function is applied lazily when a terminal operation is invoked </li> </ul> <p> <b> Example (immediate): </b> </p> <pre> {@code DoubleStream.of(1.0, 2.0, 3.0) .transformB(jdkStream -> jdkStream.map(x -> x 2), false) .toArray(); } </pre> <p> <b> Example (deferred): </b> </p> <pre> {@code DoubleStream.of(1.0, 2.0, 3.0) .transformB(jdkStream -> jdkStream.map(x -> x 2), true) .toArray(); } </pre>
-
Parameters:
-
transfer(Function<? super java.util.stream.DoubleStream, ? extends java.util.stream.DoubleStream>) — the function to transform the JDK stream. Must not be {@code null} . -
deferred(boolean) — if {@code true} , the transformation is deferred until the stream is consumed; if {@code false} , the transformation is applied immediately
-
- Returns: the transformed stream as a DoubleStream
-
Throws:
-
java.lang.IllegalStateException— if the stream has already been operated upon or closed -
java.lang.IllegalArgumentException— if transfer is null
-
- See also: #transformB(Function), #toJdkStream(), DoubleStream#defer(Supplier)
Class DoubleStreamEx (com.landawn.abacus.util.stream.DoubleStream.DoubleStreamEx)
An extension class for DoubleStream to provide additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class EntryStream (com.landawn.abacus.util.stream.EntryStream)
A specialized stream implementation for processing sequences of Map.Entry elements with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> empty() - Summary: Returns an empty EntryStream.
-
Parameters:
- (none)
- Returns: an empty EntryStream
- See also: Stream#empty()
defer(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> defer(final Supplier<? extends EntryStream<? extends K, ? extends V>> supplier) - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Defer expensive map creation EntryStream<String, Integer> deferred = EntryStream.defer(() -> EntryStream.of(expensiveMapComputation()) ); // The expensive computation is not executed until needed if (someCondition) { Map<String, Integer> result = deferred.toMap(); // Computation happens here } } </pre>
-
Parameters:
-
supplier(Supplier<? extends EntryStream<? extends K, ? extends V>>) — the supplier that provides the EntryStream
-
- Returns: an EntryStream that is lazily populated by the provided supplier
- See also: Stream#defer(Supplier)
ofNullable(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> ofNullable(final Map.Entry<K, V> entry) - Summary: Returns an EntryStream containing the provided entry if it is not {@code null} , otherwise returns an empty EntryStream.
-
Contract:
- Returns an EntryStream containing the provided entry if it is not {@code null} , otherwise returns an empty EntryStream.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Map.Entry<String, Integer> entry = map.entrySet().stream().findFirst().orElse(null); EntryStream<String, Integer> stream = EntryStream.ofNullable(entry); // If entry is null, stream will be empty // Safe chaining with nullable entries Map.Entry<String, Integer> nullableEntry = getNullableEntry(); int sum = EntryStream.ofNullable(nullableEntry) .mapToInt(Map.Entry::getValue) .sum(); // 0 if entry was null } </pre>
-
Parameters:
-
entry(Map.Entry<K, V>) — the Map.Entry to be included in the EntryStream if it is not null
-
- Returns: an EntryStream containing the provided entry if it is not {@code null} , otherwise an empty EntryStream
- See also: Stream#ofNullable(Object)
of(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1) - Summary: Returns an EntryStream containing a single entry with the provided key and value.
-
Parameters:
-
k1(K) — the key to be included in the EntryStream -
v1(V) — the value to be included in the EntryStream
-
- Returns: an EntryStream containing a single entry with the provided key and value
- See also: #of(Map), #ofNullable(Map.Entry), #concat(Map\[\]), #zip(Object\[\], Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2) - Summary: Returns an EntryStream containing two entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry
-
- Returns: an EntryStream containing two entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3) - Summary: Returns an EntryStream containing three entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry -
k3(K) — the key of the third entry -
v3(V) — the value of the third entry
-
- Returns: an EntryStream containing three entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4) - Summary: Returns an EntryStream containing four entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry -
k3(K) — the key of the third entry -
v3(V) — the value of the third entry -
k4(K) — the key of the fourth entry -
v4(V) — the value of the fourth entry
-
- Returns: an EntryStream containing four entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5) - Summary: Returns an EntryStream containing five entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry -
k3(K) — the key of the third entry -
v3(V) — the value of the third entry -
k4(K) — the key of the fourth entry -
v4(V) — the value of the fourth entry -
k5(K) — the key of the fifth entry -
v5(V) — the value of the fifth entry
-
- Returns: an EntryStream containing five entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6) - Summary: Returns an EntryStream containing six entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry -
k3(K) — the key of the third entry -
v3(V) — the value of the third entry -
k4(K) — the key of the fourth entry -
v4(V) — the value of the fourth entry -
k5(K) — the key of the fifth entry -
v5(V) — the value of the fifth entry -
k6(K) — the key of the sixth entry -
v6(V) — the value of the sixth entry
-
- Returns: an EntryStream containing six entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final K k1, final V v1, final K k2, final V v2, final K k3, final V v3, final K k4, final V v4, final K k5, final V v5, final K k6, final V v6, final K k7, final V v7) - Summary: Returns an EntryStream containing seven entries with the provided keys and values.
-
Parameters:
-
k1(K) — the key of the first entry -
v1(V) — the value of the first entry -
k2(K) — the key of the second entry -
v2(V) — the value of the second entry -
k3(K) — the key of the third entry -
v3(V) — the value of the third entry -
k4(K) — the key of the fourth entry -
v4(V) — the value of the fourth entry -
k5(K) — the key of the fifth entry -
v5(V) — the value of the fifth entry -
k6(K) — the key of the sixth entry -
v6(V) — the value of the sixth entry -
k7(K) — the key of the seventh entry -
v7(V) — the value of the seventh entry
-
- Returns: an EntryStream containing seven entries with the provided keys and values
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final Map<? extends K, ? extends V> map) - Summary: Returns an EntryStream containing the entries from the given map.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the entries to be included in the EntryStream
-
- Returns: an EntryStream containing the entries from the given map
- See also: Stream#of(Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> of(final Iterator<? extends Map.Entry<? extends K, ? extends V>> iterator) - Summary: Returns an EntryStream containing the entries from the given iterator.
-
Parameters:
-
iterator(Iterator<? extends Map.Entry<? extends K, ? extends V>>) — the iterator providing the entries to be included in the EntryStream
-
- Returns: an EntryStream containing the entries from the given iterator
-
Signature:
public static <K, V> EntryStream<K, V> of(final Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) - Summary: Returns an EntryStream containing the entries from the given iterable.
-
Parameters:
-
entries(Iterable<? extends Map.Entry<? extends K, ? extends V>>) — the iterable providing the entries to be included in the EntryStream
-
- Returns: an EntryStream containing the entries from the given iterable
-
Signature:
public static <K, E, V extends Collection<E>> EntryStream<K, V> of(final Multimap<? extends K, E, ? extends V> mulitmap) - Summary: Returns an EntryStream containing the entries from the given Multimap.
-
Parameters:
-
mulitmap(Multimap<? extends K, E, ? extends V>) — the iterable providing the entries to be included in the EntryStream
-
- Returns: an EntryStream containing the entries from the given Multimap
-
Signature:
public static <T, K> EntryStream<K, T> of(final T[] a, final Function<? super T, ? extends K> keyMapper) - Summary: Returns an EntryStream from the provided array and key mapper function.
-
Parameters:
-
a(T[]) — the array to be converted into an EntryStream -
keyMapper(Function<? super T, ? extends K>) — the function to map array elements to keys
-
- Returns: an EntryStream containing the entries from the provided array
-
Signature:
public static <T, K, V> EntryStream<K, V> of(final T[] a, final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns an EntryStream from the provided array and key and value mapper functions.
-
Parameters:
-
a(T[]) — the array to be converted into an EntryStream -
keyMapper(Function<? super T, ? extends K>) — the function to map array elements to keys -
valueMapper(Function<? super T, ? extends V>) — the function to map array elements to values
-
- Returns: an EntryStream containing the entries from the provided array
-
Signature:
public static <T, K> EntryStream<K, T> of(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyMapper) - Summary: Returns an EntryStream from the provided collection and key mapper function.
-
Parameters:
-
c(Iterable<? extends T>) — the collection to be converted into an EntryStream -
keyMapper(Function<? super T, ? extends K>) — the function to map collection elements to keys
-
- Returns: an EntryStream containing the entries from the provided collection
-
Signature:
public static <T, K, V> EntryStream<K, V> of(final Iterable<? extends T> c, final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) - Summary: Returns an EntryStream from the provided collection and key and value mapper functions.
-
Parameters:
-
c(Iterable<? extends T>) — the collection to be converted into an EntryStream -
keyMapper(Function<? super T, ? extends K>) — the function to map collection elements to keys -
valueMapper(Function<? super T, ? extends V>) — the function to map collection elements to values
-
- Returns: an EntryStream containing the entries from the provided collection
-
Signature:
public static <T, K> EntryStream<K, T> of(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyMapper) - Summary: Returns an EntryStream from the provided iterator and key mapper function.
-
Contract:
- <p> This method is useful when you have a collection of values and want to create entries where each value is associated with a computed key.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator providing the elements to be converted into entries -
keyMapper(Function<? super T, ? extends K>) — the function that extracts/computes a key from each element
-
- Returns: a new EntryStream containing entries created from the iterator elements
- See also: #of(Iterator, Function, Function), Stream#mapToEntry(Function, Function)
-
Signature:
public static <T, K, V> EntryStream<K, V> of(final Iterator<? extends T> iter, final Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper) throws IllegalArgumentException - Summary: Returns an EntryStream from the provided iterator with custom key and value mapper functions.
-
Contract:
- <p> This method provides maximum flexibility when creating entries from an iterator, allowing you to transform the original elements into both keys and values.
-
Parameters:
-
iter(Iterator<? extends T>) — the iterator providing the source elements -
keyMapper(Function<? super T, ? extends K>) — the function that extracts/computes a key from each element -
valueMapper(Function<? super T, ? extends V>) — the function that extracts/computes a value from each element
-
- Returns: a new EntryStream containing entries created from the iterator elements
-
Throws:
-
java.lang.IllegalArgumentException— if iter, keyMapper, or valueMapper is null
-
- See also: #of(Iterator, Function), Stream#mapToEntry(Function, Function)
concat(...) -> EntryStream<K, V>
-
Signature:
@SafeVarargs public static <K, V> EntryStream<K, V> concat(final Map<? extends K, ? extends V>... maps) - Summary: Concatenates multiple maps into a single EntryStream.
-
Contract:
- <p> If the same key appears in multiple maps, it will appear multiple times in the resulting stream.
-
Parameters:
-
maps(Map<? extends K, ? extends V>[]) — the maps to be concatenated into a single stream
-
- Returns: an EntryStream containing all entries from all provided maps
- See also: #concat(Collection), #merge(Map, Map, BiFunction), #of(Map), #zip(Object\[\], Object\[\])
-
Signature:
public static <K, V> EntryStream<K, V> concat(final Collection<? extends Map<? extends K, ? extends V>> maps) - Summary: Concatenates multiple maps from a collection into a single EntryStream.
-
Contract:
- <p> If the same key appears in multiple maps, it will appear multiple times in the resulting stream.
-
Parameters:
-
maps(Collection<? extends Map<? extends K, ? extends V>>) — the collection of maps to be concatenated
-
- Returns: an EntryStream containing all entries from all maps in the collection
- See also: #concat(Map\[\]), Stream#concat(Collection), Stream#flatmapToEntry(Function)
merge(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> merge(final Map<? extends K, ? extends V> a, final Map<? extends K, ? extends V> b, final BiFunction<? super Map.Entry<K, V>, ? super Map.Entry<K, V>, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges two maps into a single EntryStream based on the provided nextSelector function.
-
Contract:
- <p> The merge operation is particularly useful when you need to combine sorted maps while maintaining a specific ordering, or when implementing custom merge strategies for entries with duplicate keys.
-
Parameters:
-
a(Map<? extends K, ? extends V>) — the first map to be merged -
b(Map<? extends K, ? extends V>) — the second map to be merged -
nextSelector(BiFunction<? super Map.Entry<K, V>, ? super Map.Entry<K, V>, MergeResult>) — a function that determines which entry should be selected next from the two maps
-
- Returns: an EntryStream containing the merged entries from the two maps
-
Throws:
-
java.lang.IllegalArgumentException— if nextSelector is null
-
- See also: #merge(Map, Map, Map, BiFunction), #merge(Collection, BiFunction), #concat(Map\[\]), #zip(Object\[\], Object\[\]), MergeResult
-
Signature:
public static <K, V> EntryStream<K, V> merge(final Map<? extends K, ? extends V> a, final Map<? extends K, ? extends V> b, final Map<? extends K, ? extends V> c, final BiFunction<? super Map.Entry<K, V>, ? super Map.Entry<K, V>, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges three maps into a single EntryStream based on the provided nextSelector function.
-
Parameters:
-
a(Map<? extends K, ? extends V>) — the first map to be merged -
b(Map<? extends K, ? extends V>) — the second map to be merged -
c(Map<? extends K, ? extends V>) — the third map to be merged -
nextSelector(BiFunction<? super Map.Entry<K, V>, ? super Map.Entry<K, V>, MergeResult>) — a function that determines which entry should be selected next
-
- Returns: an EntryStream containing the merged entries from the three maps
-
Throws:
-
java.lang.IllegalArgumentException— if nextSelector is null
-
- See also: #merge(Map, Map, BiFunction), #merge(Collection, BiFunction), MergeResult, N#merge(Iterable, Iterable, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> merge(final Collection<? extends Map<? extends K, ? extends V>> maps, final BiFunction<? super Map.Entry<? extends K, ? extends V>, ? super Map.Entry<? extends K, ? extends V>, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges a collection of maps into a single EntryStream based on the provided nextSelector function.
-
Contract:
- <p> This method is useful when you have multiple maps that need to be merged with a custom ordering strategy, such as merging sorted maps while maintaining order or implementing priority-based merge strategies.
- <p> <b> Usage Examples: </b> </p> <pre> {@code List<Map<String, Integer>> inventories = Arrays.asList( Map.of("apple", 10, "banana", 5), Map.of("apple", 15, "orange", 8), Map.of("banana", 3, "orange", 12) ); // Merge maps prioritizing higher quantities EntryStream<String, Integer> merged = EntryStream.merge(inventories, (e1, e2) -> { int cmp = e1.getKey().compareTo(e2.getKey()); if (cmp != 0) return cmp < 0 ?
-
Parameters:
-
maps(Collection<? extends Map<? extends K, ? extends V>>) — the collection of maps to be merged -
nextSelector(BiFunction<? super Map.Entry<? extends K, ? extends V>, ? super Map.Entry<? extends K, ? extends V>, MergeResult>) — a function that determines which entry should be selected next
-
- Returns: an EntryStream containing the merged entries from all maps
-
Throws:
-
java.lang.IllegalArgumentException— if maps or nextSelector is null
-
- See also: #merge(Map, Map, BiFunction), #merge(Map, Map, Map, BiFunction), Stream#mergeIterables(Collection, BiFunction), MergeResult
zip(...) -> EntryStream<K, V>
-
Signature:
public static <K, V> EntryStream<K, V> zip(final K[] keys, final V[] values) - Summary: Zips two arrays of keys and values into an EntryStream.
-
Parameters:
-
keys(K[]) — the array of keys -
values(V[]) — the array of values
-
- Returns: an EntryStream containing entries created from the corresponding elements of the arrays
- See also: #zip(Object\[\], Object\[\], Object, Object), #zip(Iterable, Iterable), #of(Object\[\], Function), #concat(Map\[\]), #merge(Map, Map, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> zip(final K[] keys, final V[] values, final K valueForNoneKey, final V valueForNoneValue) - Summary: Zips two arrays of keys and values into an EntryStream with default values.
-
Contract:
- If one array is shorter, the provided default values are used for the remaining elements.
- <p> This method ensures that all elements from both arrays are used, filling in with default values when one array is longer than the other.
-
Parameters:
-
keys(K[]) — the array of keys -
values(V[]) — the array of values -
valueForNoneKey(K) — the default key to use when the values array is longer -
valueForNoneValue(V) — the default value to use when the keys array is longer
-
- Returns: an EntryStream containing entries created from the arrays with defaults for missing elements
- See also: #zip(Object\[\], Object\[\]), #zip(Iterable, Iterable, Object, Object), Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction), N#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> zip(final Iterable<? extends K> keys, final Iterable<? extends V> values) - Summary: Zips two iterables of keys and values into an EntryStream.
-
Parameters:
-
keys(Iterable<? extends K>) — the iterable providing keys -
values(Iterable<? extends V>) — the iterable providing values
-
- Returns: an EntryStream containing entries created from the corresponding elements
- See also: #zip(Iterable, Iterable, Object, Object), #zip(Object\[\], Object\[\]), Stream#zip(Iterable, Iterable, BiFunction), N#zip(Iterable, Iterable, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> zip(final Iterable<? extends K> keys, final Iterable<? extends V> values, final K valueForNoneKey, final V valueForNoneValue) - Summary: Zips two iterables of keys and values into an EntryStream with default values.
-
Contract:
- If one iterable is shorter, the provided default values are used for the remaining elements.
- <p> This method ensures that all elements from both iterables are used, filling in with default values when one iterable has fewer elements than the other.
-
Parameters:
-
keys(Iterable<? extends K>) — the iterable providing keys -
values(Iterable<? extends V>) — the iterable providing values -
valueForNoneKey(K) — the default key to use when values has more elements -
valueForNoneValue(V) — the default value to use when keys has more elements
-
- Returns: an EntryStream containing entries with defaults for missing elements
- See also: #zip(Iterable, Iterable), #zip(Object\[\], Object\[\], Object, Object), Stream#zip(Iterable, Iterable, Object, Object, BiFunction), N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> zip(final Iterator<? extends K> keys, final Iterator<? extends V> values) - Summary: Zips two iterators of keys and values into an EntryStream.
-
Parameters:
-
keys(Iterator<? extends K>) — the iterator providing keys -
values(Iterator<? extends V>) — the iterator providing values
-
- Returns: an EntryStream containing entries created from the corresponding elements
- See also: #zip(Iterator, Iterator, Object, Object), #zip(Iterable, Iterable), Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static <K, V> EntryStream<K, V> zip(final Iterator<? extends K> keys, final Iterator<? extends V> values, final K valueForNoneKey, final V valueForNoneValue) - Summary: Zips two iterators of keys and values into an EntryStream with default values.
-
Contract:
- If one iterator is exhausted before the other, the provided default values are used.
- <p> This method ensures that all elements from both iterators are used, filling in with default values when one iterator has fewer elements than the other.
-
Parameters:
-
keys(Iterator<? extends K>) — the iterator providing keys -
values(Iterator<? extends V>) — the iterator providing values -
valueForNoneKey(K) — the default key to use when values has more elements -
valueForNoneValue(V) — the default value to use when keys has more elements
-
- Returns: an EntryStream containing entries with defaults for missing elements
- See also: #zip(Iterator, Iterator), #zip(Iterable, Iterable, Object, Object), Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
Public Instance Methods
keys(...) -> Stream<K>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<K> keys() - Summary: Returns a stream consisting of the keys from the entries in this EntryStream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of the keys from the entries in this EntryStream
- See also: #values(), Stream#map(Function), Fn#key()
values(...) -> Stream<V>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<V> values() - Summary: Returns a stream consisting of the values from the entries in this EntryStream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of the values from the entries in this EntryStream
- See also: #keys(), Stream#map(Function), Fn#value()
entries(...) -> Stream<Map.Entry<K, V>>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<Map.Entry<K, V>> entries() - Summary: Returns a stream consisting of the entries (Map.Entry objects) in this EntryStream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of the entries in this EntryStream
invert(...) -> EntryStream<V, K>
-
Signature:
@SequentialOnly @IntermediateOp public EntryStream<V, K> invert() - Summary: Returns a new EntryStream with inverted key-value pairs.
-
Parameters:
- (none)
- Returns: a new EntryStream with inverted key-value pairs
- See also: #map(Function), #map(BiFunction), Stream#map(Function), Fn#invert()
selectByKey(...) -> EntryStream<KK, V>
-
Signature:
@SequentialOnly @IntermediateOp public <KK> EntryStream<KK, V> selectByKey(final Class<KK> clazz) - Summary: Returns a stream consisting of the elements of this stream whose keys are instances of the given class.
-
Parameters:
-
clazz(Class<KK>) — the class to filter the keys by
-
- Returns: a new EntryStream with keys filtered by the specified class
- See also: #selectByValue(Class), #filterByKey(Predicate)
selectByValue(...) -> EntryStream<K, VV>
-
Signature:
@SequentialOnly @IntermediateOp public <VV> EntryStream<K, VV> selectByValue(final Class<VV> clazz) - Summary: Returns a stream consisting of the elements of this stream whose values are instances of the given class.
-
Parameters:
-
clazz(Class<VV>) — the class to filter the values by
-
- Returns: a new EntryStream with values filtered by the specified class
- See also: #selectByKey(Class), #filterByValue(Predicate)
filter(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> filter(final Predicate<? super Map.Entry<K, V>> predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry to determine if it should be included
-
- Returns: a new EntryStream consisting of entries that match the given predicate
- See also: Stream#filter(Predicate)
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> filter(final BiPredicate<? super K, ? super V> predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given bi-predicate.
-
Parameters:
-
predicate(BiPredicate<? super K, ? super V>) — a non-interfering, stateless bi-predicate to apply to each key-value pair
-
- Returns: a new EntryStream consisting of entries that match the given predicate
- See also: Stream#filter(Predicate)
-
Signature:
@Override public EntryStream<K, V> filter(final Predicate<? super Map.Entry<K, V>> predicate, final Consumer<? super Map.Entry<K, V>> onDrop) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry -
onDrop(Consumer<? super Map.Entry<K, V>>) — the action to perform on entries that don't match the predicate
-
- Returns: a new EntryStream consisting of entries that match the given predicate
- See also: Stream#filter(Predicate)
filterByKey(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> filterByKey(final Predicate<? super K> keyPredicate) - Summary: Returns a stream consisting of the elements of this stream whose keys match the given predicate.
-
Parameters:
-
keyPredicate(Predicate<? super K>) — a non-interfering, stateless predicate to apply to each key
-
- Returns: a new EntryStream consisting of entries whose keys match the given predicate
- See also: #filterByValue(Predicate), Stream#filter(Predicate)
filterByValue(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> filterByValue(final Predicate<? super V> valuePredicate) - Summary: Returns a stream consisting of the elements of this stream whose values match the given predicate.
-
Parameters:
-
valuePredicate(Predicate<? super V>) — a non-interfering, stateless predicate to apply to each value
-
- Returns: a new EntryStream consisting of entries whose values match the given predicate
- See also: #filterByKey(Predicate), Stream#filter(Predicate)
takeWhile(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> takeWhile(final Predicate<? super Map.Entry<K, V>> predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry
-
- Returns: a new EntryStream consisting of elements taken while the predicate returns true
- See also: Stream#takeWhile(Predicate)
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> takeWhile(final BiPredicate<? super K, ? super V> predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(BiPredicate<? super K, ? super V>) — a non-interfering, stateless bi-predicate to apply to each key-value pair
-
- Returns: a new EntryStream consisting of elements taken while the predicate returns true
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> dropWhile(final Predicate<? super Map.Entry<K, V>> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry
-
- Returns: a new EntryStream consisting of the remaining elements after dropping
- See also: Stream#dropWhile(Predicate)
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> dropWhile(final BiPredicate<? super K, ? super V> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(BiPredicate<? super K, ? super V>) — a non-interfering, stateless bi-predicate to apply to each key-value pair
-
- Returns: a new EntryStream consisting of the remaining elements after dropping
- See also: Stream#dropWhile(Predicate)
-
Signature:
@Override public EntryStream<K, V> dropWhile(final Predicate<? super Map.Entry<K, V>> predicate, final Consumer<? super Map.Entry<K, V>> onDrop) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
- The implementation should ensure the action is thread-safe when used with parallel streams.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry -
onDrop(Consumer<? super Map.Entry<K, V>>) — the action to perform on each dropped entry
-
- Returns: a new EntryStream consisting of the remaining elements after dropping
- See also: Stream#dropWhile(Predicate)
skipUntil(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> skipUntil(final Predicate<? super Map.Entry<K, V>> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements until the given predicate evaluates to {@code true} .
-
Contract:
- This can produce results that appear unintuitive when the stream does not define an encounter order.
-
Parameters:
-
predicate(Predicate<? super Map.Entry<K, V>>) — a non-interfering, stateless predicate to apply to each entry
-
- Returns: a new EntryStream consisting of the remaining elements after skipping
-
Signature:
@Beta @ParallelSupported @IntermediateOp public EntryStream<K, V> skipUntil(final BiPredicate<? super K, ? super V> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements until the given predicate evaluates to {@code true} .
-
Contract:
- This can produce results that appear unintuitive when the stream does not define an encounter order.
-
Parameters:
-
predicate(BiPredicate<? super K, ? super V>) — a non-interfering, stateless bi-predicate to apply to each key-value pair
-
- Returns: a new EntryStream consisting of the remaining elements after skipping
map(...) -> EntryStream<KK, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> map(final Function<? super Map.Entry<K, V>, ? extends Map.Entry<? extends KK, ? extends VV>> mapper) - Summary: Returns a new EntryStream with entries transformed using the given mapper function.
-
Parameters:
-
mapper(Function<? super Map.Entry<K, V>, ? extends Map.Entry<? extends KK, ? extends VV>>) — a non-interfering, stateless function that transforms each entry
-
- Returns: a new EntryStream with transformed entries
- See also: Stream#map(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> map(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Function<? super Map.Entry<K, V>, ? extends VV> valueMapper) - Summary: Returns a new EntryStream with entries transformed using the given key and value mapper functions.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — a non-interfering, stateless function to transform each entry's key -
valueMapper(Function<? super Map.Entry<K, V>, ? extends VV>) — a non-interfering, stateless function to transform each entry's value
-
- Returns: a new EntryStream with transformed entries
- See also: #map(Function), #map(BiFunction, BiFunction), Stream#map(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> map(final BiFunction<? super K, ? super V, ? extends Map.Entry<? extends KK, ? extends VV>> mapper) - Summary: Returns a new EntryStream with entries transformed using the given bi-function mapper.
-
Parameters:
-
mapper(BiFunction<? super K, ? super V, ? extends Map.Entry<? extends KK, ? extends VV>>) — a non-interfering, stateless bi-function that transforms each key-value pair into a new entry
-
- Returns: a new EntryStream with transformed entries
- See also: #map(Function), #map(BiFunction, BiFunction), Stream#map(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> map(final BiFunction<? super K, ? super V, ? extends KK> keyMapper, final BiFunction<? super K, ? super V, ? extends VV> valueMapper) - Summary: Returns a new EntryStream with entries transformed using the given key and value mapper bi-functions.
-
Parameters:
-
keyMapper(BiFunction<? super K, ? super V, ? extends KK>) — a non-interfering, stateless bi-function to transform each key-value pair into a new key -
valueMapper(BiFunction<? super K, ? super V, ? extends VV>) — a non-interfering, stateless bi-function to transform each key-value pair into a new value
-
- Returns: a new EntryStream with transformed entries
- See also: #map(Function), #map(BiFunction), #map(Function, Function), Stream#map(Function)
mapMulti(...) -> EntryStream<KK, VV>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> mapMulti(final BiConsumer<? super Map.Entry<K, V>, ? super Consumer<Map.Entry<KK, VV>>> mapper) - Summary: Returns a new EntryStream by applying a one-to-many transformation to each entry.
-
Parameters:
-
mapper(BiConsumer<? super Map.Entry<K, V>, ? super Consumer<Map.Entry<KK, VV>>>) — a non-interfering, stateless bi-consumer that receives each entry and a consumer for output entries
-
- Returns: a new EntryStream with mapped entries
- See also: Stream#mapMulti(BiConsumer)
mapPartial(...) -> EntryStream<KK, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> mapPartial(final Function<? super Map.Entry<K, V>, Optional<Map.Entry<? extends KK, ? extends VV>>> mapper) - Summary: Returns a new EntryStream by applying a transformation that may produce optional entries.
-
Parameters:
-
mapper(Function<? super Map.Entry<K, V>, Optional<Map.Entry<? extends KK, ? extends VV>>>) — a non-interfering, stateless function that transforms each entry to an optional entry
-
- Returns: a new EntryStream with transformed entries, excluding empty optionals
- See also: Stream#mapPartial(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> mapPartial(final BiFunction<? super K, ? super V, Optional<Map.Entry<? extends KK, ? extends VV>>> mapper) - Summary: Returns a new EntryStream by applying a bi-function transformation that may produce optional entries.
-
Parameters:
-
mapper(BiFunction<? super K, ? super V, Optional<Map.Entry<? extends KK, ? extends VV>>>) — a non-interfering, stateless bi-function that transforms each key-value pair to an optional entry
-
- Returns: a new EntryStream with transformed entries, excluding empty optionals
- See also: #mapPartial(Function), Stream#mapPartial(Function)
mapKey(...) -> EntryStream<KK, V>
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> mapKey(final Function<? super K, ? extends KK> keyMapper) - Summary: Returns a new EntryStream with transformed keys while keeping the values unchanged.
-
Parameters:
-
keyMapper(Function<? super K, ? extends KK>) — a non-interfering, stateless function to transform each key
-
- Returns: a new EntryStream with transformed keys
- See also: #mapKey(BiFunction), #mapValue(Function), #map(Function), Stream#map(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> mapKey(final BiFunction<? super K, ? super V, ? extends KK> keyMapper) - Summary: Returns a new EntryStream with keys transformed using a bi-function that receives both key and value.
-
Parameters:
-
keyMapper(BiFunction<? super K, ? super V, ? extends KK>) — a non-interfering, stateless bi-function to transform each key using both key and value
-
- Returns: a new EntryStream with transformed keys
- See also: #mapKey(Function), #mapValue(BiFunction), #map(Function), Stream#map(Function)
mapValue(...) -> EntryStream<K, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> mapValue(final Function<? super V, ? extends VV> valueMapper) - Summary: Returns a new EntryStream with transformed values while keeping the keys unchanged.
-
Parameters:
-
valueMapper(Function<? super V, ? extends VV>) — a non-interfering, stateless function to transform each value
-
- Returns: a new EntryStream with transformed values
- See also: #mapValue(BiFunction), #mapKey(Function), #map(Function), Stream#map(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> mapValue(final BiFunction<? super K, ? super V, ? extends VV> valueMapper) - Summary: Returns a new EntryStream with values transformed using a bi-function that receives both key and value.
-
Parameters:
-
valueMapper(BiFunction<? super K, ? super V, ? extends VV>) — a non-interfering, stateless bi-function to transform each value using both key and value
-
- Returns: a new EntryStream with transformed values
- See also: #mapValue(Function), #mapKey(BiFunction), #map(Function), Stream#map(Function)
mapKeyPartial(...) -> EntryStream<KK, V>
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> mapKeyPartial(final Function<? super K, Optional<KK>> keyMapper) - Summary: Returns a new EntryStream with keys transformed using a function that may produce optional results.
-
Parameters:
-
keyMapper(Function<? super K, Optional<KK>>) — a non-interfering, stateless function to transform each key to an optional key
-
- Returns: a new EntryStream with transformed keys, excluding entries with empty optional keys
- See also: #mapKeyPartial(BiFunction), #mapValuePartial(Function), Stream#mapPartial(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> mapKeyPartial(final BiFunction<? super K, ? super V, Optional<KK>> keyMapper) - Summary: Returns a new EntryStream with keys transformed using a bi-function that may produce optional results.
-
Parameters:
-
keyMapper(BiFunction<? super K, ? super V, Optional<KK>>) — a non-interfering, stateless bi-function to transform each key-value pair to an optional key
-
- Returns: a new EntryStream with transformed keys, excluding entries with empty optional keys
- See also: #mapKeyPartial(Function), #mapValuePartial(BiFunction), Stream#mapPartial(Function)
mapValuePartial(...) -> EntryStream<K, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> mapValuePartial(final Function<? super V, Optional<VV>> valueMapper) - Summary: Returns a new EntryStream with values transformed using a function that may produce optional results.
-
Parameters:
-
valueMapper(Function<? super V, Optional<VV>>) — a non-interfering, stateless function to transform each value to an optional value
-
- Returns: a new EntryStream with transformed values, excluding entries with empty optional values
- See also: #mapValuePartial(BiFunction), #mapKeyPartial(Function), Stream#mapPartial(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> mapValuePartial(final BiFunction<? super K, ? super V, Optional<VV>> valueMapper) - Summary: Returns a new EntryStream with values transformed using a bi-function that may produce optional results.
-
Parameters:
-
valueMapper(BiFunction<? super K, ? super V, Optional<VV>>) — a non-interfering, stateless bi-function to transform each key-value pair to an optional value
-
- Returns: a new EntryStream with transformed values, excluding entries with empty optional values
- See also: #mapValuePartial(Function), #mapKeyPartial(BiFunction), Stream#mapPartial(Function)
flatMap(...) -> EntryStream<KK, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> flatMap(final Function<? super Map.Entry<K, V>, ? extends EntryStream<? extends KK, ? extends VV>> mapper) - Summary: Returns a new EntryStream by applying a one-to-many transformation where each entry is mapped to an EntryStream.
-
Parameters:
-
mapper(Function<? super Map.Entry<K, V>, ? extends EntryStream<? extends KK, ? extends VV>>) — a non-interfering, stateless function that transforms each entry to an EntryStream
-
- Returns: a new EntryStream with flat-mapped entries
- See also: Stream#flatMap(Function), Stream#flatmap(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> flatMap(final BiFunction<? super K, ? super V, ? extends EntryStream<? extends KK, ? extends VV>> mapper) - Summary: Returns a new EntryStream by applying a one-to-many transformation where each key-value pair is mapped to an EntryStream.
-
Parameters:
-
mapper(BiFunction<? super K, ? super V, ? extends EntryStream<? extends KK, ? extends VV>>) — a non-interfering, stateless bi-function that transforms each key-value pair to an EntryStream
-
- Returns: a new EntryStream with flat-mapped entries
- See also: #flatMap(Function), Stream#flatMap(Function), Stream#flatmap(Function)
flatmap(...) -> EntryStream<KK, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> flatmap(final Function<? super Map.Entry<K, V>, ? extends Map<? extends KK, ? extends VV>> mapper) - Summary: Returns a new EntryStream by applying a one-to-many transformation where each entry is mapped to a Map.
-
Parameters:
-
mapper(Function<? super Map.Entry<K, V>, ? extends Map<? extends KK, ? extends VV>>) — a non-interfering, stateless function that transforms each entry to a Map
-
- Returns: a new EntryStream with flat-mapped entries
- See also: Stream#flatMap(Function), Stream#flatmap(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK, VV> EntryStream<KK, VV> flatmap(final BiFunction<? super K, ? super V, ? extends Map<? extends KK, ? extends VV>> mapper) - Summary: Applies a mapping operation on the stream with multiple output elements for each input element.
-
Parameters:
-
mapper(BiFunction<? super K, ? super V, ? extends Map<? extends KK, ? extends VV>>) — a non-interfering, stateless BiFunction that transforms each entry
-
- Returns: a new EntryStream with transformed entries
- See also: #flatmap(Function), Stream#flatMap(Function), Stream#flatmap(Function)
flattMap(...) -> EntryStream<KK, VV>
-
Signature:
@ParallelSupported @IntermediateOp @Beta public <KK, VV> EntryStream<KK, VV> flattMap( final Function<? super Map.Entry<K, V>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>> mapper) - Summary: Applies a mapping operation on the stream with multiple output elements for each input element.
-
Parameters:
-
mapper(Function<? super Map.Entry<K, V>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>>) — a non-interfering, stateless Function that transforms each entry
-
- Returns: a new EntryStream with transformed entries
- See also: Stream#flatMap(Function), Stream#flatmap(Function)
-
Signature:
@ParallelSupported @IntermediateOp @Beta public <KK, VV> EntryStream<KK, VV> flattMap( final BiFunction<? super K, ? super V, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>> mapper) - Summary: Applies a mapping operation on the stream with multiple output elements for each input element.
-
Parameters:
-
mapper(BiFunction<? super K, ? super V, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>>) — a non-interfering, stateless BiFunction that transforms each entry
-
- Returns: a new EntryStream with transformed entries
- See also: #flattMap(Function), Stream#flatMap(Function), Stream#flatmap(Function)
flatMapKey(...) -> EntryStream<KK, V>
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> flatMapKey(final Function<? super K, ? extends Stream<? extends KK>> keyMapper) - Summary: Applies a mapping operation on the keys in this EntryStream with multiple output elements for each input key.
-
Parameters:
-
keyMapper(Function<? super K, ? extends Stream<? extends KK>>) — a non-interfering, stateless function to apply to each key to transform it into a Stream of new keys
-
- Returns: a new EntryStream with transformed keys
- See also: #flatMapKey(BiFunction), #flatMapValue(Function), #flatmapKey(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> flatMapKey(final BiFunction<? super K, ? super V, ? extends Stream<? extends KK>> keyMapper) - Summary: Applies a mapping operation on the keys in this EntryStream with multiple output elements for each input key.
-
Parameters:
-
keyMapper(BiFunction<? super K, ? super V, ? extends Stream<? extends KK>>) — a non-interfering, stateless function to apply to each key-value pair to transform it into a Stream of new keys
-
- Returns: a new EntryStream with transformed keys
- See also: #flatMapKey(Function), Stream#flatMap(Function), #flatMapValue(BiFunction)
flatmapKey(...) -> EntryStream<KK, V>
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> flatmapKey(final Function<? super K, ? extends Collection<? extends KK>> keyMapper) - Summary: Applies a mapping operation on the keys in this EntryStream with multiple output elements for each input key.
-
Parameters:
-
keyMapper(Function<? super K, ? extends Collection<? extends KK>>) — a non-interfering, stateless function to apply to each key to transform it into a Collection of new keys
-
- Returns: a new EntryStream with transformed keys
- See also: Stream#flatMap(Function), #flatMapKey(Function), #flatmapValue(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <KK> EntryStream<KK, V> flatmapKey(final BiFunction<? super K, ? super V, ? extends Collection<? extends KK>> keyMapper) - Summary: Applies a mapping operation on the keys in this EntryStream with multiple output elements for each input key.
-
Parameters:
-
keyMapper(BiFunction<? super K, ? super V, ? extends Collection<? extends KK>>) — a non-interfering, stateless function to apply to each key-value pair to transform it into a Collection of new keys
-
- Returns: a new EntryStream with transformed keys
- See also: #flatMapKey(Function), #flatMapKey(BiFunction), #flatmapValue(BiFunction)
flatMapValue(...) -> EntryStream<K, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> flatMapValue(final Function<? super V, ? extends Stream<? extends VV>> valueMapper) - Summary: Applies a mapping operation on the values in this EntryStream with multiple output elements for each input value.
-
Parameters:
-
valueMapper(Function<? super V, ? extends Stream<? extends VV>>) — a non-interfering, stateless function to apply to each value to transform it into a Stream of new values
-
- Returns: a new EntryStream with transformed values
- See also: Stream#flatMap(Function), #flatMapKey(Function), #flatmapValue(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> flatMapValue(final BiFunction<? super K, ? super V, ? extends Stream<? extends VV>> valueMapper) - Summary: Applies a mapping operation on the values in this EntryStream with multiple output elements for each input value.
-
Parameters:
-
valueMapper(BiFunction<? super K, ? super V, ? extends Stream<? extends VV>>) — a non-interfering, stateless function to apply to each key-value pair to transform it into a Stream of new values
-
- Returns: a new EntryStream with transformed values
- See also: #flatMapValue(Function), Stream#flatMap(Function), #flatMapKey(BiFunction)
flatmapValue(...) -> EntryStream<K, VV>
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> flatmapValue(final Function<? super V, ? extends Collection<? extends VV>> valueMapper) - Summary: Applies a mapping operation on the values in this EntryStream with multiple output elements for each input value.
-
Parameters:
-
valueMapper(Function<? super V, ? extends Collection<? extends VV>>) — a non-interfering, stateless function to apply to each value to transform it into a Collection of new values
-
- Returns: a new EntryStream with transformed values
- See also: Stream#flatMap(Function), #flatMapValue(Function), #flatmapKey(Function)
-
Signature:
@ParallelSupported @IntermediateOp public <VV> EntryStream<K, VV> flatmapValue(final BiFunction<? super K, ? super V, ? extends Collection<? extends VV>> valueMapper) - Summary: Applies a mapping operation on the values in this EntryStream with multiple output elements for each input value.
-
Parameters:
-
valueMapper(BiFunction<? super K, ? super V, ? extends Collection<? extends VV>>) — a non-interfering, stateless function to apply to each key-value pair to transform it into a Collection of new values
-
- Returns: a new EntryStream with transformed values
- See also: #flatMapValue(Function), #flatMapValue(BiFunction), #flatmapKey(BiFunction)
groupBy(...) -> EntryStream<K, List<V>>
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered public EntryStream<K, List<V>> groupBy() - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
- (none)
- Returns: a new EntryStream with keys and their associated list of values
- See also: Stream#groupBy(Function, Function), #groupBy(BinaryOperator), #groupBy(Collector)
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered public EntryStream<K, List<V>> groupBy(final Supplier<? extends Map<K, List<V>>> mapFactory) - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
-
mapFactory(Supplier<? extends Map<K, List<V>>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream with keys and their associated list of values
- See also: Stream#groupBy(Function, Function, Supplier), #groupBy()
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, VV> EntryStream<KK, List<VV>> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Function<? super Map.Entry<K, V>, ? extends VV> valueMapper) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
valueMapper(Function<? super Map.Entry<K, V>, ? extends VV>) — the function to be applied to each element in the stream to determine its value in the group
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier, and the value is a list of elements that mapped to the corresponding key.
- See also: Stream#groupBy(Function, Function)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, VV> EntryStream<KK, List<VV>> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Function<? super Map.Entry<K, V>, ? extends VV> valueMapper, final Supplier<? extends Map<KK, List<VV>>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
valueMapper(Function<? super Map.Entry<K, V>, ? extends VV>) — the function to be applied to each element in the stream to determine its value in the group -
mapFactory(Supplier<? extends Map<KK, List<VV>>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier, and the value is a list of elements that mapped to the corresponding key.
- See also: Stream#groupBy(Function, Function, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <D> EntryStream<K, D> groupBy(final Collector<? super Map.Entry<K, V>, ?, D> downstream) - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
-
downstream(Collector<? super Map.Entry<K, V>, ?, D>) — the collector to use for grouping the entries
-
- Returns: a new EntryStream with keys and their associated collected results
- See also: Stream#groupBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <D> EntryStream<K, D> groupBy(final Collector<? super Map.Entry<K, V>, ?, D> downstream, final Supplier<? extends Map<K, D>> mapFactory) - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
-
downstream(Collector<? super Map.Entry<K, V>, ?, D>) — the collector to use for grouping the entries -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream with keys and their associated collected results
- See also: Stream#groupBy(Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, D> EntryStream<KK, D> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Collector<? super Map.Entry<K, V>, ?, D> downstream) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
downstream(Collector<? super Map.Entry<K, V>, ?, D>) — the collector to use for grouping the entries
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of the downstream collector.
- See also: Stream#groupBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, D> EntryStream<KK, D> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Collector<? super Map.Entry<K, V>, ?, D> downstream, final Supplier<? extends Map<KK, D>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
downstream(Collector<? super Map.Entry<K, V>, ?, D>) — the collector to use for grouping the entries -
mapFactory(Supplier<? extends Map<KK, D>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of the downstream collector.
- See also: Stream#groupBy(Function, Collector, Supplier)
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> groupBy(final BinaryOperator<V> mergeFunction) - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — the function to merge values associated with the same key
-
- Returns: a new EntryStream with keys and their associated merged values
- See also: Stream#groupBy(Function, Function, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> groupBy(final BinaryOperator<V> mergeFunction, final Supplier<? extends Map<K, V>> mapFactory) - Summary: Groups the entries in this EntryStream by their keys.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — the function to merge values associated with the same key -
mapFactory(Supplier<? extends Map<K, V>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream with keys and their associated merged values
- See also: Stream#groupBy(Function, Function, BinaryOperator, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, VV> EntryStream<KK, VV> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Function<? super Map.Entry<K, V>, ? extends VV> valueMapper, final BinaryOperator<VV> mergeFunction) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element, and then merges the values associated with the same key using the provided merge function.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
valueMapper(Function<? super Map.Entry<K, V>, ? extends VV>) — the function to be applied to each element in the stream to determine its value in the group -
mergeFunction(BinaryOperator<VV>) — the function to merge values associated with the same key
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of merging the values that mapped to the corresponding key.
- See also: Stream#groupBy(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <KK, VV> EntryStream<KK, VV> groupBy(final Function<? super Map.Entry<K, V>, ? extends KK> keyMapper, final Function<? super Map.Entry<K, V>, ? extends VV> valueMapper, final BinaryOperator<VV> mergeFunction, final Supplier<? extends Map<KK, VV>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element, and then merges the values associated with the same key using the provided merge function.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends KK>) — the function to be applied to each element in the stream to determine the group it belongs to -
valueMapper(Function<? super Map.Entry<K, V>, ? extends VV>) — the function to be applied to each element in the stream to determine its value in the group -
mergeFunction(BinaryOperator<VV>) — the function to merge values associated with the same key -
mapFactory(Supplier<? extends Map<KK, VV>>) — the supplier providing a new empty Map into which the results will be inserted
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of merging the values that mapped to the corresponding key.
- See also: Stream#groupBy(Function, Function, BinaryOperator, Supplier)
collapseByKey(...) -> Stream<List<V>>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<List<V>> collapseByKey(final BiPredicate<? super K, ? super K> collapsible) - Summary: Collapse the entries in this EntryStream based on the given key predicate.
-
Contract:
- Adjacent elements are collapsed together when their keys satisfy the given predicate.
-
Parameters:
-
collapsible(BiPredicate<? super K, ? super K>) — a predicate that determines if two consecutive elements should be collapsed into the same group The first parameter is the key of last(not the first) element of the current group, and the second parameter is the key of the next element to check.
-
- Returns: a new Stream with lists of values whose keys are collapsible
- See also: #collapseByKey(BiPredicate, Function, Collector), Stream#collapse(BiPredicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public <U, R> Stream<R> collapseByKey(final BiPredicate<? super K, ? super K> collapsible, final Function<? super Map.Entry<K, V>, U> mapper, final Collector<? super U, ?, R> collector) - Summary: Collapse the entries in this EntryStream based on the given key predicate.
-
Contract:
- Adjacent elements are collapsed together when their keys satisfy the given predicate.
-
Parameters:
-
collapsible(BiPredicate<? super K, ? super K>) — a predicate that determines if two consecutive elements should be collapsed into the same group The first parameter is the key of last(not the first) element of the current group, and the second parameter is the key of the next element to check. -
mapper(Function<? super Map.Entry<K, V>, U>) — a non-interfering, stateless function that maps each entry to a value -
collector(Collector<? super U, ?, R>) — the collector to collect the mapped values
-
- Returns: a new Stream with the collapsed and collected results
- See also: Stream#collapse(BiPredicate, Collector)
collapseByValue(...) -> Stream<List<K>>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<List<K>> collapseByValue(final BiPredicate<? super V, ? super V> collapsible) - Summary: Collapse the entries in this EntryStream based on the given value predicate.
-
Contract:
- Adjacent elements are collapsed together when their values satisfy the given predicate.
-
Parameters:
-
collapsible(BiPredicate<? super V, ? super V>) — a predicate that determines if two consecutive elements should be collapsed into the same group The first parameter is the value of last(not the first) element of the current group, and the second parameter is the value of the next element to check.
-
- Returns: a new Stream with lists of keys whose values are collapsible
- See also: #collapseByValue(BiPredicate, Function, Collector), Stream#collapse(BiPredicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public <U, R> Stream<R> collapseByValue(final BiPredicate<? super V, ? super V> collapsible, final Function<? super Map.Entry<K, V>, U> mapper, final Collector<? super U, ?, R> collector) - Summary: Collapse the entries in this EntryStream based on the given value predicate.
-
Contract:
- Adjacent elements are collapsed together when their values satisfy the given predicate.
-
Parameters:
-
collapsible(BiPredicate<? super V, ? super V>) — a predicate that determines if two consecutive elements should be collapsed into the same group The first parameter is the value of last(not the first) element of the current group, and the second parameter is the value of the next element to check. -
mapper(Function<? super Map.Entry<K, V>, U>) — a non-interfering, stateless function that maps each entry to a value -
collector(Collector<? super U, ?, R>) — the collector to collect the mapped values
-
- Returns: a new Stream with the collapsed and collected results
- See also: Stream#collapse(BiPredicate, Collector)
split(...) -> Stream<List<Map.Entry<K, V>>>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<List<Map.Entry<K, V>>> split(final int chunkSize) - Summary: Splits the stream into chunks of the specified size.
-
Contract:
- The last chunk may contain fewer elements if the stream size is not evenly divisible by the chunk size.
-
Parameters:
-
chunkSize(int) — the size of each chunk
-
- Returns: a new Stream consisting of Lists of Map.Entry objects, each representing a chunk of the original Stream.
- See also: Stream#split(int)
-
Signature:
@SequentialOnly @IntermediateOp public <C extends Collection<Map.Entry<K, V>>> Stream<C> split(final int chunkSize, final IntFunction<? extends C> collectionSupplier) - Summary: Splits the stream into chunks of the specified size.
-
Contract:
- The last chunk may contain fewer elements if the stream size is not evenly divisible by the chunk size.
-
Parameters:
-
chunkSize(int) — the size of each chunk -
collectionSupplier(IntFunction<? extends C>) — a function which returns a new, empty collection of the appropriate type
-
- Returns: a new Stream consisting of collections of Map.Entry objects, each representing a chunk of the original Stream.
- See also: Stream#split(int, IntFunction)
sliding(...) -> Stream<List<Map.Entry<K, V>>>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<List<Map.Entry<K, V>>> sliding(final int windowSize) - Summary: Creates a sliding window over the elements of the Stream, where each window is a List of Map.Entry objects.
-
Contract:
- Each window contains exactly windowSize elements, except possibly the last few windows which may contain fewer elements if there are not enough remaining elements in the stream.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements
-
- Returns: a new Stream where each element is a List of Map.Entry objects from the original Stream, representing a window.
-
Signature:
@SequentialOnly @IntermediateOp public <C extends Collection<Map.Entry<K, V>>> Stream<C> sliding(final int windowSize, final IntFunction<? extends C> collectionSupplier) - Summary: Creates a sliding window over the elements of the Stream, where each window is a collection of Map.Entry objects specified by the collectionSupplier.
-
Contract:
- Each window contains exactly windowSize elements, except possibly the last few windows which may contain fewer elements if there are not enough remaining elements in the stream.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements -
collectionSupplier(IntFunction<? extends C>) — a function which returns a new, empty collection of the appropriate type
-
- Returns: a new Stream where each element is a collection of Map.Entry objects from the original Stream, representing a window.
-
Signature:
@SequentialOnly @IntermediateOp public Stream<List<Map.Entry<K, V>>> sliding(final int windowSize, final int increment) - Summary: Creates a sliding window over the elements of the Stream, where each window is a List of Map.Entry objects.
-
Contract:
- Each window contains exactly windowSize elements, except possibly the last few windows which may contain fewer elements if there are not enough remaining elements in the stream.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements -
increment(int) — the number of elements to move the window forward after each step
-
- Returns: a new Stream where each element is a List of Map.Entry objects from the original Stream, representing a window.
-
Signature:
@SequentialOnly @IntermediateOp public <C extends Collection<Map.Entry<K, V>>> Stream<C> sliding(final int windowSize, final int increment, final IntFunction<? extends C> collectionSupplier) - Summary: Creates a sliding window over the elements of the Stream, where each window is a collection of Map.Entry objects specified by the collectionSupplier.
-
Contract:
- Each window contains exactly windowSize elements, except possibly the last few windows which may contain fewer elements if there are not enough remaining elements in the stream.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements -
increment(int) — the number of elements to move the window forward after each step -
collectionSupplier(IntFunction<? extends C>) — a function which returns a new, empty collection of the appropriate type
-
- Returns: a new Stream where each element is a collection of Map.Entry objects from the original Stream, representing a window.
intersection(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> intersection(final Collection<?> c) - Summary: Returns an EntryStream consisting of the elements that are present in both this stream and the specified collection.
-
Parameters:
-
c(Collection<?>) — the collection to find common elements with this stream
-
- Returns: a new EntryStream containing entries present in both this stream and the specified collection, considering the minimum number of occurrences in either source
- See also: Stream#intersection(Collection), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Collection#retainAll(Collection), #difference(Collection), #symmetricDifference(Collection)
-
Signature:
@SequentialOnly @IntermediateOp public EntryStream<K, V> intersection(final Map<? extends K, ? extends V> map) - Summary: Returns an EntryStream consisting of the elements that are present in both this stream and the specified map.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map to find common elements with this stream
-
- Returns: a new EntryStream containing entries present in both this stream and the specified map, considering the minimum number of occurrences in either source
- See also: Stream#intersection(Collection), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Collection#retainAll(Collection), #difference(Collection), #symmetricDifference(Collection)
difference(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> difference(final Collection<?> c) - Summary: Returns an EntryStream consisting of the elements of this stream that are not present in the specified collection, considering the number of occurrences of each element.
-
Parameters:
-
c(Collection<?>) — the collection to compare against this stream
-
- Returns: a new EntryStream containing the elements that are present in this stream but not in the specified collection, considering the number of occurrences
- See also: Stream#difference(Collection), N#difference(Collection, Collection), #intersection(Collection), #symmetricDifference(Collection)
-
Signature:
@SequentialOnly @IntermediateOp public EntryStream<K, V> difference(final Map<?, ?> map) - Summary: Returns an EntryStream consisting of the elements of this stream that are not present in the specified map, considering the number of occurrences of each element.
-
Parameters:
-
map(Map<?, ?>) — the map to compare against this stream
-
- Returns: a new EntryStream containing the elements that are present in this stream but not in the specified map, considering the number of occurrences
- See also: Stream#difference(Collection), N#difference(Collection, Collection), #intersection(Collection), #symmetricDifference(Collection)
symmetricDifference(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> symmetricDifference(final Collection<Map.Entry<K, V>> c) - Summary: Returns an EntryStream consisting of elements that are present in either this stream or the specified collection, but not in both.
-
Parameters:
-
c(Collection<Map.Entry<K, V>>) — the collection to compare with this stream for symmetric difference
-
- Returns: a new EntryStream containing entries that are present in either this stream or the collection, but not in both, considering the number of occurrences
- See also: #intersection(Collection), #difference(Collection), N#symmetricDifference(Collection, Collection), N#symmetricDifference(int\[\], int\[\]), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), Difference#of(Collection, Collection), Iterables#symmetricDifference(Set, Set)
-
Signature:
@SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") public EntryStream<K, V> symmetricDifference(final Map<? extends K, ? extends V> map) - Summary: Returns an EntryStream consisting of elements that are present in either this stream or the specified map, but not in both.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map to compare with this stream for symmetric difference
-
- Returns: a new EntryStream containing entries that are present in either this stream or the map, but not in both, considering the number of occurrences
- See also: #intersection(Collection), #difference(Collection), N#symmetricDifference(Collection, Collection), N#symmetricDifference(int\[\], int\[\]), N#excludeAll(Collection, Collection), N#excludeAllToSet(Collection, Collection), Difference#of(Collection, Collection), Iterables#symmetricDifference(Set, Set)
sorted(...) -> EntryStream<K, V>
-
Signature:
@Deprecated @Override public EntryStream<K, V> sorted() throws UnsupportedOperationException - Summary: Returns a sorted EntryStream based on the natural ordering of the keys and values.
-
Parameters:
- (none)
- Returns: a new EntryStream with entries sorted by key and value
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this method is deprecated. Use {@link #sorted(Comparator)} instead.
-
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sorted(final Comparator<? super Map.Entry<K, V>> comparator) - Summary: Returns a sorted EntryStream based on the specified comparator.
-
Parameters:
-
comparator(Comparator<? super Map.Entry<K, V>>) — the comparator to compare the entries
-
- Returns: a new EntryStream with entries sorted by the specified comparator
- See also: #reverseSorted(Comparator), Comparators#comparingByKey(), Comparators#comparingByKey(Comparator), Comparators#comparingByValue(), Comparators#comparingByValue(Comparator)
sortedByKey(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sortedByKey(final Comparator<? super K> keyComparator) - Summary: Returns a sorted EntryStream based on the specified key comparator.
-
Parameters:
-
keyComparator(Comparator<? super K>) — the comparator to compare the keys
-
- Returns: a new EntryStream with entries sorted by the specified key comparator
- See also: #sortedByValue(Comparator), #sorted(Comparator), Stream#sorted(Comparator), Comparators#comparingByKey(Comparator)
sortedByValue(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sortedByValue(final Comparator<? super V> valueComparator) - Summary: Returns a sorted EntryStream based on the specified value comparator.
-
Parameters:
-
valueComparator(Comparator<? super V>) — the comparator to compare the values
-
- Returns: a new EntryStream with entries sorted by the specified value comparator
- See also: #sortedByKey(Comparator), #sorted(Comparator), Stream#sorted(Comparator), Comparators#comparingByValue(Comparator)
sortedBy(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered @SuppressWarnings("rawtypes") public EntryStream<K, V> sortedBy(final Function<? super Map.Entry<K, V>, ? extends Comparable> keyMapper) - Summary: Returns a sorted EntryStream based on the specified extractor function.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends Comparable>) — the function to extract the comparable value for comparison
-
- Returns: a new EntryStream with entries sorted by the extracted values
- See also: #sorted(Comparator), #sortedByInt(ToIntFunction), Stream#sortedBy(Function)
sortedByInt(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sortedByInt(final ToIntFunction<? super Map.Entry<K, V>> keyMapper) - Summary: Returns a sorted EntryStream based on the specified extractor function.
-
Parameters:
-
keyMapper(ToIntFunction<? super Map.Entry<K, V>>) — the function to extract the integer value for comparison
-
- Returns: a new EntryStream with entries sorted by the extracted integer values
- See also: #sortedBy(Function), #sortedByLong(ToLongFunction), #sorted(Comparator), Stream#sortedByInt(ToIntFunction)
sortedByLong(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sortedByLong(final ToLongFunction<? super Map.Entry<K, V>> keyMapper) - Summary: Returns a sorted EntryStream based on the specified extractor function.
-
Parameters:
-
keyMapper(ToLongFunction<? super Map.Entry<K, V>>) — the function to extract the long value for comparison
-
- Returns: a new EntryStream with entries sorted by the extracted long values
- See also: #sortedByInt(ToIntFunction), #sortedByDouble(ToDoubleFunction), #sorted(Comparator), Stream#sortedByLong(ToLongFunction)
sortedByDouble(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> sortedByDouble(final ToDoubleFunction<? super Map.Entry<K, V>> keyMapper) - Summary: Returns a sorted EntryStream based on the specified extractor function.
-
Parameters:
-
keyMapper(ToDoubleFunction<? super Map.Entry<K, V>>) — the function to extract the double value for comparison
-
- Returns: a new EntryStream with entries sorted by the extracted double values
- See also: #sortedByLong(ToLongFunction), #sortedByInt(ToIntFunction), #sorted(Comparator), Stream#sortedByDouble(ToDoubleFunction)
reverseSorted(...) -> EntryStream<K, V>
-
Signature:
@Deprecated @Override public EntryStream<K, V> reverseSorted() throws UnsupportedOperationException - Summary: Returns a reverse sorted EntryStream based on the natural ordering of the keys and values.
-
Parameters:
- (none)
- Returns: a new EntryStream with entries reverse sorted by key and value
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this method is deprecated. Use {@link #reverseSorted(Comparator)} instead.
-
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> reverseSorted(final Comparator<? super Map.Entry<K, V>> comparator) - Summary: Returns a reverse sorted EntryStream based on the specified comparator.
-
Parameters:
-
comparator(Comparator<? super Map.Entry<K, V>>) — the comparator to compare the entries
-
- Returns: a new EntryStream with entries reverse sorted by the specified comparator
- See also: #sorted(Comparator), Comparators#comparingByKey(), Comparators#comparingByKey(Comparator), Comparators#comparingByValue(), Comparators#comparingByValue(Comparator)
reverseSortedBy(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> reverseSortedBy(@SuppressWarnings("rawtypes") final Function<? super Map.Entry<K, V>, ? extends Comparable> keyMapper) - Summary: Returns a reverse sorted EntryStream based on the specified key extractor function.
-
Parameters:
-
keyMapper(@SuppressWarnings(value = "rawtypes") Function<? super Map.Entry<K, V>, ? extends Comparable>) — the function to extract the comparable value for comparison
-
- Returns: a new EntryStream with entries reverse sorted by the extracted values
- See also: #reverseSorted(Comparator), #sortedBy(Function), Stream#reverseSortedBy(Function)
indexed(...) -> Stream<Indexed<Map.Entry<K, V>>>
-
Signature:
@Override public Stream<Indexed<Map.Entry<K, V>>> indexed() - Summary: Returns a stream of indexed entries from this EntryStream.
-
Parameters:
- (none)
- Returns: a Stream of Indexed objects containing the index and the entry
- See also: Stream#indexed()
distinct(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> distinct() - Summary: Returns a stream consisting of the distinct elements of this EntryStream.
-
Contract:
- For {@code Map.Entry} , this means entries are equal if both their keys and values are equal.
-
Parameters:
- (none)
- Returns: a new EntryStream with distinct elements
- See also: Stream#distinct()
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> distinct(final BinaryOperator<Map.Entry<K, V>> mergeFunction) - Summary: Returns a stream consisting of the distinct elements of this stream, The merge function is used to resolve conflicts between duplicate elements.
-
Contract:
- <p> When duplicate entries are encountered, the merge function is applied to determine which entry to keep.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Keep the entry with larger value when duplicates are found EntryStream.of(entries) .distinct((e1, e2) -> e1.getValue() > e2.getValue() ?
-
Parameters:
-
mergeFunction(BinaryOperator<Map.Entry<K, V>>) — the function to merge duplicate elements
-
- Returns: a new EntryStream with distinct elements
- See also: Stream#distinct(BinaryOperator)
distinctByKey(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp public EntryStream<K, V> distinctByKey() - Summary: Returns a stream consisting of the distinct elements of this stream based on the keys.
-
Contract:
- <p> When multiple entries have the same key, only the first occurrence is kept.
-
Parameters:
- (none)
- Returns: a new EntryStream with distinct elements based on the keys
- See also: Stream#distinctBy(Function)
distinctByValue(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp public EntryStream<K, V> distinctByValue() - Summary: Returns a stream consisting of the distinct elements of this stream based on the values.
-
Contract:
- <p> When multiple entries have the same value, only the first occurrence is kept.
-
Parameters:
- (none)
- Returns: a new EntryStream with distinct elements based on the values
- See also: Stream#distinctBy(Function)
distinctBy(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> distinctBy(final Function<? super Map.Entry<K, V>, ?> keyMapper) - Summary: Returns a stream consisting of the distinct elements of this stream based on the keys extracted by the specified key extractor function.
-
Contract:
- <p> When multiple entries produce the same key from the extractor function, only the first occurrence is kept.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ?>) — the function to extract the key for comparison
-
- Returns: a new EntryStream with distinct elements based on the extracted keys
- See also: Stream#distinctBy(Function)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public EntryStream<K, V> distinctBy(final Function<? super Map.Entry<K, V>, ?> keyMapper, final BinaryOperator<Map.Entry<K, V>> mergeFunction) - Summary: Returns a stream consisting of the distinct elements of this stream based on the keys extracted by the specified key extractor function.
-
Contract:
- <p> When multiple entries produce the same key from the extractor function, the merge function determines which entry to keep.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ?>) — the function to extract the key for comparison -
mergeFunction(BinaryOperator<Map.Entry<K, V>>) — the function to merge duplicate elements
-
- Returns: a new EntryStream with distinct elements based on the extracted keys
- See also: Stream#distinctBy(Function, BinaryOperator)
rotated(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> rotated(final int distance) - Summary: Returns a new EntryStream with the elements rotated by the specified distance.
-
Parameters:
-
distance(int) — the distance to rotate the elements
-
- Returns: a new EntryStream with the elements rotated by the specified distance
- See also: Stream#rotated(int)
shuffled(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> shuffled() - Summary: Returns a new EntryStream with the elements shuffled randomly.
-
Parameters:
- (none)
- Returns: a new EntryStream with the elements shuffled
- See also: Stream#shuffled()
-
Signature:
@Override public EntryStream<K, V> shuffled(final Random rnd) - Summary: Returns a new EntryStream with the elements shuffled using the specified random.
-
Parameters:
-
rnd(Random) — the random to shuffle the elements
-
- Returns: a new EntryStream with the elements shuffled using the specified random
- See also: Stream#shuffled(Random)
reversed(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> reversed() - Summary: Returns a new EntryStream with the elements in reverse order.
-
Parameters:
- (none)
- Returns: a new EntryStream with the elements reversed
- See also: Stream#reversed()
cycled(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> cycled() - Summary: Returns a new EntryStream with the elements cycled.
-
Parameters:
- (none)
- Returns: a new EntryStream with the elements cycled
- See also: Stream#cycled()
-
Signature:
@Override public EntryStream<K, V> cycled(final long rounds) - Summary: Returns a new EntryStream with the elements cycled a specified number of times.
-
Parameters:
-
rounds(long) — the number of rounds to cycle the elements
-
- Returns: a new EntryStream with the elements cycled the specified number of times
- See also: Stream#cycled(long)
prepend(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") public <M extends Map<? extends K, ? extends V>> EntryStream<K, V> prepend(final M map) - Summary: Prepends the specified map to the current EntryStream.
-
Contract:
- If the map is empty, the original stream is returned.
-
Parameters:
-
map(M) — the map to prepend to the stream
-
- Returns: a new EntryStream with the elements of the specified map prepended
- See also: Stream#prepend(Collection)
-
Signature:
@Override public EntryStream<K, V> prepend(final EntryStream<K, V> stream) - Summary: Prepends the specified stream to the current EntryStream.
-
Parameters:
-
stream(EntryStream<K, V>) — the stream to prepend to the current stream
-
- Returns: a new EntryStream with the elements of the specified stream prepended
- See also: Stream#prepend(BaseStream)
-
Signature:
@Override public EntryStream<K, V> prepend(final Optional<Map.Entry<K, V>> op) - Summary: Prepends the specified optional entry to the current EntryStream.
-
Contract:
- If the optional entry is empty, the original stream is returned.
-
Parameters:
-
op(Optional<Map.Entry<K, V>>) — the optional entry to prepend to the stream
-
- Returns: a new EntryStream with the optional entry prepended
- See also: #prepend(Map)
append(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") public <M extends Map<? extends K, ? extends V>> EntryStream<K, V> append(final M map) - Summary: Appends the specified map to the current EntryStream.
-
Contract:
- If the map is empty, the original stream is returned.
-
Parameters:
-
map(M) — the map to append to the stream
-
- Returns: a new EntryStream with the elements of the specified map appended
- See also: Stream#append(Collection)
-
Signature:
@Override public EntryStream<K, V> append(final EntryStream<K, V> stream) - Summary: Appends the specified stream to the current EntryStream.
-
Parameters:
-
stream(EntryStream<K, V>) — the stream to append to the current stream
-
- Returns: a new EntryStream with the elements of the specified stream appended
- See also: Stream#append(BaseStream)
-
Signature:
@Override public EntryStream<K, V> append(final Optional<Map.Entry<K, V>> op) - Summary: Appends the specified optional entry to the current EntryStream.
-
Contract:
- If the optional entry is empty, the original stream is returned.
-
Parameters:
-
op(Optional<Map.Entry<K, V>>) — the optional entry to append to the stream
-
- Returns: a new EntryStream with the optional entry appended
- See also: #append(Map)
appendIfEmpty(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp @SuppressWarnings("rawtypes") public <M extends Map<? extends K, ? extends V>> EntryStream<K, V> appendIfEmpty(final M map) - Summary: Appends the specified map to the current EntryStream if the stream is empty.
-
Contract:
- Appends the specified map to the current EntryStream if the stream is empty.
- If the map is empty or the stream is not empty, the original stream is returned.
-
Parameters:
-
map(M) — the map to append to the stream if the stream is empty
-
- Returns: a new EntryStream with the elements of the specified map appended if the stream is empty
- See also: Stream#appendIfEmpty(Collection)
-
Signature:
@Override public EntryStream<K, V> appendIfEmpty(final Supplier<? extends EntryStream<K, V>> supplier) - Summary: Appends the specified EntryStream to the current EntryStream if the stream is empty.
-
Contract:
- Appends the specified EntryStream to the current EntryStream if the stream is empty.
- If the stream is not empty, the original stream is returned.
- The supplier is only invoked if the stream is empty.
-
Parameters:
-
supplier(Supplier<? extends EntryStream<K, V>>) — the supplier providing the EntryStream to append if the current stream is empty
-
- Returns: a new EntryStream with the elements of the specified EntryStream appended if the current stream is empty
- See also: Stream#appendIfEmpty(Supplier)
ifEmpty(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> ifEmpty(final Runnable action) throws IllegalStateException - Summary: Executes the specified action if the stream is empty.
-
Contract:
- Executes the specified action if the stream is empty.
- The action is executed during terminal operation execution, not when this method is called.
-
Parameters:
-
action(Runnable) — the action to execute if the stream is empty
-
- Returns: a new EntryStream with the action executed if the stream is empty
-
Throws:
-
java.lang.IllegalStateException— if the action cannot be executed
-
- See also: Stream#ifEmpty(Runnable)
skip(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp @Override public EntryStream<K, V> skip(final long n) - Summary: Skips the first <i> n </i> elements of this EntryStream.
-
Parameters:
-
n(long) — the number of elements to skip
-
- Returns: a new EntryStream with the first <i> n </i> elements skipped
- See also: Stream#skip(long)
-
Signature:
@Override public EntryStream<K, V> skip(final long n, final Consumer<? super Map.Entry<K, V>> onSkip) - Summary: Skips the first <i> n </i> elements of this EntryStream and applies the specified consumer to each skipped element.
-
Parameters:
-
n(long) — the number of elements to skip -
onSkip(Consumer<? super Map.Entry<K, V>>) — the consumer to apply to each skipped element
-
- Returns: a new EntryStream with the first <i> n </i> elements skipped
- See also: #skip(long)
limit(...) -> EntryStream<K, V>
-
Signature:
@SequentialOnly @IntermediateOp @Override public EntryStream<K, V> limit(final long maxSize) - Summary: Limits the number of elements in this EntryStream to the specified maximum size.
-
Parameters:
-
maxSize(long) — the maximum number of elements to include in the stream
-
- Returns: a new EntryStream with at most <i> maxSize </i> elements
- See also: Stream#limit(long)
step(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> step(final long step) - Summary: Returns a new EntryStream with entries selected at regular intervals.
-
Parameters:
-
step(long) — the interval between elements to include in the resulting stream
-
- Returns: a new EntryStream consisting of every 'step'th entry of this stream.
- See also: Stream#step(long)
rateLimited(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> rateLimited(final RateLimiter rateLimiter) - Summary: Limits the rate at which elements are processed in this EntryStream.
-
Parameters:
-
rateLimiter(RateLimiter) — the RateLimiter to control the rate of processing
-
- Returns: a new EntryStream with rate-limited processing
- See also: Stream#rateLimited(RateLimiter)
delay(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> delay(final Duration duration) - Summary: Delays each element in this EntryStream by the given duration except for the first element.
-
Parameters:
-
duration(Duration) — the duration to delay each element
-
- Returns: a new EntryStream with delayed processing
- See also: Stream#delay(Duration)
debounce(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> debounce(int maxWindowSize, Duration duration) - Summary: Returns a new {@code EntryStream} that limits entries to at most {@code maxWindowSize} within each time window of the specified {@code duration} .
-
Contract:
- When the elapsed time exceeds the duration, the window slides forward and the entry counter resets, allowing a new burst of entries.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Allow at most 5 entries per second EntryStream.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6) .debounce(5, Duration.ofSeconds(1)) .forEach((k, v) -> System.out.println(k + "=" + v)); // Only first 5 entries pass through immediately // Throttle cache updates to at most 100 per minute EntryStream.of(updates) .debounce(100, Duration.ofMinutes(1)) .forEach((key, value) -> cache.put(key, value)); // Limit database writes to 1000 per hour EntryStream.of(records) .debounce(1000, Duration.ofHours(1)) .forEach((id, data) -> database.upsert(id, data)); } </pre> <p> <b> Behavior Details: </b> </p> <ul> <li> The time window starts when the first entry is processed </li> <li> Entries within the limit are emitted immediately without delay </li> <li> Entries exceeding the limit within the window are silently dropped (filtered out) </li> <li> When the current time exceeds the window duration, the window advances and the counter resets </li> </ul> <p> <b> Comparison with {@code rateLimited} : </b> </p> <pre> {@code // debounce: allows bursting, then drops entries until next window entryStream.debounce(5, Duration.ofSeconds(1)); // rateLimited: spreads entries evenly over time (blocks until permit available) entryStream.rateLimited(5.0); // 5 per second = one every 200ms } </pre>
-
Parameters:
-
maxWindowSize(int) — the maximum number of entries to allow within each time window. Must be positive. -
duration(Duration) — the length of each time window. Must not be {@code null} and must have a positive millisecond value.
-
- Returns: a new {@code EntryStream} that limits entries to {@code maxWindowSize} per {@code duration} window
- See also: #rateLimited(double), #rateLimited(RateLimiter), #delay(Duration), Stream#debounce(int, Duration)
peek(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> peek(final Consumer<? super Map.Entry<K, V>> action) - Summary: Performs the provided action on the entries pulled by downstream/terminal operation.
-
Parameters:
-
action(Consumer<? super Map.Entry<K, V>>) — the action to be performed on the entries pulled by downstream/terminal operation
-
- Returns: a new EntryStream consisting of the elements of this stream with the provided action applied to each element
- See also: #peek(BiConsumer), #onEach(Consumer), Stream#peek(Consumer)
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> peek(final BiConsumer<? super K, ? super V> action) - Summary: Performs the provided action on the entries pulled by downstream/terminal operation.
-
Parameters:
-
action(BiConsumer<? super K, ? super V>) — the action to be performed on the entries pulled by downstream/terminal operation
-
- Returns: a new EntryStream consisting of the elements of this stream with the provided action applied to each element
- See also: #peek(Consumer), #onEach(BiConsumer), Stream#peek(Consumer)
onEach(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> onEach(final Consumer<? super Map.Entry<K, V>> action) - Summary: Performs the provided action on the entries pulled by downstream/terminal operation.
-
Parameters:
-
action(Consumer<? super Map.Entry<K, V>>) — the action to be performed on the entries pulled by downstream/terminal operation
-
- Returns: a new EntryStream consisting of the elements of this stream with the provided action applied to each element
- See also: #onEach(BiConsumer), #peek(Consumer), Stream#onEach(Consumer)
-
Signature:
@ParallelSupported @IntermediateOp public EntryStream<K, V> onEach(final BiConsumer<? super K, ? super V> action) - Summary: Performs the provided action on the entries pulled by downstream/terminal operation.
-
Parameters:
-
action(BiConsumer<? super K, ? super V>) — the action to be performed on the entries pulled by downstream/terminal operation
-
- Returns: a new EntryStream consisting of the elements of this stream with the provided action applied to each element
- See also: #onEach(Consumer), #peek(BiConsumer), Stream#onEach(Consumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> void forEach(final Throwables.Consumer<? super Map.Entry<K, V>, E> action) throws E - Summary: Performs the provided action on each entry of the EntryStream.
-
Parameters:
-
action(Throwables.Consumer<? super Map.Entry<K, V>, E>) — the action to be performed for each entry
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Throwables.BiConsumer), Stream#forEach(Throwables.Consumer)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> void forEach(final Throwables.BiConsumer<? super K, ? super V, E> action) throws E - Summary: Performs the provided action on each key-value pair of the EntryStream.
-
Parameters:
-
action(Throwables.BiConsumer<? super K, ? super V, E>) — the action to be performed for each key-value pair
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEach(Throwables.Consumer), Stream#forEach(Throwables.Consumer)
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> void forEachIndexed(final Throwables.IntObjConsumer<? super Map.Entry<K, V>, E> action) throws E - Summary: Performs the provided action on each entry of the EntryStream along with its index.
-
Contract:
- This is useful when you need to track the position of entries during processing.
-
Parameters:
-
action(Throwables.IntObjConsumer<? super Map.Entry<K, V>, E>) — the action to be performed for each entry with its index
-
-
Throws:
-
E— if the action throws an exception
-
- See also: Stream#forEachIndexed(Throwables.IntObjConsumer)
min(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> min(final Comparator<? super Map.Entry<K, V>> comparator) - Summary: Returns an Optional containing the minimum entry of this EntryStream according to the provided comparator.
-
Contract:
- <p> The comparator should compare Map.Entry objects.
-
Parameters:
-
comparator(Comparator<? super Map.Entry<K, V>>) — the comparator to compare the entries
-
- Returns: an {@code Optional} containing the minimum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #minByKey(Comparator), #minByValue(Comparator), #minBy(Function), Stream#min(Comparator)
minByKey(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> minByKey(final Comparator<? super K> keyComparator) - Summary: Returns an Optional containing the minimum entry of this EntryStream according to the provided key comparator.
-
Parameters:
-
keyComparator(Comparator<? super K>) — the comparator to compare the keys
-
- Returns: an {@code Optional} containing the minimum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #min(Comparator), #minByValue(Comparator), Stream#min(Comparator)
minByValue(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> minByValue(final Comparator<? super V> valueComparator) - Summary: Returns an Optional containing the minimum entry of this EntryStream according to the provided value comparator.
-
Parameters:
-
valueComparator(Comparator<? super V>) — the comparator to compare the values
-
- Returns: an {@code Optional} containing the minimum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #min(Comparator), #minByKey(Comparator), Stream#min(Comparator)
minBy(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp @SuppressWarnings("rawtypes") public Optional<Map.Entry<K, V>> minBy(final Function<? super Map.Entry<K, V>, ? extends Comparable> keyMapper) - Summary: Returns an Optional containing the minimum entry of this EntryStream based on the natural ordering of the keys extracted by the key mapper.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends Comparable>) — the function to extract the comparable key for comparison
-
- Returns: an {@code Optional} containing the minimum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #min(Comparator), Stream#minBy(Function)
max(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> max(final Comparator<? super Map.Entry<K, V>> comparator) - Summary: Returns an Optional containing the maximum entry of this EntryStream according to the provided comparator.
-
Contract:
- <p> The comparator should compare Map.Entry objects.
-
Parameters:
-
comparator(Comparator<? super Map.Entry<K, V>>) — the comparator to compare the entries
-
- Returns: an {@code Optional} containing the maximum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #maxByKey(Comparator), #maxByValue(Comparator), #maxBy(Function), Stream#max(Comparator)
maxByKey(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> maxByKey(final Comparator<? super K> keyComparator) - Summary: Returns an Optional containing the maximum entry of this EntryStream according to the provided key comparator.
-
Parameters:
-
keyComparator(Comparator<? super K>) — the comparator to compare the keys
-
- Returns: an {@code Optional} containing the maximum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #max(Comparator), #maxByValue(Comparator), Stream#max(Comparator)
maxByValue(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> maxByValue(final Comparator<? super V> valueComparator) - Summary: Returns an Optional containing the maximum entry of this EntryStream according to the provided value comparator.
-
Parameters:
-
valueComparator(Comparator<? super V>) — the comparator to compare the values
-
- Returns: an {@code Optional} containing the maximum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #max(Comparator), #maxByKey(Comparator), Stream#max(Comparator)
maxBy(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@ParallelSupported @TerminalOp @SuppressWarnings("rawtypes") public Optional<Map.Entry<K, V>> maxBy(final Function<? super Map.Entry<K, V>, ? extends Comparable> keyMapper) - Summary: Returns an Optional containing the maximum entry of this EntryStream based on the natural ordering of the keys extracted by the key mapper.
-
Parameters:
-
keyMapper(Function<? super Map.Entry<K, V>, ? extends Comparable>) — the function to extract the comparable key for comparison
-
- Returns: an {@code Optional} containing the maximum entry of this EntryStream, or an empty {@code Optional} if the stream is empty
- See also: #max(Comparator), Stream#maxBy(Function)
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean anyMatch(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Checks if any elements of this EntryStream match the provided predicate.
-
Contract:
- Checks if any elements of this EntryStream match the provided predicate.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any entry has a null value boolean hasNullValue = EntryStream.of(map) .anyMatch(entry -> entry.getValue() == null); // Check if any key starts with "test" boolean hasTestKey = EntryStream.of(map) .anyMatch(entry -> entry.getKey().startsWith("test")); } </pre>
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if any elements match the predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.BiPredicate), #allMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate), Stream#anyMatch(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean anyMatch(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Checks if any elements of this EntryStream match the provided bi-predicate.
-
Contract:
- Checks if any elements of this EntryStream match the provided bi-predicate.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any score is above 90 boolean hasHighScore = EntryStream.of(studentScores) .anyMatch((student, score) -> score > 90); // Check if any key equals its value boolean hasEqualKeyValue = EntryStream.of(map) .anyMatch((key, value) -> key.equals(value)); } </pre>
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: {@code true} if any elements match the predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.Predicate), Stream#anyMatch(Throwables.Predicate)
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean allMatch(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Checks if all elements of this EntryStream match the provided predicate.
-
Contract:
- Checks if all elements of this EntryStream match the provided predicate.
- <p> Returns {@code true} if all elements match the predicate or if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all values are positive boolean allPositive = EntryStream.of(scores) .allMatch(entry -> entry.getValue() > 0); // Check if all keys are non-empty strings boolean allNonEmpty = EntryStream.of(map) .allMatch(entry -> !entry.getKey().isEmpty()); } </pre>
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if all elements match the predicate or this EntryStream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #allMatch(Throwables.BiPredicate), #anyMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate), Stream#allMatch(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean allMatch(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Checks if all elements of this EntryStream match the provided bi-predicate.
-
Contract:
- Checks if all elements of this EntryStream match the provided bi-predicate.
- <p> Returns {@code true} if all elements match the predicate or if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all scores are passing (>= 60) boolean allPassing = EntryStream.of(studentScores) .allMatch((student, score) -> score >= 60); // Check if all keys are shorter than their values boolean keyShorterThanValue = EntryStream.of(stringMap) .allMatch((key, value) -> key.length() < value.length()); } </pre>
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: {@code true} if all elements match the predicate or this EntryStream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #allMatch(Throwables.Predicate), Stream#allMatch(Throwables.Predicate)
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean noneMatch(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Checks if no elements of this EntryStream match the provided predicate.
-
Contract:
- Checks if no elements of this EntryStream match the provided predicate.
- <p> Returns {@code true} if no elements match the predicate or if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no values are negative boolean noNegatives = EntryStream.of(scores) .noneMatch(entry -> entry.getValue() < 0); // Check if no keys contain spaces boolean noSpaces = EntryStream.of(map) .noneMatch(entry -> entry.getKey().contains(" ")); } </pre>
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if no elements match the predicate or this EntryStream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #noneMatch(Throwables.BiPredicate), #anyMatch(Throwables.Predicate), #allMatch(Throwables.Predicate), Stream#noneMatch(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean noneMatch(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Checks if no elements of this EntryStream match the provided bi-predicate.
-
Contract:
- Checks if no elements of this EntryStream match the provided bi-predicate.
- <p> Returns {@code true} if no elements match the predicate or if the stream is empty.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no scores are failing (< 60) boolean noFailures = EntryStream.of(studentScores) .noneMatch((student, score) -> score < 60); // Check if no key equals its value boolean noEqualKeyValue = EntryStream.of(map) .noneMatch((key, value) -> key.equals(value)); } </pre>
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: {@code true} if no elements match the predicate or this EntryStream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #noneMatch(Throwables.Predicate), Stream#noneMatch(Throwables.Predicate)
nMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean nMatch(final long atLeast, final long atMost, final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Checks if the specified number of elements in this EntryStream match the provided predicate.
-
Contract:
- Checks if the specified number of elements in this EntryStream match the provided predicate.
- <p> The operation is equivalent to: {@code {@code atLeast} <= stream.filter(predicate).limit(atMost + 1).count() <= atMost} <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if between 2 and 5 entries have values over 100 boolean inRange = EntryStream.of(scores) .nMatch(2, 5, entry -> entry.getValue() > 100); // Check if exactly 3 entries have keys starting with "test" boolean exactlyThree = EntryStream.of(map) .nMatch(3, 3, entry -> entry.getKey().startsWith("test")); } </pre>
-
Parameters:
-
atLeast(long) — the minimum number of elements that need to match the predicate -
atMost(long) — the maximum number of elements that need to match the predicate -
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to each element
-
- Returns: {@code true} if the number of elements matching the predicate is within the specified range (inclusive), {@code false} otherwise
-
Throws:
-
E— if any element processing results in an exception
-
- See also: #nMatch(long, long, Throwables.BiPredicate), Stream#nMatch(long, long, Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> boolean nMatch(final long atLeast, final long atMost, final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Checks if the specified number of elements in this EntryStream match the provided bi-predicate.
-
Contract:
- Checks if the specified number of elements in this EntryStream match the provided bi-predicate.
- <p> The operation is equivalent to: {@code {@code atLeast} <= stream.filter(predicate).limit(atMost + 1).count() <= atMost} <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if between 1 and 3 students have scores over 90 boolean inRange = EntryStream.of(studentScores) .nMatch(1, 3, (student, score) -> score > 90); // Check if at least 5 entries have matching key-value lengths boolean atLeastFive = EntryStream.of(stringMap) .nMatch(5, Long.MAX_VALUE, (key, value) -> key.length() == value.length()); } </pre>
-
Parameters:
-
atLeast(long) — the minimum number of elements that need to match the predicate -
atMost(long) — the maximum number of elements that need to match the predicate -
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless predicate to apply to each key-value pair
-
- Returns: {@code true} if the number of elements matching the predicate is within the specified range (inclusive), {@code false} otherwise
-
Throws:
-
E— if any element processing results in an exception
-
- See also: #nMatch(long, long, Throwables.Predicate), Stream#nMatch(long, long, Throwables.Predicate)
findFirst(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Beta @ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> findFirst() - Summary: Returns the first entry in the stream, if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns the first entry in the stream, if present, otherwise returns an empty {@code Optional} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the first entry of the stream, or an empty {@code Optional} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.Predicate), #findAny(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findFirst(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Finds the first entry in this EntryStream that matches the provided predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code Optional} containing the first entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findFirst(Throwables.BiPredicate), #findAny(Throwables.Predicate), #findLast(Throwables.Predicate), Stream#findFirst(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findFirst(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Finds the first entry in this EntryStream that matches the provided bi-predicate.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: an {@code Optional} containing the first entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findFirst(Throwables.Predicate), Stream#findFirst(Throwables.Predicate)
findAny(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Beta @ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> findAny() - Summary: Returns any element in the stream, if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns any element in the stream, if present, otherwise returns an empty {@code Optional} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing any entry of the stream, or an empty {@code Optional} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.Predicate), #findAny(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findAny(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Finds any entry in this EntryStream that matches the provided predicate.
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code Optional} containing any entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findAny(Throwables.BiPredicate), #findFirst(Throwables.Predicate), Stream#findAny(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findAny(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Finds any entry in this EntryStream that matches the provided bi-predicate.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: an {@code Optional} containing any entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findAny(Throwables.Predicate), Stream#findAny(Throwables.Predicate)
findLast(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Beta @ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findLast(final Throwables.Predicate<? super Map.Entry<K, V>, E> predicate) throws E - Summary: Finds the last entry in this EntryStream that matches the provided predicate.
-
Contract:
- Consider using {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.Predicate<? super Map.Entry<K, V>, E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code Optional} containing the last entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findLast(Throwables.BiPredicate), #findFirst(Throwables.Predicate), Stream#findLast(Throwables.Predicate)
-
Signature:
@Beta @ParallelSupported @TerminalOp public <E extends Exception> Optional<Map.Entry<K, V>> findLast(final Throwables.BiPredicate<? super K, ? super V, E> predicate) throws E - Summary: Finds the last entry in this EntryStream that matches the provided bi-predicate.
-
Contract:
- Consider using {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.BiPredicate<? super K, ? super V, E>) — a non-interfering, stateless bi-predicate to apply to key-value pairs of this stream
-
- Returns: an {@code Optional} containing the last entry that matches the predicate, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findLast(Throwables.Predicate), Stream#findLast(Throwables.Predicate)
first(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Override public Optional<Map.Entry<K, V>> first() - Summary: Returns an Optional containing the first entry of this EntryStream.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the first entry, or an empty {@code Optional} if the stream is empty
- See also: #last(), Stream#first()
last(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Override public Optional<Map.Entry<K, V>> last() - Summary: Returns an Optional containing the last entry of this EntryStream.
-
Contract:
- Consider restructuring your stream operations if this becomes a performance issue.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the last entry, or an empty {@code Optional} if the stream is empty
- See also: #first(), Stream#last()
elementAt(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Override public Optional<Map.Entry<K, V>> elementAt(final long position) - Summary: Returns the entry at the specified position in this stream.
-
Parameters:
-
position(long) — the position of the entry to return (zero-based)
-
- Returns: an {@code Optional} containing the entry at the specified position if it exists, otherwise an empty {@code Optional}
- See also: Stream#elementAt(long)
onlyOne(...) -> Optional<Map.Entry<K, V>>
-
Signature:
@Override public Optional<Map.Entry<K, V>> onlyOne() throws TooManyElementsException - Summary: Returns an Optional containing the only entry of this EntryStream if it contains exactly one entry.
-
Contract:
- Returns an Optional containing the only entry of this EntryStream if it contains exactly one entry.
- <p> If the stream is empty, an empty {@code Optional} is returned.
- If the stream contains more than one entry, a {@link TooManyElementsException} is thrown.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Get the only entry from a single-entry map Optional<Map.Entry<String, Integer>> only = EntryStream.of(singletonMap).onlyOne(); // Get the only matching entry Optional<Map.Entry<String, Integer>> onlyHigh = EntryStream.of(scores) .filter((k, v) -> v == 100) .onlyOne(); // Throws if multiple entries have value 100 } </pre>
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the only entry of this EntryStream if it is not empty, otherwise an empty {@code Optional}
-
Throws:
-
com.landawn.abacus.exception.TooManyElementsException— if the EntryStream contains more than one entry
-
- See also: Stream#onlyOne()
percentiles(...) -> Optional<Map<Percentage, Map.Entry<K, V>>>
-
Signature:
@Deprecated @Override public Optional<Map<Percentage, Map.Entry<K, V>>> percentiles() throws UnsupportedOperationException - Summary: Calculates the percentiles of the elements in the stream.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing a map of percentiles to entries, or an empty {@code Optional} if the stream is empty
-
Throws:
-
java.lang.UnsupportedOperationException— always, as this method is deprecated. Use {@link #percentiles(Comparator)} instead.
-
- See also: #percentiles(Comparator)
-
Signature:
public Optional<Map<Percentage, Map.Entry<K, V>>> percentiles(final Comparator<? super Map.Entry<K, V>> comparator) - Summary: Calculates the percentiles of the elements in the stream according to the provided comparator.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
-
comparator(Comparator<? super Map.Entry<K, V>>) — the comparator to determine the order of the entries
-
- Returns: an {@code Optional} containing a map of percentiles to entries, or an empty {@code Optional} if the stream is empty
- See also: N#percentilesOfSorted(int\[\]), Comparators#comparingByKey(), Comparators#comparingByKey(Comparator), Comparators#comparingByValue(), Comparators#comparingByValue(Comparator)
count(...) -> long
-
Signature:
@Override public long count() - Summary: Returns the count of entries in this EntryStream.
-
Parameters:
- (none)
- Returns: the number of entries in this EntryStream
- See also: Stream#count()
iterator(...) -> ObjIterator<Map.Entry<K, V>>
-
Signature:
@Override public ObjIterator<Map.Entry<K, V>> iterator() - Summary: Returns an iterator over the entries in this EntryStream.
-
Contract:
- <p> <b> Warning: </b> This method should be used with caution.
- The stream must be properly closed after iteration to avoid resource leaks.
-
Parameters:
- (none)
- Returns: an iterator over the entries in this EntryStream
- See also: #biIterator(), Stream#iterator()
biIterator(...) -> BiIterator<K, V>
-
Signature:
@SequentialOnly public BiIterator<K, V> biIterator() - Summary: Returns a BiIterator over the key-value pairs in this EntryStream.
-
Contract:
- <p> <b> Warning: </b> This method should be used with caution.
- The stream must be properly closed after iteration to avoid resource leaks.
-
Parameters:
- (none)
- Returns: a BiIterator over the key-value pairs in this EntryStream
- See also: #iterator()
toList(...) -> List<Map.Entry<K, V>>
-
Signature:
@Override public List<Map.Entry<K, V>> toList() - Summary: Returns a list containing all entries of this stream.
-
Parameters:
- (none)
- Returns: a List containing the entries of this stream
- See also: #toSet(), #toMap(), Stream#toList()
toSet(...) -> Set<Map.Entry<K, V>>
-
Signature:
@Override public Set<Map.Entry<K, V>> toSet() - Summary: Returns a set containing all unique entries of this stream.
-
Parameters:
- (none)
- Returns: a Set containing the unique entries of this stream
- See also: #toList(), Stream#toSet()
toCollection(...) -> C
-
Signature:
@Override public <C extends Collection<Map.Entry<K, V>>> C toCollection(final Supplier<? extends C> supplier) - Summary: Returns a collection containing all entries of this stream.
-
Parameters:
-
supplier(Supplier<? extends C>) — the supplier providing the collection
-
- Returns: a collection containing the entries of this stream
- See also: Stream#toCollection(Supplier)
toMultiset(...) -> Multiset<Map.Entry<K, V>>
-
Signature:
@Override public Multiset<Map.Entry<K, V>> toMultiset() - Summary: Returns a {@code Multiset} containing all the {@code Map.Entry} elements from this stream.
-
Parameters:
- (none)
- Returns: a {@code Multiset} containing all entries from this stream
- See also: Stream#toMultiset(), #toMultiset(Supplier)
-
Signature:
@Override public Multiset<Map.Entry<K, V>> toMultiset(final Supplier<? extends Multiset<Map.Entry<K, V>>> supplier) - Summary: Returns a {@code Multiset} containing all the {@code Map.Entry} elements from this stream, using the provided supplier to create the multiset.
-
Parameters:
-
supplier(Supplier<? extends Multiset<Map.Entry<K, V>>>) — a function which returns a new, empty {@code Multiset} into which the results will be inserted
-
- Returns: a {@code Multiset} containing all entries from this stream
- See also: Stream#toMultiset(Supplier), #toMultiset()
toMap(...) -> Map<K, V>
-
Signature:
@SequentialOnly @TerminalOp public Map<K, V> toMap() throws IllegalStateException - Summary: Returns a {@code Map} containing the key-value pairs from this stream.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
- (none)
- Returns: a {@code Map} containing all key-value pairs from this stream
-
Throws:
-
java.lang.IllegalStateException— if duplicate keys are encountered
-
- See also: Stream#toMap(Throwables.Function, Throwables.Function), #toMap(BinaryOperator), #toMap(Supplier), #toMap(BinaryOperator, Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@SequentialOnly @TerminalOp public Map<K, V> toMap(final BinaryOperator<V> mergeFunction) - Summary: Returns a {@code Map} containing the key-value pairs from this stream, using the provided merge function to resolve collisions between values associated with the same key.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a function used to resolve collisions between values associated with the same key, as supplied to {@link Map#merge(Object, Object, BiFunction)}
-
- Returns: a {@code Map} containing all key-value pairs from this stream
- See also: Stream#toMap(Throwables.Function, Throwables.Function, BinaryOperator), #toMap(), #toMap(Supplier), #toMap(BinaryOperator, Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@SequentialOnly @TerminalOp public <M extends Map<K, V>> M toMap(final Supplier<? extends M> mapFactory) throws IllegalStateException - Summary: Returns a {@code Map} containing the key-value pairs from this stream, using the provided supplier to create the map.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mapFactory(Supplier<? extends M>) — a function which returns a new, empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} containing all key-value pairs from this stream
-
Throws:
-
java.lang.IllegalStateException— if duplicate keys are encountered
-
- See also: Stream#toMap(Throwables.Function, Throwables.Function, Supplier), #toMap(), #toMap(BinaryOperator), #toMap(BinaryOperator, Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@SequentialOnly @TerminalOp public <M extends Map<K, V>> M toMap(final BinaryOperator<V> mergeFunction, final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Map} containing the key-value pairs from this stream, using the provided merge function to resolve collisions and the provided supplier to create the map.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a function used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a function which returns a new, empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} containing all key-value pairs from this stream
- See also: Stream#toMap(Throwables.Function, Throwables.Function, BinaryOperator, Supplier), #toMap(), #toMap(BinaryOperator), #toMap(Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
toMapThenApply(...) -> R
-
Signature:
@SequentialOnly @TerminalOp public <R, E extends Exception> R toMapThenApply(final Throwables.Function<? super Map<K, V>, ? extends R, E> func) throws IllegalStateException, E - Summary: Collects the entries into a {@code Map} and then applies the provided function to that map.
-
Contract:
- If duplicate keys are encountered during collection, an {@code IllegalStateException} is thrown.
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
func(Throwables.Function<? super Map<K, V>, ? extends R, E>) — the function to apply to the resulting map
-
- Returns: the result of applying the function to the collected map
-
Throws:
-
java.lang.IllegalStateException— if duplicate keys are encountered during map collection -
E— if the function throws an exception
-
- See also: #toMap(), #toMapThenAccept(Throwables.Consumer), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
toMapThenAccept(...) -> void
-
Signature:
@SequentialOnly @TerminalOp public <E extends Exception> void toMapThenAccept(final Throwables.Consumer<? super Map<K, V>, E> consumer) throws IllegalStateException, E - Summary: Collects the entries into a {@code Map} and then passes that map to the provided consumer.
-
Contract:
- If duplicate keys are encountered during collection, an {@code IllegalStateException} is thrown.
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
consumer(Throwables.Consumer<? super Map<K, V>, E>) — the consumer to accept the resulting map
-
-
Throws:
-
java.lang.IllegalStateException— if duplicate keys are encountered during map collection -
E— if the consumer throws an exception
-
- See also: #toMap(), #toMapThenApply(Throwables.Function), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
toImmutableMap(...) -> ImmutableMap<K, V>
-
Signature:
@SequentialOnly @TerminalOp public ImmutableMap<K, V> toImmutableMap() throws IllegalStateException - Summary: Returns an {@code ImmutableMap} containing the key-value pairs from this stream.
-
Contract:
- If duplicate keys are encountered, an {@code IllegalStateException} is thrown.
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
- (none)
- Returns: an {@code ImmutableMap} containing all key-value pairs from this stream
-
Throws:
-
java.lang.IllegalStateException— if duplicate keys are encountered
-
- See also: Stream#toImmutableMap(Throwables.Function, Throwables.Function), #toImmutableMap(BinaryOperator), #toMap(), ImmutableMap, Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@SequentialOnly @TerminalOp public ImmutableMap<K, V> toImmutableMap(final BinaryOperator<V> mergeFunction) - Summary: Returns an {@code ImmutableMap} containing the key-value pairs from this stream, using the provided merge function to resolve collisions between values associated with the same key.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mergeFunction(BinaryOperator<V>) — a function used to resolve collisions between values associated with the same key
-
- Returns: an {@code ImmutableMap} containing all key-value pairs from this stream
- See also: Stream#toImmutableMap(Throwables.Function, Throwables.Function, BinaryOperator), #toImmutableMap(), #toMap(BinaryOperator), ImmutableMap, Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
toMultimap(...) -> ListMultimap<K, V>
-
Signature:
@SequentialOnly @TerminalOp public ListMultimap<K, V> toMultimap() - Summary: Returns a {@code ListMultimap} containing the key-value pairs from this stream.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
- (none)
- Returns: a {@code ListMultimap} containing all key-value pairs from this stream
- See also: Stream#toMultimap(Throwables.Function, Throwables.Function), #toMultimap(Supplier), #groupTo(), ListMultimap
-
Signature:
@SequentialOnly @TerminalOp public <C extends Collection<V>, M extends Multimap<K, V, C>> M toMultimap(final Supplier<? extends M> mapFactory) - Summary: Returns a {@code Multimap} containing the key-value pairs from this stream, using the provided supplier to create the multimap.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mapFactory(Supplier<? extends M>) — a function which returns a new, empty {@code Multimap} into which the results will be inserted
-
- Returns: a {@code Multimap} containing all key-value pairs from this stream
- See also: Stream#toMultimap(Throwables.Function, Throwables.Function, Supplier), #toMultimap(), #groupTo(Supplier), Multimap
groupTo(...) -> Map<K, List<V>>
-
Signature:
@SequentialOnly @TerminalOp public Map<K, List<V>> groupTo() - Summary: Groups the values by their keys into a {@code Map} where each key is associated with a {@code List} of values.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
- (none)
- Returns: a {@code Map} where each key maps to a {@code List} of all values associated with that key in this stream
- See also: Stream#groupTo(Throwables.Function, Throwables.Function), #groupTo(Supplier), #toMultimap(), Collectors#groupingBy(Function)
-
Signature:
@SequentialOnly @TerminalOp public <M extends Map<K, List<V>>> M groupTo(final Supplier<? extends M> mapFactory) - Summary: Groups the values by their keys into a {@code Map} where each key is associated with a {@code List} of values, using the provided supplier to create the map.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
mapFactory(Supplier<? extends M>) — a function which returns a new, empty {@code Map} into which the grouped results will be inserted
-
- Returns: a {@code Map} where each key maps to a {@code List} of all values associated with that key in this stream
- See also: Stream#groupTo(Throwables.Function, Throwables.Function, Supplier), #groupTo(), #toMultimap(Supplier), Collectors#groupingBy(Function, Collector, Supplier)
groupToThenApply(...) -> R
-
Signature:
@SequentialOnly @TerminalOp public <R, E extends Exception> R groupToThenApply(final Throwables.Function<? super Map<K, List<V>>, ? extends R, E> func) throws E - Summary: Groups the values by their keys into a {@code Map} and then applies the provided function to that map.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
func(Throwables.Function<? super Map<K, List<V>>, ? extends R, E>) — the function to apply to the grouped map
-
- Returns: the result of applying the function to the grouped map
-
Throws:
-
E— if the function throws an exception
-
- See also: #groupTo(), #groupToThenAccept(Throwables.Consumer)
groupToThenAccept(...) -> void
-
Signature:
@SequentialOnly @TerminalOp public <E extends Exception> void groupToThenAccept(final Throwables.Consumer<? super Map<K, List<V>>, E> consumer) throws E - Summary: Groups the values by their keys into a {@code Map} and then passes that map to the provided consumer.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
consumer(Throwables.Consumer<? super Map<K, List<V>>, E>) — the consumer to accept the grouped map
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: #groupTo(), #groupToThenApply(Throwables.Function)
reduce(...) -> Map.Entry<K, V>
-
Signature:
@SequentialOnly @TerminalOp public Map.Entry<K, V> reduce(final Map.Entry<K, V> identity, final BinaryOperator<Map.Entry<K, V>> accumulator) - Summary: Performs a reduction on the entries of this stream, using the provided identity value and accumulation function, and returns the reduced value.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
identity(Map.Entry<K, V>) — the identity value for the accumulating function -
accumulator(BinaryOperator<Map.Entry<K, V>>) — an associative, non-interfering, stateless function for combining two values
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator), #reduce(BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public Optional<Map.Entry<K, V>> reduce(final BinaryOperator<Map.Entry<K, V>> accumulator) - Summary: Performs a reduction on the entries of this stream, using an associative accumulation function, and returns an {@code Optional} describing the reduced value, if any.
-
Contract:
- Performs a reduction on the entries of this stream, using an associative accumulation function, and returns an {@code Optional} describing the reduced value, if any.
-
Parameters:
-
accumulator(BinaryOperator<Map.Entry<K, V>>) — an associative, non-interfering, stateless function for combining two values
-
- Returns: an {@code Optional} describing the result of the reduction, or empty if the stream is empty
- See also: Stream#reduce(BinaryOperator), #reduce(Map.Entry, BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public <R> R collect(final Supplier<R> supplier, final BiConsumer<? super R, ? super Map.Entry<K, V>> accumulator, final BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the entries of this stream using a {@code Collector} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container -
accumulator(BiConsumer<? super R, ? super Map.Entry<K, V>>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), #collect(Supplier, BiConsumer), #collect(Collector)
-
Signature:
@ParallelSupported @TerminalOp public <R> R collect(final Supplier<R> supplier, final BiConsumer<? super R, ? super Map.Entry<K, V>> accumulator) - Summary: Performs a mutable reduction operation on the entries of this stream.
-
Contract:
- <p> Only call this method when the returned type {@code R} is a mutable container type like: {@code Collection} , {@code Map} , {@code StringBuilder} , {@code Multiset} , {@code Multimap} , or primitive list types.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new mutable result container -
accumulator(BiConsumer<? super R, ? super Map.Entry<K, V>>) — an associative, non-interfering, stateless function that adds an entry into the result container
-
- Returns: the result container
- See also: #collect(Supplier, BiConsumer, BiConsumer), #collect(Collector), Stream#collect(Supplier, BiConsumer)
-
Signature:
@ParallelSupported @TerminalOp public <R> R collect(final Collector<? super Map.Entry<K, V>, ?, R> collector) - Summary: Performs a mutable reduction operation on the entries of this stream using a {@code Collector} .
-
Parameters:
-
collector(Collector<? super Map.Entry<K, V>, ?, R>) — the {@code Collector} describing the reduction
-
- Returns: the result of the reduction
- See also: Stream#collect(Collector), #collect(Supplier, BiConsumer, BiConsumer), Collectors
collectThenApply(...) -> RR
-
Signature:
@ParallelSupported @TerminalOp public <R, RR, E extends Exception> RR collectThenApply(final Collector<? super Map.Entry<K, V>, ?, R> downstream, final Throwables.Function<? super R, ? extends RR, E> func) throws E - Summary: Performs a mutable reduction operation using a {@code Collector} and then applies the provided function to the result.
-
Parameters:
-
downstream(Collector<? super Map.Entry<K, V>, ?, R>) — the {@code Collector} to perform the mutable reduction -
func(Throwables.Function<? super R, ? extends RR, E>) — the function to apply to the result of the collection
-
- Returns: the result of applying the function to the collected data
-
Throws:
-
E— if the function throws an exception
-
- See also: Stream#collectThenApply(Collector, Throwables.Function), #collect(Collector), #collectThenAccept(Collector, Throwables.Consumer)
collectThenAccept(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public <R, E extends Exception> void collectThenAccept(final Collector<? super Map.Entry<K, V>, ?, R> downstream, final Throwables.Consumer<? super R, E> consumer) throws E - Summary: Performs a mutable reduction operation using a {@code Collector} and then passes the result to the provided consumer.
-
Parameters:
-
downstream(Collector<? super Map.Entry<K, V>, ?, R>) — the {@code Collector} to perform the mutable reduction -
consumer(Throwables.Consumer<? super R, E>) — the consumer to accept the result of the collection
-
-
Throws:
-
E— if the consumer throws an exception
-
- See also: Stream#collectThenAccept(Collector, Throwables.Consumer), #collect(Collector), #collectThenApply(Collector, Throwables.Function)
join(...) -> String
-
Signature:
@Override public String join(final CharSequence delimiter) - Summary: Joins the entries of this stream into a string using the specified delimiter.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each entry
-
- Returns: a string representation of the entries joined by the delimiter
- See also: Stream#join(CharSequence), #join(CharSequence, CharSequence, CharSequence), #join(CharSequence, CharSequence), #join(CharSequence, CharSequence, CharSequence, CharSequence)
-
Signature:
@Override public String join(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix) - Summary: Joins the entries of this stream into a string using the specified delimiter, prefix, and suffix.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each entry -
prefix(CharSequence) — the sequence of characters to be used at the beginning -
suffix(CharSequence) — the sequence of characters to be used at the end
-
- Returns: a string representation of the entries joined by the delimiter and enclosed with prefix and suffix
- See also: Stream#join(CharSequence, CharSequence, CharSequence), #join(CharSequence), #join(CharSequence, CharSequence), #join(CharSequence, CharSequence, CharSequence, CharSequence)
-
Signature:
@SequentialOnly @TerminalOp public String join(final CharSequence delimiter, final CharSequence keyValueDelimiter) - Summary: Joins the entries of this stream into a string using the specified delimiter and key-value delimiter.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each entry -
keyValueDelimiter(CharSequence) — the delimiter to be used between key and value in each entry
-
- Returns: a string representation of the entries
- See also: #join(CharSequence), #join(CharSequence, CharSequence, CharSequence), #join(CharSequence, CharSequence, CharSequence, CharSequence)
-
Signature:
@SequentialOnly @TerminalOp public String join(final CharSequence delimiter, final CharSequence keyValueDelimiter, final CharSequence prefix, final CharSequence suffix) throws IllegalStateException - Summary: Joins the entries of this stream into a string using the specified delimiter, key-value delimiter, prefix, and suffix.
-
Contract:
- <p> This is a terminal operation that must be executed sequentially.
-
Parameters:
-
delimiter(CharSequence) — the delimiter to be used between each entry -
keyValueDelimiter(CharSequence) — the delimiter to be used between key and value in each entry -
prefix(CharSequence) — the sequence of characters to be used at the beginning -
suffix(CharSequence) — the sequence of characters to be used at the end
-
- Returns: a string representation of the entries with custom formatting
-
Throws:
-
java.lang.IllegalStateException— if the stream has already been operated upon or closed
-
- See also: #join(CharSequence), #join(CharSequence, CharSequence), #join(CharSequence, CharSequence, CharSequence), Joiner
joinTo(...) -> Joiner
-
Signature:
@TerminalOp @Override public Joiner joinTo(final Joiner joiner) throws IllegalStateException, IllegalArgumentException - Summary: Joins the entries of this stream using the provided {@code Joiner} .
-
Parameters:
-
joiner(Joiner) — the {@code Joiner} to use for formatting the entries
-
- Returns: the same {@code Joiner} instance after all entries have been appended
-
Throws:
-
java.lang.IllegalStateException— if the stream has already been operated upon or closed -
java.lang.IllegalArgumentException— if the joiner is null
-
- See also: Stream#joinTo(Joiner), #join(CharSequence, CharSequence, CharSequence, CharSequence), Joiner
transformB(...) -> EntryStream<KK, VV>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <KK, VV> EntryStream<KK, VV> transformB( final Function<? super Stream<Map.Entry<K, V>>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>> transfer) - Summary: Transforms the current EntryStream into another EntryStream by applying the provided function.
-
Parameters:
-
transfer(Function<? super Stream<Map.Entry<K, V>>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>>) — the function to be applied on the current stream to produce a new stream.
-
- Returns: a new EntryStream transformed by the provided function.
- See also: #transformB(Function, boolean), Stream#transform(Function), Stream#transformB(Function)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <KK, VV> EntryStream<KK, VV> transformB( final Function<? super Stream<Map.Entry<K, V>>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>> transfer, final boolean deferred) - Summary: Transforms the current EntryStream into another EntryStream by applying the provided function.
-
Contract:
- The transformation can be deferred, which means it will be performed when the stream is consumed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Deferred transformation - executed only when terminal operation is called EntryStream<String, Integer> result = entryStream .<String, Integer>transformB(s -> s .filter(e -> e.getValue() > 10) .map(e -> new SimpleImmutableEntry<>(e.getKey().toUpperCase(), e.getValue() * 2)), true // deferred execution ); } </pre>
-
Parameters:
-
transfer(Function<? super Stream<Map.Entry<K, V>>, ? extends Stream<? extends Map.Entry<? extends KK, ? extends VV>>>) — the function to be applied on the current stream to produce a new stream. -
deferred(boolean) — if {@code true} , the transformation is deferred until the EntryStream is consumed.
-
- Returns: a new EntryStream transformed by the provided function.
- See also: Stream#transform(Function), Stream#transformB(Function), Stream#transformB(Function, boolean)
isParallel(...) -> boolean
-
Signature:
@Override public boolean isParallel() - Summary: Checks if the current stream is parallel.
-
Contract:
- Checks if the current stream is parallel.
-
Parameters:
- (none)
- Returns: {@code true} if the stream is parallel, {@code false} otherwise
- See also: Stream#isParallel()
sequential(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> sequential() - Summary: Returns an equivalent stream that is sequential.
-
Contract:
- <p> If the stream is already sequential, this method returns the current stream.
- If the stream is parallel, it returns a new sequential EntryStream with the same elements.
-
Parameters:
- (none)
- Returns: a sequential stream
- See also: Stream#sequential()
invertToDisposableEntry(...) -> EntryStream<V, K>
-
Signature:
@SequentialOnly @Deprecated @Beta public EntryStream<V, K> invertToDisposableEntry() - Summary: Inverts the current EntryStream to a new EntryStream by DisposableEntry.
-
Parameters:
- (none)
- Returns: a new EntryStream with inverted keys and values as DisposableEntry
- See also: #invert()
onClose(...) -> EntryStream<K, V>
-
Signature:
@Override public EntryStream<K, V> onClose(final Runnable closeHandler) - Summary: Registers a close handler to be invoked when the stream is closed.
-
Contract:
- Registers a close handler to be invoked when the stream is closed.
- The handlers will be invoked when the stream is closed, either explicitly by calling {@link #close()} or implicitly when a terminal operation completes.
-
Parameters:
-
closeHandler(Runnable) — a Runnable whose run method will be invoked when the stream is closed.
-
- Returns: an EntryStream with the close handler registered. This may be the same EntryStream instance.
close(...) -> void
-
Signature:
@Override public synchronized void close() - Summary: Closes the EntryStream.
-
Contract:
- If the stream is already closed, then invoking this method has no effect.
- All registered close handlers (added via {@link #onClose(Runnable)} ) are invoked when this method is called.
- However, if a stream may be abandoned before a terminal operation, it should be closed explicitly.
-
Parameters:
- (none)
Class FloatIteratorEx (com.landawn.abacus.util.stream.FloatIteratorEx)
An extended iterator over primitive float values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> FloatIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static FloatIteratorEx empty() - Summary: Returns an empty FloatIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty FloatIteratorEx instance
of(...) -> FloatIteratorEx
-
Signature:
public static FloatIteratorEx of(final float... a) - Summary: Creates a FloatIteratorEx from the given float array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(float[]) — the float array to iterate over (can be {@code null} or empty)
-
- Returns: a FloatIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static FloatIteratorEx of(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a FloatIteratorEx from a portion of the given float array.
-
Parameters:
-
a(float[]) — the float array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a FloatIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static FloatIteratorEx of(final FloatIterator iter) - Summary: Wraps a FloatIterator as a FloatIteratorEx.
-
Contract:
- If the iterator is already a FloatIteratorEx, it is returned as-is.
-
Parameters:
-
iter(FloatIterator) — the FloatIterator to wrap (can be null)
-
- Returns: a FloatIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> FloatIteratorEx
-
Signature:
public static FloatIteratorEx from(final Iterator<Float> iter) - Summary: Creates a FloatIteratorEx from an Iterator of Float objects.
-
Parameters:
-
iter(Iterator<Float>) — the Iterator of Float objects (can be null)
-
- Returns: a FloatIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class FloatStream (com.landawn.abacus.util.stream.FloatStream)
A specialized stream implementation for processing sequences of float values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> FloatStream
-
Signature:
public static FloatStream empty() - Summary: Returns an empty FloatStream.
-
Parameters:
- (none)
- Returns: an empty FloatStream
defer(...) -> FloatStream
-
Signature:
public static FloatStream defer(final Supplier<FloatStream> supplier) throws IllegalArgumentException - Summary: Creates a new FloatStream that is supplied by the given supplier.
-
Contract:
- The supplier is only invoked when the stream is actually used.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Lazy evaluation - supplier is called only when stream is consumed FloatStream deferred = FloatStream.defer(() -> { System.out.println("Creating stream..."); // Printed only when stream is used return FloatStream.of(1.0f, 2.0f, 3.0f); }); // Deferring expensive computation FloatStream expensive = FloatStream.defer(() -> FloatStream.of(computeExpensiveFloatArray())); // Multiple consumption - supplier is memoized after first call float sum = deferred.sum(); // "Creating stream..." printed } </pre>
-
Parameters:
-
supplier(Supplier<FloatStream>) — the supplier that provides the FloatStream
-
- Returns: a new FloatStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
ofNullable(...) -> FloatStream
-
Signature:
public static FloatStream ofNullable(final Float e) - Summary: Returns a FloatStream containing a single element if the specified value is not {@code null} , otherwise returns an empty FloatStream.
-
Contract:
- Returns a FloatStream containing a single element if the specified value is not {@code null} , otherwise returns an empty FloatStream.
-
Parameters:
-
e(Float) — the Float value to create a stream from
-
- Returns: a FloatStream containing the element if not {@code null} , otherwise an empty stream
of(...) -> FloatStream
-
Signature:
public static FloatStream of(final float... a) - Summary: Returns a FloatStream containing the specified elements.
-
Parameters:
-
a(float[]) — the elements to be contained in the stream
-
- Returns: a FloatStream containing the specified elements
-
Signature:
public static FloatStream of(final float[] a, final int fromIndex, final int toIndex) - Summary: Returns a FloatStream containing elements from the specified array between the start (inclusive) and end (exclusive) indices.
-
Parameters:
-
a(float[]) — the array from which to create the stream -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a FloatStream containing the specified range of elements
-
Signature:
public static FloatStream of(final Float[] a) - Summary: Returns a FloatStream containing the unboxed elements from the specified Float array.
-
Parameters:
-
a(Float[]) — the Float array to create a stream from
-
- Returns: a FloatStream containing the unboxed elements
-
Signature:
public static FloatStream of(final Float[] a, final int fromIndex, final int toIndex) - Summary: Returns a FloatStream containing the unboxed elements from the specified Float array between the start (inclusive) and end (exclusive) indices.
-
Parameters:
-
a(Float[]) — the Float array from which to create the stream -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a FloatStream containing the specified range of unboxed elements
-
Signature:
public static FloatStream of(final Collection<Float> c) - Summary: Returns a FloatStream containing the unboxed elements from the specified collection.
-
Parameters:
-
c(Collection<Float>) — the collection of Float values
-
- Returns: a FloatStream containing the unboxed elements from the collection
-
Signature:
public static FloatStream of(final FloatIterator iterator) - Summary: Returns a FloatStream with elements from the specified FloatIterator.
-
Parameters:
-
iterator(FloatIterator) — the FloatIterator to create a stream from
-
- Returns: a FloatStream containing elements from the iterator, or an empty stream if iterator is null
-
Signature:
public static FloatStream of(final FloatBuffer buf) - Summary: Returns a FloatStream containing elements from the specified FloatBuffer from its current position to its limit.
-
Parameters:
-
buf(FloatBuffer) — the FloatBuffer to create a stream from
-
- Returns: a FloatStream containing elements from the buffer, or an empty stream if buffer is null
flatten(...) -> FloatStream
-
Signature:
public static FloatStream flatten(final float[][] a) - Summary: Returns a FloatStream containing all elements from the two-dimensional array, flattened row by row.
-
Parameters:
-
a(float[][]) — the two-dimensional array to flatten
-
- Returns: a FloatStream containing all elements from the array
-
Signature:
public static FloatStream flatten(final float[][] a, final boolean vertically) - Summary: Returns a FloatStream containing all elements from the two-dimensional array, flattened either row by row or column by column.
-
Parameters:
-
a(float[][]) — the two-dimensional array to flatten -
vertically(boolean) — if {@code true} , flattens column by column; if {@code false} , flattens row by row
-
- Returns: a FloatStream containing all elements from the array
-
Signature:
public static FloatStream flatten(final float[][] a, final float valueForAlignment, final boolean vertically) - Summary: Returns a FloatStream containing all elements from the two-dimensional array, flattened with alignment.
-
Contract:
- If rows have different lengths, the valueForAlignment is used to pad shorter rows.
-
Parameters:
-
a(float[][]) — the two-dimensional array to flatten -
valueForAlignment(float) — element to append, so there is the same size of elements in all rows/columns -
vertically(boolean) — if {@code true} , flattens column by column; if {@code false} , flattens row by row
-
- Returns: a FloatStream containing all elements from the array with alignment
-
Signature:
public static FloatStream flatten(final float[][][] a) - Summary: Returns a FloatStream containing all elements from the three-dimensional array, flattened.
-
Parameters:
-
a(float[][][]) — the three-dimensional array to flatten
-
- Returns: a FloatStream containing all elements from the array
repeat(...) -> FloatStream
-
Signature:
public static FloatStream repeat(final float element, final long n) throws IllegalArgumentException - Summary: Returns a FloatStream consisting of n repetitions of the specified element.
-
Parameters:
-
element(float) — the element to repeat -
n(long) — the number of times to repeat the element
-
- Returns: a FloatStream containing n repetitions of the element
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> FloatStream
-
Signature:
public static FloatStream random() - Summary: Returns an effectively unlimited stream of pseudorandom float values, each between 0.0 (inclusive) and 1.0 (exclusive).
-
Parameters:
- (none)
- Returns: a stream of pseudorandom float values
iterate(...) -> FloatStream
-
Signature:
public static FloatStream iterate(final BooleanSupplier hasNext, final FloatSupplier next) throws IllegalArgumentException - Summary: Creates a stream that iterates using the given <i> hasNext </i> and <i> next </i> suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(FloatSupplier) — a FloatSupplier that provides the next float in the iteration
-
- Returns: a FloatStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> next </i> is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static FloatStream iterate(final float init, final BooleanSupplier hasNext, final FloatUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(float) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(FloatUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a FloatStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, BooleanSupplier, java.util.function.UnaryOperator)
-
Signature:
public static FloatStream iterate(final float init, final FloatPredicate hasNext, final FloatUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(float) — the initial value -
hasNext(FloatPredicate) — determinate if the returned stream has next by hasNext.test(init) for first time and hasNext.test(f.apply(previous)) for remaining. -
f(FloatUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a FloatStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, java.util.function.Predicate, java.util.function.UnaryOperator)
-
Signature:
public static FloatStream iterate(final float init, final FloatUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values.
-
Parameters:
-
init(float) — the initial value -
f(FloatUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an infinite FloatStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> f </i> is null
-
- See also: Stream#iterate(Object, java.util.function.UnaryOperator)
generate(...) -> FloatStream
-
Signature:
public static FloatStream generate(final FloatSupplier s) throws IllegalArgumentException - Summary: Generates a FloatStream using the provided FloatSupplier.
-
Parameters:
-
s(FloatSupplier) — the FloatSupplier that provides the elements of the stream
-
- Returns: a FloatStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> FloatStream
-
Signature:
public static FloatStream concat(final float[]... a) - Summary: Concatenates multiple arrays of floats into a single FloatStream.
-
Parameters:
-
a(float[][]) — the arrays of floats to concatenate
-
- Returns: a FloatStream containing all the floats from the input arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static FloatStream concat(final FloatIterator... a) - Summary: Concatenates multiple FloatIterators into a single FloatStream.
-
Parameters:
-
a(FloatIterator[]) — the arrays of FloatIterator to concatenate
-
- Returns: a FloatStream containing all the floats from the input FloatIterators
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static FloatStream concat(final FloatStream... a) - Summary: Concatenates multiple FloatStreams into a single FloatStream.
-
Parameters:
-
a(FloatStream[]) — the arrays of FloatStream to concatenate
-
- Returns: a FloatStream containing all the floats from the input FloatStreams
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static FloatStream concat(final List<float[]> c) - Summary: Concatenates a list of float array into a single FloatStream.
-
Parameters:
-
c(List<float[]>) — the list of float array to concatenate
-
- Returns: a FloatStream containing all the floats from the input list of a float array
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static FloatStream concat(final Collection<? extends FloatStream> streams) - Summary: Concatenates a collection of FloatStream into a single FloatStream.
-
Parameters:
-
streams(Collection<? extends FloatStream>) — the collection of FloatStream to concatenate
-
- Returns: a FloatStream containing all the floats from the input collection of FloatStream
- See also: Stream#concat(Collection)
concatIterators(...) -> FloatStream
-
Signature:
@Beta public static FloatStream concatIterators(final Collection<? extends FloatIterator> floatIterators) - Summary: Concatenates a collection of FloatIterator into a single FloatStream.
-
Parameters:
-
floatIterators(Collection<? extends FloatIterator>) — the collection of FloatIterator to concatenate
-
- Returns: a FloatStream containing all the floats from the input collection of FloatIterator
- See also: Stream#concatIterators(Collection)
zip(...) -> FloatStream
-
Signature:
public static FloatStream zip(final float[] a, final float[] b, final FloatBinaryOperator zipFunction) - Summary: Zips two float arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shorter array runs out of values.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
zipFunction(FloatBinaryOperator) — the function to combine elements from both arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static FloatStream zip(final float[] a, final float[] b, final float[] c, final FloatTernaryOperator zipFunction) - Summary: Zips three float arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shortest array runs out of values.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
c(float[]) — the third float array -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static FloatStream zip(final FloatIterator a, final FloatIterator b, final FloatBinaryOperator zipFunction) - Summary: Zips two float iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shorter iterator runs out of values.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
zipFunction(FloatBinaryOperator) — the function to combine elements from both iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static FloatStream zip(final FloatIterator a, final FloatIterator b, final FloatIterator c, final FloatTernaryOperator zipFunction) - Summary: Zips three float iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shortest iterator runs out of values.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
c(FloatIterator) — the third float iterator -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static FloatStream zip(final FloatStream a, final FloatStream b, final FloatBinaryOperator zipFunction) - Summary: Zips two float streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shorter stream runs out of values.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
zipFunction(FloatBinaryOperator) — the function to combine elements from both streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, BiFunction)
-
Signature:
public static FloatStream zip(final FloatStream a, final FloatStream b, final FloatStream c, final FloatTernaryOperator zipFunction) - Summary: Zips three float streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shortest stream runs out of values.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
c(FloatStream) — the third float stream -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, TriFunction)
-
Signature:
public static FloatStream zip(final Collection<? extends FloatStream> streams, final FloatNFunction<Float> zipFunction) - Summary: Zips multiple float streams into a single stream until any of them run out of values.
-
Contract:
- The stream ends when any of the input streams runs out of values.
-
Parameters:
-
streams(Collection<? extends FloatStream>) — the collection of float streams to zip -
zipFunction(FloatNFunction<Float>) — the function to combine elements from all the streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, Function)
-
Signature:
public static FloatStream zip(final float[] a, final float[] b, final float valueForNoneA, final float valueForNoneB, final FloatBinaryOperator zipFunction) - Summary: Zips two float arrays into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both arrays run out of values.
- If one array runs out of values before the other, the specified default value is used for the shorter array.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
valueForNoneA(float) — the default value to use if the first array is shorter -
valueForNoneB(float) — the default value to use if the second array is shorter -
zipFunction(FloatBinaryOperator) — the function to combine elements from both arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static FloatStream zip(final float[] a, final float[] b, final float[] c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTernaryOperator zipFunction) - Summary: Zips three float arrays into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all arrays run out of values.
- If one array runs out of values before the others, the specified default value is used for the shorter array.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
c(float[]) — the third float array -
valueForNoneA(float) — the default value to use if the first array is shorter -
valueForNoneB(float) — the default value to use if the second array is shorter -
valueForNoneC(float) — the default value to use if the third array is shorter -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static FloatStream zip(final FloatIterator a, final FloatIterator b, final float valueForNoneA, final float valueForNoneB, final FloatBinaryOperator zipFunction) - Summary: Zips two float iterators into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both iterators run out of values.
- If one iterator runs out of values before the other, the specified default value is used for the shorter iterator.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
valueForNoneA(float) — the default value to use if the first iterator is shorter -
valueForNoneB(float) — the default value to use if the second iterator is shorter -
zipFunction(FloatBinaryOperator) — the function to combine elements from both iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static FloatStream zip(final FloatIterator a, final FloatIterator b, final FloatIterator c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTernaryOperator zipFunction) - Summary: Zips three float iterators into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all iterators run out of values.
- If one iterator runs out of values before the others, the specified default value is used for the shorter iterator.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
c(FloatIterator) — the third float iterator -
valueForNoneA(float) — the default value to use if the first iterator is shorter -
valueForNoneB(float) — the default value to use if the second iterator is shorter -
valueForNoneC(float) — the default value to use if the third iterator is shorter -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, Object, Object, Object, TriFunction)
-
Signature:
public static FloatStream zip(final FloatStream a, final FloatStream b, final float valueForNoneA, final float valueForNoneB, final FloatBinaryOperator zipFunction) - Summary: Zips two float streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both streams run out of values.
- If one stream runs out of values before the other, the specified default value is used for the shorter stream.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
valueForNoneA(float) — the default value to use if the first stream is shorter -
valueForNoneB(float) — the default value to use if the second stream is shorter -
zipFunction(FloatBinaryOperator) — the function to combine elements from both streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static FloatStream zip(final FloatStream a, final FloatStream b, final FloatStream c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTernaryOperator zipFunction) - Summary: Zips three float streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all streams run out of values.
- If one stream runs out of values before the others, the specified default value is used for the shorter stream.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
c(FloatStream) — the third float stream -
valueForNoneA(float) — the default value to use if the first stream is shorter -
valueForNoneB(float) — the default value to use if the second stream is shorter -
valueForNoneC(float) — the default value to use if the third stream is shorter -
zipFunction(FloatTernaryOperator) — the function to combine elements from all three streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, Object, Object, Object, TriFunction)
-
Signature:
public static FloatStream zip(final Collection<? extends FloatStream> streams, final float[] valuesForNone, final FloatNFunction<Float> zipFunction) - Summary: Zips multiple float streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all input streams run out of values.
- If one stream runs out of values before the others, the specified default value is used for the shorter stream.
-
Parameters:
-
streams(Collection<? extends FloatStream>) — the collection of float streams to zip -
valuesForNone(float[]) — the default values to use if the corresponding stream is shorter -
zipFunction(FloatNFunction<Float>) — the function to combine elements from all the streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, List, Function)
merge(...) -> FloatStream
-
Signature:
public static FloatStream merge(final float[] a, final float[] b, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges two float arrays into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the two input arrays
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static FloatStream merge(final float[] a, final float[] b, final float[] c, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges three float arrays into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
c(float[]) — the third float array -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the three input arrays
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static FloatStream merge(final FloatIterator a, final FloatIterator b, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges two FloatIterators into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(FloatIterator) — the first FloatIterator -
b(FloatIterator) — the second FloatIterator -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the two input iterators
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static FloatStream merge(final FloatIterator a, final FloatIterator b, final FloatIterator c, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges three FloatIterators into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(FloatIterator) — the first FloatIterator -
b(FloatIterator) — the second FloatIterator -
c(FloatIterator) — the third FloatIterator -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the three input iterators
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static FloatStream merge(final FloatStream a, final FloatStream b, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges two FloatStreams into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(FloatStream) — the first FloatStream -
b(FloatStream) — the second FloatStream -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the two input streams
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static FloatStream merge(final FloatStream a, final FloatStream b, final FloatStream c, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges three FloatStreams into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
a(FloatStream) — the first FloatStream -
b(FloatStream) — the second FloatStream -
c(FloatStream) — the third FloatStream -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the three input streams
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static FloatStream merge(final Collection<? extends FloatStream> streams, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of FloatStream into a single FloatStream based on the provided nextSelector function.
-
Parameters:
-
streams(Collection<? extends FloatStream>) — the collection of FloatStream instances to merge -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a FloatStream containing the merged elements from the input FloatStreams
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract FloatStream filter(final FloatPredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(FloatPredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract FloatStream takeWhile(final FloatPredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(FloatPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract FloatStream dropWhile(final FloatPredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(FloatPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream map(FloatUnaryOperator mapper) - Summary: Returns a FloatStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatUnaryOperator) — a non-interfering, stateless function that transforms each element from float to float
-
- Returns: a new FloatStream consisting of the results of applying the mapper function to each element
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(FloatToIntFunction mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatToIntFunction) — a non-interfering, stateless function that transforms each element from float to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element
- See also: #map(FloatUnaryOperator), #mapToObj(FloatFunction)
mapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream mapToLong(FloatToLongFunction mapper) - Summary: Returns a LongStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatToLongFunction) — a non-interfering, stateless function that transforms each element from float to long
-
- Returns: a new LongStream consisting of the results of applying the mapper function to each element
- See also: #map(FloatUnaryOperator), #mapToDouble(FloatToDoubleFunction)
mapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(FloatToDoubleFunction mapper) - Summary: Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatToDoubleFunction) — a non-interfering, stateless function that transforms each element from float to double
-
- Returns: a new DoubleStream consisting of the results of applying the mapper function to each element
- See also: #map(FloatUnaryOperator), #mapToLong(FloatToLongFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(FloatFunction<? extends T> mapper) - Summary: Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatFunction<? extends T>) — a non-interfering, stateless function that transforms each element from float to T
-
- Returns: a new Stream of objects resulting from applying the mapper function to each element
- See also: #map(FloatUnaryOperator), #mapToInt(FloatToIntFunction)
flatMap(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatMap(FloatFunction<? extends FloatStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each number to include its double FloatStream.of(1.0f, 2.0f, 3.0f) .flatMap(f -> FloatStream.of(f, f * 2)) .toFloatList(); // Returns \[1.0, 2.0, 2.0, 4.0, 3.0, 6.0\] // Duplicate each element FloatStream.of(1.5f, 2.5f, 3.5f) .flatMap(f -> FloatStream.of(f, f)) .toFloatList(); // Returns \[1.5, 1.5, 2.5, 2.5, 3.5, 3.5\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(FloatFunction<? extends FloatStream>) — a non-interfering, stateless function that transforms each element from float to FloatStream
-
- Returns: the new stream
- See also: Stream#flatMap(Function)
flatmap(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatmap(FloatFunction<float[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(FloatFunction<float[]>) — a non-interfering, stateless function that transforms each element from float to float\[\]
-
- Returns: the new stream
- See also: #flatMap(FloatFunction), #flatMapToInt(FloatFunction), #flatMapToObj(FloatFunction)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(FloatFunction<? extends IntStream> mapper) - Summary: Returns an IntStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert each float to floor and ceiling integers FloatStream.of(1.5f, 2.5f, 3.5f) .flatMapToInt(f -> IntStream.of((int) f, (int) Math.ceil(f))) .toIntList(); // Returns \[1, 2, 2, 3, 3, 4\] // Generate integer range based on float value FloatStream.of(2.0f, 3.0f) .flatMapToInt(f -> IntStream.range(0, (int) f)) .toIntList(); // Returns \[0, 1, 0, 1, 2\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(FloatFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element from float to IntStream
-
- Returns: the new stream
flatMapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(FloatFunction<? extends LongStream> mapper) - Summary: Returns a LongStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert each float to floor and ceiling longs FloatStream.of(1.5f, 2.5f, 3.5f) .flatMapToLong(f -> LongStream.of((long) f, (long) Math.ceil(f))) .toLongList(); // Returns \[1, 2, 2, 3, 3, 4\] // Scale and generate range FloatStream.of(2.5f, 3.0f) .flatMapToLong(f -> LongStream.range(0, (long) f)) .toLongList(); // Returns \[0, 1, 0, 1, 2\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(FloatFunction<? extends LongStream>) — a non-interfering, stateless function that transforms each element from float to LongStream
-
- Returns: the new stream
flatMapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(FloatFunction<? extends DoubleStream> mapper) - Summary: Returns a DoubleStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert each float to double with transformations FloatStream.of(1.5f, 2.5f, 3.5f) .flatMapToDouble(f -> DoubleStream.of(f, f * 2.0)) .toDoubleList(); // Returns \[1.5, 3.0, 2.5, 5.0, 3.5, 7.0\] // Generate double range from float FloatStream.of(2.0f, 3.0f) .flatMapToDouble(f -> DoubleStream.of(f, f + 0.5, f + 1.0)) .toDoubleList(); // Returns \[2.0, 2.5, 3.0, 3.0, 3.5, 4.0\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(FloatFunction<? extends DoubleStream>) — a non-interfering, stateless function that transforms each element from float to DoubleStream
-
- Returns: the new stream
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(FloatFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Convert each float to multiple string representations FloatStream.of(1.5f, 2.5f, 3.5f) .flatMapToObj(f -> Stream.of(String.valueOf(f), String.valueOf(f 2))) .toList(); // Returns \["1.5", "3.0", "2.5", "5.0", "3.5", "7.0"\] // Generate objects based on float values FloatStream.of(1.0f, 2.0f) .flatMapToObj(f -> Stream.of("Value: " + f, "Double: " + (f 2))) .toList(); // Returns \["Value: 1.0", "Double: 2.0", "Value: 2.0", "Double: 4.0"\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(FloatFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element from float to Stream
-
- Returns: the new stream
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(FloatFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped collection produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(FloatFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element from float to Collection
-
- Returns: the new stream
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(FloatFunction<T[]> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped array produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(FloatFunction<T[]>) — a non-interfering, stateless function that transforms each element from float to T\[\]
-
- Returns: the new stream
mapPartial(...) -> FloatStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract FloatStream mapPartial(FloatFunction<OptionalFloat> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the elements of this stream, where the mapper function returns an OptionalFloat.
-
Parameters:
-
mapper(FloatFunction<OptionalFloat>) — a function to apply to each element which produces an OptionalFloat
-
- Returns: a new FloatStream with the non-empty mapped elements
rangeMap(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream rangeMap(final FloatBiPredicate sameRange, final FloatBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(FloatBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(FloatBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final FloatBiPredicate sameRange, final FloatBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(FloatBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(FloatBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<FloatList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<FloatList> collapse(final FloatBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(FloatBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream collapse(final FloatBiPredicate collapsible, final FloatBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(FloatBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(FloatBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream collapse(final FloatTriPredicate collapsible, final FloatBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(FloatTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(FloatBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream scan(final FloatBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(FloatBinaryOperator) — a {@code FloatBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code FloatStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream scan(final float init, final FloatBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(float) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(FloatBinaryOperator) — a {@code FloatBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code FloatStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream scan(final float init, final boolean initIncluded, final FloatBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(float) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(FloatBinaryOperator) — a {@code FloatBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code FloatStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream prepend(final float... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(float[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream append(final float... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(float[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream appendIfEmpty(final float... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
-
Parameters:
-
a(float[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
top(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to return
-
- Returns: a new FloatStream containing the top n elements
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream top(final int n, Comparator<? super Float> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to return -
comparator(Comparator<? super Float>) — a comparator to order the elements
-
- Returns: a new FloatStream containing the top n elements
toFloatList(...) -> FloatList
-
Signature:
@SequentialOnly @TerminalOp public abstract FloatList toFloatList() - Summary: Returns a FloatList containing all the elements of this stream.
-
Parameters:
- (none)
- Returns: a FloatList containing all stream elements
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.FloatFunction<? extends K, E> keyMapper, Throwables.FloatFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a Map where keys are generated by the keyMapper function and values are generated by the valueMapper function.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.FloatFunction<? extends V, E2>) — a function to produce values for the map
-
- Returns: a Map containing the mapped key-value pairs
-
Throws:
-
E— if the keyMapper throws an exception -
E2— if the valueMapper throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.FloatFunction<? extends K, E> keyMapper, Throwables.FloatFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map where keys are generated by the keyMapper function and values are generated by the valueMapper function, using the provided map factory.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.FloatFunction<? extends V, E2>) — a function to produce values for the map -
mapFactory(Supplier<? extends M>) — a supplier providing a new Map into which the results will be inserted
-
- Returns: a Map containing the mapped key-value pairs
-
Throws:
-
E— if the keyMapper throws an exception -
E2— if the valueMapper throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.FloatFunction<? extends K, E> keyMapper, Throwables.FloatFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a Map where keys are generated by the keyMapper function and values are generated by the valueMapper function, with a merge function to handle duplicate keys.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.FloatFunction<? extends V, E2>) — a function to produce values for the map -
mergeFunction(BinaryOperator<V>) — a function to resolve collisions between values associated with the same key
-
- Returns: a Map containing the mapped key-value pairs
-
Throws:
-
E— if the keyMapper throws an exception -
E2— if the valueMapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.FloatFunction<? extends K, E> keyMapper, Throwables.FloatFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map where keys are generated by the keyMapper function and values are generated by the valueMapper function, with a merge function to handle duplicate keys, using the provided map factory.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a function to produce keys for the map -
valueMapper(Throwables.FloatFunction<? extends V, E2>) — a function to produce values for the map -
mergeFunction(BinaryOperator<V>) — a function to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new Map into which the results will be inserted
-
- Returns: a Map containing the mapped key-value pairs
-
Throws:
-
E— if the keyMapper throws an exception -
E2— if the valueMapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.FloatFunction<? extends K, E> keyMapper, final Collector<? super Float, ?, D> downstream) throws E - Summary: Groups the elements of this stream by a classifier function and collects them using the specified downstream collector.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Float, ?, D>) — a Collector implementing the downstream reduction
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the keyMapper throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.FloatFunction<? extends K, E> keyMapper, final Collector<? super Float, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream by a classifier function and collects them using the specified downstream collector and map factory.
-
Parameters:
-
keyMapper(Throwables.FloatFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Float, ?, D>) — a Collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new Map into which the results will be inserted
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the keyMapper throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> float
-
Signature:
@ParallelSupported @TerminalOp public abstract float reduce(float identity, FloatBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(float) — the initial value of the reduction operation -
accumulator(FloatBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalFloat reduce(FloatBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
accumulator(FloatBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: an OptionalFloat describing the result of the reduction. If the stream is empty, an empty {@code OptionalFloat} is returned.
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjFloatConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjFloatConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjFloatConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <br/> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjFloatConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjFloatConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.FloatConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.FloatConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntFloatConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, passing the element's index as well.
-
Parameters:
-
action(Throwables.IntFloatConsumer<E>) — a non-interfering action to perform on the elements, taking both index and value
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code false} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalFloat
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalFloat findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalFloat} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalFloat} containing the first element of the stream, or an empty {@code OptionalFloat} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.FloatPredicate), #findAny(Throwables.FloatPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalFloat findFirst(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns an OptionalFloat describing the first element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
-
Contract:
- Returns an OptionalFloat describing the first element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an OptionalFloat describing the first matching element of this stream, or an empty {@code OptionalFloat} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalFloat
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalFloat findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalFloat} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalFloat} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalFloat} containing some element of the stream, or an empty {@code OptionalFloat} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.FloatPredicate), #findAny(Throwables.FloatPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalFloat findAny(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns an OptionalFloat describing any element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
-
Contract:
- Returns an OptionalFloat describing any element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an OptionalFloat describing any matching element of this stream, or an empty {@code OptionalFloat} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalFloat
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalFloat findLast(final Throwables.FloatPredicate<E> predicate) throws E - Summary: Returns an OptionalFloat describing the last element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
-
Contract:
- Returns an OptionalFloat describing the last element of this stream that matches the given predicate, or an empty {@code OptionalFloat} if no such element exists.
- Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.FloatPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an OptionalFloat describing the last matching element of this stream, or an empty {@code OptionalFloat} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalFloat
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalFloat min() - Summary: Returns an OptionalFloat describing the minimum element of this stream, or an empty {@code OptionalFloat} if the stream is empty.
-
Contract:
- Returns an OptionalFloat describing the minimum element of this stream, or an empty {@code OptionalFloat} if the stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalFloat} containing the minimum element, or an empty {@code OptionalFloat} if the stream is empty
max(...) -> OptionalFloat
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalFloat max() - Summary: Returns an OptionalFloat describing the maximum element of this stream, or an empty {@code OptionalFloat} if the stream is empty.
-
Contract:
- Returns an OptionalFloat describing the maximum element of this stream, or an empty {@code OptionalFloat} if the stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalFloat} containing the maximum element, or an empty {@code OptionalFloat} if the stream is empty
kthLargest(...) -> OptionalFloat
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalFloat kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty {@code OptionalFloat} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element FloatStream.of(10.5f, 30.2f, 20.8f, 50.1f, 40.7f).kthLargest(2); // Returns OptionalFloat\[40.7f\] // Find the largest element (same as max) FloatStream.of(5.5f, 2.3f, 8.1f, 1.7f).kthLargest(1); // Returns OptionalFloat\[8.1f\] // When k exceeds stream size FloatStream.of(1.5f, 2.3f, 3.8f).kthLargest(5); // Returns OptionalFloat.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an {@code OptionalFloat} containing the k-th largest element, or an empty {@code OptionalFloat} if the stream is empty or the count of elements is less than k
sum(...) -> double
-
Signature:
@SequentialOnly @TerminalOp public abstract double sum() - Summary: Returns the sum of all elements in this stream as a double.
-
Parameters:
- (none)
- Returns: the sum of elements in this stream as a double. Returns 0.0 if the stream is empty.
- See also: #average(), #reduce(float, FloatBinaryOperator)
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> FloatSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract FloatSummaryStatistics summaryStatistics() - Summary: Returns statistics about the elements of this stream.
-
Parameters:
- (none)
- Returns: a FloatSummaryStatistics containing various statistics about the elements
summaryStatisticsAndPercentiles(...) -> Pair<FloatSummaryStatistics, Optional<Map<Percentage, Float>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<FloatSummaryStatistics, Optional<Map<Percentage, Float>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of FloatSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of FloatSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Pair<FloatSummaryStatistics, Optional<Map<Percentage, Float>>> result = FloatStream.of(1.5f, 2.3f, 3.7f, 4.2f, 5.8f, 6.1f, 7.9f, 8.5f, 9.2f, 10.0f) .summaryStatisticsAndPercentiles(); FloatSummaryStatistics stats = result.left; System.out.println("Count: " + stats.getCount()); // Count: 10 System.out.println("Average: " + stats.getAverage()); // Average: 5.92 Optional<Map<Percentage, Float>> percentiles = result.right; if (percentiles.isPresent()) { Map<Percentage, Float> map = percentiles.get(); System.out.println("Median (50th percentile): " + map.get(Percentage.of(50))); System.out.println("90th percentile: " + map.get(Percentage.of(90))); } } </pre>
-
Parameters:
- (none)
- Returns: a Pair where the first element is FloatSummaryStatistics and the second is an Optional containing a map of percentiles
mergeWith(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream mergeWith(final FloatStream b, final FloatBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another FloatStream based on the provided selector function.
-
Parameters:
-
b(FloatStream) — the other FloatStream to merge with -
nextSelector(FloatBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a new FloatStream containing the merged elements
zipWith(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream zipWith(FloatStream b, FloatBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(FloatStream) — the FloatStream to be combined with the current FloatStream. Must be {@code non-null} . -
zipFunction(FloatBinaryOperator) — a FloatBinaryOperator that determines the combination of elements in the combined FloatStream. Must be {@code non-null} .
-
- Returns: a new FloatStream that is the result of combining the current FloatStream with the given FloatStream
- See also: #zipWith(FloatStream, float, float, FloatBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream zipWith(FloatStream b, FloatStream c, FloatTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(FloatStream) — the second FloatStream to be combined with the current FloatStream. Will be closed along with this FloatStream. -
c(FloatStream) — the third FloatStream to be combined with the current FloatStream. Will be closed along with this FloatStream. -
zipFunction(FloatTernaryOperator) — a FloatTernaryOperator that determines the combination of elements in the combined FloatStream. Must be {@code non-null} .
-
- Returns: a new FloatStream that is the result of combining the current FloatStream with the given FloatStreams
- See also: #zipWith(FloatStream, FloatStream, float, float, float, FloatTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream zipWith(FloatStream b, float valueForNoneA, float valueForNoneB, FloatBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(FloatStream) — the FloatStream to be combined with the current FloatStream. Will be closed along with this FloatStream. -
valueForNoneA(float) — the default value to use for the current FloatStream when it runs out of elements -
valueForNoneB(float) — the default value to use for the given FloatStream when it runs out of elements -
zipFunction(FloatBinaryOperator) — a FloatBinaryOperator that determines the combination of elements in the combined FloatStream. Must be {@code non-null} .
-
- Returns: a new FloatStream that is the result of combining the current FloatStream with the given FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream zipWith(FloatStream b, FloatStream c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(FloatStream) — the second FloatStream to be combined with the current FloatStream. Will be closed along with this FloatStream. -
c(FloatStream) — the third FloatStream to be combined with the current FloatStream. Will be closed along with this FloatStream. -
valueForNoneA(float) — the default value to use for the current FloatStream when it runs out of elements -
valueForNoneB(float) — the default value to use for the second FloatStream when it runs out of elements -
valueForNoneC(float) — the default value to use for the third FloatStream when it runs out of elements -
zipFunction(FloatTernaryOperator) — a FloatTernaryOperator that determines the combination of elements in the combined FloatStream. Must be {@code non-null} .
-
- Returns: a new FloatStream that is the result of combining the current FloatStream with the given FloatStreams
asDoubleStream(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream asDoubleStream() - Summary: Converts this FloatStream to a DoubleStream.
-
Parameters:
- (none)
- Returns: a DoubleStream containing the elements of this stream converted to doubles
boxed(...) -> Stream<Float>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Float> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Float.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Float
Class FloatStreamEx (com.landawn.abacus.util.stream.FloatStream.FloatStreamEx)
Extended abstract class for FloatStream implementations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class IntIteratorEx (com.landawn.abacus.util.stream.IntIteratorEx)
An extended iterator over primitive int values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> IntIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static IntIteratorEx empty() - Summary: Returns an empty IntIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty IntIteratorEx instance
of(...) -> IntIteratorEx
-
Signature:
public static IntIteratorEx of(final int... a) - Summary: Creates an IntIteratorEx from the given int array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(int[]) — the int array to iterate over (can be {@code null} or empty)
-
- Returns: an IntIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static IntIteratorEx of(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates an IntIteratorEx from a portion of the given int array.
-
Parameters:
-
a(int[]) — the int array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: an IntIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static IntIteratorEx of(final IntIterator iter) - Summary: Wraps an IntIterator as an IntIteratorEx.
-
Contract:
- If the iterator is already an IntIteratorEx, it is returned as-is.
-
Parameters:
-
iter(IntIterator) — the IntIterator to wrap (can be null)
-
- Returns: an IntIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> IntIteratorEx
-
Signature:
public static IntIteratorEx from(final Iterator<Integer> iter) - Summary: Creates an IntIteratorEx from an Iterator of Integer objects.
-
Parameters:
-
iter(Iterator<Integer>) — the Iterator of Integer objects (can be null)
-
- Returns: an IntIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class IntStream (com.landawn.abacus.util.stream.IntStream)
A specialized stream implementation for processing sequences of integer values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> IntStream
-
Signature:
public static IntStream empty() - Summary: Returns an empty IntStream.
-
Parameters:
- (none)
- Returns: an empty IntStream
defer(...) -> IntStream
-
Signature:
public static IntStream defer(final Supplier<IntStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Defer expensive stream creation IntStream deferred = IntStream.defer(() -> { // This code only runs when stream is consumed System.out.println("Creating stream..."); return IntStream.range(1, 1000000); }); // Stream is created only when consumed int sum = deferred.limit(10).sum(); // Prints "Creating stream..." // Useful for conditional stream generation IntStream conditional = IntStream.defer(() -> someCondition() ?
-
Parameters:
-
supplier(Supplier<IntStream>) — the supplier that provides the IntStream
-
- Returns: a new IntStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
from(...) -> IntStream
-
Signature:
public static IntStream from(final java.util.stream.IntStream stream) - Summary: Creates an IntStream from a java.util.stream.IntStream.
-
Parameters:
-
stream(java.util.stream.IntStream) — the java.util.stream.IntStream to convert
-
- Returns: an IntStream containing the elements from the input stream, or empty stream if input is null
ofNullable(...) -> IntStream
-
Signature:
public static IntStream ofNullable(final Integer e) - Summary: Creates an IntStream containing a single Integer element.
-
Contract:
- If the element is {@code null} , returns an empty stream.
-
Parameters:
-
e(Integer) — the Integer element (nullable)
-
- Returns: an IntStream containing the element, or empty stream if the element is null
of(...) -> IntStream
-
Signature:
public static IntStream of(final int... a) - Summary: Creates an IntStream from an array of int values.
-
Parameters:
-
a(int[]) — the array of int values
-
- Returns: an IntStream containing the elements from the array
-
Signature:
public static IntStream of(final int[] a, final int fromIndex, final int toIndex) - Summary: Creates an IntStream from a portion of an int array.
-
Parameters:
-
a(int[]) — the array of int values -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a IntStream containing the specified range of elements
-
Signature:
public static IntStream of(final Integer[] a) - Summary: Creates an IntStream from an array of Integer objects.
-
Parameters:
-
a(Integer[]) — the array of Integer objects (must not contain null elements)
-
- Returns: an IntStream containing the unboxed elements from the array
-
Signature:
public static IntStream of(final Integer[] a, final int fromIndex, final int toIndex) - Summary: Creates an IntStream from a portion of an Integer array.
-
Parameters:
-
a(Integer[]) — the array of Integer objects (must not contain null elements in the specified range) -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: an IntStream containing the unboxed elements from the specified range of the array
-
Signature:
public static IntStream of(final Collection<Integer> c) - Summary: Creates an IntStream from a Collection of Integer objects.
-
Parameters:
-
c(Collection<Integer>) — the Collection of Integer objects (must not contain null elements)
-
- Returns: an IntStream containing the unboxed elements from the collection
-
Signature:
public static IntStream of(final IntIterator iterator) - Summary: Creates an IntStream from an IntIterator.
-
Parameters:
-
iterator(IntIterator) — the IntIterator providing the elements
-
- Returns: an IntStream containing the elements from the iterator, or empty stream if iterator is null
-
Signature:
@Deprecated public static IntStream of(final java.util.stream.IntStream stream) - Summary: Creates an IntStream from a java.util.stream.IntStream.
-
Parameters:
-
stream(java.util.stream.IntStream) — the java.util.stream.IntStream to convert
-
- Returns: an IntStream containing the elements from the input stream
-
Signature:
public static IntStream of(final OptionalInt op) - Summary: Creates an IntStream from an OptionalInt.
-
Contract:
- If the OptionalInt is empty or {@code null} , returns an empty stream.
-
Parameters:
-
op(OptionalInt) — the OptionalInt containing the value
-
- Returns: an IntStream containing the value if present, otherwise empty stream
-
Signature:
public static IntStream of(final java.util.OptionalInt op) - Summary: Creates an IntStream from a java.util.OptionalInt.
-
Contract:
- If the OptionalInt is empty or {@code null} , returns an empty stream.
-
Parameters:
-
op(java.util.OptionalInt) — the java.util.OptionalInt containing the value
-
- Returns: an IntStream containing the value if present, otherwise empty stream
-
Signature:
public static IntStream of(final IntBuffer buf) - Summary: Creates an IntStream from an IntBuffer.
-
Parameters:
-
buf(IntBuffer) — the IntBuffer to read from
-
- Returns: an IntStream containing the elements from the buffer, or empty stream if buffer is null
ofCodePoints(...) -> IntStream
-
Signature:
public static IntStream ofCodePoints(final CharSequence str) - Summary: Creates an IntStream of Unicode code points from a CharSequence.
-
Parameters:
-
str(CharSequence) — the CharSequence to convert to code points
-
- Returns: an IntStream containing the Unicode code points from the CharSequence
splitByChunkCount(...) -> IntStream
-
Signature:
public static IntStream splitByChunkCount(final int totalSize, final int maxChunkCount, final IntBinaryOperator mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The length of returned IntStream may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
mapper(IntBinaryOperator) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: an IntStream of the mapped chunk values
- See also: #splitByChunkCount(int, int, boolean, IntBinaryOperator)
-
Signature:
public static IntStream splitByChunkCount(final int totalSize, final int maxChunkCount, final boolean sizeSmallerFirst, final IntBinaryOperator mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- <br/> The length of returned IntStream may be less than the specified {@code maxChunkCount} if the input {@code totalSize} is less than {@code maxChunkCount} .
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
sizeSmallerFirst(boolean) — if {@code true} , smaller chunks will be created first; otherwise, larger chunks will be created first -
mapper(IntBinaryOperator) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: an IntStream of the mapped chunk values
- See also: Stream#splitByChunkCount(int, int, boolean, IntBiFunction)
flatten(...) -> IntStream
-
Signature:
public static IntStream flatten(final int[][] a) - Summary: Flattens a two-dimensional int array into a single IntStream.
-
Parameters:
-
a(int[][]) — the two-dimensional int array to flatten
-
- Returns: an IntStream containing all elements from the array in row-major order
-
Signature:
public static IntStream flatten(final int[][] a, final boolean vertically) - Summary: Flattens a two-dimensional int array into a single IntStream.
-
Parameters:
-
a(int[][]) — the two-dimensional int array to flatten -
vertically(boolean) — if {@code true} , elements are read column by column; if {@code false} , row by row
-
- Returns: an IntStream containing all elements from the array
-
Signature:
public static IntStream flatten(final int[][] a, final int valueForAlignment, final boolean vertically) - Summary: Flattens a two-dimensional int array into a single IntStream with alignment.
-
Contract:
- If arrays have different lengths, shorter arrays are padded with the specified value.
-
Parameters:
-
a(int[][]) — the two-dimensional int array to flatten -
valueForAlignment(int) — element to append, so there is the same size of elements in all rows/columns -
vertically(boolean) — if {@code true} , elements are read column by column; if {@code false} , row by row
-
- Returns: an IntStream containing all elements from the array with alignment padding
-
Signature:
public static IntStream flatten(final int[][][] a) - Summary: Flattens a three-dimensional int array into a single IntStream.
-
Parameters:
-
a(int[][][]) — the three-dimensional int array to flatten
-
- Returns: an IntStream containing all elements from the array
range(...) -> IntStream
-
Signature:
public static IntStream range(final int startInclusive, final int endExclusive) - Summary: Creates an IntStream of sequential integers from startInclusive (inclusive) to endExclusive (exclusive).
-
Contract:
- If startInclusive > = endExclusive, an empty stream is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate numbers from 0 to 9 IntStream.range(0, 10).toArray(); // Returns \[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\] // Use in loop-like operations IntStream.range(1, 6).forEach(i -> System.out.println("Item " + i)); // Empty stream when start >= end IntStream.range(5, 5).count(); // Returns 0 IntStream.range(10, 5).count(); // Returns 0 } </pre>
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive)
-
- Returns: an IntStream of sequential integers
-
Signature:
public static IntStream range(final int startInclusive, final int endExclusive, final int by) - Summary: Creates an IntStream of integers from startInclusive (inclusive) to endExclusive (exclusive) with the specified step.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive) -
by(int) — the step value
-
- Returns: an IntStream of integers with the specified step
rangeClosed(...) -> IntStream
-
Signature:
public static IntStream rangeClosed(final int startInclusive, final int endInclusive) - Summary: Creates an IntStream of sequential integers from startInclusive (inclusive) to endInclusive (inclusive).
-
Contract:
- If startInclusive > endInclusive, an empty stream is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate numbers from 1 to 10 (both inclusive) IntStream.rangeClosed(1, 10).toArray(); // Returns \[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\] // Single element IntStream.rangeClosed(5, 5).toArray(); // Returns \[5\] // Empty stream when start > end IntStream.rangeClosed(10, 5).count(); // Returns 0 } </pre>
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive)
-
- Returns: an IntStream of sequential integers
-
Signature:
public static IntStream rangeClosed(final int startInclusive, final int endInclusive, final int by) - Summary: Creates an IntStream of integers from startInclusive (inclusive) to endInclusive (inclusive) with the specified step.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive) -
by(int) — the step value
-
- Returns: an IntStream of integers with the specified step
repeat(...) -> IntStream
-
Signature:
public static IntStream repeat(final int element, final long n) throws IllegalArgumentException - Summary: Creates an IntStream that repeats the specified element for the given number of times.
-
Parameters:
-
element(int) — the int value to repeat -
n(long) — the number of times to repeat the element
-
- Returns: an IntStream containing n copies of the element
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> IntStream
-
Signature:
public static IntStream random() - Summary: Creates an infinite IntStream of random integers.
-
Parameters:
- (none)
- Returns: an infinite IntStream of random integers
-
Signature:
public static IntStream random(final int startInclusive, final int endExclusive) - Summary: Creates an infinite IntStream of random integers within the specified range.
-
Parameters:
-
startInclusive(int) — the lower bound (inclusive) -
endExclusive(int) — the upper bound (exclusive)
-
- Returns: an infinite IntStream of random integers in the range \[startInclusive, endExclusive)
ofIndices(...) -> IntStream
-
Signature:
@Beta public static IntStream ofIndices(final int lenOrSize) - Summary: Creates an IntStream of indices from 0 (inclusive) to the specified length or size (exclusive).
-
Parameters:
-
lenOrSize(int) — the length or size of a collection, map, array, CharSequence, etc.
-
- Returns: an IntStream of indices from 0 to lenOrSize (exclusive)
- See also: N#len(CharSequence), N#len(int\[\]), N#len(Object\[\]), N#size(Collection), N#size(Map), N#forEach(int, int, Throwables.IntConsumer)
-
Signature:
@Beta public static IntStream ofIndices(final int lenOrSize, final int step) - Summary: Creates an IntStream of indices from 0 to {@code lenOrSize} (exclusive) with the specified step when {@code step} is positive, or from {@code lenOrSize} - 1 to 0 (inclusive) with the specified {@code step} when step is negative.
-
Contract:
- Creates an IntStream of indices from 0 to {@code lenOrSize} (exclusive) with the specified step when {@code step} is positive, or from {@code lenOrSize} - 1 to 0 (inclusive) with the specified {@code step} when step is negative.
-
Parameters:
-
lenOrSize(int) — the length or size of a collection, map, array, CharSequence, etc. -
step(int) — the increment value for each iteration in the range. It can be positive or negative but not zero.
-
- Returns: an IntStream of indices from 0 to lenOrSize (exclusive) with the specified step when it is positive, or from lenOrSize - 1 to 0 (inclusive) with the specified step when it is negative.
- See also: N#len(CharSequence), N#len(int\[\]), N#len(Object\[\]), N#size(Collection), N#size(Map), N#forEach(int, int, int, Throwables.IntConsumer)
-
Signature:
@Beta public static <AC> IntStream ofIndices(final AC source, final ObjIntFunction<? super AC, Integer> indexFunc) - Summary: Creates an IntStream of indices from the given source using the provided index function.
-
Parameters:
-
source(AC) — the source from which indices are generated -
indexFunc(ObjIntFunction<? super AC, Integer>) — the function to generate indices from the source
-
- Returns: an IntStream of indices
-
Signature:
@Beta public static <AC> IntStream ofIndices(final AC source, final int fromIndex, final ObjIntFunction<? super AC, Integer> indexFunc) - Summary: Creates an IntStream of indices from the given source starting from the specified index using the provided index function.
-
Parameters:
-
source(AC) — the source from which indices are generated -
fromIndex(int) — the starting index from which to generate indices -
indexFunc(ObjIntFunction<? super AC, Integer>) — the function to generate indices from the source
-
- Returns: an IntStream of indices
-
Signature:
@Beta public static <AC> IntStream ofIndices(final AC source, final int fromIndex, final int increment, final ObjIntFunction<? super AC, Integer> indexFunc) - Summary: Creates an IntStream of indices from the given source using the provided index function.
-
Parameters:
-
source(AC) — the source from which indices are generated -
fromIndex(int) — the starting index from which to generate indices -
increment(int) — the increment value for generating indices (can be positive or negative but not zero) -
indexFunc(ObjIntFunction<? super AC, Integer>) — the function to generate indices from the source
-
- Returns: an IntStream of indices
iterate(...) -> IntStream
-
Signature:
public static IntStream iterate(final BooleanSupplier hasNext, final IntSupplier next) throws IllegalArgumentException - Summary: Creates a stream that iterates using the given <i> hasNext </i> and <i> next </i> suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(IntSupplier) — a IntSupplier that provides the next int in the iteration
-
- Returns: an IntStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> next </i> is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static IntStream iterate(final int init, final BooleanSupplier hasNext, final IntUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(int) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(IntUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an IntStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, BooleanSupplier, java.util.function.UnaryOperator)
-
Signature:
public static IntStream iterate(final int init, final IntPredicate hasNext, final IntUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Parameters:
-
init(int) — the initial value -
hasNext(IntPredicate) — a predicate that determines if the returned stream has next by testing hasNext.test(init) for first time and hasNext.test(f.apply(previous)) for remaining elements -
f(IntUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an IntStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> hasNext </i> or <i> f </i> is null
-
- See also: Stream#iterate(Object, java.util.function.Predicate, java.util.function.UnaryOperator)
-
Signature:
public static IntStream iterate(final int init, final IntUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values.
-
Parameters:
-
init(int) — the initial value -
f(IntUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an IntStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if <i> f </i> is null
-
- See also: Stream#iterate(Object, java.util.function.UnaryOperator)
generate(...) -> IntStream
-
Signature:
public static IntStream generate(final IntSupplier s) throws IllegalArgumentException - Summary: Generates an IntStream using the provided IntSupplier.
-
Parameters:
-
s(IntSupplier) — the IntSupplier that provides the elements of the stream
-
- Returns: an IntStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> IntStream
-
Signature:
public static IntStream concat(final int[]... a) - Summary: Concatenates multiple arrays of ints into a single IntStream.
-
Parameters:
-
a(int[][]) — the arrays of ints to concatenate
-
- Returns: an IntStream containing all the ints from the input arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static IntStream concat(final IntIterator... a) - Summary: Concatenates multiple IntIterators into a single IntStream.
-
Parameters:
-
a(IntIterator[]) — the arrays of IntIterator to concatenate
-
- Returns: an IntStream containing all the ints from the input IntIterators
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static IntStream concat(final IntStream... a) - Summary: Concatenates multiple IntStreams into a single IntStream.
-
Parameters:
-
a(IntStream[]) — the arrays of IntStream to concatenate
-
- Returns: an IntStream containing all the ints from the input IntStreams
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static IntStream concat(final List<int[]> c) - Summary: Concatenates a list of int arrays into a single IntStream.
-
Parameters:
-
c(List<int[]>) — the list of int arrays to concatenate
-
- Returns: an IntStream containing all the ints from the input list of int arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static IntStream concat(final Collection<? extends IntStream> streams) - Summary: Concatenates a collection of IntStreams into a single IntStream.
-
Parameters:
-
streams(Collection<? extends IntStream>) — the collection of IntStreams to concatenate
-
- Returns: an IntStream containing all the ints from the input collection of IntStreams
- See also: Stream#concat(Collection)
concatIterators(...) -> IntStream
-
Signature:
@Beta public static IntStream concatIterators(final Collection<? extends IntIterator> intIterators) - Summary: Concatenates a collection of IntIterators into a single IntStream.
-
Parameters:
-
intIterators(Collection<? extends IntIterator>) — the collection of IntIterators to concatenate
-
- Returns: an IntStream containing all the ints from the input collection of IntIterators
- See also: Stream#concatIterators(Collection)
zip(...) -> IntStream
-
Signature:
public static IntStream zip(final int[] a, final int[] b, final IntBinaryOperator zipFunction) - Summary: Zips two int arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either array runs out of values.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(int\[\], int\[\], int, int, IntBinaryOperator)
-
Signature:
public static IntStream zip(final int[] a, final int[] b, final int[] c, final IntTernaryOperator zipFunction) - Summary: Zips three int arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any array runs out of values.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
c(int[]) — the third int array -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(int\[\], int\[\], int\[\], int, int, int, IntTernaryOperator)
-
Signature:
public static IntStream zip(final IntIterator a, final IntIterator b, final IntBinaryOperator zipFunction) - Summary: Zips two int iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either iterator runs out of values.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty) -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty) -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntIterator, IntIterator, int, int, IntBinaryOperator)
-
Signature:
public static IntStream zip(final IntIterator a, final IntIterator b, final IntIterator c, final IntTernaryOperator zipFunction) - Summary: Zips three int iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any iterator runs out of values.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty) -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty) -
c(IntIterator) — the third int iterator. Can be {@code null} (treated as empty) -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntIterator, IntIterator, IntIterator, int, int, int, IntTernaryOperator)
-
Signature:
public static IntStream zip(final IntStream a, final IntStream b, final IntBinaryOperator zipFunction) - Summary: Zips two int streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either stream runs out of values.
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first IntStream -
b(IntStream) — the second IntStream -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntStream, IntStream, int, int, IntBinaryOperator)
-
Signature:
public static IntStream zip(final IntStream a, final IntStream b, final IntStream c, final IntTernaryOperator zipFunction) - Summary: Zips three int streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first IntStream -
b(IntStream) — the second IntStream -
c(IntStream) — the third IntStream -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntStream, IntStream, IntStream, int, int, int, IntTernaryOperator)
-
Signature:
public static IntStream zip(final Collection<? extends IntStream> streams, final IntNFunction<Integer> zipFunction) - Summary: Zips multiple int streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends IntStream>) — the collection of int streams to zip -
zipFunction(IntNFunction<Integer>) — the function to combine arrays of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values. Empty if the collection is empty
- See also: #zip(Collection, int\[\], IntNFunction)
-
Signature:
public static IntStream zip(final int[] a, final int[] b, final int valueForNoneA, final int valueForNoneB, final IntBinaryOperator zipFunction) - Summary: Zips two int arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that array.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
valueForNoneA(int) — the default value to use when the first array runs out of values -
valueForNoneB(int) — the default value to use when the second array runs out of values -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(int\[\], int\[\], IntBinaryOperator)
-
Signature:
public static IntStream zip(final int[] a, final int[] b, final int[] c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTernaryOperator zipFunction) - Summary: Zips three int arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that array.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
c(int[]) — the third int array -
valueForNoneA(int) — the default value to use when the first array runs out of values -
valueForNoneB(int) — the default value to use when the second array runs out of values -
valueForNoneC(int) — the default value to use when the third array runs out of values -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(int\[\], int\[\], int\[\], IntTernaryOperator)
-
Signature:
public static IntStream zip(final IntIterator a, final IntIterator b, final int valueForNoneA, final int valueForNoneB, final IntBinaryOperator zipFunction) - Summary: Zips two int iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that iterator.
-
Parameters:
-
a(IntIterator) — the first int iterator, may be {@code null} (treated as empty) -
b(IntIterator) — the second int iterator, may be {@code null} (treated as empty) -
valueForNoneA(int) — the default value to use when the first iterator runs out of values -
valueForNoneB(int) — the default value to use when the second iterator runs out of values -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntIterator, IntIterator, IntBinaryOperator)
-
Signature:
public static IntStream zip(final IntIterator a, final IntIterator b, final IntIterator c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTernaryOperator zipFunction) - Summary: Zips three int iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that iterator.
-
Parameters:
-
a(IntIterator) — the first int iterator, may be {@code null} (treated as empty) -
b(IntIterator) — the second int iterator, may be {@code null} (treated as empty) -
c(IntIterator) — the third int iterator, may be {@code null} (treated as empty) -
valueForNoneA(int) — the default value to use when the first iterator runs out of values -
valueForNoneB(int) — the default value to use when the second iterator runs out of values -
valueForNoneC(int) — the default value to use when the third iterator runs out of values -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
- See also: #zip(IntIterator, IntIterator, IntIterator, IntTernaryOperator)
-
Signature:
public static IntStream zip(final IntStream a, final IntStream b, final int valueForNoneA, final int valueForNoneB, final IntBinaryOperator zipFunction) - Summary: Zips two int streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream -
b(IntStream) — the second int stream -
valueForNoneA(int) — the default value to use when the first stream runs out of values -
valueForNoneB(int) — the default value to use when the second stream runs out of values -
zipFunction(IntBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close the input streams when closed
- See also: #zip(IntStream, IntStream, IntBinaryOperator)
-
Signature:
public static IntStream zip(final IntStream a, final IntStream b, final IntStream c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTernaryOperator zipFunction) - Summary: Zips three int streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream -
b(IntStream) — the second int stream -
c(IntStream) — the third int stream -
valueForNoneA(int) — the default value to use when the first stream runs out of values -
valueForNoneB(int) — the default value to use when the second stream runs out of values -
valueForNoneC(int) — the default value to use when the third stream runs out of values -
zipFunction(IntTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close the input streams when closed
- See also: #zip(IntStream, IntStream, IntStream, IntTernaryOperator)
-
Signature:
public static IntStream zip(final Collection<? extends IntStream> streams, final int[] valuesForNone, final IntNFunction<Integer> zipFunction) - Summary: Zips multiple int streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the corresponding default value from valuesForNone is used for that stream.
- The returned stream will handle closing of all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends IntStream>) — the collection of int streams to zip -
valuesForNone(int[]) — array of default values, must have same size as streams collection -
zipFunction(IntNFunction<Integer>) — the function to combine arrays of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close all input streams when closed
- See also: #zip(Collection, IntNFunction)
merge(...) -> IntStream
-
Signature:
public static IntStream merge(final int[] a, final int[] b, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges two int arrays into a single IntStream by selecting elements based on the provided selector function.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next. It receives the next elements from both arrays and returns {@link MergeResult#TAKE_FIRST} to select from the first array or {@link MergeResult#TAKE_SECOND} to select from the second array
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(int\[\], int\[\], int\[\], IntBiFunction), Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static IntStream merge(final int[] a, final int[] b, final int[] c, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges three int arrays into a single IntStream by selecting elements based on the provided selector function.
-
Parameters:
-
a(int[]) — the first int array -
b(int[]) — the second int array -
c(int[]) — the third int array -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next from pairs of elements
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(int\[\], int\[\], IntBiFunction), Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static IntStream merge(final IntIterator a, final IntIterator b, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges two IntIterators into a single IntStream by selecting elements based on the provided selector function.
-
Parameters:
-
a(IntIterator) — the first IntIterator (null is treated as an empty iterator) -
b(IntIterator) — the second IntIterator (null is treated as an empty iterator) -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next. It receives the next elements from both iterators and returns {@link MergeResult#TAKE_FIRST} to select from the first iterator or {@link MergeResult#TAKE_SECOND} to select from the second iterator
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(IntIterator, IntIterator, IntIterator, IntBiFunction), Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static IntStream merge(final IntIterator a, final IntIterator b, final IntIterator c, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges three IntIterators into a single IntStream by selecting elements based on the provided selector function.
-
Parameters:
-
a(IntIterator) — the first IntIterator (null is treated as an empty iterator) -
b(IntIterator) — the second IntIterator (null is treated as an empty iterator) -
c(IntIterator) — the third IntIterator (null is treated as an empty iterator) -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next from pairs of elements
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(IntIterator, IntIterator, IntBiFunction), Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static IntStream merge(final IntStream a, final IntStream b, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges two IntStreams into a single IntStream by selecting elements based on the provided selector function.
-
Contract:
- <p> Both input streams will be automatically closed when the returned stream is closed.
- This ensures proper resource management when working with streams that hold resources.
-
Parameters:
-
a(IntStream) — the first IntStream -
b(IntStream) — the second IntStream -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next. It receives the next elements from both streams and returns {@link MergeResult#TAKE_FIRST} to select from the first stream or {@link MergeResult#TAKE_SECOND} to select from the second stream
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(IntStream, IntStream, IntStream, IntBiFunction), Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static IntStream merge(final IntStream a, final IntStream b, final IntStream c, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges three IntStreams into a single IntStream by selecting elements based on the provided selector function.
-
Contract:
- <p> All input streams will be automatically closed when the returned stream is closed.
- This ensures proper resource management when working with streams that hold resources.
-
Parameters:
-
a(IntStream) — the first IntStream -
b(IntStream) — the second IntStream -
c(IntStream) — the third IntStream -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next from pairs of elements
-
- Returns: a new IntStream containing the merged elements
- See also: #merge(IntStream, IntStream, IntBiFunction), Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static IntStream merge(final Collection<? extends IntStream> streams, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges multiple IntStreams into a single IntStream by selecting elements based on the provided selector function.
-
Contract:
- <p> All input streams will be automatically closed when the returned stream is closed.
- This ensures proper resource management when working with streams that hold resources.
-
Parameters:
-
streams(Collection<? extends IntStream>) — the collection of IntStreams to merge -
nextSelector(IntBiFunction<MergeResult>) — a function that determines which element to select next from pairs of elements
-
- Returns: a new IntStream containing the merged elements, or an empty stream if the collection is empty
- See also: #merge(IntStream, IntStream, IntBiFunction), Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract IntStream filter(final IntPredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(IntPredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract IntStream takeWhile(final IntPredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(IntPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract IntStream dropWhile(final IntPredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(IntPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream map(IntUnaryOperator mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntUnaryOperator) — a non-interfering, stateless function that transforms each element from int to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element
- See also: Stream#map(Function)
mapToChar(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream mapToChar(IntToCharFunction mapper) - Summary: Returns a CharStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToCharFunction) — a non-interfering, stateless function that transforms each element from int to char
-
- Returns: a new CharStream consisting of the results of applying the mapper function to each element
- See also: #map(IntUnaryOperator), #mapToObj(IntFunction)
mapToByte(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream mapToByte(IntToByteFunction mapper) - Summary: Returns a ByteStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToByteFunction) — a non-interfering, stateless function that transforms each element from int to byte
-
- Returns: a new ByteStream consisting of the results of applying the mapper function to each element
- See also: #map(IntUnaryOperator), #mapToObj(IntFunction)
mapToShort(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream mapToShort(IntToShortFunction mapper) - Summary: Returns a ShortStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToShortFunction) — a non-interfering, stateless function that transforms each element from int to short
-
- Returns: a new ShortStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(IntUnaryOperator), #mapToObj(IntFunction)
mapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream mapToLong(IntToLongFunction mapper) - Summary: Returns a LongStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToLongFunction) — a non-interfering, stateless function that transforms each element from int to long
-
- Returns: a new LongStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(IntUnaryOperator), #mapToObj(IntFunction)
mapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(IntToFloatFunction mapper) - Summary: Returns a FloatStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToFloatFunction) — a non-interfering, stateless function that transforms each element from int to float
-
- Returns: a new FloatStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(IntUnaryOperator), #mapToDouble(IntToDoubleFunction)
mapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(IntToDoubleFunction mapper) - Summary: Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntToDoubleFunction) — a non-interfering, stateless function that transforms each element from int to double
-
- Returns: a new DoubleStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(IntUnaryOperator), #mapToFloat(IntToFloatFunction), java.util.stream.IntStream#mapToDouble(IntToDoubleFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(IntFunction<? extends T> mapper) - Summary: Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntFunction<? extends T>) — a non-interfering, stateless function that transforms each element from int to T
-
- Returns: a new Stream of objects resulting from applying the mapper function to each element of this stream
- See also: #map(IntUnaryOperator), java.util.stream.IntStream#mapToObj(IntFunction)
flatMap(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMap(IntFunction<? extends IntStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each number to a range IntStream.of(1, 2, 3) .flatMap(n -> IntStream.range(0, n)) .toIntList(); // Returns \[0, 0, 1, 0, 1, 2\] // Duplicate each element IntStream.of(1, 2, 3) .flatMap(n -> IntStream.of(n, n)) .toIntList(); // Returns \[1, 1, 2, 2, 3, 3\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(IntFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element from int to IntStream
-
- Returns: the new stream
- See also: Stream#flatMap(Function)
flatmap(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatmap(IntFunction<int[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntFunction<int[]>) — a non-interfering, stateless function that transforms each element from int to int\[\]
-
- Returns: the new stream
- See also: #flatMap(IntFunction), #flatMapToLong(IntFunction), #flatMapToObj(IntFunction)
flattMap(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream flattMap(IntFunction<? extends java.util.stream.IntStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends java.util.stream.IntStream>) — a non-interfering, stateless function that transforms each element to a JDK IntStream
-
- Returns: the new stream
flatMapToChar(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream flatMapToChar(IntFunction<? extends CharStream> mapper) - Summary: Returns a CharStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends CharStream>) — a non-interfering, stateless function that transforms each element to a CharStream
-
- Returns: the new stream
flatMapToByte(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream flatMapToByte(IntFunction<? extends ByteStream> mapper) - Summary: Returns a ByteStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends ByteStream>) — a non-interfering, stateless function that transforms each element to a ByteStream
-
- Returns: the new stream
flatMapToShort(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream flatMapToShort(IntFunction<? extends ShortStream> mapper) - Summary: Returns a ShortStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends ShortStream>) — a non-interfering, stateless function that transforms each element to a ShortStream
-
- Returns: the new stream
flatMapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(IntFunction<? extends LongStream> mapper) - Summary: Returns a LongStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends LongStream>) — a non-interfering, stateless function that transforms each element to a LongStream
-
- Returns: the new stream
flatMapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(IntFunction<? extends FloatStream> mapper) - Summary: Returns a FloatStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends FloatStream>) — a non-interfering, stateless function that transforms each element to a FloatStream
-
- Returns: the new stream
flatMapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(IntFunction<? extends DoubleStream> mapper) - Summary: Returns a DoubleStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(IntFunction<? extends DoubleStream>) — a non-interfering, stateless function that transforms each element to a DoubleStream
-
- Returns: the new stream
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(IntFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element to a Stream
-
- Returns: the new stream
- See also: #flatMap(IntFunction), #flatmapToObj(IntFunction)
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(IntFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a collection produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element to a Collection
-
- Returns: the new stream
- See also: #flatMapToObj(IntFunction), #flattmapToObj(IntFunction)
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(IntFunction<T[]> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of an array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(IntFunction<T[]>) — a non-interfering, stateless function that transforms each element to an array
-
- Returns: the new stream
- See also: #flatMapToObj(IntFunction), #flatmapToObj(IntFunction)
mapMulti(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapMulti(IntMapMultiConsumer mapper) - Summary: Returns a stream consisting of the results of applying the given multi-mapping function to each element.
-
Parameters:
-
mapper(IntMapMultiConsumer) — a non-interfering, stateless function that generates zero or more output values for each input value
-
- Returns: the new stream
mapPartial(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartial(IntFunction<OptionalInt> mapper) - Summary: Returns a stream consisting of the elements that have a non-empty result when the given mapping function is applied to them.
-
Contract:
- Returns a stream consisting of the elements that have a non-empty result when the given mapping function is applied to them.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Map only when condition is met IntStream.of(1, 2, 3, 4, 5) .mapPartial(value -> value % 2 == 0 ?
-
Parameters:
-
mapper(IntFunction<OptionalInt>) — a non-interfering, stateless function that transforms each element to an OptionalInt
-
- Returns: the new stream containing only elements with non-empty mapping results
mapPartialJdk(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartialJdk(IntFunction<java.util.OptionalInt> mapper) - Summary: Returns a stream consisting of the elements that have a non-empty result when the given mapping function is applied to them.
-
Contract:
- Returns a stream consisting of the elements that have a non-empty result when the given mapping function is applied to them.
-
Parameters:
-
mapper(IntFunction<java.util.OptionalInt>) — a non-interfering, stateless function that transforms each element to a JDK OptionalInt
-
- Returns: the new stream containing only elements with non-empty mapping results
rangeMap(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream rangeMap(final IntBiPredicate sameRange, final IntBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Group consecutive numbers and sum each range IntStream.of(1, 2, 3, 10, 11, 20, 21) .rangeMap((first, next) -> next - first <= 1, (first, last) -> first + last) .toIntList(); // Returns \[3, 6, 21, 41\] (1+2, 3+3, 10+11, 20+21) } </pre> <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(IntBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(IntBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final IntBiPredicate sameRange, final IntBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Map ranges to string representations IntStream.of(1, 2, 3, 10, 11, 20, 21) .rangeMapToObj((first, next) -> next - first <= 1, (first, last) -> first + "-" + last) .toList(); // Returns \["1-2", "3-3", "10-11", "20-21"\] } </pre> <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(IntBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(IntBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<IntList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<IntList> collapse(final IntBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Collapse consecutive elements IntStream.of(1, 1, 2, 2, 2, 3) .collapse((a, b) -> a == b) .map(IntList::toString) .toList(); // Returns \["\[1, 1\]", "\[2, 2, 2\]", "\[3\]"\] } </pre> <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(IntBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream collapse(final IntBiPredicate collapsible, final IntBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(IntBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(IntBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream collapse(final IntTriPredicate collapsible, final IntBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(IntTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(IntBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream scan(final IntBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(IntBinaryOperator) — a {@code IntBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code IntStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream scan(final int init, final IntBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(int) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(IntBinaryOperator) — a {@code IntBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code IntStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream scan(final int init, final boolean initIncluded, final IntBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(int) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(IntBinaryOperator) — a {@code IntBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code IntStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream prepend(final int... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(int[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream append(final int... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(int[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream appendIfEmpty(final int... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Append only if stream is empty IntStream.empty() .appendIfEmpty(42, 43) .toIntList(); // Returns \[42, 43\] IntStream.of(1, 2) .appendIfEmpty(42, 43) .toIntList(); // Returns \[1, 2\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
a(int[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
top(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to return
-
- Returns: the new stream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream top(final int n, Comparator<? super Integer> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to return -
comparator(Comparator<? super Integer>) — a non-interfering, stateless Comparator to be used to compare stream elements
-
- Returns: the new stream
toIntList(...) -> IntList
-
Signature:
@SequentialOnly @TerminalOp public abstract IntList toIntList() - Summary: Returns an IntList containing all the elements of this stream.
-
Parameters:
- (none)
- Returns: an IntList containing all stream elements
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.IntFunction<? extends K, E> keyMapper, Throwables.IntFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Contract:
- If the mapped keys contain duplicates, an IllegalStateException is thrown.
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to produce keys -
valueMapper(Throwables.IntFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to produce values
-
- Returns: a Map whose keys and values are the result of applying the mapper functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.IntFunction<? extends K, E> keyMapper, Throwables.IntFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to produce keys -
valueMapper(Throwables.IntFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to produce values -
mapFactory(Supplier<? extends M>) — a supplier which returns a new, empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying the mapper functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.IntFunction<? extends K, E> keyMapper, Throwables.IntFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Contract:
- If the mapped keys contain duplicates, the values are merged using the provided merging function.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Handle duplicate keys by summing values Map<String, Integer> map = IntStream.of(1, 2, 3, 2, 1) .toMap(i -> "key" + (i % 2), i -> i, (v1, v2) -> v1 + v2); // Returns {"key1"=5, "key0"=4} // Keep the first value when keys collide Map<String, Integer> firstWins = IntStream.of(10, 20, 30, 40) .toMap(i -> i % 2 == 0 ?
- "even" : "odd", i -> i, (v1, v2) -> v1); // Returns {"even"=10} // Keep the maximum value when keys collide Map<String, Integer> maxValues = IntStream.of(5, 3, 8, 2) .toMap(i -> i % 2 == 0 ?
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to produce keys -
valueMapper(Throwables.IntFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a Map whose keys and values are the result of applying the mapper functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.IntFunction<? extends K, E> keyMapper, Throwables.IntFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a Map containing the results of applying the given functions to the elements of this stream.
-
Contract:
- If the mapped keys contain duplicates, the values are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to produce keys -
valueMapper(Throwables.IntFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier which returns a new, empty Map into which the results will be inserted
-
- Returns: a Map whose keys and values are the result of applying the mapper functions to the input elements
-
Throws:
-
E— if the key mapper throws an exception -
E2— if the value mapper throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.IntFunction<? extends K, E> keyMapper, final Collector<? super Integer, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function and performs a reduction on the values associated with each key using the specified downstream Collector.
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Integer, ?, D>) — a Collector implementing the downstream reduction
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classifier throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.IntFunction<? extends K, E> keyMapper, final Collector<? super Integer, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function and performs a reduction on the values associated with each key using the specified downstream Collector.
-
Parameters:
-
keyMapper(Throwables.IntFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Integer, ?, D>) — a Collector implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier which returns a new, empty Map into which the results will be inserted
-
- Returns: a Map containing the results of the group-by operation
-
Throws:
-
E— if the classifier throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> int
-
Signature:
@ParallelSupported @TerminalOp public abstract int reduce(int identity, IntBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value.
-
Parameters:
-
identity(int) — the identity value for the accumulating function -
accumulator(IntBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalInt reduce(IntBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalInt describing the reduced value, if any.
-
Contract:
- Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalInt describing the reduced value, if any.
-
Parameters:
-
accumulator(IntBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: an OptionalInt describing the result of the reduction, or an empty OptionalInt if the stream is empty
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjIntConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjIntConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjIntConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <p> Only call this method when the returned type {@code R} is one of these types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjIntConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjIntConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
foreach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public void foreach(final IntConsumer action) - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(IntConsumer) — a non-interfering action to perform on the elements
-
- See also: #forEach(Throwables.IntConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.IntConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.IntConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntIntConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, providing the element index to the action.
-
Parameters:
-
action(Throwables.IntIntConsumer<E>) — a non-interfering action to perform on the elements. The first parameter is the element index and the second parameter is the element value.
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code false} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any element is greater than 10 boolean hasLarge = IntStream.of(5, 8, 12, 3) .anyMatch(x -> x > 10); // Returns true // Check if any element is negative boolean hasNegative = IntStream.of(1, 2, 3, 4) .anyMatch(x -> x < 0); // Returns false // Empty stream always returns false boolean result = IntStream.empty() .anyMatch(x -> x > 0); // Returns false } </pre>
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all elements are positive boolean allPositive = IntStream.of(1, 2, 3, 4) .allMatch(x -> x > 0); // Returns true // Check if all elements are even boolean allEven = IntStream.of(2, 4, 6, 7) .allMatch(x -> x % 2 == 0); // Returns false // Empty stream always returns true boolean result = IntStream.empty() .allMatch(x -> x < 0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no elements are negative boolean noNegatives = IntStream.of(1, 2, 3, 4) .noneMatch(x -> x < 0); // Returns true // Check if no elements are even boolean noEvens = IntStream.of(1, 3, 5, 6) .noneMatch(x -> x % 2 == 0); // Returns false // Empty stream always returns true boolean result = IntStream.empty() .noneMatch(x -> x > 0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalInt
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalInt findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty OptionalInt.
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty OptionalInt.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the first element of the stream, or an empty OptionalInt if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.IntPredicate), #findAny(Throwables.IntPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalInt findFirst(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns an OptionalInt describing the first element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
-
Contract:
- Returns an OptionalInt describing the first element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code OptionalInt} describing the first element that matches the predicate, or an empty {@code OptionalInt} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalInt
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalInt findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty OptionalInt.
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty OptionalInt.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an OptionalInt containing some element of the stream, or an empty OptionalInt if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.IntPredicate), #findAny(Throwables.IntPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalInt findAny(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns an OptionalInt describing some element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
-
Contract:
- Returns an OptionalInt describing some element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code OptionalInt} describing any element that matches the predicate, or an empty {@code OptionalInt} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalInt
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalInt findLast(final Throwables.IntPredicate<E> predicate) throws E - Summary: Returns an OptionalInt describing the last element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
-
Contract:
- Returns an OptionalInt describing the last element of this stream that matches the given predicate, or an empty OptionalInt if no such element exists.
- <p> Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.IntPredicate<E>) — a non-interfering, stateless predicate to apply to elements of this stream
-
- Returns: an {@code OptionalInt} describing the last element that matches the predicate, or an empty {@code OptionalInt} if no such element exists
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalInt
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalInt min() - Summary: Returns an OptionalInt describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalInt describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the minimum element of this stream, or an empty OptionalInt if the stream is empty
max(...) -> OptionalInt
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalInt max() - Summary: Returns an OptionalInt describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalInt describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalInt containing the maximum element of this stream, or an empty OptionalInt if the stream is empty
kthLargest(...) -> OptionalInt
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalInt kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty OptionalInt is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element IntStream.of(10, 30, 20, 50, 40).kthLargest(2); // Returns OptionalInt\[40\] // Find the largest element (same as max) IntStream.of(5, 2, 8, 1).kthLargest(1); // Returns OptionalInt\[8\] // When k exceeds stream size IntStream.of(1, 2, 3).kthLargest(5); // Returns OptionalInt.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an OptionalInt containing the k-th largest element, or an empty OptionalInt if the stream is empty or the count of elements is less than k
sum(...) -> int
-
Signature:
@SequentialOnly @TerminalOp public abstract int sum() - Summary: Returns the sum of elements in this stream.
-
Contract:
- <p> <b> Note on overflow: </b> The sum may overflow if the result exceeds {@code Integer.MAX_VALUE} or is less than {@code Integer.MIN_VALUE} .
- For large datasets or when overflow is a concern, consider using {@link #mapToLong(IntToLongFunction)} followed by {@link LongStream#sum()} .
-
Parameters:
- (none)
- Returns: the sum of elements in this stream. Returns 0 if the stream is empty.
- See also: #average(), #reduce(int, IntBinaryOperator)
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> IntSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract IntSummaryStatistics summaryStatistics() - Summary: Returns an IntSummaryStatistics describing various summary data about the elements of this stream.
-
Parameters:
- (none)
- Returns: an IntSummaryStatistics describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<IntSummaryStatistics, Optional<Map<Percentage, Integer>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<IntSummaryStatistics, Optional<Map<Percentage, Integer>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of IntSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of IntSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: a Pair where the first element is IntSummaryStatistics and the second element is an Optional containing a map with default percentiles (0.25, 0.5, 0.75) and their values, or an empty Optional if the stream is empty
mergeWith(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream mergeWith(final IntStream b, final IntBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream, selecting elements based on the provided selector function.
-
Parameters:
-
b(IntStream) — the stream to merge with this stream -
nextSelector(IntBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: the merged stream
zipWith(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream zipWith(IntStream b, IntBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(IntStream) — the IntStream to be combined with the current IntStream. Must be {@code non-null} . -
zipFunction(IntBinaryOperator) — an IntBinaryOperator that determines the combination of elements in the combined IntStream. Must be {@code non-null} .
-
- Returns: a new IntStream that is the result of combining the current IntStream with the given IntStream
- See also: #zipWith(IntStream, int, int, IntBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream zipWith(IntStream b, IntStream c, IntTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(IntStream) — the second IntStream to be combined with the current IntStream. Will be closed along with this IntStream. -
c(IntStream) — the third IntStream to be combined with the current IntStream. Will be closed along with this IntStream. -
zipFunction(IntTernaryOperator) — an IntTernaryOperator that determines the combination of elements in the combined IntStream. Must be {@code non-null} .
-
- Returns: a new IntStream that is the result of combining the current IntStream with the given IntStreams
- See also: #zipWith(IntStream, IntStream, int, int, int, IntTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream zipWith(IntStream b, int valueForNoneA, int valueForNoneB, IntBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(IntStream) — the IntStream to be combined with the current IntStream. Will be closed along with this IntStream. -
valueForNoneA(int) — the default value to use for the current IntStream when it runs out of elements -
valueForNoneB(int) — the default value to use for the given IntStream when it runs out of elements -
zipFunction(IntBinaryOperator) — an IntBinaryOperator that determines the combination of elements in the combined IntStream. Must be {@code non-null} .
-
- Returns: a new IntStream that is the result of combining the current IntStream with the given IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream zipWith(IntStream b, IntStream c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(IntStream) — the second IntStream to be combined with the current IntStream. Will be closed along with this IntStream. -
c(IntStream) — the third IntStream to be combined with the current IntStream. Will be closed along with this IntStream. -
valueForNoneA(int) — the default value to use for the current IntStream when it runs out of elements -
valueForNoneB(int) — the default value to use for the second IntStream when it runs out of elements -
valueForNoneC(int) — the default value to use for the third IntStream when it runs out of elements -
zipFunction(IntTernaryOperator) — an IntTernaryOperator that determines the combination of elements in the combined IntStream. Must be {@code non-null} .
-
- Returns: a new IntStream that is the result of combining the current IntStream with the given IntStreams
asLongStream(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream asLongStream() - Summary: Converts this IntStream to a LongStream by widening each int element to a long element.
-
Contract:
- This is useful when you need to perform operations that require long precision or when combining with other long streams.
-
Parameters:
- (none)
- Returns: a LongStream containing the elements of this stream widened to long
- See also: #asFloatStream(), #asDoubleStream(), #mapToLong(IntToLongFunction)
asFloatStream(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract FloatStream asFloatStream() - Summary: Converts this IntStream to a FloatStream by converting each int element to a float element.
-
Parameters:
- (none)
- Returns: a FloatStream containing the elements of this stream converted to float
- See also: #asLongStream(), #asDoubleStream(), #mapToFloat(IntToFloatFunction)
asDoubleStream(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream asDoubleStream() - Summary: Converts this IntStream to a DoubleStream by converting each int element to a double element.
-
Parameters:
- (none)
- Returns: a DoubleStream containing the elements of this stream converted to double
- See also: #asLongStream(), #asFloatStream(), #mapToDouble(IntToDoubleFunction)
boxed(...) -> Stream<Integer>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Integer> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to an Integer.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to an Integer
toJdkStream(...) -> java.util.stream.IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract java.util.stream.IntStream toJdkStream() - Summary: Converts this IntStream to a java.util.stream.IntStream.
-
Parameters:
- (none)
- Returns: a java.util.stream.IntStream containing the elements of this stream
transformB(...) -> IntStream
-
Signature:
@Beta @SequentialOnly @IntermediateOp public IntStream transformB(final Function<? super java.util.stream.IntStream, ? extends java.util.stream.IntStream> transfer) - Summary: Transforms this IntStream using the provided function that operates on java.util.stream.IntStream.
-
Parameters:
-
transfer(Function<? super java.util.stream.IntStream, ? extends java.util.stream.IntStream>) — the function to transform the java.util.stream.IntStream
-
- Returns: a new IntStream resulting from the transformation
-
Signature:
@Beta @SequentialOnly @IntermediateOp public IntStream transformB(final Function<? super java.util.stream.IntStream, ? extends java.util.stream.IntStream> transfer, final boolean deferred) throws IllegalArgumentException - Summary: Transforms this IntStream using the provided function that operates on java.util.stream.IntStream.
-
Parameters:
-
transfer(Function<? super java.util.stream.IntStream, ? extends java.util.stream.IntStream>) — the function to transform the java.util.stream.IntStream -
deferred(boolean) — if {@code true} , the transformation is deferred until the stream is consumed; if {@code false} , the transformation is applied immediately
-
- Returns: a new IntStream resulting from the transformation
-
Throws:
-
java.lang.IllegalArgumentException— if transfer is null
-
Class IntStreamEx (com.landawn.abacus.util.stream.IntStream.IntStreamEx)
Abstract extension of IntStream that provides additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface IteratorEx (com.landawn.abacus.util.stream.IteratorEx)
An extended iterator interface that provides additional utility methods beyond the standard Iterator interface.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
advance(...) -> void
-
Signature:
default void advance(long n) - Summary: Advances the iterator by skipping the specified number of elements without returning them.
-
Contract:
- If the iterator has fewer elements than the specified number, all remaining elements will be skipped.
- If n is 0 or negative, no action is performed.
-
Parameters:
-
n(long) — the number of elements to skip (negative or zero values are ignored)
-
- See also: #count()
count(...) -> long
-
Signature:
default long count() - Summary: Counts the remaining elements in this iterator by consuming all of them.
-
Parameters:
- (none)
- Returns: the number of elements remaining in the iterator
- See also: #advance(long)
close(...) -> void
-
Signature:
@Override default void close() - Summary: Closes this iterator and releases any resources associated with it.
-
Contract:
- Subclasses should override this method if they hold resources that need to be released (e.g., file handles, database connections, or network streams).
-
Parameters:
- (none)
Class LongIteratorEx (com.landawn.abacus.util.stream.LongIteratorEx)
An extended iterator over primitive long values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> LongIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static LongIteratorEx empty() - Summary: Returns an empty LongIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty LongIteratorEx instance
of(...) -> LongIteratorEx
-
Signature:
public static LongIteratorEx of(final long... a) - Summary: Creates a LongIteratorEx from the given long array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(long[]) — the long array to iterate over (can be {@code null} or empty)
-
- Returns: a LongIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static LongIteratorEx of(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a LongIteratorEx from a portion of the given long array.
-
Parameters:
-
a(long[]) — the long array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a LongIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static LongIteratorEx of(final LongIterator iter) - Summary: Wraps a LongIterator as a LongIteratorEx.
-
Contract:
- If the iterator is already a LongIteratorEx, it is returned as-is.
-
Parameters:
-
iter(LongIterator) — the LongIterator to wrap (can be null)
-
- Returns: a LongIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> LongIteratorEx
-
Signature:
public static LongIteratorEx from(final Iterator<Long> iter) - Summary: Creates a LongIteratorEx from an Iterator of Long objects.
-
Parameters:
-
iter(Iterator<Long>) — the Iterator of Long objects (can be null)
-
- Returns: a LongIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class LongStream (com.landawn.abacus.util.stream.LongStream)
A specialized stream implementation for processing sequences of long values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> LongStream
-
Signature:
public static LongStream empty() - Summary: Returns an empty LongStream with no elements.
-
Contract:
- <p> An empty stream is useful as a base case in stream operations, conditional stream creation, or when initializing stream variables that may be populated later.
-
Parameters:
- (none)
- Returns: an empty LongStream with no elements
defer(...) -> LongStream
-
Signature:
public static LongStream defer(final Supplier<LongStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
-
Parameters:
-
supplier(Supplier<LongStream>) — the supplier that provides the LongStream
-
- Returns: a new LongStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
from(...) -> LongStream
-
Signature:
public static LongStream from(final java.util.stream.LongStream stream) - Summary: Creates a LongStream from a java.util.stream.LongStream.
-
Parameters:
-
stream(java.util.stream.LongStream) — the java.util.stream.LongStream to convert
-
- Returns: a new LongStream, or an empty stream if the input is null
ofNullable(...) -> LongStream
-
Signature:
public static LongStream ofNullable(final Long e) - Summary: Returns a LongStream containing the specified element if it is non-null, otherwise returns an empty LongStream.
-
Contract:
- Returns a LongStream containing the specified element if it is non-null, otherwise returns an empty LongStream.
- <p> This method is particularly useful when working with nullable Long values (such as from database queries, optional fields, or map lookups) and you want to seamlessly integrate them into stream pipelines without explicit null checks.
- <p> <b> Behavior: </b> <ul> <li> If {@code e} is {@code null} : returns an empty LongStream (equivalent to {@link #empty()} ) </li> <li> If {@code e} is non-null: returns a LongStream containing the single unboxed long value </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Basic usage with non-null value LongStream.ofNullable(42L) .toArray(); // Returns \[42L\] // Null value produces empty stream LongStream.ofNullable(null) .count(); // Returns 0 // Null-safe database value processing Long dbValue = resultSet.getLong("count"); // May be null long result = LongStream.ofNullable(dbValue) .findFirst() .orElse(0L); // Combining multiple nullable values Long val1 = map.get("key1"); // May be null Long val2 = map.get("key2"); // May be null Long val3 = map.get("key3"); // May be null long sum = LongStream.concat( LongStream.ofNullable(val1), LongStream.ofNullable(val2), LongStream.ofNullable(val3) ).sum(); // Sum of non-null values // Conditional stream operations Long threshold = config.getThreshold(); // May be null LongStream.ofNullable(threshold) .forEach(t -> applyThreshold(t)); // Only executed if threshold is not null // Flat-mapping nullable values List<Long> nullableValues = Arrays.asList(1L, null, 3L, null, 5L); long\[\] nonNullValues = nullableValues.stream() .flatMapToLong(LongStream::ofNullable) .toArray(); // Returns \[1L, 3L, 5L\] } </pre> <p> <b> Comparison with alternatives: </b> <pre> {@code Long value = getValue(); // May be null // Using ofNullable (concise) LongStream stream1 = LongStream.ofNullable(value); // Manual null check (verbose) LongStream stream2 = value != null ?
-
Parameters:
-
e(Long) — the Long element to be wrapped in a LongStream; may be null
-
- Returns: a LongStream containing the single element if non-null, otherwise an empty LongStream
- See also: #of(long...), #empty(), Optional#ofNullable(Object)
of(...) -> LongStream
-
Signature:
public static LongStream of(final long... a) - Summary: Returns a LongStream containing the specified array of long values.
-
Parameters:
-
a(long[]) — the array of long values; may be empty or used as varargs
-
- Returns: a LongStream containing the elements of the array, or an empty stream if the array is null or empty
- See also: #of(long\[\], int, int), #empty()
-
Signature:
public static LongStream of(final long[] a, final int fromIndex, final int toIndex) - Summary: Returns a LongStream containing elements from the specified array between the given indices.
-
Parameters:
-
a(long[]) — the array of long values -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a LongStream containing the specified range of elements
- See also: #of(long...), #of(Long\[\], int, int)
-
Signature:
public static LongStream of(final Long[] a) - Summary: Returns a LongStream containing the unboxed values from the specified Long array.
-
Contract:
- Null elements in the array will cause a NullPointerException when the stream is consumed.
-
Parameters:
-
a(Long[]) — the array of Long values; null elements will cause NullPointerException during stream processing
-
- Returns: a LongStream containing the unboxed elements of the array, or an empty stream if the array is null or empty
- See also: #of(long...), #of(Long\[\], int, int), #of(Collection)
-
Signature:
public static LongStream of(final Long[] a, final int fromIndex, final int toIndex) - Summary: Returns a LongStream containing unboxed values from the specified Long array between the given indices.
-
Parameters:
-
a(Long[]) — the array of Long values; null elements in the range will cause NullPointerException during stream processing -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a LongStream containing the unboxed elements from fromIndex to toIndex
- See also: #of(Long\[\]), #of(long\[\], int, int)
-
Signature:
public static LongStream of(final Collection<Long> c) - Summary: Returns a LongStream containing the unboxed values from the specified Collection of Long values.
-
Contract:
- Null elements in the collection will cause a NullPointerException when the stream is consumed.
-
Parameters:
-
c(Collection<Long>) — the collection of Long values; null elements will cause NullPointerException during stream processing
-
- Returns: a LongStream containing the unboxed elements of the collection, or an empty stream if the collection is null or empty
- See also: #of(Long\[\]), #of(LongIterator), Stream#of(Collection)
-
Signature:
public static LongStream of(final LongIterator iterator) - Summary: Returns a LongStream containing elements from the specified LongIterator.
-
Parameters:
-
iterator(LongIterator) — the LongIterator providing the elements; will be exhausted when the stream is consumed
-
- Returns: a LongStream containing the elements from the iterator, or an empty stream if iterator is null
- See also: #of(long\[\]), #of(Collection), LongIterator
-
Signature:
@Deprecated public static LongStream of(final java.util.stream.LongStream stream) - Summary: Returns a LongStream from the specified java.util.stream.LongStream.
-
Parameters:
-
stream(java.util.stream.LongStream) — the java.util.stream.LongStream to convert
-
- Returns: a LongStream containing the elements from the input stream
-
Signature:
public static LongStream of(final LongBuffer buf) - Summary: Returns a LongStream containing elements from the specified LongBuffer.
-
Parameters:
-
buf(LongBuffer) — the LongBuffer to read from; the buffer's position remains unchanged
-
- Returns: a LongStream containing the elements from the buffer's current position to its limit, or an empty stream if buf is null
- See also: #of(long\[\]), java.nio.LongBuffer
-
Signature:
public static LongStream of(final OptionalLong op) - Summary: Returns a LongStream containing the value from the specified OptionalLong if present.
-
Contract:
- Returns a LongStream containing the value from the specified OptionalLong if present.
- This is a static factory method that creates a stream from an Abacus OptionalLong, producing a single-element stream if the optional contains a value, or an empty stream otherwise.
-
Parameters:
-
op(OptionalLong) — the OptionalLong to convert; may be null or empty
-
- Returns: a LongStream containing the value if present, otherwise an empty stream
- See also: #ofNullable(Long), OptionalLong
-
Signature:
public static LongStream of(final java.util.OptionalLong op) - Summary: Returns a LongStream containing the value from the specified java.util.OptionalLong if present.
-
Contract:
- Returns a LongStream containing the value from the specified java.util.OptionalLong if present.
- This is a static factory method that creates a stream from a JDK OptionalLong, producing a single-element stream if the optional contains a value, or an empty stream otherwise.
-
Parameters:
-
op(java.util.OptionalLong) — the java.util.OptionalLong to convert; may be null or empty
-
- Returns: a LongStream containing the value if present, otherwise an empty stream
- See also: #of(OptionalLong), #ofNullable(Long), java.util.OptionalLong
flatten(...) -> LongStream
-
Signature:
public static LongStream flatten(final long[][] a) - Summary: Flattens a two-dimensional array of longs into a single LongStream.
-
Parameters:
-
a(long[][]) — the two-dimensional array to flatten; may be null, empty, or contain null rows
-
- Returns: a LongStream containing all elements from the two-dimensional array in row-major order, or an empty stream if the array is null or empty
- See also: #flatten(long\[\]\[\], boolean), #flatten(long\[\]\[\]\[\])
-
Signature:
public static LongStream flatten(final long[][] a, final boolean vertically) - Summary: Flattens a two-dimensional array of longs into a single LongStream with control over traversal direction.
-
Contract:
- When {@code vertically} is {@code false} , elements are read in row-major order (horizontally across rows).
- When {@code vertically} is {@code true} , elements are read in column-major order (vertically down columns).
-
Parameters:
-
a(long[][]) — the two-dimensional array to flatten; may be null, empty, or contain null/jagged rows -
vertically(boolean) — if {@code true} , elements are read column by column (column-major order); if {@code false} , row by row (row-major order)
-
- Returns: a LongStream containing all elements from the two-dimensional array in the specified traversal order, or an empty stream if the array is null or empty
- See also: #flatten(long\[\]\[\]), #flatten(long\[\]\[\], long, boolean)
-
Signature:
public static LongStream flatten(final long[][] a, final long valueForAlignment, final boolean vertically) - Summary: Flattens a two-dimensional array of longs into a single LongStream with alignment padding.
-
Contract:
- When processing jagged arrays (arrays with rows of different lengths), shorter rows are padded with the specified {@code valueForAlignment} to match the length of the longest row.
- <p> This method is particularly useful when working with irregular data structures that need to be normalized or when processing matrix-like data where consistent dimensions are required.
- <p> <b> Usage Examples: </b> </p> <pre> {@code long\[\]\[\] jagged = { {1L, 2L, 3L}, {4L, 5L}, // Shorter row {6L, 7L, 8L, 9L} // Longest row }; // Flatten horizontally with alignment (pad with 0) LongStream.flatten(jagged, 0L, false) .toArray(); // Returns \[1L, 2L, 3L, 0L, 4L, 5L, 0L, 0L, 6L, 7L, 8L, 9L\] // Each row padded to length 4 (longest row) // Flatten vertically with alignment (pad with -1) LongStream.flatten(jagged, -1L, true) .toArray(); // Returns \[1L, 4L, 6L, 2L, 5L, 7L, 3L, -1L, 8L, -1L, -1L, 9L\] // Columns aligned with -1 for missing values // Normalize data tables with missing values long\[\]\[\] dataTable = { {100L, 200L, 300L}, {400L}, // Missing values {500L, 600L} // Missing one value }; long\[\] normalized = LongStream.flatten(dataTable, 0L, false) .toArray(); // Returns \[100, 200, 300, 400, 0, 0, 500, 600, 0\] // Sum columns with padding long\[\]\[\] matrix = {{1L, 2L}, {3L, 4L, 5L}, {6L}}; // When flattened vertically with 0 padding, columns can be summed consistently } </pre>
-
Parameters:
-
a(long[][]) — the two-dimensional array to flatten; may be null, empty, or contain rows of different lengths -
valueForAlignment(long) — the value to use for padding shorter rows to match the longest row length -
vertically(boolean) — if {@code true} , elements are read column by column with vertical padding; if {@code false} , row by row with horizontal padding
-
- Returns: a LongStream containing all elements with alignment padding applied to shorter rows, or an empty stream if the array is null or empty
- See also: #flatten(long\[\]\[\], boolean), #flatten(long\[\]\[\])
-
Signature:
public static LongStream flatten(final long[][][] a) - Summary: Flattens a three-dimensional array of longs into a single LongStream.
-
Parameters:
-
a(long[][][]) — the three-dimensional array to flatten; may be null, empty, or contain null elements at any level
-
- Returns: a LongStream containing all elements from the three-dimensional array in depth-first order, or an empty stream if the array is null or empty
- See also: #flatten(long\[\]\[\]), #flatten(long\[\]\[\], boolean)
range(...) -> LongStream
-
Signature:
public static LongStream range(final long startInclusive, final long endExclusive) - Summary: Returns a LongStream of sequential-ordered values from startInclusive (inclusive) to endExclusive (exclusive).
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive)
-
- Returns: a LongStream of sequential values
-
Signature:
public static LongStream range(final long startInclusive, final long endExclusive, final long by) - Summary: Returns a LongStream of values from startInclusive (inclusive) to endExclusive (exclusive) with the specified step.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive) -
by(long) — the step size (must not be zero)
-
- Returns: a LongStream of values with the specified step
rangeClosed(...) -> LongStream
-
Signature:
public static LongStream rangeClosed(final long startInclusive, final long endInclusive) - Summary: Returns a LongStream of sequential-ordered values from startInclusive (inclusive) to endInclusive (inclusive).
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive)
-
- Returns: a LongStream of sequential values
-
Signature:
public static LongStream rangeClosed(final long startInclusive, final long endInclusive, final long by) - Summary: Returns a LongStream of values from startInclusive (inclusive) to endInclusive (inclusive) with the specified step.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive) -
by(long) — the step size (must not be zero)
-
- Returns: a LongStream of values with the specified step
repeat(...) -> LongStream
-
Signature:
public static LongStream repeat(final long element, final long n) throws IllegalArgumentException - Summary: Returns a LongStream consisting of the specified element repeated n times.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Create array of repeated values LongStream.repeat(5L, 3L) .toArray(); // Returns \[5L, 5L, 5L\] // Calculate sum of repeated elements LongStream.repeat(100L, 5L) .sum(); // Returns 500L // Initialize with default value long\[\] defaults = LongStream.repeat(0L, 10L).toArray(); // \[0L, 0L, ..., 0L\] // Combine with other operations LongStream.repeat(2L, 4L) .map(x -> x * x) .toArray(); // Returns \[4L, 4L, 4L, 4L\] // Empty stream when n is 0 LongStream.repeat(99L, 0L).count(); // Returns 0 // Padding data with repeated values LongStream combined = LongStream.concat( LongStream.of(1L, 2L, 3L), LongStream.repeat(0L, 5L) ); // Results in \[1L, 2L, 3L, 0L, 0L, 0L, 0L, 0L\] } </pre>
-
Parameters:
-
element(long) — the element to repeat -
n(long) — the number of times to repeat the element (must be non-negative)
-
- Returns: a LongStream containing n copies of the element, or an empty stream if n is 0
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
- See also: #generate(LongSupplier), #iterate(long, LongUnaryOperator)
random(...) -> LongStream
-
Signature:
public static LongStream random() - Summary: Returns an infinite LongStream of pseudorandom long values generated by a {@link SecureRandom} instance.
-
Parameters:
- (none)
- Returns: an infinite LongStream of pseudorandom long values generated by SecureRandom
- See also: #generate(LongSupplier), SecureRandom, java.util.Random#longs()
interval(...) -> LongStream
-
Signature:
@Beta public static LongStream interval(final long intervalInMillis) - Summary: Generates an infinite LongStream that emits sequential values at fixed intervals.
-
Parameters:
-
intervalInMillis(long) — the time interval in milliseconds between emissions
-
- Returns: an infinite LongStream that emits timestamp values at the specified intervals
- See also: #interval(long, long, TimeUnit), N#sleepUninterruptibly(long), System#currentTimeMillis()
-
Signature:
@Beta public static LongStream interval(final long delayInMillis, final long intervalInMillis) - Summary: Generates an infinite LongStream that emits sequential values at fixed intervals after an initial delay.
-
Parameters:
-
delayInMillis(long) — the initial delay in milliseconds before the first emission -
intervalInMillis(long) — the time interval in milliseconds between subsequent emissions
-
- Returns: an infinite LongStream that emits timestamp values at the specified intervals after the delay
- See also: #interval(long, long, TimeUnit), N#sleepUninterruptibly(long), System#currentTimeMillis()
-
Signature:
@Beta public static LongStream interval(final long delay, final long interval, final TimeUnit unit) - Summary: Generates an infinite LongStream that emits sequential values at fixed intervals with custom time unit.
-
Parameters:
-
delay(long) — the initial delay before the first emission -
interval(long) — the time interval between subsequent emissions -
unit(TimeUnit) — the time unit for both delay and interval parameters
-
- Returns: an infinite LongStream that emits timestamp values at the specified intervals
- See also: #interval(long), #interval(long, long), N#sleepUninterruptibly(long), System#currentTimeMillis()
iterate(...) -> LongStream
-
Signature:
public static LongStream iterate(final BooleanSupplier hasNext, final LongSupplier next) throws IllegalArgumentException - Summary: Creates a stream that iterates using the given hasNext and next suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(LongSupplier) — a LongSupplier that provides the next long value in the iteration
-
- Returns: a LongStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or next is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static LongStream iterate(final long init, final BooleanSupplier hasNext, final LongUnaryOperator f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a BooleanSupplier returns {@code true} .
-
Parameters:
-
init(long) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(LongUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a LongStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, BooleanSupplier, java.util.function.UnaryOperator)
-
Signature:
public static LongStream iterate(final long init, final LongPredicate hasNext, final LongUnaryOperator f) throws IllegalArgumentException - Summary: Creates a finite stream that iterates from an initial value, applying a function to generate subsequent values, and continues as long as a predicate is satisfied.
-
Contract:
- <p> <b> Iteration Behavior: </b> <ul> <li> The initial value is tested with the predicate first </li> <li> If the predicate returns {@code true} , the value is emitted and the function is applied </li> <li> The process continues until the predicate returns {@code false} </li> <li> The value that fails the predicate is NOT included in the stream </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate powers of 2 less than 100 LongStream.iterate(1L, n -> n < 100, n -> n 2) .toArray(); // Returns \[1L, 2L, 4L, 8L, 16L, 32L, 64L\] // Countdown from 10 to 1 LongStream.iterate(10L, n -> n > 0, n -> n - 1) .forEach(System.out::println); // Prints 10, 9, 8, ..., 1 // Fibonacci sequence up to a limit long limit = 1000L; LongStream.iterate(1L, n -> n < limit, n -> { // This is simplified; actual Fibonacci needs state return n 2; // Example only }).toArray(); // Generate sequence with custom termination LongStream.iterate(100L, n -> n >= 10, n -> n / 2) .toArray(); // Returns \[100L, 50L, 25L, 12L\] // Empty stream when initial value fails predicate LongStream.iterate(100L, n -> n < 50, n -> n * 2) .count(); // Returns 0 // Collatz conjecture sequence long start = 27L; LongStream.iterate(start, n -> n != 1, n -> n % 2 == 0 ?
- n / 2 : 3 n + 1) .forEach(System.out::println); // Prints Collatz sequence } </pre> <p> <b> Comparison with alternatives: </b> <pre> {@code // Using iterate with predicate (concise, declarative) LongStream.iterate(1L, n -> n < 10, n -> n 2).toArray(); // Using infinite iterate + takeWhile (similar but different) LongStream.iterate(1L, n -> n * 2).takeWhile(n -> n < 10).toArray(); // Using iterate with BooleanSupplier (when you need external state) AtomicLong counter = new AtomicLong(0); LongStream.iterate(() -> counter.get() < 5, () -> counter.getAndIncrement()); } </pre>
-
Parameters:
-
init(long) — the initial seed value -
hasNext(LongPredicate) — a stateless predicate that tests each value to determine if the stream should continue; returns {@code true} to continue iteration, {@code false} to terminate -
f(LongUnaryOperator) — a stateless function to apply to the previous element to generate the next element
-
- Returns: a finite LongStream of elements generated by the iteration while the predicate holds
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: #iterate(long, LongUnaryOperator), #iterate(BooleanSupplier, LongSupplier), #takeWhile(LongPredicate), java.util.stream.LongStream#iterate(long, java.util.function.LongPredicate, java.util.function.LongUnaryOperator)
-
Signature:
public static LongStream iterate(final long init, final LongUnaryOperator f) throws IllegalArgumentException - Summary: Creates an infinite stream that iterates from an initial value, applying a function to generate subsequent values.
-
Contract:
- // LongStream.iterate(0L, n -> n + 1).forEach(System.out::println); // DO THIS instead: LongStream.iterate(0L, n -> n + 1).limit(100).forEach(System.out::println); } </pre> <p> <b> Comparison with alternatives: </b> <pre> {@code // Infinite iterate (simple, state is in the value) LongStream.iterate(1L, n -> n 2).limit(10); // Iterate with predicate (terminates automatically) LongStream.iterate(1L, n -> n < 1024, n -> n 2); // Generate (when values don't depend on previous) LongStream.generate(() -> random.nextLong()).limit(10); // Range (for simple sequences) LongStream.range(0L, 10L); } </pre>
-
Parameters:
-
init(long) — the initial seed value -
f(LongUnaryOperator) — a stateless function to apply to the previous element to generate the next element
-
- Returns: an infinite LongStream of elements generated by repeatedly applying the function
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
- See also: #iterate(long, LongPredicate, LongUnaryOperator), #generate(LongSupplier), #limit(long), #takeWhile(LongPredicate), java.util.stream.LongStream#iterate(long, java.util.function.LongUnaryOperator)
generate(...) -> LongStream
-
Signature:
public static LongStream generate(final LongSupplier s) throws IllegalArgumentException - Summary: Generates an infinite LongStream using the provided LongSupplier.
-
Contract:
- // LongStream.generate(() -> 42L).forEach(System.out::println); // DO THIS instead: LongStream.generate(() -> 42L).limit(100).forEach(System.out::println); } </pre> <p> <b> Comparison with alternatives: </b> <pre> {@code // Generate (for independent values or external state) LongStream.generate(random::nextLong).limit(10); // Iterate (when each value depends on previous) LongStream.iterate(1L, n -> n * 2).limit(10); // Random (built-in random generator) LongStream.random().limit(10); // Repeat (for constant values) LongStream.repeat(42L, 10); } </pre> <p> <b> Thread Safety: </b> If the supplier accesses mutable state, ensure proper synchronization for thread safety, especially when using parallel streams.
-
Parameters:
-
s(LongSupplier) — the LongSupplier that provides the elements of the stream; invoked for each element
-
- Returns: an infinite LongStream where each element is generated by invoking the supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: #iterate(long, LongUnaryOperator), #random(), #repeat(long, long), java.util.stream.LongStream#generate(java.util.function.LongSupplier)
concat(...) -> LongStream
-
Signature:
public static LongStream concat(final long[]... a) - Summary: Concatenates multiple arrays of longs into a single LongStream.
-
Contract:
- If all arrays are empty or the varargs parameter is empty, an empty stream is returned.
-
Parameters:
-
a(long[][]) — the arrays of longs to concatenate; may be empty or contain empty arrays
-
- Returns: a LongStream containing all the longs from the input arrays in order, or an empty stream if no arrays provided
- See also: #concat(LongStream...), #concat(Collection)
-
Signature:
public static LongStream concat(final LongIterator... a) - Summary: Concatenates multiple LongIterators into a single LongStream.
-
Parameters:
-
a(LongIterator[]) — the LongIterators to concatenate
-
- Returns: a LongStream containing all the longs from the input iterators in order
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static LongStream concat(final LongStream... a) - Summary: Concatenates multiple LongStreams into a single LongStream.
-
Parameters:
-
a(LongStream[]) — the LongStreams to concatenate
-
- Returns: a LongStream containing all the longs from the input streams in order
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static LongStream concat(final List<long[]> c) - Summary: Concatenates a list of long arrays into a single LongStream.
-
Parameters:
-
c(List<long[]>) — the list of long arrays to concatenate
-
- Returns: a LongStream containing all the longs from the input arrays in order
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static LongStream concat(final Collection<? extends LongStream> streams) - Summary: Concatenates a collection of LongStreams into a single LongStream.
-
Parameters:
-
streams(Collection<? extends LongStream>) — the collection of LongStreams to concatenate
-
- Returns: a LongStream containing all the longs from the input streams in order
- See also: Stream#concat(Collection)
concatIterators(...) -> LongStream
-
Signature:
@Beta public static LongStream concatIterators(final Collection<? extends LongIterator> longIterators) - Summary: Concatenates a collection of LongIterators into a single LongStream.
-
Parameters:
-
longIterators(Collection<? extends LongIterator>) — the collection of LongIterators to concatenate
-
- Returns: a LongStream containing all the longs from the input iterators in order
- See also: Stream#concatIterators(Collection)
zip(...) -> LongStream
-
Signature:
public static LongStream zip(final long[] a, final long[] b, final LongBinaryOperator zipFunction) - Summary: Zips two long arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either array runs out of values.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final long[] a, final long[] b, final long[] c, final LongTernaryOperator zipFunction) - Summary: Zips three long arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any array runs out of values.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
c(long[]) — the third long array -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongIterator a, final LongIterator b, final LongBinaryOperator zipFunction) - Summary: Zips two long iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either iterator runs out of values.
-
Parameters:
-
a(LongIterator) — the first long iterator. Can be {@code null} (treated as empty) -
b(LongIterator) — the second long iterator. Can be {@code null} (treated as empty) -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongIterator a, final LongIterator b, final LongIterator c, final LongTernaryOperator zipFunction) - Summary: Zips three long iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any iterator runs out of values.
-
Parameters:
-
a(LongIterator) — the first long iterator. Can be {@code null} (treated as empty) -
b(LongIterator) — the second long iterator. Can be {@code null} (treated as empty) -
c(LongIterator) — the third long iterator. Can be {@code null} (treated as empty) -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongStream a, final LongStream b, final LongBinaryOperator zipFunction) - Summary: Zips two long streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either stream runs out of values.
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first LongStream -
b(LongStream) — the second LongStream -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongStream a, final LongStream b, final LongStream c, final LongTernaryOperator zipFunction) - Summary: Zips three long streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first LongStream -
b(LongStream) — the second LongStream -
c(LongStream) — the third LongStream -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final Collection<? extends LongStream> streams, final LongNFunction<Long> zipFunction) - Summary: Zips multiple long streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends LongStream>) — the collection of long streams to zip -
zipFunction(LongNFunction<Long>) — the function to combine arrays of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values. Empty if the collection is empty
-
Signature:
public static LongStream zip(final long[] a, final long[] b, final long valueForNoneA, final long valueForNoneB, final LongBinaryOperator zipFunction) - Summary: Zips two long arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that array.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
valueForNoneA(long) — the default value to use when the first array runs out of values -
valueForNoneB(long) — the default value to use when the second array runs out of values -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final long[] a, final long[] b, final long[] c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTernaryOperator zipFunction) - Summary: Zips three long arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that array.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
c(long[]) — the third long array -
valueForNoneA(long) — the default value to use when the first array runs out of values -
valueForNoneB(long) — the default value to use when the second array runs out of values -
valueForNoneC(long) — the default value to use when the third array runs out of values -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the arrays. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongIterator a, final LongIterator b, final long valueForNoneA, final long valueForNoneB, final LongBinaryOperator zipFunction) - Summary: Zips two long iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that iterator.
-
Parameters:
-
a(LongIterator) — the first long iterator, may be {@code null} (treated as empty) -
b(LongIterator) — the second long iterator, may be {@code null} (treated as empty) -
valueForNoneA(long) — the default value to use when the first iterator runs out of values -
valueForNoneB(long) — the default value to use when the second iterator runs out of values -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongIterator a, final LongIterator b, final LongIterator c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTernaryOperator zipFunction) - Summary: Zips three long iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that iterator.
-
Parameters:
-
a(LongIterator) — the first long iterator, may be {@code null} (treated as empty) -
b(LongIterator) — the second long iterator, may be {@code null} (treated as empty) -
c(LongIterator) — the third long iterator, may be {@code null} (treated as empty) -
valueForNoneA(long) — the default value to use when the first iterator runs out of values -
valueForNoneB(long) — the default value to use when the second iterator runs out of values -
valueForNoneC(long) — the default value to use when the third iterator runs out of values -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the iterators. Must be {@code non-null} .
-
- Returns: a stream of combined values
-
Signature:
public static LongStream zip(final LongStream a, final LongStream b, final long valueForNoneA, final long valueForNoneB, final LongBinaryOperator zipFunction) - Summary: Zips two long streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream -
b(LongStream) — the second long stream -
valueForNoneA(long) — the default value to use when the first stream runs out of values -
valueForNoneB(long) — the default value to use when the second stream runs out of values -
zipFunction(LongBinaryOperator) — the function to combine pairs of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static LongStream zip(final LongStream a, final LongStream b, final LongStream c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTernaryOperator zipFunction) - Summary: Zips three long streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream -
b(LongStream) — the second long stream -
c(LongStream) — the third long stream -
valueForNoneA(long) — the default value to use when the first stream runs out of values -
valueForNoneB(long) — the default value to use when the second stream runs out of values -
valueForNoneC(long) — the default value to use when the third stream runs out of values -
zipFunction(LongTernaryOperator) — the function to combine triples of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static LongStream zip(final Collection<? extends LongStream> streams, final long[] valuesForNone, final LongNFunction<Long> zipFunction) - Summary: Zips multiple long streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the corresponding default value from valuesForNone is used for that stream.
- The returned stream will handle closing of all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends LongStream>) — the collection of long streams to zip -
valuesForNone(long[]) — array of default values, must have same size as streams collection -
zipFunction(LongNFunction<Long>) — the function to combine arrays of values from the streams. Must be {@code non-null} .
-
- Returns: a stream of combined values that will close all input streams when closed
merge(...) -> LongStream
-
Signature:
public static LongStream merge(final long[] a, final long[] b, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges two long arrays into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected next. Returns MergeResult.TAKE_FIRST to select from the first array, otherwise from the second
-
- Returns: a LongStream containing the merged elements from the two input arrays
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static LongStream merge(final long[] a, final long[] b, final long[] c, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges three long arrays into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
c(long[]) — the third long array -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected next. Returns MergeResult.TAKE_FIRST to select from the first array, otherwise from the second
-
- Returns: a LongStream containing the merged elements from the three input arrays
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static LongStream merge(final LongIterator a, final LongIterator b, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges two LongIterators into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(LongIterator) — the first LongIterator -
b(LongIterator) — the second LongIterator -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a LongStream containing the merged elements from the two input iterators
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static LongStream merge(final LongIterator a, final LongIterator b, final LongIterator c, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges three LongIterators into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(LongIterator) — the first LongIterator -
b(LongIterator) — the second LongIterator -
c(LongIterator) — the third LongIterator -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a LongStream containing the merged elements from the three input iterators
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static LongStream merge(final LongStream a, final LongStream b, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges two LongStreams into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(LongStream) — the first LongStream -
b(LongStream) — the second LongStream -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a LongStream containing the merged elements from the two input streams
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static LongStream merge(final LongStream a, final LongStream b, final LongStream c, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges three LongStreams into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
a(LongStream) — the first LongStream -
b(LongStream) — the second LongStream -
c(LongStream) — the third LongStream -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a LongStream containing the merged elements from the three input streams
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static LongStream merge(final Collection<? extends LongStream> streams, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of LongStream into a single LongStream based on the provided nextSelector function.
-
Parameters:
-
streams(Collection<? extends LongStream>) — the collection of LongStream instances to merge -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a LongStream containing the merged elements from the input LongStreams
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
filter(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract LongStream filter(final LongPredicate predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(LongPredicate) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new stream consisting of the elements that match the given predicate
- See also: Stream#filter(Predicate)
takeWhile(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract LongStream takeWhile(final LongPredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(LongPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new stream consisting of elements from this stream until an element is encountered that doesn't match the predicate
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract LongStream dropWhile(final LongPredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(LongPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream map(LongUnaryOperator mapper) - Summary: Returns a LongStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongUnaryOperator) — a non-interfering, stateless function that transforms each element from long to long
-
- Returns: a new LongStream consisting of the results of applying the mapper function to each element
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(LongToIntFunction mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongToIntFunction) — a non-interfering, stateless function that transforms each element from long to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(LongUnaryOperator), #mapToObj(LongFunction)
mapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(LongToFloatFunction mapper) - Summary: Returns a FloatStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongToFloatFunction) — a non-interfering, stateless function that transforms each element from long to float
-
- Returns: a new FloatStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(LongUnaryOperator), #mapToDouble(LongToDoubleFunction)
mapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(LongToDoubleFunction mapper) - Summary: Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongToDoubleFunction) — a non-interfering, stateless function that transforms each element from long to double
-
- Returns: a new DoubleStream consisting of the results of applying the mapper function to each element of this stream
- See also: #map(LongUnaryOperator), #mapToFloat(LongToFloatFunction), java.util.stream.LongStream#mapToDouble(LongToDoubleFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(LongFunction<? extends T> mapper) - Summary: Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongFunction<? extends T>) — a non-interfering, stateless function that transforms each element from long to T
-
- Returns: a new Stream of objects resulting from applying the mapper function to each element of this stream
- See also: #map(LongUnaryOperator), java.util.stream.LongStream#mapToObj(LongFunction)
flatMap(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatMap(LongFunction<? extends LongStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each number to a range LongStream.of(1L, 2L, 3L) .flatMap(n -> LongStream.range(0, n)) .toLongList(); // Returns \[0, 0, 1, 0, 1, 2\] // Duplicate each element LongStream.of(1L, 2L, 3L) .flatMap(n -> LongStream.of(n, n)) .toLongList(); // Returns \[1, 1, 2, 2, 3, 3\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(LongFunction<? extends LongStream>) — a non-interfering, stateless function that transforms each element from long to LongStream
-
- Returns: the new stream
- See also: Stream#flatMap(Function)
flatmap(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatmap(LongFunction<long[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongFunction<long[]>) — a non-interfering, stateless function that transforms each element from long to long\[\]
-
- Returns: the new stream
- See also: #flatMap(LongFunction), #flatMapToInt(LongFunction), #flatMapToObj(LongFunction)
flattMap(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream flattMap(LongFunction<? extends java.util.stream.LongStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped java.util.stream.LongStream produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(LongFunction<? extends java.util.stream.LongStream>) — a non-interfering, stateless function that transforms each element from long to java.util.stream.LongStream
-
- Returns: the new stream
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(LongFunction<? extends IntStream> mapper) - Summary: Returns an {@code IntStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Extract int digits from long numbers LongStream.of(123L, 456L) .flatMapToInt(n -> IntStream.of( (int)(n / 100), (int)((n / 10) % 10), (int)(n % 10))) .toArray(); // Returns \[1, 2, 3, 4, 5, 6\] // Convert longs to int ranges LongStream.of(2L, 3L) .flatMapToInt(n -> IntStream.range(0, (int)n)) .toArray(); // Returns \[0, 1, 0, 1, 2\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(LongFunction<? extends IntStream>) — a non-interfering, stateless function that transforms each element from long to IntStream
-
- Returns: the new stream
flatMapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(LongFunction<? extends FloatStream> mapper) - Summary: Returns a {@code FloatStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate fractional values from longs LongStream.of(1L, 2L) .flatMapToFloat(n -> FloatStream.of(n 0.1f, n 0.5f, n * 1.0f)) .toArray(); // Returns \[0.1f, 0.5f, 1.0f, 0.2f, 1.0f, 2.0f\] // Convert timestamps to normalized time ranges LongStream.of(100L, 200L) .flatMapToFloat(n -> FloatStream.of(n / 100.0f, n / 50.0f)) .toArray(); // Returns \[1.0f, 2.0f, 2.0f, 4.0f\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(LongFunction<? extends FloatStream>) — a non-interfering, stateless function that transforms each element from long to FloatStream
-
- Returns: the new stream
flatMapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(LongFunction<? extends DoubleStream> mapper) - Summary: Returns a {@code DoubleStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate precision values from longs LongStream.of(1L, 2L) .flatMapToDouble(n -> DoubleStream.of(n, n + 0.5, n + 1.0)) .toArray(); // Returns \[1.0, 1.5, 2.0, 2.0, 2.5, 3.0\] // Create mathematical series LongStream.of(2L, 3L) .flatMapToDouble(n -> DoubleStream.of(Math.sqrt(n), Math.pow(n, 2))) .toArray(); // Returns \[1.414..., 4.0, 1.732..., 9.0\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(LongFunction<? extends DoubleStream>) — a non-interfering, stateless function that transforms each element from long to DoubleStream
-
- Returns: the new stream
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(LongFunction<? extends Stream<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function that transforms each element from long to Stream of T
-
- Returns: the new stream
- See also: #flatMap(LongFunction), #flatmapToObj(LongFunction)
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(LongFunction<? extends Collection<? extends T>> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of a collection produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function that transforms each element from long to Collection of T
-
- Returns: the new stream
- See also: #flatMapToObj(LongFunction), #flattmapToObj(LongFunction)
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(LongFunction<T[]> mapper) - Summary: Returns an object-valued Stream consisting of the results of replacing each element of this stream with the contents of an array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(LongFunction<T[]>) — a non-interfering, stateless function that transforms each element from long to T\[\]
-
- Returns: the new stream
- See also: #flatMapToObj(LongFunction), #flatmapToObj(LongFunction)
mapMulti(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream mapMulti(LongMapMultiConsumer mapper) - Summary: Returns a stream consisting of the results of applying the given multi-mapping function to each element.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Map each element to multiple values LongStream.of(1L, 2L) .mapMulti((n, consumer) -> { consumer.accept(n); consumer.accept(n 10); consumer.accept(n 100); }) .toArray(); // Returns \[1L, 10L, 100L, 2L, 20L, 200L\] // Conditionally emit multiple values LongStream.of(1L, 2L, 3L, 4L) .mapMulti((n, consumer) -> { if (n % 2 == 0) { consumer.accept(n); consumer.accept(n / 2); } }) .toArray(); // Returns \[2L, 1L, 4L, 2L\] } </pre>
-
Parameters:
-
mapper(LongMapMultiConsumer) — a non-interfering, stateless function that generates replacement elements
-
- Returns: a new stream
mapPartial(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartial(LongFunction<OptionalLong> mapper) - Summary: Returns a stream consisting of the results of applying the given function to the elements of this stream, where the function returns an {@code OptionalLong} .
-
Parameters:
-
mapper(LongFunction<OptionalLong>) — a non-interfering, stateless function to apply to each element which returns an {@code OptionalLong}
-
- Returns: a new stream
mapPartialJdk(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartialJdk(LongFunction<java.util.OptionalLong> mapper) - Summary: Returns a stream consisting of the results of applying the given function to the elements of this stream, where the function returns a {@code java.util.OptionalLong} .
-
Parameters:
-
mapper(LongFunction<java.util.OptionalLong>) — a non-interfering, stateless function to apply to each element which returns a {@code java.util.OptionalLong}
-
- Returns: a new stream
rangeMap(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream rangeMap(final LongBiPredicate sameRange, final LongBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(LongBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(LongBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final LongBiPredicate sameRange, final LongBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(LongBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(LongBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<LongList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<LongList> collapse(final LongBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(LongBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream collapse(final LongBiPredicate collapsible, final LongBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(LongBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(LongBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream collapse(final LongTriPredicate collapsible, final LongBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(LongTriPredicate) — a predicate that determines if the next element should be collapsed with the first and last elements of the group. The collapsible predicate takes three elements: the first and last elements of the group, and the next element in the stream. -
mergeFunction(LongBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream scan(final LongBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(LongBinaryOperator) — a {@code LongBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code LongStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream scan(final long init, final LongBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(long) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(LongBinaryOperator) — a {@code LongBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code LongStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream scan(final long init, final boolean initIncluded, final LongBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(long) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(LongBinaryOperator) — a {@code LongBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code LongStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream prepend(final long... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(long[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream append(final long... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(long[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream appendIfEmpty(final long... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
-
Parameters:
-
a(long[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
top(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to select
-
- Returns: a new stream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream top(final int n, Comparator<? super Long> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of elements to select -
comparator(Comparator<? super Long>) — a non-interfering, stateless comparator to be used to compare stream elements
-
- Returns: a new stream
toLongList(...) -> LongList
-
Signature:
@SequentialOnly @TerminalOp public abstract LongList toLongList() - Summary: Returns a {@code LongList} containing the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code LongList} containing the elements of this stream
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.LongFunction<? extends K, E> keyMapper, Throwables.LongFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to get the keys -
valueMapper(Throwables.LongFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to get the values
-
- Returns: a {@code Map} whose keys and values are the result of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.LongFunction<? extends K, E> keyMapper, Throwables.LongFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to get the keys -
valueMapper(Throwables.LongFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to get the values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the result of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.LongFunction<? extends K, E> keyMapper, Throwables.LongFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates, the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to get the keys -
valueMapper(Throwables.LongFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to get the values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Map} whose keys and values are the result of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.LongFunction<? extends K, E> keyMapper, Throwables.LongFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates, the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a non-interfering, stateless function to apply to each element to get the keys -
valueMapper(Throwables.LongFunction<? extends V, E2>) — a non-interfering, stateless function to apply to each element to get the values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the result of applying the mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.LongFunction<? extends K, E> keyMapper, final Collector<? super Long, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function, and performs a reduction operation on the values associated with each key.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Long, ?, D>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Map} containing the results of the reduction operation on the values associated with each key
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.LongFunction<? extends K, E> keyMapper, final Collector<? super Long, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function, and performs a reduction operation on the values associated with each key.
-
Parameters:
-
keyMapper(Throwables.LongFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Long, ?, D>) — a {@code Collector} implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} containing the results of the reduction operation on the values associated with each key
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> long
-
Signature:
@ParallelSupported @TerminalOp public abstract long reduce(long identity, LongBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value.
-
Parameters:
-
identity(long) — the identity value for the accumulating function -
accumulator(LongBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalLong reduce(LongBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an {@code OptionalLong} describing the reduced value, if any.
-
Contract:
- Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an {@code OptionalLong} describing the reduced value, if any.
-
Parameters:
-
accumulator(LongBinaryOperator) — an associative, non-interfering, stateless function for combining two values
-
- Returns: an {@code OptionalLong} describing the result of the reduction
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjLongConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjLongConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjLongConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream.
-
Contract:
- <br/> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjLongConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjLongConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
foreach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public void foreach(final LongConsumer action) - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(LongConsumer) — a non-interfering action to perform on the elements
-
- See also: #forEach(Throwables.LongConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.LongConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.LongConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntLongConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, passing the element index as the first parameter to the action.
-
Parameters:
-
action(Throwables.IntLongConsumer<E>) — a non-interfering action to perform on the elements, where the first parameter is the element index and the second is the element value
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any element is greater than 100 boolean hasLarge = LongStream.of(10L, 50L, 150L) .anyMatch(n -> n > 100); // Returns true // Check if any element is negative boolean hasNegative = LongStream.of(1L, 2L, 3L) .anyMatch(n -> n < 0); // Returns false } </pre>
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all elements are positive boolean allPositive = LongStream.of(1L, 2L, 3L, 4L) .allMatch(n -> n > 0); // Returns true // Check if all elements are greater than 10 boolean allLarge = LongStream.of(5L, 15L, 20L) .allMatch(n -> n > 10); // Returns false // Empty stream returns true boolean empty = LongStream.empty() .allMatch(n -> n < 0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no elements are negative boolean noNegatives = LongStream.of(1L, 2L, 3L, 4L) .noneMatch(n -> n < 0); // Returns true // Check if no elements are greater than 100 boolean noLarge = LongStream.of(10L, 50L, 150L) .noneMatch(n -> n > 100); // Returns false // Empty stream returns true boolean empty = LongStream.empty() .noneMatch(n -> n > 0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalLong
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalLong findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalLong} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the first element of the stream, or an empty {@code OptionalLong} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.LongPredicate), #findAny(Throwables.LongPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalLong findFirst(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalLong} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
-
Contract:
- Returns an {@code OptionalLong} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalLong} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalLong
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalLong findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalLong} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalLong} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing some element of the stream, or an empty {@code OptionalLong} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.LongPredicate), #findAny(Throwables.LongPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalLong findAny(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalLong} describing some element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
-
Contract:
- Returns an {@code OptionalLong} describing some element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalLong} describing some element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalLong
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalLong findLast(final Throwables.LongPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalLong} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
-
Contract:
- Returns an {@code OptionalLong} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element exists.
- Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
-
Parameters:
-
predicate(Throwables.LongPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalLong} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalLong} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalLong
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalLong min() - Summary: Returns an {@code OptionalLong} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalLong} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the minimum element of this stream, or an empty {@code OptionalLong} if the stream is empty
max(...) -> OptionalLong
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalLong max() - Summary: Returns an {@code OptionalLong} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalLong} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalLong} containing the maximum element of this stream, or an empty {@code OptionalLong} if the stream is empty
kthLargest(...) -> OptionalLong
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalLong kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty {@code OptionalLong} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element LongStream.of(10L, 30L, 20L, 50L, 40L).kthLargest(2); // Returns OptionalLong\[40L\] // Find the largest element (same as max) LongStream.of(5L, 2L, 8L, 1L).kthLargest(1); // Returns OptionalLong\[8L\] // When k exceeds stream size LongStream.of(1L, 2L, 3L).kthLargest(5); // Returns OptionalLong.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an {@code OptionalLong} containing the k-th largest element, or an empty {@code OptionalLong} if the stream is empty or the count of elements is less than k
sum(...) -> long
-
Signature:
@SequentialOnly @TerminalOp public abstract long sum() - Summary: Returns the sum of all elements in this stream.
-
Contract:
- <p> <b> Note on overflow: </b> The sum may overflow if the result exceeds {@code Long.MAX_VALUE} or is less than {@code Long.MIN_VALUE} .
- For extremely large datasets or when overflow is a concern, consider using {@link #mapToObj(LongFunction)} to convert to {@link java.math.BigInteger} .
-
Parameters:
- (none)
- Returns: the sum of elements in this stream. Returns 0 if the stream is empty.
- See also: #average(), #reduce(long, LongBinaryOperator)
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> LongSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract LongSummaryStatistics summaryStatistics() - Summary: Returns statistics about the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code LongSummaryStatistics} describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<LongSummaryStatistics, Optional<Map<Percentage, Long>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<LongSummaryStatistics, Optional<Map<Percentage, Long>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of LongSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of LongSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: a {@code Pair} containing a {@code LongSummaryStatistics} describing various summary data about the elements of this stream, and an {@code Optional} containing a map of percentile values
mergeWith(...) -> LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract LongStream mergeWith(final LongStream b, final LongBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream, selecting elements based on the given selector function.
-
Parameters:
-
b(LongStream) — the stream to merge with -
nextSelector(LongBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: the new merged stream
zipWith(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream zipWith(LongStream b, LongBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(LongStream) — the LongStream to be combined with the current LongStream. Must be {@code non-null} . -
zipFunction(LongBinaryOperator) — a LongBinaryOperator that determines the combination of elements in the combined LongStream. Must be {@code non-null} .
-
- Returns: a new LongStream that is the result of combining the current LongStream with the given LongStream
- See also: #zipWith(LongStream, long, long, LongBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream zipWith(LongStream b, LongStream c, LongTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(LongStream) — the second LongStream to be combined with the current LongStream. Will be closed along with this LongStream. -
c(LongStream) — the third LongStream to be combined with the current LongStream. Will be closed along with this LongStream. -
zipFunction(LongTernaryOperator) — a LongTernaryOperator that determines the combination of elements in the combined LongStream. Must be {@code non-null} .
-
- Returns: a new LongStream that is the result of combining the current LongStream with the given LongStreams
- See also: #zipWith(LongStream, LongStream, long, long, long, LongTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream zipWith(LongStream b, long valueForNoneA, long valueForNoneB, LongBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(LongStream) — the LongStream to be combined with the current LongStream. Will be closed along with this LongStream. -
valueForNoneA(long) — the default value to use for the current LongStream when it runs out of elements -
valueForNoneB(long) — the default value to use for the given LongStream when it runs out of elements -
zipFunction(LongBinaryOperator) — a LongBinaryOperator that determines the combination of elements in the combined LongStream. Must be {@code non-null} .
-
- Returns: a new LongStream that is the result of combining the current LongStream with the given LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream zipWith(LongStream b, LongStream c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(LongStream) — the second LongStream to be combined with the current LongStream. Will be closed along with this LongStream. -
c(LongStream) — the third LongStream to be combined with the current LongStream. Will be closed along with this LongStream. -
valueForNoneA(long) — the default value to use for the current LongStream when it runs out of elements -
valueForNoneB(long) — the default value to use for the second LongStream when it runs out of elements -
valueForNoneC(long) — the default value to use for the third LongStream when it runs out of elements -
zipFunction(LongTernaryOperator) — a LongTernaryOperator that determines the combination of elements in the combined LongStream. Must be {@code non-null} .
-
- Returns: a new LongStream that is the result of combining the current LongStream with the given LongStreams
asFloatStream(...) -> FloatStream
-
Signature:
@SequentialOnly @IntermediateOp @Deprecated public abstract FloatStream asFloatStream() - Summary: Converts this LongStream to a FloatStream by casting each long value to float.
-
Parameters:
- (none)
- Returns: a FloatStream representation of this LongStream with each long value cast to float
- See also: #asDoubleStream(), #mapToFloat(LongToFloatFunction), #mapToDouble(LongToDoubleFunction)
asDoubleStream(...) -> DoubleStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract DoubleStream asDoubleStream() - Summary: Converts this LongStream to a DoubleStream by casting each long value to double.
-
Parameters:
- (none)
- Returns: a DoubleStream representation of this LongStream
boxed(...) -> Stream<Long>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Long> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Long.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Long
toJdkStream(...) -> java.util.stream.LongStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract java.util.stream.LongStream toJdkStream() - Summary: Converts this stream to a {@code java.util.stream.LongStream} .
-
Parameters:
- (none)
- Returns: a {@code java.util.stream.LongStream} consisting of the elements of this stream
transformB(...) -> LongStream
-
Signature:
@Beta @SequentialOnly @IntermediateOp public LongStream transformB(final Function<? super java.util.stream.LongStream, ? extends java.util.stream.LongStream> transfer) - Summary: Transforms this stream using the provided transfer function.
-
Parameters:
-
transfer(Function<? super java.util.stream.LongStream, ? extends java.util.stream.LongStream>) — a function that transforms a {@code java.util.stream.LongStream} to another {@code java.util.stream.LongStream}
-
- Returns: a new {@code LongStream} that is the result of applying the transfer function
- See also: #transformB(Function, boolean), #toJdkStream()
-
Signature:
@Beta @SequentialOnly @IntermediateOp public LongStream transformB(final Function<? super java.util.stream.LongStream, ? extends java.util.stream.LongStream> transfer, final boolean deferred) throws IllegalArgumentException - Summary: Transforms this stream using the provided transfer function, with an option to defer the transformation.
-
Contract:
- <p> When {@code deferred} is {@code true} , the transformation is not applied until the stream is consumed, allowing for lazy initialization and dynamic stream generation based on runtime conditions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code LongStream.of(1L, 2L, 3L, 4L) .transformB(s -> s.map(x -> x * 2).sorted(), true) .toArray(); // Transformation applied only when toArray() is called } </pre>
-
Parameters:
-
transfer(Function<? super java.util.stream.LongStream, ? extends java.util.stream.LongStream>) — a function that transforms a {@code java.util.stream.LongStream} to another {@code java.util.stream.LongStream} -
deferred(boolean) — if {@code true} , the transformation is deferred until the stream is consumed
-
- Returns: a new {@code LongStream} that is the result of applying the transfer function
-
Throws:
-
java.lang.IllegalArgumentException— if the transfer function is null
-
- See also: #transformB(Function), #defer(Supplier)
Class LongStreamEx (com.landawn.abacus.util.stream.LongStream.LongStreamEx)
Extended LongStream class for providing additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class ObjIteratorEx (com.landawn.abacus.util.stream.ObjIteratorEx)
An extended iterator over objects with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ObjIteratorEx<T>
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static <T> ObjIteratorEx<T> empty() - Summary: Returns an empty ObjIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty ObjIteratorEx instance
of(...) -> ObjIteratorEx<T>
-
Signature:
@SafeVarargs public static <T> ObjIteratorEx<T> of(final T... a) - Summary: Creates an ObjIteratorEx from the given array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(T[]) — the array to iterate over (can be {@code null} or empty)
-
- Returns: an ObjIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static <T> ObjIteratorEx<T> of(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates an ObjIteratorEx from a portion of the given array.
-
Parameters:
-
a(T[]) — the array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: an ObjIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static <T> ObjIteratorEx<T> of(final Collection<? extends T> c) - Summary: Creates an ObjIteratorEx from a Collection.
-
Contract:
- Returns an empty iterator if the collection is {@code null} .
-
Parameters:
-
c(Collection<? extends T>) — the collection to iterate over
-
- Returns: an ObjIteratorEx over the collection
-
Signature:
public static <T> ObjIteratorEx<T> of(final Iterator<? extends T> iter) - Summary: Wraps an Iterator as an ObjIteratorEx.
-
Contract:
- If the iterator is already an ObjIteratorEx, it is returned as-is.
-
Parameters:
-
iter(Iterator<? extends T>) — the Iterator to wrap (can be null)
-
- Returns: an ObjIteratorEx wrapping the given iterator, or empty iterator if iter is null
-
Signature:
public static <T> ObjIteratorEx<T> of(final Iterable<? extends T> iterable) - Summary: Creates an ObjIteratorEx from an Iterable.
-
Contract:
- Returns an empty iterator if the iterable is {@code null} .
-
Parameters:
-
iterable(Iterable<? extends T>) — the Iterable to iterate over
-
- Returns: an ObjIteratorEx over the iterable
defer(...) -> ObjIteratorEx<T>
-
Signature:
public static <T> ObjIteratorEx<T> defer(final Supplier<? extends Iterator<? extends T>> iteratorSupplier) throws IllegalArgumentException - Summary: Creates a deferred ObjIteratorEx that initializes the underlying iterator lazily.
-
Contract:
- The iterator is created only when iteration begins (first call to hasNext or next).
- This is useful for expensive initialization operations that should only occur when actually needed.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Example: Lazy file loading - file is only opened when iteration starts ObjIteratorEx<String> iter = ObjIteratorEx.defer(() -> { try { return Files.lines(Paths.get("large-file.txt")).iterator(); } catch (IOException e) { throw new UncheckedIOException(e); } }); // File is not opened yet, no I/O has occurred // Later, when iteration begins...
- if (someCondition) { iter.hasNext(); // File is opened and buffered here while (iter.hasNext()) { process(iter.next()); } iter.close(); // Remember to close to release file handle } // If someCondition is false, file is never opened } </pre>
-
Parameters:
-
iteratorSupplier(Supplier<? extends Iterator<? extends T>>) — the supplier that provides the iterator
-
- Returns: a deferred ObjIteratorEx
-
Throws:
-
java.lang.IllegalArgumentException— if iteratorSupplier is null
-
Public Instance Methods
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class ShortIteratorEx (com.landawn.abacus.util.stream.ShortIteratorEx)
An extended iterator over primitive short values with additional functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ShortIteratorEx
-
Signature:
@SuppressWarnings({ "java:S1845", "SameReturnValue" }) public static ShortIteratorEx empty() - Summary: Returns an empty ShortIteratorEx with no elements.
-
Parameters:
- (none)
- Returns: an empty ShortIteratorEx instance
of(...) -> ShortIteratorEx
-
Signature:
public static ShortIteratorEx of(final short... a) - Summary: Creates a ShortIteratorEx from the given short array.
-
Contract:
- Returns an empty iterator if the array is {@code null} or empty.
-
Parameters:
-
a(short[]) — the short array to iterate over (can be {@code null} or empty)
-
- Returns: a ShortIteratorEx for the given array, or empty iterator if array is null/empty
-
Signature:
public static ShortIteratorEx of(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Creates a ShortIteratorEx from a portion of the given short array.
-
Parameters:
-
a(short[]) — the short array to iterate over -
fromIndex(int) — the starting index (inclusive) -
toIndex(int) — the ending index (exclusive)
-
- Returns: a ShortIteratorEx for the specified array range
-
Throws:
-
java.lang.IndexOutOfBoundsException— if fromIndex or toIndex are out of bounds
-
-
Signature:
public static ShortIteratorEx of(final ShortIterator iter) - Summary: Wraps a ShortIterator as a ShortIteratorEx.
-
Contract:
- If the iterator is already a ShortIteratorEx, it is returned as-is.
-
Parameters:
-
iter(ShortIterator) — the ShortIterator to wrap (can be null)
-
- Returns: a ShortIteratorEx wrapping the given iterator, or empty iterator if iter is null
from(...) -> ShortIteratorEx
-
Signature:
public static ShortIteratorEx from(final Iterator<Short> iter) - Summary: Creates a ShortIteratorEx from an Iterator of Short objects.
-
Parameters:
-
iter(Iterator<Short>) — the Iterator of Short objects (can be null)
-
- Returns: a ShortIteratorEx unwrapping the given iterator, or empty iterator if iter is null
Public Instance Methods
advance(...) -> void
-
Signature:
@Override public void advance(long n) -
Parameters:
-
n(long)
-
count(...) -> long
-
Signature:
@Override public long count() -
Parameters:
- (none)
- Returns: unspecified
close(...) -> void
-
Signature:
@Override public void close() -
Parameters:
- (none)
Class ShortStream (com.landawn.abacus.util.stream.ShortStream)
A specialized stream implementation for processing sequences of short values with functional-style operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> ShortStream
-
Signature:
public static ShortStream empty() - Summary: Returns an empty sequential ShortStream with no elements.
-
Contract:
- The returned stream is useful as a base case in stream operations, conditional stream creation, or when no data is available.
-
Parameters:
- (none)
- Returns: an empty sequential ShortStream with no elements
- See also: #of(short...), #ofNullable(Short)
defer(...) -> ShortStream
-
Signature:
public static ShortStream defer(final Supplier<ShortStream> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Defer expensive stream creation ShortStream stream = ShortStream.defer(() -> { System.out.println("Stream created!"); // Only printed when stream is consumed return ShortStream.range((short) 1, (short) 10); }); // Stream not yet created here stream.forEach(System.out::println); // "Stream created!" is printed, then numbers 1-9 // Conditional stream creation ShortStream conditional = ShortStream.defer(() -> { if (someCondition()) { return ShortStream.of((short) 1, (short) 2, (short) 3); } else { return ShortStream.empty(); } }); } </pre> <p> <b> Implementation Note: </b> it's equivalent to {@code Stream.just(supplier).flatMapToShort(it -> it.get())} .
-
Parameters:
-
supplier(Supplier<ShortStream>) — the supplier that provides the ShortStream
-
- Returns: a new ShortStream supplied by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#defer(Supplier)
ofNullable(...) -> ShortStream
-
Signature:
public static ShortStream ofNullable(final Short e) - Summary: Returns a stream containing a single element if the provided value is {@code non-null} , otherwise returns an empty stream.
-
Contract:
- Returns a stream containing a single element if the provided value is {@code non-null} , otherwise returns an empty stream.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // With non-null value ShortStream.ofNullable((short) 42) .forEach(System.out::println); // Prints: 42 // With null value ShortStream.ofNullable(null) .forEach(System.out::println); // Prints nothing (empty stream) // Useful for optional values Short value = getValue(); // May return null long count = ShortStream.ofNullable(value).count(); // 0 if null, 1 if non-null } </pre>
-
Parameters:
-
e(Short) — the element to create a stream from, may be null
-
- Returns: a stream containing the element if {@code non-null} , otherwise an empty stream
of(...) -> ShortStream
-
Signature:
public static ShortStream of(final short... a) - Summary: Returns a stream whose elements are the specified values.
-
Parameters:
-
a(short[]) — the elements of the new stream
-
- Returns: a new stream
-
Signature:
public static ShortStream of(final short[] a, final int fromIndex, final int toIndex) - Summary: Returns a stream whose elements are the specified values from the array within the specified range.
-
Parameters:
-
a(short[]) — the array containing the elements -
fromIndex(int) — the starting index, inclusive -
toIndex(int) — the ending index, exclusive
-
- Returns: a ShortStream containing the specified range of elements
-
Signature:
public static ShortStream of(final Short[] a) - Summary: Returns a stream whose elements are the unboxed values from the specified Short array.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Create stream from boxed Short array Short\[\] boxed = {Short.valueOf((short) 1), Short.valueOf((short) 2), Short.valueOf((short) 3)}; ShortStream.of(boxed) .sum(); // Returns 6 // Handle array with nulls (will throw NullPointerException when processed) Short\[\] withNull = {Short.valueOf((short) 10), null, Short.valueOf((short) 20)}; // ShortStream.of(withNull).sum(); // Throws NullPointerException } </pre>
-
Parameters:
-
a(Short[]) — the array of Short objects
-
- Returns: a new stream
-
Signature:
public static ShortStream of(final Short[] a, final int fromIndex, final int toIndex) - Summary: Returns a stream whose elements are the unboxed values from the specified Short array within the specified range.
-
Parameters:
-
a(Short[]) — the array of Short objects -
fromIndex(int) — the starting index, inclusive -
toIndex(int) — the ending index, exclusive
-
- Returns: a new stream
-
Signature:
public static ShortStream of(final Collection<Short> c) - Summary: Returns a stream whose elements are the unboxed values from the specified collection.
-
Parameters:
-
c(Collection<Short>) — the collection of Short objects
-
- Returns: a new stream
-
Signature:
public static ShortStream of(final ShortIterator iterator) - Summary: Returns a stream whose elements are provided by the specified iterator.
-
Parameters:
-
iterator(ShortIterator) — the iterator providing the elements
-
- Returns: a new stream
-
Signature:
public static ShortStream of(final ShortBuffer buf) - Summary: Returns a stream whose elements are the values from the specified buffer starting from its current position.
-
Parameters:
-
buf(ShortBuffer) — the ShortBuffer providing the elements
-
- Returns: a new stream
flatten(...) -> ShortStream
-
Signature:
public static ShortStream flatten(final short[][] a) - Summary: Returns a stream whose elements are all the elements of the first array, followed by all the elements of the second array, and so on.
-
Parameters:
-
a(short[][]) — the two-dimensional array to flatten
-
- Returns: a new stream containing all elements from the input arrays
-
Signature:
public static ShortStream flatten(final short[][] a, final boolean vertically) - Summary: Returns a stream whose elements are from a two-dimensional array, read either horizontally (row by row) or vertically (column by column).
-
Parameters:
-
a(short[][]) — the two-dimensional array to flatten -
vertically(boolean) — if {@code true} , reads elements column by column; if {@code false} , reads row by row
-
- Returns: a new stream containing all elements from the input array
-
Signature:
public static ShortStream flatten(final short[][] a, final short valueForAlignment, final boolean vertically) - Summary: Returns a stream whose elements are from a two-dimensional array, read either horizontally (row by row) or vertically (column by column).
-
Contract:
- If arrays have different lengths, missing elements are filled with the specified value.
-
Parameters:
-
a(short[][]) — the two-dimensional array to flatten -
valueForAlignment(short) — element to append, so there is the same size of elements in all rows/columns -
vertically(boolean) — if {@code true} , reads elements column by column; if {@code false} , reads row by row
-
- Returns: a new stream containing all elements from the input array
-
Signature:
public static ShortStream flatten(final short[][][] a) - Summary: Flattens a three-dimensional short array into a ShortStream.
-
Parameters:
-
a(short[][][]) — the three-dimensional short array to flatten
-
- Returns: a ShortStream containing all short values from the input array
range(...) -> ShortStream
-
Signature:
public static ShortStream range(final short startInclusive, final short endExclusive) - Summary: Returns a ShortStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1.
-
Contract:
- If startInclusive is greater than or equal to endExclusive, an empty stream is returned.
-
Parameters:
-
startInclusive(short) — the (inclusive) initial value -
endExclusive(short) — the exclusive upper bound
-
- Returns: a sequential ShortStream for the range of short elements
-
Signature:
public static ShortStream range(final short startInclusive, final short endExclusive, final short by) - Summary: Returns a ShortStream from startInclusive (inclusive) to endExclusive (exclusive) by the specified incremental step.
-
Contract:
- If startInclusive is greater than or equal to endExclusive, or if the step direction doesn't match the range direction, an empty stream is returned.
-
Parameters:
-
startInclusive(short) — the (inclusive) initial value -
endExclusive(short) — the exclusive upper bound -
by(short) — the amount to increment by at each step (can be negative)
-
- Returns: a sequential ShortStream for the range of short elements
rangeClosed(...) -> ShortStream
-
Signature:
public static ShortStream rangeClosed(final short startInclusive, final short endInclusive) - Summary: Returns a ShortStream from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step of 1.
-
Contract:
- If startInclusive is greater than endInclusive, an empty stream is returned.
-
Parameters:
-
startInclusive(short) — the (inclusive) initial value -
endInclusive(short) — the inclusive upper bound
-
- Returns: a sequential ShortStream for the range of short elements
-
Signature:
public static ShortStream rangeClosed(final short startInclusive, final short endInclusive, final short by) - Summary: Returns a ShortStream from startInclusive (inclusive) to endInclusive (inclusive) by the specified incremental step.
-
Contract:
- If startInclusive equals endInclusive, a stream containing only that value is returned.
- If the step direction doesn't match the range direction, an empty stream is returned.
-
Parameters:
-
startInclusive(short) — the (inclusive) initial value -
endInclusive(short) — the inclusive upper bound -
by(short) — the amount to increment by at each step (can be negative)
-
- Returns: a sequential ShortStream for the range of short elements
repeat(...) -> ShortStream
-
Signature:
public static ShortStream repeat(final short element, final long n) throws IllegalArgumentException - Summary: Returns an infinite sequential ShortStream with the specified element repeated.
-
Parameters:
-
element(short) — the element to be repeated -
n(long) — the number of times to repeat the element
-
- Returns: a ShortStream consisting of n copies of the specified element
-
Throws:
-
java.lang.IllegalArgumentException— if n is negative
-
random(...) -> ShortStream
-
Signature:
public static ShortStream random() - Summary: Returns an infinite sequential unordered stream where each element is generated randomly.
-
Parameters:
- (none)
- Returns: an infinite ShortStream of random short values
iterate(...) -> ShortStream
-
Signature:
public static ShortStream iterate(final BooleanSupplier hasNext, final ShortSupplier next) throws IllegalArgumentException - Summary: Creates a ShortStream that iterates using the given hasNext and next suppliers.
-
Contract:
- The stream terminates when hasNext returns {@code false} .
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(ShortSupplier) — a ShortSupplier that provides the next short in the iteration
-
- Returns: a ShortStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or next is null
-
- See also: Stream#iterate(BooleanSupplier, Supplier)
-
Signature:
public static ShortStream iterate(final short init, final BooleanSupplier hasNext, final ShortUnaryOperator f) throws IllegalArgumentException - Summary: Creates a ShortStream that starts with an initial value and iterates by applying a function to generate subsequent values.
-
Parameters:
-
init(short) — the initial value -
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
f(ShortUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a ShortStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, BooleanSupplier, java.util.function.UnaryOperator)
-
Signature:
public static ShortStream iterate(final short init, final ShortPredicate hasNext, final ShortUnaryOperator f) throws IllegalArgumentException - Summary: Creates a ShortStream that starts with an initial value and iterates by applying a function to generate subsequent values.
-
Parameters:
-
init(short) — the initial value -
hasNext(ShortPredicate) — predicate to determine if the stream should continue; tested on init for the first element and on subsequent generated values -
f(ShortUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: a ShortStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or f is null
-
- See also: Stream#iterate(Object, java.util.function.Predicate, java.util.function.UnaryOperator)
-
Signature:
public static ShortStream iterate(final short init, final ShortUnaryOperator f) throws IllegalArgumentException - Summary: Creates an infinite ShortStream that starts with an initial value and iterates by applying a function to generate subsequent values.
-
Parameters:
-
init(short) — the initial value -
f(ShortUnaryOperator) — a function to apply to the previous element to generate the next element
-
- Returns: an infinite ShortStream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if f is null
-
- See also: Stream#iterate(Object, java.util.function.UnaryOperator)
generate(...) -> ShortStream
-
Signature:
public static ShortStream generate(final ShortSupplier s) throws IllegalArgumentException - Summary: Generates an infinite sequential unordered stream where each element is generated by the provided ShortSupplier.
-
Parameters:
-
s(ShortSupplier) — the ShortSupplier that provides the elements of the stream
-
- Returns: an infinite ShortStream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: Stream#generate(Supplier)
concat(...) -> ShortStream
-
Signature:
public static ShortStream concat(final short[]... a) - Summary: Concatenates multiple short arrays into a single ShortStream.
-
Parameters:
-
a(short[][]) — the arrays of shorts to concatenate
-
- Returns: a ShortStream containing all the shorts from the input arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static ShortStream concat(final ShortIterator... a) - Summary: Concatenates multiple ShortIterators into a single ShortStream.
-
Parameters:
-
a(ShortIterator[]) — the array of ShortIterators to concatenate
-
- Returns: a ShortStream containing all the shorts from the input iterators
- See also: Stream#concat(Iterator\[\])
-
Signature:
public static ShortStream concat(final ShortStream... a) - Summary: Concatenates multiple ShortStreams into a single ShortStream.
-
Parameters:
-
a(ShortStream[]) — the array of ShortStreams to concatenate
-
- Returns: a ShortStream containing all the shorts from the input streams
- See also: Stream#concat(Stream\[\])
-
Signature:
@Beta public static ShortStream concat(final List<short[]> c) - Summary: Concatenates a list of short arrays into a single ShortStream.
-
Parameters:
-
c(List<short[]>) — the list of short arrays to concatenate
-
- Returns: a ShortStream containing all the shorts from the input arrays
- See also: Stream#concat(Object\[\]\[\])
-
Signature:
public static ShortStream concat(final Collection<? extends ShortStream> streams) - Summary: Concatenates a collection of ShortStreams into a single ShortStream.
-
Contract:
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends ShortStream>) — the collection of ShortStreams to concatenate
-
- Returns: a ShortStream containing all the shorts from the input streams
- See also: Stream#concat(Collection)
concatIterators(...) -> ShortStream
-
Signature:
@Beta public static ShortStream concatIterators(final Collection<? extends ShortIterator> shortIterators) - Summary: Concatenates a collection of ShortIterators into a single ShortStream.
-
Parameters:
-
shortIterators(Collection<? extends ShortIterator>) — the collection of ShortIterators to concatenate
-
- Returns: a ShortStream containing all the shorts from the input iterators
- See also: Stream#concatIterators(Collection)
zip(...) -> ShortStream
-
Signature:
public static ShortStream zip(final short[] a, final short[] b, final ShortBinaryOperator zipFunction) - Summary: Zips two short arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shorter array runs out of values.
-
Parameters:
-
a(short[]) — the first short array. Must be non-null -
b(short[]) — the second short array. Must be non-null -
zipFunction(ShortBinaryOperator) — the function to combine elements from both arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static ShortStream zip(final short[] a, final short[] b, final short[] c, final ShortTernaryOperator zipFunction) - Summary: Zips three short arrays into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when the shortest array runs out of values.
-
Parameters:
-
a(short[]) — the first short array. Must be non-null -
b(short[]) — the second short array. Must be non-null -
c(short[]) — the third short array. Must be non-null -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static ShortStream zip(final ShortIterator a, final ShortIterator b, final ShortBinaryOperator zipFunction) - Summary: Zips two short iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when either iterator runs out of values.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator. Must be non-null -
b(ShortIterator) — the second ShortIterator. Must be non-null -
zipFunction(ShortBinaryOperator) — the function to combine elements from both iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, BiFunction)
-
Signature:
public static ShortStream zip(final ShortIterator a, final ShortIterator b, final ShortIterator c, final ShortTernaryOperator zipFunction) - Summary: Zips three short iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when any iterator runs out of values.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator. Must be non-null -
b(ShortIterator) — the second ShortIterator. Must be non-null -
c(ShortIterator) — the third ShortIterator. Must be non-null -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static ShortStream zip(final ShortStream a, final ShortStream b, final ShortBinaryOperator zipFunction) - Summary: Zips two short streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when either stream runs out of values.
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream. Must be non-null -
b(ShortStream) — the second ShortStream. Must be non-null -
zipFunction(ShortBinaryOperator) — the function to combine elements from both streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, BiFunction)
-
Signature:
public static ShortStream zip(final ShortStream a, final ShortStream b, final ShortStream c, final ShortTernaryOperator zipFunction) - Summary: Zips three short streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream. Must be non-null -
b(ShortStream) — the second ShortStream. Must be non-null -
c(ShortStream) — the third ShortStream. Must be non-null -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, TriFunction)
-
Signature:
public static ShortStream zip(final Collection<? extends ShortStream> streams, final ShortNFunction<Short> zipFunction) - Summary: Zips multiple short streams into a single stream until one of them runs out of values.
-
Contract:
- The stream ends when any stream runs out of values.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends ShortStream>) — the collection of ShortStreams to zip. Must be non-null -
zipFunction(ShortNFunction<Short>) — the function to combine elements from all the streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, Function)
-
Signature:
public static ShortStream zip(final short[] a, final short[] b, final short valueForNoneA, final short valueForNoneB, final ShortBinaryOperator zipFunction) - Summary: Zips two short arrays into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both arrays run out of values.
- If one array runs out of values before the other, the specified default values are used.
-
Parameters:
-
a(short[]) — the first short array. Must be non-null -
b(short[]) — the second short array. Must be non-null -
valueForNoneA(short) — the default value to use if the first array is shorter -
valueForNoneB(short) — the default value to use if the second array is shorter -
zipFunction(ShortBinaryOperator) — the function to combine elements from both arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static ShortStream zip(final short[] a, final short[] b, final short[] c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTernaryOperator zipFunction) - Summary: Zips three short arrays into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all arrays run out of values.
- If any array runs out of values before the others, the specified default values are used.
-
Parameters:
-
a(short[]) — the first short array. Must be non-null -
b(short[]) — the second short array. Must be non-null -
c(short[]) — the third short array. Must be non-null -
valueForNoneA(short) — the default value to use if the first array is shorter -
valueForNoneB(short) — the default value to use if the second array is shorter -
valueForNoneC(short) — the default value to use if the third array is shorter -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three arrays. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static ShortStream zip(final ShortIterator a, final ShortIterator b, final short valueForNoneA, final short valueForNoneB, final ShortBinaryOperator zipFunction) - Summary: Zips two short iterators into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both iterators run out of values.
- If one iterator runs out of values before the other, the specified default values are used.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator. Must be non-null -
b(ShortIterator) — the second ShortIterator. Must be non-null -
valueForNoneA(short) — the default value to use if the first iterator is shorter -
valueForNoneB(short) — the default value to use if the second iterator is shorter -
zipFunction(ShortBinaryOperator) — the function to combine elements from both iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static ShortStream zip(final ShortIterator a, final ShortIterator b, final ShortIterator c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTernaryOperator zipFunction) - Summary: Zips three short iterators into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all iterators run out of values.
- If any iterator runs out of values before the others, the specified default values are used.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator. Must be non-null -
b(ShortIterator) — the second ShortIterator. Must be non-null -
c(ShortIterator) — the third ShortIterator. Must be non-null -
valueForNoneA(short) — the default value to use if the first iterator is shorter -
valueForNoneB(short) — the default value to use if the second iterator is shorter -
valueForNoneC(short) — the default value to use if the third iterator is shorter -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three iterators. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Iterator, Iterator, Iterator, Object, Object, Object, TriFunction)
-
Signature:
public static ShortStream zip(final ShortStream a, final ShortStream b, final short valueForNoneA, final short valueForNoneB, final ShortBinaryOperator zipFunction) - Summary: Zips two short streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when both streams run out of values.
- If one stream runs out of values before the other, the specified default values are used.
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream. Must be non-null -
b(ShortStream) — the second ShortStream. Must be non-null -
valueForNoneA(short) — the default value to use if the first stream is shorter -
valueForNoneB(short) — the default value to use if the second stream is shorter -
zipFunction(ShortBinaryOperator) — the function to combine elements from both streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static ShortStream zip(final ShortStream a, final ShortStream b, final ShortStream c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTernaryOperator zipFunction) - Summary: Zips three short streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all streams run out of values.
- If any stream runs out of values before the others, the specified default values are used.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream. Must be non-null -
b(ShortStream) — the second ShortStream. Must be non-null -
c(ShortStream) — the third ShortStream. Must be non-null -
valueForNoneA(short) — the default value to use if the first stream is shorter -
valueForNoneB(short) — the default value to use if the second stream is shorter -
valueForNoneC(short) — the default value to use if the third stream is shorter -
zipFunction(ShortTernaryOperator) — the function to combine elements from all three streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Stream, Stream, Stream, Object, Object, Object, TriFunction)
-
Signature:
public static ShortStream zip(final Collection<? extends ShortStream> streams, final short[] valuesForNone, final ShortNFunction<Short> zipFunction) - Summary: Zips multiple short streams into a single stream until all of them run out of values.
-
Contract:
- The stream ends when all streams run out of values.
- If any stream runs out of values before the others, the corresponding default value from valuesForNone is used.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends ShortStream>) — the collection of ShortStreams to zip. Must be non-null -
valuesForNone(short[]) — the array of default values to use for streams that run out of values. Must be non-null -
zipFunction(ShortNFunction<Short>) — the function to combine elements from all the streams. Must be non-null
-
- Returns: a stream of combined values
- See also: Stream#zip(Collection, List, Function)
merge(...) -> ShortStream
-
Signature:
public static ShortStream merge(final short[] a, final short[] b, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges two short arrays into a single ShortStream based on the provided nextSelector function.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the two input arrays
- See also: Stream#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static ShortStream merge(final short[] a, final short[] b, final short[] c, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges three short arrays into a single ShortStream based on the provided nextSelector function.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
c(short[]) — the third short array -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the three input arrays
- See also: Stream#merge(Object\[\], Object\[\], Object\[\], BiFunction)
-
Signature:
public static ShortStream merge(final ShortIterator a, final ShortIterator b, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges two ShortIterators into a single ShortStream based on the provided nextSelector function.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator -
b(ShortIterator) — the second ShortIterator -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the two input iterators
- See also: Stream#merge(Iterator, Iterator, BiFunction)
-
Signature:
public static ShortStream merge(final ShortIterator a, final ShortIterator b, final ShortIterator c, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges three ShortIterators into a single ShortStream based on the provided nextSelector function.
-
Parameters:
-
a(ShortIterator) — the first ShortIterator -
b(ShortIterator) — the second ShortIterator -
c(ShortIterator) — the third ShortIterator -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the three input iterators
- See also: Stream#merge(Iterator, Iterator, Iterator, BiFunction)
-
Signature:
public static ShortStream merge(final ShortStream a, final ShortStream b, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges two ShortStreams into a single ShortStream based on the provided nextSelector function.
-
Contract:
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream -
b(ShortStream) — the second ShortStream -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the two input streams
- See also: Stream#merge(Stream, Stream, BiFunction)
-
Signature:
public static ShortStream merge(final ShortStream a, final ShortStream b, final ShortStream c, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges three ShortStreams into a single ShortStream based on the provided nextSelector function.
-
Contract:
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first ShortStream -
b(ShortStream) — the second ShortStream -
c(ShortStream) — the third ShortStream -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the three input streams
- See also: Stream#merge(Stream, Stream, Stream, BiFunction)
-
Signature:
public static ShortStream merge(final Collection<? extends ShortStream> streams, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges a collection of ShortStreams into a single ShortStream based on the provided nextSelector function.
-
Contract:
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends ShortStream>) — the collection of ShortStreams to merge -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: a ShortStream containing the merged elements from the input streams
- See also: Stream#merge(Collection, BiFunction)
Public Instance Methods
takeWhile(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract ShortStream takeWhile(final ShortPredicate predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(ShortPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new Stream consisting of elements taken while the predicate returns true
- See also: Stream#takeWhile(Predicate)
dropWhile(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract ShortStream dropWhile(final ShortPredicate predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(ShortPredicate) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: Stream#dropWhile(Predicate)
map(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream map(ShortUnaryOperator mapper) - Summary: Returns a ShortStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ShortUnaryOperator) — a non-interfering, stateless function that transforms each element from short to short
-
- Returns: a new ShortStream consisting of the results of applying the mapper function to each element
- See also: Stream#map(Function)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(ShortToIntFunction mapper) - Summary: Returns an IntStream consisting of the results of applying the given function to the elements of this stream.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ShortToIntFunction) — a non-interfering, stateless function that transforms each element from short to int
-
- Returns: a new IntStream consisting of the results of applying the mapper function to each element
- See also: #map(ShortUnaryOperator), #mapToObj(ShortFunction)
mapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> mapToObj(ShortFunction<? extends T> mapper) - Summary: Returns an object-valued {@code Stream} consisting of the results of applying the given function to the elements of this stream.
-
Parameters:
-
mapper(ShortFunction<? extends T>) — a non-interfering, stateless function to apply to each element
-
- Returns: a new stream
flatMap(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream flatMap(ShortFunction<? extends ShortStream> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each element into a range ShortStream.of((short) 2, (short) 3, (short) 4) .flatMap(s -> ShortStream.range((short) 0, s)) .toArray(); // Returns \[(short) 0, (short) 1, (short) 0, (short) 1, (short) 2, (short) 0, (short) 1, (short) 2, (short) 3\] // Duplicate each element ShortStream.of((short) 1, (short) 2, (short) 3) .flatMap(s -> ShortStream.of(s, s)) .toArray(); // Returns \[(short) 1, (short) 1, (short) 2, (short) 2, (short) 3, (short) 3\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(ShortFunction<? extends ShortStream>) — a non-interfering, stateless function that transforms each element from short to ShortStream
-
- Returns: the new stream
- See also: Stream#flatMap(Function)
flatmap(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream flatmap(ShortFunction<short[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of the array produced by applying the provided mapping function to each element.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ShortFunction<short[]>) — a non-interfering, stateless function that transforms each element from short to short\[\]
-
- Returns: the new stream
- See also: #flatMap(ShortFunction), #flatMapToInt(ShortFunction), #flatMapToObj(ShortFunction)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(ShortFunction<? extends IntStream> mapper) - Summary: Returns an {@code IntStream} consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each short to a range of ints ShortStream.of((short) 2, (short) 3) .flatMapToInt(s -> IntStream.range(0, s)) .toArray(); // Returns \[0, 1, 0, 1, 2\] // Convert and duplicate each short ShortStream.of((short) 10, (short) 20) .flatMapToInt(s -> IntStream.of(s, s * 2)) .toArray(); // Returns \[10, 20, 20, 40\] } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(ShortFunction<? extends IntStream>) — a non-interfering, stateless function to apply to each element which produces an IntStream of new values
-
- Returns: the new stream
flatMapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatMapToObj(ShortFunction<? extends Stream<? extends T>> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
-
Contract:
- (If a mapped stream is {@code null} an empty stream is used, instead.) <p> <b> Usage Examples: </b> </p> <pre> {@code // Expand each short to multiple strings ShortStream.of((short) 1, (short) 2) .flatMapToObj(s -> Stream.of("A" + s, "B" + s)) .toList(); // Returns \["A1", "B1", "A2", "B2"\] // Generate objects based on short value ShortStream.of((short) 2, (short) 3) .flatMapToObj(s -> Stream.generate(() -> new Point(s, s)).limit(s)) .toList(); // Returns list with 2 Point(2,2) and 3 Point(3,3) } </pre> <p> This is an intermediate operation.
-
Parameters:
-
mapper(ShortFunction<? extends Stream<? extends T>>) — a non-interfering, stateless function to apply to each element which produces a Stream of new values
-
- Returns: the new stream
flatmapToObj(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T> Stream<T> flatmapToObj(ShortFunction<? extends Collection<? extends T>> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped collection produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(ShortFunction<? extends Collection<? extends T>>) — a non-interfering, stateless function to apply to each element which produces a Collection of new values
-
- Returns: the new stream
flattmapToObj(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <T> Stream<T> flattmapToObj(ShortFunction<T[]> mapper) - Summary: Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped array produced by applying the provided mapping function to each element.
-
Parameters:
-
mapper(ShortFunction<T[]>) — a non-interfering, stateless function to apply to each element which produces an array of new values
-
- Returns: the new stream
mapPartial(...) -> ShortStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract ShortStream mapPartial(ShortFunction<OptionalShort> mapper) - Summary: Returns a stream consisting of the results of applying the given function to the elements of this stream.
-
Parameters:
-
mapper(ShortFunction<OptionalShort>) — a non-interfering, stateless function to apply to each element
-
- Returns: the new stream containing only the mapped values that were present
rangeMap(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream rangeMap(final ShortBiPredicate sameRange, final ShortBinaryOperator mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(ShortBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(ShortBinaryOperator) — a function that maps a range (defined by its first and last element) to an output element
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
rangeMapToObj(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <T> Stream<T> rangeMapToObj(final ShortBiPredicate sameRange, final ShortBiFunction<? extends T> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\] to objects using the mapper function.
-
Parameters:
-
sameRange(ShortBiPredicate) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. Must be {@code non-null} . -
mapper(ShortBiFunction<? extends T>) — a function that maps a range (defined by its first and last element) to an output object of type T
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: Stream#rangeMap(BiPredicate, BiFunction)
collapse(...) -> Stream<ShortList>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<ShortList> collapse(final ShortBiPredicate collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, the resulting stream will contain \[\[1, 2\], \[5, 6, 7\], \[10\]\].
-
Parameters:
-
collapsible(ShortBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: Stream#collapse(BiPredicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream collapse(final ShortBiPredicate collapsible, final ShortBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(ShortBiPredicate) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(ShortBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream collapse(final ShortTriPredicate collapsible, final ShortBinaryOperator mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- <p> <b> Implementation Note: </b> For example, if this stream contains elements \[1, 2, 5, 6, 7, 10\] and the predicate tests whether the difference between consecutive elements is less than 3, and the merge function sums the elements, the resulting stream will contain \[3, 18, 10\].
-
Parameters:
-
collapsible(ShortTriPredicate) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(ShortBinaryOperator) — a function to merge two collapsible elements into one
-
- Returns: a stream of merged elements
- See also: Stream#collapse(BiPredicate, BinaryOperator)
scan(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream scan(final ShortBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
accumulator(ShortBinaryOperator) — a {@code ShortBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ShortStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream scan(final short init, final ShortBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(short) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(ShortBinaryOperator) — a {@code ShortBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ShortStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream scan(final short init, final boolean initIncluded, final ShortBinaryOperator accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Contract:
- This operation is sequential only, even when called on a parallel stream.
-
Parameters:
-
init(short) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(ShortBinaryOperator) — a {@code ShortBinaryOperator} that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new {@code ShortStream} consisting of the results of the scan operation on the elements of the original stream.
- See also: Stream#scan(Object, boolean, BiFunction)
prepend(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream prepend(final short... a) - Summary: Returns a stream consisting of the specified elements followed by the elements of this stream.
-
Parameters:
-
a(short[]) — the elements to prepend to this stream
-
- Returns: a new stream with the specified elements prepended
append(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream append(final short... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended.
-
Parameters:
-
a(short[]) — the elements to append to this stream
-
- Returns: a new stream with the specified elements appended
appendIfEmpty(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream appendIfEmpty(final short... a) - Summary: Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
-
Contract:
- Returns a stream consisting of the elements of this stream with the specified elements appended if this stream is empty.
- If this stream is not empty, returns this stream unchanged.
-
Parameters:
-
a(short[]) — the elements to append if this stream is empty
-
- Returns: this stream if not empty, otherwise a new stream containing the specified elements
top(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to return
-
- Returns: a new stream containing the top n elements
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream top(final int n, Comparator<? super Short> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to return -
comparator(Comparator<? super Short>) — a comparator to compare elements
-
- Returns: a new stream containing the top n elements
toShortList(...) -> ShortList
-
Signature:
@SequentialOnly @TerminalOp public abstract ShortList toShortList() - Summary: Returns a {@code ShortList} containing the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code ShortList} containing the elements of this stream
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.ShortFunction<? extends K, E> keyMapper, Throwables.ShortFunction<? extends V, E2> valueMapper) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.ShortFunction<? extends V, E2>) — a mapping function to produce values
-
- Returns: a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.ShortFunction<? extends K, E> keyMapper, Throwables.ShortFunction<? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), an {@code IllegalStateException} is thrown when the collection operation is performed.
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.ShortFunction<? extends V, E2>) — a mapping function to produce values -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.ShortFunction<? extends K, E> keyMapper, Throwables.ShortFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
- "even" : "odd", n -> (int)n, (v1, v2) -> v1 + v2); // Result: {odd=4, even=6} (1+3=4, 2+4=6) // Keep the first value when encountering duplicates Map<Integer, Short> firstMap = ShortStream.of((short)10, (short)20, (short)30, (short)40) .toMap(n -> n / 10, n -> n, (v1, v2) -> v1); // Result: {1=10, 2=20, 3=30, 4=40} // Keep the maximum value for duplicate keys Map<Integer, Short> maxMap = ShortStream.of((short)5, (short)2, (short)8, (short)3) .toMap(n -> n % 3, n -> n, (v1, v2) -> v1 > v2 ?
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.ShortFunction<? extends V, E2>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key
-
- Returns: a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.ShortFunction<? extends K, E> keyMapper, Throwables.ShortFunction<? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Returns a {@code Map} whose keys and values are the result of applying the provided mapping functions to the input elements.
-
Contract:
- If the mapped keys contain duplicates (according to {@link Object#equals(Object)} ), the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a mapping function to produce keys -
valueMapper(Throwables.ShortFunction<? extends V, E2>) — a mapping function to produce values -
mergeFunction(BinaryOperator<V>) — a merge function, used to resolve collisions between values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} whose keys and values are the result of applying mapping functions to the input elements
-
Throws:
-
E— if the key mapping function throws an exception -
E2— if the value mapping function throws an exception
-
- See also: Collectors#toMap(Function, Function, BinaryOperator, Supplier)
groupTo(...) -> Map<K, D>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.ShortFunction<? extends K, E> keyMapper, final Collector<? super Short, ?, D> downstream) throws E - Summary: Groups the elements of this stream according to a classification function and collects the elements in each group using the specified downstream collector.
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Short, ?, D>) — a {@code Collector} implementing the downstream reduction
-
- Returns: a {@code Map} containing the results of the group-and-reduce operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.ShortFunction<? extends K, E> keyMapper, final Collector<? super Short, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream according to a classification function and collects the elements in each group using the specified downstream collector.
-
Parameters:
-
keyMapper(Throwables.ShortFunction<? extends K, E>) — a classifier function mapping input elements to keys -
downstream(Collector<? super Short, ?, D>) — a {@code Collector} implementing the downstream reduction -
mapFactory(Supplier<? extends M>) — a supplier providing a new empty {@code Map} into which the results will be inserted
-
- Returns: a {@code Map} containing the results of the group-and-reduce operation
-
Throws:
-
E— if the classification function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
reduce(...) -> short
-
Signature:
@ParallelSupported @TerminalOp public abstract short reduce(short identity, ShortBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(short) — the initial value of the reduction operation -
accumulator(ShortBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: the result of the reduction
- See also: Stream#reduce(Object, BinaryOperator)
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalShort reduce(ShortBinaryOperator accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
accumulator(ShortBinaryOperator) — the function for combining the current reduced value and the current stream element
-
- Returns: an OptionalShort describing the result of the reduction. If the stream is empty, an empty {@code OptionalShort} is returned.
- See also: Stream#reduce(BinaryOperator)
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjShortConsumer<? super R> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjShortConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: Stream#collect(Supplier, BiConsumer, BiConsumer), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, ObjShortConsumer<? super R> accumulator) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <br/> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(ObjShortConsumer<? super R>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
- See also: #collect(Supplier, ObjShortConsumer, BiConsumer), Stream#collect(Supplier, BiConsumer), Stream#collect(Supplier, BiConsumer, BiConsumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(final Throwables.ShortConsumer<E> action) throws E - Summary: Performs an action for each element of this stream.
-
Parameters:
-
action(Throwables.ShortConsumer<E>) — a non-interfering action to perform on the elements
-
-
Throws:
-
E— if the action throws an exception
-
forEachIndexed(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntShortConsumer<E> action) throws E - Summary: Performs an action for each element of this stream, passing the element's index as well.
-
Parameters:
-
action(Throwables.IntShortConsumer<E>) — a non-interfering action to perform on the elements, taking both index and element
-
-
Throws:
-
E— if the action throws an exception
-
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns whether any elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code false} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if any element is greater than 10 boolean hasLarge = ShortStream.of((short)5, (short)12, (short)8) .anyMatch(n -> n > 10); // Returns true // Check if any element is negative boolean hasNegative = ShortStream.of((short)1, (short)2, (short)3) .anyMatch(n -> n < 0); // Returns false // Check if any element is even boolean hasEven = ShortStream.of((short)1, (short)3, (short)5, (short)6) .anyMatch(n -> n % 2 == 0); // Returns true (short-circuits at 6) // Empty stream always returns false boolean empty = ShortStream.empty() .anyMatch(n -> n > 0); // Returns false } </pre>
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if any elements of the stream match the provided predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns whether all elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if all elements are positive boolean allPositive = ShortStream.of((short)1, (short)2, (short)3) .allMatch(n -> n > 0); // Returns true // Check if all elements are even boolean allEven = ShortStream.of((short)2, (short)4, (short)5, (short)6) .allMatch(n -> n % 2 == 0); // Returns false (short-circuits at 5) // Check if all elements are within range boolean allInRange = ShortStream.of((short)10, (short)15, (short)20) .allMatch(n -> n >= 10 && n <= 20); // Returns true // Empty stream always returns true boolean empty = ShortStream.empty() .allMatch(n -> n > 100); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either all elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns whether no elements of this stream match the provided predicate.
-
Contract:
- May not evaluate the predicate on all elements if not necessary for determining the result.
- If the stream is empty then {@code true} is returned and the predicate is not evaluated.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Check if no elements are negative boolean noNegative = ShortStream.of((short)1, (short)2, (short)3) .noneMatch(n -> n < 0); // Returns true // Check if no elements are greater than 100 boolean noneAbove100 = ShortStream.of((short)10, (short)20, (short)150) .noneMatch(n -> n > 100); // Returns false (short-circuits at 150) // Check if no elements are even boolean noEven = ShortStream.of((short)1, (short)3, (short)5, (short)7) .noneMatch(n -> n % 2 == 0); // Returns true // Empty stream always returns true boolean empty = ShortStream.empty() .noneMatch(n -> n > 0); // Returns true } </pre>
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: {@code true} if either no elements of the stream match the provided predicate or the stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
findFirst(...) -> OptionalShort
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalShort findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code OptionalShort} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalShort} containing the first element of the stream, or an empty {@code OptionalShort} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.ShortPredicate), #findAny(Throwables.ShortPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalShort findFirst(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalShort} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
-
Contract:
- Returns an {@code OptionalShort} describing the first element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalShort} describing the first element that matches the predicate, or an empty {@code OptionalShort} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
findAny(...) -> OptionalShort
-
Signature:
@Beta @ParallelSupported @TerminalOp public OptionalShort findAny() - Summary: Returns some element in the stream, if present, otherwise returns an empty {@code OptionalShort} .
-
Contract:
- Returns some element in the stream, if present, otherwise returns an empty {@code OptionalShort} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code OptionalShort} containing some element of the stream, or an empty {@code OptionalShort} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.ShortPredicate), #findAny(Throwables.ShortPredicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalShort findAny(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalShort} describing some element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
-
Contract:
- Returns an {@code OptionalShort} describing some element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalShort} describing some element that matches the predicate, or an empty {@code OptionalShort} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
findLast(...) -> OptionalShort
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> OptionalShort findLast(final Throwables.ShortPredicate<E> predicate) throws E - Summary: Returns an {@code OptionalShort} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
-
Contract:
- Returns an {@code OptionalShort} describing the last element of this stream that matches the given predicate, or an empty {@code OptionalShort} if no such element is found.
- <p> Consider using: {@code stream.reversed().findFirst(predicate)} for better performance if possible.
- Consider using {@code reversed().findFirst(predicate)} for better performance when applicable.
-
Parameters:
-
predicate(Throwables.ShortPredicate<E>) — a non-interfering, stateless predicate that tests each element
-
- Returns: an {@code OptionalShort} describing the last element that matches the predicate, or an empty {@code OptionalShort} if no such element is found
-
Throws:
-
E— if the predicate throws an exception
-
min(...) -> OptionalShort
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalShort min() - Summary: Returns an {@code OptionalShort} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalShort} describing the minimum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalShort} containing the minimum element of this stream, or an empty {@code OptionalShort} if the stream is empty
max(...) -> OptionalShort
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalShort max() - Summary: Returns an {@code OptionalShort} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an {@code OptionalShort} describing the maximum element of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an {@code OptionalShort} containing the maximum element of this stream, or an empty {@code OptionalShort} if the stream is empty
kthLargest(...) -> OptionalShort
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalShort kthLargest(int k) - Summary: Returns the <i> k-th </i> largest element in the stream.
-
Contract:
- If the stream is empty or the count of elements is less than k, an empty {@code OptionalShort} is returned.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Find the 2nd largest element ShortStream.of((short) 10, (short) 30, (short) 20, (short) 50, (short) 40).kthLargest(2); // Returns OptionalShort\[40\] // Find the largest element (same as max) ShortStream.of((short) 5, (short) 2, (short) 8, (short) 1).kthLargest(1); // Returns OptionalShort\[8\] // When k exceeds stream size ShortStream.of((short) 1, (short) 2, (short) 3).kthLargest(5); // Returns OptionalShort.empty() } </pre>
-
Parameters:
-
k(int) — the position (1-based) of the largest element to retrieve
-
- Returns: an {@code OptionalShort} containing the k-th largest element, or an empty {@code OptionalShort} if the stream is empty or the count of elements is less than k
sum(...) -> int
-
Signature:
@SequentialOnly @TerminalOp public abstract int sum() - Summary: Returns the sum of elements in this stream.
-
Parameters:
- (none)
- Returns: the sum of elements in this stream
average(...) -> OptionalDouble
-
Signature:
@SequentialOnly @TerminalOp public abstract OptionalDouble average() - Summary: Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Contract:
- Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
-
Parameters:
- (none)
- Returns: an OptionalDouble containing the average element of this stream, or an empty optional if the stream is empty
summaryStatistics(...) -> ShortSummaryStatistics
-
Signature:
@SequentialOnly @TerminalOp public abstract ShortSummaryStatistics summaryStatistics() - Summary: Returns statistics about the elements of this stream.
-
Parameters:
- (none)
- Returns: a {@code ShortSummaryStatistics} describing various summary data about the elements of this stream
summaryStatisticsAndPercentiles(...) -> Pair<ShortSummaryStatistics, Optional<Map<Percentage, Short>>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Pair<ShortSummaryStatistics, Optional<Map<Percentage, Short>>> summaryStatisticsAndPercentiles() - Summary: Returns a pair consisting of ShortSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
-
Contract:
- Returns a pair consisting of ShortSummaryStatistics for the elements of this stream, and an Optional containing a map of percentiles if the stream is not empty.
- To calculates the percentiles of the elements in the stream, All elements will be loaded into memory and sorted if not yet.
-
Parameters:
- (none)
- Returns: a {@code Pair} containing summary statistics and a map of percentile values
mergeWith(...) -> ShortStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract ShortStream mergeWith(final ShortStream b, final ShortBiFunction<MergeResult> nextSelector) - Summary: Merges this stream with another stream, selecting elements based on the provided selector function.
-
Contract:
- The selector function determines which element to select when both streams have elements available.
-
Parameters:
-
b(ShortStream) — the stream to merge with -
nextSelector(ShortBiFunction<MergeResult>) — a function to determine which element should be selected as the next element. The first parameter is selected if {@code MergeResult.TAKE_FIRST} is returned, otherwise the second parameter is selected.
-
- Returns: the merged stream
zipWith(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream zipWith(ShortStream b, ShortBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(ShortStream) — the ShortStream to be combined with the current ShortStream. Must be {@code non-null} . -
zipFunction(ShortBinaryOperator) — a ShortBinaryOperator that determines the combination of elements in the combined ShortStream. Must be {@code non-null} .
-
- Returns: a new ShortStream that is the result of combining the current ShortStream with the given ShortStream
- See also: #zipWith(ShortStream, short, short, ShortBinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream zipWith(ShortStream b, ShortStream c, ShortTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(ShortStream) — the second ShortStream to be combined with the current ShortStream. Will be closed along with this ShortStream. -
c(ShortStream) — the third ShortStream to be combined with the current ShortStream. Will be closed along with this ShortStream. -
zipFunction(ShortTernaryOperator) — a ShortTernaryOperator that determines the combination of elements in the combined ShortStream. Must be {@code non-null} .
-
- Returns: a new ShortStream that is the result of combining the current ShortStream with the given ShortStreams
- See also: #zipWith(ShortStream, ShortStream, short, short, short, ShortTernaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream zipWith(ShortStream b, short valueForNoneA, short valueForNoneB, ShortBinaryOperator zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(ShortStream) — the ShortStream to be combined with the current ShortStream. Will be closed along with this ShortStream. -
valueForNoneA(short) — the default value to use for the current ShortStream when it runs out of elements -
valueForNoneB(short) — the default value to use for the given ShortStream when it runs out of elements -
zipFunction(ShortBinaryOperator) — a ShortBinaryOperator that determines the combination of elements in the combined ShortStream. Must be {@code non-null} .
-
- Returns: a new ShortStream that is the result of combining the current ShortStream with the given ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream zipWith(ShortStream b, ShortStream c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTernaryOperator zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(ShortStream) — the second ShortStream to be combined with the current ShortStream. Will be closed along with this ShortStream. -
c(ShortStream) — the third ShortStream to be combined with the current ShortStream. Will be closed along with this ShortStream. -
valueForNoneA(short) — the default value to use for the current ShortStream when it runs out of elements -
valueForNoneB(short) — the default value to use for the second ShortStream when it runs out of elements -
valueForNoneC(short) — the default value to use for the third ShortStream when it runs out of elements -
zipFunction(ShortTernaryOperator) — a ShortTernaryOperator that determines the combination of elements in the combined ShortStream. Must be {@code non-null} .
-
- Returns: a new ShortStream that is the result of combining the current ShortStream with the given ShortStreams
asIntStream(...) -> IntStream
-
Signature:
@SequentialOnly @IntermediateOp public abstract IntStream asIntStream() - Summary: Returns an {@code IntStream} consisting of the elements of this stream, converted to int.
-
Parameters:
- (none)
- Returns: an {@code IntStream} consisting of the elements of this stream, converted to int
boxed(...) -> Stream<Short>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Short> boxed() - Summary: Returns a Stream consisting of the elements of this stream, each boxed to a Short.
-
Parameters:
- (none)
- Returns: a Stream consisting of the elements of this stream, each boxed to a Short
Class ShortStreamEx (com.landawn.abacus.util.stream.ShortStream.ShortStreamEx)
An abstract extension class for ShortStream that allows for custom implementations and extensions of the base ShortStream functionality.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Class Stream (com.landawn.abacus.util.stream.Stream)
A powerful and enhanced stream processing API that extends the capabilities of Java's built-in Stream API with additional functionalities, optimizations, and more intuitive operations for functional-style data processing.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
empty(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> empty() - Summary: Returns an empty Stream.
-
Parameters:
- (none)
- Returns: an empty Stream
defer(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> defer(final Supplier<? extends Stream<? extends T>> supplier) throws IllegalArgumentException - Summary: Returns a Stream that is lazily populated by an input supplier.
-
Contract:
- <p> The supplier is invoked only when the returned stream is traversed, allowing for lazy initialization and dynamic stream generation.
- This is useful for expensive stream creation operations or when the stream content depends on runtime conditions.
-
Parameters:
-
supplier(Supplier<? extends Stream<? extends T>>) — the Supplier that generates the Stream.
-
- Returns: a Stream instance that will be populated by the supplier when consumed
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
from(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> from(final java.util.stream.Stream<? extends T> stream) - Summary: Creates a new Stream from the provided java.util.stream.Stream.
-
Parameters:
-
stream(java.util.stream.Stream<? extends T>) — the java.util.stream.Stream to convert. May be {@code null} (returns empty stream).
-
- Returns: a new Stream containing the elements of the provided java.util.stream.Stream
just(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> just(final T e) - Summary: Creates a stream containing a single element.
-
Contract:
- <p> This method is useful when you need to convert a single value into a stream for further processing or when combining with other streams.
-
Parameters:
-
e(T) — the element to be included in the stream
-
- Returns: a stream containing the specified element
ofNullable(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> ofNullable(final T e) - Summary: Returns an empty Stream if the specified element is {@code null} , otherwise returns a Stream containing the element.
-
Contract:
- Returns an empty Stream if the specified element is {@code null} , otherwise returns a Stream containing the element.
- <p> This method is useful for avoiding NullPointerException when creating streams from potentially {@code null} values.
-
Parameters:
-
e(T) — the element to be included in the stream, or null
-
- Returns: a stream containing the specified element, or an empty stream if the element is null
of(...) -> Stream<T>
-
Signature:
@SafeVarargs public static <T> Stream<T> of(final T... a) - Summary: Returns a stream containing the specified elements.
-
Parameters:
-
a(T[]) — the elements to be included in the stream
-
- Returns: a stream containing the specified elements. If the specified array is empty, an empty stream is returned.
-
Signature:
public static <T> Stream<T> of(final T[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given array.
-
Contract:
- This method is useful when you need to process only a portion of an array.
-
Parameters:
-
a(T[]) — the array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a Stream containing the specified range of elements
-
Throws:
-
java.lang.IndexOutOfBoundsException— if {@code fromIndex} is negative, {@code toIndex} is greater than the array length, or {@code fromIndex} is greater than {@code toIndex}
-
-
Signature:
public static <T> Stream<T> of(final Collection<? extends T> c) - Summary: Returns a stream containing elements from the given collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection from which elements are to be included in the stream
-
- Returns: a stream containing the specified elements from the collection
-
Signature:
public static <T> Stream<T> of(final Collection<? extends T> c, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given collection.
-
Contract:
- This method is useful when you need to process only a portion of a collection.
-
Parameters:
-
c(Collection<? extends T>) — the collection from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the collection -
toIndex(int) — the ending index (exclusive) of the collection
-
- Returns: a stream containing the specified elements from the collection
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static <K, V> Stream<Map.Entry<K, V>> of(final Map<? extends K, ? extends V> map) - Summary: Returns a stream containing the entries from the given map.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map from which entries are to be included in the stream
-
- Returns: a stream containing the specified entries from the map
-
Signature:
public static <T> Stream<T> of(final Iterable<? extends T> iterable) - Summary: Returns a stream containing the elements of the specified iterable.
-
Contract:
- <p> If the iterable is a Collection, it will use the optimized Collection-specific implementation.
-
Parameters:
-
iterable(Iterable<? extends T>) — the iterable whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified iterable
-
Signature:
public static <T> Stream<T> of(final Iterator<? extends T> iterator) - Summary: Returns a stream containing the elements of the specified iterator.
-
Parameters:
-
iterator(Iterator<? extends T>) — the iterator whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified iterator
-
Signature:
@Deprecated public static <T> Stream<T> of(final java.util.stream.Stream<? extends T> stream) - Summary: Returns a stream containing the elements of the specified JDK stream.
-
Parameters:
-
stream(java.util.stream.Stream<? extends T>) — the JDK stream whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified JDK stream
- See also: #from(java.util.stream.Stream)
-
Signature:
public static <T> Stream<T> of(final Enumeration<? extends T> enumeration) - Summary: Returns a stream containing the elements of the specified enumeration.
-
Parameters:
-
enumeration(Enumeration<? extends T>) — the enumeration whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified enumeration
-
Signature:
public static Stream<Boolean> of(final boolean[] a) - Summary: Returns a stream containing the elements of the specified boolean array.
-
Parameters:
-
a(boolean[]) — the boolean array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified boolean array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Boolean> of(final boolean[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given boolean array.
-
Parameters:
-
a(boolean[]) — the boolean array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Character> of(final char[] a) - Summary: Returns a stream containing the elements of the specified char array.
-
Parameters:
-
a(char[]) — the char array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified char array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Character> of(final char[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given char array.
-
Parameters:
-
a(char[]) — the char array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Byte> of(final byte[] a) - Summary: Returns a stream containing the elements of the specified byte array.
-
Parameters:
-
a(byte[]) — the byte array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified byte array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Byte> of(final byte[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given byte array.
-
Parameters:
-
a(byte[]) — the byte array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Short> of(final short[] a) - Summary: Returns a stream containing the elements of the specified short array.
-
Parameters:
-
a(short[]) — the short array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified short array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Short> of(final short[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given short array.
-
Parameters:
-
a(short[]) — the short array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Integer> of(final int[] a) - Summary: Returns a stream containing the elements of the specified int array.
-
Parameters:
-
a(int[]) — the int array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified int array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Integer> of(final int[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given int array.
-
Parameters:
-
a(int[]) — the int array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Long> of(final long[] a) - Summary: Returns a stream containing the elements of the specified long array.
-
Parameters:
-
a(long[]) — the long array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified long array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Long> of(final long[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given long array.
-
Parameters:
-
a(long[]) — the long array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Float> of(final float[] a) - Summary: Returns a stream containing the elements of the specified float array.
-
Parameters:
-
a(float[]) — the float array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified float array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Float> of(final float[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given float array.
-
Parameters:
-
a(float[]) — the float array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static Stream<Double> of(final double[] a) - Summary: Returns a stream containing the elements of the specified double array.
-
Parameters:
-
a(double[]) — the double array whose elements are to be included in the stream
-
- Returns: a stream containing the elements of the specified double array. If the specified array is empty, an empty stream is returned.
-
Signature:
public static Stream<Double> of(final double[] a, final int fromIndex, final int toIndex) throws IndexOutOfBoundsException - Summary: Returns a stream containing the elements within the specified range from the given double array.
-
Parameters:
-
a(double[]) — the double array from which elements are to be included in the stream -
fromIndex(int) — the starting index (inclusive) of the array -
toIndex(int) — the ending index (exclusive) of the array
-
- Returns: a stream containing the specified elements from the array
-
Throws:
-
java.lang.IndexOutOfBoundsException— if the specified start index or end index is out of bounds
-
-
Signature:
public static <T> Stream<T> of(final Optional<T> op) - Summary: Returns a stream containing the element of the specified Optional if it is present.
-
Contract:
- Returns a stream containing the element of the specified Optional if it is present.
- <p> If the Optional is empty or {@code null} , an empty stream is returned.
-
Parameters:
-
op(Optional<T>) — the Optional whose element is to be included in the stream
-
- Returns: a stream containing the element of the specified Optional if it is present, otherwise an empty stream
-
Signature:
public static <T> Stream<T> of(final java.util.Optional<T> op) - Summary: Returns a stream containing the element of the specified java.util.Optional if it is present.
-
Contract:
- Returns a stream containing the element of the specified java.util.Optional if it is present.
- <p> If the Optional is empty or {@code null} , an empty stream is returned.
-
Parameters:
-
op(java.util.Optional<T>) — the Optional whose element is to be included in the stream
-
- Returns: a stream containing the element of the specified Optional if it is present, otherwise an empty stream
ofKeys(...) -> Stream<K>
-
Signature:
public static <K> Stream<K> ofKeys(final Map<? extends K, ?> map) - Summary: Returns a stream containing the keys of the specified map.
-
Parameters:
-
map(Map<? extends K, ?>) — the map whose keys are to be included in the stream
-
- Returns: a stream containing the keys of the specified map
-
Signature:
public static <K, V> Stream<K> ofKeys(final Map<? extends K, ? extends V> map, final Predicate<? super V> valueFilter) - Summary: Returns a stream containing the keys of the specified map whose values match the given predicate.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose keys are to be included in the stream -
valueFilter(Predicate<? super V>) — the predicate to filter the values
-
- Returns: a stream containing the keys of the specified map whose values match the given predicate
-
Signature:
public static <K, V> Stream<K> ofKeys(final Map<? extends K, ? extends V> map, final BiPredicate<? super K, ? super V> filter) - Summary: Returns a stream containing the keys of the specified map whose entries match the given bi-predicate.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose keys are to be included in the stream -
filter(BiPredicate<? super K, ? super V>) — the bi-predicate to filter the entries
-
- Returns: a stream containing the keys of the specified map whose entries match the given bi-predicate
ofValues(...) -> Stream<V>
-
Signature:
public static <V> Stream<V> ofValues(final Map<?, ? extends V> map) - Summary: Returns a stream containing the values of the specified map.
-
Parameters:
-
map(Map<?, ? extends V>) — the map whose values are to be included in the stream
-
- Returns: a stream containing the values of the specified map
-
Signature:
public static <K, V> Stream<V> ofValues(final Map<? extends K, ? extends V> map, final Predicate<? super K> keyFilter) - Summary: Returns a stream containing the values of the specified map whose keys match the given predicate.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose values are to be included in the stream -
keyFilter(Predicate<? super K>) — the predicate to filter the keys
-
- Returns: a stream containing the values of the specified map whose keys match the given predicate
-
Signature:
public static <K, V> Stream<V> ofValues(final Map<? extends K, ? extends V> map, final BiPredicate<? super K, ? super V> filter) - Summary: Returns a stream containing the values of the specified map whose entries match the given bi-predicate.
-
Parameters:
-
map(Map<? extends K, ? extends V>) — the map whose values are to be included in the stream -
filter(BiPredicate<? super K, ? super V>) — the bi-predicate to filter the entries
-
- Returns: a stream containing the values of the specified map whose entries match the given bi-predicate
ofReversed(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> ofReversed(final T[] array) - Summary: Returns a stream containing the elements of the specified array in reverse order.
-
Parameters:
-
array(T[]) — the array whose elements are to be included in the stream in reverse order
-
- Returns: a stream containing the elements of the specified array in reverse order
-
Signature:
public static <T> Stream<T> ofReversed(final List<? extends T> list) - Summary: Returns a stream containing the elements of the specified list in reverse order.
-
Parameters:
-
list(List<? extends T>) — the list whose elements are to be included in the stream in reverse order
-
- Returns: a stream containing the elements of the specified list in reverse order
range(...) -> Stream<Integer>
-
Signature:
public static Stream<Integer> range(final int startInclusive, final int endExclusive) - Summary: Returns a stream of integers within the specified range.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive)
-
- Returns: a stream of integers from startInclusive (inclusive) to endExclusive (exclusive)
-
Signature:
public static Stream<Integer> range(final int startInclusive, final int endExclusive, final int by) - Summary: Returns a stream of integers within the specified range with a specified step.
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endExclusive(int) — the ending value (exclusive) -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent integer
-
- Returns: a stream of integers from startInclusive (inclusive) to endExclusive (exclusive) with the specified step
-
Signature:
public static Stream<Long> range(final long startInclusive, final long endExclusive) - Summary: Returns a stream of longs within the specified range.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive)
-
- Returns: a stream of longs from startInclusive (inclusive) to endExclusive (exclusive)
-
Signature:
public static Stream<Long> range(final long startInclusive, final long endExclusive, final long by) - Summary: Returns a stream of longs within the specified range with a specified step.
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endExclusive(long) — the ending value (exclusive) -
by(long) — the step to increment (if positive) or decrement (if negative) for each subsequent long
-
- Returns: a stream of longs from startInclusive (inclusive) to endExclusive (exclusive) with the specified step
rangeClosed(...) -> Stream<Integer>
-
Signature:
public static Stream<Integer> rangeClosed(final int startInclusive, final int endInclusive) - Summary: Returns a stream of integers within the specified range (inclusive).
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive)
-
- Returns: a stream of integers from startInclusive (inclusive) to endInclusive (inclusive)
-
Signature:
public static Stream<Integer> rangeClosed(final int startInclusive, final int endInclusive, final int by) - Summary: Returns a stream of integers within the specified range with a specified step.
-
Contract:
- <p> The stream contains integers starting from startInclusive, incrementing by the step value, up to and including endInclusive (if reachable by the step).
-
Parameters:
-
startInclusive(int) — the starting value (inclusive) -
endInclusive(int) — the ending value (inclusive) -
by(int) — the step to increment (if positive) or decrement (if negative) for each subsequent integer
-
- Returns: a stream of integers from startInclusive (inclusive) to endInclusive (inclusive) with the specified step
-
Signature:
public static Stream<Long> rangeClosed(final long startInclusive, final long endInclusive) - Summary: Returns a stream of longs within the specified range (inclusive).
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive)
-
- Returns: a stream of longs from startInclusive (inclusive) to endInclusive (inclusive)
-
Signature:
public static Stream<Long> rangeClosed(final long startInclusive, final long endInclusive, final long by) - Summary: Returns a stream of longs within the specified range with a specified step.
-
Contract:
- <p> The stream contains longs starting from startInclusive, incrementing by the step value, up to and including endInclusive (if reachable by the step).
-
Parameters:
-
startInclusive(long) — the starting value (inclusive) -
endInclusive(long) — the ending value (inclusive) -
by(long) — the step to increment (if positive) or decrement (if negative) for each subsequent long
-
- Returns: a stream of longs from startInclusive (inclusive) to endInclusive (inclusive) with the specified step
split(...) -> Stream<String>
-
Signature:
public static Stream<String> split(final CharSequence str, final char delimiter) - Summary: Splits the given character sequence by the specified delimiter and returns a stream of the resulting substrings.
-
Contract:
- Empty strings may be included if there are consecutive delimiters.
-
Parameters:
-
str(CharSequence) — the character sequence to be split -
delimiter(char) — the character used as the delimiter
-
- Returns: a stream of substrings resulting from splitting the input character sequence by the delimiter
-
Signature:
public static Stream<String> split(final CharSequence str, final CharSequence delimiter) - Summary: Splits the given character sequence by the specified delimiter and returns a stream of the resulting substrings.
-
Contract:
- Empty strings may be included if there are consecutive delimiters.
-
Parameters:
-
str(CharSequence) — the character sequence to be split -
delimiter(CharSequence) — the character sequence used as the delimiter
-
- Returns: a stream of substrings resulting from splitting the input character sequence by the delimiter
-
Signature:
public static Stream<String> split(final CharSequence str, final Pattern pattern) - Summary: Splits the given character sequence by the specified pattern and returns a stream of the resulting substrings.
-
Contract:
- Empty strings may be included if there are consecutive matches.
-
Parameters:
-
str(CharSequence) — the character sequence to be split -
pattern(Pattern) — the pattern used as the delimiter
-
- Returns: a stream of substrings resulting from splitting the input character sequence by the pattern
splitToLines(...) -> Stream<String>
-
Signature:
@Beta public static Stream<String> splitToLines(final String str) - Summary: Splits the given string into lines and returns a stream of the resulting lines.
-
Parameters:
-
str(String) — the string to be split into lines
-
- Returns: a stream of lines resulting from splitting the input string
-
Signature:
@Beta public static Stream<String> splitToLines(final String str, final boolean trim, final boolean omitEmptyLines) - Summary: Splits the given string into lines and returns a stream of the resulting lines.
-
Parameters:
-
str(String) — the string to be split into lines -
trim(boolean) — whether to trim each line -
omitEmptyLines(boolean) — whether to omit empty lines
-
- Returns: a stream of lines resulting from splitting the input string
splitByChunkCount(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> splitByChunkCount(final int totalSize, final int maxChunkCount, final IntBiFunction<? extends T> mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- For example, if totalSize is 10 and maxChunkCount is 3, the chunks will have sizes \[4, 3, 3\].
- The length of returned Stream may be less than the specified maxChunkCount if the input totalSize is less than maxChunkCount.
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
mapper(IntBiFunction<? extends T>) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: a Stream of the mapped chunk values
- See also: #splitByChunkCount(int, int, boolean, IntBiFunction)
-
Signature:
public static <T> Stream<T> splitByChunkCount(final int totalSize, final int maxChunkCount, final boolean sizeSmallerFirst, final IntBiFunction<? extends T> mapper) - Summary: Splits the total size into chunks based on the specified maximum chunk count.
-
Contract:
- The length of returned Stream may be less than the specified maxChunkCount if the input totalSize is less than maxChunkCount.
-
Parameters:
-
totalSize(int) — the total size to be split. It could be the size of an array, list, etc. -
maxChunkCount(int) — the maximum number of chunks to split into -
sizeSmallerFirst(boolean) — if {@code true} , smaller chunks will be created first; otherwise, larger chunks will be created first -
mapper(IntBiFunction<? extends T>) — a function to map the chunk from and to index to an element in the resulting stream
-
- Returns: a Stream of the mapped chunk values
- See also: IntStream#splitByChunkCount(int, int, boolean, IntBinaryOperator)
flatten(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> flatten(final Collection<? extends Collection<? extends T>> c) - Summary: Flattens a collection of collections into a single stream of elements.
-
Parameters:
-
c(Collection<? extends Collection<? extends T>>) — the collection of collections to be flattened
-
- Returns: a stream of elements from the flattened collections
-
Signature:
public static <T> Stream<T> flatten(final T[][] a) - Summary: Flattens a two-dimensional array into a single stream of elements.
-
Parameters:
-
a(T[][]) — the two-dimensional array to be flattened
-
- Returns: a stream of elements from the flattened array
-
Signature:
public static <T> Stream<T> flatten(final T[][] a, final boolean vertically) - Summary: Flattens a two-dimensional array into a single stream of elements.
-
Parameters:
-
a(T[][]) — the two-dimensional array to be flattened -
vertically(boolean) — if {@code true} , the array is flattened vertically (column by column); otherwise, it is flattened horizontally (row by row)
-
- Returns: a stream of elements from the flattened array
-
Signature:
public static <T> Stream<T> flatten(final T[][] a, final T valueForAlignment, final boolean vertically) - Summary: Flattens a two-dimensional array into a single stream of elements with alignment.
-
Contract:
- If arrays have different lengths, the valueForAlignment is used to pad shorter arrays.
-
Parameters:
-
a(T[][]) — the two-dimensional array to be flattened -
valueForAlignment(T) — the element to append so there are the same number of elements in all rows/columns -
vertically(boolean) — if {@code true} , the array is flattened vertically; otherwise, it is flattened horizontally
-
- Returns: a stream of elements from the flattened array
-
Signature:
public static <T> Stream<T> flatten(final T[][][] a) - Summary: Flattens a three-dimensional array into a single stream of elements.
-
Parameters:
-
a(T[][][]) — the three-dimensional array to be flattened
-
- Returns: a stream of elements from the flattened array
repeat(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> repeat(final T element, final long n) throws IllegalArgumentException - Summary: Creates a stream that repeats the given element a specified number of times.
-
Contract:
- If n is 0, an empty stream is returned.
-
Parameters:
-
element(T) — the element to be repeated -
n(long) — the number of times to repeat the element
-
- Returns: a stream of the repeated element
-
Throws:
-
java.lang.IllegalArgumentException— if the number of repetitions is negative
-
iterate(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> iterate(final BooleanSupplier hasNext, final Supplier<? extends T> next) throws IllegalArgumentException - Summary: Creates a stream that iterates using the given hasNext and next suppliers.
-
Parameters:
-
hasNext(BooleanSupplier) — a BooleanSupplier that returns {@code true} if the iteration should continue -
next(Supplier<? extends T>) — a Supplier that provides the next element in the iteration
-
- Returns: a stream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if hasNext or next is null
-
-
Signature:
public static <T> Stream<T> iterate(final T init, final BooleanSupplier hasNext, final UnaryOperator<T> f) throws IllegalArgumentException - Summary: Returns a Stream produced by iterative application of a function to an initial element.
-
Parameters:
-
init(T) — the initial element -
hasNext(BooleanSupplier) — a predicate that returns {@code true} if the iteration should continue -
f(UnaryOperator<T>) — a function to apply to the previous element to generate the next element
-
- Returns: a stream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if the initial element, hasNext or f is null
-
-
Signature:
public static <T> Stream<T> iterate(final T init, final Predicate<? super T> hasNext, final UnaryOperator<T> f) throws IllegalArgumentException - Summary: Creates a stream that iterates from an initial value, applying a function to generate subsequent values.
-
Contract:
- The predicate is tested on the value that would be returned, so the first element is init (if it satisfies the predicate).
-
Parameters:
-
init(T) — the initial value -
hasNext(Predicate<? super T>) — test if has next by hasNext.test(init) for first time and hasNext.test(f.apply(previous)) for remaining -
f(UnaryOperator<T>) — a function to apply to the previous element to generate the next element
-
- Returns: a stream of elements generated by the iteration
-
Throws:
-
java.lang.IllegalArgumentException— if the initial element, hasNext or f is null
-
-
Signature:
public static <T> Stream<T> iterate(final T init, final UnaryOperator<T> f) throws IllegalArgumentException - Summary: Creates a stream that iterates over elements starting from the given initial value.
-
Contract:
- This creates an infinite stream, so it should be used with limiting operations like limit() or takeWhile().
-
Parameters:
-
init(T) — the initial element -
f(UnaryOperator<T>) — the function to apply to the previous element to produce the next element
-
- Returns: a stream of elements generated by iterating with the given function
-
Throws:
-
java.lang.IllegalArgumentException— if the initial element or f is null
-
generate(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> generate(final Supplier<T> supplier) throws IllegalArgumentException - Summary: Generates a Stream using the provided Supplier.
-
Contract:
- Since this creates an infinite stream, it should be used with limiting operations like limit() or takeWhile().
-
Parameters:
-
supplier(Supplier<T>) — the Supplier that provides the elements of the stream.
-
- Returns: a Stream generated by the given supplier
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
ofLines(...) -> Stream<String>
-
Signature:
public static Stream<String> ofLines(final File file) - Summary: Creates a stream of lines from the specified file.
-
Contract:
- The underlying file resources are automatically closed when the stream is closed.
-
Parameters:
-
file(File) — the file to read lines from
-
- Returns: a stream of lines from the file
-
Signature:
public static Stream<String> ofLines(final File file, final Charset charset) - Summary: Creates a stream of lines from the specified file.
-
Contract:
- The underlying file resources are automatically closed when the stream is closed.
-
Parameters:
-
file(File) — the file to read lines from -
charset(Charset) — the character set to use for reading the file
-
- Returns: a stream of lines from the file
-
Signature:
public static Stream<String> ofLines(final Path path) - Summary: Creates a stream of lines from the specified path.
-
Contract:
- The underlying file resources are automatically closed when the stream is closed.
-
Parameters:
-
path(Path) — the path to read lines from
-
- Returns: a stream of lines from the path
-
Signature:
public static Stream<String> ofLines(final Path path, final Charset charset) - Summary: Creates a stream of lines from the specified path.
-
Contract:
- The underlying file resources are automatically closed when the stream is closed.
-
Parameters:
-
path(Path) — the path to read lines from -
charset(Charset) — the character set to use for reading the file
-
- Returns: a stream of lines from the path
-
Signature:
public static Stream<String> ofLines(final Reader reader) - Summary: Creates a stream of lines from the given Reader.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code Reader reader = new FileReader("data.txt"); Stream<String> lines = Stream.ofLines(reader); lines.forEach(System.out::println); reader.close(); // User must close the reader } </pre>
-
Parameters:
-
reader(Reader) — the Reader to read lines from
-
- Returns: a Stream of lines read from the Reader
-
Signature:
public static Stream<String> ofLines(final Reader reader, final boolean closeReaderWhenStreamIsClosed) throws IllegalArgumentException - Summary: Creates a stream of lines from the given Reader.
-
Contract:
- If closeReaderWhenStreamIsClosed is {@code true} , the Reader will be automatically closed when the stream is closed.
-
Parameters:
-
reader(Reader) — the Reader to read lines from -
closeReaderWhenStreamIsClosed(boolean) — if {@code true} , the input Reader will be closed when the stream is closed
-
- Returns: a Stream of lines read from the Reader
-
Throws:
-
java.lang.IllegalArgumentException— if the reader is null
-
listFiles(...) -> Stream<File>
-
Signature:
public static Stream<File> listFiles(final File parentPath) - Summary: Lists the files in the specified parent directory.
-
Contract:
- If the directory doesn't exist, an empty stream is returned.
-
Parameters:
-
parentPath(File) — the parent directory to list files from
-
- Returns: a stream of files in the parent directory
-
Signature:
public static Stream<File> listFiles(final File parentPath, final boolean recursively) - Summary: Lists the files in the specified parent directory.
-
Contract:
- <p> If recursively is {@code false} , returns only direct children of the directory.
- If recursively is {@code true} , returns all files and directories in the entire directory tree.
-
Parameters:
-
parentPath(File) — the parent directory to list files from -
recursively(boolean) — if {@code true} , lists files recursively in sub-directories
-
- Returns: a stream of files in the parent directory
-
Signature:
public static Stream<File> listFiles(final File parentPath, final boolean recursively, final boolean excludeDirectory) - Summary: Lists the files in the specified parent directory.
-
Contract:
- <p> If recursively is {@code true} , traverses the entire directory tree.
- If excludeDirectory is {@code true} , only regular files are included (directories are excluded).
-
Parameters:
-
parentPath(File) — the parent directory to list files from -
recursively(boolean) — if {@code true} , lists files recursively in sub-directories -
excludeDirectory(boolean) — if {@code true} , excludes directories from the stream
-
- Returns: a stream of files in the parent directory
interval(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> interval(final long intervalInMillis, final Supplier<T> s) - Summary: Creates a stream that generates elements at fixed intervals.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
intervalInMillis(long) — the interval in milliseconds between each element generation -
s(Supplier<T>) — the supplier that generates the elements
-
- Returns: a stream that generates elements at the specified interval
-
Signature:
public static <T> Stream<T> interval(final long delayInMillis, final long intervalInMillis, final Supplier<T> s) - Summary: Creates a stream that generates elements at fixed intervals after an initial delay.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
delayInMillis(long) — the initial delay in milliseconds before the first element is generated -
intervalInMillis(long) — the interval in milliseconds between each element generation -
s(Supplier<T>) — the supplier that generates the elements
-
- Returns: a stream that generates elements at the specified interval after the initial delay
-
Signature:
public static <T> Stream<T> interval(final long delay, final long interval, final TimeUnit unit, final Supplier<T> s) throws IllegalArgumentException - Summary: Creates a stream that generates elements at fixed intervals after an initial delay.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
delay(long) — the initial delay before the first element is generated -
interval(long) — the interval between each element generation -
unit(TimeUnit) — the time unit of the delay and interval -
s(Supplier<T>) — the supplier that generates the elements
-
- Returns: a stream that generates elements at the specified interval after the initial delay
-
Throws:
-
java.lang.IllegalArgumentException— if the supplier is null
-
- See also: LongStream#interval(long, long, TimeUnit)
-
Signature:
public static <T> Stream<T> interval(final long intervalInMillis, final LongFunction<? extends T> s) - Summary: Creates a stream that generates elements at fixed intervals.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
intervalInMillis(long) — the interval in milliseconds between each element generation -
s(LongFunction<? extends T>) — the function that generates the elements based on the current time in milliseconds
-
- Returns: a stream that generates elements at the specified interval
-
Signature:
public static <T> Stream<T> interval(final long delayInMillis, final long intervalInMillis, final LongFunction<? extends T> s) - Summary: Creates a stream that generates elements at fixed intervals after an initial delay.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
delayInMillis(long) — the initial delay in milliseconds before the first element is generated -
intervalInMillis(long) — the interval in milliseconds between each element generation -
s(LongFunction<? extends T>) — the function that generates the elements based on the current time in milliseconds
-
- Returns: a stream that generates elements at the specified interval after the initial delay
-
Signature:
public static <T> Stream<T> interval(final long delay, final long interval, final TimeUnit unit, final LongFunction<? extends T> s) throws IllegalArgumentException - Summary: Creates a stream that generates elements at fixed intervals after an initial delay.
-
Contract:
- This creates an infinite stream that should be used with limiting operations or closed when done.
-
Parameters:
-
delay(long) — the initial delay before the first element is generated -
interval(long) — the interval between each element generation -
unit(TimeUnit) — the time unit of the delay and interval -
s(LongFunction<? extends T>) — the function that generates the elements based on the current time in the specified unit
-
- Returns: a stream that generates elements at the specified interval after the initial delay
-
Throws:
-
java.lang.IllegalArgumentException— if the function is null
-
- See also: LongStream#interval(long, long, TimeUnit)
observe(...) -> Stream<T>
-
Signature:
@Beta public static <T> Stream<T> observe(final BlockingQueue<T> queue, final Duration duration) throws IllegalArgumentException - Summary: Observes a blocking queue and creates a stream that polls elements from the queue for the specified duration.
-
Parameters:
-
queue(BlockingQueue<T>) — the blocking queue to observe -
duration(Duration) — the total time to observe the queue
-
- Returns: a stream that polls elements from the queue at the specified interval
-
Throws:
-
java.lang.IllegalArgumentException— if the queue or duration is null
-
-
Signature:
@Beta public static <T> Stream<T> observe(final BlockingQueue<T> queue, final BooleanSupplier hasMore, final long maxWaitIntervalInMillis) throws IllegalArgumentException - Summary: Observes a blocking queue and creates a stream that polls elements from the queue at fixed intervals.
-
Parameters:
-
queue(BlockingQueue<T>) — the blocking queue to observe -
hasMore(BooleanSupplier) — it will will be set to {@code true} if Stream is completed and the upstream should not continue to put elements to queue when it's completed. This is an output parameter. -
maxWaitIntervalInMillis(long) — the maximum wait interval in milliseconds between polling the queue
-
- Returns: a stream that polls elements from the queue at the specified interval
-
Throws:
-
java.lang.IllegalArgumentException— if the queue or hasMore is {@code null} , or if maxWaitIntervalInMillis is negative
-
concat(...) -> Stream<T>
-
Signature:
@SafeVarargs public static <T> Stream<T> concat(final T[]... a) - Summary: Concatenates multiple arrays into a single stream.
-
Contract:
- If no arrays are provided, an empty stream is returned.
-
Parameters:
-
a(T[][]) — the arrays to be concatenated. Can be empty or contain {@code null} arrays (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided arrays
- See also: #concat(Iterable...), #concat(Iterator...), #concat(Stream...)
-
Signature:
@SafeVarargs public static <T> Stream<T> concat(final Iterable<? extends T>... a) - Summary: Concatenates multiple iterables into a single stream.
-
Contract:
- If no iterables are provided, an empty stream is returned.
-
Parameters:
-
a(Iterable<? extends T>[]) — the iterables to be concatenated. Can be empty or contain {@code null} iterables (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided iterables
- See also: #concat(Object\[\]\[\]), #concat(Iterator...), #concat(Stream...)
-
Signature:
@SafeVarargs public static <T> Stream<T> concat(final Iterator<? extends T>... a) - Summary: Concatenates multiple iterators into a single stream.
-
Contract:
- If no iterators are provided, an empty stream is returned.
-
Parameters:
-
a(Iterator<? extends T>[]) — the iterators to be concatenated. Can be empty or contain {@code null} iterators (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided iterators
- See also: #concat(Object\[\]\[\]), #concat(Iterable...), #concat(Stream...)
-
Signature:
@SafeVarargs public static <T> Stream<T> concat(final Stream<? extends T>... a) - Summary: Concatenates multiple streams into a single stream.
-
Contract:
- If no streams are provided, an empty stream is returned.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(Stream<? extends T>[]) — the streams to be concatenated. Can be empty or contain {@code null} streams (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided streams
- See also: #concat(Object\[\]\[\]), #concat(Iterable...), #concat(Iterator...)
-
Signature:
public static <T> Stream<T> concat(final Collection<? extends Stream<? extends T>> streams) - Summary: Concatenates multiple streams from a collection into a single stream.
-
Contract:
- If the collection is empty, an empty stream is returned.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be concatenated. Can be empty or contain {@code null} streams (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided streams
- See also: #concat(Stream...), #concatIterables(Collection), #concatIterators(Collection)
concatIterables(...) -> Stream<T>
-
Signature:
@Beta public static <T> Stream<T> concatIterables(final Collection<? extends Iterable<? extends T>> iterables) - Summary: Concatenates multiple iterables from a collection into a single stream.
-
Contract:
- If the collection is empty, an empty stream is returned.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterable to be concatenated. Can be empty or contain {@code null} iterables (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided iterables
- See also: #concat(Iterable...), #concatIterators(Collection)
concatIterators(...) -> Stream<T>
-
Signature:
@Beta public static <T> Stream<T> concatIterators(final Collection<? extends Iterator<? extends T>> c) - Summary: Concatenates multiple iterators from a collection into a single stream.
-
Contract:
- If the collection is empty, an empty stream is returned.
-
Parameters:
-
c(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be concatenated. Can be empty or contain {@code null} iterators (which are treated as empty)
-
- Returns: a stream containing all the elements of the provided iterators
- See also: #concat(Iterator...), #concatIterables(Collection)
parallelConcat(...) -> Stream<T>
-
Signature:
@SafeVarargs public static <T> Stream<T> parallelConcat(final Iterator<? extends T>... a) - Summary: Returns a stream with elements from multiple iterators fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple iterators, which can improve performance when reading from slow sources.
-
Parameters:
-
a(Iterator<? extends T>[]) — the iterators to be concatenated in parallel
-
- Returns: a stream containing all elements from the provided iterators
- See also: #concat(Iterator...), #parallelConcatIterators(Collection, int, int)
-
Signature:
@SafeVarargs public static <T> Stream<T> parallelConcat(final Stream<? extends T>... a) - Summary: Returns a stream with elements from multiple streams fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple streams, which can improve performance when reading from slow sources.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(Stream<? extends T>[]) — the streams to be concatenated in parallel
-
- Returns: a stream containing all elements from the provided streams
- See also: #concat(Stream...), #parallelConcat(Collection, int, int)
-
Signature:
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> streams) - Summary: Returns a stream with elements from multiple streams fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple streams, which can improve performance when reading from slow sources.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be concatenated in parallel
-
- Returns: a stream containing all elements from the provided streams
- See also: #concat(Collection), #parallelConcat(Collection, int)
-
Signature:
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> streams, final int readThreadNum) - Summary: Returns a stream with elements from multiple streams fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple streams, which can improve performance when reading from slow sources.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be concatenated in parallel -
readThreadNum(int) — the number of threads used to read elements from streams. Default is min(64, CPU cores)
-
- Returns: a stream containing all elements from the provided streams
- See also: #parallelConcat(Collection), #parallelConcat(Collection, int, int)
-
Signature:
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> streams, final int readThreadNum, final int bufferSize) - Summary: Returns a stream with elements from multiple streams fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple streams, which can improve performance when reading from slow sources.
- The resulting stream will automatically close all input streams when it is closed.
- <p> Warning: Dead lock could happen if the total thread number started by this stream and its upstream is bigger than the core thread pool size.
- If you encounter issues, consider using a custom executor.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be concatenated in parallel -
readThreadNum(int) — the number of threads used to read elements from streams. Default is min(64, CPU cores) -
bufferSize(int) — the size of the buffer used to store elements from the streams read by the reading threads
-
- Returns: a stream containing all elements from the provided streams
- See also: #parallelConcat(Collection, int)
parallelConcatIterators(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> parallelConcatIterators(final Collection<? extends Iterator<? extends T>> iterators) - Summary: Returns a stream with elements from multiple iterators fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple iterators, which can improve performance when reading from slow sources.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be concatenated in parallel
-
- Returns: a stream containing all elements from the provided iterators
- See also: #concatIterators(Collection), #parallelConcatIterators(Collection, int)
-
Signature:
public static <T> Stream<T> parallelConcatIterators(final Collection<? extends Iterator<? extends T>> iterators, final int readThreadNum) - Summary: Returns a stream with elements from multiple iterators fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple iterators, which can improve performance when reading from slow sources.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be concatenated in parallel -
readThreadNum(int) — the number of threads used to read elements from iterators. Default is min(64, CPU cores)
-
- Returns: a stream containing all elements from the provided iterators
- See also: #parallelConcatIterators(Collection), #parallelConcatIterators(Collection, int, int)
-
Signature:
public static <T> Stream<T> parallelConcatIterators(final Collection<? extends Iterator<? extends T>> iterators, final int readThreadNum, final int bufferSize) - Summary: Returns a stream with elements from multiple iterators fetched in parallel.
-
Contract:
- <p> This is an intermediate operation that provides parallel reading of multiple iterators, which can improve performance when reading from slow sources.
- <p> Warning: Dead lock could happen if the total thread number started by this stream and its upstream is bigger than the core thread pool size.
- If you encounter issues, consider using a custom executor.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be concatenated in parallel -
readThreadNum(int) — the number of threads used to read elements from iterators. Default is min(64, CPU cores) -
bufferSize(int) — the size of the buffer used to store elements from the iterators read by the reading threads
-
- Returns: a stream containing all elements from the provided iterators
- See also: #parallelConcatIterators(Collection, int)
zip(...) -> Stream<R>
-
Signature:
public static <R> Stream<R> zip(final char[] a, final char[] b, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two char arrays into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when either of the input arrays runs out of elements.
-
Parameters:
-
a(char[]) — the first char array -
b(char[]) — the second char array -
zipFunction(CharBiFunction<? extends R>) — the function to combine elements from the two arrays
-
- Returns: a stream of combined values
- See also: #zip(char\[\], char\[\], char, char, CharBiFunction)
-
Signature:
public static <R> Stream<R> zip(final char[] a, final char[] b, final char[] c, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three char arrays into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when any of the input arrays runs out of elements.
-
Parameters:
-
a(char[]) — the first char array -
b(char[]) — the second char array -
c(char[]) — the third char array -
zipFunction(CharTriFunction<? extends R>) — the function to combine elements from the three arrays
-
- Returns: a stream of combined values
- See also: #zip(char\[\], char\[\], char\[\], char, char, char, CharTriFunction)
-
Signature:
public static <R> Stream<R> zip(final CharIterator a, final CharIterator b, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two char iterators into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when either of the input iterators runs out of elements.
-
Parameters:
-
a(CharIterator) — the first char iterator. Can be {@code null} (treated as empty) -
b(CharIterator) — the second char iterator. Can be {@code null} (treated as empty) -
zipFunction(CharBiFunction<? extends R>) — the function to combine elements from the two iterators
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharIterator a, final CharIterator b, final CharIterator c, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three char iterators into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when any of the input iterators runs out of elements.
-
Parameters:
-
a(CharIterator) — the first char iterator. Can be {@code null} (treated as empty) -
b(CharIterator) — the second char iterator. Can be {@code null} (treated as empty) -
c(CharIterator) — the third char iterator. Can be {@code null} (treated as empty) -
zipFunction(CharTriFunction<? extends R>) — the function to combine elements from the three iterators
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharStream a, final CharStream b, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two CharStreams into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when either of the input streams runs out of elements.
- The resulting stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(CharStream) — the first CharStream -
b(CharStream) — the second CharStream -
zipFunction(CharBiFunction<? extends R>) — the function to combine elements from the two streams
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharStream a, final CharStream b, final CharStream c, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three CharStreams into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when any of the input streams runs out of elements.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(CharStream) — the first CharStream -
b(CharStream) — the second CharStream -
c(CharStream) — the third CharStream -
zipFunction(CharTriFunction<? extends R>) — the function to combine elements from the three streams
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends CharStream> c, final CharNFunction<? extends R> zipFunction) - Summary: Zips a collection of CharStreams into a single stream by combining corresponding elements.
-
Contract:
- The resulting stream ends when any of the input streams runs out of elements.
- The resulting stream will automatically close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends CharStream>) — the collection of CharStreams -
zipFunction(CharNFunction<? extends R>) — the function to combine elements from all streams
-
- Returns: a stream of combined values. Empty if the collection is empty
-
Signature:
public static <R> Stream<R> zip(final char[] a, final char[] b, final char valueForNoneA, final char valueForNoneB, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two character arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that array.
-
Parameters:
-
a(char[]) — the first character array -
b(char[]) — the second character array -
valueForNoneA(char) — the default value to use when the first array runs out of values -
valueForNoneB(char) — the default value to use when the second array runs out of values -
zipFunction(CharBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
- See also: #zip(char\[\], char\[\], CharBiFunction)
-
Signature:
public static <R> Stream<R> zip(final char[] a, final char[] b, final char[] c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three character arrays into a single stream until all of them run out of values.
-
Contract:
- When an array runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that array.
-
Parameters:
-
a(char[]) — the first character array -
b(char[]) — the second character array -
c(char[]) — the third character array -
valueForNoneA(char) — the default value to use when the first array runs out of values -
valueForNoneB(char) — the default value to use when the second array runs out of values -
valueForNoneC(char) — the default value to use when the third array runs out of values -
zipFunction(CharTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharIterator a, final CharIterator b, final char valueForNoneA, final char valueForNoneB, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two character iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that iterator.
-
Parameters:
-
a(CharIterator) — the first character iterator, may be {@code null} (treated as empty) -
b(CharIterator) — the second character iterator, may be {@code null} (treated as empty) -
valueForNoneA(char) — the default value to use when the first iterator runs out of values -
valueForNoneB(char) — the default value to use when the second iterator runs out of values -
zipFunction(CharBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharIterator a, final CharIterator b, final CharIterator c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three character iterators into a single stream until all of them run out of values.
-
Contract:
- When an iterator runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that iterator.
-
Parameters:
-
a(CharIterator) — the first character iterator, may be {@code null} (treated as empty) -
b(CharIterator) — the second character iterator, may be {@code null} (treated as empty) -
c(CharIterator) — the third character iterator, may be {@code null} (treated as empty) -
valueForNoneA(char) — the default value to use when the first iterator runs out of values -
valueForNoneB(char) — the default value to use when the second iterator runs out of values -
valueForNoneC(char) — the default value to use when the third iterator runs out of values -
zipFunction(CharTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final CharStream a, final CharStream b, final char valueForNoneA, final char valueForNoneB, final CharBiFunction<? extends R> zipFunction) - Summary: Zips two character streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(CharStream) — the first character stream -
b(CharStream) — the second character stream -
valueForNoneA(char) — the default value to use when the first stream runs out of values -
valueForNoneB(char) — the default value to use when the second stream runs out of values -
zipFunction(CharBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final CharStream a, final CharStream b, final CharStream c, final char valueForNoneA, final char valueForNoneB, final char valueForNoneC, final CharTriFunction<? extends R> zipFunction) - Summary: Zips three character streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(CharStream) — the first character stream -
b(CharStream) — the second character stream -
c(CharStream) — the third character stream -
valueForNoneA(char) — the default value to use when the first stream runs out of values -
valueForNoneB(char) — the default value to use when the second stream runs out of values -
valueForNoneC(char) — the default value to use when the third stream runs out of values -
zipFunction(CharTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends CharStream> c, final char[] valuesForNone, final CharNFunction<? extends R> zipFunction) - Summary: Zips a collection of character streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the corresponding default value from valuesForNone array is used for that stream.
- The returned stream will handle closing of all input streams when it is closed.
- <p> The size of valuesForNone must equal the size of the streams collection.
-
Parameters:
-
c(Collection<? extends CharStream>) — the collection of character streams to zip -
valuesForNone(char[]) — array of default values, must have same size as streams collection -
zipFunction(CharNFunction<? extends R>) — the function to combine arrays of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final byte[] a, final byte[] b, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either array runs out of values.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
- See also: #zip(byte\[\], byte\[\], byte, byte, ByteBiFunction)
-
Signature:
public static <R> Stream<R> zip(final byte[] a, final byte[] b, final byte[] c, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any array runs out of values.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
c(byte[]) — the third byte array -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteIterator a, final ByteIterator b, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either iterator runs out of values.
-
Parameters:
-
a(ByteIterator) — the first byte iterator, may be {@code null} (treated as empty) -
b(ByteIterator) — the second byte iterator, may be {@code null} (treated as empty) -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteIterator a, final ByteIterator b, final ByteIterator c, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any iterator runs out of values.
-
Parameters:
-
a(ByteIterator) — the first byte iterator, may be {@code null} (treated as empty) -
b(ByteIterator) — the second byte iterator, may be {@code null} (treated as empty) -
c(ByteIterator) — the third byte iterator, may be {@code null} (treated as empty) -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteStream a, final ByteStream b, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either stream runs out of values.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ByteStream) — the first byte stream -
b(ByteStream) — the second byte stream -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final ByteStream a, final ByteStream b, final ByteStream c, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ByteStream) — the first byte stream -
b(ByteStream) — the second byte stream -
c(ByteStream) — the third byte stream -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends ByteStream> c, final ByteNFunction<? extends R> zipFunction) - Summary: Zips a collection of byte streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The returned stream will handle closing of all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends ByteStream>) — the collection of byte streams to zip -
zipFunction(ByteNFunction<? extends R>) — the function to combine arrays of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final byte[] a, final byte[] b, final byte valueForNoneA, final byte valueForNoneB, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that array.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
valueForNoneA(byte) — the default value to use when the first array runs out of values -
valueForNoneB(byte) — the default value to use when the second array runs out of values -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final byte[] a, final byte[] b, final byte[] c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte arrays into a single stream until all of them run out of values.
-
Contract:
- When an array runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that array.
-
Parameters:
-
a(byte[]) — the first byte array -
b(byte[]) — the second byte array -
c(byte[]) — the third byte array -
valueForNoneA(byte) — the default value to use when the first array runs out of values -
valueForNoneB(byte) — the default value to use when the second array runs out of values -
valueForNoneC(byte) — the default value to use when the third array runs out of values -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteIterator a, final ByteIterator b, final byte valueForNoneA, final byte valueForNoneB, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte iterators into a single stream until all of them run out of values.
-
Contract:
- When one iterator runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that iterator.
-
Parameters:
-
a(ByteIterator) — the first byte iterator, may be {@code null} (treated as empty) -
b(ByteIterator) — the second byte iterator, may be {@code null} (treated as empty) -
valueForNoneA(byte) — the default value to use when the first iterator runs out of values -
valueForNoneB(byte) — the default value to use when the second iterator runs out of values -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteIterator a, final ByteIterator b, final ByteIterator c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte iterators into a single stream until all of them run out of values.
-
Contract:
- When an iterator runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that iterator.
-
Parameters:
-
a(ByteIterator) — the first byte iterator, may be {@code null} (treated as empty) -
b(ByteIterator) — the second byte iterator, may be {@code null} (treated as empty) -
c(ByteIterator) — the third byte iterator, may be {@code null} (treated as empty) -
valueForNoneA(byte) — the default value to use when the first iterator runs out of values -
valueForNoneB(byte) — the default value to use when the second iterator runs out of values -
valueForNoneC(byte) — the default value to use when the third iterator runs out of values -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ByteStream a, final ByteStream b, final byte valueForNoneA, final byte valueForNoneB, final ByteBiFunction<? extends R> zipFunction) - Summary: Zips two byte streams into a single stream until all of them run out of values.
-
Contract:
- When one stream runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ByteStream) — the first byte stream -
b(ByteStream) — the second byte stream -
valueForNoneA(byte) — the default value to use when the first stream runs out of values -
valueForNoneB(byte) — the default value to use when the second stream runs out of values -
zipFunction(ByteBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final ByteStream a, final ByteStream b, final ByteStream c, final byte valueForNoneA, final byte valueForNoneB, final byte valueForNoneC, final ByteTriFunction<? extends R> zipFunction) - Summary: Zips three byte streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that stream.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ByteStream) — the first byte stream -
b(ByteStream) — the second byte stream -
c(ByteStream) — the third byte stream -
valueForNoneA(byte) — the default value to use when the first stream runs out of values -
valueForNoneB(byte) — the default value to use when the second stream runs out of values -
valueForNoneC(byte) — the default value to use when the third stream runs out of values -
zipFunction(ByteTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends ByteStream> c, final byte[] valuesForNone, final ByteNFunction<? extends R> zipFunction) - Summary: Zips a collection of byte streams into a single stream until all of them run out of values.
-
Contract:
- When a stream runs out of values, the corresponding default value from valuesForNone array is used for that stream.
- The returned stream will handle closing of all input streams when it is closed.
- <p> The size of valuesForNone must equal the size of the streams collection.
-
Parameters:
-
c(Collection<? extends ByteStream>) — the collection of byte streams to zip -
valuesForNone(byte[]) — array of default values, must have same size as streams collection -
zipFunction(ByteNFunction<? extends R>) — the function to combine arrays of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final short[] a, final short[] b, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either array runs out of values.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
- See also: #zip(short\[\], short\[\], short, short, ShortBiFunction)
-
Signature:
public static <R> Stream<R> zip(final short[] a, final short[] b, final short[] c, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any array runs out of values.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
c(short[]) — the third short array -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortIterator a, final ShortIterator b, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either iterator runs out of values.
-
Parameters:
-
a(ShortIterator) — the first short iterator, may be {@code null} (treated as empty) -
b(ShortIterator) — the second short iterator, may be {@code null} (treated as empty) -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortIterator a, final ShortIterator b, final ShortIterator c, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any iterator runs out of values.
-
Parameters:
-
a(ShortIterator) — the first short iterator, may be {@code null} (treated as empty) -
b(ShortIterator) — the second short iterator, may be {@code null} (treated as empty) -
c(ShortIterator) — the third short iterator, may be {@code null} (treated as empty) -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when either stream runs out of values.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first short stream -
b(ShortStream) — the second short stream -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortStream c, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The returned stream will handle closing of the input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first short stream -
b(ShortStream) — the second short stream -
c(ShortStream) — the third short stream -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends ShortStream> c, final ShortNFunction<? extends R> zipFunction) - Summary: Zips a collection of short streams into a single stream until one of them runs out of values.
-
Contract:
- <p> The operation stops when any stream runs out of values.
- The returned stream will handle closing of all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends ShortStream>) — the collection of short streams to zip -
zipFunction(ShortNFunction<? extends R>) — the function to combine arrays of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final short[] a, final short[] b, final short valueForNoneA, final short valueForNoneB, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short arrays into a single stream until all of them run out of values.
-
Contract:
- When one array runs out of values, the specified default value (valueForNoneA or valueForNoneB) is used for that array.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
valueForNoneA(short) — the default value to use when the first array runs out of values -
valueForNoneB(short) — the default value to use when the second array runs out of values -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final short[] a, final short[] b, final short[] c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short arrays into a single stream until all of them run out of values.
-
Contract:
- When an array runs out of values, the specified default value (valueForNoneA, valueForNoneB, or valueForNoneC) is used for that array.
-
Parameters:
-
a(short[]) — the first short array -
b(short[]) — the second short array -
c(short[]) — the third short array -
valueForNoneA(short) — the default value to use when the first array runs out of values -
valueForNoneB(short) — the default value to use when the second array runs out of values -
valueForNoneC(short) — the default value to use when the third array runs out of values -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortIterator a, final ShortIterator b, final short valueForNoneA, final short valueForNoneB, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The resulting stream continues until both iterators are exhausted, using default values when one iterator is empty.
-
Parameters:
-
a(ShortIterator) — the first short iterator. Can be {@code null} (treated as empty iterator). -
b(ShortIterator) — the second short iterator. Can be {@code null} (treated as empty iterator). -
valueForNoneA(short) — the value to use if the first iterator runs out of values -
valueForNoneB(short) — the value to use if the second iterator runs out of values -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortIterator a, final ShortIterator b, final ShortIterator c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- The resulting stream continues until all iterators are exhausted, using default values when an iterator is empty.
-
Parameters:
-
a(ShortIterator) — the first short iterator. Can be {@code null} (treated as empty iterator). -
b(ShortIterator) — the second short iterator. Can be {@code null} (treated as empty iterator). -
c(ShortIterator) — the third short iterator. Can be {@code null} (treated as empty iterator). -
valueForNoneA(short) — the value to use if the first iterator runs out of values -
valueForNoneB(short) — the value to use if the second iterator runs out of values -
valueForNoneC(short) — the value to use if the third iterator runs out of values -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final short valueForNoneA, final short valueForNoneB, final ShortBiFunction<? extends R> zipFunction) - Summary: Zips two short streams into a single stream until all of them runs out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The resulting stream continues until both input streams are exhausted, using default values when one stream is empty.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first short stream. Can be {@code null} (treated as empty stream). -
b(ShortStream) — the second short stream. Can be {@code null} (treated as empty stream). -
valueForNoneA(short) — the value to use if the first stream runs out of values -
valueForNoneB(short) — the value to use if the second stream runs out of values -
zipFunction(ShortBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortStream c, final short valueForNoneA, final short valueForNoneB, final short valueForNoneC, final ShortTriFunction<? extends R> zipFunction) - Summary: Zips three short streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
- The resulting stream continues until all input streams are exhausted, using default values when a stream is empty.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(ShortStream) — the first short stream. Can be {@code null} (treated as empty stream). -
b(ShortStream) — the second short stream. Can be {@code null} (treated as empty stream). -
c(ShortStream) — the third short stream. Can be {@code null} (treated as empty stream). -
valueForNoneA(short) — the value to use if the first stream runs out of values -
valueForNoneB(short) — the value to use if the second stream runs out of values -
valueForNoneC(short) — the value to use if the third stream runs out of values -
zipFunction(ShortTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends ShortStream> c, final short[] valuesForNone, final ShortNFunction<? extends R> zipFunction) - Summary: Zips a collection of short streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the corresponding value from valuesForNone is used.
- The resulting stream continues until all input streams are exhausted, using default values when a stream is empty.
- The returned stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends ShortStream>) — the collection of short streams. If empty, returns an empty stream. -
valuesForNone(short[]) — the array of default values to use when streams run out of values. Must have the same length as the collection. -
zipFunction(ShortNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final int[] a, final int[] b, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int arrays into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when the shorter array is exhausted.
-
Parameters:
-
a(int[]) — the first int array. Can be {@code null} or empty. -
b(int[]) — the second int array. Can be {@code null} or empty. -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values with length equal to the shorter array
-
Signature:
public static <R> Stream<R> zip(final int[] a, final int[] b, final int[] c, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int arrays into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when the shortest array is exhausted.
-
Parameters:
-
a(int[]) — the first int array. Can be {@code null} or empty. -
b(int[]) — the second int array. Can be {@code null} or empty. -
c(int[]) — the third int array. Can be {@code null} or empty. -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values with length equal to the shortest array
-
Signature:
public static <R> Stream<R> zip(final IntIterator a, final IntIterator b, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int iterators into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when either iterator is exhausted.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty iterator). -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty iterator). -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final IntIterator a, final IntIterator b, final IntIterator c, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int iterators into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any iterator is exhausted.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty iterator). -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty iterator). -
c(IntIterator) — the third int iterator. Can be {@code null} (treated as empty iterator). -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final IntStream a, final IntStream b, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when either stream is exhausted.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream. Can be {@code null} (treated as empty stream). -
b(IntStream) — the second int stream. Can be {@code null} (treated as empty stream). -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final IntStream a, final IntStream b, final IntStream c, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any stream is exhausted.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream. Can be {@code null} (treated as empty stream). -
b(IntStream) — the second int stream. Can be {@code null} (treated as empty stream). -
c(IntStream) — the third int stream. Can be {@code null} (treated as empty stream). -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends IntStream> c, final IntNFunction<? extends R> zipFunction) - Summary: Zips a collection of int streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any stream is exhausted.
- The returned stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends IntStream>) — the collection of int streams. If empty, returns an empty stream. -
zipFunction(IntNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final int[] a, final int[] b, final int valueForNoneA, final int valueForNoneB, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int arrays into a single stream until all of them runs out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The resulting stream continues until both arrays are exhausted, using default values when one array is shorter.
-
Parameters:
-
a(int[]) — the first int array. Can be {@code null} or empty. -
b(int[]) — the second int array. Can be {@code null} or empty. -
valueForNoneA(int) — the value to use if the first array runs out of values -
valueForNoneB(int) — the value to use if the second array runs out of values -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final int[] a, final int[] b, final int[] c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int arrays into a single stream until all of them runs out of values.
-
Contract:
- If one array runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- The resulting stream continues until all arrays are exhausted, using default values when an array is shorter.
-
Parameters:
-
a(int[]) — the first int array. Can be {@code null} or empty. -
b(int[]) — the second int array. Can be {@code null} or empty. -
c(int[]) — the third int array. Can be {@code null} or empty. -
valueForNoneA(int) — the value to use if the first array runs out of values -
valueForNoneB(int) — the value to use if the second array runs out of values -
valueForNoneC(int) — the value to use if the third array runs out of values -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final IntIterator a, final IntIterator b, final int valueForNoneA, final int valueForNoneB, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The resulting stream continues until both iterators are exhausted, using default values when one iterator is empty.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty iterator). -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty iterator). -
valueForNoneA(int) — the value to use if the first iterator runs out of values -
valueForNoneB(int) — the value to use if the second iterator runs out of values -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final IntIterator a, final IntIterator b, final IntIterator c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- The resulting stream continues until all iterators are exhausted, using default values when an iterator is empty.
-
Parameters:
-
a(IntIterator) — the first int iterator. Can be {@code null} (treated as empty iterator). -
b(IntIterator) — the second int iterator. Can be {@code null} (treated as empty iterator). -
c(IntIterator) — the third int iterator. Can be {@code null} (treated as empty iterator). -
valueForNoneA(int) — the value to use if the first iterator runs out of values -
valueForNoneB(int) — the value to use if the second iterator runs out of values -
valueForNoneC(int) — the value to use if the third iterator runs out of values -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final IntStream a, final IntStream b, final int valueForNoneA, final int valueForNoneB, final IntBiFunction<? extends R> zipFunction) - Summary: Zips two int streams into a single stream until all of them runs out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The resulting stream continues until both input streams are exhausted, using default values when one stream is empty.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream. Can be {@code null} (treated as empty stream). -
b(IntStream) — the second int stream. Can be {@code null} (treated as empty stream). -
valueForNoneA(int) — the value to use if the first stream runs out of values -
valueForNoneB(int) — the value to use if the second stream runs out of values -
zipFunction(IntBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final IntStream a, final IntStream b, final IntStream c, final int valueForNoneA, final int valueForNoneB, final int valueForNoneC, final IntTriFunction<? extends R> zipFunction) - Summary: Zips three int streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
- The resulting stream continues until all input streams are exhausted, using default values when a stream is empty.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(IntStream) — the first int stream. Can be {@code null} (treated as empty stream). -
b(IntStream) — the second int stream. Can be {@code null} (treated as empty stream). -
c(IntStream) — the third int stream. Can be {@code null} (treated as empty stream). -
valueForNoneA(int) — the value to use if the first stream runs out of values -
valueForNoneB(int) — the value to use if the second stream runs out of values -
valueForNoneC(int) — the value to use if the third stream runs out of values -
zipFunction(IntTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends IntStream> c, final int[] valuesForNone, final IntNFunction<? extends R> zipFunction) - Summary: Zips a collection of int streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the corresponding value from valuesForNone is used.
- The resulting stream continues until all input streams are exhausted, using default values when a stream is empty.
- The returned stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends IntStream>) — the collection of int streams. If empty, returns an empty stream. -
valuesForNone(int[]) — the array of default values to use when streams run out of values. Must have the same length as the collection. -
zipFunction(IntNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final long[] a, final long[] b, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long arrays into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when the shorter array is exhausted.
-
Parameters:
-
a(long[]) — the first long array. Can be {@code null} or empty. -
b(long[]) — the second long array. Can be {@code null} or empty. -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values with length equal to the shorter array
-
Signature:
public static <R> Stream<R> zip(final long[] a, final long[] b, final long[] c, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long arrays into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when the shortest array is exhausted.
-
Parameters:
-
a(long[]) — the first long array. Can be {@code null} or empty. -
b(long[]) — the second long array. Can be {@code null} or empty. -
c(long[]) — the third long array. Can be {@code null} or empty. -
zipFunction(LongTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values with length equal to the shortest array
-
Signature:
public static <R> Stream<R> zip(final LongIterator a, final LongIterator b, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long iterators into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when either iterator is exhausted.
-
Parameters:
-
a(LongIterator) — the first long iterator. Can be {@code null} (treated as empty iterator). -
b(LongIterator) — the second long iterator. Can be {@code null} (treated as empty iterator). -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongIterator a, final LongIterator b, final LongIterator c, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long iterators into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any iterator is exhausted.
-
Parameters:
-
a(LongIterator) — the first long iterator. Can be {@code null} (treated as empty iterator). -
b(LongIterator) — the second long iterator. Can be {@code null} (treated as empty iterator). -
c(LongIterator) — the third long iterator. Can be {@code null} (treated as empty iterator). -
zipFunction(LongTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongStream a, final LongStream b, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when either stream is exhausted.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream. Can be {@code null} (treated as empty stream). -
b(LongStream) — the second long stream. Can be {@code null} (treated as empty stream). -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final LongStream a, final LongStream b, final LongStream c, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any stream is exhausted.
- The returned stream will close the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream. Can be {@code null} (treated as empty stream). -
b(LongStream) — the second long stream. Can be {@code null} (treated as empty stream). -
c(LongStream) — the third long stream. Can be {@code null} (treated as empty stream). -
zipFunction(LongTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values that will close the input streams when closed
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends LongStream> c, final LongNFunction<? extends R> zipFunction) - Summary: Zips a collection of long streams into a single stream until one of them runs out of values.
-
Contract:
- The resulting stream ends when any stream is exhausted.
- The returned stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends LongStream>) — the collection of long streams. If empty, returns an empty stream. -
zipFunction(LongNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values that will close all input streams when closed
-
Signature:
public static <R> Stream<R> zip(final long[] a, final long[] b, final long valueForNoneA, final long valueForNoneB, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both arrays are exhausted, using default values when one array is shorter than the other.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
valueForNoneA(long) — the value to use if the first array runs out of values -
valueForNoneB(long) — the value to use if the second array runs out of values -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final long[] a, final long[] b, final long[] c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- <p> This method continues processing until all three arrays are exhausted, using default values when arrays have different lengths.
-
Parameters:
-
a(long[]) — the first long array -
b(long[]) — the second long array -
c(long[]) — the third long array -
valueForNoneA(long) — the value to use if the first array runs out of values -
valueForNoneB(long) — the value to use if the second array runs out of values -
valueForNoneC(long) — the value to use if the third array runs out of values -
zipFunction(LongTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongIterator a, final LongIterator b, final long valueForNoneA, final long valueForNoneB, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both iterators are exhausted, using default values when one iterator is exhausted before the other.
-
Parameters:
-
a(LongIterator) — the first long iterator -
b(LongIterator) — the second long iterator -
valueForNoneA(long) — the value to use if the first iterator runs out of values -
valueForNoneB(long) — the value to use if the second iterator runs out of values -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongIterator a, final LongIterator b, final LongIterator c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- <p> This method continues processing until all three iterators are exhausted, using default values when iterators are exhausted at different times.
-
Parameters:
-
a(LongIterator) — the first long iterator -
b(LongIterator) — the second long iterator -
c(LongIterator) — the third long iterator -
valueForNoneA(long) — the value to use if the first iterator runs out of values -
valueForNoneB(long) — the value to use if the second iterator runs out of values -
valueForNoneC(long) — the value to use if the third iterator runs out of values -
zipFunction(LongTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongStream a, final LongStream b, final long valueForNoneA, final long valueForNoneB, final LongBiFunction<? extends R> zipFunction) - Summary: Zips two long streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both streams are exhausted, using default values when one stream is exhausted before the other.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream -
b(LongStream) — the second long stream -
valueForNoneA(long) — the value to use if the first stream runs out of values -
valueForNoneB(long) — the value to use if the second stream runs out of values -
zipFunction(LongBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final LongStream a, final LongStream b, final LongStream c, final long valueForNoneA, final long valueForNoneB, final long valueForNoneC, final LongTriFunction<? extends R> zipFunction) - Summary: Zips three long streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
- <p> This method continues processing until all three streams are exhausted, using default values when streams are exhausted at different times.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(LongStream) — the first long stream -
b(LongStream) — the second long stream -
c(LongStream) — the third long stream -
valueForNoneA(long) — the value to use if the first stream runs out of values -
valueForNoneB(long) — the value to use if the second stream runs out of values -
valueForNoneC(long) — the value to use if the third stream runs out of values -
zipFunction(LongTriFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends LongStream> c, final long[] valuesForNone, final LongNFunction<? extends R> zipFunction) - Summary: Zips a collection of long streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valuesForNone are used.
- <p> This method continues processing until all streams are exhausted, using the corresponding default value from valuesForNone when a stream is exhausted.
- The resulting stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends LongStream>) — the collection of long streams -
valuesForNone(long[]) — the values to use if the streams run out of values. Must have the same size as the collection. -
zipFunction(LongNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final float[] a, final float[] b, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when the shorter array is exhausted.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final float[] a, final float[] b, final float[] c, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when the shortest array is exhausted.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
c(float[]) — the third float array -
zipFunction(FloatTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatIterator a, final FloatIterator b, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when either iterator is exhausted.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatIterator a, final FloatIterator b, final FloatIterator c, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when any iterator is exhausted.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
c(FloatIterator) — the third float iterator -
zipFunction(FloatTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatStream a, final FloatStream b, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when either stream is exhausted.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatStream a, final FloatStream b, final FloatStream c, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when any stream is exhausted.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
c(FloatStream) — the third float stream -
zipFunction(FloatTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends FloatStream> c, final FloatNFunction<? extends R> zipFunction) - Summary: Zips a collection of float streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements from all streams in parallel positions and stops when any stream is exhausted.
- The resulting stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends FloatStream>) — the collection of float streams -
zipFunction(FloatNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final float[] a, final float[] b, final float valueForNoneA, final float valueForNoneB, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both arrays are exhausted, using default values when one array is shorter than the other.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
valueForNoneA(float) — the value to use if the first array runs out of values -
valueForNoneB(float) — the value to use if the second array runs out of values -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final float[] a, final float[] b, final float[] c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- <p> This method continues processing until all three arrays are exhausted, using default values when arrays have different lengths.
-
Parameters:
-
a(float[]) — the first float array -
b(float[]) — the second float array -
c(float[]) — the third float array -
valueForNoneA(float) — the value to use if the first array runs out of values -
valueForNoneB(float) — the value to use if the second array runs out of values -
valueForNoneC(float) — the value to use if the third array runs out of values -
zipFunction(FloatTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatIterator a, final FloatIterator b, final float valueForNoneA, final float valueForNoneB, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both iterators are exhausted, using default values when one iterator is exhausted before the other.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
valueForNoneA(float) — the value to use if the first iterator runs out of values -
valueForNoneB(float) — the value to use if the second iterator runs out of values -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatIterator a, final FloatIterator b, final FloatIterator c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
- <p> This method continues processing until all three iterators are exhausted, using default values when iterators are exhausted at different times.
-
Parameters:
-
a(FloatIterator) — the first float iterator -
b(FloatIterator) — the second float iterator -
c(FloatIterator) — the third float iterator -
valueForNoneA(float) — the value to use if the first iterator runs out of values -
valueForNoneB(float) — the value to use if the second iterator runs out of values -
valueForNoneC(float) — the value to use if the third iterator runs out of values -
zipFunction(FloatTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatStream a, final FloatStream b, final float valueForNoneA, final float valueForNoneB, final FloatBiFunction<? extends R> zipFunction) - Summary: Zips two float streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both streams are exhausted, using default values when one stream is exhausted before the other.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
valueForNoneA(float) — the value to use if the first stream runs out of values -
valueForNoneB(float) — the value to use if the second stream runs out of values -
zipFunction(FloatBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final FloatStream a, final FloatStream b, final FloatStream c, final float valueForNoneA, final float valueForNoneB, final float valueForNoneC, final FloatTriFunction<? extends R> zipFunction) - Summary: Zips three float streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
- <p> This method continues processing until all three streams are exhausted, using default values when streams are exhausted at different times.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(FloatStream) — the first float stream -
b(FloatStream) — the second float stream -
c(FloatStream) — the third float stream -
valueForNoneA(float) — the value to use if the first stream runs out of values -
valueForNoneB(float) — the value to use if the second stream runs out of values -
valueForNoneC(float) — the value to use if the third stream runs out of values -
zipFunction(FloatTriFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends FloatStream> c, final float[] valuesForNone, final FloatNFunction<? extends R> zipFunction) - Summary: Zips a collection of float streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valuesForNone are used.
- <p> This method continues processing until all streams are exhausted, using the corresponding default value from valuesForNone when a stream is exhausted.
- The resulting stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends FloatStream>) — the collection of float streams -
valuesForNone(float[]) — the values to use if the streams run out of values. Must have the same size as the collection. -
zipFunction(FloatNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final double[] a, final double[] b, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when the shorter array is exhausted.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final double[] a, final double[] b, final double[] c, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double arrays into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when the shortest array is exhausted.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
c(double[]) — the third double array -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final DoubleIterator a, final DoubleIterator b, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when either iterator is exhausted.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final DoubleIterator a, final DoubleIterator b, final DoubleIterator c, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double iterators into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when any iterator is exhausted.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
c(DoubleIterator) — the third double iterator -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final DoubleStream a, final DoubleStream b, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements pairwise and stops when either stream is exhausted.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final DoubleStream a, final DoubleStream b, final DoubleStream c, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements in triples and stops when any stream is exhausted.
- The resulting stream will close the input streams when it is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
c(DoubleStream) — the third double stream -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine triples of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends DoubleStream> c, final DoubleNFunction<? extends R> zipFunction) - Summary: Zips a collection of double streams into a single stream until one of them runs out of values.
-
Contract:
- <p> This method processes elements from all streams in parallel positions and stops when any stream is exhausted.
- The resulting stream will close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends DoubleStream>) — the collection of double streams -
zipFunction(DoubleNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final double[] a, final double[] b, final double valueForNoneA, final double valueForNoneB, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- <p> This method continues processing until both arrays are exhausted, using default values when one array is shorter than the other.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
valueForNoneA(double) — the value to use if the first array runs out of values -
valueForNoneB(double) — the value to use if the second array runs out of values -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
-
Signature:
public static <R> Stream<R> zip(final double[] a, final double[] b, final double[] c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double arrays into a single stream until all of them runs out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
-
Parameters:
-
a(double[]) — the first double array -
b(double[]) — the second double array -
c(double[]) — the third double array -
valueForNoneA(double) — the value to use if the first array runs out of values -
valueForNoneB(double) — the value to use if the second array runs out of values -
valueForNoneC(double) — the value to use if the third array runs out of values -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a new Stream of combined values
- See also: #zip(double\[\], double\[\], double, double, DoubleBiFunction), #zip(DoubleIterator, DoubleIterator, DoubleIterator, double, double, double, DoubleTriFunction)
-
Signature:
public static <R> Stream<R> zip(final DoubleIterator a, final DoubleIterator b, final double valueForNoneA, final double valueForNoneB, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
valueForNoneA(double) — the value to use if the first iterator runs out of values -
valueForNoneB(double) — the value to use if the second iterator runs out of values -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
- See also: #zip(DoubleIterator, DoubleIterator, DoubleIterator, double, double, double, DoubleTriFunction), #zip(DoubleStream, DoubleStream, double, double, DoubleBiFunction)
-
Signature:
public static <R> Stream<R> zip(final DoubleIterator a, final DoubleIterator b, final DoubleIterator c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double iterators into a single stream until all of them runs out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB or valueForNoneC is used.
-
Parameters:
-
a(DoubleIterator) — the first double iterator -
b(DoubleIterator) — the second double iterator -
c(DoubleIterator) — the third double iterator -
valueForNoneA(double) — the value to use if the first iterator runs out of values -
valueForNoneB(double) — the value to use if the second iterator runs out of values -
valueForNoneC(double) — the value to use if the third iterator runs out of values -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
- See also: #zip(DoubleIterator, DoubleIterator, double, double, DoubleBiFunction), #zip(DoubleStream, DoubleStream, DoubleStream, double, double, double, DoubleTriFunction)
-
Signature:
public static <R> Stream<R> zip(final DoubleStream a, final DoubleStream b, final double valueForNoneA, final double valueForNoneB, final DoubleBiFunction<? extends R> zipFunction) - Summary: Zips two double streams into a single stream until all of them runs out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The returned stream will automatically close the input streams when it is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
valueForNoneA(double) — the value to use if the first stream runs out of values -
valueForNoneB(double) — the value to use if the second stream runs out of values -
zipFunction(DoubleBiFunction<? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
- See also: #zip(DoubleIterator, DoubleIterator, double, double, DoubleBiFunction), #zip(DoubleStream, DoubleStream, DoubleStream, double, double, double, DoubleTriFunction)
-
Signature:
public static <R> Stream<R> zip(final DoubleStream a, final DoubleStream b, final DoubleStream c, final double valueForNoneA, final double valueForNoneB, final double valueForNoneC, final DoubleTriFunction<? extends R> zipFunction) - Summary: Zips three double streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(DoubleStream) — the first double stream -
b(DoubleStream) — the second double stream -
c(DoubleStream) — the third double stream -
valueForNoneA(double) — the value to use if the first stream runs out of values -
valueForNoneB(double) — the value to use if the second stream runs out of values -
valueForNoneC(double) — the value to use if the third stream runs out of values -
zipFunction(DoubleTriFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
- See also: #zip(DoubleStream, DoubleStream, double, double, DoubleBiFunction), #zip(Collection, double\[\], DoubleNFunction)
-
Signature:
public static <R> Stream<R> zip(final Collection<? extends DoubleStream> c, final double[] valuesForNone, final DoubleNFunction<? extends R> zipFunction) - Summary: Zips a collection of double streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valuesForNone are used.
- The size of valuesForNone must match the size of the collection.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
c(Collection<? extends DoubleStream>) — the collection of double streams -
valuesForNone(double[]) — the values to use if the streams run out of values. Size must match the collection size. -
zipFunction(DoubleNFunction<? extends R>) — the function to combine sets of values from the streams.
-
- Returns: a stream of combined values
- See also: #zip(DoubleStream, DoubleStream, DoubleStream, double, double, double, DoubleTriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final A[] a, final B[] b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two arrays into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shorter array is exhausted.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
- See also: N#zip(Object\[\], Object\[\], BiFunction), Fn#pair(), Fn#tuple2(), #zip(Object\[\], Object\[\], Object, Object, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final A[] a, final B[] b, final C[] c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three arrays into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest array is exhausted.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
c(C[]) — the third array -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triples of values from the arrays.
-
- Returns: a stream of combined values
- See also: N#zip(Object\[\], Object\[\], Object\[\], TriFunction), Fn#triple(), Fn#tuple3(), #zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterables into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shorter iterable is exhausted.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable -
b(Iterable<? extends B>) — the second iterable -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterables.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, BiFunction), Fn#pair(), Fn#tuple2(), #zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterables into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest iterable is exhausted.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable -
b(Iterable<? extends B>) — the second iterable -
c(Iterable<? extends C>) — the third iterable -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triples of values from the iterables.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, TriFunction), Fn#triple(), Fn#tuple3(), #zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterators into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shorter iterator is exhausted.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator -
b(Iterator<? extends B>) — the second iterator -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, BiFunction), Fn#pair(), Fn#tuple2(), #zip(Iterator, Iterator, Object, Object, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterators into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest iterator is exhausted.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator -
b(Iterator<? extends B>) — the second iterator -
c(Iterator<? extends C>) — the third iterator -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, TriFunction), Fn#triple(), Fn#tuple3(), #zip(Iterator, Iterator, Iterator, Object, Object, Object, TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Stream<? extends A> a, final Stream<? extends B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two streams into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shorter stream is exhausted.
- The returned stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(Stream<? extends A>) — the first stream -
b(Stream<? extends B>) — the second stream -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, BiFunction), Fn#pair(), Fn#tuple2(), #zip(Stream, Stream, Object, Object, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Stream<? extends A> a, final Stream<? extends B> b, final Stream<? extends C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three streams into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest stream is exhausted.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(Stream<? extends A>) — the first stream -
b(Stream<? extends B>) — the second stream -
c(Stream<? extends C>) — the third stream -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the streams.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, TriFunction), Fn#triple(), Fn#tuple3(), #zip(Stream, Stream, Stream, Object, Object, Object, TriFunction)
-
Signature:
public static <T, R> Stream<R> zip(final Collection<? extends Stream<? extends T>> streams, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple streams into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest stream is exhausted.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be zipped -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the streams.
-
- Returns: a stream of combined values
- See also: #zip(Collection, List, Function), #zipIterables(Collection, Function)
-
Signature:
public static <A, B, R> Stream<R> zip(final A[] a, final B[] b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two arrays into a single stream until all of them runs out of values.
-
Contract:
- If one array runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
valueForNoneA(A) — the value to use if the first array runs out of values -
valueForNoneB(B) — the value to use if the second array runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the arrays.
-
- Returns: a stream of combined values
- See also: N#zip(Object\[\], Object\[\], Object, Object, BiFunction), #zip(Object\[\], Object\[\], BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final A[] a, final B[] b, final C[] c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three arrays into a single stream until all of them run out of values.
-
Contract:
- If one array runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
-
Parameters:
-
a(A[]) — the first array -
b(B[]) — the second array -
c(C[]) — the third array -
valueForNoneA(A) — the value to use if the first array runs out of values -
valueForNoneB(B) — the value to use if the second array runs out of values -
valueForNoneC(C) — the value to use if the third array runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the arrays.
-
- Returns: a stream of combined values
- See also: N#zip(Object\[\], Object\[\], Object\[\], Object, Object, Object, TriFunction), #zip(Object\[\], Object\[\], Object\[\], TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterables into a single stream until all of them run out of values.
-
Contract:
- If one iterable runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable -
b(Iterable<? extends B>) — the second iterable -
valueForNoneA(A) — the value to use if the first iterable runs out of values -
valueForNoneB(B) — the value to use if the second iterable runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterables.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction), #zip(Iterable, Iterable, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterables into a single stream until all of them run out of values.
-
Contract:
- If one iterable runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable -
b(Iterable<? extends B>) — the second iterable -
c(Iterable<? extends C>) — the third iterable -
valueForNoneA(A) — the value to use if the first iterable runs out of values -
valueForNoneB(B) — the value to use if the second iterable runs out of values -
valueForNoneC(C) — the value to use if the third iterable runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the iterables.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction), #zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator -
b(Iterator<? extends B>) — the second iterator -
valueForNoneA(A) — the value to use if the first iterator runs out of values -
valueForNoneB(B) — the value to use if the second iterator runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterators.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction), #zip(Iterator, Iterator, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator -
b(Iterator<? extends B>) — the second iterator -
c(Iterator<? extends C>) — the third iterator -
valueForNoneA(A) — the value to use if the first iterator runs out of values -
valueForNoneB(B) — the value to use if the second iterator runs out of values -
valueForNoneC(C) — the value to use if the third iterator runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triples of values from the iterators.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction), #zip(Iterator, Iterator, Iterator, TriFunction)
-
Signature:
public static <A, B, R> Stream<R> zip(final Stream<? extends A> a, final Stream<? extends B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction) - Summary: Zips two streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- The returned stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(Stream<? extends A>) — the first stream -
b(Stream<? extends B>) — the second stream -
valueForNoneA(A) — the value to use if the first stream runs out of values -
valueForNoneB(B) — the value to use if the second stream runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the streams.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction), #zip(Stream, Stream, BiFunction)
-
Signature:
public static <A, B, C, R> Stream<R> zip(final Stream<? extends A> a, final Stream<? extends B> b, final Stream<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Summary: Zips three streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the specified valueForNoneA, valueForNoneB, or valueForNoneC is used.
-
Parameters:
-
a(Stream<? extends A>) — the first stream -
b(Stream<? extends B>) — the second stream -
c(Stream<? extends C>) — the third stream -
valueForNoneA(A) — the value to use if the first stream runs out of values -
valueForNoneB(B) — the value to use if the second stream runs out of values -
valueForNoneC(C) — the value to use if the third stream runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the streams.
-
- Returns: a stream of combined values
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
public static <T, R> Stream<R> zip(final Collection<? extends Stream<? extends T>> streams, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple streams into a single stream until all of them run out of values.
-
Contract:
- If one stream runs out of values before the others, the corresponding value from valuesForNone is used.
- The size of valuesForNone must match the size of the streams collection.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream to be zipped. Must not be {@code null} . -
valuesForNone(List<? extends T>) — the value to use if any stream runs out of values. Size must match streams size. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the streams.
-
- Returns: a stream of combined values
zipIterables(...) -> Stream<R>
-
Signature:
public static <T, R> Stream<R> zipIterables(final Collection<? extends Iterable<? extends T>> iterables, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple iterables into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest iterable is exhausted.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterable to be zipped -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterables.
-
- Returns: a stream of combined values
- See also: #zipIterators(Collection, Function), #zipIterables(Collection, List, Function)
-
Signature:
public static <T, R> Stream<R> zipIterables(final Collection<? extends Iterable<? extends T>> iterables, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple iterables into a single stream until all of them run out of values.
-
Contract:
- If one iterable runs out of values before the others, the corresponding value from valuesForNone is used.
- The size of valuesForNone must match the size of the iterables collection.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterable to be zipped. Must not be {@code null} . -
valuesForNone(List<? extends T>) — the values to use if an iterable runs out of values. Size must match iterables size. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterables.
-
- Returns: a stream of combined values
zipIterators(...) -> Stream<R>
-
Signature:
public static <T, R> Stream<R> zipIterators(final Collection<? extends Iterator<? extends T>> iterators, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple iterators into a single stream until one of them runs out of values.
-
Contract:
- The operation stops when the shortest iterator is exhausted.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be zipped -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterators.
-
- Returns: a stream of combined values
- See also: #zipIterables(Collection, Function), #zipIterators(Collection, List, Function)
-
Signature:
public static <T, R> Stream<R> zipIterators(final Collection<? extends Iterator<? extends T>> iterators, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction) - Summary: Zips multiple iterators into a single stream until all of them run out of values.
-
Contract:
- If one iterator runs out of values before the others, the corresponding value from valuesForNone is used.
- The size of valuesForNone must match the size of the iterators collection.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterator to be zipped. Must not be {@code null} . -
valuesForNone(List<? extends T>) — the values to use if an iterator runs out of values. Size must match iterators size. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterators.
-
- Returns: a stream of combined values
parallelZip(...) -> Stream<R>
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Iterable<? extends A> a, final Iterable<? extends B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two iterables into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when either iterable runs out of elements.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable. Can be {@code null} (treated as empty). -
b(Iterable<? extends B>) — the second iterable. Can be {@code null} (treated as empty). -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Iterator<? extends A> a, final Iterator<? extends B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two iterators into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when either iterator runs out of elements.
- If maxThreadNumForZipFunction is 1, this method behaves the same as the sequential zip operation.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator. Can be {@code null} (treated as empty). -
b(Iterator<? extends B>) — the second iterator. Can be {@code null} (treated as empty). -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterators. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two streams into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when either stream runs out of elements.
-
Parameters:
-
a(Stream<A>) — the first stream. Must not be {@code null} . -
b(Stream<B>) — the second stream. Must not be {@code null} . -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three iterables into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when any iterable runs out of elements.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable. Can be {@code null} (treated as empty). -
b(Iterable<? extends B>) — the second iterable. Can be {@code null} (treated as empty). -
c(Iterable<? extends C>) — the third iterable. Can be {@code null} (treated as empty). -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three iterators into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when any iterator runs out of elements.
- If maxThreadNumForZipFunction is 1, this method behaves the same as the sequential zip operation.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator. Can be {@code null} (treated as empty). -
b(Iterator<? extends B>) — the second iterator. Can be {@code null} (treated as empty). -
c(Iterator<? extends C>) — the third iterator. Can be {@code null} (treated as empty). -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the iterators. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final Stream<C> c, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three streams into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when any stream runs out of elements.
-
Parameters:
-
a(Stream<A>) — the first stream. Must not be {@code null} . -
b(Stream<B>) — the second stream. Must not be {@code null} . -
c(Stream<C>) — the third stream. Must not be {@code null} . -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Iterable<? extends A> a, final Iterable<? extends B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two iterables into a single stream until all of them run out of values in parallel.
-
Contract:
- If one iterable runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable. Can be {@code null} (treated as empty). -
b(Iterable<? extends B>) — the second iterable. Can be {@code null} (treated as empty). -
valueForNoneA(A) — the value to use if the first iterable runs out of values -
valueForNoneB(B) — the value to use if the second iterable runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Iterator<? extends A> a, final Iterator<? extends B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two iterators into a single stream until all of them run out of values in parallel.
-
Contract:
- If one iterator runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
- If maxThreadNumForZipFunction is 1, this method behaves the same as the sequential zip operation.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator. Can be {@code null} (treated as empty). -
b(Iterator<? extends B>) — the second iterator. Can be {@code null} (treated as empty). -
valueForNoneA(A) — the value to use if the first iterator runs out of values -
valueForNoneB(B) — the value to use if the second iterator runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the iterators. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final A valueForNoneA, final B valueForNoneB, final BiFunction<? super A, ? super B, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips two streams into a single stream until all of them run out of values in parallel.
-
Contract:
- If one stream runs out of values before the other, the specified valueForNoneA or valueForNoneB is used.
-
Parameters:
-
a(Stream<A>) — the first stream. Must not be {@code null} . -
b(Stream<B>) — the second stream. Must not be {@code null} . -
valueForNoneA(A) — the value to use if the first stream runs out of values -
valueForNoneB(B) — the value to use if the second stream runs out of values -
zipFunction(BiFunction<? super A, ? super B, ? extends R>) — the function to combine pairs of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Iterable<? extends A> a, final Iterable<? extends B> b, final Iterable<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three iterables into a single stream until all of them run out of values in parallel.
-
Contract:
- If any iterable runs out of values before the others, the corresponding valueForNone is used.
-
Parameters:
-
a(Iterable<? extends A>) — the first iterable. Can be {@code null} (treated as empty). -
b(Iterable<? extends B>) — the second iterable. Can be {@code null} (treated as empty). -
c(Iterable<? extends C>) — the third iterable. Can be {@code null} (treated as empty). -
valueForNoneA(A) — the value to use if the first iterable runs out of values -
valueForNoneB(B) — the value to use if the second iterable runs out of values -
valueForNoneC(C) — the value to use if the third iterable runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Iterator<? extends A> a, final Iterator<? extends B> b, final Iterator<? extends C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three iterators into a single stream until all of them run out of values in parallel.
-
Contract:
- If any iterator runs out of values before the others, the corresponding valueForNone is used.
- If maxThreadNumForZipFunction is 1, this method behaves the same as the sequential zip operation.
-
Parameters:
-
a(Iterator<? extends A>) — the first iterator. Can be {@code null} (treated as empty). -
b(Iterator<? extends B>) — the second iterator. Can be {@code null} (treated as empty). -
c(Iterator<? extends C>) — the third iterator. Can be {@code null} (treated as empty). -
valueForNoneA(A) — the value to use if the first iterator runs out of values -
valueForNoneB(B) — the value to use if the second iterator runs out of values -
valueForNoneC(C) — the value to use if the third iterator runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the iterators. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
-
Signature:
public static <A, B, C, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final Stream<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips three streams into a single stream until all of them run out of values in parallel.
-
Contract:
- If any stream runs out of values before the others, the corresponding valueForNone is used.
-
Parameters:
-
a(Stream<A>) — the first stream. Must not be {@code null} . -
b(Stream<B>) — the second stream. Must not be {@code null} . -
c(Stream<C>) — the third stream. Must not be {@code null} . -
valueForNoneA(A) — the value to use if the first stream runs out of values -
valueForNoneB(B) — the value to use if the second stream runs out of values -
valueForNoneC(C) — the value to use if the third stream runs out of values -
zipFunction(TriFunction<? super A, ? super B, ? super C, ? extends R>) — the function to combine triplets of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
-
Signature:
public static <T, R> Stream<R> parallelZip(final Collection<? extends Stream<? extends T>> streams, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips a collection of streams into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when any stream runs out of elements.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream. Must not be {@code null} or empty. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
-
Signature:
public static <T, R> Stream<R> parallelZip(final Collection<? extends Stream<? extends T>> streams, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips multiple streams into a single stream until all of them run out of values in parallel.
-
Contract:
- If any stream runs out of values before the others, the corresponding value from valuesForNone is used.
- The size of valuesForNone must match the size of the streams collection.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of stream. Must not be {@code null} . -
valuesForNone(List<? extends T>) — the values to use if any stream runs out of values. Size must match streams size. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the streams. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: Stream#buffered(), Stream#buffered(int)
parallelZipIterables(...) -> Stream<R>
-
Signature:
public static <T, R> Stream<R> parallelZipIterables(final Collection<? extends Iterable<? extends T>> iterables, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips multiple iterables into a single stream until one of them runs out of values in parallel.
-
Contract:
- The iteration stops when any iterable runs out of elements.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of Iterable. Must not be {@code null} or empty. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: N#iterateEach(Collection)
-
Signature:
public static <T, R> Stream<R> parallelZipIterables(final Collection<? extends Iterable<? extends T>> iterables, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips multiple iterables into a single stream until all of them run out of values in parallel.
-
Contract:
- If any iterable runs out of values before the others, the corresponding value from valuesForNone is used.
- The size of valuesForNone must match the size of the iterables collection.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of Iterable. Must not be {@code null} . -
valuesForNone(List<? extends T>) — the values to use if any iterable runs out of values. Size must match iterables size. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterables. -
maxThreadNumForZipFunction(int) — the max thread number for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: N#iterateEach(Collection)
parallelZipIterators(...) -> Stream<R>
-
Signature:
public static <T, R> Stream<R> parallelZipIterators(final Collection<? extends Iterator<? extends T>> iterators, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips multiple iterators into a single stream until one of them runs out of values.
-
Contract:
- The stream terminates when any iterator is exhausted.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be zipped. Null iterators are treated as empty. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterators. -
maxThreadNumForZipFunction(int) — the maximum number of threads for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: #zipIterators(Collection, Function)
-
Signature:
public static <T, R> Stream<R> parallelZipIterators(final Collection<? extends Iterator<? extends T>> iterators, final List<? extends T> valuesForNone, final Function<? super List<T>, ? extends R> zipFunction, final int maxThreadNumForZipFunction) - Summary: Zips multiple iterators into a single stream until all of them run out of values.
-
Contract:
- When an iterator is exhausted, its corresponding value from {@code valuesForNone} is used.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be zipped. Null iterators are treated as empty. -
valuesForNone(List<? extends T>) — the default values to use when an iterator runs out of values. Must have same size as iterators. -
zipFunction(Function<? super List<T>, ? extends R>) — the function to combine lists of values from the iterators. -
maxThreadNumForZipFunction(int) — the maximum number of threads for executing the zipFunction. Must be positive.
-
- Returns: a stream of combined values
- See also: #zipIterators(Collection, List, Function)
merge(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> merge(final T[] a, final T[] b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two arrays into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the two arrays should be selected next.
- The arrays should be pre-sorted according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(T[]) — the first array to be merged. It should be ordered. Can be {@code null} or empty. -
b(T[]) — the second array to be merged. It should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next. Returns TAKE_FIRST to select from the first array, TAKE_SECOND for the second.
-
- Returns: a stream containing the merged elements from the two arrays
- See also: N#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static <T> Stream<T> merge(final T[] a, final T[] b, final T[] c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges three arrays into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the arrays should be selected next.
- All arrays should be pre-sorted according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(T[]) — the first array to be merged. It should be ordered. Can be {@code null} or empty. -
b(T[]) — the second array to be merged. It should be ordered. Can be {@code null} or empty. -
c(T[]) — the third array to be merged. It should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the three arrays
- See also: N#merge(Object\[\], Object\[\], BiFunction)
-
Signature:
public static <T> Stream<T> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two iterables into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the two iterables should be selected next.
- The iterables should be pre-sorted according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable to be merged. It should be ordered. Can be {@code null} or empty. -
b(Iterable<? extends T>) — the second iterable to be merged. It should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the two iterables
- See also: N#merge(Iterable, Iterable, BiFunction)
-
Signature:
public static <T> Stream<T> merge(final Iterable<? extends T> a, final Iterable<? extends T> b, final Iterable<? extends T> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges three iterables into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the iterables should be selected next.
- All iterables should be pre-sorted according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(Iterable<? extends T>) — the first iterable to be merged. It should be ordered. Can be {@code null} or empty. -
b(Iterable<? extends T>) — the second iterable to be merged. It should be ordered. Can be {@code null} or empty. -
c(Iterable<? extends T>) — the third iterable to be merged. It should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the three iterables
- See also: N#merge(Iterable, Iterable, BiFunction)
-
Signature:
public static <T> Stream<T> merge(final Iterator<? extends T> a, final Iterator<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two iterators into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the two iterators should be selected next.
- The iterators should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator to be merged. It should be ordered. Can be {@code null} (treated as empty). -
b(Iterator<? extends T>) — the second iterator to be merged. It should be ordered. Can be {@code null} (treated as empty). -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the two iterators
- See also: N#merge(Iterable, Iterable, BiFunction)
-
Signature:
public static <T> Stream<T> merge(final Iterator<? extends T> a, final Iterator<? extends T> b, final Iterator<? extends T> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges three iterators into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the iterators should be selected next.
- All iterators should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
-
Parameters:
-
a(Iterator<? extends T>) — the first iterator to be merged. It should be ordered. Can be {@code null} (treated as empty). -
b(Iterator<? extends T>) — the second iterator to be merged. It should be ordered. Can be {@code null} (treated as empty). -
c(Iterator<? extends T>) — the third iterator to be merged. It should be ordered. Can be {@code null} (treated as empty). -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the three iterators
- See also: N#merge(Iterable, Iterable, BiFunction)
-
Signature:
public static <T> Stream<T> merge(final Stream<? extends T> a, final Stream<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges two streams into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the two streams should be selected next.
- The streams should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
- The returned stream will automatically close both input streams when it is closed.
-
Parameters:
-
a(Stream<? extends T>) — the first stream to be merged. It should be ordered. Can be {@code null} (treated as empty). -
b(Stream<? extends T>) — the second stream to be merged. It should be ordered. Can be {@code null} (treated as empty). -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the two streams
-
Signature:
public static <T> Stream<T> merge(final Stream<? extends T> a, final Stream<? extends T> b, final Stream<? extends T> c, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges three streams into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the streams should be selected next.
- All streams should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
a(Stream<? extends T>) — the first stream to be merged. It should be ordered. Can be {@code null} (treated as empty). -
b(Stream<? extends T>) — the second stream to be merged. It should be ordered. Can be {@code null} (treated as empty). -
c(Stream<? extends T>) — the third stream to be merged. It should be ordered. Can be {@code null} (treated as empty). -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from the three streams
-
Signature:
public static <T> Stream<T> merge(final Collection<? extends Stream<? extends T>> streams, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges a collection of streams into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the streams should be selected next.
- All streams should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
- The returned stream will automatically close all input streams when it is closed.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of streams to be merged. Each stream should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all streams in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if nextSelector is null
-
mergeIterables(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> mergeIterables(final Collection<? extends Iterable<? extends T>> iterables, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges a collection of iterables into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the iterables should be selected next.
- All iterables should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterables to be merged. Each iterable should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all iterables in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if nextSelector is null
-
mergeIterators(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> mergeIterators(final Collection<? extends Iterator<? extends T>> iterators, final BiFunction<? super T, ? super T, MergeResult> nextSelector) throws IllegalArgumentException - Summary: Merges a collection of iterators into a single stream based on the provided nextSelector function.
-
Contract:
- The nextSelector function determines which element from the iterators should be selected next.
- All iterators should provide elements in pre-sorted order according to the same ordering that the nextSelector function expects.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be merged. Each iterator should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all iterators in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if nextSelector is null
-
parallelMerge(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> parallelMerge(final Collection<? extends Stream<? extends T>> streams, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges a collection of streams into a single stream in parallel using the default maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of streams, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of streams to be merged. Each stream should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all streams in the collection
- See also: #merge(Collection, BiFunction), #parallelMerge(Collection, BiFunction, int)
-
Signature:
public static <T> Stream<T> parallelMerge(final Collection<? extends Stream<? extends T>> streams, final BiFunction<? super T, ? super T, MergeResult> nextSelector, final int maxThreadNum) throws IllegalArgumentException - Summary: Merges a collection of streams into a single stream in parallel with specified maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of streams, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
streams(Collection<? extends Stream<? extends T>>) — the collection of streams to be merged. Each stream should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next. -
maxThreadNum(int) — the maximum number of threads for the parallel merge. Must be positive.
-
- Returns: a stream containing the merged elements from all streams in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if maxThreadNum is not positive
-
- See also: #merge(Collection, BiFunction)
parallelMergeIterables(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> parallelMergeIterables(final Collection<? extends Iterable<? extends T>> iterables, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges a collection of iterables into a single stream in parallel using the default maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of iterables, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterables to be merged. Each iterable should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all iterables in the collection
- See also: #mergeIterables(Collection, BiFunction), #parallelMergeIterables(Collection, BiFunction, int)
-
Signature:
public static <T> Stream<T> parallelMergeIterables(final Collection<? extends Iterable<? extends T>> iterables, final BiFunction<? super T, ? super T, MergeResult> nextSelector, final int maxThreadNum) throws IllegalArgumentException - Summary: Merges a collection of iterables into a single stream in parallel with specified maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of iterables, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
iterables(Collection<? extends Iterable<? extends T>>) — the collection of iterables to be merged. Each iterable should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next. -
maxThreadNum(int) — the maximum number of threads for the parallel merge. Must be positive.
-
- Returns: a stream containing the merged elements from all iterables in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if maxThreadNum is not positive
-
- See also: #mergeIterables(Collection, BiFunction)
parallelMergeIterators(...) -> Stream<T>
-
Signature:
public static <T> Stream<T> parallelMergeIterators(final Collection<? extends Iterator<? extends T>> iterators, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges a collection of iterators into a single stream in parallel using the default maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of iterators, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be merged. Each iterator should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next.
-
- Returns: a stream containing the merged elements from all iterators in the collection
- See also: #mergeIterators(Collection, BiFunction), #parallelMergeIterators(Collection, BiFunction, int)
-
Signature:
public static <T> Stream<T> parallelMergeIterators(final Collection<? extends Iterator<? extends T>> iterators, final BiFunction<? super T, ? super T, MergeResult> nextSelector, final int maxThreadNum) throws IllegalArgumentException - Summary: Merges a collection of iterators into a single stream in parallel with specified maximum thread number.
-
Contract:
- <p> This method provides better performance than sequential merge for large collections of iterators, but is not totally lazy evaluation and may cause {@code OutOfMemoryError} if there are too many elements merged into the intermediate queues.
-
Parameters:
-
iterators(Collection<? extends Iterator<? extends T>>) — the collection of iterators to be merged. Each iterator should be ordered. Can be {@code null} or empty. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a function that determines which element to select next. -
maxThreadNum(int) — the maximum number of threads for the parallel merge. Must be positive.
-
- Returns: a stream containing the merged elements from all iterators in the collection
-
Throws:
-
java.lang.IllegalArgumentException— if maxThreadNum is not positive
-
- See also: #mergeIterators(Collection, BiFunction)
Public Instance Methods
filter(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract Stream<T> filter(Predicate<? super T> predicate) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- The predicate should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine if it should be included
-
- Returns: a new Stream consisting of the elements that match the given predicate
- See also: #filter(Predicate, Consumer), #takeWhile(Predicate), #dropWhile(Predicate)
-
Signature:
@Beta @ParallelSupported @IntermediateOp @Override public abstract Stream<T> filter(Predicate<? super T> predicate, Consumer<? super T> onDrop) - Summary: Returns a stream consisting of the elements of this stream that match the given predicate.
-
Contract:
- If an element does not match the predicate, the provided action {@code onDrop} is applied to that element.
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
- Both the predicate and action should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine if it should be included -
onDrop(Consumer<? super T>) — the action to perform on the elements that do not match the predicate. This action is only applied to the elements that do not match the predicate and pulled by downstream/terminal operation. Must be {@code non-null} .
-
- Returns: a new Stream consisting of the elements that match the given predicate
- See also: #filter(Predicate), #onEach(Consumer), #peek(Consumer)
takeWhile(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract Stream<T> takeWhile(Predicate<? super T> predicate) - Summary: Returns a stream consisting of the longest prefix of elements from this stream that satisfy the given predicate.
-
Contract:
- <p> <b> Notes on parallel unordered streams: </b> <br> In parallel Streams, elements beyond the first non-matching element might still be evaluated and may appear in the result if they individually satisfy the predicate.
- This can produce results that appear unexpected when the stream does not have a defined encounter order.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine when to stop taking elements
-
- Returns: a new Stream consisting of elements taken while the predicate returns true
- See also: #dropWhile(Predicate), #filter(Predicate), #limit(long)
dropWhile(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @Override public abstract Stream<T> dropWhile(Predicate<? super T> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements
-
- Returns: a new stream consisting of the remaining elements of this stream after dropping elements while the given predicate returns {@code true}
- See also: #takeWhile(Predicate), #filter(Predicate), #skip(long)
-
Signature:
@Beta @ParallelSupported @IntermediateOp @Override public abstract Stream<T> dropWhile(Predicate<? super T> predicate, Consumer<? super T> onDrop) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements from the start while the given predicate evaluates to {@code true} .
-
Contract:
- This may lead to results that appear unintuitive when the stream has no defined encounter order.
- The implementation should ensure the action is thread-safe when used with parallel streams.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine when to stop dropping elements -
onDrop(Consumer<? super T>) — the action to perform on the elements that match the predicate (are being dropped). This action is only applied to the elements that match the predicate and pulled by downstream/terminal operation. Must be {@code non-null} .
-
- Returns: a new Stream consisting of the remaining elements after the elements that match the predicate have been removed
- See also: #dropWhile(Predicate), #filter(Predicate, Consumer), #skipUntil(Predicate)
skipUntil(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp @Override public abstract Stream<T> skipUntil(Predicate<? super T> predicate) - Summary: Returns a stream consisting of the remaining elements of this stream after discarding elements until the given predicate evaluates to {@code true} .
-
Contract:
- This can produce results that appear unintuitive when the stream does not define an encounter order.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate that tests each element to determine when to start including elements
-
- Returns: a new Stream consisting of the remaining elements starting from the first element that matches the predicate
- See also: #dropWhile(Predicate), #takeWhile(Predicate), #skip(long)
onEach(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp @Override public abstract Stream<T> onEach(Consumer<? super T> action) - Summary: Performs the given action on the elements pulled by downstream/terminal operation.
-
Contract:
- <p> The action should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
action(Consumer<? super T>) — the action to be performed on the elements pulled by downstream/terminal operation.
-
- Returns: a new Stream consisting of the elements of this stream with the provided action applied to each element.
- See also: #peek(Consumer), #forEach(Throwables.Consumer)
peek(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @Override public Stream<T> peek(final Consumer<? super T> action) - Summary: Performs the provided action on the elements pulled by downstream/terminal operation.
-
Contract:
- The action is executed when elements are consumed by downstream operations.
- <p> The action should be non-interfering and stateless for correct behavior in parallel streams.
- This method is primarily intended for debugging and should not be used to modify the stream elements or perform critical business logic.
-
Parameters:
-
action(Consumer<? super T>) — the action to be performed on the elements pulled by downstream/terminal operation.
-
- Returns: a new Stream consisting of the elements of this stream with the provided action applied to each element.
- See also: #onEach(Consumer), #forEach(Throwables.Consumer)
select(...) -> Stream<U>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<U> select(final Class<? extends U> targetType) - Summary: Selects the elements that belong to the specified {@code targetType} , including its subtypes.
-
Parameters:
-
targetType(Class<? extends U>) — the class of the type to be selected.
-
- Returns: a new Stream containing elements of the specified type
- See also: #filter(Predicate), #map(Function)
pairWith(...) -> Stream<Pair<T, U>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T, U>> pairWith(final Function<? super T, ? extends U> extractor) - Summary: Pairs each element in the stream with the result of applying the provided function to that element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The extractor function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
extractor(Function<? super T, ? extends U>) — the function to be applied to each element in the stream.
-
- Returns: a new Stream of Pairs, where each Pair consists of an element from the original stream and its corresponding value obtained by applying the extractor function.
- See also: #map(Function), #zipWith(Collection, BiFunction)
map(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> map(final Function<? super T, ? extends R> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream.
- See also: #flatMap(Function), #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction)
mapIfNotNull(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapIfNotNull(final Function<? super T, ? extends R> mapper) - Summary: Transforms the elements in the stream by applying a function to each element if it's not {@code null} , otherwise skips it.
-
Contract:
- Transforms the elements in the stream by applying a function to each element if it's not {@code null} , otherwise skips it.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — a non-interfering, stateless function that transforms each {@code non-null} element
-
- Returns: a new Stream consisting of the results of applying the given function to the {@code non-null} elements of this stream
- See also: #map(Function), #skipNulls(), #filter(Predicate)
slidingMap(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each adjacent pair of elements in this stream.
-
Contract:
- If the stream contains only one element \[a\], the resulting stream will contain \[f(a,null)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(BiFunction<? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each adjacent pair of this stream's elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each adjacent pair of elements in this stream
- See also: #sliding(int), #slidingMap(int, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(int increment, BiFunction<? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each pair of elements separated by the specified increment in this stream.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d\] and increment=2, pairs are taken every 2 elements: \[f(a,b), f(c,d)\].
- If this stream contains elements \[a, b, c, d, e\] and increment=2, the resulting stream will contain \[f(a,b), f(c,d), f(e,null)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair. Must be positive. -
mapper(BiFunction<? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each pair of elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each pair of elements
- See also: #slidingMap(BiFunction), #slidingMap(int, boolean, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(int increment, boolean ignoreNotPaired, BiFunction<? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each pair of elements separated by the specified increment in this stream.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d, e\] and increment=2, ignoreNotPaired=false, the resulting stream will contain \[f(a,b), f(c,d), f(e,null)\].
- If this stream contains elements \[a, b, c, d, e\] and increment=2, ignoreNotPaired=true, the resulting stream will contain \[f(a,b), f(c,d)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair. Must be positive. -
ignoreNotPaired(boolean) — if {@code false} , unpaired elements will be processed with {@code null} as their pair; if {@code true} , the last element will be ignored if there is no element to pair with it. -
mapper(BiFunction<? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each pair of elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each pair of elements
- See also: #slidingMap(int, BiFunction), #sliding(int, int)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T, ? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each adjacent triple of elements in this stream.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d, e\], the resulting stream will contain \[f(a,b,c), f(b,c,d), f(c,d,e)\], where f is the provided mapping function.
- If this stream contains only one element \[a\], the resulting stream will contain \[f(a,null,null)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(TriFunction<? super T, ? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each adjacent triple of this stream's elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each adjacent triple of elements in this stream
- See also: #slidingMap(BiFunction), #slidingMap(int, TriFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(int increment, TriFunction<? super T, ? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each triple of elements separated by the specified increment in this stream.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d, e, f\] and increment=3, the resulting stream will contain \[f(a,b,c), f(d,e,f)\].
- If this stream contains elements \[a, b, c, d, e, f, g, h\] and increment=3, the resulting stream will contain \[f(a,b,c), f(d,e,f), f(g,h,null)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple. Must be positive. -
mapper(TriFunction<? super T, ? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each triple of elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each triple of elements
- See also: #slidingMap(TriFunction), #slidingMap(int, boolean, TriFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(int increment, boolean ignoreNotPaired, TriFunction<? super T, ? super T, ? super T, ? extends R> mapper) - Summary: Returns a stream consisting of the results of applying the given function to each triple of elements separated by the specified increment in this stream.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d, e, f, g\] and increment=3, ignoreNotPaired=false, the resulting stream will contain \[f(a,b,c), f(d,e,f), f(g,null,null)\].
- If this stream contains elements \[a, b, c, d, e, f, g\] and increment=3, ignoreNotPaired=true, the resulting stream will contain \[f(a,b,c), f(d,e,f)\].
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple. Must be positive. -
ignoreNotPaired(boolean) — if {@code false} , unpaired elements will be processed with {@code null} as their pair; if {@code true} , the last elements will be ignored if there are not enough elements to form a complete triple. -
mapper(TriFunction<? super T, ? super T, ? super T, ? extends R>) — a non-interfering, stateless function that transforms each triple of elements
-
- Returns: a new stream consisting of the results of applying the mapper function to each triple of elements
- See also: #slidingMap(int, TriFunction), #sliding(int, int)
rangeMap(...) -> Stream<U>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<U> rangeMap(final BiPredicate<? super T, ? super T> sameRange, final BiFunction<? super T, ? super T, ? extends U> mapper) - Summary: Returns a stream consisting of the results of applying the given mapper function to the first and last element of the ranges in this stream, where elements in a range are determined by the sameRange predicate.
-
Contract:
- If {@code true} is returned, the next element belongs to the same range as the first element.
- <p> For example, if this stream contains elements \[1, 2, 3, 10, 11, 20, 21\] and the sameRange predicate returns true when the difference between elements is less than 2, the stream will map ranges \[1,2\], \[3,3\], \[10,11\], \[20,21\].
-
Parameters:
-
sameRange(BiPredicate<? super T, ? super T>) — a predicate that determines if the next element belongs to the same range as the first element of the current range. The first argument tested by sameRange is the first(not the last) element of the current range, and the second argument is the next element to check. If {@code true} is returned, the next element belongs to the same range as the first element. -
mapper(BiFunction<? super T, ? super T, ? extends U>) — a function that maps a range (defined by its first and last element) to an output element.
-
- Returns: a new stream consisting of the results of applying the mapper function to each range of elements
- See also: #collapse(BiPredicate), #groupBy(Function)
mapFirst(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> mapFirst(Function<? super T, ? extends T> mapperForFirst) - Summary: Returns a stream consisting of the elements of this stream with the first element transformed by the given function.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d\], the resulting stream will contain \[f(a), b, c, d\], where f is the provided mapping function.
-
Parameters:
-
mapperForFirst(Function<? super T, ? extends T>) — a non-interfering, stateless function to apply to the first element of this stream.
-
- Returns: a new stream consisting of the transformed first element and the unchanged remaining elements of this stream
- See also: #mapFirstOrElse(Function, Function), #mapLast(Function)
mapFirstOrElse(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapFirstOrElse(Function<? super T, ? extends R> mapperForFirst, Function<? super T, ? extends R> mapperForElse) - Summary: Returns a stream consisting of the elements of this stream with the first element transformed by the specified {@code mapperForFirst} and all other elements transformed by {@code mapperForElse} .
-
Contract:
- <p> This operation is parallel supported and can be parallelized if the stream supports parallel processing.
- <p> For example, if this stream contains elements \[a, b, c, d\], the resulting stream will contain \[f(a), g(b), g(c), g(d)\], where f is the mapperForFirst function and g is the mapperForElse function.
-
Parameters:
-
mapperForFirst(Function<? super T, ? extends R>) — a non-interfering, stateless function to apply to the first element of this stream. -
mapperForElse(Function<? super T, ? extends R>) — a non-interfering, stateless function to apply to all other elements of this stream.
-
- Returns: a new stream consisting of the results of applying the appropriate mapper function to each element
- See also: #mapFirst(Function), #mapLastOrElse(Function, Function)
mapLast(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> mapLast(Function<? super T, ? extends T> mapperForLast) - Summary: Returns a stream consisting of the elements of this stream with the last element transformed by the given function.
-
Contract:
- <p> For example, if this stream contains elements \[a, b, c, d\], the resulting stream will contain \[a, b, c, f(d)\], where f is the provided mapping function.
-
Parameters:
-
mapperForLast(Function<? super T, ? extends T>) — a non-interfering, stateless function to apply to the last element of this stream.
-
- Returns: a new stream consisting of the unchanged elements and the transformed last element of this stream
- See also: #mapLastOrElse(Function, Function), #mapFirst(Function)
mapLastOrElse(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapLastOrElse(Function<? super T, ? extends R> mapperForLast, Function<? super T, ? extends R> mapperForElse) - Summary: Returns a stream consisting of the elements of this stream with the last element transformed by the specified {@code mapperForLast} and all other elements transformed by {@code mapperForElse} .
-
Contract:
- <p> This operation is parallel supported and can be parallelized if the stream supports parallel processing.
- <p> For example, if this stream contains elements \[a, b, c, d\], the resulting stream will contain \[f(a), f(b), f(c), g(d)\], where f is the mapperForElse function and g is the mapperForLast function.
-
Parameters:
-
mapperForLast(Function<? super T, ? extends R>) — a non-interfering, stateless function to apply to the last element of this stream. -
mapperForElse(Function<? super T, ? extends R>) — a non-interfering, stateless function to apply to all other elements of this stream.
-
- Returns: a new stream consisting of the results of applying the appropriate mapper function to each element
- See also: #mapLast(Function), #mapFirstOrElse(Function, Function)
mapToChar(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream mapToChar(ToCharFunction<? super T> mapper) - Summary: Transforms this stream to a {@code CharStream} by applying the specified {@code ToCharFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToCharFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new CharStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction)
mapToByte(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream mapToByte(ToByteFunction<? super T> mapper) - Summary: Transforms this stream to a {@code ByteStream} by applying the specified {@code ToByteFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToByteFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ByteStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction)
mapToShort(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream mapToShort(ToShortFunction<? super T> mapper) - Summary: Transforms this stream to a {@code ShortStream} by applying the specified {@code ToShortFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToShortFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ShortStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction)
mapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(ToIntFunction<? super T> mapper) - Summary: Transforms this stream to an {@code IntStream} by applying the specified {@code ToIntFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new IntStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction), #map(Function)
mapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream mapToLong(ToLongFunction<? super T> mapper) - Summary: Transforms this stream to a {@code LongStream} by applying the specified {@code ToLongFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new LongStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToDouble(ToDoubleFunction), #map(Function)
mapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(ToFloatFunction<? super T> mapper) - Summary: Transforms this stream to a {@code FloatStream} by applying the specified {@code ToFloatFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToFloatFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new FloatStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #mapToDouble(ToDoubleFunction)
mapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper) - Summary: Transforms this stream to a {@code DoubleStream} by applying the specified {@code ToDoubleFunction} to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new DoubleStream consisting of the results of applying the given function to the elements of this stream.
- See also: #mapToInt(ToIntFunction), #mapToLong(ToLongFunction), #map(Function)
mapToEntry(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K, V> mapToEntry(Function<? super T, ? extends Map.Entry<? extends K, ? extends V>> mapper) - Summary: Transforms the elements in the stream into Map.Entry instances by applying the provided function to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Map.Entry<? extends K, ? extends V>>) — the function to be applied to each element in the stream, which should return a Map.Entry instance.
-
- Returns: a new EntryStream consisting of Map.Entry instances obtained by applying the mapper function to the elements of this stream.
- See also: #mapToEntry(Function, Function), #flatMapToEntry(Function)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K, V> mapToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper) - Summary: Transforms the elements in the stream into Map.Entry instances by applying the provided key and value mapping functions to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to generate the key. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to generate the value.
-
- Returns: a new EntryStream consisting of Map.Entry instances obtained by applying the key and value mapping functions to the elements of this stream.
- See also: #mapToEntry(Function), #groupBy(Function, Function)
flatMap(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a Stream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Stream<? extends R>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
- See also: #flatmap(Function), #map(Function), #flatten(Collection)
flatmap(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatmap(Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a Collection of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends R>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped collection produced by applying the provided mapping function to each element.
- See also: #flatMap(Function), #flattmap(Function), #map(Function)
flattmap(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattmap(Function<? super T, R[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return an array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, R[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped array produced by applying the provided mapping function to each element.
- See also: #flatMap(Function), #flatmap(Function), #flattMap(Function)
flattMap(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattMap(Function<? super T, ? extends java.util.stream.Stream<? extends R>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a java.util.stream.Stream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends java.util.stream.Stream<? extends R>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.
- See also: #flatMap(Function), #flatmap(Function), #flattmap(Function)
flatMapToChar(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream flatMapToChar(Function<? super T, ? extends CharStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a CharStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends CharStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new CharStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped CharStream produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatMapToLong(Function), #flatMapToDouble(Function)
flatmapToChar(...) -> CharStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract CharStream flatmapToChar(Function<? super T, char[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a char array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, char[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new CharStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped char array produced by applying the provided mapping function to each element.
- See also: #flatMapToChar(Function), #flatmapToInt(Function)
flatMapToByte(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream flatMapToByte(Function<? super T, ? extends ByteStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a ByteStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends ByteStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ByteStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped ByteStream produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatMapToLong(Function), #flatMapToDouble(Function)
flatmapToByte(...) -> ByteStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ByteStream flatmapToByte(Function<? super T, byte[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a byte array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, byte[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ByteStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped byte array produced by applying the provided mapping function to each element.
- See also: #flatMapToByte(Function), #flatmapToInt(Function)
flatMapToShort(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream flatMapToShort(Function<? super T, ? extends ShortStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a ShortStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends ShortStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ShortStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped ShortStream produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatMapToLong(Function), #flatMapToDouble(Function)
flatmapToShort(...) -> ShortStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract ShortStream flatmapToShort(Function<? super T, short[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a short array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, short[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new ShortStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped short array produced by applying the provided mapping function to each element.
- See also: #flatMapToShort(Function), #flatmapToInt(Function)
flatMapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return an IntStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends IntStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new IntStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped IntStream produced by applying the provided mapping function to each element.
- See also: #flatMapToLong(Function), #flatMapToDouble(Function), #mapToInt(ToIntFunction)
flatmapToInt(...) -> IntStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract IntStream flatmapToInt(Function<? super T, int[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return an array of int elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, int[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new IntStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped int array produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatmapToLong(Function)
flatMapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a LongStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends LongStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new LongStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped LongStream produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatMapToDouble(Function), #mapToLong(ToLongFunction)
flatmapToLong(...) -> LongStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract LongStream flatmapToLong(Function<? super T, long[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a long array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, long[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new LongStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped long array produced by applying the provided mapping function to each element.
- See also: #flatMapToLong(Function), #flatmapToInt(Function)
flatMapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(Function<? super T, ? extends FloatStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a FloatStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends FloatStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new FloatStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped FloatStream produced by applying the provided mapping function to each element.
- See also: #flatMapToDouble(Function), #mapToFloat(ToFloatFunction)
flatmapToFloat(...) -> FloatStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract FloatStream flatmapToFloat(Function<? super T, float[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a float array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, float[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new FloatStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped float array produced by applying the provided mapping function to each element.
- See also: #flatMapToFloat(Function), #flatmapToDouble(Function)
flatMapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a DoubleStream of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends DoubleStream>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new DoubleStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped DoubleStream produced by applying the provided mapping function to each element.
- See also: #flatMapToInt(Function), #flatMapToLong(Function), #mapToDouble(ToDoubleFunction)
flatmapToDouble(...) -> DoubleStream
-
Signature:
@ParallelSupported @IntermediateOp public abstract DoubleStream flatmapToDouble(Function<? super T, double[]> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a double array of elements.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, double[]>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new DoubleStream consisting of the elements obtained by replacing each element of this stream with the contents of a mapped double array produced by applying the provided mapping function to each element.
- See also: #flatMapToDouble(Function), #flatmapToLong(Function)
flatMapToEntry(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K, V> flatMapToEntry(Function<? super T, ? extends Stream<? extends Map.Entry<? extends K, ? extends V>>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a Stream of Map.Entry instances.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Stream<? extends Map.Entry<? extends K, ? extends V>>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new EntryStream consisting of Map.Entry instances obtained by applying the mapper function to the elements of this stream.
- See also: #flatmapToEntry(Function), #mapToEntry(Function, Function)
flatmapToEntry(...) -> EntryStream<K, V>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K, V> flatmapToEntry(Function<? super T, ? extends Map<? extends K, ? extends V>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return a Map of key-value pairs.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Map<? extends K, ? extends V>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new EntryStream consisting of Map.Entry instances obtained by transforming each element of this stream into a Map and then flattening these Maps into a stream of their entries.
- See also: #flatMapToEntry(Function), #mapToEntry(Function, Function)
flattMapToEntry(...) -> EntryStream<K, V>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K, V> flattMapToEntry(Function<? super T, ? extends EntryStream<? extends K, ? extends V>> mapper) - Summary: Transforms the elements in the stream by applying a function to each element.
-
Contract:
- The function should return an EntryStream of key-value pairs.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends EntryStream<? extends K, ? extends V>>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new EntryStream consisting of key-value pairs obtained by transforming each element of this stream into an EntryStream and then flattening these EntryStreams into a single EntryStream.
- See also: #flatMapToEntry(Function), #flatmapToEntry(Function)
flatmapIfNotNull(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatmapIfNotNull(final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Applies a flat mapping operation on the stream, but only for {@code non-null} elements.
-
Contract:
- <p> This is an intermediate operation that is equivalent to: {@code skipNulls().flatmap(mapper)} <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends R>>) — a Function that takes an element and produces a Collection of new elements.
-
- Returns: a new Stream consisting of the results of applying the Function to each {@code non-null} element
- See also: #flatmap(Function), #skipNulls(), #mapIfNotNull(Function)
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <U, R> Stream<R> flatmapIfNotNull(final Function<? super T, ? extends Collection<? extends U>> mapper, final Function<? super U, ? extends Collection<? extends R>> secondMapper) - Summary: Applies a flat mapping operation on the stream, but only for {@code non-null} elements.
-
Contract:
- <p> This is an intermediate operation that is equivalent to: {@code skipNulls().flatmap(mapper).skipNulls().flatmap(secondMapper)} <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends U>>) — a Function that takes an element and produces a Collection of intermediate elements. -
secondMapper(Function<? super U, ? extends Collection<? extends R>>) — a Function that takes an intermediate element and produces a Collection of new elements.
-
- Returns: a new Stream consisting of the results of applying the Functions to each {@code non-null} element
- See also: #flatmapIfNotNull(Function), #flatmap(Function), #skipNulls()
mapMulti(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapMulti(BiConsumer<? super T, ? super Consumer<R>> mapper) - Summary: Applies a mapping operation on the stream with multiple output elements for each input element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(BiConsumer<? super T, ? super Consumer<R>>) — a BiConsumer that takes an input element and a Consumer for output elements, and produces multiple output elements for each input element.
-
- Returns: a new Stream consisting of all output elements produced by the BiConsumer for each input element.
- See also: #flatMap(Function), #mapMultiToInt(BiConsumer), #mapMultiToLong(BiConsumer), #mapMultiToDouble(BiConsumer)
mapMultiToInt(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream mapMultiToInt(BiConsumer<? super T, ? super IntConsumer> mapper) - Summary: Applies a mapping operation on the stream with multiple output integers for each input element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(BiConsumer<? super T, ? super IntConsumer>) — a BiConsumer that takes an input element and an IntConsumer for output integers, and produces multiple output integers for each input element.
-
- Returns: a new IntStream consisting of all output integers produced by the BiConsumer for each input element.
- See also: #mapMulti(BiConsumer), #mapMultiToLong(BiConsumer), #mapMultiToDouble(BiConsumer)
mapMultiToLong(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream mapMultiToLong(BiConsumer<? super T, ? super LongConsumer> mapper) - Summary: Applies a mapping operation on the stream with multiple output longs for each input element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(BiConsumer<? super T, ? super LongConsumer>) — a BiConsumer that takes an input element and a LongConsumer for output longs, and produces multiple output longs for each input element.
-
- Returns: a new LongStream consisting of all output longs produced by the BiConsumer for each input element.
- See also: #mapMulti(BiConsumer), #mapMultiToInt(BiConsumer), #mapMultiToDouble(BiConsumer)
mapMultiToDouble(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapMultiToDouble(BiConsumer<? super T, ? super DoubleConsumer> mapper) - Summary: Applies a mapping operation on the stream with multiple output doubles for each input element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(BiConsumer<? super T, ? super DoubleConsumer>) — a BiConsumer that takes an input element and a DoubleConsumer for output doubles, and produces multiple output doubles for each input element.
-
- Returns: a new DoubleStream consisting of all output doubles produced by the BiConsumer for each input element.
- See also: #mapMulti(BiConsumer), #mapMultiToInt(BiConsumer), #mapMultiToLong(BiConsumer)
mapPartial(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapPartial(Function<? super T, Optional<R>> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the Optional is empty, the element is not included in the resulting stream.
- If the Optional contains a value, that value is included in the resulting stream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, Optional<R>>) — a Function that takes an element and produces an Optional of a new element of type R.
-
- Returns: a new Stream consisting of the results of applying the Function to each element
- See also: #mapPartialJdk(Function), #filter(Predicate), #map(Function)
mapPartialToInt(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartialToInt(Function<? super T, OptionalInt> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalInt is empty, the element is not included in the resulting IntStream.
- If the OptionalInt contains a value, that value is included in the resulting IntStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, OptionalInt>) — a Function that takes an element and produces an OptionalInt of a new element.
-
- Returns: a new IntStream consisting of the results of applying the Function to each element
- See also: #mapPartial(Function), #mapPartialToLong(Function), #mapPartialToDouble(Function)
mapPartialToLong(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartialToLong(Function<? super T, OptionalLong> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalLong is empty, the element is not included in the resulting LongStream.
- If the OptionalLong contains a value, that value is included in the resulting LongStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, OptionalLong>) — a Function that takes an element and produces an OptionalLong of a new element.
-
- Returns: a new LongStream consisting of the results of applying the Function to each element
- See also: #mapPartial(Function), #mapPartialToInt(Function), #mapPartialToDouble(Function)
mapPartialToDouble(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartialToDouble(Function<? super T, OptionalDouble> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalDouble is empty, the element is not included in the resulting DoubleStream.
- If the OptionalDouble contains a value, that value is included in the resulting DoubleStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, OptionalDouble>) — a Function that takes an element and produces an OptionalDouble of a new element.
-
- Returns: a new DoubleStream consisting of the results of applying the Function to each element
- See also: #mapPartial(Function), #mapPartialToInt(Function), #mapPartialToLong(Function)
mapPartialJdk(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapPartialJdk(Function<? super T, java.util.Optional<R>> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the Optional is empty, the element is not included in the resulting stream.
- If the Optional contains a value, that value is included in the resulting stream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, java.util.Optional<R>>) — a Function that takes an element and produces a java.util.Optional of a new element of type R.
-
- Returns: a new Stream consisting of the results of applying the Function to each element
- See also: #mapPartial(Function), #mapPartialToIntJdk(Function), #mapPartialToLongJdk(Function), #mapPartialToDoubleJdk(Function)
mapPartialToIntJdk(...) -> IntStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartialToIntJdk(Function<? super T, java.util.OptionalInt> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalInt is empty, the element is not included in the resulting IntStream.
- If the OptionalInt contains a value, that value is included in the resulting IntStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, java.util.OptionalInt>) — a Function that takes an element and produces a java.util.OptionalInt of a new element.
-
- Returns: a new IntStream consisting of the results of applying the Function to each element
- See also: #mapPartialJdk(Function), #mapPartialToInt(Function)
mapPartialToLongJdk(...) -> LongStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartialToLongJdk(Function<? super T, java.util.OptionalLong> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalLong is empty, the element is not included in the resulting LongStream.
- If the OptionalLong contains a value, that value is included in the resulting LongStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, java.util.OptionalLong>) — a Function that takes an element and produces a java.util.OptionalLong of a new element.
-
- Returns: a new LongStream consisting of the results of applying the Function to each element
- See also: #mapPartialJdk(Function), #mapPartialToLong(Function)
mapPartialToDoubleJdk(...) -> DoubleStream
-
Signature:
@Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartialToDoubleJdk(Function<? super T, java.util.OptionalDouble> mapper) - Summary: Applies a partial mapping operation on the stream.
-
Contract:
- If the OptionalDouble is empty, the element is not included in the resulting DoubleStream.
- If the OptionalDouble contains a value, that value is included in the resulting DoubleStream.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The mapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
mapper(Function<? super T, java.util.OptionalDouble>) — a Function that takes an element and produces a java.util.OptionalDouble of a new element.
-
- Returns: a new DoubleStream consisting of the results of applying the Function to each element
- See also: #mapPartialJdk(Function), #mapPartialToDouble(Function)
groupBy(...) -> Stream<Map.Entry<K, List<T>>>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K, List<T>>> groupBy(final Function<? super T, ? extends K> keyMapper) - Summary: Groups the elements of the stream by the classification function provided.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The keyMapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is a list of elements belonging to that group.
- See also: #groupBy(Function, Supplier), #groupBy(Function, Function), #groupBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K, List<T>>> groupBy(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends Map<K, List<T>>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The keyMapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
mapFactory(Supplier<? extends Map<K, List<T>>>) — a supplier to create the resulting map.
-
- Returns: a new Stream consisting of entries where the key is the group identifier and the value is a list of elements belonging to that group.
- See also: #groupBy(Function), #groupBy(Function, Function, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K, List<V>>> groupBy(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group.
-
- Returns: a new Stream consisting of entries where the key is the group identifier and the value is a list of elements that mapped to the corresponding key.
- See also: #groupBy(Function, Function, Supplier), Collectors#toMultimap(Function, Function)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K, List<V>>> groupBy(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Supplier<? extends Map<K, List<V>>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
mapFactory(Supplier<? extends Map<K, List<V>>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new Stream consisting of entries where the key is the group identifier and the value is a list of elements that mapped to the corresponding key.
- See also: #groupBy(Function, Function), Collectors#toMultimap(Function, Function, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> Stream<Map.Entry<K, D>> groupBy(Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream) - Summary: Groups the elements of the stream by the classification function provided and then applies a Collector to the elements of each group.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The keyMapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of applying the Collector to the elements of the group.
- See also: #groupBy(Function, Collector, Supplier), Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> Stream<Map.Entry<K, D>> groupBy(Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Summary: Groups the elements of the stream by the classification function provided and then applies a Collector to the elements of each group.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The keyMapper function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group. -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of applying the Collector to the elements of the group.
- See also: #groupBy(Function, Collector), Collectors#groupingBy(Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> Stream<Map.Entry<K, D>> groupBy(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Collector<? super V, ?, D> downstream) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element, and then applies a Collector to the values of each group.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
downstream(Collector<? super V, ?, D>) — the Collector to be applied to the values of each group.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of applying the Collector to the values of the group.
- See also: #groupBy(Function, Function, Collector, Supplier), Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> Stream<Map.Entry<K, D>> groupBy(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Collector<? super V, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element, and then applies a Collector to the values of each group.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
downstream(Collector<? super V, ?, D>) — the Collector to be applied to the values of each group. -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of applying the Collector to the values of the group.
- See also: #groupBy(Function, Function, Collector), Collectors#groupingBy(Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K, V>> groupBy(Function<? super T, ? extends K> keyMapper, final Function<? super T, ? extends V> valueMapper, BinaryOperator<V> mergeFunction) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element, and then merges the values of each group using a merge function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both mapper functions and the merge function should be non-interfering and stateless for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
mergeFunction(BinaryOperator<V>) — the function to be applied for merging the values of each group.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of merging the values of the group using the merge function.
- See also: #groupBy(Function, Function, Collector), Collectors#groupingBy(Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K, V>> groupBy(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K, V>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Contract:
- In parallel streams, the merge function must be associative and stateless.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
mergeFunction(BinaryOperator<V>) — the function to be used for merging values in case of key collision. -
mapFactory(Supplier<? extends Map<K, V>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new Stream consisting of Map.Entry instances where the key is the group identifier and the value is the result of applying the value mapping function to the elements of the group and merging them using the merge function
- See also: #groupByToEntry(Function, Function, BinaryOperator, Supplier), #groupTo(Throwables.Function, Throwables.Function, Collector, Supplier)
groupByToEntry(...) -> EntryStream<K, List<T>>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K, List<T>> groupByToEntry(Function<? super T, ? extends K> keyMapper) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is a list of elements belonging to that group
- See also: #groupByToEntry(Function, Supplier), #groupTo(Throwables.Function)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K, List<T>> groupByToEntry(Function<? super T, ? extends K> keyMapper, Supplier<? extends Map<K, List<T>>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
mapFactory(Supplier<? extends Map<K, List<T>>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is a list of elements belonging to that group
- See also: #groupByToEntry(Function), #groupTo(Throwables.Function, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K, List<V>> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is a list of elements that were mapped to that key
- See also: #groupByToEntry(Function, Function, Supplier), #groupTo(Throwables.Function, Throwables.Function)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K, List<V>> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Supplier<? extends Map<K, List<V>>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
mapFactory(Supplier<? extends Map<K, List<V>>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is a list of elements that were mapped to that key
- See also: #groupByToEntry(Function, Function), #groupTo(Throwables.Function, Throwables.Function, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> EntryStream<K, D> groupByToEntry(Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the Collector to the elements of the group
- See also: #groupByToEntry(Function, Collector, Supplier), #groupTo(Throwables.Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> EntryStream<K, D> groupByToEntry(Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group. -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the Collector to the elements of the group
- See also: #groupByToEntry(Function, Collector), #groupTo(Throwables.Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> EntryStream<K, D> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Collector<? super V, ?, D> downstream) - Summary: Groups the elements of the stream by applying a key mapping function, a value mapping function, and a Collector to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value for the Collector. -
downstream(Collector<? super V, ?, D>) — the Collector to be applied to the values of each group.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the Collector to the values of the group
- See also: #groupByToEntry(Function, Function, Collector, Supplier), #groupTo(Throwables.Function, Throwables.Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> EntryStream<K, D> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, Collector<? super V, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function, a value mapping function, and a Collector to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value for the Collector. -
downstream(Collector<? super V, ?, D>) — the Collector to be applied to the values of each group. -
mapFactory(Supplier<? extends Map<K, D>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the Collector to the values of the group
- See also: #groupByToEntry(Function, Function, Collector), #groupTo(Throwables.Function, Throwables.Function, Collector, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K, V> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BinaryOperator<V> mergeFunction) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value for the BinaryOperator. -
mergeFunction(BinaryOperator<V>) — the BinaryOperator to be applied to the values of each group.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the BinaryOperator to the values of the group
- See also: #groupByToEntry(Function, Function, BinaryOperator, Supplier), #groupBy(Function, Function, BinaryOperator, Supplier)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K, V> groupByToEntry(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K, V>> mapFactory) - Summary: Groups the elements of the stream by applying a key mapping function and a value mapping function to each element.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the function to be applied to each element in the stream to determine the group it belongs to. -
valueMapper(Function<? super T, ? extends V>) — the function to be applied to each element in the stream to determine its value in the group. -
mergeFunction(BinaryOperator<V>) — the function to be used for merging values in case of key collision. -
mapFactory(Supplier<? extends Map<K, V>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the group identifier and the value is the result of applying the value mapping function to the elements of the group and merging them using the merge function
- See also: #groupByToEntry(Function, Function, BinaryOperator), #groupBy(Function, Function, BinaryOperator, Supplier)
partitionBy(...) -> Stream<Map.Entry<Boolean, List<T>>>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<Map.Entry<Boolean, List<T>>> partitionBy(final Predicate<? super T> predicate) - Summary: Partitions the elements of the stream according to a Predicate.
-
Contract:
- If the Predicate returns {@code true} for an element, it is included in the List corresponding to the key {@code true} in the Map.Entry.
- If the Predicate returns {@code false} for an element, it is included in the List corresponding to the key {@code false} in the Map.Entry.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate to be used for partitioning the stream elements
-
- Returns: a new Stream consisting of Map.Entry where the key is a Boolean and the value is a List of elements
- See also: #partitionByToEntry(Predicate), #partitionTo(Throwables.Predicate), Collectors#partitioningBy(Predicate)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <D> Stream<Map.Entry<Boolean, D>> partitionBy(final Predicate<? super T> predicate, final Collector<? super T, ?, D> downstream) - Summary: Partitions the elements of the stream according to a Predicate and a Collector.
-
Contract:
- If the Predicate returns {@code true} for an element, it is included in the group corresponding to the key {@code true} in the Map.Entry.
- If the Predicate returns {@code false} for an element, it is included in the group corresponding to the key {@code false} in the Map.Entry.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate to be used for partitioning the stream elements -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group.
-
- Returns: a new Stream consisting of Map.Entry where the key is a Boolean and the value is the result of applying the Collector to the elements of the group
- See also: #partitionByToEntry(Predicate, Collector), #partitionTo(Throwables.Predicate, Collector), Collectors#partitioningBy(Predicate, Collector)
partitionByToEntry(...) -> EntryStream<Boolean, List<T>>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract EntryStream<Boolean, List<T>> partitionByToEntry(final Predicate<? super T> predicate) - Summary: Partitions the elements of the stream according to a Predicate.
-
Contract:
- If the Predicate returns {@code true} for an element, it is included in the List corresponding to the key {@code true} in the EntryStream.
- If the Predicate returns {@code false} for an element, it is included in the List corresponding to the key {@code false} in the EntryStream.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate to be used for partitioning the stream elements
-
- Returns: a new EntryStream consisting of entries where the key is a Boolean and the value is a List of elements
- See also: #partitionBy(Predicate), #partitionTo(Throwables.Predicate), Collectors#partitioningBy(Predicate)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <D> EntryStream<Boolean, D> partitionByToEntry(final Predicate<? super T> predicate, final Collector<? super T, ?, D> downstream) - Summary: Partitions the elements of the stream according to a Predicate and a Collector.
-
Contract:
- If the Predicate returns {@code true} for an element, it is included in the group corresponding to the key {@code true} in the EntryStream.
- If the Predicate returns {@code false} for an element, it is included in the group corresponding to the key {@code false} in the EntryStream.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering, stateless predicate to be used for partitioning the stream elements -
downstream(Collector<? super T, ?, D>) — the Collector to be applied to the elements of each group.
-
- Returns: a new EntryStream consisting of entries where the key is a Boolean and the value is the result of applying the Collector to the elements of the group
- See also: #partitionBy(Predicate, Collector), #partitionTo(Throwables.Predicate, Collector), Collectors#partitioningBy(Predicate, Collector)
countBy(...) -> Stream<Map.Entry<K, Integer>>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<Map.Entry<K, Integer>> countBy(final Function<? super T, ? extends K> keyMapper) - Summary: Counts the elements of the stream according to a Function that maps elements to keys.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the Function to be used for mapping stream elements to keys.
-
- Returns: a new Stream consisting of Map.Entry where the key is the mapped key and the value is the count of elements that were mapped to this key
- See also: #countByToEntry(Function), #groupBy(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<Map.Entry<K, Integer>> countBy(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends Map<K, Integer>> mapFactory) - Summary: Counts the elements of the stream according to a Function that maps elements to keys.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the Function to be used for mapping stream elements to keys. -
mapFactory(Supplier<? extends Map<K, Integer>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new Stream consisting of Map.Entry where the key is the mapped key and the value is the count of elements that were mapped to this key
- See also: #countByToEntry(Function, Supplier), #groupBy(Function, Collector, Supplier)
countByToEntry(...) -> EntryStream<K, Integer>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> EntryStream<K, Integer> countByToEntry(final Function<? super T, ? extends K> keyMapper) - Summary: Counts the elements of the stream according to a Function that maps elements to keys.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the Function to be used for mapping stream elements to keys.
-
- Returns: a new EntryStream consisting of entries where the key is the mapped key and the value is the count of elements that were mapped to this key
- See also: #countBy(Function), #groupByToEntry(Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> EntryStream<K, Integer> countByToEntry(final Function<? super T, ? extends K> keyMapper, final Supplier<? extends Map<K, Integer>> mapFactory) - Summary: Counts the elements of the stream according to a Function that maps elements to keys.
-
Parameters:
-
keyMapper(Function<? super T, ? extends K>) — the Function to be used for mapping stream elements to keys. -
mapFactory(Supplier<? extends Map<K, Integer>>) — the supplier providing a new empty Map into which the results will be inserted.
-
- Returns: a new EntryStream consisting of entries where the key is the mapped key and the value is the count of elements that were mapped to this key
- See also: #countBy(Function, Supplier), #groupByToEntry(Function, Collector, Supplier)
collapse(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> collapse(final BiPredicate<? super T, ? super T> collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into lists.
-
Parameters:
-
collapsible(BiPredicate<? super T, ? super T>) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: #collapse(BiPredicate, Supplier), #collapse(BiPredicate, BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> collapse(final BiPredicate<? super T, ? super T> collapsible, Supplier<? extends C> supplier) - Summary: Collapses consecutive elements in the stream into custom collections based on a predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied to adjacent elements are grouped together into collections created by the supplied collection factory.
-
Parameters:
-
collapsible(BiPredicate<? super T, ? super T>) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
supplier(Supplier<? extends C>) — a factory to create new collection instances for each group.
-
- Returns: a stream of collections, each containing a sequence of consecutive elements that are collapsible with each other
- See also: #collapse(BiPredicate), #collapse(BiPredicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> collapse(final BiPredicate<? super T, ? super T> collapsible, final BinaryOperator<T> mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements are collapsible.
- When adjacent elements satisfy the collapsible predicate, they are merged using the provided merge function.
-
Parameters:
-
collapsible(BiPredicate<? super T, ? super T>) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
mergeFunction(BinaryOperator<T>) — a function to merge two collapsible elements into one.
-
- Returns: a stream of merged elements
- See also: #collapse(BiPredicate), #collapse(BiPredicate, Object, BiFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<U> collapse(final BiPredicate<? super T, ? super T> collapsible, final U init, final BiFunction<? super U, ? super T, U> mergeFunction) - Summary: Collapses consecutive elements in the stream into an accumulator of type U.
-
Contract:
- When adjacent elements satisfy the collapsible predicate, the accumulator value and the current element are combined using the provided merge function.
-
Parameters:
-
collapsible(BiPredicate<? super T, ? super T>) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
init(U) — the initial value for each accumulation. -
mergeFunction(BiFunction<? super U, ? super T, U>) — a function to incorporate an element into an accumulated result.
-
- Returns: a stream of accumulated values
- See also: #collapse(BiPredicate, BinaryOperator), #collapse(BiPredicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(final BiPredicate<? super T, ? super T> collapsible, final Collector<? super T, ?, R> collector) - Summary: Collapses consecutive elements in the stream using a collector when elements are collapsible.
-
Contract:
- Collapses consecutive elements in the stream using a collector when elements are collapsible.
-
Parameters:
-
collapsible(BiPredicate<? super T, ? super T>) — a predicate that determines if two consecutive elements should be collapsed into the same group. The first parameter is the last(not the first) element of the current group, and the second parameter is the next element to check. -
collector(Collector<? super T, ?, R>) — a collector to accumulate elements into a result.
-
- Returns: a stream of collected results
- See also: #collapse(BiPredicate), #collapse(BiPredicate, BinaryOperator)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<List<T>> collapse(final TriPredicate<? super T, ? super T, ? super T> collapsible) - Summary: Collapses consecutive elements in the stream into groups based on a three-element predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into lists.
- A new group starts when the predicate returns {@code false} .
-
Parameters:
-
collapsible(TriPredicate<? super T, ? super T, ? super T>) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check.
-
- Returns: a stream of lists, each containing a sequence of consecutive elements that are collapsible with each other
- See also: #collapse(TriPredicate, Supplier), #collapse(BiPredicate)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> collapse(final TriPredicate<? super T, ? super T, ? super T> collapsible, Supplier<? extends C> supplier) - Summary: Collapses consecutive elements in the stream into custom collections based on a three-element predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are grouped together into collections created by the supplied collection factory.
- A new collection starts when the predicate returns {@code false} .
-
Parameters:
-
collapsible(TriPredicate<? super T, ? super T, ? super T>) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
supplier(Supplier<? extends C>) — a factory to create new collection instances for each group.
-
- Returns: a stream of collections, each containing a sequence of consecutive elements that are collapsible with each other
- See also: #collapse(TriPredicate), #collapse(BiPredicate, Supplier)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> collapse(final TriPredicate<? super T, ? super T, ? super T> collapsible, final BinaryOperator<T> mergeFunction) - Summary: Collapses consecutive elements in the stream by applying a merge function when elements satisfy a three-element predicate.
-
Contract:
- Collapses consecutive elements in the stream by applying a merge function when elements satisfy a three-element predicate.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are combined using the provided merge function.
-
Parameters:
-
collapsible(TriPredicate<? super T, ? super T, ? super T>) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
mergeFunction(BinaryOperator<T>) — a function to merge two collapsible elements into one.
-
- Returns: a stream of merged elements
- See also: #collapse(TriPredicate), #collapse(BiPredicate, BinaryOperator)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U> Stream<U> collapse(final TriPredicate<? super T, ? super T, ? super T> collapsible, final U init, final BiFunction<? super U, ? super T, U> mergeFunction) - Summary: Collapses consecutive elements in the stream into an accumulator of type U based on a three-element predicate.
-
Contract:
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are combined using the provided merge function.
-
Parameters:
-
collapsible(TriPredicate<? super T, ? super T, ? super T>) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
init(U) — the initial value for each accumulation -
mergeFunction(BiFunction<? super U, ? super T, U>) — a function to incorporate an element into an accumulated result.
-
- Returns: a stream of accumulated values
- See also: #collapse(TriPredicate, BinaryOperator), #collapse(BiPredicate, Object, BiFunction)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(final TriPredicate<? super T, ? super T, ? super T> collapsible, final Collector<? super T, ?, R> collector) - Summary: Collapses consecutive elements in the stream using a collector when elements satisfy a three-element predicate.
-
Contract:
- Collapses consecutive elements in the stream using a collector when elements satisfy a three-element predicate.
- Elements for which the predicate returns {@code true} when applied with the first and last elements of the group are collected using the provided collector.
-
Parameters:
-
collapsible(TriPredicate<? super T, ? super T, ? super T>) — a predicate that determines if the next element from this stream should be collapsed with the first and last elements of current group The collapsible predicate takes three elements: the first and last elements of current group, and the next element to check. -
collector(Collector<? super T, ?, R>) — a collector to accumulate elements into a result.
-
- Returns: a stream of collected results
- See also: #collapse(TriPredicate), #collapse(BiPredicate, Collector)
scan(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> scan(final BinaryOperator<T> accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Parameters:
-
accumulator(BinaryOperator<T>) — a BiFunction that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new Stream consisting of the results of the scan operation on the elements of the original stream
- See also: #scan(Object, BiFunction), #reduce(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<U> scan(final U init, final BiFunction<? super U, ? super T, U> accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Parameters:
-
init(U) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream. -
accumulator(BiFunction<? super U, ? super T, U>) — a BiFunction that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new Stream consisting of the results of the scan operation on the elements of the original stream
- See also: #scan(Object, boolean, BiFunction), #scan(BinaryOperator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<U> scan(final U init, final boolean initIncluded, final BiFunction<? super U, ? super T, U> accumulator) - Summary: Performs a scan (also known as prefix sum, cumulative sum, running total, or integral) operation on the elements of the stream.
-
Parameters:
-
init(U) — the initial value. It's only used once by the accumulator to calculate the first element in the returned stream. -
initIncluded(boolean) — a boolean value that determines if the initial value should be included as the first element in the returned stream. -
accumulator(BiFunction<? super U, ? super T, U>) — a BiFunction that takes two parameters: the current accumulated value and the current stream element, and returns a new accumulated value.
-
- Returns: a new Stream consisting of the results of the scan operation on the elements of the original stream
- See also: #scan(Object, BiFunction), #scan(BinaryOperator)
split(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> split(final int chunkSize) - Summary: Returns a Stream of Lists, where each List contains a chunk of elements from the original stream.
-
Contract:
- The final chunk may be smaller if there are not enough elements.
-
Parameters:
-
chunkSize(int) — the desired size of each chunk (the last chunk may be smaller). Must be positive.
-
- Returns: a Stream of Lists, each containing a chunk of elements from the original stream
- See also: #split(int, IntFunction), #sliding(int)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(int chunkSize, IntFunction<? extends C> collectionSupplier) - Summary: Returns a Stream of Collections, where each Collection contains a chunk of elements from the original stream.
-
Contract:
- The final chunk may be smaller if there are not enough elements.
-
Parameters:
-
chunkSize(int) — the desired size of each chunk (the last chunk may be smaller). Must be positive. -
collectionSupplier(IntFunction<? extends C>) — a function that provides a new collection of type C for each chunk
-
- Returns: a Stream of Collections, each containing a chunk of elements from the original stream
- See also: #split(int), #split(int, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> split(int chunkSize, Collector<? super T, ?, R> collector) - Summary: Splits the elements of the stream into sub-streams of the specified size, each collected by the provided collector.
-
Parameters:
-
chunkSize(int) — the desired size of each sub stream (the last may be smaller). Must be positive. -
collector(Collector<? super T, ?, R>) — the collector to be used for collecting elements of each sub stream
-
- Returns: a new Stream consisting of results produced by the collector for each sub stream
- See also: #split(int), #split(int, IntFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> split(final Predicate<? super T> predicate) - Summary: Splits the elements of the stream into sub-streams based on consecutive equal predicate results.
-
Contract:
- A new sub-stream begins when the predicate result changes from one element to the next (either {@code true} to {@code false} , or {@code false} to true).
-
Parameters:
-
predicate(Predicate<? super T>) — the condition to be used for splitting the stream into sub-streams
-
- Returns: a new Stream consisting of Lists of elements from the original Stream
- See also: #split(Predicate, Supplier), #split(Predicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(Predicate<? super T> predicate, Supplier<? extends C> collectionSupplier) - Summary: Splits the elements of the stream into collections based on consecutive equal predicate results.
-
Contract:
- A new collection begins when the predicate result changes from one element to the next.
-
Parameters:
-
predicate(Predicate<? super T>) — the condition to be used for splitting the stream into collections -
collectionSupplier(Supplier<? extends C>) — the supplier function to provide a new collection for each sub stream
-
- Returns: a new Stream consisting of collections of elements from the original Stream
- See also: #split(Predicate), #split(Predicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> split(Predicate<? super T> predicate, Collector<? super T, ?, R> collector) - Summary: Splits the elements of the stream into separate groups based on consecutive equal predicate results.
-
Contract:
- A new group begins when the predicate result changes from one element to the next (either {@code true} to {@code false} , or {@code false} to true).
-
Parameters:
-
predicate(Predicate<? super T>) — the condition to be used for splitting the stream -
collector(Collector<? super T, ?, R>) — the collector to be used for collecting elements of each chunk
-
- Returns: a new Stream consisting of elements from the original Stream collected by the provided collector
- See also: #split(Predicate), #split(Predicate, Supplier)
splitAt(...) -> Stream<Stream<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> splitAt(int position) - Summary: Splits the stream into two parts at the specified index.
-
Contract:
- If the index is greater than the number of elements, the second stream will be empty.
-
Parameters:
-
position(int) — the index at which to split the stream. Must be non-negative.
-
- Returns: a new Stream consisting of two sub-streams split at the given index
- See also: #splitAt(int, Collector), #splitAt(Predicate)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> splitAt(int position, Collector<? super T, ?, R> collector) - Summary: Splits the stream into two parts at the specified index.
-
Parameters:
-
position(int) — the index at which to split the stream. The element at this index will be the first element of the second part -
collector(Collector<? super T, ?, R>) — the collector to be used for collecting elements of the first part of the stream
-
- Returns: a new Stream consisting of elements from the first part collected by the provided collector
- See also: #splitAt(int), #splitAt(Predicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> splitAt(final Predicate<? super T> where) - Summary: Splits the stream into two parts based on the specified predicate.
-
Contract:
- If no element satisfies the predicate, the second stream will be empty.
-
Parameters:
-
where(Predicate<? super T>) — the predicate to determine where to split the stream
-
- Returns: a new Stream consisting of two sub-streams split at the point where the predicate is satisfied
- See also: #splitAt(int), #splitAt(Predicate, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> splitAt(Predicate<? super T> where, Collector<? super T, ?, R> collector) - Summary: Splits the stream into two parts based on the provided predicate.
-
Parameters:
-
where(Predicate<? super T>) — the condition at which to split the stream -
collector(Collector<? super T, ?, R>) — the collector to be used for collecting elements of the first part of the stream
-
- Returns: a new Stream consisting of elements from the first part collected by the provided collector
- See also: #splitAt(Predicate), #splitAt(int, Collector)
sliding(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> sliding(final int windowSize) - Summary: Creates a sliding window over the elements of the Stream, where each window is a List of elements.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive.
-
- Returns: a new Stream where each element is a List of elements from the original Stream, representing a window
- See also: #sliding(int, int), #sliding(int, IntFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, IntFunction<? extends C> collectionSupplier) - Summary: Creates a sliding window over the elements of the Stream, where each window is a collection of elements.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive. -
collectionSupplier(IntFunction<? extends C>) — the function to create a new collection for each window
-
- Returns: a new Stream where each element is a collection of elements from the original Stream, representing a window
- See also: #sliding(int), #sliding(int, int, IntFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> sliding(int windowSize, Collector<? super T, ?, R> collector) - Summary: Creates a sliding window over the elements of the Stream, where each window is collected using the provided Collector.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive. -
collector(Collector<? super T, ?, R>) — the collector to be used for reduction of the elements in each window
-
- Returns: a new Stream where each element is a result container of the collected elements from the original Stream, representing a window
- See also: #sliding(int), #sliding(int, int, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> sliding(final int windowSize, final int increment) - Summary: Creates a sliding window over the elements of the Stream, where each window is a List of elements.
-
Contract:
- If increment equals windowSize, windows don't overlap.
- If increment is less than windowSize, windows overlap.
- If increment is greater than windowSize, some elements may be skipped.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive. -
increment(int) — the number of elements to move the window by each time. Must be positive.
-
- Returns: a new Stream where each element is a List of elements from the original Stream, representing a window
- See also: #sliding(int), #sliding(int, int, IntFunction)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, int increment, IntFunction<? extends C> collectionSupplier) - Summary: Creates a sliding window over the elements of the Stream, where each window is a collection of elements.
-
Contract:
- If increment equals windowSize, windows don't overlap.
- If increment is less than windowSize, windows overlap.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive. -
increment(int) — the number of elements to move the window by each time. Must be positive. -
collectionSupplier(IntFunction<? extends C>) — the function to create a new collection for each window
-
- Returns: a new Stream where each element is a collection of elements from the original Stream, representing a window
- See also: #sliding(int, int), #sliding(int, int, Collector)
-
Signature:
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> sliding(int windowSize, int increment, Collector<? super T, ?, R> collector) - Summary: Creates a sliding window over the elements of the Stream, where each window is collected using the provided Collector.
-
Parameters:
-
windowSize(int) — the size of the window to be used for sliding over the Stream elements. Must be positive. -
increment(int) — the number of elements to move the window by each time. Must be positive. -
collector(Collector<? super T, ?, R>) — the collector to be used for reduction of the elements in each window
-
- Returns: a new Stream where each element is a result container of the collected elements from the original Stream, representing a window
- See also: #sliding(int, Collector), #sliding(int, int)
intersperse(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> intersperse(T delimiter) - Summary: Intersperses the given delimiter between the elements of the stream.
-
Contract:
- If the stream has only one element, no delimiter is added.
-
Parameters:
-
delimiter(T) — the element to be inserted between each element of the stream
-
- Returns: a new Stream with the delimiter interspersed between each element
- See also: #prepend(Object\[\]), #append(Object\[\])
distinct(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public Stream<T> distinct(final BinaryOperator<T> mergeFunction) - Summary: Returns a stream consisting of the distinct elements of this stream, where duplicates are merged using the provided merge function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The merge function should be associative for correct behavior in parallel streams.
-
Parameters:
-
mergeFunction(BinaryOperator<T>) — a binary operator used to merge duplicate elements.
-
- Returns: a new Stream consisting of the distinct elements of this stream with duplicates merged
- See also: #distinct(), #distinctBy(Function)
distinctBy(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract Stream<T> distinctBy(Function<? super T, ?> keyMapper) - Summary: Returns a stream consisting of the distinct elements of this stream, where the distinctness is determined by the value mapped from the given key mapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Function<? super T, ?>) — a function to extract the key for comparison.
-
- Returns: a new Stream consisting of the distinct elements of this stream based on the extracted keys
- See also: #distinct(), #distinctBy(Function, BinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public Stream<T> distinctBy(final Function<? super T, ?> keyMapper, final BinaryOperator<T> mergeFunction) - Summary: Returns a stream consisting of the distinct elements of this stream, where the distinctness is determined by the value mapped from the given key mapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The merge function should be associative for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Function<? super T, ?>) — a function to extract the key for comparison. -
mergeFunction(BinaryOperator<T>) — a binary operator used to merge duplicate elements.
-
- Returns: a new Stream consisting of the distinct elements of this stream with duplicates merged
- See also: #distinct(BinaryOperator), #distinctBy(Function)
sorted(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sorted(Comparator<? super T> comparator) - Summary: Returns a Stream consisting of the elements of this stream, sorted according to the provided Comparator.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The comparator should be consistent with equals for correct behavior.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code non-null} Comparator to be used to compare stream elements
-
- Returns: a new stream that contains the elements of the original stream, sorted according to the provided Comparator
- See also: #sortedBy(Function), #reverseSorted(Comparator)
sortedBy(...) -> Stream<T>
-
Signature:
@SuppressWarnings("rawtypes") @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedBy(Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted according to the natural order of the keys produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The extracted keys must implement Comparable.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a non-interfering, stateless function to apply to each element to determine its key for sorting
-
- Returns: a new stream that contains the elements of the original stream, sorted according to the natural order of the keys produced by the keyMapper function
- See also: #sorted(Comparator), #sortedByInt(ToIntFunction), Comparators#comparingBy(Function)
sortedByInt(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByInt(ToIntFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted according to the natural order of the integer values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToIntFunction<? super T>) — a function to extract the int key for sorting
-
- Returns: a new Stream consisting of the elements of this stream, sorted by the keys produced by the keyMapper function
- See also: #sortedBy(Function), #sortedByLong(ToLongFunction), Comparators#comparingInt(ToIntFunction)
sortedByLong(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByLong(ToLongFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted according to the natural order of the long values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToLongFunction<? super T>) — a function to extract the long key for sorting
-
- Returns: a new Stream consisting of the elements of this stream, sorted by the keys produced by the keyMapper function
- See also: #sortedBy(Function), #sortedByDouble(ToDoubleFunction), Comparators#comparingLong(ToLongFunction)
sortedByDouble(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByDouble(ToDoubleFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted according to the natural order of the double values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToDoubleFunction<? super T>) — a function to extract the double key for sorting
-
- Returns: a new Stream consisting of the elements of this stream, sorted by the keys produced by the keyMapper function
- See also: #sortedBy(Function), #sortedByInt(ToIntFunction), Comparators#comparingDouble(ToDoubleFunction)
reverseSorted(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSorted(Comparator<? super T> comparator) - Summary: Returns a Stream consisting of the elements of this stream, sorted in reverse order according to the provided Comparator.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The comparator should be consistent with equals for correct behavior.
-
Parameters:
-
comparator(Comparator<? super T>) — a {@code non-null} Comparator to be used to compare stream elements in reverse order
-
- Returns: a new stream that contains the elements of the original stream, sorted in reverse order according to the provided Comparator
- See also: #sorted(Comparator), #reverseSortedBy(Function), Comparators#reverseOrder(Comparator)
reverseSortedByInt(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSortedByInt(ToIntFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted in reverse order according to the natural order of the integer values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToIntFunction<? super T>) — a function to extract the int key for sorting
-
- Returns: a new stream that contains the elements of the original stream, sorted in reverse order according to the natural order of the keys produced by the keyMapper function
- See also: #sortedByInt(ToIntFunction), #reverseSortedBy(Function), Comparators#reversedComparingInt(ToIntFunction)
reverseSortedByLong(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSortedByLong(ToLongFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted in reverse order according to the natural order of the long values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToLongFunction<? super T>) — a function to extract the long key for sorting
-
- Returns: a new stream that contains the elements of the original stream, sorted in reverse order according to the natural order of the keys produced by the keyMapper function
- See also: #sortedByLong(ToLongFunction), #reverseSortedBy(Function), Comparators#reversedComparingLong(ToLongFunction)
reverseSortedByDouble(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSortedByDouble(ToDoubleFunction<? super T> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted in reverse order according to the natural order of the double values produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(ToDoubleFunction<? super T>) — a function to extract the double key for sorting
-
- Returns: a new stream that contains the elements of the original stream, sorted in reverse order according to the natural order of the keys produced by the keyMapper function
- See also: #sortedByDouble(ToDoubleFunction), #reverseSortedBy(Function), Comparators#reversedComparingDouble(ToDoubleFunction)
reverseSortedBy(...) -> Stream<T>
-
Signature:
@SuppressWarnings("rawtypes") @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSortedBy(Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns a Stream consisting of the elements of this stream, sorted in reverse order according to the natural order of the keys produced by the provided keyMapper function.
-
Contract:
- It can be parallelized if the stream supports parallel processing.
- The extracted keys must implement Comparable.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function to apply to each element to determine its key for sorting
-
- Returns: a new stream that contains the elements of the original stream, sorted in reverse order according to the natural order of the keys produced by the keyMapper function
- See also: #sortedBy(Function), #reverseSorted(Comparator), Comparators#reversedComparingBy(Function)
top(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> top(int n) - Summary: Returns a Stream consisting of the top n elements of this stream, according to the natural order of the elements.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
- Elements must be Comparable.
- If there are fewer than n elements, all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to select from the stream. Must be non-negative.
-
- Returns: a new stream that contains the top n elements of the original stream, according to the natural order of the elements. There is no guarantee on the order of the returned elements.
- See also: #top(int, Comparator), #kthLargest(int, Comparator)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> top(int n, Comparator<? super T> comparator) - Summary: Returns a Stream consisting of the top n elements of this stream compared by the provided Comparator.
-
Contract:
- If this stream contains fewer elements than {@code n} , all elements are returned.
- If there are fewer than n elements, all elements are returned.
-
Parameters:
-
n(int) — the number of top elements to select from the stream. Must be non-negative. -
comparator(Comparator<? super T>) — a {@code non-null} Comparator to be used to compare stream elements
-
- Returns: a new Stream consisting of the top n elements of this stream compared by the provided Comparator. There is no guarantee on the order of the returned elements.
- See also: #top(int), #kthLargest(int, Comparator)
skipRange(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> skipRange(int startInclusive, int endExclusive) - Summary: Skips a range of elements in the stream.
-
Contract:
- If startInclusive equals endExclusive, no elements are skipped.
-
Parameters:
-
startInclusive(int) — the first position in the range to skip, inclusive. Must be non-negative. -
endExclusive(int) — the last position in the range to skip, exclusive. Must be > = startInclusive.
-
- Returns: a new stream that skips the specified range of the original stream
- See also: #skip(long), #limit(long)
skipNulls(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> skipNulls() - Summary: Returns a Stream consisting of the elements of this stream, excluding {@code null} elements.
-
Parameters:
- (none)
- Returns: a new stream that excludes {@code null} elements of the original stream
- See also: #filter(Predicate)
skipLast(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> skipLast(int n) - Summary: Returns a Stream consisting of the elements of this stream, excluding the last n elements.
-
Contract:
- It may cause OutOfMemoryError if n is too large.
-
Parameters:
-
n(int) — the number of elements from the end of the stream to skip. Must be non-negative.
-
- Returns: a new stream that excludes the last n elements of the original stream
- See also: #takeLast(int), #skip(long)
last(...) -> Stream<T>
-
Signature:
@Deprecated @Beta @SequentialOnly @IntermediateOp public final Stream<T> last(final int n) - Summary: Returns a Stream consisting of the last n elements of this stream.
-
Contract:
- It may cause OutOfMemoryError if n is too large.
- All the elements will be loaded to get the last n elements and the Stream will be closed after that, if a terminal operation is triggered.
-
Parameters:
-
n(int) — the number of elements from the end of the stream to include. Must be non-negative.
-
- Returns: a new stream that includes the last n elements of the original stream
- See also: #takeLast(int)
takeLast(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> takeLast(int n) - Summary: Returns a Stream consisting of the last n elements of this stream.
-
Contract:
- It may cause OutOfMemoryError if n is too large.
- All the elements will be loaded to get the last n elements and the Stream will be closed after that, if a terminal operation is triggered.
-
Parameters:
-
n(int) — the number of elements from the end of the stream to include. Must be non-negative.
-
- Returns: a new stream that includes the last n elements of the original stream
- See also: #skipLast(int), #limit(long)
onFirst(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onFirst(Consumer<? super T> action) - Summary: Performs the provided action on the first element of the stream as it is consumed.
-
Contract:
- If the stream is empty, the action is not performed.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on the first element of the stream
-
- Returns: a new stream that includes the action on the first element
- See also: #onLast(Consumer), #peekFirst(Consumer)
onLast(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onLast(Consumer<? super T> action) - Summary: Performs the provided action on the last element of the stream as it is consumed.
-
Contract:
- If the stream is empty, the action is not performed.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on the last element of the stream
-
- Returns: a new stream that includes the action on the last element
- See also: #onFirst(Consumer), #peekLast(Consumer)
peekFirst(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<T> peekFirst(final Consumer<? super T> action) - Summary: Performs the provided action on the first element of the stream as it is consumed.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on the first element of the stream
-
- Returns: a new stream that includes the action on the first element
- See also: #onFirst(Consumer), #peek(Consumer)
peekLast(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public Stream<T> peekLast(final Consumer<? super T> action) - Summary: Performs the provided action on the last element of the stream as it is consumed.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on the last element of the stream
-
- Returns: a new stream that includes the action on the last element
- See also: #onLast(Consumer), #peek(Consumer)
peekIf(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public Stream<T> peekIf(final Predicate<? super T> predicate, final Consumer<? super T> action) - Summary: Performs the provided action only on the elements pulled by downstream/terminal operation which satisfy the given predicate as they are consumed.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Predicate<? super T>) — a non-interfering predicate to test on the elements of the stream -
action(Consumer<? super T>) — a non-interfering action to perform on the elements that satisfy the predicate
-
- Returns: a new stream that includes the action on the elements that satisfy the predicate
- See also: #peek(Consumer), #peekIf(BiPredicate, Consumer)
-
Signature:
@Beta @ParallelSupported @IntermediateOp public Stream<T> peekIf(final BiPredicate<? super T, ? super Long> predicate, final Consumer<? super T> action) throws IllegalArgumentException - Summary: Performs the provided action only on the elements pulled by downstream/terminal operation which satisfy the given predicate as they are consumed.
-
Contract:
- <p> This operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(BiPredicate<? super T, ? super Long>) — a non-interfering predicate to test on the elements of the stream and their iteration count -
action(Consumer<? super T>) — a non-interfering action to perform on the elements that satisfy the predicate
-
- Returns: a new stream that includes the action on the elements that satisfy the predicate
-
Throws:
-
java.lang.IllegalArgumentException— if the predicate or action is null
-
- See also: #peek(Consumer), #peekIf(Predicate, Consumer)
foreach(...) -> void
-
Signature:
@Beta @ParallelSupported @TerminalOp public void foreach(final Consumer<? super T> action) - Summary: Performs the provided action for each element of the Stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- In parallel execution, the action must be thread-safe as it may be called concurrently.
-
Parameters:
-
action(Consumer<? super T>) — a non-interfering action to perform on the elements
-
- See also: #forEach(Throwables.Consumer)
forEach(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(Throwables.Consumer<? super T, E> action) throws E - Summary: Performs the provided action for each element of the Stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- In parallel execution, the action must be thread-safe as it may be called concurrently.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
E— Exception thrown by the Consumer
-
- See also: java.util.function.Consumer, com.landawn.abacus.util.Throwables.Consumer
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception, E2 extends Exception> void forEach(Throwables.Consumer<? super T, E> action, Throwables.Runnable<E2> onComplete) throws E, E2 - Summary: Performs the provided action for each element of the Stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
action(Throwables.Consumer<? super T, E>) — the action to be performed for each element -
onComplete(Throwables.Runnable<E2>) — the Runnable to be executed after all elements have been processed
-
-
Throws:
-
E— Exception thrown by the Consumer -
E2— Exception thrown by the Runnable
-
- See also: N#forEach(Iterable, Throwables.Consumer)
-
Signature:
@ParallelSupported @TerminalOp public abstract <U, E extends Exception, E2 extends Exception> void forEach(Throwables.Function<? super T, ? extends Iterable<? extends U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) throws E, E2 - Summary: Transforms the elements in the stream by applying the flatMapper function to each element and then performs the provided action for each element of the Stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The flatMapper should produce finite iterables for each element.
-
Parameters:
-
flatMapper(Throwables.Function<? super T, ? extends Iterable<? extends U>, E>) — the function to transform elements of the Stream into Iterables -
action(Throwables.BiConsumer<? super T, ? super U, E2>) — the action to be performed for each element of the Stream and each element of the Iterable produced by the flatMapper function
-
-
Throws:
-
E— Exception thrown by the flatMapper function -
E2— Exception thrown by the BiConsumer action
-
- See also: N#forEach(Iterable, Throwables.Function, Throwables.BiConsumer)
-
Signature:
@ParallelSupported @TerminalOp public abstract <T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEach( Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) throws E, E2, E3 - Summary: Transforms the elements in the stream by applying the flatMapper/flatMapper2 function to each element and then performs the provided action for each element of the Stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- Both flatMappers should produce finite iterables for each element.
-
Parameters:
-
flatMapper(Throwables.Function<? super T, ? extends Iterable<T2>, E>) — the first function to transform elements of the Stream into Iterables -
flatMapper2(Throwables.Function<? super T2, ? extends Iterable<T3>, E2>) — the second function to transform elements of the first Iterable into further Iterables -
action(Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3>) — the action to be performed for each element of the Stream and each element of the Iterables produced by the flatMapper functions
-
-
Throws:
-
E— Exception thrown by the first flatMapper function -
E2— Exception thrown by the second flatMapper function -
E3— Exception thrown by the TriConsumer action
-
- See also: N#forEach(Iterable, Throwables.Function, Throwables.Function, Throwables.TriConsumer)
forEachIndexed(...) -> void
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IntObjConsumer<? super T, E> action) throws E - Summary: Performs the provided action for each element of the Stream, where the action is an instance of Throwables.IntObjConsumer.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
action(Throwables.IntObjConsumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
E— Exception thrown by the Consumer
-
- See also: com.landawn.abacus.util.Throwables.IntObjConsumer
forEachUntil(...) -> void
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachUntil(Throwables.BiConsumer<? super T, MutableBoolean, E> action) throws E - Summary: Performs the provided action for each element of the Stream until the action sets the MutableBoolean to {@code true} .
-
Contract:
- Iteration on this stream will also be stopped when this flag is set to {@code true} .
- <p> This operation can be parallelized if the stream supports parallel processing.
- <p> <b> Usage Examples: </b> </p> <pre> {@code Stream.of(1, 2, 3, 4, 5) .forEachUntil((value, stopFlag) -> { System.out.println(value); if (value >= 3) stopFlag.setTrue(); }); // Prints 1, 2, 3 } </pre>
-
Parameters:
-
action(Throwables.BiConsumer<? super T, MutableBoolean, E>) — the action to be performed for each element, which accepts an element and a MutableBoolean
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachUntil(MutableBoolean, Throwables.Consumer)
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachUntil(MutableBoolean flagToBreak, Throwables.Consumer<? super T, E> action) throws E - Summary: Performs the provided action for each element of the Stream until the flagToBreak is set to {@code true} .
-
Contract:
- Iteration on this stream will also be stopped when the flagToBreak is set to {@code true} .
- If the flagToBreak is set to {@code true} at the beginning, no elements will be iterated from the stream before it is stopped and closed.
- <p> This operation can be parallelized if the stream supports parallel processing.
- The flag should be thread-safe if used in parallel streams.
- <p> <b> Usage Examples: </b> </p> <pre> {@code MutableBoolean stopFlag = MutableBoolean.of(false); Stream.of(1, 2, 3, 4, 5) .forEachUntil(stopFlag, value -> { System.out.println(value); if (value >= 3) stopFlag.setTrue(); }); // Prints 1, 2, 3 } </pre>
-
Parameters:
-
flagToBreak(MutableBoolean) — a flag to break the for-each loop. Set it to {@code true} to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to {@code true} . -
action(Throwables.Consumer<? super T, E>) — the action to be performed for each element
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachUntil(Throwables.BiConsumer)
forEachPair(...) -> void
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(final Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Performs the given action on each adjacent pair of elements in this stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
action(Throwables.BiConsumer<? super T, ? super T, E>) — a non-interfering action to perform on each adjacent pair of elements
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(int, Throwables.BiConsumer)
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(int increment, Throwables.BiConsumer<? super T, ? super T, E> action) throws E - Summary: Performs the given action on pairs of elements in this stream with the specified increment between the first elements of each pair.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
increment(int) — the distance between the first elements of each pair. Must be positive. -
action(Throwables.BiConsumer<? super T, ? super T, E>) — a non-interfering action to perform on each pair of elements
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachPair(Throwables.BiConsumer)
forEachTriple(...) -> void
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Performs the given action on each adjacent triple of elements in this stream.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — a non-interfering action to perform on each adjacent triple of elements
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(int, Throwables.TriConsumer)
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(final int increment, final Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) throws E - Summary: Performs the given action on triples of elements in this stream with the specified increment between the first elements of each triple.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
increment(int) — the distance between the first elements of each triple. Must be positive. -
action(Throwables.TriConsumer<? super T, ? super T, ? super T, E>) — a non-interfering action to perform on each triple of elements
-
-
Throws:
-
E— if the action throws an exception
-
- See also: #forEachTriple(Throwables.TriConsumer)
anyMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Checks if any elements of this Stream match the provided predicate.
-
Contract:
- Checks if any elements of this Stream match the provided predicate.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements of this stream
-
- Returns: {@code true} if any elements match the predicate, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #allMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate)
allMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Checks if all elements of this Stream match the provided predicate.
-
Contract:
- Checks if all elements of this Stream match the provided predicate.
- <p> This operation can be parallelized if the stream supports parallel processing.
- Returns {@code true} if the stream is empty.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements of this stream
-
- Returns: {@code true} if all elements match the predicate or this Stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.Predicate), #noneMatch(Throwables.Predicate)
noneMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Checks if no elements of this Stream match the provided predicate.
-
Contract:
- Checks if no elements of this Stream match the provided predicate.
- <p> This operation can be parallelized if the stream supports parallel processing.
- Returns {@code true} if the stream is empty.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements of this stream
-
- Returns: {@code true} if no elements match the predicate or this Stream is empty, otherwise {@code false}
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #anyMatch(Throwables.Predicate), #allMatch(Throwables.Predicate)
nMatch(...) -> boolean
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean nMatch(long atLeast, long atMost, Throwables.Predicate<? super T, E> predicate) throws E - Summary: Checks if the specified number of elements in the stream match the provided predicate.
-
Contract:
- Checks if the specified number of elements in the stream match the provided predicate.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
atLeast(long) — the minimum number of elements that need to match the predicate -
atMost(long) — the maximum number of elements that need to match the predicate -
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements in the stream
-
- Returns: {@code true} if the number of elements matching the predicate is within the range \[atLeast, atMost\], {@code false} otherwise
-
Throws:
-
E— Exception thrown by the predicate
-
- See also: #anyMatch(Throwables.Predicate), #allMatch(Throwables.Predicate)
findFirst(...) -> Optional<T>
-
Signature:
@Beta @ParallelSupported @TerminalOp public Optional<T> findFirst() - Summary: Returns the first element in the stream, if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns the first element in the stream, if present, otherwise returns an empty {@code Optional} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing the first element of the stream, or an empty {@code Optional} if the stream is empty
- See also: #first(), #findAny(), #findFirst(Throwables.Predicate), #findAny(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> Optional<T> findFirst(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Returns the first element in the stream that matches the provided predicate.
-
Contract:
- If no element matches, an empty {@code Optional} is returned.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements in the stream
-
- Returns: an {@code Optional} containing the first matching element, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findAny(Throwables.Predicate), #findLast(Throwables.Predicate)
findAny(...) -> Optional<T>
-
Signature:
@Beta @ParallelSupported @TerminalOp public Optional<T> findAny() - Summary: Returns any element in the stream, if present, otherwise returns an empty {@code Optional} .
-
Contract:
- Returns any element in the stream, if present, otherwise returns an empty {@code Optional} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
- (none)
- Returns: an {@code Optional} containing any element of the stream, or an empty {@code Optional} if the stream is empty
- See also: #first(), #findFirst(), #findFirst(Throwables.Predicate), #findAny(Throwables.Predicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> Optional<T> findAny(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Returns any element matched by the provided predicate if found.
-
Contract:
- Returns any element matched by the provided predicate if found.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements in the stream
-
- Returns: an {@code Optional} containing any matching element, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #findFirst(Throwables.Predicate)
findLast(...) -> Optional<T>
-
Signature:
@Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> Optional<T> findLast(Throwables.Predicate<? super T, E> predicate) throws E - Summary: Returns the last element matched by the provided predicate if found.
-
Contract:
- Returns the last element matched by the provided predicate if found.
- Consider using: {@code stream.reversed().findFirst(predicate)} for better performance when possible.
- <p> This operation can be parallelized if the stream supports parallel processing.
- All elements must be examined to find the last matching one.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — the predicate to apply to elements in the stream
-
- Returns: an {@code Optional} containing the last matching element, or an empty {@code Optional} if no match is found
-
Throws:
-
E— if the predicate throws an exception
-
- See also: #reversed(), #findFirst(Throwables.Predicate)
containsAll(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @SequentialOnly @TerminalOp public abstract boolean containsAll(T... a) - Summary: Checks if the stream contains all the specified elements.
-
Contract:
- Checks if the stream contains all the specified elements.
- This is a terminal operation that may short-circuit if a missing element is found.
-
Parameters:
-
a(T[]) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream contains all the specified elements or the specified array is empty, {@code false} otherwise
- See also: #containsAny(Object\[\]), #containsNone(Object\[\])
-
Signature:
@SequentialOnly @TerminalOp public abstract boolean containsAll(Collection<? extends T> c) - Summary: Checks if the stream contains all the specified elements.
-
Contract:
- Checks if the stream contains all the specified elements.
- This is a terminal operation that may short-circuit if a missing element is found.
-
Parameters:
-
c(Collection<? extends T>) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream contains all the specified elements or the specified collection is empty, {@code false} otherwise
- See also: #containsAny(Collection), #containsNone(Collection)
containsAny(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @SequentialOnly @TerminalOp public abstract boolean containsAny(T... a) - Summary: Checks if the stream contains any of the specified elements.
-
Contract:
- Checks if the stream contains any of the specified elements.
-
Parameters:
-
a(T[]) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream contains any of the specified elements, {@code false} otherwise if doesn't or if the array is {@code null} or empty
- See also: #containsNone(Object\[\]), #containsAll(Object\[\])
-
Signature:
@SequentialOnly @TerminalOp public abstract boolean containsAny(Collection<? extends T> c) - Summary: Checks if the stream contains any of the specified elements.
-
Contract:
- Checks if the stream contains any of the specified elements.
-
Parameters:
-
c(Collection<? extends T>) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream contains any of the specified element, {@code false} otherwise if doesn't or if the Collection is {@code null} or empty
- See also: #containsNone(Collection), #containsAll(Collection)
containsNone(...) -> boolean
-
Signature:
@SuppressWarnings("unchecked") @SequentialOnly @TerminalOp public abstract boolean containsNone(T... a) - Summary: Checks if the stream doesn't contain any of the specified elements.
-
Contract:
- Checks if the stream doesn't contain any of the specified elements.
- This is a terminal operation that short-circuits if any specified element is found.
-
Parameters:
-
a(T[]) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream doesn't contain any of the specified elements, or if this stream is empty, or if valuesToFind is {@code null} or empty, {@code false} otherwise
- See also: #containsAny(Object\[\]), #containsAll(Object\[\])
-
Signature:
@SequentialOnly @TerminalOp public abstract boolean containsNone(Collection<? extends T> c) - Summary: Checks if the stream doesn't contain any of the specified elements.
-
Contract:
- Checks if the stream doesn't contain any of the specified elements.
- This is a terminal operation that short-circuits if any specified element is found.
-
Parameters:
-
c(Collection<? extends T>) — the elements to check for presence in the stream
-
- Returns: {@code true} if the stream doesn't contain any of the specified elements, or if this stream is empty, or if valuesToFind is {@code null} or empty. {@code false} otherwise
- See also: #containsAny(Collection), #containsAll(Collection)
toArray(...) -> A\[\]
-
Signature:
@SequentialOnly @TerminalOp public abstract <A> A[] toArray(IntFunction<A[]> generator) - Summary: Returns an array containing the elements of this stream.
-
Contract:
- The generator function should create an array of the appropriate size.
-
Parameters:
-
generator(IntFunction<A[]>) — a function which produces a new array of the desired type and the provided length
-
- Returns: an array containing the elements of this stream
- See also: #toArray(), #toList()
toImmutableMap(...) -> ImmutableMap<K, V>
-
Signature:
@ParallelSupported @TerminalOp public <K, V, E extends Exception, E2 extends Exception> ImmutableMap<K, V> toImmutableMap(final Throwables.Function<? super T, ? extends K, E> keyMapper, final Throwables.Function<? super T, ? extends V, E2> valueMapper) throws IllegalStateException, E, E2 - Summary: Collects the elements of this stream into an immutable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map
-
- Returns: an immutable map containing the elements of this stream
-
Throws:
-
java.lang.IllegalStateException— if there are duplicated keys -
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toImmutableMap(Throwables.Function, Throwables.Function, BinaryOperator), #toMap(Throwables.Function, Throwables.Function), #toMap(Throwables.Function, Throwables.Function, BinaryOperator), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@ParallelSupported @TerminalOp public <K, V, E extends Exception, E2 extends Exception> ImmutableMap<K, V> toImmutableMap(final Throwables.Function<? super T, ? extends K, E> keyMapper, final Throwables.Function<? super T, ? extends V, E2> valueMapper, final BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Collects the elements of this stream into an immutable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The merge function should be associative for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map -
mergeFunction(BinaryOperator<V>) — the function to merge values associated with the same key
-
- Returns: an immutable map containing the elements of this stream
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toImmutableMap(Throwables.Function, Throwables.Function), #toMap(Throwables.Function, Throwables.Function, BinaryOperator), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
toMap(...) -> Map<K, V>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper) throws IllegalStateException, E, E2 - Summary: Collects the elements of this stream into a modifiable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map
-
- Returns: a map containing the elements of this stream
-
Throws:
-
java.lang.IllegalStateException— if there are duplicated keys -
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toMap(Throwables.Function, Throwables.Function, BinaryOperator), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, V> toMap(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2 - Summary: Collects the elements of this stream into a modifiable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The merge function should be associative for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map -
mergeFunction(BinaryOperator<V>) — the function to merge values associated with the same key
-
- Returns: a map containing the elements of this stream
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toMap(Throwables.Function, Throwables.Function, BinaryOperator, Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws IllegalStateException, E, E2 - Summary: Collects the elements of this stream into a modifiable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map
-
- Returns: a map containing the elements of this stream
-
Throws:
-
java.lang.IllegalStateException— if there are duplicated keys -
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toMap(Throwables.Function, Throwables.Function, BinaryOperator, Supplier), Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Collects the elements of this stream into a modifiable map.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The merge function should be associative for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map -
mergeFunction(BinaryOperator<V>) — the function to merge values associated with the same key -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map
-
- Returns: a map containing the elements of this stream
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: Fn#throwingMerger(), Fn#replacingMerger(), Fn#ignoringMerger()
groupTo(...) -> Map<K, List<T>>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, E extends Exception> Map<K, List<T>> groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper) throws E - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception
-
- See also: #toMultimap(Throwables.Function), #groupTo(Throwables.Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, M extends Map<K, List<T>>, E extends Exception> M groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception
-
- See also: #toMultimap(Throwables.Function, Supplier), #groupTo(Throwables.Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, List<V>> groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper) throws E, E2 - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toMultimap(Throwables.Function, Throwables.Function), #groupTo(Throwables.Function, Throwables.Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, List<V>>, E extends Exception, E2 extends Exception> M groupTo( Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: #toMultimap(Throwables.Function, Throwables.Function, Supplier), #groupTo(Throwables.Function, Throwables.Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper, final Collector<? super T, ?, D> downstream) throws E - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map -
downstream(Collector<? super T, ?, D>) — a collector to reduce the values associated with a key
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector), #groupTo(Throwables.Function, Collector, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper, final Collector<? super T, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map. -
downstream(Collector<? super T, ?, D>) — a collector to reduce the values associated with a key. -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map.
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, D, E extends Exception, E2 extends Exception> Map<K, D> groupTo(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, final Collector<? super V, ?, D> downstream) throws E, E2 - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map. -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map. -
downstream(Collector<? super V, ?, D>) — a collector to reduce the values associated with a key.
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, D, M extends Map<K, D>, E extends Exception, E2 extends Exception> M groupTo( Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, final Collector<? super V, ?, D> downstream, final Supplier<? extends M> mapFactory) throws E, E2 - Summary: Groups the elements of this stream by a key produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — a function to produce the keys for the map. -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — a function to produce the values for the map. -
downstream(Collector<? super V, ?, D>) — a collector to reduce the values associated with a key. -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map.
-
- Returns: a map containing the elements of this stream grouped by the keys produced by the keyMapper function
-
Throws:
-
E— if the keyMapper function throws an exception -
E2— if the valueMapper function throws an exception
-
- See also: Collectors#groupingBy(Function, Collector, Supplier)
flatGroupTo(...) -> Map<K, List<T>>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, E extends Exception> Map<K, List<T>> flatGroupTo(Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor) throws E - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys.
-
- Returns: a Map where each key is associated with a List of elements that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, M extends Map<K, List<T>>, E extends Exception> M flatGroupTo( final Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, final Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map.
-
- Returns: a Map where each key is associated with a List of elements that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K, List<V>> flatGroupTo( Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Throwables.BiFunction<? super K, ? super T, ? extends V, E2> valueMapper) throws E, E2 - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
valueMapper(Throwables.BiFunction<? super K, ? super T, ? extends V, E2>) — a function that maps an input element and its corresponding key to a value.
-
- Returns: a Map where each key is associated with a List of values that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function -
E2— Exception thrown by the value mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, List<V>>, E extends Exception, E2 extends Exception> M flatGroupTo( Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Throwables.BiFunction<? super K, ? super T, ? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
valueMapper(Throwables.BiFunction<? super K, ? super T, ? extends V, E2>) — a function that maps an input element and its corresponding key to a value. -
mapFactory(Supplier<? extends M>) — a supplier to create the resulting map.
-
- Returns: a Map where each key is associated with a List of values that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function -
E2— Exception thrown by the value mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K, D> flatGroupTo(Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Collector<? super T, ?, D> downstream) throws E - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The downstream collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
downstream(Collector<? super T, ?, D>) — a Collector that accumulates input elements into a mutable result container.
-
- Returns: a Map where each key is associated with a List of values that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M flatGroupTo( Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Collector<? super T, ?, D> downstream, Supplier<? extends M> mapFactory) throws E - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The downstream collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
downstream(Collector<? super T, ?, D>) — a Collector that accumulates input elements into a mutable result container. -
mapFactory(Supplier<? extends M>) — a function that creates a new Map.
-
- Returns: a Map where each key is associated with a List of values that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, D, E extends Exception, E2 extends Exception> Map<K, D> flatGroupTo( Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Throwables.BiFunction<? super K, ? super T, ? extends V, E2> valueMapper, Collector<? super V, ?, D> downstream) throws E, E2 - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The downstream collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
valueMapper(Throwables.BiFunction<? super K, ? super T, ? extends V, E2>) — a function that maps an input element and a key to an intermediate value. -
downstream(Collector<? super V, ?, D>) — a Collector that accumulates intermediate values into a final result.
-
- Returns: a Map where each key is associated with a value that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function -
E2— Exception thrown by the value mapping function
-
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, D, M extends Map<K, D>, E extends Exception, E2 extends Exception> M flatGroupTo( Throwables.Function<? super T, ? extends Collection<? extends K>, E> flatKeyExtractor, Throwables.BiFunction<? super K, ? super T, ? extends V, E2> valueMapper, final Collector<? super V, ?, D> downstream, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Groups the elements of the Stream into a Map according to a function that maps each element to multiple keys.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The downstream collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
flatKeyExtractor(Throwables.Function<? super T, ? extends Collection<? extends K>, E>) — a function that maps an input element to a collection of keys. -
valueMapper(Throwables.BiFunction<? super K, ? super T, ? extends V, E2>) — a function that maps an input element and a key to an intermediate value. -
downstream(Collector<? super V, ?, D>) — a Collector that accumulates intermediate values into a final result. -
mapFactory(Supplier<? extends M>) — a Supplier that generates the resulting Map.
-
- Returns: a Map where each key is associated with a value that were mapped to it
-
Throws:
-
E— Exception thrown by the key mapping function -
E2— Exception thrown by the value mapping function
-
partitionTo(...) -> Map<Boolean, List<T>>
-
Signature:
@ParallelSupported @TerminalOp public abstract <E extends Exception> Map<Boolean, List<T>> partitionTo(final Throwables.Predicate<? super T, E> predicate) throws E - Summary: Partitions the elements of the Stream into a Map according to a predicate.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — a function that tests whether an element should be included in the <i> true </i> or <i> false </i> list.
-
- Returns: a Map where the Boolean key is associated with a list of elements that satisfy or do not satisfy the predicate
-
Throws:
-
E— Exception thrown by the predicate
-
- See also: #groupTo(Throwables.Function), Collectors#partitioningBy(Predicate)
-
Signature:
@ParallelSupported @TerminalOp public abstract <D, E extends Exception> Map<Boolean, D> partitionTo(Throwables.Predicate<? super T, E> predicate, Collector<? super T, ?, D> downstream) throws E - Summary: Partitions the elements of the Stream into a Map according to a predicate.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The downstream collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, E>) — a function that tests whether an element should be included in the <i> true </i> or <i> false </i> group. -
downstream(Collector<? super T, ?, D>) — a Collector that accumulates elements into a final result.
-
- Returns: a Map where the Boolean key is associated with a value that is the result of applying a downstream collector to the elements that satisfy or do not satisfy the predicate
-
Throws:
-
E— Exception thrown by the predicate
-
- See also: #groupTo(Throwables.Function, Collector), Collectors#partitioningBy(Predicate, Collector)
toMultimap(...) -> ListMultimap<K, T>
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, E extends Exception> ListMultimap<K, T> toMultimap(Throwables.Function<? super T, ? extends K, E> keyMapper) throws E - Summary: Converts the elements in this stream into a ListMultimap based on the provided key extractor function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — the function to extract keys from the elements.
-
- Returns: a ListMultimap where the keys are generated by the key extractor function and the values are the elements
-
Throws:
-
E— if an exception occurs during key extraction
-
- See also: #groupTo(Throwables.Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V extends Collection<T>, M extends Multimap<K, T, V>, E extends Exception> M toMultimap( Throwables.Function<? super T, ? extends K, E> keyMapper, Supplier<? extends M> mapFactory) throws E - Summary: Converts the elements in this stream into a Multimap based on the provided key extractor function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — the function to extract keys from the elements. -
mapFactory(Supplier<? extends M>) — the supplier to create a new multimap instance.
-
- Returns: a Multimap where the keys are generated by the key extractor function and the values are the elements
-
Throws:
-
E— if an exception occurs during key extraction
-
- See also: #groupTo(Throwables.Function, Supplier)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> ListMultimap<K, V> toMultimap(Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper) throws E, E2 - Summary: Converts the elements in this stream into a ListMultimap based on the provided key and value extractor functions.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — the function to extract keys from the elements. -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — the function to extract values from the elements.
-
- Returns: a ListMultimap where the keys are generated by the key extractor function and the values are generated by the value extractor function
-
Throws:
-
E— if an exception occurs during key extraction -
E2— if an exception occurs during value extraction
-
- See also: #groupTo(Throwables.Function, Throwables.Function)
-
Signature:
@ParallelSupported @TerminalOp public abstract <K, V, C extends Collection<V>, M extends Multimap<K, V, C>, E extends Exception, E2 extends Exception> M toMultimap( Throwables.Function<? super T, ? extends K, E> keyMapper, Throwables.Function<? super T, ? extends V, E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2 - Summary: Converts the elements in this stream into a Multimap based on the provided key and value extractor functions.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Throwables.Function<? super T, ? extends K, E>) — the function to extract keys from the elements. -
valueMapper(Throwables.Function<? super T, ? extends V, E2>) — the function to extract values from the elements. -
mapFactory(Supplier<? extends M>) — the supplier to create the Multimap instance.
-
- Returns: a Multimap where the keys are generated by the key extractor function and the values are generated by the value extractor function
-
Throws:
-
E— if an exception occurs during key extraction -
E2— if an exception occurs during value extraction
-
- See also: #groupTo(Throwables.Function, Throwables.Function, Supplier)
toDataset(...) -> Dataset
-
Signature:
@Beta @SequentialOnly @TerminalOp public abstract Dataset toDataset() throws IllegalArgumentException - Summary: Converts the elements of the Stream into a Dataset.
-
Contract:
- The element type {@code T} in this stream must be a Map or Bean for retrieving column names.
-
Parameters:
- (none)
- Returns: a Dataset representation of the Stream elements.
-
Throws:
-
java.lang.IllegalArgumentException— if element type {@code T} is not Map or Bean.
-
- See also: N#newDataset(Collection)
-
Signature:
@SequentialOnly @TerminalOp public abstract Dataset toDataset(final List<String> columnNames) throws IllegalArgumentException - Summary: Converts the elements of the Stream into a Dataset.
-
Contract:
- The element type {@code T} in this stream must be an array/collection, Map or Bean.
-
Parameters:
-
columnNames(List<String>) — the list of column names to be used in the Dataset. Must not be {@code null} .
-
- Returns: a Dataset representation of the Stream elements.
-
Throws:
-
java.lang.IllegalArgumentException— if the specified {code columnNames} is empty and element type {@code T} is not Map or Bean.
-
- See also: N#newDataset(Collection, Collection)
foldLeft(...) -> Optional<T>
-
Signature:
@SequentialOnly @TerminalOp public abstract Optional<T> foldLeft(BinaryOperator<T> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided BinaryOperator, and returns an Optional.
-
Contract:
- The BinaryOperator should be an associative accumulation function, and it is applied from left to right to the elements in this stream.
-
Parameters:
-
accumulator(BinaryOperator<T>) — the function for combining two values.
-
- Returns: an Optional describing the result of the fold
- See also: #reduce(BinaryOperator)
-
Signature:
@SequentialOnly @TerminalOp public abstract <U> U foldLeft(U identity, BiFunction<? super U, ? super T, U> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(U) — the initial value. -
accumulator(BiFunction<? super U, ? super T, U>) — the function for combining the current reduced value and the current stream element.
-
- Returns: the result of the reduction
- See also: #reduce(Object, BiFunction, BinaryOperator)
foldRight(...) -> Optional<T>
-
Signature:
@SequentialOnly @TerminalOp public abstract Optional<T> foldRight(BinaryOperator<T> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided BinaryOperator, and returns an Optional.
-
Contract:
- The BinaryOperator should be an associative accumulation function, and it is applied from right to left to the elements in this stream.
-
Parameters:
-
accumulator(BinaryOperator<T>) — the function for combining two values.
-
- Returns: an Optional describing the result of the fold
- See also: #reduce(BinaryOperator)
-
Signature:
@SequentialOnly @TerminalOp public abstract <U> U foldRight(U identity, BiFunction<? super U, ? super T, U> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Parameters:
-
identity(U) — the initial value. -
accumulator(BiFunction<? super U, ? super T, U>) — the function for combining the current reduced value and the current stream element.
-
- Returns: the result of the reduction
- See also: #reduce(Object, BiFunction, BinaryOperator)
reduce(...) -> Optional<T>
-
Signature:
@ParallelSupported @TerminalOp public abstract Optional<T> reduce(BinaryOperator<T> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The accumulator should be associative for correct behavior in parallel streams.
-
Parameters:
-
accumulator(BinaryOperator<T>) — the function for combining the current reduced value and the current stream element. Must be {@code non-null} and associative.
-
- Returns: an Optional describing the result of the reduction. If the stream is empty, an empty {@code Optional} is returned.
-
Signature:
@ParallelSupported @TerminalOp public T reduce(final T identity, final BinaryOperator<T> accumulator) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function, and returns the reduced value.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The accumulator should be associative for correct behavior in parallel streams.
-
Parameters:
-
identity(T) — the initial value of the reduction operation. -
accumulator(BinaryOperator<T>) — the function for combining the current reduced value and the current stream element. Must be {@code non-null} and associative.
-
- Returns: the result of the reduction
-
Signature:
@ParallelSupported @TerminalOp public abstract <U> U reduce(U identity, BiFunction<? super U, ? super T, U> accumulator, BinaryOperator<U> combiner) - Summary: Performs a reduction on the elements of this stream, using the provided accumulator function and combiner function, and returns the reduced value.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The accumulator and combiner should be associative for correct behavior in parallel streams.
-
Parameters:
-
identity(U) — the initial value of the reduction operation. -
accumulator(BiFunction<? super U, ? super T, U>) — the function for combining the current reduced value and the current stream element. -
combiner(BinaryOperator<U>) — the function for combining the results of the accumulator function. Must be {@code non-null} and associative.
-
- Returns: the result of the reduction
collect(...) -> R
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R, ? super T> accumulator, BiConsumer<R, R> combiner) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The combiner should be associative for correct behavior in parallel streams.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(BiConsumer<? super R, ? super T>) — an associative, non-interfering, stateless function for incorporating an additional element into a result. -
combiner(BiConsumer<R, R>) — an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function. It's unnecessary to specify {@code combiner} if {@code R} is a {@code Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- Returns: the result of the reduction
- See also: #collect(Supplier, BiConsumer), #collect(Collector), BiConsumers#ofAddAll(), BiConsumers#ofPutAll()
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R, ? super T> accumulator) throws IllegalArgumentException - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <p> Only call this method when the returned type {@code R} is one types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
supplier(Supplier<R>) — a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. -
accumulator(BiConsumer<? super R, ? super T>) — an associative, non-interfering, stateless function for incorporating an additional element into a result.
-
- Returns: the result of the reduction
-
Throws:
-
java.lang.IllegalArgumentException— if the returned type {@code R} is not one of the types: {@code Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList} .
-
- See also: #collect(Supplier, BiConsumer, BiConsumer), #collect(Collector)
-
Signature:
@ParallelSupported @TerminalOp public abstract <R> R collect(Collector<? super T, ?, R> collector) - Summary: Performs a mutable reduction operation on the elements of this stream using a Collector.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
collector(Collector<? super T, ?, R>) — the Collector encapsulating the reduction operation. It provides functions for creating a new result container, incorporating an element into a result, and combining two result containers.
-
- Returns: the result of the reduction
collectThenApply(...) -> RR
-
Signature:
@ParallelSupported @TerminalOp public abstract <R, RR, E extends Exception> RR collectThenApply(Collector<? super T, ?, R> downstream, Throwables.Function<? super R, ? extends RR, E> func) throws E - Summary: Collects the elements of this stream using the provided Collector, then applies the provided function to the result.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
downstream(Collector<? super T, ?, R>) — the Collector to perform the reduction operation on the elements of this stream. -
func(Throwables.Function<? super R, ? extends RR, E>) — the function to apply to the result of the collection.
-
- Returns: the final result after applying the function to the collected elements.
-
Throws:
-
E— If an exception occurs during function application.
-
collectThenAccept(...) -> void
-
Signature:
@ParallelSupported @TerminalOp public abstract <R, E extends Exception> void collectThenAccept(Collector<? super T, ?, R> downstream, Throwables.Consumer<? super R, E> consumer) throws E - Summary: Collects the elements of this stream using the provided Collector, then applies the provided consumer to the result.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
- The collector should be concurrent for correct behavior in parallel streams.
-
Parameters:
-
downstream(Collector<? super T, ?, R>) — the Collector to perform the reduction operation on the elements of this stream. -
consumer(Throwables.Consumer<? super R, E>) — the consumer to apply to the result of the collection.
-
-
Throws:
-
E— If an exception occurs during the consumer application.
-
toListThenApply(...) -> R
-
Signature:
@SequentialOnly @TerminalOp public abstract <R, E extends Exception> R toListThenApply(Throwables.Function<? super List<T>, ? extends R, E> func) throws E - Summary: Applies the provided function to a list of elements collected from this stream.
-
Parameters:
-
func(Throwables.Function<? super List<T>, ? extends R, E>) — the function to apply to the list of elements.
-
- Returns: the result produced by applying the function to the list of elements.
-
Throws:
-
E— If an exception occurs during the function application.
-
toListThenAccept(...) -> void
-
Signature:
@SequentialOnly @TerminalOp public abstract <E extends Exception> void toListThenAccept(Throwables.Consumer<? super List<T>, E> consumer) throws E - Summary: Applies the provided consumer to a list of elements collected from this stream.
-
Parameters:
-
consumer(Throwables.Consumer<? super List<T>, E>) — the consumer to apply to the list of elements.
-
-
Throws:
-
E— If an exception occurs during the consumer application.
-
toSetThenApply(...) -> R
-
Signature:
@SequentialOnly @TerminalOp public abstract <R, E extends Exception> R toSetThenApply(Throwables.Function<? super Set<T>, ? extends R, E> func) throws E - Summary: Applies the provided function to a set of elements collected from this stream.
-
Parameters:
-
func(Throwables.Function<? super Set<T>, ? extends R, E>) — the function to apply to the set of elements.
-
- Returns: the result produced by applying the function to the set of elements.
-
Throws:
-
E— If an exception occurs during the function application.
-
toSetThenAccept(...) -> void
-
Signature:
@SequentialOnly @TerminalOp public abstract <E extends Exception> void toSetThenAccept(Throwables.Consumer<? super Set<T>, E> consumer) throws E - Summary: Applies the provided consumer to a set of elements collected from this stream.
-
Parameters:
-
consumer(Throwables.Consumer<? super Set<T>, E>) — the consumer to apply to the set of elements.
-
-
Throws:
-
E— If an exception occurs during the consumer application.
-
toCollectionThenApply(...) -> R
-
Signature:
@SequentialOnly @TerminalOp public abstract <R, C extends Collection<T>, E extends Exception> R toCollectionThenApply(Supplier<? extends C> supplier, Throwables.Function<? super C, ? extends R, E> func) throws E - Summary: Applies the provided function to a collection of elements collected from this stream.
-
Parameters:
-
supplier(Supplier<? extends C>) — the supplier to create the Collection instance. -
func(Throwables.Function<? super C, ? extends R, E>) — the function to apply to the collection of elements.
-
- Returns: the result produced by applying the function to the collection of elements.
-
Throws:
-
E— If an exception occurs during the function application.
-
toCollectionThenAccept(...) -> void
-
Signature:
@SequentialOnly @TerminalOp public abstract <C extends Collection<T>, E extends Exception> void toCollectionThenAccept(Supplier<? extends C> supplier, Throwables.Consumer<? super C, E> consumer) throws E - Summary: Applies the provided consumer to a collection of elements collected from this stream.
-
Parameters:
-
supplier(Supplier<? extends C>) — the supplier to provide the collection of elements. -
consumer(Throwables.Consumer<? super C, E>) — the consumer to apply to the collection of elements.
-
-
Throws:
-
E— If an exception occurs during the consumer application.
-
min(...) -> Optional<T>
-
Signature:
@ParallelSupported @TerminalOp public abstract Optional<T> min(Comparator<? super T> comparator) - Summary: Returns an <i> Optional </i> describing the minimum element of this stream according to the provided comparator.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to compare elements of this stream.
-
- Returns: an <i> Optional </i> describing the minimum element of this stream, or an empty <i> Optional </i> if the stream is empty.
minBy(...) -> Optional<T>
-
Signature:
@ParallelSupported @TerminalOp @SuppressWarnings("rawtypes") public Optional<T> minBy(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns an <i> Optional </i> describing the minimum element of this stream according to the natural order of the keys produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function to apply to each element to determine its key for comparison.
-
- Returns: an <i> Optional </i> describing the minimum element of this stream, or an empty <i> Optional </i> if the stream is empty.
minAll(...) -> List<T>
-
Signature:
@ParallelSupported @TerminalOp public abstract List<T> minAll(Comparator<? super T> comparator) - Summary: Returns a <i> List </i> containing all the minimum elements of this stream according to the provided comparator.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to compare elements of this stream.
-
- Returns: a <i> List </i> containing all the minimum elements of this stream.
max(...) -> Optional<T>
-
Signature:
@ParallelSupported @TerminalOp public abstract Optional<T> max(Comparator<? super T> comparator) - Summary: Returns an <i> Optional </i> describing the maximum element of this stream according to the provided comparator.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to compare elements of this stream.
-
- Returns: an <i> Optional </i> describing the maximum element of this stream, or an empty <i> Optional </i> if the stream is empty.
maxBy(...) -> Optional<T>
-
Signature:
@ParallelSupported @TerminalOp @SuppressWarnings("rawtypes") public Optional<T> maxBy(final Function<? super T, ? extends Comparable> keyMapper) - Summary: Returns an <i> Optional </i> describing the maximum element of this stream according to the natural order of the keys produced by the provided keyMapper function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
keyMapper(Function<? super T, ? extends Comparable>) — a function to apply to each element to determine its key for comparison.
-
- Returns: an <i> Optional </i> describing the maximum element of this stream, or an empty <i> Optional </i> if the stream is empty.
maxAll(...) -> List<T>
-
Signature:
@ParallelSupported @TerminalOp public abstract List<T> maxAll(Comparator<? super T> comparator) - Summary: Returns a <i> List </i> containing all the maximum elements of this stream according to the provided comparator.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator to compare elements of this stream.
-
- Returns: a <i> List </i> containing all the maximum elements of this stream.
sumInt(...) -> long
-
Signature:
@ParallelSupported @TerminalOp public abstract long sumInt(ToIntFunction<? super T> mapper) - Summary: Sums the integer values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — the function to extract integer values from the elements.
-
- Returns: the sum of the integer values
- See also: N#sumInt(Iterable, ToIntFunction)
sumLong(...) -> long
-
Signature:
@ParallelSupported @TerminalOp public abstract long sumLong(ToLongFunction<? super T> mapper) - Summary: Sums the long values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — the function to extract long values from the elements.
-
- Returns: the sum of the long values
- See also: N#sumLong(Iterable, ToLongFunction)
sumDouble(...) -> double
-
Signature:
@ParallelSupported @TerminalOp public abstract double sumDouble(ToDoubleFunction<? super T> mapper) - Summary: Sums the double values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — the function to extract double values from the elements.
-
- Returns: the sum of the double values
- See also: N#sumDouble(Iterable, ToDoubleFunction)
averageInt(...) -> OptionalDouble
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalDouble averageInt(ToIntFunction<? super T> mapper) - Summary: Calculates the average of the integer values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToIntFunction<? super T>) — the function to extract integer values from the elements.
-
- Returns: the average of the integer values, or empty if the stream is empty
- See also: N#averageInt(Iterable, ToIntFunction)
averageLong(...) -> OptionalDouble
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalDouble averageLong(ToLongFunction<? super T> mapper) - Summary: Calculates the average of the long values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToLongFunction<? super T>) — the function to extract long values from the elements.
-
- Returns: the average of the long values, or empty if the stream is empty
- See also: N#averageLong(Iterable, ToLongFunction)
averageDouble(...) -> OptionalDouble
-
Signature:
@ParallelSupported @TerminalOp public abstract OptionalDouble averageDouble(ToDoubleFunction<? super T> mapper) - Summary: Calculates the average of the double values extracted from the elements in this stream using the provided function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(ToDoubleFunction<? super T>) — the function to extract double values from the elements.
-
- Returns: the average of the double values, or empty if the stream is empty
- See also: N#averageDouble(Iterable, ToDoubleFunction)
kthLargest(...) -> Optional<T>
-
Signature:
@SequentialOnly @TerminalOp public abstract Optional<T> kthLargest(int k, Comparator<? super T> comparator) - Summary: Returns the <i> k-th </i> largest element in the stream according to the provided comparator.
-
Parameters:
-
k(int) — the rank of the element to find. k=1 would mean the largest element, k=2 the second largest, and so on. Must be positive. -
comparator(Comparator<? super T>) — a comparator to determine the order of the elements.
-
- Returns: an {@code Optional} containing the <i> k-th </i> largest element if it exists, otherwise an empty {@code Optional} .
percentiles(...) -> Optional<Map<Percentage, T>>
-
Signature:
@SequentialOnly @TerminalOp public abstract Optional<Map<Percentage, T>> percentiles(Comparator<? super T> comparator) - Summary: Calculates the percentiles of the elements in the stream according to the provided comparator.
-
Contract:
- All elements will be loaded into memory and sorted if not yet.
-
Parameters:
-
comparator(Comparator<? super T>) — a comparator to determine the order of the elements.
-
- Returns: an {@code Optional} containing a Map where the keys are the percentiles and the values are the corresponding elements. If the stream is empty, an empty {@code Optional} is returned.
- See also: N#percentilesOfSorted(int\[\])
hasDuplicates(...) -> boolean
-
Signature:
@SequentialOnly @TerminalOp public abstract boolean hasDuplicates() - Summary: Checks if the stream contains duplicate elements.
-
Contract:
- Checks if the stream contains duplicate elements.
-
Parameters:
- (none)
- Returns: <i> true </i> if the stream contains duplicate elements, otherwise <i> false </i> .
combinations(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations() - Summary: Generates all possible combinations of the elements in this stream.
-
Parameters:
- (none)
- Returns: a new stream where each element is a list representing a combination of elements from the original stream.
- See also: #combinations(int), #combinations(int, boolean)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations(int len) - Summary: Generates all possible combinations of the elements in this stream of the specified length.
-
Parameters:
-
len(int) — the length of each combination. Must be non-negative.
-
- Returns: a new stream where each element is a list representing a combination of elements from the original stream.
- See also: #combinations(int, boolean), #permutations(), Iterables#permutations(Collection)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations(int len, boolean repeat) - Summary: Generates all possible combinations of the elements in this stream of the specified length, with or without repetition.
-
Parameters:
-
len(int) — the length of each combination. Must be non-negative. -
repeat(boolean) — if {@code true} , elements can be repeated in the combinations; otherwise, elements are not repeated.
-
- Returns: a new stream where each element is a list representing a combination of elements from the original stream.
- See also: Iterables#permutations(Collection)
permutations(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> permutations() - Summary: Generates all permutations of the elements in the stream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of all the permutations of the elements in the original Stream.
- See also: Iterables#permutations(Collection)
orderedPermutations(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations() - Summary: Generates all ordered permutations of the elements in the stream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of all the ordered permutations of the elements in the original Stream.
- See also: Iterables#orderedPermutations(Collection)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations(Comparator<? super T> comparator) - Summary: Generates all ordered permutations of the elements in the stream, according to the specified comparator.
-
Contract:
- If the comparator views two elements as equal, there are no guarantees on the order of those elements in the resulting permutations.
-
Parameters:
-
comparator(Comparator<? super T>) — the comparator that should be used to determine the order of the elements in the permutations.
-
- Returns: a new Stream consisting of all the ordered permutations of the elements in the original Stream.
- See also: Iterables#orderedPermutations(Collection, Comparator)
cartesianProduct(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<List<T>> cartesianProduct(final Collection<? extends T>... cs) - Summary: Generates the Cartesian product of the provided collections.
-
Parameters:
-
cs(Collection<? extends T>[]) — the collections to generate the Cartesian product from.
-
- Returns: a new Stream consisting of all the ordered pairs in the Cartesian product of the elements in the original collections.
- See also: #cartesianProduct(Collection), Iterables#cartesianProduct(Collection...)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> cartesianProduct(Collection<? extends Collection<? extends T>> cs) - Summary: Generates the Cartesian product of the provided collections.
-
Parameters:
-
cs(Collection<? extends Collection<? extends T>>) — the collections to generate the Cartesian product from.
-
- Returns: a new Stream consisting of all the ordered pairs in the Cartesian product of the elements in the original collections.
- See also: Iterables#cartesianProduct(Collection)
rollup(...) -> Stream<List<T>>
-
Signature:
@SequentialOnly @IntermediateOp @TerminalOpTriggered public abstract Stream<List<T>> rollup() - Summary: Generates a rollup of the elements in the stream.
-
Parameters:
- (none)
- Returns: a new Stream consisting of Lists that represent the rollup of the elements in the original stream.
- See also: Iterables#rollup(Collection)
intersection(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U> Stream<T> intersection(Function<? super T, ? extends U> mapper, Collection<U> c) - Summary: Returns a stream consisting of the elements of this stream that are also present in the specified collection based on a mapping function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — a function that transforms stream elements into a form that can be compared with collection elements. -
c(Collection<U>) — the collection to find common elements with.
-
- Returns: a new Stream containing elements whose mapped values are present in the collection
- See also: N#intersection(int\[\], int\[\]), N#intersection(Collection, Collection), N#commonSet(Collection, Collection), Collection#retainAll(Collection)
difference(...) -> Stream<T>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U> Stream<T> difference(Function<? super T, ? extends U> mapper, Collection<U> c) - Summary: Returns a stream consisting of elements from this stream that are not present in the specified collection, after applying the provided mapping function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(Function<? super T, ? extends U>) — a function that transforms stream elements into values for comparison. -
c(Collection<U>) — the collection of values to exclude from the stream.
-
- Returns: a new stream containing elements whose mapped values have more occurrences in this stream than in the collection
- See also: #difference(Collection), #symmetricDifference(Collection), #intersection(Function, Collection), N#difference(Collection, Collection), N#symmetricDifference(Collection, Collection), Difference#of(Collection, Collection), Iterables#symmetricDifference(Set, Set)
prepend(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> prepend(final T... a) - Summary: Prepends the specified elements to the beginning of this stream.
-
Parameters:
-
a(T[]) — the elements to prepend to the stream
-
- Returns: a new stream with the specified elements prepended
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> prepend(Collection<? extends T> c) - Summary: Prepends the specified collection of elements to the beginning of this stream.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to prepend to the stream.
-
- Returns: a new stream with the specified collection of elements prepended
append(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> append(final T... a) - Summary: Appends the specified elements to the end of this stream.
-
Parameters:
-
a(T[]) — the elements to append to the stream
-
- Returns: a new stream with the specified elements appended
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> append(Collection<? extends T> c) - Summary: Appends the specified collection of elements to the end of this stream.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to append to the stream.
-
- Returns: a new stream with the specified collection of elements appended
appendIfEmpty(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> appendIfEmpty(final T... a) - Summary: Appends the specified elements to the end of this stream if the stream is empty.
-
Contract:
- Appends the specified elements to the end of this stream if the stream is empty.
-
Parameters:
-
a(T[]) — the elements to append to the stream
-
- Returns: a new stream with the specified elements appended if the stream is empty, otherwise the original stream
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> appendIfEmpty(Collection<? extends T> c) - Summary: Appends the specified collection of elements to the end of this stream if the stream is empty.
-
Contract:
- Appends the specified collection of elements to the end of this stream if the stream is empty.
-
Parameters:
-
c(Collection<? extends T>) — the collection of elements to append to the stream.
-
- Returns: a new stream with the specified collection of elements appended if the stream is empty, otherwise the original stream
defaultIfEmpty(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public final Stream<T> defaultIfEmpty(final T defaultValue) - Summary: Returns a stream that contains the specified default value if the original stream is empty.
-
Contract:
- Returns a stream that contains the specified default value if the original stream is empty.
-
Parameters:
-
defaultValue(T) — the default value to be used if the stream is empty
-
- Returns: a new stream that contains the default value if the original stream is empty
- See also: #appendIfEmpty(Object...)
buffered(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> buffered() - Summary: Returns a new Stream with elements from a temporary queue which is filled by fetching elements from this Stream asynchronously with a new thread.
-
Parameters:
- (none)
- Returns: a new Stream < T > that is buffered
- See also: #buffered(int)
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> buffered(int bufferSize) - Summary: Returns a new Stream with elements from a temporary queue which is filled by fetching elements from this Stream asynchronously with a new thread.
-
Parameters:
-
bufferSize(int) — the size of the buffer to be used for the Stream. Must be positive.
-
- Returns: a new Stream < T > that is buffered
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> buffered(final BlockingQueue<T> queueToBuffer) - Summary: Returns a new Stream with elements from a temporary queue which is filled by fetching elements from this Stream asynchronously with a new thread.
-
Parameters:
-
queueToBuffer(BlockingQueue<T>) — the queue to be used for buffering the Stream.
-
- Returns: a new Stream < T > that is buffered
mergeWith(...) -> Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> mergeWith(final Collection<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges the current Stream with a given Collection.
-
Contract:
- If the BiFunction returns MergeResult.FIRST, the element from the current Stream is selected.
- If it returns MergeResult.SECOND, the element from the given Collection is selected.
-
Parameters:
-
b(Collection<? extends T>) — the Collection to be merged. It should be ordered with the current Stream. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a BiFunction that determines the order of elements in the merged Stream.
-
- Returns: a new Stream that is the result of merging the current Stream with the given Collection
-
Signature:
@SequentialOnly @IntermediateOp public abstract Stream<T> mergeWith(final Stream<? extends T> b, final BiFunction<? super T, ? super T, MergeResult> nextSelector) - Summary: Merges the current Stream with a given Stream.
-
Contract:
- If the BiFunction returns MergeResult.FIRST, the element from the current Stream is selected.
- If it returns MergeResult.SECOND, the element from the given Stream is selected.
-
Parameters:
-
b(Stream<? extends T>) — the Stream to be merged. It should be ordered with the current Stream. -
nextSelector(BiFunction<? super T, ? super T, MergeResult>) — a BiFunction that determines the order of elements in the merged Stream.
-
- Returns: a new Stream that is the result of merging the current Stream with the given Stream
zipWith(...) -> Stream<R>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(final Collection<T2> b, final BiFunction<? super T, ? super T2, ? extends R> zipFunction) - Summary: Zips this stream with the given collection using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<T2>) — the Collection to be combined with the current Stream. -
zipFunction(BiFunction<? super T, ? super T2, ? extends R>) — a BiFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Collection
- See also: #zipWith(Collection, Object, Object, BiFunction), N#zip(Iterable, Iterable, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Collection<T2> b, T valueForNoneA, final T2 valueForNoneB, BiFunction<? super T, ? super T2, ? extends R> zipFunction) - Summary: Zips this stream with the given collection using the provided zip function.
-
Contract:
- If the current stream or the given collection runs out of elements before the other, the provided default values are used.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<T2>) — the Collection to be combined with the current Stream. -
valueForNoneA(T) — the default value to use for the current Stream when it runs out of elements -
valueForNoneB(T2) — the default value to use for the Collection when it runs out of elements -
zipFunction(BiFunction<? super T, ? super T2, ? extends R>) — a BiFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Collection
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Collection<T2> b, final Collection<T3> c, TriFunction<? super T, ? super T2, ? super T3, ? extends R> zipFunction) - Summary: Zips this stream with the given collections using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<T2>) — the first Collection to be combined with the current Stream. -
c(Collection<T3>) — the second Collection to be combined with the current Stream. -
zipFunction(TriFunction<? super T, ? super T2, ? super T3, ? extends R>) — a TriFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Collections
- See also: #zipWith(Collection, Collection, Object, Object, Object, TriFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, TriFunction<? super T, ? super T2, ? super T3, ? extends R> zipFunction) - Summary: Zips this stream with the given collections using the provided zip function.
-
Contract:
- If the current stream or one of the given collections runs out of elements before the other, the provided default values are used.
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<T2>) — the first Collection to be combined with the current Stream. -
c(Collection<T3>) — the second Collection to be combined with the current Stream. -
valueForNoneA(T) — the default value to use for the current Stream when it runs out of elements -
valueForNoneB(T2) — the default value to use for the first Collection when it runs out of elements -
valueForNoneC(T3) — the default value to use for the second Collection when it runs out of elements -
zipFunction(TriFunction<? super T, ? super T2, ? super T3, ? extends R>) — a TriFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Collections
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(final Stream<T2> b, final BiFunction<? super T, ? super T2, ? extends R> zipFunction) - Summary: Zips this stream with the given stream using the provided zip function.
-
Contract:
- <p> This operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Stream<T2>) — the Stream to be combined with the current Stream. -
zipFunction(BiFunction<? super T, ? super T2, ? extends R>) — a BiFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Stream
- See also: #zipWith(Stream, Object, Object, BiFunction), N#zip(Iterable, Iterable, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(final Stream<T2> b, final T valueForNoneA, final T2 valueForNoneB, final BiFunction<? super T, ? super T2, ? extends R> zipFunction) - Summary: Zips this stream with the given stream using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when one stream runs out of elements before the other.
-
Parameters:
-
b(Stream<T2>) — the Stream to be combined with the current Stream. Will be closed along with this Stream. -
valueForNoneA(T) — the default value to use for the current Stream when it runs out of elements -
valueForNoneB(T2) — the default value to use for the given Stream when it runs out of elements -
zipFunction(BiFunction<? super T, ? super T2, ? extends R>) — a BiFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Stream
- See also: N#zip(Iterable, Iterable, Object, Object, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(final Stream<T2> b, final Stream<T3> c, final TriFunction<? super T, ? super T2, ? super T3, ? extends R> zipFunction) - Summary: Zips this stream with two other streams using the provided zip function.
-
Contract:
- If any stream is longer, its remaining elements are ignored.
-
Parameters:
-
b(Stream<T2>) — the second Stream to be combined with the current Stream. Will be closed along with this Stream. -
c(Stream<T3>) — the third Stream to be combined with the current Stream. Will be closed along with this Stream. -
zipFunction(TriFunction<? super T, ? super T2, ? super T3, ? extends R>) — a TriFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Streams
- See also: #zipWith(Stream, Stream, Object, Object, Object, TriFunction), N#zip(Iterable, Iterable, Iterable, TriFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(final Stream<T2> b, final Stream<T3> c, final T valueForNoneA, final T2 valueForNoneB, final T3 valueForNoneC, final TriFunction<? super T, ? super T2, ? super T3, ? extends R> zipFunction) - Summary: Zips this stream with two other streams using the provided zip function, with default values for missing elements.
-
Contract:
- Default values are used when any stream runs out of elements before the others.
-
Parameters:
-
b(Stream<T2>) — the second Stream to be combined with the current Stream. Will be closed along with this Stream. -
c(Stream<T3>) — the third Stream to be combined with the current Stream. Will be closed along with this Stream. -
valueForNoneA(T) — the default value to use for the current Stream when it runs out of elements -
valueForNoneB(T2) — the default value to use for the second Stream when it runs out of elements -
valueForNoneC(T3) — the default value to use for the third Stream when it runs out of elements -
zipFunction(TriFunction<? super T, ? super T2, ? super T3, ? extends R>) — a TriFunction that determines the combination of elements in the combined Stream.
-
- Returns: a new Stream that is the result of combining the current Stream with the given Streams
- See also: N#zip(Iterable, Iterable, Iterable, Object, Object, Object, TriFunction)
saveEach(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(File output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified file.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
output(File) — the file to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(File), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T, String> toLine, File output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified file, using the provided function to convert elements to strings.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(File) — the file to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(Function, File), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T, String> toLine, OutputStream output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified output stream, using the provided function to convert elements to strings.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(OutputStream) — the output stream to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(Function, OutputStream), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T, String> toLine, Writer output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified writer, using the provided function to convert elements to strings.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(Writer) — the writer to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(Function, Writer), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final Throwables.BiConsumer<? super T, Writer, IOException> write, final File output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified file using the provided function to write each element.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the file. The line separator is automatically added after each write. -
output(File) — the file to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(Throwables.BiConsumer, File), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final Throwables.BiConsumer<? super T, Writer, IOException> write, final Writer output) throws IllegalStateException, UncheckedIOException - Summary: Writes each element of this stream as a separate line to the specified writer using the provided function to write each element.
-
Contract:
- The actual writing occurs when a terminal operation is invoked on the returned stream.
-
Parameters:
-
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the writer. -
output(Writer) — the writer to save each element to.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedIOException— may be thrown in the terminal operation if an I/O error occurs
-
- See also: #persist(Throwables.BiConsumer, Writer), N#stringOf(Object), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final PreparedStatement stmt, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided prepared statement and statement setter.
-
Parameters:
-
stmt(PreparedStatement) — the prepared statement used to save each element. -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(PreparedStatement, int, long, Throwables.BiConsumer), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final PreparedStatement stmt, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided prepared statement and statement setter with batch processing.
-
Parameters:
-
stmt(PreparedStatement) — the prepared statement used to save each element. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(PreparedStatement, int, long, Throwables.BiConsumer), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final Connection conn, final String insertSQL, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided connection, insert SQL and statement setter.
-
Parameters:
-
conn(Connection) — the connection used to save each element. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(Connection, String, int, long, Throwables.BiConsumer), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final Connection conn, final String insertSQL, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided connection, insert SQL and statement setter with batch processing.
-
Parameters:
-
conn(Connection) — the connection used to save each element. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(Connection, String, int, long, Throwables.BiConsumer), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final javax.sql.DataSource ds, final String insertSQL, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided data source and SQL insert statement.
-
Parameters:
-
ds(javax.sql.DataSource) — the data source used to save each element. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(javax.sql.DataSource, String, int, long, Throwables.BiConsumer), #onEach(Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(final javax.sql.DataSource ds, final String insertSQL, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws IllegalStateException, UncheckedSQLException - Summary: Saves each element of this stream to the database using the provided data source and SQL insert statement with batch processing.
-
Parameters:
-
ds(javax.sql.DataSource) — the data source used to save each element. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: this stream for further chaining
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
com.landawn.abacus.exception.UncheckedSQLException— may be thrown in the terminal operation if an SQL error happens
-
- See also: #persist(javax.sql.DataSource, String, int, long, Throwables.BiConsumer), #onEach(Consumer)
persist(...) -> long
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file.
-
Parameters:
-
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(String header, String tail, File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file with a header and tail.
-
Parameters:
-
header(String) — the header line to be written at the beginning of the file. Can be {@code null} . -
tail(String) — the tail line to be written at the end of the file. Can be {@code null} . -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(Function<? super T, String> toLine, File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file using the provided function to convert elements to strings.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(String header, String tail, Function<? super T, String> toLine, File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file with a header and tail using the provided function to convert elements to strings.
-
Parameters:
-
header(String) — the header line to be written at the beginning of the file. Can be {@code null} . -
tail(String) — the tail line to be written at the end of the file. Can be {@code null} . -
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(Function<? super T, String> toLine, OutputStream output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified output stream using the provided function to convert elements to strings.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(OutputStream) — the output stream to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(String header, String tail, Function<? super T, String> toLine, OutputStream output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified output stream with a header and tail using the provided function to convert elements to strings.
-
Parameters:
-
header(String) — the header line to be written at the beginning. Can be {@code null} . -
tail(String) — the tail line to be written at the end. Can be {@code null} . -
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(OutputStream) — the output stream to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(Function<? super T, String> toLine, Writer output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified writer using the provided function to convert elements to strings.
-
Parameters:
-
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(String header, String tail, Function<? super T, String> toLine, Writer output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified writer with a header and tail using the provided function to convert elements to strings.
-
Parameters:
-
header(String) — the header line to be written at the beginning. Can be {@code null} . -
tail(String) — the tail line to be written at the end. Can be {@code null} . -
toLine(Function<? super T, String>) — the function to convert each element to a string. -
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: N#stringOf(Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final Throwables.BiConsumer<? super T, Writer, IOException> write, final File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file using the provided function to write each element.
-
Parameters:
-
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the file. The line separator is automatically added after each write. -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final String header, final String tail, final Throwables.BiConsumer<? super T, Writer, IOException> write, final File output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified file with a header and tail using the provided function to write each element.
-
Parameters:
-
header(String) — the header line to be written at the beginning. Can be {@code null} . -
tail(String) — the tail line to be written at the end. Can be {@code null} . -
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the file. The line separator is automatically added after each write. -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final Throwables.BiConsumer<? super T, Writer, IOException> write, final Writer output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified writer using the provided function to write each element.
-
Parameters:
-
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the writer. The line separator is automatically added after each write. -
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final String header, final String tail, final Throwables.BiConsumer<? super T, Writer, IOException> write, final Writer output) throws IOException - Summary: Saves each element of this stream as a separate line to the specified writer with a header and tail using the provided function to write each element.
-
Parameters:
-
header(String) — the header line to be written at the beginning. Can be {@code null} . -
tail(String) — the tail line to be written at the end. Can be {@code null} . -
write(Throwables.BiConsumer<? super T, Writer, IOException>) — the function to write each element as a separate line to the writer. The line separator is automatically added after each write. -
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted (excluding header and tail)
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final PreparedStatement stmt, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws SQLException - Summary: Persists the stream to the database using the provided prepared statement and statement setter with batch processing.
-
Contract:
- The prepared statement should be ready for execution.
- Batch updates are used if batchSize > = 2.
-
Parameters:
-
stmt(PreparedStatement) — the prepared statement used to persist the stream. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: the number of elements persisted
-
Throws:
-
java.sql.SQLException— if an SQL error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final Connection conn, final String insertSQL, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws SQLException - Summary: Persists the stream to the database using the provided connection, insert SQL and statement setter with batch processing.
-
Contract:
- Batch updates are used if batchSize > = 2.
-
Parameters:
-
conn(Connection) — the connection used to persist the stream. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: the number of elements persisted
-
Throws:
-
java.sql.SQLException— if an SQL error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persist(final javax.sql.DataSource ds, final String insertSQL, final int batchSize, final long batchIntervalInMillis, final Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) throws SQLException - Summary: Persists the stream to the database using the provided data source, SQL insert statement and statement setter with batch processing.
-
Contract:
- Batch updates are used if batchSize > = 2.
-
Parameters:
-
ds(javax.sql.DataSource) — the data source used to persist the stream. -
insertSQL(String) — the SQL insert script used to prepare the statement. -
batchSize(int) — the number of elements to include in each batch. If less than 2, batch update won't be used. -
batchIntervalInMillis(long) — the interval in milliseconds between each batch -
stmtSetter(Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException>) — the function to set each element to the prepared statement.
-
- Returns: the number of elements persisted
-
Throws:
-
java.sql.SQLException— if an SQL error occurs
-
persistToCsv(...) -> long
-
Signature:
@Beta @SequentialOnly @TerminalOp public abstract long persistToCsv(File output) throws IOException - Summary: Persists the stream to a CSV file.
-
Contract:
- <p> The first element is used to determine field names: if it's an array or list, those values become headers; if it's a bean or map, the property/key names become headers.
-
Parameters:
-
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToCsv(Collection<String> csvHeaders, File output) throws IOException - Summary: Persists the stream to a CSV file with the specified headers.
-
Parameters:
-
csvHeaders(Collection<String>) — the headers to be used for the CSV file. -
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
@Beta @SequentialOnly @TerminalOp public abstract long persistToCsv(OutputStream output) throws IOException - Summary: Persists the stream to a CSV format output stream.
-
Contract:
- <p> The first element is used to determine field names: if it's an array or list, those values become headers; if it's a bean or map, the property/key names become headers.
-
Parameters:
-
output(OutputStream) — the output stream to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToCsv(Collection<String> csvHeaders, OutputStream output) throws IOException - Summary: Persists the stream to a CSV format output stream with the specified headers.
-
Parameters:
-
csvHeaders(Collection<String>) — the headers to be used for the CSV file. -
output(OutputStream) — the output stream to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
@Beta @SequentialOnly @TerminalOp public abstract long persistToCsv(Writer output) throws IOException - Summary: Persists the stream to a CSV format writer.
-
Contract:
- <p> The first element is used to determine field names: if it's an array or list, those values become headers; if it's a bean or map, the property/key names become headers.
-
Parameters:
-
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToCsv(Collection<String> csvHeaders, Writer output) throws IOException - Summary: Persists the stream with CSV format to the specified writer with the specified headers.
-
Parameters:
-
csvHeaders(Collection<String>) — the headers to be used for the CSV file. -
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
- See also: CsvUtil#setHeaderParser(Function), CsvUtil#setLineParser(BiConsumer), CsvUtil#setEscapeCharToBackSlashForWrite(), CsvUtil#resetEscapeCharForWrite(), CsvUtil#writeField(BufferedCsvWriter, com.landawn.abacus.type.Type, Object)
persistToJson(...) -> long
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToJson(File output) throws IOException - Summary: Persists the stream with JSON format to the specified file.
-
Parameters:
-
output(File) — the file to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToJson(OutputStream output) throws IOException - Summary: Persists the stream with JSON format to the specified output stream.
-
Parameters:
-
output(OutputStream) — the output stream to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
-
Signature:
@SequentialOnly @TerminalOp public abstract long persistToJson(Writer output) throws IOException - Summary: Persists the stream with JSON format to the specified writer.
-
Parameters:
-
output(Writer) — the writer to persist the stream to.
-
- Returns: the number of elements persisted
-
Throws:
-
java.io.IOException— if an I/O error occurs
-
toJdkStream(...) -> java.util.stream.Stream<T>
-
Signature:
@SequentialOnly @IntermediateOp public abstract java.util.stream.Stream<T> toJdkStream() - Summary: Converts this Stream to a JDK Stream.
-
Contract:
- <p> This operation is useful when you need to integrate with APIs that expect JDK streams or when you want to use JDK stream operations not available in this Stream implementation.
-
Parameters:
- (none)
- Returns: a java.util.stream.Stream containing the elements of this Stream
- See also: #transformB(Function), #transformB(Function, boolean)
transformB(...) -> Stream<U>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <U> Stream<U> transformB(final Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends U>> transfer) throws IllegalArgumentException - Summary: Transforms the current Stream into another Stream by applying the provided function.
-
Parameters:
-
transfer(Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends U>>) — the function to be applied on the current stream to produce a new stream.
-
- Returns: a new Stream transformed by the provided function
-
Throws:
-
java.lang.IllegalArgumentException— if the provided function is {@code null}
-
- See also: #toJdkStream()
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <U> Stream<U> transformB(final Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends U>> transfer, final boolean deferred) throws IllegalStateException, IllegalArgumentException - Summary: Transforms the current Stream into another Stream by applying the provided function.
-
Contract:
- The transformation can be deferred, which means it will be performed when the stream is consumed.
- <p> When deferred is {@code true} , the transformation is lazy and will only be executed when terminal operations are called.
- When {@code false} , the transformation is applied immediately.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Deferred transformation Stream<String> result = Stream.of("hello", "world") .transformB(jdkStream -> jdkStream .map(String::toUpperCase) .sorted(), true); // Transformation happens when terminal operation is called result.toList(); // Returns \["HELLO", "WORLD"\] } </pre>
-
Parameters:
-
transfer(Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends U>>) — the function to be applied on the current stream to produce a new stream. -
deferred(boolean) — if {@code true} , the transformation is deferred until the stream is consumed
-
- Returns: a new Stream transformed by the provided function
-
Throws:
-
java.lang.IllegalStateException— if the stream has already been operated upon or closed -
java.lang.IllegalArgumentException— if the provided function is {@code null}
-
- See also: #toJdkStream()
sps(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> sps(final int maxThreadNum, final int chunkSize, final Function<? super List<T>, ? extends Stream<? extends R>> op) throws IllegalArgumentException - Summary: Temporarily switches the stream to a parallel stream for the operation {@code op} and then switches back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for the parallel operation. Must be positive. -
chunkSize(int) — the chunk size this stream will be split into for the parallel operation. Must be positive. -
op(Function<? super List<T>, ? extends Stream<? extends R>>) — the operation will take a chunk of elements and return a new Stream executed repeatedly by multiple threads.
-
- Returns: a new Stream transformed by the provided function
-
Throws:
-
java.lang.IllegalArgumentException— if the specified maxThreadNum or chunkSize is equal to or less than 0
-
spsFilter(...) -> Stream<T>
-
Signature:
@Beta @IntermediateOp public Stream<T> spsFilter(final Predicate<? super T> predicate) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code filter} and then switches it back to a sequential stream.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to be used for the filter operation on the stream.
-
- Returns: a new Stream that has been filtered in parallel using the provided predicate
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsFilter(final int maxThreadNum, final Predicate<? super T> predicate) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code filter} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
predicate(Predicate<? super T>) — the predicate to apply to each element to determine if it should be included.
-
- Returns: a new Stream with the specified filter applied in parallel
- See also: #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsFilter(final int maxThreadNum, final int chunkSize, final Predicate<? super T> predicate) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code filter} and then switches back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
chunkSize(int) — the size of chunks to split the stream into for parallel processing. Must be positive. -
predicate(Predicate<? super T>) — the predicate to be used for the filter operation on the stream.
-
- Returns: a new Stream that has been filtered in parallel using the provided predicate
- See also: #sps(int, int, Function)
spsMap(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsMap(final Function<? super T, ? extends R> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code map} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Function<? super T, ? extends R>) — the mapping function to apply to each element.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsMap(final int maxThreadNum, final Function<? super T, ? extends R> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code map} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Function<? super T, ? extends R>) — the mapping function to apply to each element.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsMap(final int maxThreadNum, final int chunkSize, final Function<? super T, ? extends R> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code map} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
chunkSize(int) — the size of chunks to split the stream into for parallel processing. Must be positive. -
mapper(Function<? super T, ? extends R>) — the function to be applied to each element of the stream.
-
- Returns: a new Stream that has been mapped in parallel using the provided mapper function
- See also: #sps(int, int, Function)
spsFlatMap(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatMap(final Function<? super T, ? extends Stream<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Function<? super T, ? extends Stream<? extends R>>) — the mapping function to apply to each element, which produces a stream of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatMap(final int maxThreadNum, final Function<? super T, ? extends Stream<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Function<? super T, ? extends Stream<? extends R>>) — the mapping function to apply to each element, which produces a stream of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatMap(final int maxThreadNum, final int chunkSize, final Function<? super T, ? extends Stream<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
chunkSize(int) — the size of chunks to split the stream into for parallel processing. Must be positive. -
mapper(Function<? super T, ? extends Stream<? extends R>>) — the function to be applied to each element of the stream.
-
- Returns: a new Stream that has been flat-mapped in parallel using the provided mapper function
- See also: #sps(int, int, Function)
spsFlatmap(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatmap(final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatmap} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Function<? super T, ? extends Collection<? extends R>>) — the mapping function to apply to each element, which produces a collection of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatmap(final int maxThreadNum, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatmap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the mapping function to apply to each element, which produces a collection of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatmap(final int maxThreadNum, final int chunkSize, final Function<? super T, ? extends Collection<? extends R>> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
chunkSize(int) — the size of chunks to split the stream into for parallel processing. Must be positive. -
mapper(Function<? super T, ? extends Collection<? extends R>>) — the function to be applied to each element of the stream.
-
- Returns: a new Stream that has been flat-mapped in parallel using the provided mapper function
- See also: #sps(int, int, Function)
spsOnEach(...) -> Stream<T>
-
Signature:
@Beta @IntermediateOp public Stream<T> spsOnEach(final Consumer<? super T> action) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code onEach} and then switches it back to a sequential stream.
-
Parameters:
-
action(Consumer<? super T>) — the action to be performed on each element of the stream.
-
- Returns: a new Stream with the specified action applied in parallel
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsOnEach(final int maxThreadNum, final Consumer<? super T> action) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code onEach} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
action(Consumer<? super T>) — the action to be performed on each element of the stream.
-
- Returns: a new Stream with the specified action applied in parallel
- See also: #sps(int, Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsOnEach(final int maxThreadNum, final int chunkSize, final Consumer<? super T> action) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code onEach} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
chunkSize(int) — the size of chunks to split the stream into for parallel processing. Must be positive. -
action(Consumer<? super T>) — the action to be performed on each element of the stream.
-
- Returns: a new Stream with the specified action applied in parallel
- See also: #sps(int, int, Function)
spsFilterE(...) -> Stream<T>
-
Signature:
@Beta @IntermediateOp public Stream<T> spsFilterE(final Throwables.Predicate<? super T, ? extends Exception> predicate) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code filter} and then switches it back to a sequential stream.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends Exception>) — the predicate to be used for the filter operation on the stream.
-
- Returns: a new Stream that has been filtered in parallel using the provided predicate
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsFilterE(final int maxThreadNum, final Throwables.Predicate<? super T, ? extends Exception> predicate) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code filter} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
predicate(Throwables.Predicate<? super T, ? extends Exception>) — the predicate to be used for the filter operation on the stream.
-
- Returns: a new Stream that has been filtered in parallel using the provided predicate
- See also: #sps(int, Function)
spsMapE(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsMapE(final Throwables.Function<? super T, ? extends R, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code map} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the mapping function to apply to each element.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsMapE(final int maxThreadNum, final Throwables.Function<? super T, ? extends R, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code map} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Throwables.Function<? super T, ? extends R, ? extends Exception>) — the mapping function to apply to each element.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
spsFlatMapE(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatMapE(final Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception>) — the mapping function to apply to each element, which produces a stream of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatMapE(final int maxThreadNum, final Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception>) — the mapping function to apply to each element, which produces a stream of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
spsFlatmapE(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatmapE(final Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception>) — the mapping function to apply to each element, which produces a collection of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> spsFlatmapE(final int maxThreadNum, final Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code flatMap} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
mapper(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception>) — the mapping function to apply to each element, which produces a collection of new values.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: #sps(int, Function)
spsOnEachE(...) -> Stream<T>
-
Signature:
@Beta @IntermediateOp public Stream<T> spsOnEachE(final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code onEach} and then switches it back to a sequential stream.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends Exception>) — the action to be performed on each element of the stream.
-
- Returns: a new Stream with the specified action applied in parallel
- See also: #sps(Function)
-
Signature:
@Beta @IntermediateOp public Stream<T> spsOnEachE(final int maxThreadNum, final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Temporarily switches the stream to a parallel stream for the operation {@code onEach} and then switches it back to a sequential stream.
-
Parameters:
-
maxThreadNum(int) — the maximum number of threads to be used for parallel execution. Must be positive. -
action(Throwables.Consumer<? super T, ? extends Exception>) — the action to be performed on each element of the stream.
-
- Returns: a new Stream with the specified action applied in parallel
- See also: #sps(int, Function)
sjps(...) -> Stream<R>
-
Signature:
@Beta @IntermediateOp public <R> Stream<R> sjps(final Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends R>> op) - Summary: Temporarily switches the stream to a JDK parallel stream for the operation {@code op} and then switches it back to a sequential stream.
-
Parameters:
-
op(Function<? super java.util.stream.Stream<T>, ? extends java.util.stream.Stream<? extends R>>) — the function to be applied to the JDK parallel stream.
-
- Returns: a new Stream with the specified operation applied in parallel
filterE(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public Stream<T> filterE(final Throwables.Predicate<? super T, ? extends Exception> predicate) - Summary: Filters the elements of this stream using the provided predicate that can throw exceptions.
-
Contract:
- The operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
predicate(Throwables.Predicate<? super T, ? extends Exception>) — the predicate to apply to each element to determine if it should be included.
-
- Returns: a new stream that contains only the elements that match the predicate
- See also: Fn#pp(Throwables.Predicate)
mapE(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public <R> Stream<R> mapE(final Throwables.Function<? super T, ? extends R, ? extends Exception> mapper) - Summary: Transforms the elements in the stream by applying a function that can throw exceptions to each element.
-
Contract:
- The operation can be parallelized if the stream supports parallel processing.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends R, ? extends Exception>) — a non-interfering, stateless function that transforms each element
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream
- See also: Fn#ff(Throwables.Function)
flatMapE(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flatMapE(final Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) - Summary: Transforms the elements in the stream by applying a function that returns a stream to each element, and then flattens the resulting streams into a single stream.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception>) — the function to be applied to each element in the stream, which returns a stream. Can throw checked exceptions.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream, and then flattening the resulting streams
- See also: #flatMap(Function), Fn#ff(Throwables.Function)
flatmapE(...) -> Stream<R>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flatmapE(final Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) - Summary: Transforms the elements in the stream by applying a function that returns a collection to each element, and then flattens the resulting collections into a single stream.
-
Parameters:
-
mapper(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception>) — the function to be applied to each element in the stream, which returns a collection. Can throw checked exceptions.
-
- Returns: a new Stream consisting of the results of applying the given function to the elements of this stream, and then flattening the resulting collections
- See also: #flatmap(Function), Fn#ff(Throwables.Function)
onEachE(...) -> Stream<T>
-
Signature:
@Beta @ParallelSupported @IntermediateOp public Stream<T> onEachE(final Throwables.Consumer<? super T, ? extends Exception> action) - Summary: Performs the provided action for each element of the Stream.
-
Parameters:
-
action(Throwables.Consumer<? super T, ? extends Exception>) — the action to be performed for each element, which can throw an exception
-
- Returns: a new Stream with the same elements, with the action applied to each element as it passes through
- See also: #onEach(Consumer), Fn#cc(Throwables.Consumer)
crossJoin(...) -> Stream<Pair<T, U>>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U> Stream<Pair<T, U>> crossJoin(Collection<? extends U> b) - Summary: Performs a cross join (Cartesian product) with the specified collection.
-
Contract:
- This is a sequential-only intermediate operation that must be used with caution on large datasets due to its quadratic nature.
-
Parameters:
-
b(Collection<? extends U>) — the collection to cross join with; must not be null
-
- Returns: a new Stream of Pairs containing all combinations of elements from this stream and the collection
- See also: #crossJoin(Collection, BiFunction),for direct transformation of pairs, #innerJoin(Collection, Function, Function),for key-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U, R> Stream<R> crossJoin(Collection<? extends U> b, BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a cross join (Cartesian product) with the specified collection and applies a transformation function.
-
Contract:
- <p> This variant is preferred when you need to transform the paired elements immediately, as it avoids creating intermediate Pair objects and allows for direct construction of result objects or computations.
-
Parameters:
-
b(Collection<? extends U>) — the collection to cross join with; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to each pair of elements; must not be null
-
- Returns: a new Stream containing the results of applying the function to all combinations
- Performance: Time complexity is O(n * m) where {@code n} is the size of this stream and {@code m} is the size of the collection.
- See also: #crossJoin(Collection),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@SequentialOnly @IntermediateOp public abstract <U, R> Stream<R> crossJoin(Stream<? extends U> b, BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a cross join (Cartesian product) with another stream and applies a transformation function.
-
Contract:
- If the second stream is too large to fit in memory, consider reversing the operation using {@code b.crossJoin(this.toList(), func)} if this stream is smaller, or use a collection-based approach with appropriate batching.
-
Parameters:
-
b(Stream<? extends U>) — the stream to cross join with; will be loaded into memory and closed automatically; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to each pair of elements; must not be null
-
- Returns: a new Stream containing the results of applying the function to all combinations
- Performance: Time complexity is O(n * m) where {@code n} is the size of this stream and {@code m} is the size of the second stream.
- See also: #crossJoin(Collection, BiFunction),for collection-based cross join, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
innerJoin(...) -> Stream<Pair<T, U>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, U>> innerJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor) - Summary: Performs an inner join between this stream and the specified collection based on matching keys.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing, making it suitable for large-scale data processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null
-
- Returns: a new Stream of Pair objects containing matched elements from both sources
- Performance: Uses hash-based lookup for {@code O(n + m)} time complexity.
- See also: #innerJoin(Collection, Function, Function, BiFunction),for direct transformation of matched pairs, #leftJoin(Collection, Function, Function),for including all left elements, #fullJoin(Collection, Function, Function),for including all elements from both sources, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> innerJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs an inner join between this stream and the specified collection with result transformation.
-
Contract:
- <p> This variant is preferred when you need to transform matched pairs directly into result objects, avoiding intermediate Pair objects for better performance and cleaner code.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to matched pairs to produce result elements; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to matched pairs
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #innerJoin(Collection, Function, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K> Stream<Pair<T, T>> innerJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper) - Summary: Performs an inner join between this stream and a collection of the same type using a common key extractor.
-
Contract:
- This simplified method is useful when joining homogeneous collections where both sources contain the same type of elements and use the same key extraction logic.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null
-
- Returns: a new Stream of Pair objects containing matched elements from both sources
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #innerJoin(Collection, Function, BiFunction),for transformation of matched pairs, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, R> Stream<R> innerJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, final BiFunction<? super T, ? super T, ? extends R> func) - Summary: Performs an inner join between this stream and a collection of the same type with result transformation.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null -
func(BiFunction<? super T, ? super T, ? extends R>) — the function to apply to matched pairs to produce result elements; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to matched pairs
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #innerJoin(Collection, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> innerJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs an inner join between this stream and another stream with result transformation.
-
Contract:
- If the second stream is too large to fit in memory, consider reversing the join operation using {@code b.innerJoin(this.toList(), ...)} if this stream is smaller.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with; will be loaded into memory and closed automatically; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to matched pairs to produce result elements; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to matched pairs
- Performance: The second stream is loaded into memory for efficient hash-based lookup, providing {@code O(n + m)} performance.
- See also: #innerJoin(Collection, Function, Function, BiFunction),for collection-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T, U>> innerJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate) - Summary: Performs an inner join between this stream and the specified collection based on a predicate condition.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements; must not be null
-
- Returns: a new Stream of Pair objects containing matched elements from both sources
- Performance: <p> Use this method only when: <ul> <li> The join condition is complex and cannot be expressed as simple key equality </li> <li> You need range-based joins or inequality conditions </li> <li> The datasets are small enough that O(n * m) performance is acceptable </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code List<User> users = Arrays.asList(new User(1, "John"), new User(2, "Jane")); List<Order> orders = Arrays.asList(new Order(1, 100), new Order(2, 200)); Stream.of(users) .innerJoin(orders, (user, order) -> user.getId() == order.getUserId()) .forEach(pair -> System.out.println(pair.left + " - " + pair.right)); // Range-based join timeRanges.stream() .innerJoin(events, (range, event) -> event.getTime() >= range.getStart() && event.getTime() <= range.getEnd()) .map(pair -> new RangeEvent(pair.left, pair.right)) .collect(Collectors.toList()); } </pre>
- See also: #innerJoin(Collection, Function, Function),for efficient key-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U, R> Stream<R> innerJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs an inner join based on a predicate condition with result transformation.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to matched pairs to produce result elements; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to matched pairs
- Performance: <p> This method is appropriate for: <ul> <li> Complex join conditions involving multiple fields or computations </li> <li> Range-based or inequality joins that cannot use hash lookup </li> <li> Small datasets where O(n * m) performance is acceptable </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code List<User> users = Arrays.asList(new User(1, "John"), new User(2, "Jane")); List<Order> orders = Arrays.asList(new Order(1, 100), new Order(2, 200)); Stream.of(users) .innerJoin(orders, (user, order) -> user.getId() == order.getUserId(), (user, order) -> user.getName() + ": $" + order.getAmount()) .forEach(System.out::println); // Complex join with multiple conditions products.stream() .innerJoin(promotions, (product, promo) -> product.getCategory().equals(promo.getCategory()) && product.getPrice() >= promo.getMinPrice() && product.getPrice() <= promo.getMaxPrice(), (product, promo) -> new DiscountedProduct(product, promo.getDiscount())) .collect(Collectors.toList()); } </pre>
- See also: #innerJoin(Collection, Function, Function, BiFunction),for efficient key-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
fullJoin(...) -> Stream<Pair<T, U>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, U>> fullJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor) - Summary: Performs a full outer join between this stream and the specified collection based on matching keys.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null
-
- Returns: a new Stream of Pair objects containing all elements from both sources, with {@code null} for unmatched elements
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function, Function, BiFunction),for transformation of joined results, #innerJoin(Collection, Function, Function),for matching elements only, #leftJoin(Collection, Function, Function),for all left elements with optional right matches, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> fullJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a full outer join with result transformation.
-
Contract:
- The function must handle {@code null} values for unmatched elements.
- <p> The transformation function receives {@code null} for unmatched elements: <ul> <li> When a left element has no matching right element, the function receives (leftElement, null) </li> <li> When a right element has no matching left element, the function receives (null, rightElement) </li> <li> When elements match, the function receives both {@code non-null} elements </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code List<User> users = Arrays.asList(new User(1, "John"), new User(2, "Jane")); List<Order> orders = Arrays.asList(new Order(2, 200), new Order(3, 300)); Stream.of(users) .fullJoin(orders, User::getId, Order::getUserId, (user, order) -> (user != null ?
- order.getAmount() : 0)) .forEach(System.out::println); // Prints: John: $0, Jane: $200, Unknown: $300 // Data synchronization report sourceData.stream() .fullJoin(targetData, Record::getId, Record::getId, (source, target) -> { if (source == null) return new SyncStatus("MISSING_IN_SOURCE", target); if (target == null) return new SyncStatus("MISSING_IN_TARGET", source); return new SyncStatus("PRESENT", source, target); }) .collect(Collectors.groupingBy(SyncStatus::getStatus)); } </pre>
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs; must handle {@code null} values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all pairs
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K> Stream<Pair<T, T>> fullJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper) - Summary: Performs a full outer join between this stream and a collection of the same type using a common key extractor.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code List<Person> employees = Arrays.asList(new Person(1, "John"), new Person(2, "Jane")); List<Person> managers = Arrays.asList(new Person(2, "Jane"), new Person(3, "Bob")); Stream.of(employees) .fullJoin(managers, Person::getId) .forEach(pair -> System.out.println(pair.left + " - " + pair.right)); // Includes all persons from both lists // Find differences between two snapshots yesterdayData.stream() .fullJoin(todayData, Record::getId) .map(pair -> { if (pair.left == null) return new Change("ADDED", pair.right); if (pair.right == null) return new Change("REMOVED", pair.left); return new Change("UNCHANGED", pair.left); }) .collect(Collectors.toList()); } </pre>
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null
-
- Returns: a new Stream of Pair objects containing all elements from both sources, with {@code null} for unmatched elements
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function, BiFunction),for transformation of matched pairs, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, R> Stream<R> fullJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, final BiFunction<? super T, ? super T, ? extends R> func) - Summary: Performs a full outer join between this stream and a collection of the same type with result transformation.
-
Contract:
- This operation includes all elements from both sources and applies a transformation function that must handle {@code null} values for unmatched elements.
- mgr.getName() : "N/A")) .forEach(System.out::println); // Generate detailed comparison report baseline.stream() .fullJoin(current, Config::getKey, (base, curr) -> { if (base == null) return "Added: " + curr; if (curr == null) return "Removed: " + base; if (!base.equals(curr)) return "Modified: " + base + " -> " + curr; return "Unchanged: " + base; }) .filter(status -> !status.startsWith("Unchanged")) .collect(Collectors.toList()); } </pre>
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null -
func(BiFunction<? super T, ? super T, ? extends R>) — the function to apply to pairs; must handle {@code null} values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all pairs
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> fullJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a full outer join between this stream and another stream with result transformation.
-
Contract:
- If it's too large, consider using {@code b.fullJoin(this.toList(), ...)} if this stream is smaller.
- The transformation function must handle {@code null} values for unmatched elements from either stream.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with; will be loaded into memory and closed automatically; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs; must handle {@code null} values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all pairs
- Performance: The second stream is loaded into memory for efficient hash-based lookup, providing {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function, Function, BiFunction),for collection-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T, U>> fullJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate) - Summary: Performs a full outer join based on a predicate condition.
-
Contract:
- The predicate must handle {@code null} values since unmatched elements will be paired with {@code null} .
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs; must handle {@code null} values; must not be null
-
- Returns: a new Stream of Pair objects containing all elements from both sources
- Performance: <p> Use this method only when: <ul> <li> The join condition cannot be expressed as simple key equality </li> <li> You need complex matching logic that requires examining multiple fields </li> <li> The datasets are small enough that O(n * m) performance is acceptable </li> </ul> <p> <b> Usage Examples: </b> </p> <pre> {@code List<User> users = Arrays.asList(new User(1, "John"), new User(2, "Jane")); List<Order> orders = Arrays.asList(new Order(2, 200), new Order(3, 300)); Stream.of(users) .fullJoin(orders, (user, order) -> user != null && order != null && user.getId() == order.getUserId()) .forEach(pair -> System.out.println(pair.left + " - " + pair.right)); // Complex condition with null handling dataset1.stream() .fullJoin(dataset2, (item1, item2) -> item1 != null && item2 != null && item1.getCategory().equals(item2.getCategory()) && Math.abs(item1.getValue() - item2.getValue()) < 0.01) .collect(Collectors.toList()); } </pre>
- See also: #fullJoin(Collection, Function, Function),for efficient key-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U, R> Stream<R> fullJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a full outer join based on a predicate with result transformation.
-
Contract:
- The predicate and transformation function must handle {@code null} values.
- Both the predicate and transformation function must handle {@code null} values for unmatched elements.
- order.getAmount() : 0)) .forEach(System.out::println); // Range-based full join with transformation ranges.stream() .fullJoin(values, (range, value) -> value != null && range != null && value.getAmount() >= range.getMin() && value.getAmount() <= range.getMax(), (range, value) -> { if (range == null) return "Unmatched value: " + value; if (value == null) return "Empty range: " + range; return "Match: " + range + " contains " + value; }) .collect(Collectors.toList()); } </pre>
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs; must handle {@code null} values; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs; must handle {@code null} values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all pairs
- Performance: For large datasets with simple equality conditions, use {@link #fullJoin(Collection, Function, Function, BiFunction)} for {@code O(n + m)} performance.
- See also: #fullJoin(Collection, Function, Function, BiFunction),for efficient key-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
leftJoin(...) -> Stream<Pair<T, U>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, U>> leftJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor) - Summary: Performs a left outer join between this stream and the specified collection based on matching keys.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null
-
- Returns: a new Stream of Pair objects containing all elements from this stream, with {@code null} for unmatched right elements
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #leftJoin(Collection, Function, Function, BiFunction),for transformation of joined results, #innerJoin(Collection, Function, Function),for matching elements only, #fullJoin(Collection, Function, Function),for all elements from both sources, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> leftJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a left outer join with result transformation.
-
Contract:
- The function receives {@code null} for the right parameter when no match is found in the collection.
- The transformation function must handle {@code null} values for the right parameter to process unmatched elements appropriately.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs; must handle {@code null} right values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all left elements with their matches
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #leftJoin(Collection, Function, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K> Stream<Pair<T, T>> leftJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper) - Summary: Performs a left outer join between this stream and a collection of the same type using a common key extractor.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null
-
- Returns: a new Stream of Pair objects containing all elements from this stream, with {@code null} for unmatched right elements
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #leftJoin(Collection, Function, BiFunction),for transformation of matched pairs, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, R> Stream<R> leftJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, final BiFunction<? super T, ? super T, ? extends R> func) - Summary: Performs a left outer join between this stream and a collection of the same type with result transformation.
-
Contract:
- This operation includes all elements from this stream and applies a transformation function that must handle {@code null} values for unmatched right elements.
- <p> This method is ideal for creating reports or transformations where all primary records must be preserved while optionally enriching them with data from a secondary source of the same type.
- mgr.getName() : "Nobody")) .forEach(System.out::println); // Prints: John reports to: John, Jane reports to: Nobody // Create status reports with optional updates baselineData.stream() .leftJoin(updates, Item::getId, (base, update) -> { if (update == null) return base.toString() + " \[No Update\]"; return base.toString() + " \[Updated: " + update.getTimestamp() + "\]"; }) .collect(Collectors.toList()); } </pre>
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with; must not be null -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements; applied to both sources; must not be null -
func(BiFunction<? super T, ? super T, ? extends R>) — the function to apply to pairs; must handle {@code null} right values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all left elements with their matches
- Performance: Uses hash-based lookup for {@code O(n + m)} performance.
- See also: #leftJoin(Collection, Function),for obtaining pairs without transformation, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> leftJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a left outer join between this stream and another stream with result transformation.
-
Contract:
- If it's too large, consider using {@code b.rightJoin(this.toList(), ...)} for the equivalent operation with reversed memory usage.
- The transformation function must handle {@code null} values for unmatched right elements.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with; will be loaded into memory and closed automatically; must not be null -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream; must not be null -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream; must not be null -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs; must handle {@code null} right values; must not be null
-
- Returns: a new Stream consisting of the results of applying the function to all left elements with their matches
- Performance: The second stream is loaded into memory for efficient hash-based lookup, providing {@code O(n + m)} performance.
- See also: #leftJoin(Collection, Function, Function, BiFunction),for collection-based joining, <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T, U>> leftJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate) - Summary: Performs a left outer join between this stream and the specified collection based on a predicate condition.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements. Must handle {@code null} right values.
-
- Returns: a new Stream of Pair objects containing all elements from this stream, with {@code null} for unmatched right elements
- Performance: <p> This operation has time complexity O(n * m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #leftJoin(Collection, Function, Function), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U, R> Stream<R> leftJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a left outer join between this stream and the specified collection based on a predicate, applying a mapping function.
-
Contract:
- The mapping function will receive {@code null} for the right parameter when no match is found.
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements. Must handle {@code null} right values. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs to produce result elements. Must handle {@code null} right values.
-
- Returns: a new Stream consisting of the results of applying the function to all left elements with their matches
- Performance: <p> This operation has time complexity O(n * m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #leftJoin(Collection, Function, Function, BiFunction), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
rightJoin(...) -> Stream<Pair<T, U>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, U>> rightJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor) - Summary: Performs a right outer join between this stream and the specified collection based on matching keys.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection.
-
- Returns: a new Stream of Pair objects containing all elements from the collection, with {@code null} for unmatched left elements
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function, Function, BiFunction), #leftJoin(Collection, Function, Function), #fullJoin(Collection, Function, Function), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> rightJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a right outer join between this stream and the specified collection, applying a mapping function.
-
Contract:
- The mapping function will receive {@code null} for the left parameter when no match is found.
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs to produce result elements. Must handle {@code null} left values.
-
- Returns: a new Stream consisting of the results of applying the function to all right elements with their matches
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function, Function), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K> Stream<Pair<T, T>> rightJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper) - Summary: Performs a right outer join between this stream and the specified collection of the same type based on a common key.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements.
-
- Returns: a new Stream of Pair objects containing all elements from the collection, with {@code null} for unmatched left elements
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function, BiFunction), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, R> Stream<R> rightJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, final BiFunction<? super T, ? super T, ? extends R> func) - Summary: Performs a right outer join between this stream and the specified collection of the same type, applying a mapping function.
-
Contract:
- The mapping function will receive {@code null} for the left parameter when no match is found.
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements. -
func(BiFunction<? super T, ? super T, ? extends R>) — the function to apply to pairs to produce result elements. Must handle {@code null} left values.
-
- Returns: a new Stream consisting of the results of applying the function to all right elements with their matches
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> rightJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a right outer join between this stream and another stream, applying a mapping function.
-
Contract:
- If the second stream is too large to fit in memory, consider using {@code b.rightJoin(this, ...)} instead.
- The mapping function will receive {@code null} for the left parameter when no match is found.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with. Will be loaded to memory and closed along with this stream. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs to produce result elements. Must handle {@code null} left values.
-
- Returns: a new Stream consisting of the results of applying the function to all right elements with their matches
- Performance: <p> This operation loads the second stream into memory for efficient hash-based lookup with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the second stream.
- See also: #rightJoin(Collection, Function, Function, BiFunction), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T, U>> rightJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate) - Summary: Performs a right outer join between this stream and the specified collection based on a predicate condition.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements. Must handle {@code null} left values.
-
- Returns: a new Stream of Pair objects containing all elements from the collection, with {@code null} for unmatched left elements
- Performance: <p> This operation has time complexity O(n * m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function, Function), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
-
Signature:
@Deprecated @ParallelSupported @IntermediateOp public abstract <U, R> Stream<R> rightJoin(Collection<? extends U> b, BiPredicate<? super T, ? super U> predicate, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a right outer join between this stream and the specified collection based on a predicate, applying a mapping function.
-
Contract:
- The mapping function will receive {@code null} for the left parameter when no match is found.
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test pairs of elements. Must handle {@code null} left values. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to pairs to produce result elements. Must handle {@code null} left values.
-
- Returns: a new Stream consisting of the results of applying the function to all right elements with their matches
- Performance: <p> This operation has time complexity O(n * m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #rightJoin(Collection, Function, Function, BiFunction), <a href="https://stackoverflow.com/questions/38549">,What is the difference between "INNER JOIN" and "OUTER JOIN",</a>
groupJoin(...) -> Stream<Pair<T, List<U>>>
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, List<U>>> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor) - Summary: Performs a group join between this stream and the specified collection based on matching keys.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection.
-
- Returns: a new Stream of Pair objects containing elements from this stream paired with lists of matching elements
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super List<U>, ? extends R> func) - Summary: Performs a group join between this stream and the specified collection, applying a mapping function to grouped results.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
func(BiFunction<? super T, ? super List<U>, ? extends R>) — the function to apply to element-list pairs to produce result elements.
-
- Returns: a new Stream consisting of the results of applying the function to grouped pairs
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K> Stream<Pair<T, List<T>>> groupJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper) - Summary: Performs a group join between this stream and the specified collection of the same type based on a common key.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements.
-
- Returns: a new Stream of Pair objects containing elements from this stream paired with lists of matching elements
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, R> Stream<R> groupJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, final BiFunction<? super T, ? super List<T>, ? extends R> func) - Summary: Performs a group join between this stream and the specified collection of the same type, applying a mapping function.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements. -
func(BiFunction<? super T, ? super List<T>, ? extends R>) — the function to apply to element-list pairs to produce result elements.
-
- Returns: a new Stream consisting of the results of applying the function to grouped pairs
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, final BiFunction<? super T, ? super List<U>, ? extends R> func) - Summary: Performs a group join between this stream and another stream, applying a mapping function to grouped results.
-
Contract:
- If the second stream is too large to fit in memory, consider using {@code b.groupJoin(this, ...)} instead.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with. Will be loaded to memory and closed along with this stream. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream. -
func(BiFunction<? super T, ? super List<U>, ? extends R>) — the function to apply to element-list pairs to produce result elements.
-
- Returns: a new Stream consisting of the results of applying the function to grouped pairs
- Performance: <p> This operation loads the second stream into memory for efficient hash-based lookup with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the second stream.
- See also: #groupJoin(Collection, Function, Function, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K> Stream<Pair<T, U>> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, BinaryOperator<U> mergeFunction) - Summary: Performs a group join between this stream and the specified collection, merging grouped elements with a binary operator.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
mergeFunction(BinaryOperator<U>) — binary operator to merge multiple matching elements into one.
-
- Returns: a new Stream of Pair objects containing elements paired with merged matching elements
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function, BinaryOperator, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, BinaryOperator<U> mergeFunction, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a group join between this stream and the specified collection, merging grouped elements and applying a mapping function.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
mergeFunction(BinaryOperator<U>) — binary operator to merge multiple matching elements into one. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to paired elements to produce result elements.
-
- Returns: a new Stream consisting of the results of applying the function to merged pairs
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function, BinaryOperator)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, BinaryOperator<U> mergeFunction, final BiFunction<? super T, ? super U, ? extends R> func) - Summary: Performs a group join between this stream and another stream, merging grouped elements and applying a mapping function.
-
Contract:
- If the second stream is too large to fit in memory, consider using {@code b.groupJoin(this, ...)} instead.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with. Will be loaded to memory and closed along with this stream. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream. -
mergeFunction(BinaryOperator<U>) — binary operator to merge multiple matching elements into one. -
func(BiFunction<? super T, ? super U, ? extends R>) — the function to apply to paired elements to produce result elements.
-
- Returns: a new Stream consisting of the results of applying the function to merged pairs
- Performance: <p> This operation loads the second stream into memory for efficient hash-based lookup with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the second stream.
- See also: #groupJoin(Collection, Function, Function, BinaryOperator, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, D> Stream<Pair<T, D>> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, Collector<? super U, ?, D> downstream) - Summary: Performs a group join between this stream and the specified collection using a collector to aggregate grouped elements.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
downstream(Collector<? super U, ?, D>) — collector to aggregate matching elements.
-
- Returns: a new Stream of Pair objects containing elements paired with collected results
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function, Collector, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, D, R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, Collector<? super U, ?, D> downstream, final BiFunction<? super T, ? super D, ? extends R> func) - Summary: Performs a group join between this stream and the specified collection using a collector and applying a mapping function.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends U>) — the collection to join with. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the collection. -
downstream(Collector<? super U, ?, D>) — collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements.
-
- Returns: a new Stream consisting of the results of applying the function to collected pairs
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, D> Stream<Pair<T, D>> groupJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream) - Summary: Performs a group join between this stream and the specified collection of the same type using a collector.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements. -
downstream(Collector<? super T, ?, D>) — collector to aggregate matching elements.
-
- Returns: a new Stream of Pair objects containing elements paired with collected results
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Collector, BiFunction)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <K, D, R> Stream<R> groupJoin(Collection<? extends T> b, Function<? super T, ? extends K> keyMapper, Collector<? super T, ?, D> downstream, final BiFunction<? super T, ? super D, ? extends R> func) - Summary: Performs a group join between this stream and the specified collection of the same type using a collector and mapping function.
-
Contract:
- The operation is stateless and can be parallelized if the stream supports parallel processing.
-
Parameters:
-
b(Collection<? extends T>) — the collection to join with. -
keyMapper(Function<? super T, ? extends K>) — function to extract keys from elements. -
downstream(Collector<? super T, ?, D>) — collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements.
-
- Returns: a new Stream consisting of the results of applying the function to collected pairs
- Performance: <p> This operation uses hash-based lookup for efficient joining with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the specified collection.
- See also: #groupJoin(Collection, Function, Collector)
-
Signature:
@ParallelSupported @IntermediateOp public abstract <U, K, D, R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T, ? extends K> leftKeyExtractor, Function<? super U, ? extends K> rightKeyExtractor, Collector<? super U, ?, D> downstream, final BiFunction<? super T, ? super D, ? extends R> func) - Summary: Performs a group join between this stream and another stream using a collector and applying a mapping function.
-
Contract:
- If the second stream is too large to fit in memory, consider using {@code b.groupJoin(this, ...)} instead.
-
Parameters:
-
b(Stream<? extends U>) — the stream to join with. Will be loaded to memory and closed along with this stream. -
leftKeyExtractor(Function<? super T, ? extends K>) — function to extract keys from elements of this stream. -
rightKeyExtractor(Function<? super U, ? extends K>) — function to extract keys from elements of the second stream. -
downstream(Collector<? super U, ?, D>) — collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements.
-
- Returns: a new Stream consisting of the results of applying the function to collected pairs
- Performance: <p> This operation loads the second stream into memory for efficient hash-based lookup with time complexity O(n + m), where {@code n} is the size of this stream and {@code m} is the size of the second stream.
- See also: #groupJoin(Collection, Function, Function, Collector, BiFunction)
joinByRange(...) -> Stream<Pair<T, List<U>>>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U> Stream<Pair<T, List<U>>> joinByRange(final Iterator<U> b, final BiPredicate<? super T, ? super U> predicate) - Summary: Performs a range-based join between this stream and an ordered iterator based on a predicate condition.
-
Contract:
- The iterator should be ordered for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Iterator<U>) — the ordered iterator to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined.
-
- Returns: a new Stream of Pair objects containing stream elements paired with lists of matching iterator elements
- See also: #joinByRange(Iterator, BiPredicate, Collector)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, R> Stream<Pair<T, R>> joinByRange(final Iterator<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, R> collector) - Summary: Performs a range-based join between this stream and an ordered iterator using a collector.
-
Contract:
- The iterator should be ordered for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Iterator<U>) — the ordered iterator to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, R>) — the collector to aggregate matching elements.
-
- Returns: a new Stream of Pair objects containing stream elements paired with collected results
- See also: #joinByRange(Iterator, BiPredicate)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, D, R> Stream<R> joinByRange(final Iterator<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, D> collector, BiFunction<? super T, ? super D, ? extends R> func) - Summary: Performs a range-based join between this stream and an ordered iterator, collecting and transforming the results.
-
Contract:
- The iterator should be ordered for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Iterator<U>) — the ordered iterator to join with. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, D>) — the collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements.
-
- Returns: a new Stream consisting of the results of applying the function to collected pairs
- See also: #joinByRange(Iterator, BiPredicate, Collector)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, D, R> Stream<R> joinByRange(final Iterator<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, D> collector, BiFunction<? super T, ? super D, ? extends R> func, Function<Iterator<U>, Stream<R>> mapperForUnJoinedElements) - Summary: Performs a range-based join with handling for unjoined elements from the iterator.
-
Contract:
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Iterator<U>) — the ordered iterator to join with. Will be closed along with this stream. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, D>) — the collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements. -
mapperForUnJoinedElements(Function<Iterator<U>, Stream<R>>) — function to process remaining iterator elements.
-
- Returns: a new Stream consisting of joined results followed by mapped unjoined elements
- See also: #joinByRange(Iterator, BiPredicate, Collector, BiFunction)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U> Stream<Pair<T, List<U>>> joinByRange(final Stream<U> b, final BiPredicate<? super T, ? super U> predicate) - Summary: Performs a range-based join between this stream and another ordered stream based on a predicate condition.
-
Contract:
- The second stream should contain ordered data for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Stream<U>) — the ordered stream to join with. Will be closed along with this stream. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined.
-
- Returns: a new Stream of Pair objects containing stream elements paired with lists of matching elements
- See also: #joinByRange(Stream, BiPredicate, Collector)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, R> Stream<Pair<T, R>> joinByRange(final Stream<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, R> collector) - Summary: Performs a range-based join between this stream and another ordered stream using a collector.
-
Contract:
- The second stream should contain ordered data for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Stream<U>) — the ordered stream to join with. Will be closed along with this stream. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, R>) — the collector to aggregate matching elements.
-
- Returns: a new Stream of Pair objects containing stream elements paired with collected results
- See also: #joinByRange(Stream, BiPredicate)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, D, R> Stream<R> joinByRange(final Stream<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, D> collector, final BiFunction<? super T, ? super D, ? extends R> func) - Summary: Performs a range-based join between this stream and another ordered stream, collecting and transforming results.
-
Contract:
- The second stream should contain ordered data for optimal performance.
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Stream<U>) — the ordered stream to join with. Will be closed along with this stream. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, D>) — the collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements.
-
- Returns: a new Stream consisting of the results of applying the function to collected pairs
- See also: #joinByRange(Stream, BiPredicate, Collector)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public abstract <U, D, R> Stream<R> joinByRange(final Stream<U> b, final BiPredicate<? super T, ? super U> predicate, final Collector<? super U, ?, D> collector, final BiFunction<? super T, ? super D, ? extends R> func, Function<Iterator<U>, Stream<R>> mapperForUnJoinedElements) - Summary: Performs a range-based join with handling for unjoined elements from the second stream.
-
Contract:
- This operation must be used in sequential mode only.
-
Parameters:
-
b(Stream<U>) — the ordered stream to join with. Will be closed along with this stream. -
predicate(BiPredicate<? super T, ? super U>) — the condition to test if elements can be joined. -
collector(Collector<? super U, ?, D>) — the collector to aggregate matching elements. -
func(BiFunction<? super T, ? super D, ? extends R>) — the function to apply to paired results to produce final elements. -
mapperForUnJoinedElements(Function<Iterator<U>, Stream<R>>) — function to process remaining stream elements.
-
- Returns: a new Stream consisting of joined results followed by mapped unjoined elements
- See also: #joinByRange(Stream, BiPredicate, Collector, BiFunction)
maxWait(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> maxWait(final Duration duration, final T defaultValue) throws IllegalArgumentException - Summary: Returns at least one element in every specified interval, or the default value if no element occurs during that interval.
-
Contract:
- Returns at least one element in every specified interval, or the default value if no element occurs during that interval.
- This is a sequential-only intermediate operation useful for handling sparse streams where you need regular output even when the source stream has periods of inactivity.
- <p> When no element arrives within the specified duration, the default value is emitted to maintain a consistent flow of data.
- This prevents timeout issues in downstream operations and helps maintain responsive UIs when displaying real-time data streams.
-
Parameters:
-
duration(Duration) — the maximum duration to wait for an element before emitting the default value; must be positive -
defaultValue(T) — the value to emit if no element occurs within the specified duration; can be null
-
- Returns: a new Stream that emits elements from the original stream or the default value if no element occurs within the duration
-
Throws:
-
java.lang.IllegalArgumentException— if duration is {@code null} or non-positive
-
- See also: #maxWait(Duration, Supplier),for dynamic default value generation, #window(Duration),for grouping elements by time windows, #delay(Duration),for adding delays between elements
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> maxWait(final Duration duration, final Supplier<? extends T> supplierForDefaultValue) throws IllegalArgumentException - Summary: Returns at least one element in every specified interval, or a value from the supplier if no element occurs during that interval.
-
Contract:
- Returns at least one element in every specified interval, or a value from the supplier if no element occurs during that interval.
- The supplier is called only when needed, allowing for expensive computations to be deferred or context-aware default values to be generated based on the current system state.
- <p> This method is particularly useful when default values need to be computed dynamically, such as timestamps, random values, or values that depend on external state.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Generate timestamp-based default values when no data arrives stream.maxWait(Duration.ofSeconds(5), () -> new Measurement("NO_DATA", System.currentTimeMillis())) .forEach(measurement -> processMeasurement(measurement)); // Use random values as defaults for missing sensor data Random random = new Random(); sensorStream.maxWait(Duration.ofSeconds(3), () -> new Reading(random.nextDouble() * 100)) .forEach(reading -> updateDisplay(reading)); } </pre>
-
Parameters:
-
duration(Duration) — the maximum duration to wait for an element before emitting a value from the supplier; must be positive -
supplierForDefaultValue(Supplier<? extends T>) — the supplier to provide a value if no element occurs within the specified duration; must not be {@code null} but may return {@code null} values
-
- Returns: a new Stream that emits elements from the original stream or values from the supplier if no element occurs within the duration
-
Throws:
-
java.lang.IllegalArgumentException— if duration is {@code null} or non-positive, or if supplierForDefaultValue is null
-
- See also: #maxWait(Duration, Object),for static default values, #window(Duration),for time-based windowing without defaults, #delay(Duration),for adding delays between elements
window(...) -> Stream<List<T>>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<List<T>> window(final Duration duration) - Summary: Splits this stream into fixed-duration windows of elements.
-
Contract:
- If no elements arrive during a window duration, an empty list is returned for that window.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive
-
- Returns: a new Stream where each element is a List < T > representing a window of elements from the original Stream
- See also: #window(Duration, Supplier),for custom collection types, #window(Duration, Collector),for custom aggregation, #window(Duration, Duration),for sliding windows, #sliding(int, int, Collector),for count-based sliding windows, #maxWait(Duration, Object),to ensure regular output
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration duration, final Supplier<? extends C> collectionSupplier) - Summary: Splits this stream into fixed-duration windows using a custom collection type.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
collectionSupplier(Supplier<? extends C>) — a Supplier that provides a new Collection instance for each window; must not be null
-
- Returns: a new Stream where each element is a Collection < T > representing a window of elements
- See also: #window(Duration),for default List windows, #window(Duration, Collector),for custom aggregation, #maxWait(Duration, Object),to ensure regular output
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration duration, final LongSupplier startTimeSupplier, final Supplier<? extends C> collectionSupplier) - Summary: Splits this stream into fixed-duration windows with a custom start time and collection type.
-
Contract:
- <p> The start time supplier is called once to determine when windowing begins.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
startTimeSupplier(LongSupplier) — a supplier that provides the start time for the first window in milliseconds since epoch -
collectionSupplier(Supplier<? extends C>) — a Supplier that provides a new Collection instance for each window
-
- Returns: a new Stream where each element is a Collection < T > representing a window of elements
- See also: #window(Duration, Supplier),for current time start, #maxWait(Duration, Object),to ensure regular output
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration duration, final Collector<? super T, ?, R> collector) - Summary: Splits this stream into fixed-duration windows and applies a collector to aggregate each window.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
collector(Collector<? super T, ?, R>) — a Collector to aggregate the elements in each window; must not be null
-
- Returns: a new Stream where each element is the result of applying the Collector to a window
- See also: #window(Duration),for collecting into lists, #window(Duration, Duration, Collector),for sliding window aggregation, #maxWait(Duration, Object),to ensure regular output
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration duration, final LongSupplier startTimeSupplier, final Collector<? super T, ?, R> collector) - Summary: Splits this stream into fixed-duration windows with custom start time and applies a collector.
-
Contract:
- <p> The start time supplier determines when the first window begins, and the collector processes each window's elements to produce an aggregated result.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
startTimeSupplier(LongSupplier) — the supplier function to provide the start time for the first window in milliseconds -
collector(Collector<? super T, ?, R>) — a Collector to aggregate the elements in each window
-
- Returns: a new Stream where each element is the result of applying the Collector to a window
- See also: #window(Duration, Collector),for current time start, #maxWait(Duration, Object),to ensure regular output
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<List<T>> window(final Duration duration, final Duration increment) - Summary: Creates sliding windows with specified duration and increment.
-
Contract:
- Sliding windows can overlap when the increment is less than the duration, providing a moving view over the stream data.
- When increment is less than duration, windows overlap, allowing elements to appear in multiple windows.
- When increment equals duration, windows are adjacent (tumbling windows).
- When increment exceeds duration, there are gaps between windows.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for the start of each window; must be positive
-
- Returns: a new Stream where each element is a list of elements from the overlapping windows
- See also: #window(Duration),for non-overlapping windows, #window(Duration, Duration, Collector),for sliding window aggregation, #sliding(int, int, Collector),for count-based sliding windows
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration duration, final Duration increment, final Supplier<? extends C> collectionSupplier) - Summary: Creates sliding windows with custom collection type.
-
Contract:
- Overlapping windows will contain some of the same elements when increment is less than duration.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for window starts; must be positive -
collectionSupplier(Supplier<? extends C>) — the supplier function to provide a new collection for each window
-
- Returns: a new Stream where each element is a collection from a sliding window
- See also: #window(Duration, Duration),for list-based sliding windows, #window(Duration, Supplier),for non-sliding custom collections
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration duration, final Duration increment, final LongSupplier startTimeSupplier, final Supplier<? extends C> collectionSupplier) - Summary: Creates sliding windows with custom start time and collection type.
-
Contract:
- <p> The start time supplier determines when the first window begins.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for window starts; must be positive -
startTimeSupplier(LongSupplier) — the supplier for the first window's start time in milliseconds -
collectionSupplier(Supplier<? extends C>) — the supplier for new collection instances
-
- Returns: a new Stream where each element is a collection from a sliding window
- See also: #window(Duration, Duration, Supplier),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration duration, final Duration increment, final Collector<? super T, ?, R> collector) - Summary: Creates sliding windows and applies a collector to aggregate each window.
-
Contract:
- When windows overlap (increment < duration), elements contribute to multiple aggregations, providing smooth transitions in the results.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for window starts; must be positive -
collector(Collector<? super T, ?, R>) — a Collector to aggregate elements in each window
-
- Returns: a new Stream where each element is an aggregation result from a sliding window
- See also: #window(Duration, Duration),for list-based sliding windows, #window(Duration, Collector),for non-sliding aggregation
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration duration, final Duration increment, final LongSupplier startTimeSupplier, final Collector<? super T, ?, R> collector) - Summary: Creates sliding windows with custom start time and applies a collector.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for window starts; must be positive -
startTimeSupplier(LongSupplier) — the supplier for the first window's start time in milliseconds -
collector(Collector<? super T, ?, R>) — a Collector to aggregate elements in each window
-
- Returns: a new Stream where each element is an aggregation result from a sliding window
- See also: #window(Duration, Duration, Collector),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration duration, final Duration increment, final LongSupplier startTimeSupplier, final WindowHandler<T, R> windowHandler, final Collector<? super T, ?, R> collector) - Summary: Creates sliding windows with custom window handler and collector.
-
Parameters:
-
duration(Duration) — the duration for each window; must be positive -
increment(Duration) — the increment duration for window starts; must be positive -
startTimeSupplier(LongSupplier) — the supplier for the first window's start time -
windowHandler(WindowHandler<T, R>) — handler for late data and custom window operations; may be null -
collector(Collector<? super T, ?, R>) — a Collector to aggregate elements in each window
-
- Returns: a new Stream with aggregated sliding window results
- See also: WindowHandler,for customization options, #window(Duration, Duration, LongSupplier, Collector),for simpler sliding windows
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<List<T>> window(final Duration maxDuration, final int maxWindowSize) - Summary: Creates bounded windows limited by both duration and element count.
-
Contract:
- Windows close when either the time limit expires or the maximum number of elements is reached, whichever occurs first.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window; must be positive -
maxWindowSize(int) — the maximum number of elements for each window; must be positive
-
- Returns: a new Stream where each element is a list of bounded window elements
- See also: #window(Duration),for time-only windows, #window(Duration, int, Collector),for bounded window aggregation, #sliding(int, int),for count-only windows
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration maxDuration, final int maxWindowSize, final Supplier<? extends C> collectionSupplier) - Summary: Creates bounded windows with custom collection type.
-
Contract:
- Windows close and emit their contents when either limit is reached, ensuring predictable memory usage and latency bounds.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window; must be positive -
maxWindowSize(int) — the maximum number of elements; must be positive -
collectionSupplier(Supplier<? extends C>) — the supplier for new collection instances
-
- Returns: a new Stream where each element is a bounded collection
- See also: #window(Duration, int),for list-based bounded windows, #window(Duration, Supplier),for time-only custom collections
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window(final Duration maxDuration, final int maxWindowSize, final LongSupplier startTimeSupplier, final Supplier<? extends C> collectionSupplier) - Summary: Creates bounded windows with custom start time and collection type.
-
Contract:
- <p> The start time supplier determines when windowing begins, enabling synchronization across streams or alignment to time boundaries while maintaining size limits for predictable resource usage.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window -
maxWindowSize(int) — the maximum number of elements -
startTimeSupplier(LongSupplier) — the supplier for start time in milliseconds -
collectionSupplier(Supplier<? extends C>) — the supplier for collection instances
-
- Returns: a new Stream where each element is a bounded collection
- See also: #window(Duration, int, Supplier),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration maxDuration, final int maxWindowSize, final Collector<? super T, ?, R> collector) - Summary: Creates bounded windows and applies a collector for aggregation.
-
Contract:
- <p> The collector processes each window independently when either limit is reached.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window -
maxWindowSize(int) — the maximum number of elements -
collector(Collector<? super T, ?, R>) — a Collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
- See also: #window(Duration, int),for list-based bounded windows, #window(Duration, Collector),for time-only aggregation
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration maxDuration, final int maxWindowSize, final LongSupplier startTimeSupplier, final Collector<? super T, ?, R> collector) - Summary: Creates bounded windows with custom start time and applies a collector.
-
Contract:
- <p> Windows start at the specified time and close when either the duration or size limit is reached.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window -
maxWindowSize(int) — the maximum number of elements -
startTimeSupplier(LongSupplier) — the supplier for start time in milliseconds -
collector(Collector<? super T, ?, R>) — a Collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
- See also: #window(Duration, int, Collector),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final Duration maxDuration, final int maxWindowSize, final LongSupplier startTimeSupplier, final WindowHandler<T, R> windowHandler, final Collector<? super T, ?, R> collector) - Summary: Creates bounded windows with window handler and collector.
-
Contract:
- Windows close when either limit is reached, with sophisticated stream processing capabilities.
-
Parameters:
-
maxDuration(Duration) — the maximum duration for each window -
maxWindowSize(int) — the maximum number of elements -
startTimeSupplier(LongSupplier) — the supplier for start time -
windowHandler(WindowHandler<T, R>) — handler for late data and custom operations -
collector(Collector<? super T, ?, R>) — a Collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
- See also: WindowHandler,for customization options, #window(Duration, int, LongSupplier, Collector),for simpler bounded windows
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<List<T>> window( final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter) - Summary: Creates windows based on a custom splitter predicate.
-
Contract:
- This advanced method provides complete control over window boundaries using a predicate that examines the window state and determines when to start a new window.
- <p> The window splitter predicate receives: <ul> <li> The first element in the current window (with timestamp) </li> <li> The current (latest) element in the current window (with timestamp) </li> <li> The next element to be evaluated (with timestamp) </li> <li> The current count of elements in the window </li> </ul> <p> The predicate returns {@code true} when the next element should start a new window, {@code false} to include it in the current window.
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Split windows when gap between elements exceeds 1 second stream.window((first, current, next, count) -> next.timestamp() - current.timestamp() > 1000) .forEach(window -> processSessionWindow(window)); // Split on value changes with size limit dataStream.window((first, current, next, count) -> !current.value().getType().equals(next.value().getType()) || count >= 100) .forEach(window -> processHomogeneousWindow(window)); } </pre>
-
Parameters:
-
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — a QuadPredicate determining when to split the window
-
- Returns: a new Stream where each element is a list from a custom window
- See also: #window(QuadPredicate, Supplier),for custom collection types, #window(QuadPredicate, Collector),for custom aggregation, NoCachingNoUpdating.Timed,for the timed element wrapper
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window( final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final Supplier<? extends C> collectionSupplier) - Summary: Creates custom windows with specified collection type.
-
Parameters:
-
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — a QuadPredicate determining when to split -
collectionSupplier(Supplier<? extends C>) — a Supplier for new collection instances
-
- Returns: a new Stream where each element is a custom collection
- See also: #window(QuadPredicate),for list-based custom windows, NoCachingNoUpdating.Timed,for the timed element wrapper
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window( final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final LongSupplier startTimeSupplier, final Supplier<? extends C> collectionSupplier) throws IllegalStateException, IllegalArgumentException - Summary: Creates custom windows with specified collection type and start time.
-
Contract:
- <p> The start time supplier provides timestamps for elements if they don't have inherent timestamps, enabling custom windowing on any stream type.
-
Parameters:
-
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — a QuadPredicate determining when to split -
startTimeSupplier(LongSupplier) — a LongSupplier for the start time -
collectionSupplier(Supplier<? extends C>) — a Supplier for collection instances
-
- Returns: a new Stream where each element is a custom collection
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException— if parameters are null
-
- See also: #window(QuadPredicate, Supplier),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window( final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final Collector<? super T, ?, R> collector) - Summary: Creates custom windows and applies a collector for aggregation.
-
Parameters:
-
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — a QuadPredicate determining when to split -
collector(Collector<? super T, ?, R>) — a Collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
- See also: #window(QuadPredicate),for list-based custom windows, <a href="https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#handling-late-data-and-watermarking">,Handling Late Data and Watermarking,</a>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window( final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final LongSupplier startTimeSupplier, final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException - Summary: Creates custom windows with specified start time and collector.
-
Parameters:
-
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — a QuadPredicate determining when to split -
startTimeSupplier(LongSupplier) — a LongSupplier for the start time -
collector(Collector<? super T, ?, R>) — a Collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException— if parameters are null
-
- See also: #window(QuadPredicate, Collector),for current time start
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<List<T>> window(final ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> maxWaitForNextInMillis, final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter) - Summary: Creates windows with custom timeout and splitting logic.
-
Contract:
- The splitter determines if a received element should start a new window.
-
Parameters:
-
maxWaitForNextInMillis(ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — function to calculate timeout in milliseconds -
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — predicate to determine window boundaries
-
- Returns: a new Stream where each element is a list from a timeout window
- See also: #window(QuadPredicate),for simple custom windows, NoCachingNoUpdating.Timed,for the timed element wrapper
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window( final ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> maxWaitForNextInMillis, final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final Supplier<? extends C> collectionSupplier) - Summary: Creates windows with custom timeout, splitting, and collection type.
-
Parameters:
-
maxWaitForNextInMillis(ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — function to calculate timeout -
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — predicate to determine boundaries -
collectionSupplier(Supplier<? extends C>) — supplier for collection instances
-
- Returns: a new Stream where each element is a custom collection
- See also: #window(ToLongTriFunction, QuadPredicate),for list-based
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <C extends Collection<T>> Stream<C> window( final ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> maxWaitForNextInMillis, final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final LongSupplier startTimeSupplier, final Supplier<? extends C> collectionSupplier) - Summary: Creates windows with custom timeout, splitting, collection, and start time.
-
Contract:
- <p> <b> Usage Examples: </b> </p> <pre> {@code // Synchronized adaptive windows long syncTime = getGlobalSyncTime(); stream.window( (first, current, count) -> calculateAdaptiveTimeout(first, current), (first, current, next, count) -> shouldSplitWindow(current, next), () -> syncTime, ArrayList::new) .forEach(window -> processAdaptiveWindow(window)); } </pre>
-
Parameters:
-
maxWaitForNextInMillis(ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — function to calculate timeout -
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — predicate to determine boundaries -
startTimeSupplier(LongSupplier) — supplier for start time -
collectionSupplier(Supplier<? extends C>) — supplier for collections
-
- Returns: a new Stream where each element is a custom collection
- See also: #window(ToLongTriFunction, QuadPredicate, Supplier),for current time
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> maxWaitForNextInMillis, final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final Collector<? super T, ?, R> collector) - Summary: Creates windows with custom timeout, splitting, and aggregation.
-
Contract:
- <p> Windows close when either the timeout expires (no element arrives within the calculated time) or the splitter indicates a boundary.
-
Parameters:
-
maxWaitForNextInMillis(ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — function to calculate timeout -
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — predicate to determine boundaries -
collector(Collector<? super T, ?, R>) — collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
- See also: #window(ToLongTriFunction, QuadPredicate),for list-based
-
Signature:
@Beta @SequentialOnly @IntermediateOp public <R> Stream<R> window(final ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> maxWaitForNextInMillis, final QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer> windowSplitter, final LongSupplier startTimeSupplier, final Collector<? super T, ?, R> collector) throws IllegalStateException, IllegalArgumentException - Summary: Creates windows with full customization of timeout, splitting, timing, and aggregation.
-
Parameters:
-
maxWaitForNextInMillis(ToLongTriFunction<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — function to calculate timeout in milliseconds -
windowSplitter(QuadPredicate<NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, NoCachingNoUpdating.Timed<T>, Integer>) — predicate to determine window boundaries -
startTimeSupplier(LongSupplier) — supplier for the start time in milliseconds -
collector(Collector<? super T, ?, R>) — collector to aggregate window elements
-
- Returns: a new Stream where each element is an aggregation result
-
Throws:
-
java.lang.IllegalStateException -
java.lang.IllegalArgumentException— if required parameters are null
-
- See also: #window(ToLongTriFunction, QuadPredicate, Collector),for simpler timeout windows
addSubscriber(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> addSubscriber(final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction) - Summary: Attaches a new stream with its own terminal operation to consume elements from the upstream.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action.
-
- Returns: the main stream with the attached subscriber
- See also: #addSubscriber(Throwables.Consumer, int, long, Executor)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> addSubscriber(final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction, final int queueSize, final long maxWaitForAddingElementToQuery, final Executor executor) throws IllegalStateException, IllegalArgumentException - Summary: Attaches a new stream with its own terminal operation to consume elements from the upstream.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action. -
queueSize(int) — the size of the queue. Default value is 64. Must be positive. -
maxWaitForAddingElementToQuery(long) — max wait time to add the next element to queue for subscriber stream to consume. Default value is 30000 (unit is milliseconds). Must be positive. If the next element can't be added to queue after waiting for the period, an exception will be thrown in the subscriber stream. -
executor(Executor) — the executor to run the attached stream.
-
- Returns: the main stream with the attached subscriber
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
java.lang.IllegalArgumentException— if any parameter is invalid
-
filterWhileAddSubscriber(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> filterWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction) - Summary: Attaches a new stream with its own terminal operation to consume elements filtered out by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action.
-
- Returns: the main stream with the attached subscriber
- See also: #filterWhileAddSubscriber(Predicate, Throwables.Consumer, int, long, Executor), #addSubscriber(Throwables.Consumer, int, long, Executor), #filter(Predicate, Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> filterWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction, final int queueSize, final long maxWaitForAddingElementToQuery, final Executor executor) throws IllegalStateException, IllegalArgumentException - Summary: Attaches a new stream with its own terminal operation to consume elements filtered out by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action. -
queueSize(int) — the size of the queue. Default value is 64. Must be positive. -
maxWaitForAddingElementToQuery(long) — max wait time to add the next element to queue for subscriber stream to consume. Default value is 30000 (unit is milliseconds). Must be positive. If the next element can't be added to queue after waiting for the period, an exception will be thrown in the subscriber stream. -
executor(Executor) — the executor to run the attached stream.
-
- Returns: the main stream with the attached subscriber
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
java.lang.IllegalArgumentException— if any parameter is invalid
-
- See also: #addSubscriber(Throwables.Consumer, int, long, Executor), #filter(Predicate, Consumer)
takeWhileAddSubscriber(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> takeWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction) - Summary: Attaches a new stream with its own terminal operation to consume elements not taken by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action.
-
- Returns: the main stream with the attached subscriber
- See also: #takeWhileAddSubscriber(Predicate, Throwables.Consumer, Executor), #addSubscriber(Throwables.Consumer, int, long, Executor)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> takeWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction, final Executor executor) throws IllegalArgumentException - Summary: Attaches a new stream with its own terminal operation to consume elements not taken by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action. -
executor(Executor) — the executor to run the attached stream.
-
- Returns: the main stream with the attached subscriber
-
Throws:
-
java.lang.IllegalArgumentException— if any parameter is null
-
- See also: #addSubscriber(Throwables.Consumer, int, long, Executor)
dropWhileAddSubscriber(...) -> Stream<T>
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> dropWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction) - Summary: Attaches a new stream with its own terminal operation to consume elements dropped by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action.
-
- Returns: the main stream with the attached subscriber
- See also: #dropWhileAddSubscriber(Predicate, Throwables.Consumer, int, long, Executor), #addSubscriber(Throwables.Consumer, int, long, Executor), #dropWhile(Predicate, Consumer)
-
Signature:
@Beta @SequentialOnly @IntermediateOp public Stream<T> dropWhileAddSubscriber(final Predicate<? super T> predicate, final Throwables.Consumer<? super Stream<T>, ? extends Exception> consumerForNewStreamWithTerminalAction, final int queueSize, final long maxWaitForAddingElementToQuery, final Executor executor) throws IllegalStateException, IllegalArgumentException - Summary: Attaches a new stream with its own terminal operation to consume elements dropped by the specified predicate.
-
Contract:
- The new thread is started when the main stream receives the first element or is closed if there are no elements.
- <p> After the main stream is finished, the attached stream will continue to pull remaining elements from upstream if needed.
- However, when the main stream is closed, it will wait for the attached stream to close before calling close actions.
-
Parameters:
-
predicate(Predicate<? super T>) — the predicate to test elements. -
consumerForNewStreamWithTerminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the consumer for the new stream with terminal action. -
queueSize(int) — the size of the queue. Default value is 64. Must be positive. -
maxWaitForAddingElementToQuery(long) — max wait time to add the next element to queue for subscriber stream to consume. Default value is 30000 (unit is milliseconds). Must be positive. If the next element can't be added to queue after waiting for the period, an exception will be thrown in the subscriber stream. -
executor(Executor) — the executor to run the attached stream.
-
- Returns: the main stream with the attached subscriber
-
Throws:
-
java.lang.IllegalStateException— if the stream is already closed -
java.lang.IllegalArgumentException— if any parameter is invalid
-
- See also: #addSubscriber(Throwables.Consumer, int, long, Executor), #dropWhile(Predicate, Consumer)
asyncRun(...) -> ContinuableFuture<Void>
-
Signature:
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(final Throwables.Consumer<? super Stream<T>, ? extends Exception> terminalAction) throws IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this Stream.
-
Parameters:
-
terminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the terminal operation to be executed on this Stream.
-
- Returns: a ContinuableFuture representing the result of the asynchronous computation
-
Throws:
-
java.lang.IllegalArgumentException— if terminalAction is null
-
-
Signature:
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(final Throwables.Consumer<? super Stream<T>, ? extends Exception> terminalAction, final Executor executor) throws IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this Stream using the specified Executor.
-
Parameters:
-
terminalAction(Throwables.Consumer<? super Stream<T>, ? extends Exception>) — the terminal operation to be executed on this Stream. -
executor(Executor) — the Executor to use for asynchronous execution.
-
- Returns: a ContinuableFuture representing the result of the asynchronous computation
-
Throws:
-
java.lang.IllegalArgumentException— if terminalAction or executor is null
-
asyncCall(...) -> ContinuableFuture<R>
-
Signature:
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(final Throwables.Function<? super Stream<T>, R, ? extends Exception> terminalAction) throws IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this Stream and returns its result.
-
Parameters:
-
terminalAction(Throwables.Function<? super Stream<T>, R, ? extends Exception>) — the terminal operation to be executed on this Stream.
-
- Returns: a ContinuableFuture representing the result of the asynchronous computation
-
Throws:
-
java.lang.IllegalArgumentException— if terminalAction is null
-
-
Signature:
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(final Throwables.Function<? super Stream<T>, R, ? extends Exception> terminalAction, final Executor executor) throws IllegalArgumentException - Summary: Executes the provided terminal operation asynchronously on this Stream using the specified Executor and returns its result.
-
Parameters:
-
terminalAction(Throwables.Function<? super Stream<T>, R, ? extends Exception>) — the terminal operation to be executed on this Stream. -
executor(Executor) — the Executor to use for asynchronous execution.
-
- Returns: a ContinuableFuture representing the result of the asynchronous computation
-
Throws:
-
java.lang.IllegalArgumentException— if terminalAction or executor is null
-
Class StreamEx (com.landawn.abacus.util.stream.Stream.StreamEx)
Extended stream class providing additional stream operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
- (none)
Interface WindowHandler (com.landawn.abacus.util.stream.Stream.WindowHandler)
Handler for windowing operations with support for late data handling.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
of(...) -> WindowHandler<T, R>
-
Signature:
static <T, R> WindowHandler<T, R> of(final ToLongFunction<? super T> timeExtractor) - Summary: Creates a WindowHandler with the specified time extractor.
-
Parameters:
-
timeExtractor(ToLongFunction<? super T>) — the function to extract timestamps from elements
-
- Returns: a WindowHandler instance
-
Signature:
static <T, R> WindowHandler<T, R> of(final BiConsumer<? super T, ? super R> onLateDataAction) - Summary: Creates a WindowHandler with the specified late data action.
-
Parameters:
-
onLateDataAction(BiConsumer<? super T, ? super R>) — the action to perform when late data is received
-
- Returns: a WindowHandler instance
-
Signature:
static <T, R> WindowHandler<T, R> of(final int cacheSize, final boolean delayForLateData, final ToLongFunction<? super T> timeExtractor, final BiConsumer<? super T, ? super R> onLateDataAction) - Summary: Creates a WindowHandler with the specified configuration.
-
Parameters:
-
cacheSize(int) — the cache size for late data -
delayForLateData(boolean) — whether to delay window results for late data -
timeExtractor(ToLongFunction<? super T>) — the function to extract timestamps from elements -
onLateDataAction(BiConsumer<? super T, ? super R>) — the action to perform when late data is received
-
- Returns: a WindowHandler instance
builder(...) -> WindowHandlerBuilder<T, R>
-
Signature:
static <T, R> WindowHandlerBuilder<T, R> builder() - Summary: Creates a new WindowHandlerBuilder for constructing WindowHandler instances.
-
Parameters:
- (none)
- Returns: a WindowHandlerBuilder instance
Public Instance Methods
cacheSizeForLateData(...) -> int
-
Signature:
default int cacheSizeForLateData() - Summary: Returns the maximum window result cache size that late data can reach.
-
Parameters:
- (none)
- Returns: the maximum cache size for late data (default is 9)
delayForLateData(...) -> boolean
-
Signature:
default boolean delayForLateData() - Summary: Returns whether to delay window result to reflect late data update.
-
Contract:
- If {@code false} is returned, late data update may not be reflected in the earlier window result if it's retrieved before the late data arrives.
-
Parameters:
- (none)
- Returns: {@code true} to delay window results for late data, {@code false} otherwise (default is {@code false} )
timeExtractor(...) -> ToLongFunction<T>
-
Signature:
default ToLongFunction<T> timeExtractor() - Summary: Returns the time extractor function to extract timestamp from elements.
-
Parameters:
- (none)
- Returns: the time extractor function, or {@code null} if not set (default is {@code null} )
timeWrapper(...) -> ObjLongFunction<T, Timed<T>>
-
Signature:
default ObjLongFunction<T, Timed<T>> timeWrapper() - Summary: Returns the time wrapper function to wrap elements with their timestamps.
-
Parameters:
- (none)
- Returns: the time wrapper function, or {@code null} if not set (default is {@code null} )
onLateDataAction(...) -> OnLateDataAction<T, R>
-
Signature:
default OnLateDataAction<T, R> onLateDataAction() - Summary: Returns the action to be performed when late data is received.
-
Contract:
- Returns the action to be performed when late data is received.
-
Parameters:
- (none)
- Returns: the late data action, or {@code null} if not set (default is {@code null} )
Class WindowHandlerBuilder (com.landawn.abacus.util.stream.Stream.WindowHandler.WindowHandlerBuilder)
Builder for constructing WindowHandler instances with a fluent API.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
cacheSizeForLateData(...) -> WindowHandlerBuilder<T, R>
-
Signature:
public WindowHandlerBuilder<T, R> cacheSizeForLateData(final int cacheSizeForLateData) - Summary: Sets the cache size for late data.
-
Parameters:
-
cacheSizeForLateData(int) — the cache size for late data
-
- Returns: this builder instance
delayForLateData(...) -> WindowHandlerBuilder<T, R>
-
Signature:
public WindowHandlerBuilder<T, R> delayForLateData(final boolean delayForLateData) - Summary: Sets whether to delay window results for late data.
-
Parameters:
-
delayForLateData(boolean) — whether to delay window results for late data
-
- Returns: this builder instance
timeExtractor(...) -> WindowHandlerBuilder<T, R>
-
Signature:
public WindowHandlerBuilder<T, R> timeExtractor(final ToLongFunction<? super T> timeExtractor) - Summary: Sets the time extractor function to extract timestamps from elements.
-
Parameters:
-
timeExtractor(ToLongFunction<? super T>) — the function to extract timestamps from elements
-
- Returns: this builder instance
timeWrapper(...) -> WindowHandlerBuilder<T, R>
-
Signature:
public WindowHandlerBuilder<T, R> timeWrapper(final ObjLongFunction<? super T, Timed<T>> timeWrapper) - Summary: Sets the time wrapper function to wrap elements with their timestamps.
-
Parameters:
-
timeWrapper(ObjLongFunction<? super T, Timed<T>>) — the function to wrap elements with their timestamps
-
- Returns: this builder instance
onLateData(...) -> WindowHandlerBuilder<T, R>
-
Signature:
public WindowHandlerBuilder<T, R> onLateData(final BiConsumer<? super T, ? super R> onLateDataAction) - Summary: Sets the action to perform when late data is received.
-
Contract:
- Sets the action to perform when late data is received.
-
Parameters:
-
onLateDataAction(BiConsumer<? super T, ? super R>) — the action to perform when late data is received
-
- Returns: this builder instance
-
Signature:
public WindowHandlerBuilder<T, R> onLateData(final OnLateDataAction<T, R> onLateDataAction) - Summary: Sets the late data action to perform when late data is received.
-
Contract:
- Sets the late data action to perform when late data is received.
-
Parameters:
-
onLateDataAction(OnLateDataAction<T, R>) — the late data action
-
- Returns: this builder instance
build(...) -> WindowHandler<T, R>
-
Signature:
public WindowHandler<T, R> build() - Summary: Builds and returns a WindowHandler instance with the configured settings.
-
Parameters:
- (none)
- Returns: a WindowHandler instance
Interface OnLateDataAction (com.landawn.abacus.util.stream.Stream.WindowHandler.OnLateDataAction)
Functional interface for handling late data events in windowing operations.
Thread-safety: unspecified Nullability: unspecified
Public Constructors
- (none)
Public Static Methods
- (none)
Public Instance Methods
accept(...) -> void
-
Signature:
void accept(long windowStartTime, long windowEndTime, long eventTime, T element, R windowResultContainer) - Summary: Performs the action for late data.
-
Parameters:
-
windowStartTime(long) — the start time of the window -
windowEndTime(long) — the end time of the window -
eventTime(long) — the timestamp of the late data event -
element(T) — the late data element -
windowResultContainer(R) — the window result container
-